Merged in feature/IO-2677-Tasks (pull request #1427)

Feature/IO-2677 Tasks

Approved-by: Patrick Fic
This commit is contained in:
Allan Carr
2024-04-19 16:29:32 +00:00
committed by Patrick Fic
38 changed files with 165 additions and 60 deletions

View File

@@ -236,6 +236,7 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
<EmployeeSearchSelect options={employeeData ? employeeData.employees : []} />
</Form.Item>
);
//This was introduced with tasks before assigned_to was shifted to UUID. Keeping in place for reference in the future if needed.
if (idtype === "employeeWithEmail")
return (
<Form.Item

View File

@@ -149,7 +149,7 @@ function TaskListComponent({
sorter: true,
sortOrder: sortcolumn === "assigned_to" && sortorder,
render: (text, record) => {
const employee = bodyshop?.employees?.find((e) => e.user_email === record.assigned_to);
const employee = bodyshop?.employees?.find((e) => e.id === record.assigned_to);
return employee ? `${employee.first_name} ${employee.last_name}` : t("general.labels.na");
}
});

View File

@@ -48,8 +48,8 @@ export function TaskListContainer({
bodyshop: bodyshop.id,
[relationshipType]: relationshipId,
deleted: deleted === "true",
completed: completed === "true",
assigned_to: mine === "true" ? currentUser.email : undefined, // replace currentUserID with the actual ID of the current user
completed: completed === "true", //TODO: Find where mine is set.
assigned_to: onlyMine ? bodyshop?.employees?.find((e) => e.user_email === currentUser.email)?.id : undefined, // replace currentUserID with the actual ID of the current user
offset: page ? (page - 1) * pageLimit : 0,
limit: pageLimit,
order: [

View File

@@ -224,9 +224,7 @@ export function TaskUpsertModalComponent({
label={t("tasks.fields.assigned_to")}
name="assigned_to"
initialValue={
bodyshop.employees.find((employee) => employee?.user_email === currentUser.email && employee.active)
? currentUser.email
: undefined
bodyshop.employees.find((employee) => employee?.user_email === currentUser.email && employee.active)?.id
}
rules={[
{
@@ -240,7 +238,7 @@ export function TaskUpsertModalComponent({
.filter((x) => x.active && x.user_email)
.map((employee) => ({
key: employee.id,
value: employee.user_email,
value: employee.id,
label: `${employee.first_name} ${employee.last_name}`
}))}
/>