fix
All checks were successful
Build And Deploy Main / build-and-deploy (push) Successful in 35s

This commit is contained in:
2026-03-12 14:02:26 -04:00
parent cf22d431c3
commit 015ab2b934

View File

@@ -167,6 +167,30 @@ const RouteReportWithSignature = () => {
return `${baseName} (${qualifiers.join(', ')})`;
};
const getAttendanceDisplayByReportLogic = (...customerCandidates) => {
const hasEnterCenterTime = customerCandidates.some(
(item) => item?.customer_enter_center_time !== null && item?.customer_enter_center_time !== undefined
);
if (hasEnterCenterTime) {
return { y: '✓', n: '' };
}
const hasInCenterStatus = customerCandidates.some(
(item) => (item?.customer_route_status || '').toString() === PERSONAL_ROUTE_STATUS.IN_CENTER
);
if (hasInCenterStatus) {
return { y: '✓', n: '' };
}
return { y: '', n: '✗' };
};
const getRouteNoteText = (...customerCandidates) => {
for (const item of customerCandidates) {
const noteText = (item?.customer_note || '').toString().trim();
if (noteText) return noteText;
}
return '';
};
return (
<>
<style>
@@ -292,9 +316,8 @@ const RouteReportWithSignature = () => {
const otherRouteWithThisCustomer = getOtherRouteWithThisCustomer(customer?.customer_id);
const customerInOtherRoute = otherRouteWithThisCustomer?.route_customer_list?.find(cust => cust?.customer_id === customer?.customer_id);
const otherOutboundRoute = getOtherOutboundRouteWithThisCustomer(customer?.customer_id);
const isAttending = ![PERSONAL_ROUTE_STATUS.SCHEDULED_ABSENT, PERSONAL_ROUTE_STATUS.UNEXPECTED_ABSENT].includes(relativeRouteCustomer?.customer_route_status) &&
![PERSONAL_ROUTE_STATUS.SCHEDULED_ABSENT, PERSONAL_ROUTE_STATUS.UNEXPECTED_ABSENT].includes(customer?.customer_route_status);
const attendanceDisplay = getAttendanceDisplayByReportLogic(customer, relativeRouteCustomer, customerInOtherRoute);
const routeNoteText = getRouteNoteText(customer, relativeRouteCustomer, customerInOtherRoute);
return (
<tr key={index}>
@@ -303,8 +326,8 @@ const RouteReportWithSignature = () => {
<td>{customer?.customer_phone}</td>
<td>{customer?.customer_address_override || customer?.customer_address}</td>
<td></td>
<td style={{ textAlign: 'center' }}>{isAttending ? '✓' : ''}</td>
<td style={{ textAlign: 'center' }}>{!isAttending ? '✗' : ''}</td>
<td style={{ textAlign: 'center' }}>{attendanceDisplay.y}</td>
<td style={{ textAlign: 'center' }}>{attendanceDisplay.n}</td>
<td style={{ textAlign: 'center' }}>
{customer?.customer_pickup_time
? new Date(customer?.customer_pickup_time).toLocaleTimeString('en-US', {hour12: false, hour: '2-digit', minute: '2-digit'})
@@ -342,6 +365,7 @@ const RouteReportWithSignature = () => {
: ''))}
</td>
<td>
{routeNoteText && <div>{routeNoteText}</div>}
{customer?.customer_type !== CUSTOMER_TYPE.MEMBER && <div>{CUSTOMER_TYPE_TEXT[customer?.customer_type]}</div>}
{!relativeRouteCustomer && otherRouteWithThisCustomer && (
<div>{`${currentRoute?.type === 'inbound' ? 'Switch to Route ' : 'Switch from Route '} ${otherRouteWithThisCustomer?.name}`}</div>