This repository was archived by the owner on Jun 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteractUi.js
More file actions
77 lines (67 loc) · 2.07 KB
/
Copy pathinteractUi.js
File metadata and controls
77 lines (67 loc) · 2.07 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
68
69
70
71
72
73
74
75
76
77
'use strict';
// function searchMessagesById(contactId) {
// return $q( (resolve, reject) => {
// $http.get(`http://localhost:3000/messages/${contactId}`)
// .then( (data) => {
// console.log("records for that student:", data)
// resolve(data);
// })
// .catch( (err) => {
// reject(err);
// });
// });
// }
// searchMessagesById("0036100000uHOWD");
// //here, we need the listener that gets the input from the search field, then in that function:
// if (contactID) {
// searchEmailsById(contactID);
// } else if (relatedContactId) {
// searchByRelId(relatedContactId);
// } else if (emailAd) {
// searchByEmailAd(emailAd);
// } else {
// //something to say "please input something we can use"
// }
const handleFileSelect = (event) => {
console.log("firing event", event);
let file = event.target.files[0];
let data;
Papa.parse(file, {
header: true,
dynamicTyping: true,
step: (results) => {
data = results;
console.log('data?', data);
prepData(data.data[0]);
}
});
};
const runInsertToDB = (emailObj) => {
db.run(`INSERT INTO email VALUES (null,
'${emailObj.clicked}',
'${emailObj.contact}',
'${emailObj.contactId}',
'${emailObj.contactRecordType}',
'${emailObj.dateBounced}',
'${emailObj.dateOpened}',
'${emailObj.dateSent}',
'${emailObj.dateUnsubscribed}',
'${emailObj.deleted}',
'${emailObj.email}',
'${emailObj.emailName}',
'${emailObj.fromAddress}',
'${emailObj.fromName}',
'${emailObj.hardBounce}',
${emailObj.numberOfTotalClicks},
${emailObj.numberOfUniqueClicks},
'${emailObj.opened}',
'${emailObj.relatedStudentContactId}',
'${emailObj.softBounce}',
'${emailObj.subjectLine}')`);
}
//BELOW are a vanillaJS and jQuery way to output the results to the DOM
// let div = document.getElementById('output-field');
// div.innerHTML = "WHAT UP";
// $(document).ready(() => {
// $('#file-import').change(handleFileSelect);
// });