32 lines
956 B
JavaScript
32 lines
956 B
JavaScript
|
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();
|
||
|
}
|
||
|
});
|
||
|
}
|