@gelabs/ovr 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accounts.d.ts +52 -0
- package/dist/accounts.js +13 -0
- package/dist/audit.d.ts +13 -0
- package/dist/audit.js +11 -0
- package/dist/auth-auth.d.ts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/chunk-4EDMZRGS.js +98 -0
- package/dist/chunk-4JMHQKMK.js +268 -0
- package/dist/chunk-6662IONX.js +69 -0
- package/dist/chunk-6WMPBAUH.js +18 -0
- package/dist/chunk-7GVZZWK3.js +74 -0
- package/dist/chunk-ACXED4UH.js +403 -0
- package/dist/chunk-BBTAG3FD.js +165 -0
- package/dist/chunk-HX7QT2FE.js +452 -0
- package/dist/chunk-LC3S47FM.js +468 -0
- package/dist/chunk-NPTR7GFZ.js +432 -0
- package/dist/chunk-SLQRZBMR.js +66 -0
- package/dist/chunk-UBUXPJLN.js +29 -0
- package/dist/chunk-UN6Z4WGF.js +31 -0
- package/dist/chunk-YE3D2DYY.js +83 -0
- package/dist/citizen.d.ts +5 -0
- package/dist/citizen.js +12 -0
- package/dist/config.d.ts +2 -2
- package/dist/core-i18n.d.ts +1 -1
- package/dist/core.d.ts +2 -2
- package/dist/dashboard.d.ts +10 -0
- package/dist/dashboard.js +3 -0
- package/dist/data-mock-store.d.ts +1 -1
- package/dist/{format-C7MSwUHK.d.ts → format-VyCUfF8R.d.ts} +1 -1
- package/dist/generated/client/edge.js +2 -2
- package/dist/generated/client/index.js +2 -2
- package/dist/generated/client/wasm.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/notifications.d.ts +6 -0
- package/dist/notifications.js +11 -0
- package/dist/officers.d.ts +27 -0
- package/dist/officers.js +11 -0
- package/dist/offline.d.ts +1 -1
- package/dist/payments.d.ts +15 -0
- package/dist/payments.js +11 -0
- package/dist/roles.d.ts +37 -0
- package/dist/roles.js +12 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/tickets.d.ts +6 -0
- package/dist/tickets.js +24 -0
- package/dist/ui-components-admin/accounts-manager.d.ts +3 -52
- package/dist/ui-components-admin/accounts-manager.js +11 -468
- package/dist/ui-components-admin/admin-nav.js +9 -81
- package/dist/ui-components-admin/issuance-form.js +15 -432
- package/dist/ui-components-admin/logs-viewer.d.ts +3 -13
- package/dist/ui-components-admin/logs-viewer.js +8 -98
- package/dist/ui-components-admin/notifications-list.js +6 -66
- package/dist/ui-components-admin/officers-manager.d.ts +3 -27
- package/dist/ui-components-admin/officers-manager.js +9 -268
- package/dist/ui-components-admin/roles-manager.d.ts +3 -37
- package/dist/ui-components-admin/roles-manager.js +10 -403
- package/dist/ui-components-admin/stat-card.d.ts +2 -10
- package/dist/ui-components-admin/stat-card.js +3 -29
- package/dist/ui-components-admin/ticket-preview.js +2 -2
- package/dist/ui-components-admin/tickets-table.js +7 -69
- package/dist/ui-components-admin/violations-manager.js +13 -452
- package/dist/ui-components-citizen/citizen-nav.js +3 -31
- package/dist/ui-components-citizen/payment-form.d.ts +3 -14
- package/dist/ui-components-citizen/payment-form.js +9 -165
- package/dist/ui-components-citizen/payment-qr-dialog.js +2 -2
- package/dist/ui-components-citizen/ticket-not-found.js +4 -18
- package/dist/ui-components-citizen/violation-history-table.js +6 -74
- package/dist/ui-config.d.ts +2 -2
- package/dist/ui-server.d.ts +2 -2
- package/dist/violations.d.ts +3 -0
- package/dist/violations.js +14 -0
- package/package.json +42 -2
- package/dist/{chunk-ZUMEOZ22.js → chunk-JTSTNZAB.js} +1 -1
- package/dist/{chunk-TLG4C2XI.js → chunk-QCAURREW.js} +1 -1
- package/dist/{schema-CdsFQxIg.d.ts → schema-BUhh_mKX.d.ts} +108 -108
|
@@ -1,440 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Checkbox } from '../chunk-BBQBKQA4.js';
|
|
6
|
-
import { TicketPreview } from '../chunk-ZUMEOZ22.js';
|
|
2
|
+
export { IssuanceForm } from '../chunk-NPTR7GFZ.js';
|
|
3
|
+
import '../chunk-EGKFELO3.js';
|
|
4
|
+
import '../chunk-JTSTNZAB.js';
|
|
7
5
|
import '../chunk-IBZVIUNI.js';
|
|
8
6
|
import '../chunk-GLIK5BHP.js';
|
|
7
|
+
import '../chunk-QCRVT2SS.js';
|
|
8
|
+
import '../chunk-YGYA7KEG.js';
|
|
9
9
|
import '../chunk-NSCIBSCW.js';
|
|
10
|
+
import '../chunk-EYFZWQ4J.js';
|
|
11
|
+
import '../chunk-BBQBKQA4.js';
|
|
12
|
+
import '../chunk-XQTVSNHC.js';
|
|
13
|
+
import '../chunk-M35R6JLA.js';
|
|
14
|
+
import '../chunk-K3KIBHJF.js';
|
|
10
15
|
import '../chunk-OE525ZER.js';
|
|
11
16
|
import '../chunk-BVI5XDDA.js';
|
|
12
|
-
import { Card, CardHeader, CardTitle, CardContent, CardDescription } from '../chunk-SETIN6XP.js';
|
|
13
17
|
import '../chunk-OWCGEEAZ.js';
|
|
14
18
|
import '../chunk-55FQP2DO.js';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { cn } from '../chunk-77QBZC7J.js';
|
|
21
|
-
import { useIdentity } from '../chunk-YGYA7KEG.js';
|
|
22
|
-
import { localToManilaISO, toPreviewTicket, listProvinces, citiesOfProvince } from '../chunk-BI4EGLPG.js';
|
|
23
|
-
import * as React from 'react';
|
|
24
|
-
import { toast } from 'sonner';
|
|
25
|
-
import { FilePlus2, TriangleAlert, Loader2 } from 'lucide-react';
|
|
26
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
27
|
-
|
|
28
|
-
var fieldClass = "h-9 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm shadow-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50 dark:bg-input/30";
|
|
29
|
-
function TextField({
|
|
30
|
-
id,
|
|
31
|
-
label,
|
|
32
|
-
value,
|
|
33
|
-
onChange,
|
|
34
|
-
placeholder,
|
|
35
|
-
required,
|
|
36
|
-
type = "text"
|
|
37
|
-
}) {
|
|
38
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
39
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: id, children: [
|
|
40
|
-
label,
|
|
41
|
-
required ? /* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" }) : null
|
|
42
|
-
] }),
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
Input,
|
|
45
|
-
{
|
|
46
|
-
id,
|
|
47
|
-
type,
|
|
48
|
-
value,
|
|
49
|
-
onChange: (e) => onChange(e.target.value),
|
|
50
|
-
placeholder,
|
|
51
|
-
autoComplete: "off"
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
] });
|
|
55
|
-
}
|
|
56
|
-
function ViolationRow({
|
|
57
|
-
item,
|
|
58
|
-
checked,
|
|
59
|
-
details,
|
|
60
|
-
onToggle,
|
|
61
|
-
onDetails,
|
|
62
|
-
formatPeso
|
|
63
|
-
}) {
|
|
64
|
-
return /* @__PURE__ */ jsxs(
|
|
65
|
-
"div",
|
|
66
|
-
{
|
|
67
|
-
className: cn(
|
|
68
|
-
"rounded-lg border p-3 transition-colors",
|
|
69
|
-
checked ? "border-primary/40 bg-primary/5" : "hover:bg-muted/40"
|
|
70
|
-
),
|
|
71
|
-
children: [
|
|
72
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
73
|
-
/* @__PURE__ */ jsx(
|
|
74
|
-
Checkbox,
|
|
75
|
-
{
|
|
76
|
-
id: `v-${item.code}`,
|
|
77
|
-
checked,
|
|
78
|
-
onCheckedChange: (v) => onToggle(v === true),
|
|
79
|
-
className: "mt-0.5"
|
|
80
|
-
}
|
|
81
|
-
),
|
|
82
|
-
/* @__PURE__ */ jsxs("label", { htmlFor: `v-${item.code}`, className: "flex-1 cursor-pointer", children: [
|
|
83
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between gap-2", children: [
|
|
84
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: item.title }),
|
|
85
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-sm font-medium tabular-nums", children: formatPeso(item.basicFine) })
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: item.code })
|
|
88
|
-
] })
|
|
89
|
-
] }),
|
|
90
|
-
checked ? /* @__PURE__ */ jsx(
|
|
91
|
-
Textarea,
|
|
92
|
-
{
|
|
93
|
-
value: details,
|
|
94
|
-
onChange: (e) => onDetails(e.target.value),
|
|
95
|
-
placeholder: "Add details \u2014 location, circumstances, plate, etc.",
|
|
96
|
-
rows: 2,
|
|
97
|
-
className: "mt-2.5"
|
|
98
|
-
}
|
|
99
|
-
) : null
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
function IssuanceForm({
|
|
105
|
-
catalog,
|
|
106
|
-
officers,
|
|
107
|
-
createAction
|
|
108
|
-
}) {
|
|
109
|
-
const { formatPeso, nowManilaLocalInput } = useFormatters();
|
|
110
|
-
const { municipality, rules } = useOvrConfig();
|
|
111
|
-
const identity = useIdentity();
|
|
112
|
-
const [firstName, setFirstName] = React.useState("");
|
|
113
|
-
const [middleName, setMiddleName] = React.useState("");
|
|
114
|
-
const [lastName, setLastName] = React.useState("");
|
|
115
|
-
const [street, setStreet] = React.useState("");
|
|
116
|
-
const [barangay, setBarangay] = React.useState("");
|
|
117
|
-
const [cityMunicipality, setCityMunicipality] = React.useState(
|
|
118
|
-
municipality.shortName
|
|
119
|
-
);
|
|
120
|
-
const [province, setProvince] = React.useState(municipality.province);
|
|
121
|
-
const [licenseNumber, setLicenseNumber] = React.useState("");
|
|
122
|
-
const [plateNumber, setPlateNumber] = React.useState("");
|
|
123
|
-
const [contactNo, setContactNo] = React.useState("");
|
|
124
|
-
const [apprehendedLocal, setApprehendedLocal] = React.useState("");
|
|
125
|
-
const [placeOfViolation, setPlaceOfViolation] = React.useState("");
|
|
126
|
-
const [officerId, setOfficerId] = React.useState(officers[0]?.id ?? "");
|
|
127
|
-
const [selected, setSelected] = React.useState({});
|
|
128
|
-
const [remarks, setRemarks] = React.useState("");
|
|
129
|
-
const [issuedBy, setIssuedBy] = React.useState("");
|
|
130
|
-
const [mounted, setMounted] = React.useState(false);
|
|
131
|
-
const [open, setOpen] = React.useState(false);
|
|
132
|
-
const [error, setError] = React.useState(null);
|
|
133
|
-
const [isPending, startTransition] = React.useTransition();
|
|
134
|
-
React.useEffect(() => {
|
|
135
|
-
setMounted(true);
|
|
136
|
-
setApprehendedLocal(nowManilaLocalInput());
|
|
137
|
-
}, [nowManilaLocalInput]);
|
|
138
|
-
function toggle(code, checked) {
|
|
139
|
-
setSelected((prev) => {
|
|
140
|
-
const next = { ...prev };
|
|
141
|
-
if (checked) next[code] = next[code] ?? "";
|
|
142
|
-
else delete next[code];
|
|
143
|
-
return next;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const violator = {
|
|
147
|
-
firstName,
|
|
148
|
-
middleName: middleName || void 0,
|
|
149
|
-
lastName,
|
|
150
|
-
street,
|
|
151
|
-
barangay: barangay || void 0,
|
|
152
|
-
cityMunicipality,
|
|
153
|
-
province,
|
|
154
|
-
licenseNumber,
|
|
155
|
-
plateNumber: plateNumber || void 0,
|
|
156
|
-
contactNo: contactNo || void 0
|
|
157
|
-
};
|
|
158
|
-
const chosen = catalog.filter((c) => c.code in selected);
|
|
159
|
-
const total = chosen.reduce((s, c) => s + c.basicFine, 0);
|
|
160
|
-
const draft = {
|
|
161
|
-
violator,
|
|
162
|
-
apprehendedAtISO: apprehendedLocal ? localToManilaISO(apprehendedLocal) : "",
|
|
163
|
-
placeOfViolation: placeOfViolation || void 0,
|
|
164
|
-
officer: officers.find((o) => o.id === officerId),
|
|
165
|
-
violations: chosen.map((c) => ({ item: c, details: selected[c.code] })),
|
|
166
|
-
remarks: remarks || void 0
|
|
167
|
-
};
|
|
168
|
-
const preview = toPreviewTicket(draft, /* @__PURE__ */ new Date(), rules);
|
|
169
|
-
const valid = !!firstName.trim() && !!lastName.trim() && !!street.trim() && !!cityMunicipality.trim() && !!province.trim() && !!licenseNumber.trim() && !!apprehendedLocal && !!officerId && chosen.length > 0;
|
|
170
|
-
function issue() {
|
|
171
|
-
setError(null);
|
|
172
|
-
const input = {
|
|
173
|
-
violator,
|
|
174
|
-
apprehendedAt: localToManilaISO(apprehendedLocal),
|
|
175
|
-
placeOfViolation: placeOfViolation || void 0,
|
|
176
|
-
officerId,
|
|
177
|
-
violations: Object.entries(selected).map(([catalogCode, details]) => ({
|
|
178
|
-
catalogCode,
|
|
179
|
-
details: details || void 0
|
|
180
|
-
})),
|
|
181
|
-
remarks: remarks || void 0,
|
|
182
|
-
issuedBy: issuedBy || void 0,
|
|
183
|
-
apprehendingEnforcerId: identity?.userId,
|
|
184
|
-
apprehendingEnforcerName: identity?.username
|
|
185
|
-
};
|
|
186
|
-
startTransition(async () => {
|
|
187
|
-
const res = await createAction(input);
|
|
188
|
-
if (res?.error) {
|
|
189
|
-
setError(res.error);
|
|
190
|
-
toast.error(res.error);
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
const traffic = catalog.filter((c) => c.category === "TRAFFIC");
|
|
195
|
-
const ordinance = catalog.filter((c) => c.category === "ORDINANCE");
|
|
196
|
-
return /* @__PURE__ */ jsxs("div", { className: "grid gap-6 lg:grid-cols-5", children: [
|
|
197
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-6 lg:col-span-3", children: [
|
|
198
|
-
/* @__PURE__ */ jsxs(Card, { children: [
|
|
199
|
-
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: "Violator details" }) }),
|
|
200
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
201
|
-
/* @__PURE__ */ jsx(TextField, { id: "firstName", label: "First name", value: firstName, onChange: setFirstName, required: true }),
|
|
202
|
-
/* @__PURE__ */ jsx(TextField, { id: "middleName", label: "Middle name", value: middleName, onChange: setMiddleName }),
|
|
203
|
-
/* @__PURE__ */ jsx(TextField, { id: "lastName", label: "Last name", value: lastName, onChange: setLastName, required: true }),
|
|
204
|
-
/* @__PURE__ */ jsx(TextField, { id: "license", label: "License number", value: licenseNumber, onChange: setLicenseNumber, required: true, placeholder: "N03-12-345678" }),
|
|
205
|
-
/* @__PURE__ */ jsx("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx(TextField, { id: "street", label: "Address line", value: street, onChange: setStreet, required: true, placeholder: "House no. / Purok / Zone / Street" }) }),
|
|
206
|
-
/* @__PURE__ */ jsx("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx(TextField, { id: "barangay", label: "Barangay", value: barangay, onChange: setBarangay, placeholder: "e.g. Amungan" }) }),
|
|
207
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
208
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: "province", children: [
|
|
209
|
-
"Province",
|
|
210
|
-
/* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" })
|
|
211
|
-
] }),
|
|
212
|
-
/* @__PURE__ */ jsxs(
|
|
213
|
-
"select",
|
|
214
|
-
{
|
|
215
|
-
id: "province",
|
|
216
|
-
value: province,
|
|
217
|
-
onChange: (e) => {
|
|
218
|
-
const p = e.target.value;
|
|
219
|
-
setProvince(p);
|
|
220
|
-
if (cityMunicipality && !citiesOfProvince(p).includes(cityMunicipality)) {
|
|
221
|
-
setCityMunicipality("");
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
className: fieldClass,
|
|
225
|
-
children: [
|
|
226
|
-
/* @__PURE__ */ jsx("option", { value: "", children: "Select province\u2026" }),
|
|
227
|
-
listProvinces().map((p) => /* @__PURE__ */ jsx("option", { value: p, children: p }, p))
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
)
|
|
231
|
-
] }),
|
|
232
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
233
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: "city", children: [
|
|
234
|
-
"City / Municipality",
|
|
235
|
-
/* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" })
|
|
236
|
-
] }),
|
|
237
|
-
/* @__PURE__ */ jsxs(
|
|
238
|
-
"select",
|
|
239
|
-
{
|
|
240
|
-
id: "city",
|
|
241
|
-
value: cityMunicipality,
|
|
242
|
-
onChange: (e) => setCityMunicipality(e.target.value),
|
|
243
|
-
disabled: !province,
|
|
244
|
-
className: fieldClass,
|
|
245
|
-
children: [
|
|
246
|
-
/* @__PURE__ */ jsx("option", { value: "", children: province ? "Select city / municipality\u2026" : "Select a province first" }),
|
|
247
|
-
citiesOfProvince(province).map((c) => /* @__PURE__ */ jsx("option", { value: c, children: c }, c))
|
|
248
|
-
]
|
|
249
|
-
}
|
|
250
|
-
)
|
|
251
|
-
] }),
|
|
252
|
-
/* @__PURE__ */ jsx(TextField, { id: "plate", label: "Plate number", value: plateNumber, onChange: setPlateNumber, placeholder: "ABC 1234" }),
|
|
253
|
-
/* @__PURE__ */ jsx(TextField, { id: "contact", label: "Contact number", value: contactNo, onChange: setContactNo, placeholder: "0917 555 0000" })
|
|
254
|
-
] })
|
|
255
|
-
] }),
|
|
256
|
-
/* @__PURE__ */ jsxs(Card, { children: [
|
|
257
|
-
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: "Apprehension details" }) }),
|
|
258
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
259
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
260
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: "apprehendedAt", children: [
|
|
261
|
-
"Date & time",
|
|
262
|
-
/* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" })
|
|
263
|
-
] }),
|
|
264
|
-
/* @__PURE__ */ jsx(
|
|
265
|
-
Input,
|
|
266
|
-
{
|
|
267
|
-
id: "apprehendedAt",
|
|
268
|
-
type: "datetime-local",
|
|
269
|
-
value: apprehendedLocal,
|
|
270
|
-
onChange: (e) => setApprehendedLocal(e.target.value)
|
|
271
|
-
}
|
|
272
|
-
)
|
|
273
|
-
] }),
|
|
274
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
275
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: "officer", children: [
|
|
276
|
-
"Apprehending officer",
|
|
277
|
-
/* @__PURE__ */ jsx("span", { className: "text-destructive", children: " *" })
|
|
278
|
-
] }),
|
|
279
|
-
/* @__PURE__ */ jsx(
|
|
280
|
-
"select",
|
|
281
|
-
{
|
|
282
|
-
id: "officer",
|
|
283
|
-
value: officerId,
|
|
284
|
-
onChange: (e) => setOfficerId(e.target.value),
|
|
285
|
-
className: fieldClass,
|
|
286
|
-
children: officers.map((o) => /* @__PURE__ */ jsxs("option", { value: o.id, children: [
|
|
287
|
-
o.name,
|
|
288
|
-
o.badgeNo ? ` (${o.badgeNo})` : ""
|
|
289
|
-
] }, o.id))
|
|
290
|
-
}
|
|
291
|
-
)
|
|
292
|
-
] }),
|
|
293
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
294
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: "apprehendingEnforcer", children: "Apprehending enforcer" }),
|
|
295
|
-
/* @__PURE__ */ jsx(
|
|
296
|
-
"p",
|
|
297
|
-
{
|
|
298
|
-
id: "apprehendingEnforcer",
|
|
299
|
-
className: "flex h-9 items-center rounded-lg border border-input bg-muted/40 px-2.5 text-sm text-muted-foreground",
|
|
300
|
-
children: identity?.username ?? "\u2014"
|
|
301
|
-
}
|
|
302
|
-
),
|
|
303
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Auto-recorded from your sign-in." })
|
|
304
|
-
] }),
|
|
305
|
-
/* @__PURE__ */ jsx("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx(TextField, { id: "place", label: "Place of violation", value: placeOfViolation, onChange: setPlaceOfViolation, placeholder: `Street / landmark, ${municipality.shortName}` }) })
|
|
306
|
-
] })
|
|
307
|
-
] }),
|
|
308
|
-
/* @__PURE__ */ jsxs(Card, { children: [
|
|
309
|
-
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
310
|
-
/* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: "Violations" }),
|
|
311
|
-
/* @__PURE__ */ jsx(CardDescription, { children: "Tick each violation and add details. Fines total automatically." })
|
|
312
|
-
] }),
|
|
313
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
314
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
315
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Traffic" }),
|
|
316
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: traffic.map((c) => /* @__PURE__ */ jsx(
|
|
317
|
-
ViolationRow,
|
|
318
|
-
{
|
|
319
|
-
item: c,
|
|
320
|
-
checked: c.code in selected,
|
|
321
|
-
details: selected[c.code] ?? "",
|
|
322
|
-
onToggle: (v) => toggle(c.code, v),
|
|
323
|
-
onDetails: (v) => setSelected((p) => ({ ...p, [c.code]: v })),
|
|
324
|
-
formatPeso
|
|
325
|
-
},
|
|
326
|
-
c.code
|
|
327
|
-
)) })
|
|
328
|
-
] }),
|
|
329
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
330
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Ordinance" }),
|
|
331
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: ordinance.map((c) => /* @__PURE__ */ jsx(
|
|
332
|
-
ViolationRow,
|
|
333
|
-
{
|
|
334
|
-
item: c,
|
|
335
|
-
checked: c.code in selected,
|
|
336
|
-
details: selected[c.code] ?? "",
|
|
337
|
-
onToggle: (v) => toggle(c.code, v),
|
|
338
|
-
onDetails: (v) => setSelected((p) => ({ ...p, [c.code]: v })),
|
|
339
|
-
formatPeso
|
|
340
|
-
},
|
|
341
|
-
c.code
|
|
342
|
-
)) })
|
|
343
|
-
] })
|
|
344
|
-
] })
|
|
345
|
-
] }),
|
|
346
|
-
/* @__PURE__ */ jsxs(Card, { children: [
|
|
347
|
-
/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base", children: "Remarks" }) }),
|
|
348
|
-
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-3", children: [
|
|
349
|
-
/* @__PURE__ */ jsx(
|
|
350
|
-
Textarea,
|
|
351
|
-
{
|
|
352
|
-
value: remarks,
|
|
353
|
-
onChange: (e) => setRemarks(e.target.value),
|
|
354
|
-
placeholder: "Optional notes for this ticket.",
|
|
355
|
-
rows: 3
|
|
356
|
-
}
|
|
357
|
-
),
|
|
358
|
-
/* @__PURE__ */ jsx(
|
|
359
|
-
TextField,
|
|
360
|
-
{
|
|
361
|
-
id: "issuedBy",
|
|
362
|
-
label: "Issued by",
|
|
363
|
-
value: issuedBy,
|
|
364
|
-
onChange: setIssuedBy,
|
|
365
|
-
placeholder: "Optional \u2014 name shown on the receipt"
|
|
366
|
-
}
|
|
367
|
-
)
|
|
368
|
-
] })
|
|
369
|
-
] })
|
|
370
|
-
] }),
|
|
371
|
-
/* @__PURE__ */ jsx("div", { className: "lg:col-span-2", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4 lg:sticky lg:top-6", children: [
|
|
372
|
-
mounted ? /* @__PURE__ */ jsx(TicketPreview, { ticket: preview }) : /* @__PURE__ */ jsx(Skeleton, { className: "h-80 w-full rounded-xl" }),
|
|
373
|
-
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "flex items-center justify-between gap-3", children: [
|
|
374
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
375
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Total fines" }),
|
|
376
|
-
/* @__PURE__ */ jsx("p", { className: "text-xl font-semibold tabular-nums", children: formatPeso(total) })
|
|
377
|
-
] }),
|
|
378
|
-
/* @__PURE__ */ jsxs(
|
|
379
|
-
Button,
|
|
380
|
-
{
|
|
381
|
-
type: "button",
|
|
382
|
-
disabled: !valid,
|
|
383
|
-
onClick: () => {
|
|
384
|
-
setError(null);
|
|
385
|
-
setOpen(true);
|
|
386
|
-
},
|
|
387
|
-
className: "h-10 gap-2 px-4",
|
|
388
|
-
children: [
|
|
389
|
-
/* @__PURE__ */ jsx(FilePlus2, { className: "size-4" }),
|
|
390
|
-
"Review & issue"
|
|
391
|
-
]
|
|
392
|
-
}
|
|
393
|
-
)
|
|
394
|
-
] }) }),
|
|
395
|
-
!valid ? /* @__PURE__ */ jsx("p", { className: "text-center text-xs text-muted-foreground", children: "Fill the required fields and select at least one violation." }) : null
|
|
396
|
-
] }) }),
|
|
397
|
-
/* @__PURE__ */ jsx(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
398
|
-
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
399
|
-
/* @__PURE__ */ jsx(DialogTitle, { children: "Confirm & issue ticket" }),
|
|
400
|
-
/* @__PURE__ */ jsxs(DialogDescription, { children: [
|
|
401
|
-
"This issues an official OVR for",
|
|
402
|
-
" ",
|
|
403
|
-
/* @__PURE__ */ jsxs("span", { className: "font-medium text-foreground", children: [
|
|
404
|
-
firstName,
|
|
405
|
-
" ",
|
|
406
|
-
lastName
|
|
407
|
-
] }),
|
|
408
|
-
" ",
|
|
409
|
-
"with ",
|
|
410
|
-
chosen.length,
|
|
411
|
-
" ",
|
|
412
|
-
chosen.length === 1 ? "violation" : "violations",
|
|
413
|
-
" totaling",
|
|
414
|
-
" ",
|
|
415
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground", children: formatPeso(total) }),
|
|
416
|
-
". It becomes immediately searchable by the citizen."
|
|
417
|
-
] })
|
|
418
|
-
] }),
|
|
419
|
-
error ? /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
|
|
420
|
-
/* @__PURE__ */ jsx(TriangleAlert, {}),
|
|
421
|
-
/* @__PURE__ */ jsx(AlertDescription, { children: error })
|
|
422
|
-
] }) : null,
|
|
423
|
-
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
424
|
-
/* @__PURE__ */ jsx(
|
|
425
|
-
DialogClose,
|
|
426
|
-
{
|
|
427
|
-
render: /* @__PURE__ */ jsx(Button, { variant: "outline", disabled: isPending }),
|
|
428
|
-
children: "Cancel"
|
|
429
|
-
}
|
|
430
|
-
),
|
|
431
|
-
/* @__PURE__ */ jsxs(Button, { onClick: issue, disabled: isPending, className: "gap-2", children: [
|
|
432
|
-
isPending ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(FilePlus2, { className: "size-4" }),
|
|
433
|
-
"Confirm & issue"
|
|
434
|
-
] })
|
|
435
|
-
] })
|
|
436
|
-
] }) })
|
|
437
|
-
] });
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
export { IssuanceForm };
|
|
19
|
+
import '../chunk-I4WDVYHX.js';
|
|
20
|
+
import '../chunk-TJSNVTVB.js';
|
|
21
|
+
import '../chunk-SETIN6XP.js';
|
|
22
|
+
import '../chunk-77QBZC7J.js';
|
|
23
|
+
import '../chunk-BI4EGLPG.js';
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Activity-log viewer (GE-022). Read-only audit trail with client-side filters
|
|
6
|
-
* (action dropdown + actor/detail search) over the entries fetched by the page.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
declare function LogsViewer({ entries }: {
|
|
10
|
-
entries: ActivityLog[];
|
|
11
|
-
}): React.JSX.Element;
|
|
12
|
-
|
|
13
|
-
export { LogsViewer };
|
|
1
|
+
export { LogsViewer } from '../audit.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '../types.js';
|
|
@@ -1,102 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
export { LogsViewer } from '../chunk-4EDMZRGS.js';
|
|
3
|
+
import '../chunk-6YFZLXFP.js';
|
|
4
|
+
import '../chunk-K3KIBHJF.js';
|
|
5
|
+
import '../chunk-QZRRFE6E.js';
|
|
6
|
+
import '../chunk-OWCGEEAZ.js';
|
|
7
|
+
import '../chunk-55FQP2DO.js';
|
|
7
8
|
import '../chunk-I4WDVYHX.js';
|
|
8
|
-
import
|
|
9
|
+
import '../chunk-TJSNVTVB.js';
|
|
10
|
+
import '../chunk-SETIN6XP.js';
|
|
9
11
|
import '../chunk-77QBZC7J.js';
|
|
10
|
-
import { ACTIVITY_ACTION_LABELS } from '../chunk-QZRRFE6E.js';
|
|
11
12
|
import '../chunk-BI4EGLPG.js';
|
|
12
|
-
import * as React from 'react';
|
|
13
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
var fieldClass = "h-9 rounded-lg border border-input bg-transparent px-2.5 text-sm shadow-xs outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 dark:bg-input/30";
|
|
16
|
-
function actionLabel(action) {
|
|
17
|
-
return ACTIVITY_ACTION_LABELS[action] ?? action;
|
|
18
|
-
}
|
|
19
|
-
function LogsViewer({ entries }) {
|
|
20
|
-
const t = useCopy().admin.logsPage;
|
|
21
|
-
const { rules } = useOvrConfig();
|
|
22
|
-
const [action, setAction] = React.useState("");
|
|
23
|
-
const [q, setQ] = React.useState("");
|
|
24
|
-
const fmt = (iso) => new Date(iso).toLocaleString(rules.locale, {
|
|
25
|
-
timeZone: rules.timeZone,
|
|
26
|
-
year: "numeric",
|
|
27
|
-
month: "short",
|
|
28
|
-
day: "2-digit",
|
|
29
|
-
hour: "numeric",
|
|
30
|
-
minute: "2-digit"
|
|
31
|
-
});
|
|
32
|
-
const actions = Array.from(new Set(entries.map((e) => e.action)));
|
|
33
|
-
const query = q.trim().toLowerCase();
|
|
34
|
-
const filtered = entries.filter((e) => {
|
|
35
|
-
if (action && e.action !== action) return false;
|
|
36
|
-
if (query) {
|
|
37
|
-
const hay = `${e.actorUsername ?? ""} ${e.summary}`.toLowerCase();
|
|
38
|
-
if (!hay.includes(query)) return false;
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
});
|
|
42
|
-
const { pageItems, page, setPage, totalPages, from, to, total } = usePagination(filtered, 20, `${action}|${query}`);
|
|
43
|
-
return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-4xl p-4 sm:p-6 lg:p-8", children: [
|
|
44
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
45
|
-
/* @__PURE__ */ jsx("h1", { className: "font-heading text-2xl font-semibold tracking-tight", children: t.title }),
|
|
46
|
-
/* @__PURE__ */ jsx("p", { className: "max-w-2xl text-sm text-muted-foreground", children: t.subtitle })
|
|
47
|
-
] }),
|
|
48
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-4 flex flex-wrap items-center gap-2", children: [
|
|
49
|
-
/* @__PURE__ */ jsxs(
|
|
50
|
-
"select",
|
|
51
|
-
{
|
|
52
|
-
value: action,
|
|
53
|
-
onChange: (e) => setAction(e.target.value),
|
|
54
|
-
className: `${fieldClass} w-auto`,
|
|
55
|
-
"aria-label": t.action,
|
|
56
|
-
children: [
|
|
57
|
-
/* @__PURE__ */ jsx("option", { value: "", children: t.allActions }),
|
|
58
|
-
actions.map((a) => /* @__PURE__ */ jsx("option", { value: a, children: actionLabel(a) }, a))
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
),
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
Input,
|
|
64
|
-
{
|
|
65
|
-
value: q,
|
|
66
|
-
onChange: (e) => setQ(e.target.value),
|
|
67
|
-
placeholder: t.search,
|
|
68
|
-
className: "h-9 w-auto min-w-56"
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
] }),
|
|
72
|
-
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(CardContent, { className: "p-0", children: filtered.length === 0 ? /* @__PURE__ */ jsx("p", { className: "p-8 text-center text-sm text-muted-foreground", children: t.empty }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73
|
-
/* @__PURE__ */ jsxs(Table, { children: [
|
|
74
|
-
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
75
|
-
/* @__PURE__ */ jsx(TableHead, { children: t.when }),
|
|
76
|
-
/* @__PURE__ */ jsx(TableHead, { children: t.actor }),
|
|
77
|
-
/* @__PURE__ */ jsx(TableHead, { children: t.action }),
|
|
78
|
-
/* @__PURE__ */ jsx(TableHead, { children: t.detail })
|
|
79
|
-
] }) }),
|
|
80
|
-
/* @__PURE__ */ jsx(TableBody, { children: pageItems.map((e) => /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
81
|
-
/* @__PURE__ */ jsx(TableCell, { className: "whitespace-nowrap text-muted-foreground", children: fmt(e.createdAt) }),
|
|
82
|
-
/* @__PURE__ */ jsx(TableCell, { className: "font-medium", children: e.actorUsername ?? t.system }),
|
|
83
|
-
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: actionLabel(e.action) }) }),
|
|
84
|
-
/* @__PURE__ */ jsx(TableCell, { className: "text-muted-foreground", children: e.summary })
|
|
85
|
-
] }, e.id)) })
|
|
86
|
-
] }),
|
|
87
|
-
/* @__PURE__ */ jsx(
|
|
88
|
-
Pagination,
|
|
89
|
-
{
|
|
90
|
-
page,
|
|
91
|
-
totalPages,
|
|
92
|
-
from,
|
|
93
|
-
to,
|
|
94
|
-
total,
|
|
95
|
-
onPage: setPage
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
] }) }) })
|
|
99
|
-
] });
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export { LogsViewer };
|
|
@@ -1,70 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
export { NotificationsList } from '../chunk-SLQRZBMR.js';
|
|
3
|
+
import '../chunk-YGYA7KEG.js';
|
|
4
|
+
import '../chunk-6YFZLXFP.js';
|
|
5
|
+
import '../chunk-55FQP2DO.js';
|
|
5
6
|
import '../chunk-I4WDVYHX.js';
|
|
6
|
-
import
|
|
7
|
+
import '../chunk-TJSNVTVB.js';
|
|
8
|
+
import '../chunk-SETIN6XP.js';
|
|
7
9
|
import '../chunk-77QBZC7J.js';
|
|
8
|
-
import { useNotifications } from '../chunk-YGYA7KEG.js';
|
|
9
10
|
import '../chunk-BI4EGLPG.js';
|
|
10
|
-
import Link from 'next/link';
|
|
11
|
-
import { AlertTriangle, Clock } from 'lucide-react';
|
|
12
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
|
-
|
|
14
|
-
function NotificationsList() {
|
|
15
|
-
const items = useNotifications();
|
|
16
|
-
const t = useCopy().admin.notifications;
|
|
17
|
-
const { rules } = useOvrConfig();
|
|
18
|
-
const { pageItems, page, setPage, totalPages, from, to, total } = usePagination(items, 20);
|
|
19
|
-
const fmt = (iso) => new Date(iso).toLocaleString(rules.locale, {
|
|
20
|
-
timeZone: rules.timeZone,
|
|
21
|
-
year: "numeric",
|
|
22
|
-
month: "short",
|
|
23
|
-
day: "2-digit",
|
|
24
|
-
hour: "numeric",
|
|
25
|
-
minute: "2-digit"
|
|
26
|
-
});
|
|
27
|
-
return /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-3xl p-4 sm:p-6 lg:p-8", children: [
|
|
28
|
-
/* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
|
|
29
|
-
/* @__PURE__ */ jsx("h1", { className: "font-heading text-2xl font-semibold tracking-tight", children: t.title }),
|
|
30
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.subtitle })
|
|
31
|
-
] }),
|
|
32
|
-
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(CardContent, { className: "p-0", children: [
|
|
33
|
-
items.length === 0 ? /* @__PURE__ */ jsx("p", { className: "p-8 text-center text-sm text-muted-foreground", children: t.empty }) : /* @__PURE__ */ jsx("ul", { className: "divide-y", children: pageItems.map((n) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
34
|
-
Link,
|
|
35
|
-
{
|
|
36
|
-
href: n.href,
|
|
37
|
-
className: "flex items-center gap-3 px-4 py-3 transition-colors hover:bg-muted/50",
|
|
38
|
-
children: [
|
|
39
|
-
n.type === "overdue" ? /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4 shrink-0 text-red-500" }) : /* @__PURE__ */ jsx(Clock, { className: "size-4 shrink-0 text-amber-500" }),
|
|
40
|
-
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
41
|
-
/* @__PURE__ */ jsx("span", { className: "block truncate text-sm font-medium", children: n.name }),
|
|
42
|
-
/* @__PURE__ */ jsx("span", { className: "block font-mono text-xs text-muted-foreground", children: n.ovrTicketNo })
|
|
43
|
-
] }),
|
|
44
|
-
/* @__PURE__ */ jsx(
|
|
45
|
-
Badge,
|
|
46
|
-
{
|
|
47
|
-
variant: n.type === "overdue" ? "destructive" : "secondary",
|
|
48
|
-
children: n.type === "overdue" ? t.overdue : t.outstanding
|
|
49
|
-
}
|
|
50
|
-
),
|
|
51
|
-
/* @__PURE__ */ jsx("span", { className: "hidden whitespace-nowrap text-xs text-muted-foreground sm:block", children: fmt(n.at) })
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
) }, n.id)) }),
|
|
55
|
-
/* @__PURE__ */ jsx(
|
|
56
|
-
Pagination,
|
|
57
|
-
{
|
|
58
|
-
page,
|
|
59
|
-
totalPages,
|
|
60
|
-
from,
|
|
61
|
-
to,
|
|
62
|
-
total,
|
|
63
|
-
onPage: setPage
|
|
64
|
-
}
|
|
65
|
-
)
|
|
66
|
-
] }) })
|
|
67
|
-
] });
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { NotificationsList };
|