Merged in feature/IO-2517-All-Courtesy-Car-Warning (pull request #1128)

IO-2517 All Courtesy Car Warning Indicator

Approved-by: Dave Richer
This commit is contained in:
Allan Carr
2024-01-02 15:01:22 +00:00
committed by Dave Richer
2 changed files with 7 additions and 8 deletions

View File

@@ -214,10 +214,7 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
> >
<CourtesyCarStatus /> <CourtesyCarStatus />
</Form.Item> </Form.Item>
<Form.Item <Form.Item label={t("courtesycars.fields.readiness")} name="readiness">
label={t("courtesycars.fields.readiness")}
name="readiness"
>
<CourtesyCarReadiness /> <CourtesyCarReadiness />
</Form.Item> </Form.Item>
<div> <div>
@@ -234,8 +231,9 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
> >
{() => { {() => {
const nextservicekm = form.getFieldValue("nextservicekm"); const nextservicekm = form.getFieldValue("nextservicekm");
const mileageOver = const mileageOver = nextservicekm
nextservicekm && nextservicekm <= form.getFieldValue("mileage"); ? nextservicekm <= form.getFieldValue("mileage")
: false;
if (mileageOver) if (mileageOver)
return ( return (
<Space direction="vertical" style={{ color: "tomato" }}> <Space direction="vertical" style={{ color: "tomato" }}>

View File

@@ -74,10 +74,11 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) {
render: (text, record) => { render: (text, record) => {
const { nextservicedate, nextservicekm, mileage } = record; const { nextservicedate, nextservicekm, mileage } = record;
const mileageOver = nextservicekm <= mileage; const mileageOver = nextservicekm ? nextservicekm <= mileage : false;
const dueForService = const dueForService =
nextservicedate && moment(nextservicedate).isBefore(moment()); nextservicedate &&
moment(nextservicedate).endOf("day").isSameOrBefore(moment());
return ( return (
<Space> <Space>