+
+ /* Parcel type. */
+ echo "<tr>\n";
+ echo " <td>Family unit</td>\n";
+ echo " <td><select name=\"parcel_size\">\n";
+ $mask = 1 << count($parcel_sizes);
+ for ($i = 0; $i < count($parcel_sizes); $i++) {
+ option("parcel_size", 1 << $i, $parcel_sizes[$i], $contact->getParcel() % $mask);
+ }
+ echo "</select></td>\n";
+ echo "</tr>\n";
+
+ /* Parcel contents. */
+ echo "<tr>\n";
+ echo " <td>Dietary requirements</td>\n";
+ echo " <td>";
+ for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) {
+ if (1 << $i == $GLOBALS['PARCEL_TOILETRY']) continue;
+ echo " <input type=\"checkbox\" id=\"parcel_$i\" name=\"parcel_$i\"";
+ if ($contact->getParcel() & (1 << $i)) echo " checked";
+ echo "><label for=\"parcel_$i\">$parcel_contents[$i]</label>\n";
+ }
+ echo "</td>\n";
+ echo "</tr>\n";
+
+ /* Notes. */
+ echo "<tr>\n";
+ echo " <td>Notes</td>\n";
+ echo " <td>"; textarea("notes", $contact->getNotes()); echo "</td>\n";
+ echo "</tr>\n";
+
+ /* Offers. */
+ $available_offers = get_available_offers($contact);
+ if (count($available_offers)) {
+ echo "<tr>\n";
+ echo " <td colspan=2><strong>Offers</strong></td>\n";
+ echo "</tr>\n";
+
+ $offer_states = Array();
+ foreach ($available_offers as $offer) {
+ $offer_id = $offer->getId();
+ $state = get_offer_state($contact, $offer);
+ $state_id = is_null($state) ? $GLOBALS['OFFER_ELIGIBLE'] : $state->getState();
+ $offer_states[$offer_id] = $state_id;
+ echo "<tr>\n";
+ echo " <td>" . $offer->getDescription() . "</td>\n";
+ echo " <td><select name=\"offer$offer_id\">\n";
+ for ($i = 0; $i < count($offers); $i++) {
+ option("offer$offer_id", 1 << $i, $offers[$i], $state_id == 1 << $i);
+ }
+ echo "</select></td>\n";
+ echo "</tr>\n";
+ }
+ hidden("offer_states", urlencode(json_encode($offer_states)));
+ }
+ else {
+ echo "<tr>\n";
+ echo " <td colspan=2><strong>No available offers</strong></td>\n";
+ echo "</tr>\n";
+ hidden("offer_states", "{}");
+ }