|
54 | 54 | <div class="d-flex task-detail-right-side-label"> |
55 | 55 | <h4>{{$t('Comment.created_by')}}</h4> |
56 | 56 | <Skelaton v-if="!task?.Task_Leader && isMainSpinner" style="height: 30px;" class="w-30px border-radius-50-per"/> |
57 | | - <div v-else class="d-flex align-items-center"> |
58 | | - <UserProfile |
59 | | - :data="{ |
60 | | - image: taskLeaderData.Employee_profileImageURL, |
61 | | - title: taskLeaderData.Employee_Name |
62 | | - }" |
63 | | - :showDot="false" |
64 | | - width="30px" |
65 | | - :thumbnail="'30x30'" |
66 | | - /> |
67 | | - <span |
68 | | - class="black text-ellipsis task-created-by" |
69 | | - :class="{'font-size-13 font-weight-400' : clientWidth > 767, 'font-size-16' : clientWidth <=767}" |
70 | | - :title="taskLeaderData?.Employee_Name || 'N/A'"> |
71 | | - {{ taskLeaderData?.Employee_Name || 'N/A' }} |
72 | | - </span> |
73 | | - </div> |
| 57 | + <template v-else> |
| 58 | + <!-- Editable picker — gated by the same permission as Assignee. --> |
| 59 | + <div |
| 60 | + v-if="checkPermission('task.task_assignee',project?.isGlobalPermission) === true && checkPermission('task.task_list',project?.isGlobalPermission) == true" |
| 61 | + class="d-flex align-items-center" |
| 62 | + > |
| 63 | + <Assignee |
| 64 | + :numOfUsers="1" |
| 65 | + :users="task.Task_Leader ? [task.Task_Leader] : []" |
| 66 | + :addUser="true" |
| 67 | + :options="permittedOptions" |
| 68 | + @selected="updateTaskLeader($event)" |
| 69 | + imageWidth="30px" |
| 70 | + :showAddUser="false" |
| 71 | + :zIndexAssigne="props.zIndexAssigne" |
| 72 | + :isDisplayTeam="false" |
| 73 | + :multiSelect="false" |
| 74 | + /> |
| 75 | + <span |
| 76 | + class="black text-ellipsis task-created-by ml-5px" |
| 77 | + :class="{'font-size-13 font-weight-400' : clientWidth > 767, 'font-size-16' : clientWidth <=767}" |
| 78 | + :title="taskLeaderData?.Employee_Name || 'N/A'"> |
| 79 | + {{ taskLeaderData?.Employee_Name || 'N/A' }} |
| 80 | + </span> |
| 81 | + </div> |
| 82 | + <!-- Read-only display — original behaviour for users without permission. --> |
| 83 | + <div v-else class="d-flex align-items-center"> |
| 84 | + <UserProfile |
| 85 | + :data="{ |
| 86 | + image: taskLeaderData.Employee_profileImageURL, |
| 87 | + title: taskLeaderData.Employee_Name |
| 88 | + }" |
| 89 | + :showDot="false" |
| 90 | + width="30px" |
| 91 | + :thumbnail="'30x30'" |
| 92 | + /> |
| 93 | + <span |
| 94 | + class="black text-ellipsis task-created-by" |
| 95 | + :class="{'font-size-13 font-weight-400' : clientWidth > 767, 'font-size-16' : clientWidth <=767}" |
| 96 | + :title="taskLeaderData?.Employee_Name || 'N/A'"> |
| 97 | + {{ taskLeaderData?.Employee_Name || 'N/A' }} |
| 98 | + </span> |
| 99 | + </div> |
| 100 | + </template> |
74 | 101 | </div> |
75 | 102 | <div class="d-flex task-detail-right-side-label" v-if="checkPermission('task.task_priority',project?.isGlobalPermission) !== null && checkApps('Priority')"> |
76 | 103 | <h4>{{$t('Projects.priority')}}</h4> |
@@ -357,6 +384,44 @@ const updateAssignee = (event, type) =>{ |
357 | 384 | } |
358 | 385 | } |
359 | 386 |
|
| 387 | +const updateTaskLeader = (event) => { |
| 388 | + try { |
| 389 | + if (!event || !event.id) return; |
| 390 | + if (event.id === props.task.Task_Leader) return; |
| 391 | + const userData = getUserData(); |
| 392 | +
|
| 393 | + const updateObject = { |
| 394 | + Task_Leader: event.id |
| 395 | + } |
| 396 | +
|
| 397 | + const projectData = { |
| 398 | + _id: project.value._id, |
| 399 | + CompanyId: project.value.CompanyId, |
| 400 | + lastTaskId: project.value.lastTaskId, |
| 401 | + ProjectName: project.value.ProjectName, |
| 402 | + ProjectCode: project.value.ProjectCode |
| 403 | + } |
| 404 | +
|
| 405 | + taskClass.updateTaskLeader({ |
| 406 | + firebaseObj: updateObject, |
| 407 | + projectData: projectData, |
| 408 | + taskData: props.task, |
| 409 | + employeeName: getUser(event.id).Employee_Name, |
| 410 | + userData |
| 411 | + }) |
| 412 | + .then(() => { |
| 413 | + $toast.success(t('Toast.Created_by_updated_successfully'), { position: 'top-right' }); |
| 414 | + }) |
| 415 | + .catch((error) => { |
| 416 | + console.error("ERROR in updateTaskLeader: ", error); |
| 417 | + $toast.error(t('Toast.Created_by_not_updated'), { position: 'top-right' }); |
| 418 | + }) |
| 419 | + } catch (error) { |
| 420 | + console.error(error); |
| 421 | + $toast.error(t('Toast.Created_by_not_updated'), { position: 'top-right' }); |
| 422 | + } |
| 423 | +} |
| 424 | +
|
360 | 425 | const updatePriority = async(val) => { |
361 | 426 | try { |
362 | 427 | const userData = getUserData(); |
|
0 commit comments