This commit is contained in:
@@ -2500,6 +2500,7 @@ input[type="checkbox"] {
|
||||
|
||||
.calendar-list-column .event-list-item-container {
|
||||
width: 100%;
|
||||
min-width: 320px;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -1005,9 +1005,9 @@ const EventsCalendar = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="column-container calendar-list-column" style={{ display: 'flex', flexDirection: 'column', flex: 1, minWidth: 0 }}>
|
||||
<div className="column-card" style={{ height: listHeight ? `${listHeight}px` : 'auto', overflowY: 'auto', overflowX: 'hidden', padding: '16px', display: 'flex', flexDirection: 'column', width: '100%', boxSizing: 'border-box' }}>
|
||||
<div className="column-card" style={{ height: listHeight ? `${listHeight}px` : 'auto', overflowY: 'auto', overflowX: 'auto', padding: '16px', display: 'flex', flexDirection: 'column', width: '100%', boxSizing: 'border-box' }}>
|
||||
<h6 className="text-primary mb-3">List</h6>
|
||||
<div style={{ flex: 1, overflowY: 'auto', width: '100%' }}>
|
||||
<div style={{ flex: 1, overflowY: 'auto', overflowX: 'auto', width: '100%' }}>
|
||||
{(!groupedEvents || groupedEvents.size === 0) && (
|
||||
<div style={{ padding: '24px', textAlign: 'center', color: '#999' }}>
|
||||
No events for this period
|
||||
|
||||
@@ -54,6 +54,7 @@ const RoutesDashboard = () => {
|
||||
const [showCopyDateTargetLoading, setShowCopyDateTargetLoading] = useState(false);
|
||||
const [copyDisabled, setCopyDisabled] = useState(false);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [deleteRouteType, setDeleteRouteType] = useState('');
|
||||
const [targetedDateSelected, setTargetedDateSelected] = useState(undefined);
|
||||
const [originDateSelected, setOriginDateSelected] = useState(undefined);
|
||||
const [showOriginDateDropdown, setShowOriginDateDropdown] = useState(false);
|
||||
@@ -187,15 +188,12 @@ const RoutesDashboard = () => {
|
||||
(route?.route_customer_list || []).forEach((customer) => {
|
||||
const customerKey = customer?.customer_id || normalizeName(customer?.customer_name);
|
||||
if (!customerKey) return;
|
||||
const timeKey = getCustomerTimeKey(route, customer);
|
||||
if (!timeKey) return;
|
||||
const record = {
|
||||
customerKey,
|
||||
customerName: customer?.customer_name || 'Unknown',
|
||||
customerAddress: customer?.customer_address_override || customer?.customer_address || '',
|
||||
routeId: route?.id || route?._id || '',
|
||||
routeName: route?.name || 'Unnamed Route',
|
||||
timeKey
|
||||
routeName: route?.name || 'Unnamed Route'
|
||||
};
|
||||
const existing = byCustomer.get(customerKey) || [];
|
||||
byCustomer.set(customerKey, [...existing, record]);
|
||||
@@ -211,8 +209,7 @@ const RoutesDashboard = () => {
|
||||
const first = records[i];
|
||||
const second = records[j];
|
||||
if (first.routeId === second.routeId) continue;
|
||||
if (first.timeKey !== second.timeKey) continue;
|
||||
const pairKey = [first.customerKey, first.timeKey, first.routeId, second.routeId].sort().join('|');
|
||||
const pairKey = [first.customerKey, first.routeId, second.routeId].sort().join('|');
|
||||
if (seenPairs.has(pairKey)) continue;
|
||||
seenPairs.add(pairKey);
|
||||
issues.push({
|
||||
@@ -220,8 +217,7 @@ const RoutesDashboard = () => {
|
||||
customerAddressA: first.customerAddress || '',
|
||||
customerAddressB: second.customerAddress || '',
|
||||
routeA: first.routeName,
|
||||
routeB: second.routeName,
|
||||
time: first.timeKey
|
||||
routeB: second.routeName
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -766,7 +762,12 @@ const RoutesDashboard = () => {
|
||||
}
|
||||
|
||||
const cleanupSchedule = () => {
|
||||
allTomorrowRoutes.forEach((route) => {
|
||||
const routesToDelete = deleteRouteType === 'inbound'
|
||||
? (tmrInboundRoutes || [])
|
||||
: deleteRouteType === 'outbound'
|
||||
? (tmrOutboundRoutes || [])
|
||||
: (allTomorrowRoutes || []);
|
||||
routesToDelete.forEach((route) => {
|
||||
TransRoutesService.deleteRoute(route.id);
|
||||
});
|
||||
setTimeout(() => {
|
||||
@@ -777,9 +778,11 @@ const RoutesDashboard = () => {
|
||||
|
||||
const closeDeleteModal = () => {
|
||||
setShowDeleteModal(false);
|
||||
setDeleteRouteType('');
|
||||
}
|
||||
|
||||
const triggerShowDeleteModal = () => {
|
||||
const triggerShowDeleteModal = (routeType = '') => {
|
||||
setDeleteRouteType(routeType);
|
||||
setShowDeleteModal(true);
|
||||
}
|
||||
|
||||
@@ -1722,11 +1725,11 @@ const RoutesDashboard = () => {
|
||||
)}
|
||||
</div>
|
||||
<div className="col-md-12 mb-4">
|
||||
<RoutesSection transRoutes={tmrInboundRoutes} copyList={tmrOutboundRoutes} addText="Add New Route" copyText="Import Outbound Routes" canAddNew={true} drivers={drivers} vehicles={vehicles} redirect={goToCreateRoute} routeType="inbound" sectionName="Inbound Routes" showCheckedInText={false} showRouteHeaderButtons={true} clearAllRoutesAction={triggerShowDeleteModal}/>
|
||||
<RoutesSection transRoutes={tmrInboundRoutes} copyList={tmrOutboundRoutes} addText="Add New Route" copyText="Import Outbound Routes" canAddNew={true} drivers={drivers} vehicles={vehicles} redirect={goToCreateRoute} routeType="inbound" sectionName="Inbound Routes" showCheckedInText={false} showRouteHeaderButtons={true} clearAllRoutesAction={() => triggerShowDeleteModal('inbound')}/>
|
||||
</div>
|
||||
<hr />
|
||||
<div className="col-md-12 mb-4">
|
||||
<RoutesSection transRoutes={tmrOutboundRoutes} copyList={tmrInboundRoutes} addText="Add New Route" copyText="Import Inbound Routes" canAddNew={true} drivers={drivers} vehicles={vehicles} redirect={goToCreateRoute} routeType="outbound" sectionName="Outbound Routes" showRouteHeaderButtons={true} clearAllRoutesAction={triggerShowDeleteModal}/>
|
||||
<RoutesSection transRoutes={tmrOutboundRoutes} copyList={tmrInboundRoutes} addText="Add New Route" copyText="Import Inbound Routes" canAddNew={true} drivers={drivers} vehicles={vehicles} redirect={goToCreateRoute} routeType="outbound" sectionName="Outbound Routes" showRouteHeaderButtons={true} clearAllRoutesAction={() => triggerShowDeleteModal('outbound')}/>
|
||||
</div>
|
||||
<hr />
|
||||
</>}
|
||||
@@ -1915,7 +1918,13 @@ const RoutesDashboard = () => {
|
||||
<Modal.Title>Delete Schedule</Modal.Title>
|
||||
</Modal.Header>
|
||||
<Modal.Body>
|
||||
<div>Are you sure you want to delete all the schedule?</div>
|
||||
<div>
|
||||
{deleteRouteType === 'inbound'
|
||||
? 'Are you sure you want to delete all inbound routes for this date?'
|
||||
: deleteRouteType === 'outbound'
|
||||
? 'Are you sure you want to delete all outbound routes for this date?'
|
||||
: 'Are you sure you want to delete all the schedule?'}
|
||||
</div>
|
||||
</Modal.Body>
|
||||
<Modal.Footer>
|
||||
<Button variant="secondary" onClick={() => closeDeleteModal()}>
|
||||
@@ -1993,7 +2002,7 @@ const RoutesDashboard = () => {
|
||||
<div className="fw-bold mb-2">Attendance Note Issues</div>
|
||||
{checkRoutesResult.attendance.map((issue, idx) => (
|
||||
<div key={`attendance-issue-${idx}`} className="mb-2">
|
||||
{issue.customerName} has an attendance note for {issue.noteDate} and {issue.customerName} is on route {issue.routeNames.join(' and ')}.
|
||||
{issue.customerName} is scheduled absent on {issue.noteDate} but still appears on Route {joinRouteNames(issue.routeNames)}.
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user