Skip to content

Commit e33400d

Browse files
committed
Fixing new names time problem
1 parent 1ce5405 commit e33400d

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

dr-controler.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ async function setSharingLink(questionaryId) {
148148
const formApiEndpoint = await drLib.getSharingToken(questionaryId);
149149
const sharingLink = patientURL + '?formApiEndpoint=' + formApiEndpoint;
150150
const sharingMailBody = 'Hello,\n\nI am sending you a link to fill out a form.\nPlease click on the link below to access the form: \n\n' + sharingLink + '\n\nBest regards,\nYour Doctor';
151-
const sharingLinkHTML = `<A HREF="mailto:?subject=Invitation&body=${encodeURI(sharingMailBody)}">Send by email</A> - ${sharingLink}`;
151+
let sharingLinkHTML = `<A HREF="mailto:?subject=Invitation&body=${encodeURI(sharingMailBody)}">Send by email</A>`;
152+
// add copy link
153+
sharingLinkHTML += ` - <A HREF="#" onclick="navigator.clipboard.writeText('${sharingLink}'); alert('Copied the sharing link to clipboard')">Copy link to clipboard</A>`;
154+
155+
152156
document.getElementById('sharing-link').innerHTML = sharingLinkHTML;
153157
}

dr.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2 class="card-title">Welcome</h2>
4848
<div id="questionnary-view">
4949
<div class="card">
5050
<h2 class="card-title">Sharing link</h2>
51-
<span id="sharing-link">
51+
<span id="sharing-link"></span>
5252
</div>
5353
<div class="card">
5454
<h2 class="card-title">Patients</h2>

patient-lib.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,16 @@ async function handleFormSubmit (formData, values, date) {
307307
continue;
308308
}
309309
// create a new event
310+
const eventData = {
311+
streamId: streamId,
312+
type: eventType,
313+
content: value
314+
};
315+
if (date) eventData.time = date.getTime() / 1000;
316+
310317
apiCalls.push({
311318
method: 'events.create',
312-
params: {
313-
streamId: streamId,
314-
type: eventType,
315-
content: value,
316-
time: date ? date.getTime() / 1000 : null
317-
}
319+
params: eventData
318320
});
319321
}
320322
if (apiCalls.length === 0) {

0 commit comments

Comments
 (0)