This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
147 lines (136 loc) · 4.89 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<script src="/main.js"></script>
</head>
<body>
<p>JobCloud ApplyWith SDK DEV</p>
<div id="jobcloud-outlet"></div>
<form id="app-form" method="POST" action="http://localhost:8083/upload" enctype="application/x-www-form-urlencoded">
<fieldset>
<label>Salutation: </label><select name="salutation" id="app-gender"><option value="M">Mr.</option><option value="F">Mrs.</option></select>
</fieldset>
<fieldset>
<label>Firstname: </label><input name="firstname" id="app-firstname" type="text" />
</fieldset>
<fieldset>
<label>Lastname: </label><input name="lastname" id="app-lastname" type="text" />
</fieldset>
<fieldset>
<label>Email: </label><input name="email" id="app-email" type="text" />
</fieldset>
<fieldset>
<label>Phone: </label><input name="phone" id="app-phone" type="text" />
</fieldset>
<fieldset>
<label>Zipcode: </label><input name="zipcode" id="app-zipcode" type="text" />
</fieldset>
<fieldset>
<label>City: </label><input name="city" id="app-city" type="text" />
</fieldset>
<fieldset>
<label>Country: </label><input name="country" id="app-country" type="text" />
</fieldset>
<fieldset>
<h3>Picture:</h3>
<div id="app-picture"></div>
</fieldset>
<fieldset>
<h3>Attachments:</h3>
<ul id="app-attachments"></ul>
</fieldset>
<fieldset>
<h3>Attachments (useFileRefs):</h3>
<ul id="app-attachments-ref"></ul>
</fieldset>
<fieldset>
<input type="submit" />
</fieldset>
</form>
<script type="text/javascript">
var createPicture = function(url) {
var $picture = document.querySelector('#app-picture');
var $image = document.createElement('img');
$image.src = url;
$picture.appendChild($image);
}
var createAttachment = function(name, mimeType, base64String, tags) {
var $attachments = document.querySelector('#app-attachments');
var $form = document.querySelector('#app-form');
// Create visible list item
var $listItem = document.createElement('li');
$listItem.textContent = name + ' (' + mimeType + ')';
$attachments.appendChild($listItem);
// Create hidden form input
var $input = document.createElement('input');
$input.setAttribute('type', 'hidden');
$input.setAttribute('name', 'attachment[' + name + ']');
$input.setAttribute('value', base64String);
$input.setAttribute('data-tags', tags.join(', '));
$form.appendChild($input);
}
var createImage = function(url) {
var $attachments = document.querySelector('#app-attachments-ref');
var $image = document.createElement('img');
$image.src = url;
var $listItem = document.createElement('li');
$listItem.appendChild($image);
$attachments.appendChild($listItem);
}
var sdkCallback = function(app) {
document.querySelector('#app-gender').value = app.gender;
document.querySelector('#app-email').value = app.email;
if (app.firstName && app.lastName) {
document.querySelector('#app-firstname').value = app.firstName;
document.querySelector('#app-lastname').value = app.lastName;
}
if (app.phone) {
document.querySelector('#app-phone').value = app.phone;
}
if (app.zipCode) {
document.querySelector('#app-zipcode').value = app.zipCode;
}
if (app.city) {
document.querySelector('#app-city').value = app.city;
}
if (app.country) {
document.querySelector('#app-country').value = app.country;
}
if (app.picture) {
createPicture(app.picture);
}
// Create list of attachments
var $attachments = document.querySelector('#app-attachments');
if (app.cv) {
createAttachment('JobCloud_CV.pdf', app.cv.mimeType, app.cv.binary, []);
}
if (app.documents) {
app.documents.forEach(function (doc) {
createAttachment(doc.fileName, doc.mimeType, doc.binary, doc.tags || []);
if (doc.transientUrl) {
createImage(doc.transientUrl);
}
});
}
}
JobCloudSDK.injectButton({
tenant: 'jobs_ch',
accessKey: '22_ffff',
injectElement: '#jobcloud-outlet',
useFileRefs: true,
locale: 'de',
env: 'dev', // prod, test, dev
callback: sdkCallback
});
JobCloudSDK.injectButton({
tenant: 'jobup_ch',
accessKey: '22_ffff',
injectElement: '#jobcloud-outlet',
useFileRefs: true,
locale: 'en',
env: 'dev', // prod, test, dev
callback: sdkCallback
});
</script>
</body>
</html>