diff --git a/assets/js/app/filter.js b/assets/js/app/filter.js
index cf60a0c..9585307 100644
--- a/assets/js/app/filter.js
+++ b/assets/js/app/filter.js
@@ -19,7 +19,7 @@ export function filterAddressesByCase() {
addressList.innerHTML = '';
origin.innerHTML += '';
- destination.innerHTML += '';
+ destination.innerHTML += '';
result.forEach(a => {
origin.innerHTML += ``;
@@ -38,7 +38,7 @@ export function filterAddressesByCase() {
${a.formattedAddress} |
${a.lat}/${a.lon} |
-
+
edit
|
@@ -51,7 +51,7 @@ export function filterItineraryByCase() {
let caseId = null;
let startDate = null;
let endDate = null;
-
+
if (document.getElementById('case-filter').value) {
caseId = document.getElementById('case-filter').value;
}
@@ -79,7 +79,6 @@ export function filterItineraryByCase() {
.then(result => {
const itineraryList = document.getElementById('itineraryList');
itineraryList.innerHTML = '';
- console.log(result);
result.forEach(i => {
itineraryList.innerHTML += `
diff --git a/assets/js/app/itinerary.js b/assets/js/app/itinerary.js
index c5eb8f4..c8d15e0 100644
--- a/assets/js/app/itinerary.js
+++ b/assets/js/app/itinerary.js
@@ -21,19 +21,19 @@ export function addLocationToItinerary() {
let caseMileage = document.getElementById('case-mileage').checked;
let caseId = document.getElementById('case-filter').value;
- fetch('/index.php/api/add-location-to-itinerary', {
+ fetch('/api/add-location-to-itinerary', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
+ caseId: caseId,
date: date,
origin: origin,
destination: destination,
departure: departure,
arrival: arrival,
- caseMileage: caseMileage,
- caseId: caseId
+ caseMileage: caseMileage
})
})
.then(response => response.json())
diff --git a/assets/js/app/message.js b/assets/js/app/message.js
new file mode 100644
index 0000000..e97bfd2
--- /dev/null
+++ b/assets/js/app/message.js
@@ -0,0 +1,32 @@
+export function messageSupervisor() {
+ let btn = document.getElementById('message-supervisor');
+ btn.setAttribute('data-bs-toggle', 'modal');
+ btn.setAttribute('data-bs-target', '#message-modal');
+ btn.click();
+}
+
+export function openMessage() {
+ let btn = document.getElementById('open-message');
+ btn.setAttribute('data-bs-toggle', 'modal');
+ btn.setAttribute('data-bs-target', '#message-modal');
+ btn.click();
+}
+
+export function sendMessage() {
+ fetch('/api/send-message', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ case: document.getElementById('my-cases').value,
+ message: document.getElementById('message').value
+ })
+ })
+ .then(response => response.json())
+ .then(data => {
+ if (data.success === true) {
+ $('#close-modal').click();
+ }
+ });
+}
\ No newline at end of file
diff --git a/assets/js/app/notes.js b/assets/js/app/notes.js
new file mode 100644
index 0000000..0e67f66
--- /dev/null
+++ b/assets/js/app/notes.js
@@ -0,0 +1,46 @@
+export function filterNotes()
+{
+ let referralId = document.getElementById('referralList').value;
+ let startDate = document.getElementById('startDate').value;
+ let endDate = document.getElementById('endDate').value;
+ let caseId = null;
+
+ if (referralId.substr(0, 5) == 'case-') {
+ caseId = referralId.substr(5);
+ referralId = null;
+ }
+
+ fetch('/api/filter-notes', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ 'referral': referralId,
+ 'startDate': startDate,
+ 'endDate': endDate,
+ 'case': caseId
+ })
+ })
+ .then(response => response.json())
+ .then(data => {
+ const noteList = document.getElementById('note-list');
+ noteList.innerHTML = '';
+
+ data.forEach(i => {
+ noteList.innerHTML += `
+
+ ${i.date}
+ ${i.startTime}-${i.endTime} (${i.duration}) |
+ ${i.location} |
+ ${i.method} |
+ ${i.members} |
+
+
+ edit
+
+ |
+
`;
+ })
+ });
+}
\ No newline at end of file
diff --git a/assets/js/app/user.js b/assets/js/app/user.js
new file mode 100644
index 0000000..2b8583f
--- /dev/null
+++ b/assets/js/app/user.js
@@ -0,0 +1,21 @@
+export function createSignatureBlock() {
+ pad = new SignaturePad(document.getElementById('signature_pad'));
+ const ratio = Math.max(window.devicePixelRatio || 1, 1);
+ canvas.width = canvas.offsetWidth * ratio;
+ canvas.height = canvas.offsetHeight * ratio;
+ canvas.getContext("2d").scale(ratio, ratio);
+ //pad.clear(); // otherwise isEmpty() might return incorrect value
+}
+
+export function clearSignatureBlock() {
+ //const pad = new SignaturePad(document.getElementById('signature_pad'));
+ pad.clear();
+}
+
+export function saveSignatureBlock() {
+ //const pad = new SignaturePad(document.getElementById('signature_pad'));
+ const data = pad.toData();
+ document.getElementById('signature').value = data;
+
+ return true;
+}
\ No newline at end of file