Added multiple labor rates to employees
IO-548
This commit is contained in:
@@ -44,24 +44,42 @@ export function TimeTicketModalContainer({
|
||||
);
|
||||
|
||||
const handleFinish = (values) => {
|
||||
const emps = EmployeeAutoCompleteData.employees.filter(
|
||||
(e) => e.id === values.employeeid
|
||||
);
|
||||
if (timeTicketModal.context.id) {
|
||||
updateTicket({
|
||||
variables: {
|
||||
timeticketId: timeTicketModal.context.id,
|
||||
timeticket: values,
|
||||
timeticket: {
|
||||
...values,
|
||||
rate:
|
||||
emps.length === 1
|
||||
? emps[0].rates.filter(
|
||||
(r) => r.cost_center === values.cost_center
|
||||
)[0].rate
|
||||
: null,
|
||||
},
|
||||
},
|
||||
})
|
||||
.then(handleMutationSuccess)
|
||||
.catch(handleMutationError);
|
||||
} else {
|
||||
//Get selected employee rate.
|
||||
const rate = EmployeeAutoCompleteData.employees.filter(
|
||||
(i) => i.id === values.employeeid
|
||||
)[0].base_rate;
|
||||
|
||||
insertTicket({
|
||||
variables: {
|
||||
timeTicketInput: [{ ...values, rate, bodyshopid: bodyshop.id }],
|
||||
timeTicketInput: [
|
||||
{
|
||||
...values,
|
||||
rate:
|
||||
emps.length === 1
|
||||
? emps[0].rates.filter(
|
||||
(r) => r.cost_center === values.cost_center
|
||||
)[0].rate
|
||||
: null,
|
||||
bodyshopid: bodyshop.id,
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
.then(handleMutationSuccess)
|
||||
@@ -196,7 +214,6 @@ export function TimeTicketModalContainer({
|
||||
employeeAutoCompleteOptions={
|
||||
EmployeeAutoCompleteData && EmployeeAutoCompleteData.employees
|
||||
}
|
||||
responsibilityCenters={bodyshop.md_responsibility_centers || null}
|
||||
loadLineTicketData={loadLineTicketData}
|
||||
lineTicketData={
|
||||
lineTicketData ? lineTicketData : { joblines: [], timetickets: [] }
|
||||
|
||||
Reference in New Issue
Block a user