Servis: garantni list, radovi na otpremnici, selektivno prihvatanje predloga po stavkama
This commit is contained in:
@@ -718,7 +718,43 @@
|
||||
{{end}}
|
||||
</div>{{/* kraj stavke-blok */}}
|
||||
|
||||
|
||||
<!-- prihvati/odbij odabrane predlozene stavke (interna forma) -->
|
||||
{{if and (index .Dozvole "servis.izmeni") (or .PredlozeniRadovi .PredlozeniDelovi)}}
|
||||
<div class="kartica detalji-kartica animiraj" style="border-left:3px solid #f59e0b;">
|
||||
<div style="margin-bottom:14px;padding-bottom:12px;border-bottom:0.5px solid var(--ivica);display:flex;justify-content:space-between;align-items:center;">
|
||||
<span style="font-size:15px;font-weight:500;color:#f59e0b;">Predložene stavke</span>
|
||||
<span style="font-size:12px;color:var(--tekst-sporedni);">Odštikliraj šta ne prihvataš</span>
|
||||
</div>
|
||||
<form method="POST" action="/servis/{{.Nalog.ID}}/prihvati-odabrano" data-refresh="#radovi-blok, #delovi-blok, #nalog-ukupno">
|
||||
<input type="hidden" name="_csrf" value="{{.CsrfToken}}">
|
||||
{{if .PredlozeniRadovi}}
|
||||
<div style="font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.6px;color:var(--tekst-sporedni);margin-bottom:8px;">Radovi</div>
|
||||
{{range .PredlozeniRadovi}}
|
||||
<label style="display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:0.5px solid var(--ivica);cursor:pointer;">
|
||||
<span style="display:flex;align-items:center;gap:10px;flex:1;">
|
||||
<input type="checkbox" name="rad_id" value="{{.ID}}" checked style="width:16px;height:16px;accent-color:#f59e0b;flex-shrink:0;">
|
||||
<span style="font-size:13px;color:var(--tekst-glavni);">{{.Naziv}}{{if gt .Kolicina 1.0}} × {{printf "%.0f" .Kolicina}}{{end}}</span>
|
||||
</span>
|
||||
<span style="font-size:13px;font-weight:500;color:var(--tekst-glavni);white-space:nowrap;">{{dinari .Ukupno}} din</span>
|
||||
</label>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if .PredlozeniDelovi}}
|
||||
<div style="font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.6px;color:var(--tekst-sporedni);margin:{{if .PredlozeniRadovi}}12px{{else}}0px{{end}} 0 8px;">Delovi</div>
|
||||
{{range .PredlozeniDelovi}}
|
||||
<label style="display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:0.5px solid var(--ivica);cursor:pointer;">
|
||||
<span style="display:flex;align-items:center;gap:10px;flex:1;">
|
||||
<input type="checkbox" name="artikal_id" value="{{.ArtikalID}}" checked style="width:16px;height:16px;accent-color:#f59e0b;flex-shrink:0;">
|
||||
<span style="font-size:13px;color:var(--tekst-glavni);">{{.ArtikalNaziv}}{{if gt .Kolicina 1}} × {{.Kolicina}}{{end}}</span>
|
||||
</span>
|
||||
<span style="font-size:13px;font-weight:500;color:var(--tekst-glavni);white-space:nowrap;">{{if .Kolicina}}{{dinari .Ukupno}} din{{else}}—{{end}}</span>
|
||||
</label>
|
||||
{{end}}
|
||||
{{end}}
|
||||
<button type="submit" class="btn-primarno" style="width:100%;margin-top:14px;">Prihvati odabrano</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<!-- ukupno: zbir usluga (radova) i ugrađenih delova -->
|
||||
<div id="nalog-ukupno" class="kartica detalji-kartica animiraj">
|
||||
|
||||
@@ -164,6 +164,33 @@
|
||||
<div class="polje-tekst">{{if .Nalog.OpisKvara}}{{.Nalog.OpisKvara}}{{else}}<span class="prazno">—</span>{{end}}</div>
|
||||
</div>
|
||||
|
||||
<!-- radovi -->
|
||||
{{if .Radovi}}
|
||||
<div class="odeljak">
|
||||
<div class="odeljak-naslov">Izvršeni radovi</div>
|
||||
<table class="tabela">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Opis rada</th>
|
||||
<th class="desno" style="width:70px;">Kol.</th>
|
||||
<th class="desno" style="width:120px;">Cena/kom</th>
|
||||
<th class="desno" style="width:120px;">Ukupno</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Radovi}}
|
||||
<tr>
|
||||
<td>{{.Naziv}}</td>
|
||||
<td class="desno">{{printf "%.0f" .Kolicina}}</td>
|
||||
<td class="desno">{{dinari .CenaKomada}} din</td>
|
||||
<td class="desno">{{dinari .Ukupno}} din</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<!-- ugrađeni delovi -->
|
||||
{{if .ServisniDelovi}}
|
||||
<div class="odeljak">
|
||||
|
||||
@@ -54,14 +54,18 @@
|
||||
/* napomena na dnu */
|
||||
.dno-info { margin-top: 20px; font-size: 11px; color: #888; text-align: center; }
|
||||
|
||||
@page { size: A4; margin: 12mm 14mm 18mm; }
|
||||
@media print {
|
||||
body { font-size: 12px; }
|
||||
.strana { padding: 16px 20px; max-width: 100%; }
|
||||
.dugme-stampa { display: none !important; }
|
||||
@page { size: A4; margin: 12mm 14mm; }
|
||||
/* uslovi servisa (sa potpisima) idu na novu stranicu */
|
||||
.uslovi-strana { break-before: page; }
|
||||
.stampa-broj-strane { display: block; text-align: center; font-size: 9px; color: #888; margin-top: 16px; }
|
||||
.stampa-samo-ekran { display: none !important; }
|
||||
}
|
||||
.stampa-broj-strane { display: none; }
|
||||
.stampa-samo-ekran { display: block; }
|
||||
.dugme-stampa { position: fixed; bottom: 24px; right: 24px; background: #111; color: #fff; border: none; padding: 12px 22px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
|
||||
.dugme-stampa:hover { background: #333; }
|
||||
</style>
|
||||
@@ -202,5 +206,79 @@
|
||||
|
||||
<button class="dugme-stampa" onclick="window.print()">Štampaj</button>
|
||||
|
||||
<script>
|
||||
// Brojevi strana pri štampi — radi u svim browser-ima
|
||||
(function() {
|
||||
const sadrzaj = document.querySelector('.strana');
|
||||
if (!sadrzaj) return;
|
||||
|
||||
let originalniHTML = '';
|
||||
// Visina štampane strane (A4 - margine) u px
|
||||
const VISINA_STRANE_PX = (297 - 12 - 18) * 96 / 25.4;
|
||||
|
||||
function izmeriVisinu(el) {
|
||||
const test = el.cloneNode(true);
|
||||
test.style.cssText = 'position:absolute;visibility:hidden;width:' + sadrzaj.offsetWidth + 'px;max-width:none;';
|
||||
document.body.appendChild(test);
|
||||
const h = test.scrollHeight;
|
||||
document.body.removeChild(test);
|
||||
return h;
|
||||
}
|
||||
|
||||
window.addEventListener('beforeprint', function() {
|
||||
if (originalniHTML) return;
|
||||
originalniHTML = sadrzaj.innerHTML;
|
||||
|
||||
const ukupnaVisina = izmeriVisinu(sadrzaj);
|
||||
const brStrana = Math.max(1, Math.ceil(ukupnaVisina / VISINA_STRANE_PX));
|
||||
if (brStrana <= 1) return;
|
||||
|
||||
const deca = Array.from(sadrzaj.children);
|
||||
sadrzaj.innerHTML = '';
|
||||
|
||||
let stranaBr = 1;
|
||||
let visinaTrenutne = 0;
|
||||
let stranaDiv = napraviStranu(stranaBr, brStrana);
|
||||
sadrzaj.appendChild(stranaDiv);
|
||||
|
||||
for (const el of deca) {
|
||||
const h = izmeriVisinu(el);
|
||||
if (visinaTrenutne + h > VISINA_STRANE_PX && visinaTrenutne > 200) {
|
||||
dodajBrojac(stranaDiv, stranaBr, brStrana);
|
||||
stranaBr++;
|
||||
stranaDiv = napraviStranu(stranaBr, brStrana);
|
||||
sadrzaj.appendChild(stranaDiv);
|
||||
visinaTrenutne = 0;
|
||||
}
|
||||
stranaDiv.appendChild(el.cloneNode(true));
|
||||
visinaTrenutne += h;
|
||||
}
|
||||
dodajBrojac(stranaDiv, stranaBr, brStrana);
|
||||
});
|
||||
|
||||
function napraviStranu(br, ukupno) {
|
||||
const d = document.createElement('div');
|
||||
d.className = 'stampa-stranica';
|
||||
d.style.cssText = 'min-height:' + (VISINA_STRANE_PX - 30) + 'px;';
|
||||
if (br < ukupno) d.style.pageBreakAfter = 'always';
|
||||
return d;
|
||||
}
|
||||
|
||||
function dodajBrojac(stranaDiv, br, ukupno) {
|
||||
const brojac = document.createElement('div');
|
||||
brojac.className = 'stampa-broj-strane';
|
||||
brojac.textContent = br + ' / ' + ukupno;
|
||||
stranaDiv.appendChild(brojac);
|
||||
}
|
||||
|
||||
window.addEventListener('afterprint', function() {
|
||||
if (originalniHTML) {
|
||||
sadrzaj.innerHTML = originalniHTML;
|
||||
originalniHTML = '';
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -261,18 +261,33 @@
|
||||
Serviser predlaže sledeće radove i delove. Pogledajte i javite nam da li ste saglasni.
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/status/{{.Nalog.JavniToken}}/odluka-odabrano" style="margin-top:4px;">
|
||||
{{if .PredlozeniRadovi}}
|
||||
<div style="font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.6px;color:#94a3b8;margin-bottom:6px;">Radovi</div>
|
||||
{{range .PredlozeniRadovi}}
|
||||
<div class="red">
|
||||
<span class="red-labela">{{.Naziv}}{{if gt .Kolicina 1.0}} ×{{.Kolicina}}{{end}}</span>
|
||||
<span class="red-vrednost">{{dinari .Ukupno}} din</span>
|
||||
</div>
|
||||
<label style="display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:0.5px solid #1e293b;cursor:pointer;">
|
||||
<span style="display:flex;align-items:center;gap:10px;flex:1;">
|
||||
<input type="checkbox" name="rad_id" value="{{.ID}}" checked
|
||||
style="width:18px;height:18px;accent-color:#f59e0b;flex-shrink:0;">
|
||||
<span style="font-size:13px;color:#e2e8f0;">{{.Naziv}}{{if gt .Kolicina 1.0}} × {{printf "%.0f" .Kolicina}}{{end}}</span>
|
||||
</span>
|
||||
<span style="font-size:13px;font-weight:600;color:#fbbf24;white-space:nowrap;">{{dinari .Ukupno}} din</span>
|
||||
</label>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{if .PredlozeniDelovi}}
|
||||
<div style="font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.6px;color:#94a3b8;margin:10px 0 6px;">Delovi i materijal</div>
|
||||
{{range .PredlozeniDelovi}}
|
||||
<div class="red">
|
||||
<span class="red-labela">{{.ArtikalNaziv}}{{if gt .Kolicina 1}} ×{{.Kolicina}}{{end}}</span>
|
||||
<span class="red-vrednost">{{dinari .Ukupno}} din</span>
|
||||
</div>
|
||||
<label style="display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:0.5px solid #1e293b;cursor:pointer;">
|
||||
<span style="display:flex;align-items:center;gap:10px;flex:1;">
|
||||
<input type="checkbox" name="artikal_id" value="{{.ArtikalID}}" checked
|
||||
style="width:18px;height:18px;accent-color:#f59e0b;flex-shrink:0;">
|
||||
<span style="font-size:13px;color:#e2e8f0;">{{.ArtikalNaziv}}{{if gt .Kolicina 1}} × {{.Kolicina}}{{end}}</span>
|
||||
</span>
|
||||
<span style="font-size:13px;font-weight:600;color:#fbbf24;white-space:nowrap;">{{dinari .Ukupno}} din</span>
|
||||
</label>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
<div class="cena-blok predlog-ukupno" style="margin-top:12px;display:flex;justify-content:space-between;align-items:center;">
|
||||
@@ -280,14 +295,9 @@
|
||||
<span class="cena-vrednost">{{dinari .UkupnoPredlog}} din</span>
|
||||
</div>
|
||||
|
||||
<!-- komentar i dugmad -->
|
||||
<form method="POST" style="margin-top:16px;">
|
||||
<textarea name="komentar" placeholder="Poruka serviseru (opciono)..." rows="2"
|
||||
style="width:100%;padding:10px 12px;border:0.5px solid #334155;border-radius:8px;background:#0f172a;color:#e2e8f0;font-size:13px;font-family:inherit;resize:vertical;margin-bottom:10px;box-sizing:border-box;"></textarea>
|
||||
<div style="display:flex;gap:10px;">
|
||||
<button type="submit" formaction="/status/{{.Nalog.JavniToken}}/prihvati" class="dugme-prihvati" style="flex:1;">Prihvatam predlog</button>
|
||||
<button type="submit" formaction="/status/{{.Nalog.JavniToken}}/odbij" class="dugme-odbij" style="flex:1;">Ne prihvatam</button>
|
||||
</div>
|
||||
<textarea name="komentar" placeholder="Poruka serviseru (opciono)..." rows="2"
|
||||
style="width:100%;padding:10px 12px;border:0.5px solid #334155;border-radius:8px;background:#0f172a;color:#e2e8f0;font-size:13px;font-family:inherit;resize:vertical;margin:14px 0 10px;box-sizing:border-box;"></textarea>
|
||||
<button type="submit" class="dugme-prihvati" style="width:100%;">Potvrdi odabrano</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user