diff --git a/client/src/components/dashboard-components/scheduled-in-today/scheduled-in-today.component.jsx b/client/src/components/dashboard-components/scheduled-in-today/scheduled-in-today.component.jsx index 87d1980a1..fca46457a 100644 --- a/client/src/components/dashboard-components/scheduled-in-today/scheduled-in-today.component.jsx +++ b/client/src/components/dashboard-components/scheduled-in-today/scheduled-in-today.component.jsx @@ -23,36 +23,40 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) { const appt = []; // Flatten Data data.scheduled_in_today.forEach((item) => { - var i = { - canceled: item.canceled, - id: item.id, - alt_transport: item.job.alt_transport, - clm_no: item.job.clm_no, - jobid: item.job.jobid, - ins_co_nm: item.job.ins_co_nm, - iouparent: item.job.iouparent, - ownerid: item.job.ownerid, - ownr_co_nm: item.job.ownr_co_nm, - ownr_ea: item.job.ownr_ea, - ownr_fn: item.job.ownr_fn, - ownr_ln: item.job.ownr_ln, - ownr_ph1: item.job.ownr_ph1, - ownr_ph2: item.job.ownr_ph2, - production_vars: item.job.production_vars, - ro_number: item.job.ro_number, - suspended: item.job.suspended, - v_make_desc: item.job.v_make_desc, - v_model_desc: item.job.v_model_desc, - v_model_yr: item.job.v_model_yr, - v_vin: item.job.v_vin, - vehicleid: item.job.vehicleid, - note: item.note, - start: moment(item.start).format("hh:mm a"), - title: item.title, - }; - appt.push(i); + if (item.job) { + var i = { + canceled: item.canceled, + id: item.id, + alt_transport: item.job.alt_transport, + clm_no: item.job.clm_no, + jobid: item.job.jobid, + ins_co_nm: item.job.ins_co_nm, + iouparent: item.job.iouparent, + ownerid: item.job.ownerid, + ownr_co_nm: item.job.ownr_co_nm, + ownr_ea: item.job.ownr_ea, + ownr_fn: item.job.ownr_fn, + ownr_ln: item.job.ownr_ln, + ownr_ph1: item.job.ownr_ph1, + ownr_ph2: item.job.ownr_ph2, + production_vars: item.job.production_vars, + ro_number: item.job.ro_number, + suspended: item.job.suspended, + v_make_desc: item.job.v_make_desc, + v_model_desc: item.job.v_model_desc, + v_model_yr: item.job.v_model_yr, + v_vin: item.job.v_vin, + vehicleid: item.job.vehicleid, + note: item.note, + start: moment(item.start).format("hh:mm a"), + title: item.title, + }; + appt.push(i); + } + }); + appt.sort(function (a, b) { + return new moment(a.start) - new moment(b.start); }); - appt.sort ( function (a, b) { return new Date(a.start) - new Date(b.start); }); const columns = [ { @@ -182,7 +186,12 @@ export default function DashboardScheduledInToday({ data, ...cardProps }) { }; return ( - +