Skip to content

Commit ba53407

Browse files
Mark Orders As In Progress
If order information is input and the order hasn't been marked as in progress on Order Tracking, this will update the order's status.
1 parent 6a9e892 commit ba53407

File tree

1 file changed

+47
-10
lines changed

1 file changed

+47
-10
lines changed

script.js

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
var spinner = $('#loader');
2-
const scriptURLC ='https://script.google.com/macros/s/AKfycbwq6MUkaz551Y9Tu3q_5-q3HZR9hybTmZk_rpVfBoRZ-l6JOgf53HB7Ic3DwH2g8JLx/exec';
2+
const scriptURLC ='https://script.google.com/macros/s/AKfycbwFKUi-VRaGqRA7fbmcecVuSvdN-NzsFfiI8pc2oCriSJDkrmWok2P_dj4rdS5i0ELz/exec';
33
const serverlessForm = document.forms['serverless-form'];
44
var timerOn = false;
55
var bgAnimate = false;
6+
var oldOrderID = 0000;
7+
var currentOrderID = 0000;
8+
var oldTech = "";
9+
var currentTech = "";
610

711
$("#reset-btn").click(function(){
812
$("#contactForm").trigger("reset");
@@ -104,7 +108,13 @@ function runTimer(){
104108

105109
}
106110

107-
$("#order-id").change(function(){
111+
// $("#order-id").change(function(){
112+
//
113+
//
114+
// })
115+
116+
//Get Order Notes
117+
$('#order-id').change(function(){
108118

109119
var orderID = $('#order-id').val();
110120
var tapeName = orderID.split("_");
@@ -118,22 +128,33 @@ $("#order-id").change(function(){
118128

119129
}
120130

131+
currentOrderID = $('#order-id').val();
132+
currentTech = $('#initials').val();
121133

122-
123-
})
124-
125-
//Get Order Notes
126-
$('#order-id').change(function(){
127134
console.log("Getting Order Notes");
128135
$('#order-notes').html("Retrieving Order Notes");
129136
$('#last-name').val("");
130137
$('#last-name').attr("placeholder", "Retrieving Customer Name");
131-
getOrderDetails($('#order-id').val(), $('#tape-num').val());
138+
getOrderDetails(currentOrderID, $('#tape-num').val(), currentTech);
132139
})
133140

134141
$('#tape-num').change(function(){
142+
143+
currentOrderID = $('#order-id').val();
144+
currentTech = $('#initials').val();
145+
135146
$('#existing-qc-notes').html("Retrieving Tape Notes");
136-
getOrderDetails($('#order-id').val(), $('#tape-num').val());
147+
getOrderDetails(currentOrderID, $('#tape-num').val(), currentTech);
148+
})
149+
150+
//If the initials have been updated, update order Status on Order Tracking.
151+
$('#initials').change(function(){
152+
153+
currentOrderID = $('#order-id').val();
154+
currentTech = $('#initials').val();
155+
156+
getOrderDetails(currentOrderID, $('#tape-num').val(), currentTech);
157+
137158
})
138159

139160
//-----------------------------------------------------------------
@@ -160,6 +181,18 @@ function getFormDetails(){
160181
notesOnly = $('#notes-only').val();
161182
billingNotes = $('#billing-notes').val();
162183

184+
if (currentOrderID != oldOrderID || currentTech != oldTech){
185+
186+
checkOrderStatus = true;
187+
oldOrderID = currentOrderID;
188+
oldTech = currentTech;
189+
190+
} else {
191+
192+
checkOrderStatus = false;
193+
194+
}
195+
163196
}
164197

165198
serverlessForm.addEventListener('submit', e => {
@@ -278,11 +311,15 @@ function logTape(e){
278311
})
279312
}
280313

281-
function getOrderDetails(orderID, tapeNum){
314+
function getOrderDetails(orderID, tapeNum, initials){
315+
316+
getFormDetails();
282317

283318
var params = new URLSearchParams({
284319
orderID: orderID,
285320
tapeNum: tapeNum,
321+
initials: initials,
322+
checkOrderStatus: checkOrderStatus,
286323
getOrderDetails: true
287324
});
288325

0 commit comments

Comments
 (0)