X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Fdelivery.php;h=574094ada01704f4d684b03be6458c59e62225dd;hb=refs%2Ftags%2F2022-10-31;hp=4c7c4f09b491cebb93ae92af5c9ad3a578b2a611;hpb=068aa1997b31e7f46e66977693b751f5fbbcb2b7;p=readifood.git diff --git a/lib/delivery.php b/lib/delivery.php index 4c7c4f0..574094a 100644 --- a/lib/delivery.php +++ b/lib/delivery.php @@ -109,32 +109,72 @@ $q = new OrderQuery; $orders = $q->filterById(get_driver_schedule_by_order_id($contact->getId(), $order_ids))->find(); + + /* + Only allow drag and drop if there's more than one order otherwise IE will + mess up the CSS. + */ + $count = count($orders); + if ($count) { + foreach ($orders as $order) { + if (! get_contact_by_id($order->getBeneficiaryId())) $count--; + } + } + + if ($count > 1) { + echo "

$count orders

"; + echo "

Drag delivery details to reorder the schedule.

\n"; + echo "
\n"; + } + else echo "

1 order

"; + foreach ($orders as $order) { $contact = get_contact_by_id($order->getBeneficiaryId()); if (! $contact) continue; + echo "
"; + + $phones = array(); $area = get_contact_area($contact); echo "

Order of " . get_order_parcel_string($order) . " for " . htmlspecialchars($contact->getDisplayname()) . " in " . htmlspecialchars(get_area_displayname($area)) . ".

\n"; $hub = get_hub_by_id($order->getHubId(), false); if ($hub) { echo "

Deliver to hub " . htmlspecialchars($hub->getName()) . ""; $address = get_hub_address($hub); + $phone = $hub->getTelephone1(); + if ($phone) $phones[] = $phone; + $phone = $hub->getTelephone2(); + if ($phone) $phones[] = $phone; } else { echo "

Deliver direct to beneficiary"; $address = get_contact_address($contact); + $phone = $contact->getTelephone1(); + if ($phone) $phones[] = $phone; + $phone = $contact->getTelephone2(); + if ($phone) $phones[] = $phone; } $area = get_address_area($address); - echo " in " . htmlspecialchars($area->getName()) . " at:
"; + echo " in " . htmlspecialchars($area->getName()) . " at:"; $city = get_area_city($area); - echo "\n
" . htmlspecialchars($address->getLine()); - echo "\n
" . htmlspecialchars($city->getName()); - echo "\n
" . htmlspecialchars($address->getPostcode()); + echo "\n" . htmlspecialchars($address->getLine()); + echo ",\n" . htmlspecialchars($address->getPostcode()); + if (count($phones)) echo ";\nTelephone " . implode(" or ", $phones) . ""; echo "

\n"; - echo "
\n\n"; + $notes = $order->getNotes(); + if ($notes) { + echo "

Notes:\n"; + echo htmlspecialchars($notes); + echo "

\n"; + } + + echo "
\n"; + echo "
\n\n"; } + + if ($count > 1) echo "
\n"; } function show_delivery_date_form($date = null) {