-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCode.js
More file actions
67 lines (61 loc) · 2.09 KB
/
Copy pathCode.js
File metadata and controls
67 lines (61 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Welcome to the Taurus Craco Service Tech Time Keeping App
* This App will accept data submitted by the user and
* gradually create a data base of pertinant info to allow for
* easier data submission as it's used
*/
/**
* The Web App Call for the user form to be displayed
*/
function doGet(e) {
let f = HtmlService.createTemplateFromFile('index.html');
f.data = CustomerSelectionList();
return f.evaluate()
};
/**
* Loads Style Sheet and JS File. Called from index HTML page via scriptlets
*/
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.getContent();
};
/**
* Create a menu for the user to test
*/
function onOpen(){
let ui = SpreadsheetApp.getUi();
ui.createMenu("Time Sheet Menu")
.addItem('Add test entry', 'AddTestEntry')
.addItem('Create new weekly sheet', 'GetWeeklySheet')
.addItem('Update Customer List', 'UpdateCustomerList')
.addItem('Email Time Sheet', 'EmailCurrentSheet')
.addItem('Add Week to Archive','AddWeekToArchive')
.addToUi();
};
/**
* Call from the Web app once the user hits the Submit Button
*/
function AddResponse(formObject){
// console.log("add Response was called"+ formObject);
let record = new Record(formObject);
console.log(record)
let success = [];
// let currentDate = new Date();
// let currentTime = Utilities.formatDate(currentDate,'EST','HH:mm');
let sheet = GetWeeklySheet();
// let customer = formObject.customerName;
// if(customer === ""){customer = formObject.customerSelect;};
// let machine = formObject.machineName;
// if(machine === ""){machine = formObject.machineSelect;};
// let workOrder = formObject.workOrder;
// if(isNaN(workOrder)){workOrder = "Office Time"};
// let hours = formObject.totalHours;
// let log = formObject.logEntry;
// let newEntry = [currentDate,currentTime,customer,machine,log,hours,workOrder];
// sheet.appendRow(newEntry);
console.log(record.getRecord());
sheet.appendRow(record.getRecord());
success.push(["Response added successfully!"]);
UpdateCustomerList(record.customer)
return success;
};