function customerFields($data, $badFields) { global $states; global $COUNTRIES; if (userLoggedIn() && array_key_exists("CID", $data) && $data["CID"] != "") { tableRow(array(tableData(prompt("<b>CID:</b>"), "right", "top"), tableData(prompt($data["CID"]), "left", "top"))); prepDatePicker(); tableRow(array(tableData(prompt("<b>Met Date:</b>"), "right", "top"), tableData(text($data, "metDate", "", "", "datepicker"), "left", "middle"))); } tableRow(array(tableData(prompt("<b>First name*:</b>", in_array("fname", $badFields)), "right"), tableData(text($data, "fname"), "left", "middle"), tableData(prompt("<b>Last name*:</b>", in_array("lname", $badFields)), "right"), tableData(text($data, "lname"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Email*:</b>", in_array("email", $badFields)), "right"), tableData(text($data, "email"), "left", "middle"), tableData(prompt("<b>Phone Number:</b>", in_array("phoneNum", $badFields)), "right"), tableData(text($data, "phoneNum"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Title:</b>", in_array("title", $badFields)), "right"), tableData(radioButton($data, "title", "Mr.", false, "Mr."), "center", "middle"), tableData(radioButton($data, "title", "Ms.", false, "Ms."), "center", "middle"), tableData(radioButton($data, "title", "Mrs.", false, "Mrs."), "center", "middle"), tableData(radioButton($data, "title", "Dr.", false, "Dr."), "center", "middle"))); if (!userLoggedIn()) { if ($data["charity"] == true) { tableRow(array(tableData(prompt("Tell us about your situtation, your team and why you need a ChapR. The more information the better!"), "middle", "top", 6))); } else { tableRow(array(tableData(prompt("Write anything else you would like us to know about you below: <br> team info (type, name, number), how you heard about us (where, from who?) etc."), "middle", "top", 6))); } } tableRow(array(tableData(prompt("<b>Comments:</b>", in_array("customerCNotes", $badFields), ""), "right", "top"), tableData(textArea($data, "customerCNotes", 3), "center", "", 5))); tableRow(array(tableData(prompt("<b>Street1*:</b>", in_array("street1", $badFields)), "right"), tableData(text($data, "street1"), "left", "middle", 3))); tableRow(array(tableData(prompt("<b>Street2:</b>", in_array("street2", $badFields)), "right"), tableData(text($data, "street2"), "left", "middle", 3))); $stateDirections = 'only applicable for domestic teams'; tableRow(array(tableData(prompt("<b>City*:</b>", in_array("city", $badFields)), "right"), tableData(text($data, "city"), "left", "middle"), tableData(prompt("<b>State*:</b>", in_array("state", $badFields), "", $stateDirections), "right"), tableData(dropDown($data, "state", $states, "--------Choose Your State-------"), "left", "middle"))); tableRow(array(tableData(prompt("<b>Zip*:</b>", in_array("zip", $badFields)), "right"), tableData(text($data, "zip"), "left", "middle"), tableData(prompt("<b>Country:</b>", in_array("country", $badFields)), "right"), tableData(dropDown($data, "country", $COUNTRIES), "left", "middle"))); if (userLoggedIn()) { tableRow(array(tableData(prompt("<b>Admin Comments:</b>", in_array("adminCNotes", $badFields), "", $commentDirections), "right", "top"), tableData(textArea($data, "adminCNotes", 3), "center", "", 5))); } tableRow(array(tableData(hiddenField("CID", $data["CID"])), tableData(hiddenField("OID", $data["OID"])))); }
function showShippingForm($data, $action, $badFields = array()) { prepDatePicker(); formHeader($action, "<h1>Shipping Info Form</h1>", "shippingForm", "void"); shippingFields($data, $badFields); tableRow(array(tableData(""), tableData(""), tableData(""), tableData(""), tableData(""), tableData(submit("Enter Shipping Details!"), "right"))); if (inWordPress()) { echo getWordpressHiddenFormField(); } formFooter("shippingForm"); }
function orderFields($data, $badFields) { global $SETTINGS; // display data not supposed to be visible for customers if (userLoggedIn()) { if (array_key_exists("OID", $data) && $data["OID"] != "") { tableRow(array(tableData(prompt("<b>OID: </b>"), "right", "top"), tableData(prompt($data["OID"]), "left", "top"))); } tableRow(array(tableData(prompt("<b>Expedite:</b>"), "right", "top"), tableData(checkBox($data, "isExpedited", "true", "YES"), "left", "middle", 3))); prepDatePicker(); tableRow(array(tableData(prompt("<b>Ordered Date:</b>"), "right", "top"), tableData(text($data, "orderedDate", "", "", "datepicker"), "left", "middle"))); } // show the order amount change fields if the user has permission (and in WordPress) if (inWordPress() && current_user_can("can_change_amounts")) { tableRow(array(tableData(prompt("<b>Shipping Fee:</b>", in_array("shippingFee", $badFields)), "right"), tableData(text($data, "shippingFee", null, "10"), "left"), tableData(prompt("<b>Expedite Fee:</b>", in_array("expediteFee", $badFields)), "right"), tableData(text($data, "expediteFee", null, "10"), "left"), tableData(prompt("<b>Discount:</b>", in_array("discount", $badFields)), "right"), tableData(text($data, "discount", null, "10"), "left"))); } // figure out how many rows to display initially ($i is set to that value) for ($i = $SETTINGS["MaxItems"]; $i > 1; $i--) { if (array_key_exists("packages{$i}", $data) && $data["packages{$i}"] != "" && $data["packages{$i}"] != 0 || array_key_exists("personality{$i}", $data) && $data["personality{$i}"] != "" && $data["personality{$i}"] != 0 || array_key_exists("quantity{$i}", $data) && $data["quantity{$i}"] != "" && $data["quantity{$i}"] != 0) { break; } } $initialRows = $i; // get currently available packages (from database) for display $rows = dbGetPackages(); $displayPackages = array(); foreach ($rows as $row) { if ($row["Active"]) { $displayPackages[$row["PackageName"]] = $row["PKID"]; } } // get currently available personalities (from database) for display $rows = dbGetPersonalities(); $displayPersonalities = array(); foreach ($rows as $row) { if ($row["Active"]) { $displayPersonalities[$row["PieceName"]] = $row["PID"]; } } if (!userLoggedIn()) { tableRow(array(tableData(prompt("Note: \"personality\" refers to the type of software or platform the firmware is compatible with.\n<br> It can be changed later using a USB stick, but we might as well set it for you."), "middle", "top", 6))); } for ($i = 1; $i <= $SETTINGS["MaxItems"]; $i++) { // note that the "table-row" setting for display is controversial and may // not work well in Microsoft IE // note, too, that the reason while rows 2 through 5 don't initially display // is that they are set as display = 'none' in the style sheet - if that // is turned off, then they will display right away $magicClick = ""; if ($i != $SETTINGS["MaxItems"]) { $magicClick = "<button id=\"prodrowclick-"; $magicClick .= $i; $magicClick .= "\""; if ($i != $initialRows) { $magicClick .= " style=\"visibility:hidden;\""; } $magicClick .= " type=\"button\" onclick=\""; $magicClick .= "document.getElementById('prodrow-"; $magicClick .= $i + 1; // sets the next row to visible $magicClick .= "').style.display = 'table-row';"; if ($i < $SETTINGS["MaxItems"] - 1) { $magicClick .= "document.getElementById('prodrowclick-"; $magicClick .= $i + 1; // sets the next button to visible $magicClick .= "').style.visibility = 'visible';"; } $magicClick .= "document.getElementById('prodrowclick-"; $magicClick .= $i; // sets its own button to hidden $magicClick .= "').style.visibility = 'hidden';"; $magicClick .= "\">+</button>"; } if (userLoggedIn() && array_key_exists("iid{$i}", $data) && $data["IID"] != "") { tableRow(array(tableData(prompt("<b>IID{$i}:</b>"), "right", "top"), tableData(prompt($data["iid{$i}"]), "left", "top"))); } tableRow(array(tableData(prompt("<b>Product*:</b>", in_array("product{$i}", $badFields)), "right"), tableData(dropDown($data, "packages{$i}", $displayPackages, "----------Select Product----------")), tableData(prompt("<b>Personality:</b>", in_array("personality{$i}", $badFields)), "right"), tableData(dropDown($data, "personality{$i}", $displayPersonalities, " ")), tableData(prompt("<b>Quantity*:</b>", in_array("quantity{$i}", $badFields)), "right"), tableData(text($data, "quantity{$i}", "", "2"), "left"), tableData($magicClick)), "prodrow-" . $i, $i <= $initialRows); hiddenField("iid{$i}", $data["iid{$i}"]); } if (!userLoggedIn()) { tableRow(array(tableData(prompt("Write anything you would like us to know about the order: <br> a deadline you need to meet, some option you want that isn't offered etc."), "middle", "top", 6))); } tableRow(array(tableData(prompt("<b>Order Notes:</b>"), "right", "top"), tableData(textArea($data, "customerONotes", 5), "left", "", 5))); if (userLoggedIn()) { tableRow(array(tableData(prompt("<b>Admin Order Notes:</b>"), "right", "top"), tableData(textArea($data, "adminONotes", 5), "left", "", 5))); } hiddenField("charity", $data["charity"]); hiddenField("OID", $data["OID"]); }