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/.
|
||||
*/
|
||||
|
||||
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() {
|
||||
$("#itemweight").css("display", "none");
|
||||
$("#itemsize").css("display", "none");
|
||||
$("#itemweightlbs").css("display", "");
|
||||
switch ($("#itemType").val()) {
|
||||
case "Card":
|
||||
$("#itemweight").css("display", "none");
|
||||
$("#weightLbs").val("0");
|
||||
$("#weightOz").val("0");
|
||||
break;
|
||||
case "Letter":
|
||||
$("#itemweight").css("display", "");
|
||||
$("#itemweightlbs").css("display", "none");
|
||||
$("#weightLbs").val("0");
|
||||
break;
|
||||
case "Flat":
|
||||
$("#itemweight").css("display", "");
|
||||
break;
|
||||
case "Parcel":
|
||||
$("#itemweight").css("display", "");
|
||||
$("#itemsize").css("display", "");
|
||||
break;
|
||||
case "RegionalRateBoxA":
|
||||
case "RegionalRateBoxB":
|
||||
$("#itemweight").css("display", "");
|
||||
break;
|
||||
case "Pak":
|
||||
case "Tube":
|
||||
case "SmallExpressBox":
|
||||
case "MediumExpressBox":
|
||||
case "LargeExpressBox":
|
||||
$("#itemweight").css("display", "");
|
||||
break;
|
||||
default:
|
||||
if ($("#itemType").val().startsWith("UPS") || $("#itemType").val().startsWith("FedEx")) {
|
||||
$("#itemweight").css("display", "");
|
||||
}
|
||||
break;
|
||||
$("#itemweightlbs").css("display", "none");
|
||||
|
||||
if ($("#itemType").val() == "") {
|
||||
// no selection, leave all boxes hidden
|
||||
return;
|
||||
}
|
||||
if (typeof itemTypeCharacteristics[$("#itemType").val()] == 'undefined') {
|
||||
// not in list of item type info
|
||||
$("#itemweight").css("display", "");
|
||||
$("#itemsize").css("display", "");
|
||||
$("#itemweightlbs").css("display", "");
|
||||
return;
|
||||
}
|
||||
|
||||
var chars = itemTypeCharacteristics[$("#itemType").val()];
|
||||
if (chars.weight) {
|
||||
// show weight box for ounces
|
||||
$("#itemweight").css("display", "");
|
||||
} else {
|
||||
$("#weightLbs").val("0");
|
||||
$("#weightOz").val("0");
|
||||
}
|
||||
if (chars.lbs) {
|
||||
// show weight box for pounds
|
||||
$("#itemweightlbs").css("display", "");
|
||||
} else {
|
||||
$("#weightLbs").val("0");
|
||||
}
|
||||
if (chars.size) {
|
||||
$("#itemsize").css("display", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
||||
<div class="item-input-wrap">
|
||||
<select id="itemType" name="itemType">
|
||||
<option value="" selected>Choose Item Type</option>
|
||||
<option value="Parcel">Parcel</option>
|
||||
<option value="Parcel">Package/Parcel/Other</option>
|
||||
<optgroup label="USPS">
|
||||
<option value="Card">Postcard</option>
|
||||
<option value="Letter">Letter</option>
|
||||
@ -92,8 +92,6 @@
|
||||
<option value="SmallExpressBox">UPS Small Express Box</option>
|
||||
<option value="MediumExpressBox">UPS Medium 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 label="FedEx">
|
||||
<option value="FedExEnvelope">FedEx Envelope</option>
|
||||
@ -104,8 +102,6 @@
|
||||
<option value="FedExMediumBox">FedEx Medium Box</option>
|
||||
<option value="FedExLargeBox">FedEx 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>
|
||||
</select>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user