feat: dnevni unosi i svi dani u mjesecnom izvjestaju servisera
- Dodan model MonthlyServicerDayEntry s automatskom popunom prema tipu: office (08:00-16:00, Zagreb ured), vacation i sick_leave (8h bez vremena) - Migracija 0034_monthlyservicerdayentry za novu tablicu s UniqueConstraint - Novi ViewSet + serializer + endpoint fleet/monthly-servicer-day-entries/ (upsert: POST za novi dan ili update za isti dan ako vec postoji) - Backend DOCX report (_build_monthly_servicer_report_rows) sad generira redak za SVAKI dan u mjesecu: taskovi > rucni unos > prazan red - TaskCalendarWidget potpuno prepisan bez mojibake znakova (zamjena UTF-8 specijalnih znakova ASCII ekvivalentima u string literalima) - Tablica izvjestaja servisera: klikom na red bez naloga otvara se overlay s tri opcije (Rad u uredu / Bolovanje / Godisnji) - TaskCalendarPortal: dodan calendarWorkOrders computed (svi statusi) kako bi report imao potpune podatke o radnom vremenu - fetchMonthlyServicerEntries i upsertMonthlyServicerEntry u store-u Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -913,6 +913,30 @@ export async function downloadWorkOrderInvoicesDocx(workOrderId) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchMonthlyServicerEntries(year, month) {
|
||||
const payload = await api.get(
|
||||
`fleet/monthly-servicer-day-entries/?year=${year}&month=${month}`
|
||||
);
|
||||
return Array.isArray(payload) ? payload : (payload?.results ?? []);
|
||||
}
|
||||
|
||||
export async function upsertMonthlyServicerEntry(data = {}) {
|
||||
if (!data.entry_date) {
|
||||
throw new Error('Datum dnevnog unosa je obavezan.');
|
||||
}
|
||||
if (!data.entry_type) {
|
||||
throw new Error('Vrsta dnevnog unosa je obavezna.');
|
||||
}
|
||||
try {
|
||||
const response = await api.post('fleet/monthly-servicer-day-entries/', data);
|
||||
showToast('Dnevni unos je uspjesno spremljen.', 'success');
|
||||
return response;
|
||||
} catch (err) {
|
||||
showToast(err?.message || 'Spremanje dnevnog unosa nije uspjelo.', 'error');
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export async function downloadMonthlyServiserReport(year, month) {
|
||||
try {
|
||||
const blob = await api.get(
|
||||
|
||||
Reference in New Issue
Block a user