Use textarea() for contact notes.
[readifood.git] / lib / order.php
index 38a235a..7872f94 100644 (file)
     foreach ($contacts as $contact) {
       option("requester_id", $contact->getId(), $contact->getDisplayname(), $order->getRequesterId());
     }
-    echo "</select></td>\n";
+    echo "</select>";
+    $contact = get_contact_by_id($order->getRequesterId(), false);
+    if ($contact) echo " " . get_small_link($contact->getDisplayname(), $contact->getURL());
+    echo "</td>\n";
     echo "</tr>\n";
 
     /* Beneficiary. */
         option("beneficiary_id", $contact->getId(), $contact->getDisplayname(), $order->getBeneficiaryId());
       }
     }
-    echo "</select></td>\n";
+    echo "</select>";
+    $contact = get_contact_by_id($order->getBeneficiaryId(), false);
+    if ($contact) echo " " . get_small_link($contact->getDisplayname(), $contact->getURL());
+    echo "</td>\n";
     echo "</tr>\n";
 
     /* Hub. */
     foreach ($hubs as $hub) {
       option("hub_id", $hub->getId(), $hub->getDisplayname(), $order->getHubId());
     }
-    echo "</select></td>\n";
+    echo "</select>";
+    $hub = get_hub_by_id($order->getHubId(), false);
+    if ($hub) echo " " . get_small_link($hub->getDisplayname(), $hub->getURL());
+    echo "</td>\n";
     echo "</tr>\n";
 
     /* Parcel type. */
     echo "</td>\n";
     echo "</tr>\n";
 
+    /* Notes. */
+    echo "<tr>\n";
+    echo "  <td>Notes</td>\n";
+    echo "  <td>"; textarea("notes", $order->getNotes()); echo "</td>\n";
+    echo "</tr>\n";
+
     /* Driver. */
     echo "<tr>\n";
     echo "  <td>Driver</td>\n";
       foreach ($contacts as $contact) {
         option("driver_id", $contact->getId(), $contact->getDisplayname(), $driver_id);
       }
-      echo "</select></td>\n";
+      echo "</select>";
+      $contact = get_contact_by_id($driver_id, false);
+      if ($contact) echo " " . get_small_link($contact->getDisplayname(), $contact->getURL());
+      echo "</td>\n";
     }
     else echo "  <td>No drivers!</td>\n";
     echo "</tr>\n";
     for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) {
       if ($_POST['parcel_' . $i] == "on") $parcel |= (1 << $i);
     }
+    $notes = $_POST['notes'];
 
     if ($date) {
       list($y, $m, $d) = explode('-', $date);
       $order->setBeneficiaryId($beneficiary_id);
       $order->setHubId($hub_id);
       $order->setParcel($parcel);
+      $order->setNotes($notes);
 
       /* XXX: begin/commit */
       try {
     if (! count($order_states)) return;
 
     echo "<h3>Order history</h3>\n";
+    echo "<p class=\"history\">\n";
     foreach ($order_states as $order_state) {
       $date = $order_state->getUpdated();
 
         }
       }
       #$state = $states[$order_state->getState()];
-      echo "<p><strong>$username</strong> changed order to state <strong>$state</strong>";
+      echo "<strong>$username</strong> changed order to state <strong>$state</strong>";
       if ($driver) echo " for driver " . $driver->getDisplayname();
-      echo " on $date.</p>\n";
+      echo " on $date.<br>\n";
     }
+    echo "</p>\n";
   }
 
   function show_order(&$id = null) {