-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmpl_upd_bkup.html
79 lines (68 loc) · 2.56 KB
/
tmpl_upd_bkup.html
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
68
69
70
71
72
73
74
75
76
77
78
79
<script>
function updateForm(addChairList, addCustomerList){
purgeForm();
//--------------------------Recreate chair form-------------------------------
var itemListTypeSelectedIndex = document.getElementById("itemListType").selectedIndex;
var docName = itemListType.options[itemListType.selectedIndex].innerHTML;
var html = "<br>";
if(addChairList)
{
if(itemListTypeSelectedIndex == 0) //Bilbarnstol
{
html += ""
+ "<span>Stol:</span><br>"
+ "<select id='itemListChair' name='itemListChair'></select><br>"
}
else //Babyskydd
{
html += ""
+ "<span>Hyrningstyp:</span><br>"
+ "<select id='itemListChair' name='itemListChair'>"
+ "<option id='Chair0' value='0'>Korttid</option>"
+ "<option id='Chair1' value='1'>Långtid</option>"
+ "</select><br>"
}
}
if(addCustomerList)
{
html += "<span>Kund:</span><br>";
html += "<select id='itemListCustomer' name='itemListCustomer'></select><br>";
}
html += "<br><input id='submitChair' type='submit'>";
var template = document.createElement("template");
template.innerHTML = html;
document.getElementById("chairListForm").appendChild(template.content);
//--------------Add attributes to form and insert customer list----------------
document.getElementById("submitChair").setAttribute("value", document.getElementById("submitText").innerHTML);
if(addCustomerList)
{
document.getElementById("itemListChair").setAttribute("onchange", "updateCustomerList();");
}
if(addChairList && itemListTypeSelectedIndex == 0) //Don't create chair list for "Babyskydd"
{
createListFromSheetColumn(docName, 2, "getChairNumber", 3, 9, "Chair");
}
if(addCustomerList)
{
if(itemListTypeSelectedIndex == 0) //Bilbarnstol
{
createListFromSheetColumn(docName, 4, 8, 3, 1, "Customer");
}
else //Babyskydd
{
var chairIndex = document.getElementById("itemListChair").selectedIndex;
createListFromSheetColumn(docName, 4 + (9*chairIndex), 47, 3, 1, "Customer");
}
}
}
//Remove all form child elements BUT NOT the rental type list
function purgeForm(){
var e = document.getElementById("chairListForm");
var child = e.lastElementChild;
while (child && child.id != "itemListType")
{
e.removeChild(child);
child = e.lastElementChild;
}
}
</script>