javascript for various functions
This commit is contained in:
parent
d85c1571e7
commit
04d5e88820
@ -19,7 +19,7 @@ export function filterAddressesByCase() {
|
||||
addressList.innerHTML = '';
|
||||
|
||||
origin.innerHTML += '<option value="">-- Origin --</option>';
|
||||
destination.innerHTML += '<option value="0">-- Destination --</option>';
|
||||
destination.innerHTML += '<option value="">-- Destination --</option>';
|
||||
|
||||
result.forEach(a => {
|
||||
origin.innerHTML += `<option value='${a.id}'>${a.name}</option>`;
|
||||
@ -38,7 +38,7 @@ export function filterAddressesByCase() {
|
||||
<td>${a.formattedAddress}</td>
|
||||
<td class='align-middle text-center text-xs'>${a.lat}/${a.lon}</td>
|
||||
<td class='align-middle'>
|
||||
<a href='/index.php/addresses/edit/${a.id}' title='Edit Address'>
|
||||
<a href='/addresses/edit/${a.id}' class='text-secondary' title='Edit Address'>
|
||||
<i class='material-symbols-rounded opacity-5'>edit</i>
|
||||
</a>
|
||||
</td>
|
||||
@ -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 += `
|
||||
|
@ -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())
|
||||
|
32
assets/js/app/message.js
Normal file
32
assets/js/app/message.js
Normal file
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
46
assets/js/app/notes.js
Normal file
46
assets/js/app/notes.js
Normal file
@ -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 += `
|
||||
<tr>
|
||||
<td>${i.date}<br/>
|
||||
${i.startTime}-${i.endTime} (${i.duration})</td>
|
||||
<td class='text-center'>${i.location}</td>
|
||||
<td class='text-center'>${i.method}</td>
|
||||
<td'>${i.members}</td>
|
||||
<td style='text-align: right;'>
|
||||
<a href='/edit-note/${i.noteType}/${i.id}' class='text-secondary' title='Edit Note'>
|
||||
<i class="material-symbols-rounded opacity-5">edit</i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>`;
|
||||
})
|
||||
});
|
||||
}
|
21
assets/js/app/user.js
Normal file
21
assets/js/app/user.js
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user