.
This commit is contained in:
+16
-4
@@ -168,10 +168,22 @@
|
||||
previewEnd = null;
|
||||
render();
|
||||
if(selStart && selEnd){
|
||||
const url = requestUrl + '?worker_id=' + encodeURIComponent(workerId) + '&start_date=' + selStart + '&end_date=' + selEnd;
|
||||
setTimeout(function(){
|
||||
try{ if(window.htmx && typeof window.htmx.ajax === 'function'){ window.htmx.ajax('GET', url, {target:'#modal', swap:'innerHTML'}); } else { htmx.ajax('GET', url, {target:'#modal', swap:'innerHTML'}); } }catch(e){ window.location = url; }
|
||||
}, 80);
|
||||
// If a specific workerId is supplied, use existing single-worker modal flow.
|
||||
if(workerId){
|
||||
const url = requestUrl + '?worker_id=' + encodeURIComponent(workerId) + '&start_date=' + selStart + '&end_date=' + selEnd;
|
||||
setTimeout(function(){
|
||||
try{ if(window.htmx && typeof window.htmx.ajax === 'function'){ window.htmx.ajax('GET', url, {target:'#modal', swap:'innerHTML'}); } else { htmx.ajax('GET', url, {target:'#modal', swap:'innerHTML'}); } }catch(e){ window.location = url; }
|
||||
}, 80);
|
||||
} else {
|
||||
// Global calendar: prompt for workers to apply this leave to.
|
||||
// Use an HTMX GET to render the select-workers modal.
|
||||
let url = '/leave/select_workers/?start_date=' + encodeURIComponent(selStart) + '&end_date=' + encodeURIComponent(selEnd);
|
||||
// Include rota_id if present in the page URL
|
||||
try{ const rotaParam = new URLSearchParams(window.location.search).get('rota_id'); if(rotaParam){ url += '&rota_id=' + encodeURIComponent(rotaParam); } }catch(e){}
|
||||
setTimeout(function(){
|
||||
try{ if(window.htmx && typeof window.htmx.ajax === 'function'){ window.htmx.ajax('GET', url, {target:'#modal', swap:'innerHTML'}); } else { htmx.ajax('GET', url, {target:'#modal', swap:'innerHTML'}); } }catch(e){ window.location = url; }
|
||||
}, 80);
|
||||
}
|
||||
}
|
||||
}catch(e){ console.error('calendar pointer handler', e); }
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user