IO-1979 Resolve various employee vacation bugs.

This commit is contained in:
Patrick Fic
2022-07-19 13:41:14 -07:00
parent 179147dc4e
commit d5f55c5873
8 changed files with 100 additions and 71 deletions

View File

@@ -14777,6 +14777,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>vacationadded</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children> </children>
</folder_node> </folder_node>
<folder_node> <folder_node>

View File

@@ -37,9 +37,12 @@ export function ScheduleCalendarHeaderComponent({
...otherProps ...otherProps
}) { }) {
const ATSToday = useMemo(() => { const ATSToday = useMemo(() => {
console.log("eeee", events);
if (!events) return []; if (!events) return [];
return _.groupBy( return _.groupBy(
events.filter((e) => moment(date).isSame(moment(e.start), "day")), events.filter(
(e) => !e.vacation && moment(date).isSame(moment(e.start), "day")
),
"job.alt_transport" "job.alt_transport"
); );
}, [events, date]); }, [events, date]);

View File

@@ -43,7 +43,7 @@ export default function ShopEmployeeAddVacation({ employee }) {
}); });
} else { } else {
notification["success"]({ notification["success"]({
message: t("employees.successes.added"), message: t("employees.successes.vacationadded"),
}); });
} }
setLoading(false); setLoading(false);

View File

@@ -1494,7 +1494,7 @@ export default function ShopInfoGeneral({ form }) {
} }
const ReceivableCustomFieldSelect = ( const ReceivableCustomFieldSelect = (
<Select> <Select allowClear>
<Select.Option value="v_vin">VIN</Select.Option> <Select.Option value="v_vin">VIN</Select.Option>
<Select.Option value="clm_no">Claim No.</Select.Option> <Select.Option value="clm_no">Claim No.</Select.Option>
<Select.Option value="ded_amt">Deductible Amount</Select.Option> <Select.Option value="ded_amt">Deductible Amount</Select.Option>

View File

@@ -1,75 +1,77 @@
import { gql } from "@apollo/client"; import { gql } from "@apollo/client";
export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql` export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql`
query QUERY_ALL_ACTIVE_APPOINTMENTS( query QUERY_ALL_ACTIVE_APPOINTMENTS(
$start: timestamptz! $start: timestamptz!
$end: timestamptz! $end: timestamptz!
$startd: date! $startd: date!
$endd: date! $endd: date!
) {
employee_vacation(
where: { _or: [{ start: { _gte: $startd } },
{ end: { _lte: $endd } },
{_and:[{start:{_lte: $startd}},{end:{_gte:$endd}}]}] }
) { ) {
employee_vacation( id
where: { _or: [{ start: { _gte: $startd } }, { end: { _lte: $endd } }] } start
) { end
employee {
id id
start last_name
end first_name
employee { }
id }
last_name appointments(
first_name where: {
canceled: { _eq: false }
end: { _lte: $end }
start: { _gte: $start }
}
) {
start
id
end
arrived
title
isintake
block
color
note
job {
alt_transport
ro_number
ownr_ln
ownr_co_nm
ownr_fn
ownr_ph1
ownr_ph2
ownr_ea
clm_total
id
clm_no
ins_co_nm
v_model_yr
v_make_desc
v_model_desc
labhrs: joblines_aggregate(
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(
where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }
) {
aggregate {
sum {
mod_lb_hrs
}
}
} }
} }
appointments(
where: {
canceled: { _eq: false }
end: { _lte: $end }
start: { _gte: $start }
}
) {
start
id
end
arrived
title
isintake
block
color
note
job {
alt_transport
ro_number
ownr_ln
ownr_co_nm
ownr_fn
ownr_ph1
ownr_ph2
ownr_ea
clm_total
id
clm_no
ins_co_nm
v_model_yr
v_make_desc
v_model_desc
labhrs: joblines_aggregate(
where: { mod_lbr_ty: { _neq: "LAR" }, removed: { _eq: false } }
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(
where: { mod_lbr_ty: { _eq: "LAR" }, removed: { _eq: false } }
) {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
} }
} }
`; `;

View File

@@ -922,7 +922,8 @@
}, },
"successes": { "successes": {
"delete": "Employee deleted successfully.", "delete": "Employee deleted successfully.",
"save": "Employee saved successfully." "save": "Employee saved successfully.",
"vacationadded": "Employee vacation added."
}, },
"validation": { "validation": {
"unique_employee_number": "You must enter a unique employee number." "unique_employee_number": "You must enter a unique employee number."

View File

@@ -922,7 +922,8 @@
}, },
"successes": { "successes": {
"delete": "Empleado eliminado con éxito.", "delete": "Empleado eliminado con éxito.",
"save": "Empleado guardado con éxito." "save": "Empleado guardado con éxito.",
"vacationadded": ""
}, },
"validation": { "validation": {
"unique_employee_number": "" "unique_employee_number": ""

View File

@@ -922,7 +922,8 @@
}, },
"successes": { "successes": {
"delete": "L'employé a bien été supprimé.", "delete": "L'employé a bien été supprimé.",
"save": "L'employé a enregistré avec succès." "save": "L'employé a enregistré avec succès.",
"vacationadded": ""
}, },
"validation": { "validation": {
"unique_employee_number": "" "unique_employee_number": ""