Last active
December 31, 2019 16:27
-
-
Save joelbcastillo/2ad0df6b2ae3fc43b7c8bfbbed9d2133 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name DORIS POS | |
// @version 2 | |
// @grant none | |
// @include https://nyc-stg-web.csc.nycnet/doittshoppingcart/* | |
// @include https://www1.nyc.gov/doittshoppingcart/* | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js | |
// ==/UserScript== | |
custom_photo_sales = 16; | |
custom_photo_sales_tax = 17 | |
function addCentralParkBook() { | |
$("[name='items[" + custom_photo_sales + "].selected']").prop("checked", true); | |
$("[name='items[" + custom_photo_sales + "].description']").val("Central Park Book"); | |
$("[name='items[" + custom_photo_sales + "].flexField2']").val("Central Park Book"); | |
$("[name='items[" + custom_photo_sales + "].cost']").val("50.00"); | |
/* Shipping & Handling (Photos) */ | |
$("[name='items[" + custom_photo_sales_tax + "].selected']").prop("checked", true); | |
$("[name='items[" + custom_photo_sales_tax + "].description']").val("Central Park Book Sales Tax (8.875%)"); | |
$("[name='items[" + custom_photo_sales_tax + "].flexField2']").val("Central Park Book Sales Tax (8.875%)"); | |
$("[name='items[" + custom_photo_sales_tax + "].cost']").val("4.44"); | |
} | |
function finalizeOrder() { | |
var i; | |
for (i = 0; i < 24; i++) { | |
if ($("[name='items[" + i + "].selected']").prop("checked") == true) { | |
$("[name='items[" + i + "].shortDescription1']").val($("[name='items[" + i + "].flexField2']").val() + " x " + $("[name='items[" + i + "].quantity']").val()); | |
} | |
} | |
if ($("[name='items[" + custom_photo_sales + "].flexField2']").val() == "Central Park Book") { | |
$("[name='items[" + custom_photo_sales_tax + "].quantity']").val($("[name='items[" + custom_photo_sales + "].quantity']").val()) | |
$("[name='items[" + custom_photo_sales_tax + "].shortDescription1']").val($("[name='items[" + custom_photo_sales_tax + "].flexField2']").val() + " x " + $("[name='items[" + custom_photo_sales_tax + "].quantity']").val()); | |
} | |
} | |
function setupPage() { | |
$(".form-table").prepend("<li class='form-table-row'><div></div><div><button type='button' class='btn btn-primary btn-lg rounded' id='addCentralParkBook'>Add Central Park Book</button></div></li>"); | |
$('#addCentralParkBook').click(addCentralParkBook); | |
$('#cashierItemsForm').submit(function (event) { | |
finalizeOrder(); | |
}); | |
} | |
window.onload = function () { | |
setupPage(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment