-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathform.html
488 lines (424 loc) · 20 KB
/
form.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-signin-client_id" content="378984296211-oalrj85dhm067v4jsulkdv5pi6ibq2u2.apps.googleusercontent.com">
<link rel="stylesheet" href="styles.css">
<title>Logger</title>
</head>
<body>
<script src="https://apis.google.com/js/api.js"></script>
<div class="padding"></div>
<button class="btn" id="signOutBtn" onclick="signOut();">Sign out</button>
<br>
<h2>Enter An Expense</h2>
<input type="checkbox" id="editCheck" name="editCheck">
<label for="editCheck">Edit a Campaign</label>
<div class="form-popup" id="subForm">
<form action="#" onsubmit="foo(); return false">
<input class="formEntry" type="text" id="ExpenseID" placeholder="Expense ID">
<input class="formEntry" type="text" id="EnteredBy" placeholder="Entered by">
<select class="formEntry" name="Country" id="Country">
<option value="" disabled selected>Country</option>
<option value="US">US</option>
<option value="ER">ER</option>
<option value="GC">GC</option>
<option value="F75">F75</option>
<option value="MR">MR</option>
</select>
<select class="formEntry" name="Medium" id="Medium">
<option value="" disabled selected>Medium</option>
<option value="Online">Online</option>
<option value="Offline">Offline</option>
</select>
<select class="formEntry" name="Channel Category" id="ChannelCategory">
<option value="" disabled selected>Channel Category</option>
<option value="Brand">Brand</option>
<option value="Non-Marketing Vouchers">Non-Marketing Vouchers</option>
<option value="Organic">Organic</option>
<option value="Performance">Performance</option>
<option value="Referral">Referral</option>
<option value="Revenue Generation">Revenue Generation</option>
</select>
<select class="formEntry" name="Channel" id="Channel">
<option value="" disabled selected>Channel</option>
<option value="Affiliate">Affiliate</option>
<option value="App CRM">App CRM</option>
<option value="App Organic">App Organic</option>
<option value="App Paid Acquisition">App Paid Acquisition</option>
<option value="Barter">Barter</option>
<option value="Box Inserts">Box Inserts</option>
<option value="Call Center">Call Center</option>
<option value="Customer Care Sorry Vouchers">Customer Care Sorry Vouchers</option>
<option value="Daily Deals">Daily Deals</option>
<option value="Direct Mail CRM">Direct Mail CRM</option>
<option value="Direct Mail Performance">Direct Mail Performance</option>
<option value="Direct Sales">Direct Sales</option>
<option value="Display">Display</option>
<option value="Email">Email</option>
<option value="Email Partnerships">Email Partnerships</option>
<option value="Employee Discounts">Employee Discounts</option>
<option value="Freebies Offline">Freebies Offline</option>
<option value="Freebies Online">Freebies Online</option>
<option value="Gift boxes">Gift boxes</option>
<option value="Gift Card & Flyers">Gift Card & Flyers</option>
<option value="HelloShare Offline">HelloShare Offline</option>
<option value="HelloShare Online">HelloShare Online</option>
<option value="Influencer Brand">Influencer Brand</option>
<option value="Influencer Performance">Influencer Performance</option>
<option value="Leads Generation">Leads Generation</option>
<option value="Native">Native</option>
<option value="On-site">On-site</option>
<option value="Organic">Organic</option>
<option value="Organic Reactivation">Organic Reactivation</option>
<option value="Out of Home">Out of Home</option>
<option value="Paid Social">Paid Social</option>
<option value="Partnerships">Partnerships</option>
<option value="Podcast">Podcast</option>
<option value="PR">PR</option>
<option value="Print">Print</option>
<option value="QA / Warehouse / Office boxes">QA / Warehouse / Office boxes</option>
<option value="Radio">Radio</option>
<option value="SEA Brand">SEA Brand</option>
<option value="SEA Non-Brand">SEA Non-Brand</option>
<option value="SEO Brand">SEO Brand</option>
<option value="SEO Non-Brand">SEO Non-Brand</option>
<option value="SMS">SMS</option>
</select>
<select class="formEntry" name="Channel Split" id="ChannelSplit">
<option value="" disabled selected>Channel Split</option>
<option value="Addressable TV">Addressable TV</option>
<option value="Addressed">Addressed</option>
<option value="Agency Fee">Agency Fee</option>
<option value="App Product Promotion">App Product Promotion</option>
<option value="App Store Optimisation">App Store Optimisation</option>
<option value="Auto-Cancel">Auto-Cancel</option>
<option value="B2B Conversion">B2B Conversion</option>
<option value="B2B Managed Service">B2B Managed Service</option>
<option value="B2B2C Partnerships">B2B2C Partnerships</option>
<option value="Brand Boosting">Brand Boosting</option>
<option value="Call Center">Call Center</option>
<option value="Callcenter">Callcenter</option>
<option value="Cart abandonment">Cart abandonment</option>
<option value="Community engagement">Community engagement</option>
<option value="Content">Content</option>
<option value="Customer Care Sorry Vouchers">Customer Care Sorry Vouchers</option>
<option value="Customer Events">Customer Events</option>
<option value="D2D">D2D</option>
<option value="Daily Deals">Daily Deals</option>
<option value="Darkposting">Darkposting</option>
<option value="Direct Affiliate">Direct Affiliate</option>
<option value="Door-to-Door">Door-to-Door</option>
<option value="DV360">DV360</option>
<option value="Email Partnerships">Email Partnerships</option>
<option value="Employee Discounts">Employee Discounts</option>
<option value="Event">Event</option>
<option value="Events">Events</option>
<option value="Facebook">Facebook</option>
<option value="Fixed Cost">Fixed Cost</option>
<option value="GDN">GDN</option>
<option value="Gift">Gift</option>
<option value="Gift boxes">Gift boxes</option>
<option value="Gift Card">Gift Card</option>
<option value="GSP">GSP</option>
<option value="Handouts">Handouts</option>
<option value="High Profile">High Profile</option>
<option value="Inbound">Inbound</option>
<option value="Influencer Amplification">Influencer Amplification</option>
<option value="Insert">Insert</option>
<option value="Kiosk">Kiosk</option>
<option value="Lead Cycle">Lead Cycle</option>
<option value="Magazine Ads / Editorial Magazine">Magazine Ads / Editorial Magazine</option>
<option value="Mainline">Mainline</option>
<option value="Marketing">Marketing</option>
<option value="Measurement Cost">Measurement Cost</option>
<option value="Native Facebook">Native Facebook</option>
<option value="Native Non-Facebook">Native Non-Facebook</option>
<option value="Network Affiliate">Network Affiliate</option>
<option value="Networks">Networks</option>
<option value="Newsletter">Newsletter</option>
<option value="Non-Facebook">Non-Facebook</option>
<option value="On-site">On-site</option>
<option value="Organic">Organic</option>
<option value="Organic Reactivation">Organic Reactivation</option>
<option value="Other Display">Other Display</option>
<option value="Outbound">Outbound</option>
<option value="Outdoor">Outdoor</option>
<option value="Outdoor Production">Outdoor Production</option>
<option value="Over The Top">Over The Top</option>
<option value="Over The Top (OTT)">Over The Top (OTT)</option>
<option value="Paid Social">Paid Social</option>
<option value="Parcel Inserts">Parcel Inserts</option>
<option value="Partnerships">Partnerships</option>
<option value="Podcast Ads">Podcast Ads</option>
<option value="Podcast Production">Podcast Production</option>
<option value="Podcast Sponsorship">Podcast Sponsorship</option>
<option value="PR Boxes">PR Boxes</option>
<option value="PR Events">PR Events</option>
<option value="PR Influencers">PR Influencers</option>
<option value="Print">Print</option>
<option value="Print Production">Print Production</option>
<option value="Production Cost">Production Cost</option>
<option value="Programmatic">Programmatic</option>
<option value="QA / Warehouse / Office boxes">QA / Warehouse / Office boxes</option>
<option value="Radio Ads">Radio Ads</option>
<option value="Radio Production">Radio Production</option>
<option value="Radio Sponsorship">Radio Sponsorship</option>
<option value="Research Cost">Research Cost</option>
<option value="Retail Gift Card">Retail Gift Card</option>
<option value="Retail Gift Cards">Retail Gift Cards</option>
<option value="SEA Brand">SEA Brand</option>
<option value="SEA Competitor">SEA Competitor</option>
<option value="SEA Fresh">SEA Fresh</option>
<option value="SEA Non Brand">SEA Non Brand</option>
<option value="SEA Non-Brand">SEA Non-Brand</option>
<option value="SEA Reactivation">SEA Reactivation</option>
<option value="SEA Shopping">SEA Shopping</option>
<option value="SEO Brand">SEO Brand</option>
<option value="SEO Non-Brand">SEO Non-Brand</option>
<option value="Shared Mailer (3rd party)">Shared Mailer (3rd party)</option>
<option value="Shared Mailer (in-house)">Shared Mailer (in-house)</option>
<option value="Talent Fees">Talent Fees</option>
<option value="Transactional">Transactional</option>
<option value="TV Advertising">TV Advertising</option>
<option value="TV Agency">TV Agency</option>
<option value="TV Buyouts">TV Buyouts</option>
<option value="TV Production">TV Production</option>
<option value="TV Sponsorship">TV Sponsorship</option>
<option value="TV Upload/Clearing">TV Upload/Clearing</option>
<option value="Unaddressed">Unaddressed</option>
<option value="Universal App Campaigns">Universal App Campaigns</option>
<option value="Video">Video</option>
<option value="Video Brand">Video Brand</option>
<option value="Video On Demand (VOD)">Video On Demand (VOD)</option>
<option value="Vlogging">Vlogging</option>
<option value="Youtube">Youtube</option>
</select>
<input class="formEntry" type="text" id="Partner" placeholder="Partner">
<select class="formEntry" name="Campaign Type" id="CampaignType">
<option value="" disabled selected>Campaign Type</option>
<option value="Acquisition">Acquisition</option>
<option value="Reactivation">Reactivation</option>
<option value="Lifecycle">Lifecycle</option>
<option value="Upselling">Upselling</option>
<option value="Retention">Retention</option>
</select>
<input class="formEntry" type="text" id="Vendor" placeholder="Vendor">
<input class="formEntry" type="date" id="CampaignStart" placeholder="Campaign Start">
<input class="formEntry" type="date" id="CampaignEnd" placeholder="Campaign End">
<input class="formEntry" type="text" id="Amount" placeholder="Amount">
<br>
<input class="btn" type="submit" value="Submit" />
</form>
</div>
<br>
<h2>My Campaigns</h2>
<table id="myTable">
<thead>
<tr>
<th>Entered By</th>
<th>Country</th>
<th>Medium</th>
<th>Channel Category</th>
<th>Channel</th>
<th>Channel Split</th>
<th>Partner</th>
<th>Campaign Type</th>
<th>Vendor</th>
<th>Campaign Start</th>
<th>Campaign End</th>
<th>Amount</th>
<th>Expense ID</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-firestore.js"></script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.7.0/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.7.0/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.15.5/firebase-firestore.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyD2Yz0n4P5MrXGvHXpYiCDsMmEZpc813MM",
authDomain: "logger-b2a2b.firebaseapp.com",
projectId: "logger-b2a2b",
storageBucket: "logger-b2a2b.appspot.com",
messagingSenderId: "378984296211",
appId: "1:378984296211:web:4f6b82de59d8e5e6fb74e6",
measurementId: "G-3N4QL6GNSF"
};
// // Initialize Firebase
// firebase.initializeApp(firebaseConfig);
// firebase.analytics();
</script>
<script>
// const firebase = require("firebase");
// // Required for side-effects
// require("firebase/firestore");
// // Initialize Cloud Firestore through Firebase
firebase.initializeApp({
apiKey: "AIzaSyD2Yz0n4P5MrXGvHXpYiCDsMmEZpc813MM",
authDomain: "logger-b2a2b.firebaseapp.com",
projectId: "logger-b2a2b",
});
var db = firebase.firestore();
</script>
<script>
function foo() {
if (document.getElementById("editCheck").checked) {
bar();
} else {
footwo();
}
}
function bar() {
Swal.fire(
'Nice!',
'You have updated an expense',
'success'
)
db.collection("expenses").where("expenseID", "==", document.getElementById("ExpenseID").value)
.get()
.then((querySnapshot) => {
querySnapshot.forEach(doc => {
doc.ref.delete()
})
});
footwo();
}
function footwo() {
Swal.fire(
'Nice!',
'You have submitted the expense',
'success'
)
var expense_id = 'MEL_' + Math.floor(Math.random() * 1000000)
db.collection("expenses").add({
expenseID: expense_id,
enteredBy: document.getElementById("EnteredBy").value,
country: document.getElementById("Country").value,
medium: document.getElementById("Medium").value,
channelCategory: document.getElementById("ChannelCategory").value,
channel: document.getElementById("Channel").value,
channelSplit: document.getElementById("ChannelSplit").value,
partner: document.getElementById("Partner").value,
campaignType: document.getElementById("CampaignType").value,
vendor: document.getElementById("Vendor").value,
campaignStart: document.getElementById("CampaignStart").value,
campaignEnd: document.getElementById("CampaignEnd").value,
amount: document.getElementById("Amount").value
})
.then((docRef) => {
console.log("Document written with ID: ", docRef.id);
})
.catch((error) => {
console.error("Error adding document: ", error);
});
}
</script>
<script>
console.log("HERE")
db.collection("expenses").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
// doc.data() is never undefined for query doc snapshots
console.log(doc.id, " => ", doc.data());
var tbodyRef = document.getElementById('myTable').getElementsByTagName('tbody')[0];
// Insert a row at the end of table
var newRow = tbodyRef.insertRow();
/*
// Insert a cell at the end of the row
var newCellBtn = newRow.insertCell();
// Append a text node to the cell
var newBtn = document.createElement("BUTTON");
newBtn.setAttribute("id", "editbtn");
newBtn.textContent = 'Edit';
newCellBtn.appendChild(newBtn);
*/
// Insert a cell at the end of the row
var newCell = newRow.insertCell();
// Append a text node to the cell
var newText = document.createTextNode(doc.data().enteredBy);
newCell.appendChild(newText);
// Insert a cell at the end of the row
var newCellCountry = newRow.insertCell();
// Append a text node to the cell
var newTextCountry = document.createTextNode(doc.data().country);
newCellCountry.appendChild(newTextCountry);
// Insert a cell at the end of the row
var newCell1 = newRow.insertCell();
// Append a text node to the cell
var newText1 = document.createTextNode(doc.data().medium);
newCell1.appendChild(newText1);
// Insert a cell at the end of the row
var newCell2 = newRow.insertCell();
// Append a text node to the cell
var newText2 = document.createTextNode(doc.data().channelCategory);
newCell2.appendChild(newText2);
// Insert a cell at the end of the row
var newCell3 = newRow.insertCell();
// Append a text node to the cell
var newText3 = document.createTextNode(doc.data().channel);
newCell3.appendChild(newText3);
// Insert a cell at the end of the row
var newCell4 = newRow.insertCell();
// Append a text node to the cell
var newText4 = document.createTextNode(doc.data().channelSplit);
newCell4.appendChild(newText4);
// Insert a cell at the end of the row
var newCell5 = newRow.insertCell();
// Append a text node to the cell
var newText5 = document.createTextNode(doc.data().partner);
newCell5.appendChild(newText5);
var newCell6 = newRow.insertCell();
// Append a text node to the cell
var newText6 = document.createTextNode(doc.data().campaignType);
newCell6.appendChild(newText6);
var newCell7 = newRow.insertCell();
// Append a text node to the cell
var newText7 = document.createTextNode(doc.data().vendor);
newCell7.appendChild(newText7);
var newCell8 = newRow.insertCell();
// Append a text node to the cell
var newText8 = document.createTextNode(doc.data().campaignStart);
newCell8.appendChild(newText8);
var newCell9 = newRow.insertCell();
// Append a text node to the cell
var newText9 = document.createTextNode(doc.data().campaignEnd);
newCell9.appendChild(newText9);
var newCell10 = newRow.insertCell();
// Append a text node to the cell
var newText10 = document.createTextNode(doc.data().amount);
newCell10.appendChild(newText10);
var newCell11 = newRow.insertCell();
// Append a text node to the cell
var newText11 = document.createTextNode(doc.data().expenseID);
newCell11.appendChild(newText11);
});
});
</script>
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
window.location = "index.html"
})};
function onLoad() {
gapi.load('auth2', function() {
gapi.auth2.init();
});
}
</script>
<script src="https://apis.google.com/js/platform.js?onload=onLoad" async defer></script>
</body>
</html>