-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfirm.html
60 lines (56 loc) · 2.23 KB
/
confirm.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
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
function handleFormSubmit() {
btnLoading();
google.script.run.withSuccessHandler(closeSidebar).confirmNewRound();
}
function closeSidebar() {
google.script.host.close();
}
function btnLoading() {
$('#submit').prop('disabled', true);
$('#submit').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Confirm');
$('#cancel').prop('disabled', true);
}
</script>
</head>
<body>
<ul id="log" class="list-group"></ul>
<script>
// Populate log
( function() {
google.script.run.withSuccessHandler(populateLog).getQueuedChanges();
})();
function populateLog(queuedChanges) {
// Summary information
var newType = queuedChanges.newType == "OR" ? "operating round" : "stock round";
var curType = queuedChanges.currentType == "OR" ? "operating round" : "stock round";
var summary = "<i>Creating new " + newType + " named " + queuedChanges.newName + " from " + curType + " " + queuedChanges.currentName + ".</i>";
var sumLi = '<li class="list-group-item py-1">' + summary + '</li>';
$('#log').append(sumLi);
// Populate list
for (var i=0; i<queuedChanges.log.length; i++) {
var li = '<li class="list-group-item py-1">' + queuedChanges.log[i] + '</li>';
$('#log').append(li);
}
}
</script>
<form id="roundForm">
<div class="container">
<div class="row justify-content-around my-3">
<div class="col-xs-4">
<button name="button-submit" id="submit" type="button" class="btn btn-success btn-block" onclick="handleFormSubmit()"> Confirm </button>
</div>
<div class="col-xs-4">
<button name="button-cancel" id="cancel" type="button" class="btn btn-secondary btn-block" onclick="closeSidebar()"> Cancel </button>
</div>
</div>
</div>
</form>
</body>
</html>