Update rates page
This commit is contained in:
parent
f7a579f71c
commit
70e02dfeff
@ -4,44 +4,73 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var itemTypeCharacteristics = {
|
||||||
|
"Parcel": {weight: true, size: true, lbs: true},
|
||||||
|
// USPS
|
||||||
|
"Card": {weight: false, size: false, lbs: false},
|
||||||
|
"Letter": {weight: true, size: false, lbs: false},
|
||||||
|
"Flat": {weight: true, size: false, lbs: true},
|
||||||
|
"FlatRateEnvelope": {weight: false, size: false, lbs: false},
|
||||||
|
"FlatRateLegalEnvelope": {weight: false, size: false, lbs: false},
|
||||||
|
"FlatRatePaddedEnvelope": {weight: false, size: false, lbs: false},
|
||||||
|
"SmallFlatRateBox": {weight: false, size: false, lbs: false},
|
||||||
|
"MediumFlatRateBox": {weight: false, size: false, lbs: false},
|
||||||
|
"LargeFlatRateBox": {weight: false, size: false, lbs: false},
|
||||||
|
"LargeFlatRateBoxAPOFPO": {weight: false, size: false, lbs: false},
|
||||||
|
"RegionalRateBoxA": {weight: true, size: false, lbs: true},
|
||||||
|
"RegionalRateBoxB": {weight: true, size: false, lbs: true},
|
||||||
|
// UPS
|
||||||
|
"UPSLetter": {weight: true, size: false, lbs: true},
|
||||||
|
"UPSExpressBox": {weight: true, size: false, lbs: true},
|
||||||
|
"Pak": {weight: true, size: false, lbs: true},
|
||||||
|
"Tube": {weight: true, size: false, lbs: true},
|
||||||
|
"SmallExpressBox": {weight: true, size: false, lbs: true},
|
||||||
|
"MediumExpressBox": {weight: true, size: false, lbs: true},
|
||||||
|
"LargeExpressBox": {weight: true, size: false, lbs: true},
|
||||||
|
// FedEx
|
||||||
|
"FedExEnvelope": {weight: true, size: false, lbs: true},
|
||||||
|
"FedExBox": {weight: true, size: false, lbs: true},
|
||||||
|
"FedExPak": {weight: true, size: false, lbs: true},
|
||||||
|
"FedExTube": {weight: true, size: false, lbs: true},
|
||||||
|
"FedExSmallBox": {weight: true, size: false, lbs: true},
|
||||||
|
"FedExMediumBox": {weight: true, size: false, lbs: true},
|
||||||
|
"FedExLargeBox": {weight: true, size: false, lbs: true},
|
||||||
|
"FedExExtraLargeBox": {weight: true, size: false, lbs: true}
|
||||||
|
};
|
||||||
|
|
||||||
function updateRateForm() {
|
function updateRateForm() {
|
||||||
$("#itemweight").css("display", "none");
|
$("#itemweight").css("display", "none");
|
||||||
$("#itemsize").css("display", "none");
|
$("#itemsize").css("display", "none");
|
||||||
$("#itemweightlbs").css("display", "");
|
$("#itemweightlbs").css("display", "none");
|
||||||
switch ($("#itemType").val()) {
|
|
||||||
case "Card":
|
if ($("#itemType").val() == "") {
|
||||||
$("#itemweight").css("display", "none");
|
// no selection, leave all boxes hidden
|
||||||
$("#weightLbs").val("0");
|
return;
|
||||||
$("#weightOz").val("0");
|
}
|
||||||
break;
|
if (typeof itemTypeCharacteristics[$("#itemType").val()] == 'undefined') {
|
||||||
case "Letter":
|
// not in list of item type info
|
||||||
$("#itemweight").css("display", "");
|
$("#itemweight").css("display", "");
|
||||||
$("#itemweightlbs").css("display", "none");
|
$("#itemsize").css("display", "");
|
||||||
$("#weightLbs").val("0");
|
$("#itemweightlbs").css("display", "");
|
||||||
break;
|
return;
|
||||||
case "Flat":
|
}
|
||||||
$("#itemweight").css("display", "");
|
|
||||||
break;
|
var chars = itemTypeCharacteristics[$("#itemType").val()];
|
||||||
case "Parcel":
|
if (chars.weight) {
|
||||||
$("#itemweight").css("display", "");
|
// show weight box for ounces
|
||||||
$("#itemsize").css("display", "");
|
$("#itemweight").css("display", "");
|
||||||
break;
|
} else {
|
||||||
case "RegionalRateBoxA":
|
$("#weightLbs").val("0");
|
||||||
case "RegionalRateBoxB":
|
$("#weightOz").val("0");
|
||||||
$("#itemweight").css("display", "");
|
}
|
||||||
break;
|
if (chars.lbs) {
|
||||||
case "Pak":
|
// show weight box for pounds
|
||||||
case "Tube":
|
$("#itemweightlbs").css("display", "");
|
||||||
case "SmallExpressBox":
|
} else {
|
||||||
case "MediumExpressBox":
|
$("#weightLbs").val("0");
|
||||||
case "LargeExpressBox":
|
}
|
||||||
$("#itemweight").css("display", "");
|
if (chars.size) {
|
||||||
break;
|
$("#itemsize").css("display", "");
|
||||||
default:
|
|
||||||
if ($("#itemType").val().startsWith("UPS") || $("#itemType").val().startsWith("FedEx")) {
|
|
||||||
$("#itemweight").css("display", "");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
<div class="item-input-wrap">
|
<div class="item-input-wrap">
|
||||||
<select id="itemType" name="itemType">
|
<select id="itemType" name="itemType">
|
||||||
<option value="" selected>Choose Item Type</option>
|
<option value="" selected>Choose Item Type</option>
|
||||||
<option value="Parcel">Parcel</option>
|
<option value="Parcel">Package/Parcel/Other</option>
|
||||||
<optgroup label="USPS">
|
<optgroup label="USPS">
|
||||||
<option value="Card">Postcard</option>
|
<option value="Card">Postcard</option>
|
||||||
<option value="Letter">Letter</option>
|
<option value="Letter">Letter</option>
|
||||||
@ -92,8 +92,6 @@
|
|||||||
<option value="SmallExpressBox">UPS Small Express Box</option>
|
<option value="SmallExpressBox">UPS Small Express Box</option>
|
||||||
<option value="MediumExpressBox">UPS Medium Express Box</option>
|
<option value="MediumExpressBox">UPS Medium Express Box</option>
|
||||||
<option value="LargeExpressBox">UPS Large Express Box</option>
|
<option value="LargeExpressBox">UPS Large Express Box</option>
|
||||||
<option value="UPS10kgBox">UPS 10kg Box</option>
|
|
||||||
<option value="UPS25kgBox">UPS 25kg Box</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="FedEx">
|
<optgroup label="FedEx">
|
||||||
<option value="FedExEnvelope">FedEx Envelope</option>
|
<option value="FedExEnvelope">FedEx Envelope</option>
|
||||||
@ -104,8 +102,6 @@
|
|||||||
<option value="FedExMediumBox">FedEx Medium Box</option>
|
<option value="FedExMediumBox">FedEx Medium Box</option>
|
||||||
<option value="FedExLargeBox">FedEx Large Box</option>
|
<option value="FedExLargeBox">FedEx Large Box</option>
|
||||||
<option value="FedExExtraLargeBox">FedEx Extra Large Box</option>
|
<option value="FedExExtraLargeBox">FedEx Extra Large Box</option>
|
||||||
<option value="FedEx10kgBox">FedEx 10kg Box</option>
|
|
||||||
<option value="FedEx25kgBox">FedEx 25kg Box</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user