Actualizar asignados.html
This commit is contained in:
@@ -189,9 +189,11 @@
|
|||||||
|
|
||||||
<div class="bg-slate-50 border-2 border-primary-dynamic p-5 rounded-2xl mb-6 shadow-inner text-center relative overflow-hidden">
|
<div class="bg-slate-50 border-2 border-primary-dynamic p-5 rounded-2xl mb-6 shadow-inner text-center relative overflow-hidden">
|
||||||
<div class="absolute left-0 top-0 bottom-0 w-2 bg-primary-dynamic"></div>
|
<div class="absolute left-0 top-0 bottom-0 w-2 bg-primary-dynamic"></div>
|
||||||
<p class="text-[10px] font-black text-primary-dynamic uppercase tracking-widest mb-1">Fecha Solicitada por el Cliente</p>
|
<p class="text-[10px] font-black text-primary-dynamic uppercase tracking-widest mb-3">Fecha y Hora de Cita (Modificable)</p>
|
||||||
<h4 class="text-2xl font-black text-slate-800" id="appDate">--/--/----</h4>
|
<div class="flex justify-center gap-3">
|
||||||
<p class="text-sm font-bold text-slate-600 mt-1" id="appTime">--:--</p>
|
<input type="date" id="appDateInput" class="bg-white border border-slate-200 px-3 py-2 rounded-xl text-sm font-black text-slate-700 outline-none focus:ring-2 focus:ring-primary-dynamic transition-all">
|
||||||
|
<input type="time" id="appTimeInput" class="bg-white border border-slate-200 px-3 py-2 rounded-xl text-sm font-black text-slate-700 outline-none focus:ring-2 focus:ring-primary-dynamic transition-all">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" id="appId">
|
<input type="hidden" id="appId">
|
||||||
@@ -415,8 +417,8 @@
|
|||||||
document.getElementById('appRef').innerText = `Exp. #${req.service_ref || "S/R"}`;
|
document.getElementById('appRef').innerText = `Exp. #${req.service_ref || "S/R"}`;
|
||||||
document.getElementById('appName').innerText = raw["Nombre Cliente"] || "Cliente";
|
document.getElementById('appName').innerText = raw["Nombre Cliente"] || "Cliente";
|
||||||
|
|
||||||
document.getElementById('appDate').innerText = formatDate(raw.requested_date);
|
document.getElementById('appDateInput').value = raw.requested_date || "";
|
||||||
document.getElementById('appTime').innerText = `Llegada aprox: ${raw.requested_time} - ${addOneHour(raw.requested_time)}`;
|
document.getElementById('appTimeInput').value = raw.requested_time || "";
|
||||||
document.getElementById('appDurationInput').value = "60";
|
document.getElementById('appDurationInput').value = "60";
|
||||||
|
|
||||||
const modal = document.getElementById('approveModal');
|
const modal = document.getElementById('approveModal');
|
||||||
@@ -430,6 +432,8 @@
|
|||||||
async function approveRequest() {
|
async function approveRequest() {
|
||||||
const id = document.getElementById('appId').value;
|
const id = document.getElementById('appId').value;
|
||||||
const duration = document.getElementById('appDurationInput').value;
|
const duration = document.getElementById('appDurationInput').value;
|
||||||
|
const date = document.getElementById('appDateInput').value;
|
||||||
|
const time = document.getElementById('appTimeInput').value;
|
||||||
const btn = document.getElementById('btnApprove');
|
const btn = document.getElementById('btnApprove');
|
||||||
const originalContent = btn.innerHTML;
|
const originalContent = btn.innerHTML;
|
||||||
btn.innerHTML = `<i data-lucide="loader-2" class="w-4 h-4 animate-spin"></i>`;
|
btn.innerHTML = `<i data-lucide="loader-2" class="w-4 h-4 animate-spin"></i>`;
|
||||||
@@ -439,7 +443,7 @@
|
|||||||
const res = await fetch(`${API_URL}/agenda/requests/${id}/approve`, {
|
const res = await fetch(`${API_URL}/agenda/requests/${id}/approve`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}` },
|
headers: { "Content-Type": "application/json", "Authorization": `Bearer ${localStorage.getItem("token")}` },
|
||||||
body: JSON.stringify({ duration: duration })
|
body: JSON.stringify({ duration: duration, date: date, time: time })
|
||||||
});
|
});
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
showToast("Cita Aceptada");
|
showToast("Cita Aceptada");
|
||||||
|
|||||||
Reference in New Issue
Block a user