Dropdown: CSS u main.css, dupli handler fix, Prihod=prodaja+servis, mobilni layout
- main.css: cust-sel CSS prebačen iz dodatni-css (dostupan svim stranama) - servis_detalji: _custClickDodat guard protiv duplog event listenera - servis_detalji: _ntechPopuniArtikle na window (data-refresh fix) - izvestaj: PrihodTekuciMesec = prodaja + servis (Preuzeto) - main.css: mobilni dropdown preko cele širine (grid 1 kolona)
This commit is contained in:
@@ -37,8 +37,15 @@ func (r *sqliteIzvestajRepo) BrojAktivnihServisa(ctx context.Context) (int, erro
|
||||
func (r *sqliteIzvestajRepo) PrihodTekuciMesec(ctx context.Context) (float64, error) {
|
||||
var iznos float64
|
||||
err := r.db.QueryRowContext(ctx, `
|
||||
SELECT COALESCE(SUM(ukupno), 0) FROM prodajni_nalozi
|
||||
WHERE substr(datum, 1, 7) = strftime('%Y-%m', 'now', 'localtime')`).Scan(&iznos)
|
||||
SELECT COALESCE(
|
||||
(SELECT SUM(ukupno) FROM prodajni_nalozi
|
||||
WHERE substr(datum, 1, 7) = strftime('%Y-%m', 'now', 'localtime')),
|
||||
0)
|
||||
+ COALESCE(
|
||||
(SELECT SUM(cena_konacna) FROM servisni_nalozi
|
||||
WHERE status = 'Preuzeto'
|
||||
AND substr(datum_zavrsetka, 1, 7) = strftime('%Y-%m', 'now', 'localtime')),
|
||||
0)`).Scan(&iznos)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("ntech: izvestaj.PrihodTekuciMesec: %w", err)
|
||||
}
|
||||
|
||||
+34
-2
@@ -359,6 +359,36 @@ body {
|
||||
border-color: var(--ivica-jaka);
|
||||
}
|
||||
|
||||
/* custom dropdown (servis_detalji, prodaja_forma) — naziv levo, cena desno */
|
||||
.cust-sel { position: relative; }
|
||||
.cust-sel-btn {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
||||
height: 38px; padding: 0 10px; box-sizing: border-box; cursor: pointer;
|
||||
border: 0.5px solid var(--ivica) !important; border-radius: 8px; font-size: 14px;
|
||||
background: var(--kartica) !important; color: var(--tekst-glavni) !important;
|
||||
user-select: none;
|
||||
}
|
||||
.cust-sel-btn:focus { border-color: #3b82f6 !important; outline: none; }
|
||||
.cust-sel-tekst { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.cust-sel-chevron { font-size: 10px; color: var(--tekst-sporedni); flex-shrink: 0; transition: transform 0.15s; }
|
||||
.cust-sel.otvoren .cust-sel-chevron { transform: rotate(180deg); }
|
||||
.cust-sel-lista {
|
||||
position: absolute; top: calc(100% + 3px); left: -9999px; right: auto; z-index: 500;
|
||||
background: var(--kartica); border: 0.5px solid var(--ivica); border-radius: 10px;
|
||||
max-height: 260px; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.4);
|
||||
}
|
||||
.cust-sel.otvoren .cust-sel-lista { left: 0; right: 0; }
|
||||
.cso {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
||||
padding: 8px 12px; cursor: pointer; border-bottom: 0.5px solid var(--ivica); font-size: 13px;
|
||||
}
|
||||
.cso:last-child { border-bottom: none; }
|
||||
.cso:hover, .cso.izabran { background: rgba(255,255,255,0.06); }
|
||||
.cso-naziv { color: var(--tekst-glavni); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.cso-cena { color: #f59e0b; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
|
||||
.cso-prazno { color: var(--tekst-sporedni); }
|
||||
.kartica.cust-aktivan { position: relative; z-index: 100; }
|
||||
|
||||
/* hover varijante po korisničkoj preferenciji.
|
||||
Selektor je [data-hover] (ne body[data-hover]) da bi isti CSS
|
||||
radio i globalno (body) i lokalno na preview wrapperima. */
|
||||
@@ -1377,13 +1407,15 @@ select {
|
||||
font-size: 11px; font-weight: 600; background: #f59e0b; color: #fff;
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
/* na telefonu: dve kolone, dugme preko cele širine */
|
||||
/* na telefonu: polja jedno ispod drugog, dugme preko cele širine */
|
||||
.detalji-forma-rad,
|
||||
.detalji-forma-deo { grid-template-columns: 1fr 1fr; }
|
||||
.detalji-forma-deo { grid-template-columns: 1fr; }
|
||||
.detalji-forma-rad > :last-child,
|
||||
.detalji-forma-deo > :last-child { grid-column: 1 / -1; }
|
||||
.detalji-forma-rad > :last-child .btn-primarno,
|
||||
.detalji-forma-deo > :last-child .btn-primarno { width: 100%; }
|
||||
/* dropdown lista preko cele širine na mobilnom */
|
||||
.cust-sel-lista { max-height: 220px; }
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
@@ -11,35 +11,6 @@
|
||||
.detalji-kartica:nth-child(5) { animation-delay: 0.36s; }
|
||||
/* bez animacija na detaljima — smetaju pri dodavanju/brisanju stavki */
|
||||
#sadrzaj .kartica.animiraj { animation: none; }
|
||||
/* custom dropdown za usluge i artikle */
|
||||
.cust-sel { position: relative; }
|
||||
.cust-sel-btn {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
||||
height: 38px; padding: 0 10px; box-sizing: border-box; cursor: pointer;
|
||||
border: 0.5px solid var(--ivica) !important; border-radius: 8px; font-size: 14px;
|
||||
background: var(--kartica) !important; color: var(--tekst-glavni) !important;
|
||||
user-select: none;
|
||||
}
|
||||
.cust-sel-btn:focus { border-color: #3b82f6 !important; outline: none; }
|
||||
.cust-sel-tekst { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.cust-sel-chevron { font-size: 10px; color: var(--tekst-sporedni); flex-shrink: 0; transition: transform 0.15s; }
|
||||
.cust-sel.otvoren .cust-sel-chevron { transform: rotate(180deg); }
|
||||
.cust-sel-lista {
|
||||
position: absolute; top: calc(100% + 3px); left: -9999px; right: auto; z-index: 500;
|
||||
background: var(--kartica); border: 0.5px solid var(--ivica); border-radius: 10px;
|
||||
max-height: 260px; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.4);
|
||||
}
|
||||
.cust-sel.otvoren .cust-sel-lista { left: 0; right: 0; }
|
||||
.cso {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 12px;
|
||||
padding: 8px 12px; cursor: pointer; border-bottom: 0.5px solid var(--ivica); font-size: 13px;
|
||||
}
|
||||
.cso:last-child { border-bottom: none; }
|
||||
.cso:hover, .cso.izabran { background: rgba(255,255,255,0.06); }
|
||||
.cso-naziv { color: var(--tekst-glavni); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.cso-cena { color: #f59e0b; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
|
||||
.cso-prazno { color: var(--tekst-sporedni); }
|
||||
.kartica.cust-aktivan { position: relative; z-index: 100; }
|
||||
</style>
|
||||
{{end}}
|
||||
|
||||
@@ -1007,6 +978,8 @@ function _custZatvoriSve() {
|
||||
if (k) k.classList.remove('cust-aktivan');
|
||||
});
|
||||
}
|
||||
if (!window._custClickDodat) {
|
||||
window._custClickDodat = true;
|
||||
document.addEventListener('click', function (e) {
|
||||
var btn = e.target.closest('.cust-sel-btn');
|
||||
if (btn) {
|
||||
@@ -1049,6 +1022,7 @@ document.addEventListener('click', function (e) {
|
||||
}
|
||||
_custZatvoriSve();
|
||||
});
|
||||
}
|
||||
|
||||
// Radovi: pri izboru usluge (custom dropdown → hidden input) popuni predloženu cenu.
|
||||
document.addEventListener('change', function (e) {
|
||||
|
||||
Reference in New Issue
Block a user