medusajs-repairshop-plugin 0.1.13 → 0.1.35
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/.medusa/server/src/admin/index.js +640 -298
- package/.medusa/server/src/admin/index.mjs +641 -299
- package/.medusa/server/src/api/admin/repairs/[id]/approve/route.js +2 -2
- package/.medusa/server/src/api/admin/repairs/[id]/custom-parts/[index]/route.js +39 -0
- package/.medusa/server/src/api/admin/repairs/[id]/custom-parts/route.js +4 -4
- package/.medusa/server/src/api/admin/repairs/[id]/details/route.js +27 -9
- package/.medusa/server/src/api/admin/repairs/[id]/document/route.js +2 -2
- package/.medusa/server/src/api/admin/repairs/[id]/parts/[variant_id]/route.js +40 -1
- package/.medusa/server/src/api/admin/repairs/[id]/parts/route.js +38 -1
- package/.medusa/server/src/api/admin/repairs/[id]/route.js +3 -3
- package/.medusa/server/src/api/admin/repairs/analytics/route.js +4 -4
- package/.medusa/server/src/api/admin/repairs/middleware.js +2 -1
- package/.medusa/server/src/api/admin/repairs/route.js +2 -2
- package/.medusa/server/src/api/admin/repairs/settings/route.js +38 -0
- package/.medusa/server/src/api/admin/repairs/test-suite/route.js +82 -0
- package/.medusa/server/src/api/store/repairs/[id]/document/route.js +2 -2
- package/.medusa/server/src/api/store/repairs/paystack/initialize/route.js +85 -0
- package/.medusa/server/src/api/store/repairs/paystack/verify/route.js +71 -0
- package/.medusa/server/src/api/store/repairs/test-suite/route.js +36 -0
- package/.medusa/server/src/api/store/repairs/token/[token]/document/route.js +2 -2
- package/.medusa/server/src/modules/repair/migrations/Migration20260917000000.js +16 -0
- package/.medusa/server/src/modules/repair/migrations/Migration20260917000001.js +14 -0
- package/.medusa/server/src/modules/repair/migrations/Migration20260917000002.js +22 -0
- package/.medusa/server/src/modules/repair/migrations/Migration20260917000003.js +18 -0
- package/.medusa/server/src/modules/repair/migrations/Migration20260917000004.js +16 -0
- package/.medusa/server/src/modules/repair/migrations/Migration20260918000000.js +14 -0
- package/.medusa/server/src/modules/repair/models/repair-settings.js +21 -0
- package/.medusa/server/src/modules/repair/models/repair-ticket.js +7 -1
- package/.medusa/server/src/modules/repair/service.js +3 -1
- package/.medusa/server/src/services/zoho-books.js +177 -0
- package/.medusa/server/src/subscribers/notifications.js +76 -4
- package/.medusa/server/src/subscribers/order-paid.js +27 -12
- package/.medusa/server/src/subscribers/repair-customer-reminder.js +2 -2
- package/.medusa/server/src/utils/generate-repair-document.js +63 -4
- package/.medusa/server/src/utils/templates/repair.js +89 -17
- package/.medusa/server/src/utils/zoho-payment-sync.js +47 -0
- package/.medusa/server/src/workflows/approve-repair-cost-workflow.js +5 -5
- package/.medusa/server/src/workflows/reject-repair-cost-workflow.js +53 -9
- package/.medusa/server/src/workflows/steps/add-repair-parts.js +3 -3
- package/.medusa/server/src/workflows/steps/create-repair-payment-collection.js +47 -0
- package/.medusa/server/src/workflows/steps/remove-repair-part.js +3 -3
- package/.medusa/server/src/workflows/steps/sync-repair-inventory.js +85 -0
- package/.medusa/server/src/workflows/steps/update-repair-ticket-status.js +29 -1
- package/.medusa/server/src/workflows/update-repair-status-workflow.js +6 -1
- package/README.md +132 -83
- package/package.json +1 -1
- package/.medusa/server/src/workflows/steps/create-repair-order.js +0 -108
|
@@ -30,7 +30,7 @@ const useStoreCurrency = () => {
|
|
|
30
30
|
return new Intl.NumberFormat(window.navigator.language || "en-US", {
|
|
31
31
|
style: "currency",
|
|
32
32
|
currency: currencyCode
|
|
33
|
-
}).format(amount
|
|
33
|
+
}).format(amount);
|
|
34
34
|
};
|
|
35
35
|
return { currencyCode, formatCurrency };
|
|
36
36
|
};
|
|
@@ -109,10 +109,63 @@ const RepairsPage = () => {
|
|
|
109
109
|
const { formatCurrency } = useStoreCurrency();
|
|
110
110
|
const [createModalOpen, setCreateModalOpen] = react.useState(false);
|
|
111
111
|
const [isCreating, setIsCreating] = react.useState(false);
|
|
112
|
+
const [settings, setSettings] = react.useState({
|
|
113
|
+
email_notifications_enabled: true,
|
|
114
|
+
sms_notifications_enabled: true,
|
|
115
|
+
whatsapp_notifications_enabled: true,
|
|
116
|
+
zoho_books_enabled: false,
|
|
117
|
+
zoho_client_id: "",
|
|
118
|
+
zoho_client_secret: "",
|
|
119
|
+
zoho_refresh_token: "",
|
|
120
|
+
zoho_organization_id: "",
|
|
121
|
+
paystack_enabled: false,
|
|
122
|
+
paystack_public_key: "",
|
|
123
|
+
paystack_secret_key: "",
|
|
124
|
+
company_name: "Repair Shop",
|
|
125
|
+
storefront_url: ""
|
|
126
|
+
});
|
|
127
|
+
const loadSettings = () => {
|
|
128
|
+
fetch("/admin/repairs/settings", { credentials: "include" }).then((res) => res.json()).then((data) => {
|
|
129
|
+
if (data.settings) {
|
|
130
|
+
setSettings({
|
|
131
|
+
...data.settings,
|
|
132
|
+
zoho_client_id: data.settings.zoho_client_id || "",
|
|
133
|
+
zoho_client_secret: data.settings.zoho_client_secret || "",
|
|
134
|
+
zoho_refresh_token: data.settings.zoho_refresh_token || "",
|
|
135
|
+
zoho_organization_id: data.settings.zoho_organization_id || "",
|
|
136
|
+
paystack_public_key: data.settings.paystack_public_key || "",
|
|
137
|
+
paystack_secret_key: data.settings.paystack_secret_key || "",
|
|
138
|
+
company_name: data.settings.company_name || "Repair Shop",
|
|
139
|
+
storefront_url: data.settings.storefront_url || ""
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}).catch((err) => console.error(err));
|
|
143
|
+
};
|
|
144
|
+
const [isSaving, setIsSaving] = react.useState(false);
|
|
145
|
+
const updateSettingState = (key, value) => {
|
|
146
|
+
setSettings({ ...settings, [key]: value });
|
|
147
|
+
};
|
|
148
|
+
const saveSettings = async () => {
|
|
149
|
+
setIsSaving(true);
|
|
150
|
+
try {
|
|
151
|
+
await fetch("/admin/repairs/settings", {
|
|
152
|
+
method: "POST",
|
|
153
|
+
credentials: "include",
|
|
154
|
+
headers: { "Content-Type": "application/json" },
|
|
155
|
+
body: JSON.stringify(settings)
|
|
156
|
+
});
|
|
157
|
+
alert("Settings saved successfully!");
|
|
158
|
+
} catch (e) {
|
|
159
|
+
console.error(e);
|
|
160
|
+
alert("Failed to save settings.");
|
|
161
|
+
} finally {
|
|
162
|
+
setIsSaving(false);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
112
165
|
const [newDevice, setNewDevice] = react.useState({
|
|
113
166
|
serial_number: "",
|
|
114
167
|
model_name: "",
|
|
115
|
-
brand: "",
|
|
168
|
+
brand: "Apple",
|
|
116
169
|
customer_id: "",
|
|
117
170
|
imei: "",
|
|
118
171
|
condition: ""
|
|
@@ -154,6 +207,7 @@ const RepairsPage = () => {
|
|
|
154
207
|
react.useEffect(() => {
|
|
155
208
|
loadTickets();
|
|
156
209
|
loadCustomers();
|
|
210
|
+
loadSettings();
|
|
157
211
|
}, []);
|
|
158
212
|
const handleAccessoryKeyDown = (e) => {
|
|
159
213
|
if (e.key === "," || e.key === "Enter") {
|
|
@@ -203,7 +257,7 @@ const RepairsPage = () => {
|
|
|
203
257
|
setNewDevice({
|
|
204
258
|
serial_number: "",
|
|
205
259
|
model_name: "",
|
|
206
|
-
brand: "",
|
|
260
|
+
brand: "Apple",
|
|
207
261
|
customer_id: "",
|
|
208
262
|
imei: "",
|
|
209
263
|
condition: ""
|
|
@@ -259,269 +313,457 @@ const RepairsPage = () => {
|
|
|
259
313
|
const matchesStatus = statusFilter === "all" || ticket.status === statusFilter;
|
|
260
314
|
return matchesSearch && matchesStatus;
|
|
261
315
|
});
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
/* @__PURE__ */ jsxRuntime.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
)
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
316
|
+
const [activeTab, setActiveTab] = react.useState("tickets");
|
|
317
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0 overflow-hidden", children: [
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex border-b border-ui-border-base px-6 pt-2 space-x-6", children: [
|
|
319
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
320
|
+
"button",
|
|
321
|
+
{
|
|
322
|
+
onClick: () => setActiveTab("tickets"),
|
|
323
|
+
className: `pb-3 text-sm font-medium transition-colors ${activeTab === "tickets" ? "border-b-2 border-ui-fg-base text-ui-fg-base" : "text-ui-fg-subtle hover:text-ui-fg-base"}`,
|
|
324
|
+
children: "Tickets"
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
onClick: () => setActiveTab("settings"),
|
|
331
|
+
className: `pb-3 text-sm font-medium transition-colors ${activeTab === "settings" ? "border-b-2 border-ui-fg-base text-ui-fg-base" : "text-ui-fg-subtle hover:text-ui-fg-base"}`,
|
|
332
|
+
children: "Settings"
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] }),
|
|
336
|
+
activeTab === "tickets" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6", children: [
|
|
337
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-6", children: [
|
|
338
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Repair Tickets" }),
|
|
339
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.FocusModal, { open: createModalOpen, onOpenChange: setCreateModalOpen, children: [
|
|
340
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", children: "Create Repair Ticket" }) }),
|
|
341
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.FocusModal.Content, { children: [
|
|
342
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
343
|
+
ui.Button,
|
|
344
|
+
{
|
|
345
|
+
variant: "primary",
|
|
346
|
+
onClick: handleCreateTicket,
|
|
347
|
+
isLoading: isCreating,
|
|
348
|
+
children: "Save Ticket"
|
|
349
|
+
}
|
|
350
|
+
) }),
|
|
351
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.FocusModal.Body, { className: "flex flex-col items-center py-16 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-lg flex-col gap-y-8", children: [
|
|
352
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
353
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Create Repair Ticket" }),
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-ui-fg-subtle text-sm", children: "Add a new device and repair ticket." })
|
|
355
|
+
] }),
|
|
356
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
357
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Device Details" }),
|
|
358
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
359
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
360
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "brand", children: "Brand *" }),
|
|
361
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
362
|
+
ui.Input,
|
|
363
|
+
{
|
|
364
|
+
id: "brand",
|
|
365
|
+
value: newDevice.brand,
|
|
366
|
+
onChange: (e) => setNewDevice({ ...newDevice, brand: e.target.value }),
|
|
367
|
+
placeholder: "Apple"
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
] }),
|
|
371
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
372
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "model_name", children: "Model Name *" }),
|
|
373
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
374
|
+
ui.Input,
|
|
375
|
+
{
|
|
376
|
+
id: "model_name",
|
|
377
|
+
value: newDevice.model_name,
|
|
378
|
+
onChange: (e) => setNewDevice({
|
|
379
|
+
...newDevice,
|
|
380
|
+
model_name: e.target.value
|
|
381
|
+
}),
|
|
382
|
+
placeholder: "iPhone 13 Pro"
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
] }),
|
|
386
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
387
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "serial_number", children: "Serial Number *" }),
|
|
388
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
389
|
+
ui.Input,
|
|
390
|
+
{
|
|
391
|
+
id: "serial_number",
|
|
392
|
+
value: newDevice.serial_number,
|
|
393
|
+
onChange: (e) => setNewDevice({
|
|
394
|
+
...newDevice,
|
|
395
|
+
serial_number: e.target.value
|
|
396
|
+
}),
|
|
397
|
+
placeholder: "SN12345678"
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
] }),
|
|
401
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
402
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "imei", children: "IMEI" }),
|
|
403
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
404
|
+
ui.Input,
|
|
405
|
+
{
|
|
406
|
+
id: "imei",
|
|
407
|
+
value: newDevice.imei,
|
|
408
|
+
onChange: (e) => setNewDevice({ ...newDevice, imei: e.target.value }),
|
|
409
|
+
placeholder: "Optional"
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
] }),
|
|
413
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2 col-span-2", children: [
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "condition", children: "Device Condition" }),
|
|
415
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
416
|
+
ui.Textarea,
|
|
417
|
+
{
|
|
418
|
+
id: "condition",
|
|
419
|
+
value: newDevice.condition,
|
|
420
|
+
onChange: (e) => setNewDevice({
|
|
421
|
+
...newDevice,
|
|
422
|
+
condition: e.target.value
|
|
423
|
+
}),
|
|
424
|
+
placeholder: "Scratches on screen, etc.",
|
|
425
|
+
rows: 3
|
|
426
|
+
}
|
|
427
|
+
)
|
|
428
|
+
] })
|
|
354
429
|
] })
|
|
355
|
-
] })
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
430
|
+
] }),
|
|
431
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
432
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Ticket Details" }),
|
|
433
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
|
|
434
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
435
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "customer_id", children: "Customer" }),
|
|
436
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
437
|
+
ui.Select,
|
|
438
|
+
{
|
|
439
|
+
value: newTicket.customer_id,
|
|
440
|
+
onValueChange: (val) => {
|
|
441
|
+
setNewTicket({ ...newTicket, customer_id: val });
|
|
442
|
+
setNewDevice({ ...newDevice, customer_id: val });
|
|
443
|
+
},
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
446
|
+
ui.Select.Value,
|
|
447
|
+
{
|
|
448
|
+
placeholder: loadingCustomers ? "Loading..." : "Select a customer"
|
|
449
|
+
}
|
|
450
|
+
) }),
|
|
451
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Content, { children: customers.map((customer) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Item, { value: customer.id, children: [
|
|
452
|
+
customer.first_name || customer.last_name ? `${customer.first_name || ""} ${customer.last_name || ""}`.trim() : "No Name",
|
|
453
|
+
" ",
|
|
454
|
+
"(",
|
|
455
|
+
customer.email,
|
|
456
|
+
")"
|
|
457
|
+
] }, customer.id)) })
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
] }),
|
|
462
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
463
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "issue_description", children: "Issue Description *" }),
|
|
464
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
465
|
+
ui.Textarea,
|
|
466
|
+
{
|
|
467
|
+
id: "issue_description",
|
|
468
|
+
value: newTicket.issue_description,
|
|
469
|
+
onChange: (e) => setNewTicket({
|
|
470
|
+
...newTicket,
|
|
471
|
+
issue_description: e.target.value
|
|
472
|
+
}),
|
|
473
|
+
placeholder: "Screen is cracked and battery draining fast."
|
|
474
|
+
}
|
|
475
|
+
)
|
|
476
|
+
] }),
|
|
477
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
478
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "accessories", children: "Accessories Included (press comma to add)" }),
|
|
479
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: accessories.map((acc) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
480
|
+
ui.Badge,
|
|
481
|
+
{
|
|
482
|
+
color: "grey",
|
|
483
|
+
size: "small",
|
|
484
|
+
className: "flex items-center gap-1",
|
|
485
|
+
children: [
|
|
486
|
+
acc,
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
488
|
+
"button",
|
|
489
|
+
{
|
|
490
|
+
type: "button",
|
|
491
|
+
onClick: () => removeAccessory(acc),
|
|
492
|
+
className: "text-ui-fg-muted hover:text-ui-fg-base",
|
|
493
|
+
children: "×"
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
]
|
|
369
497
|
},
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
] }, customer.id)) })
|
|
384
|
-
]
|
|
385
|
-
}
|
|
386
|
-
)
|
|
387
|
-
] }),
|
|
388
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
389
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "issue_description", children: "Issue Description *" }),
|
|
390
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
391
|
-
ui.Textarea,
|
|
392
|
-
{
|
|
393
|
-
id: "issue_description",
|
|
394
|
-
value: newTicket.issue_description,
|
|
395
|
-
onChange: (e) => setNewTicket({
|
|
396
|
-
...newTicket,
|
|
397
|
-
issue_description: e.target.value
|
|
398
|
-
}),
|
|
399
|
-
placeholder: "Screen is cracked and battery draining fast."
|
|
400
|
-
}
|
|
401
|
-
)
|
|
402
|
-
] }),
|
|
403
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
404
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "accessories", children: "Accessories Included (press comma to add)" }),
|
|
405
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: accessories.map((acc) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
406
|
-
ui.Badge,
|
|
407
|
-
{
|
|
408
|
-
color: "grey",
|
|
409
|
-
size: "small",
|
|
410
|
-
className: "flex items-center gap-1",
|
|
411
|
-
children: [
|
|
412
|
-
acc,
|
|
413
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
414
|
-
"button",
|
|
415
|
-
{
|
|
416
|
-
type: "button",
|
|
417
|
-
onClick: () => removeAccessory(acc),
|
|
418
|
-
className: "text-ui-fg-muted hover:text-ui-fg-base",
|
|
419
|
-
children: "×"
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
]
|
|
423
|
-
},
|
|
424
|
-
acc
|
|
425
|
-
)) }),
|
|
426
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
427
|
-
ui.Input,
|
|
428
|
-
{
|
|
429
|
-
id: "accessories",
|
|
430
|
-
value: accessoryInput,
|
|
431
|
-
onChange: (e) => setAccessoryInput(e.target.value),
|
|
432
|
-
onKeyDown: handleAccessoryKeyDown,
|
|
433
|
-
placeholder: "Type and press comma..."
|
|
434
|
-
}
|
|
435
|
-
)
|
|
498
|
+
acc
|
|
499
|
+
)) }),
|
|
500
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
501
|
+
ui.Input,
|
|
502
|
+
{
|
|
503
|
+
id: "accessories",
|
|
504
|
+
value: accessoryInput,
|
|
505
|
+
onChange: (e) => setAccessoryInput(e.target.value),
|
|
506
|
+
onKeyDown: handleAccessoryKeyDown,
|
|
507
|
+
placeholder: "Type and press comma..."
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
] })
|
|
436
511
|
] })
|
|
437
|
-
] })
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
512
|
+
] }),
|
|
513
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4", children: [
|
|
514
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Legal & Compliance" }),
|
|
515
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
516
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
517
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
518
|
+
ui.Checkbox,
|
|
519
|
+
{
|
|
520
|
+
id: "terms_accepted",
|
|
521
|
+
checked: newTicket.terms_accepted,
|
|
522
|
+
onCheckedChange: (c) => setNewTicket({
|
|
523
|
+
...newTicket,
|
|
524
|
+
terms_accepted: c === true
|
|
525
|
+
})
|
|
526
|
+
}
|
|
527
|
+
),
|
|
528
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "terms_accepted", children: "Customer accepts Repair Terms & Conditions *" })
|
|
529
|
+
] }),
|
|
530
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
+
ui.Checkbox,
|
|
533
|
+
{
|
|
534
|
+
id: "data_wiped_consent",
|
|
535
|
+
checked: newTicket.data_wiped_consent,
|
|
536
|
+
onCheckedChange: (c) => setNewTicket({
|
|
537
|
+
...newTicket,
|
|
538
|
+
data_wiped_consent: c === true
|
|
539
|
+
})
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "data_wiped_consent", children: "Customer consents to device data wipe (if required)" })
|
|
543
|
+
] })
|
|
469
544
|
] })
|
|
470
545
|
] })
|
|
471
|
-
] })
|
|
472
|
-
] })
|
|
473
|
-
] })
|
|
474
|
-
] })
|
|
475
|
-
] }),
|
|
476
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 mb-6", children: [
|
|
477
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
478
|
-
ui.Input,
|
|
479
|
-
{
|
|
480
|
-
placeholder: "Search tickets...",
|
|
481
|
-
value: searchTerm,
|
|
482
|
-
onChange: (e) => setSearchTerm(e.target.value),
|
|
483
|
-
className: "flex-1"
|
|
484
|
-
}
|
|
485
|
-
),
|
|
486
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { value: statusFilter, onValueChange: setStatusFilter, children: [
|
|
487
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Filter by status" }) }),
|
|
488
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
|
|
489
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "all", children: "All Statuses" }),
|
|
490
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "received", children: "Received" }),
|
|
491
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "diagnosing", children: "Diagnosing" }),
|
|
492
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "awaiting_approval", children: "Awaiting Approval" }),
|
|
493
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "repairing", children: "Repairing" }),
|
|
494
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "ready", children: "Ready" }),
|
|
495
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "completed", children: "Completed" }),
|
|
496
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "cancelled", children: "Cancelled" })
|
|
546
|
+
] }) })
|
|
547
|
+
] })
|
|
497
548
|
] })
|
|
549
|
+
] }),
|
|
550
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-4 mb-6", children: [
|
|
551
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-48", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { value: statusFilter, onValueChange: setStatusFilter, children: [
|
|
552
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Filter by status" }) }),
|
|
553
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "all", children: "All Statuses" }),
|
|
555
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "received", children: "Received" }),
|
|
556
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "diagnosing", children: "Diagnosing" }),
|
|
557
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "awaiting_approval", children: "Awaiting Approval" }),
|
|
558
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "repairing", children: "Repairing" }),
|
|
559
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "ready", children: "Ready" }),
|
|
560
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "completed", children: "Completed" }),
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "cancelled", children: "Cancelled" })
|
|
562
|
+
] })
|
|
563
|
+
] }) }),
|
|
564
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
565
|
+
ui.Input,
|
|
566
|
+
{
|
|
567
|
+
placeholder: "Search tickets...",
|
|
568
|
+
value: searchTerm,
|
|
569
|
+
onChange: (e) => setSearchTerm(e.target.value),
|
|
570
|
+
className: "flex-1"
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
] }),
|
|
574
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center py-12", children: "Loading repair tickets..." }) : filteredTickets.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-12 text-ui-fg-subtle", children: [
|
|
575
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Wrench, { className: "mx-auto mb-4", size: 48 }),
|
|
576
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "No repair tickets found" })
|
|
577
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { children: [
|
|
578
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
|
|
579
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Ticket #" }),
|
|
580
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Status" }),
|
|
581
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Technician" }),
|
|
582
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Issue" }),
|
|
583
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Estimate" }),
|
|
584
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Created" })
|
|
585
|
+
] }) }),
|
|
586
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Body, { children: filteredTickets.map((ticket) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
587
|
+
ui.Table.Row,
|
|
588
|
+
{
|
|
589
|
+
onClick: () => navigate(`/repairs/${ticket.id}`),
|
|
590
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle-hover transition-colors",
|
|
591
|
+
children: [
|
|
592
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Cell, { children: [
|
|
593
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ticket.ticket_number }),
|
|
594
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle text-xs", children: getCustomerName(ticket.customer_id) })
|
|
595
|
+
] }),
|
|
596
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: getStatusColor(ticket.status), size: "small", children: ticket.status.replace("_", " ") }) }),
|
|
597
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: ticket.technician_name ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "purple", size: "small", children: ticket.technician_name }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-fg-muted text-xs", children: "Unassigned" }) }),
|
|
598
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "max-w-xs truncate", children: ticket.issue_description }),
|
|
599
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: formatCurrency(ticket.total_estimate) }),
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: new Date(ticket.created_at).toLocaleDateString() })
|
|
601
|
+
]
|
|
602
|
+
},
|
|
603
|
+
ticket.id
|
|
604
|
+
)) })
|
|
498
605
|
] })
|
|
499
606
|
] }),
|
|
500
|
-
|
|
501
|
-
/* @__PURE__ */ jsxRuntime.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
/* @__PURE__ */ jsxRuntime.
|
|
607
|
+
activeTab === "settings" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6 w-full max-w-2xl p-6", children: [
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
609
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "General Settings" }),
|
|
610
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 mt-4", children: [
|
|
611
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
612
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "font-medium text-ui-fg-base", children: "Company Name" }),
|
|
613
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Displayed in notifications and SMS messages." }),
|
|
614
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
615
|
+
ui.Input,
|
|
616
|
+
{
|
|
617
|
+
placeholder: "e.g. Urban Device Care Ltd",
|
|
618
|
+
value: settings.company_name,
|
|
619
|
+
onChange: (e) => updateSettingState("company_name", e.target.value)
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
] }),
|
|
623
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
624
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "font-medium text-ui-fg-base", children: "Storefront URL" }),
|
|
625
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Base URL for tracking links (e.g. http://localhost:8000)." }),
|
|
626
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
627
|
+
ui.Input,
|
|
628
|
+
{
|
|
629
|
+
placeholder: "e.g. https://store.example.com",
|
|
630
|
+
value: settings.storefront_url,
|
|
631
|
+
onChange: (e) => updateSettingState("storefront_url", e.target.value)
|
|
632
|
+
}
|
|
633
|
+
)
|
|
634
|
+
] })
|
|
517
635
|
] }),
|
|
518
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.
|
|
522
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.
|
|
523
|
-
/* @__PURE__ */ jsxRuntime.
|
|
524
|
-
|
|
636
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base my-6" })
|
|
637
|
+
] }),
|
|
638
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
639
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Notification Settings" }),
|
|
640
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "Configure which channels are enabled for automated repair notifications. (Note: Medusa must have a provider configured for these channels to actually send them)." }),
|
|
641
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6 mt-4", children: [
|
|
642
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
643
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
644
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "font-semibold", children: "Email Notifications" }),
|
|
645
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-ui-fg-subtle", children: "Send status updates and payment links to customers via Email." })
|
|
646
|
+
] }),
|
|
647
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { checked: settings.email_notifications_enabled, onCheckedChange: (v) => updateSettingState("email_notifications_enabled", v) })
|
|
648
|
+
] }),
|
|
649
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
650
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
651
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "font-semibold", children: "SMS Notifications" }),
|
|
652
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-ui-fg-subtle", children: "Send status updates and payment links to customers via SMS." })
|
|
653
|
+
] }),
|
|
654
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { checked: settings.sms_notifications_enabled, onCheckedChange: (v) => updateSettingState("sms_notifications_enabled", v) })
|
|
655
|
+
] }),
|
|
656
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
657
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
658
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "font-semibold", children: "WhatsApp Notifications" }),
|
|
659
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-ui-fg-subtle", children: "Send status updates and payment links to customers via WhatsApp." })
|
|
660
|
+
] }),
|
|
661
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { checked: settings.whatsapp_notifications_enabled, onCheckedChange: (v) => updateSettingState("whatsapp_notifications_enabled", v) })
|
|
662
|
+
] })
|
|
663
|
+
] })
|
|
664
|
+
] }),
|
|
665
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-8" }),
|
|
666
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6 max-w-2xl", children: [
|
|
667
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Zoho Books Integration" }),
|
|
668
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "Configure Zoho Books to automatically sync Repair Tickets as Estimates and Invoices." }),
|
|
669
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6 mt-4", children: [
|
|
670
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
671
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
672
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "font-semibold", children: "Enable Zoho Books Sync" }),
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-ui-fg-subtle", children: "Replaces local PDF generation with official Zoho Books documents." })
|
|
674
|
+
] }),
|
|
675
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { checked: settings.zoho_books_enabled, onCheckedChange: (v) => updateSettingState("zoho_books_enabled", v) })
|
|
676
|
+
] }),
|
|
677
|
+
settings.zoho_books_enabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4 p-4 border border-ui-border-base rounded-lg bg-ui-bg-subtle", children: [
|
|
678
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
679
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Organization ID" }),
|
|
680
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
681
|
+
ui.Input,
|
|
682
|
+
{
|
|
683
|
+
placeholder: "e.g. 12345678",
|
|
684
|
+
value: settings.zoho_organization_id,
|
|
685
|
+
onChange: (e) => updateSettingState("zoho_organization_id", e.target.value)
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
] }),
|
|
689
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
690
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Client ID" }),
|
|
691
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
692
|
+
ui.Input,
|
|
693
|
+
{
|
|
694
|
+
placeholder: "1000.XXXXXXXXXXXXXXXXXXXXXXXX",
|
|
695
|
+
value: settings.zoho_client_id,
|
|
696
|
+
onChange: (e) => updateSettingState("zoho_client_id", e.target.value)
|
|
697
|
+
}
|
|
698
|
+
)
|
|
699
|
+
] }),
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Client Secret" }),
|
|
702
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
703
|
+
ui.Input,
|
|
704
|
+
{
|
|
705
|
+
placeholder: "Enter Client Secret",
|
|
706
|
+
type: "password",
|
|
707
|
+
value: settings.zoho_client_secret,
|
|
708
|
+
onChange: (e) => updateSettingState("zoho_client_secret", e.target.value)
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
] }),
|
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Refresh Token" }),
|
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
715
|
+
ui.Input,
|
|
716
|
+
{
|
|
717
|
+
placeholder: "1000.XXXXXXXXXXXXXXXXXXXXXXXX",
|
|
718
|
+
type: "password",
|
|
719
|
+
value: settings.zoho_refresh_token,
|
|
720
|
+
onChange: (e) => updateSettingState("zoho_refresh_token", e.target.value)
|
|
721
|
+
}
|
|
722
|
+
)
|
|
723
|
+
] })
|
|
724
|
+
] })
|
|
725
|
+
] })
|
|
726
|
+
] }),
|
|
727
|
+
/* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-8" }),
|
|
728
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6 max-w-2xl", children: [
|
|
729
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", children: "Paystack Integration" }),
|
|
730
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "Configure Paystack to generate payment links for repairs." }),
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-6 mt-4", children: [
|
|
732
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
733
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
734
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "font-semibold", children: "Enable Paystack Checkout" }),
|
|
735
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm text-ui-fg-subtle", children: "Generate Paystack checkout links on approved tickets." })
|
|
736
|
+
] }),
|
|
737
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Switch, { checked: settings.paystack_enabled, onCheckedChange: (v) => updateSettingState("paystack_enabled", v) })
|
|
738
|
+
] }),
|
|
739
|
+
settings.paystack_enabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-4 p-4 border border-ui-border-base rounded-lg bg-ui-bg-subtle", children: [
|
|
740
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
741
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Public Key" }),
|
|
742
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
743
|
+
ui.Input,
|
|
744
|
+
{
|
|
745
|
+
placeholder: "pk_test_...",
|
|
746
|
+
value: settings.paystack_public_key,
|
|
747
|
+
onChange: (e) => updateSettingState("paystack_public_key", e.target.value)
|
|
748
|
+
}
|
|
749
|
+
)
|
|
750
|
+
] }),
|
|
751
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
752
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Secret Key" }),
|
|
753
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
754
|
+
ui.Input,
|
|
755
|
+
{
|
|
756
|
+
placeholder: "sk_test_...",
|
|
757
|
+
type: "password",
|
|
758
|
+
value: settings.paystack_secret_key,
|
|
759
|
+
onChange: (e) => updateSettingState("paystack_secret_key", e.target.value)
|
|
760
|
+
}
|
|
761
|
+
)
|
|
762
|
+
] })
|
|
763
|
+
] })
|
|
764
|
+
] })
|
|
765
|
+
] }),
|
|
766
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: saveSettings, isLoading: isSaving, children: "Save Settings" }) })
|
|
525
767
|
] })
|
|
526
768
|
] });
|
|
527
769
|
};
|
|
@@ -550,8 +792,10 @@ const RepairDetailPage = () => {
|
|
|
550
792
|
const [etc, setEtc] = react.useState("");
|
|
551
793
|
const [inventoryParts, setInventoryParts] = react.useState([]);
|
|
552
794
|
const [selectedInventoryPart, setSelectedInventoryPart] = react.useState("");
|
|
795
|
+
const [partSearch, setPartSearch] = react.useState("");
|
|
553
796
|
const [isAddingPart, setIsAddingPart] = react.useState(false);
|
|
554
797
|
const [customPartName, setCustomPartName] = react.useState("");
|
|
798
|
+
const [customPartTaxable, setCustomPartTaxable] = react.useState(true);
|
|
555
799
|
const [customPartPrice, setCustomPartPrice] = react.useState("");
|
|
556
800
|
const [technicianSearch, setTechnicianSearch] = react.useState("");
|
|
557
801
|
const [technicianOptions, setTechnicianOptions] = react.useState([]);
|
|
@@ -602,7 +846,7 @@ const RepairDetailPage = () => {
|
|
|
602
846
|
setNewStatus(t.status);
|
|
603
847
|
setTechnicianName(t.technician_name || "");
|
|
604
848
|
setTechnicianId(t.technician_id || "");
|
|
605
|
-
setLaborCost((t.labor_estimate
|
|
849
|
+
setLaborCost((t.labor_estimate || 0).toFixed(2));
|
|
606
850
|
setEtc(
|
|
607
851
|
t.estimated_completion ? t.estimated_completion.split("T")[0] : ""
|
|
608
852
|
);
|
|
@@ -642,6 +886,7 @@ const RepairDetailPage = () => {
|
|
|
642
886
|
});
|
|
643
887
|
ui.toast.success("Inventory part added");
|
|
644
888
|
setSelectedInventoryPart("");
|
|
889
|
+
setPartSearch("");
|
|
645
890
|
loadTicket();
|
|
646
891
|
} catch (err) {
|
|
647
892
|
ui.toast.error("Failed to add part");
|
|
@@ -674,12 +919,14 @@ const RepairDetailPage = () => {
|
|
|
674
919
|
headers: { "Content-Type": "application/json" },
|
|
675
920
|
body: JSON.stringify({
|
|
676
921
|
name: customPartName,
|
|
677
|
-
price: Number(customPartPrice)
|
|
922
|
+
price: Number(customPartPrice),
|
|
923
|
+
is_taxable: customPartTaxable
|
|
678
924
|
})
|
|
679
925
|
});
|
|
680
926
|
ui.toast.success("Custom part added");
|
|
681
927
|
setCustomPartName("");
|
|
682
928
|
setCustomPartPrice("");
|
|
929
|
+
setCustomPartTaxable(true);
|
|
683
930
|
loadTicket();
|
|
684
931
|
} catch (err) {
|
|
685
932
|
ui.toast.error("Failed to add custom part");
|
|
@@ -734,7 +981,7 @@ const RepairDetailPage = () => {
|
|
|
734
981
|
try {
|
|
735
982
|
const promises = [];
|
|
736
983
|
if (laborCost !== "") {
|
|
737
|
-
const laborAmount =
|
|
984
|
+
const laborAmount = parseFloat(laborCost);
|
|
738
985
|
if (!isNaN(laborAmount)) {
|
|
739
986
|
promises.push(
|
|
740
987
|
fetch(`/admin/repairs/${id}/costs`, {
|
|
@@ -849,6 +1096,14 @@ const RepairDetailPage = () => {
|
|
|
849
1096
|
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", children: "Invoice PDF" })
|
|
850
1097
|
}
|
|
851
1098
|
),
|
|
1099
|
+
(ticket.payment_status === "captured" || ticket.payment_status === "paid") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
+
"a",
|
|
1101
|
+
{
|
|
1102
|
+
href: `/admin/repairs/${id}/document?type=receipt`,
|
|
1103
|
+
target: "_blank",
|
|
1104
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", size: "small", children: "Download Receipt" })
|
|
1105
|
+
}
|
|
1106
|
+
),
|
|
852
1107
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
853
1108
|
"a",
|
|
854
1109
|
{
|
|
@@ -935,10 +1190,19 @@ const RepairDetailPage = () => {
|
|
|
935
1190
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Total Estimate:" }),
|
|
936
1191
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: formatCurrency(ticket.total_estimate) })
|
|
937
1192
|
] }),
|
|
938
|
-
ticket.is_approved ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
939
|
-
"
|
|
940
|
-
|
|
941
|
-
|
|
1193
|
+
ticket.is_approved ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 mt-2", children: [
|
|
1194
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Badge, { color: "green", size: "small", children: [
|
|
1195
|
+
"Approved on ",
|
|
1196
|
+
new Date(ticket.approved_at).toLocaleDateString()
|
|
1197
|
+
] }),
|
|
1198
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between items-center border-t pt-2 mt-2", children: [
|
|
1199
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm font-medium", children: "Payment Status" }),
|
|
1200
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: ticket.payment_status === "paid" || ticket.payment_status === "captured" ? "green" : "orange", size: "small", children: ticket.payment_status.toUpperCase() })
|
|
1201
|
+
] }),
|
|
1202
|
+
ticket.payment_collection_id && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "text-xs text-ui-fg-muted", children: [
|
|
1203
|
+
"Collection ID: ",
|
|
1204
|
+
ticket.payment_collection_id
|
|
1205
|
+
] })
|
|
942
1206
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 pt-4 border-t", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
943
1207
|
ui.Button,
|
|
944
1208
|
{
|
|
@@ -947,7 +1211,7 @@ const RepairDetailPage = () => {
|
|
|
947
1211
|
onClick: handleManualApprove,
|
|
948
1212
|
disabled: loading,
|
|
949
1213
|
className: "w-full",
|
|
950
|
-
children: "Manually Approve & Create
|
|
1214
|
+
children: "Manually Approve & Create Payment"
|
|
951
1215
|
}
|
|
952
1216
|
) })
|
|
953
1217
|
] })
|
|
@@ -957,41 +1221,80 @@ const RepairDetailPage = () => {
|
|
|
957
1221
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 mb-6", children: [
|
|
958
1222
|
ticket.parts && ticket.parts.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
959
1223
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Inventory Parts Used" }),
|
|
960
|
-
ticket.parts.map((p) =>
|
|
1224
|
+
ticket.parts.map((p) => {
|
|
1225
|
+
var _a, _b, _c;
|
|
1226
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1227
|
+
"div",
|
|
1228
|
+
{
|
|
1229
|
+
className: "flex items-center justify-between p-2 bg-ui-bg-subtle rounded border text-sm",
|
|
1230
|
+
children: [
|
|
1231
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
1232
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
1233
|
+
((_a = p.product) == null ? void 0 : _a.title) ? `${p.product.title} - ` : "",
|
|
1234
|
+
p.title
|
|
1235
|
+
] }),
|
|
1236
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "text-ui-fg-subtle text-xs", children: [
|
|
1237
|
+
p.sku || "-",
|
|
1238
|
+
" ",
|
|
1239
|
+
((_c = (_b = p.prices) == null ? void 0 : _b[0]) == null ? void 0 : _c.amount) != null ? ` • ${formatCurrency(p.prices[0].amount)}` : ""
|
|
1240
|
+
] })
|
|
1241
|
+
] }),
|
|
1242
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1243
|
+
ui.Button,
|
|
1244
|
+
{
|
|
1245
|
+
variant: "transparent",
|
|
1246
|
+
className: "text-ui-fg-muted hover:text-ui-fg-base",
|
|
1247
|
+
onClick: () => handleRemoveInventoryPart(p.id),
|
|
1248
|
+
disabled: isAddingPart,
|
|
1249
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
|
|
1250
|
+
}
|
|
1251
|
+
)
|
|
1252
|
+
]
|
|
1253
|
+
},
|
|
1254
|
+
p.id
|
|
1255
|
+
);
|
|
1256
|
+
})
|
|
1257
|
+
] }),
|
|
1258
|
+
ticket.custom_parts && ticket.custom_parts.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1259
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Custom Parts" }),
|
|
1260
|
+
ticket.custom_parts.map((cp, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
961
1261
|
"div",
|
|
962
1262
|
{
|
|
963
1263
|
className: "flex items-center justify-between p-2 bg-ui-bg-subtle rounded border text-sm",
|
|
964
1264
|
children: [
|
|
965
1265
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
966
|
-
/* @__PURE__ */ jsxRuntime.
|
|
967
|
-
|
|
1266
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
1267
|
+
cp.name,
|
|
1268
|
+
cp.is_taxable === false && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-2 text-[10px] bg-ui-tag-neutral-bg text-ui-tag-neutral-text px-1.5 py-0.5 rounded-full border border-ui-border-base", children: "No VAT" })
|
|
1269
|
+
] }),
|
|
1270
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium text-xs", children: formatCurrency(cp.price) })
|
|
968
1271
|
] }),
|
|
969
1272
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
970
1273
|
ui.Button,
|
|
971
1274
|
{
|
|
972
1275
|
variant: "transparent",
|
|
973
1276
|
className: "text-ui-fg-muted hover:text-ui-fg-base",
|
|
974
|
-
onClick: () =>
|
|
1277
|
+
onClick: async () => {
|
|
1278
|
+
try {
|
|
1279
|
+
setIsAddingPart(true);
|
|
1280
|
+
await fetch(`/admin/repairs/${id}/custom-parts/${idx}`, {
|
|
1281
|
+
method: "DELETE",
|
|
1282
|
+
credentials: "include"
|
|
1283
|
+
});
|
|
1284
|
+
ui.toast.success("Custom part removed");
|
|
1285
|
+
loadTicket();
|
|
1286
|
+
} catch (e) {
|
|
1287
|
+
ui.toast.error("Failed to remove custom part");
|
|
1288
|
+
} finally {
|
|
1289
|
+
setIsAddingPart(false);
|
|
1290
|
+
}
|
|
1291
|
+
},
|
|
975
1292
|
disabled: isAddingPart,
|
|
976
1293
|
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
|
|
977
1294
|
}
|
|
978
1295
|
)
|
|
979
1296
|
]
|
|
980
1297
|
},
|
|
981
|
-
p.id
|
|
982
|
-
))
|
|
983
|
-
] }),
|
|
984
|
-
ticket.custom_parts && ticket.custom_parts.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
985
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: "Custom Parts" }),
|
|
986
|
-
ticket.custom_parts.map((cp, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
987
|
-
"div",
|
|
988
|
-
{
|
|
989
|
-
className: "flex justify-between p-2 bg-ui-bg-subtle rounded border text-sm",
|
|
990
|
-
children: [
|
|
991
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: cp.name }),
|
|
992
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: formatCurrency(cp.price) })
|
|
993
|
-
]
|
|
994
|
-
},
|
|
995
1298
|
idx
|
|
996
1299
|
))
|
|
997
1300
|
] })
|
|
@@ -999,21 +1302,48 @@ const RepairDetailPage = () => {
|
|
|
999
1302
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
1000
1303
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-sm", children: "Add Inventory Part" }),
|
|
1001
1304
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
1002
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1305
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1", children: [
|
|
1306
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1307
|
+
ui.Input,
|
|
1308
|
+
{
|
|
1309
|
+
placeholder: "Search variant...",
|
|
1310
|
+
value: partSearch,
|
|
1311
|
+
onChange: (e) => {
|
|
1312
|
+
setPartSearch(e.target.value);
|
|
1313
|
+
setSelectedInventoryPart("");
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
),
|
|
1317
|
+
partSearch && !selectedInventoryPart && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute z-10 w-full mt-1 bg-ui-bg-base border border-ui-border-base rounded-md shadow-md max-h-48 overflow-y-auto", children: [
|
|
1318
|
+
inventoryParts.filter(
|
|
1319
|
+
(p) => {
|
|
1320
|
+
var _a;
|
|
1321
|
+
return p.title.toLowerCase().includes(partSearch.toLowerCase()) || ((_a = p.sku) == null ? void 0 : _a.toLowerCase().includes(partSearch.toLowerCase()));
|
|
1322
|
+
}
|
|
1323
|
+
).map((p) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1324
|
+
"div",
|
|
1325
|
+
{
|
|
1326
|
+
className: "p-2 text-sm hover:bg-ui-bg-subtle-hover cursor-pointer",
|
|
1327
|
+
onClick: () => {
|
|
1328
|
+
setSelectedInventoryPart(p.id);
|
|
1329
|
+
setPartSearch(`${p.title} ${p.sku ? `(${p.sku})` : ""}`);
|
|
1330
|
+
},
|
|
1331
|
+
children: [
|
|
1332
|
+
p.title,
|
|
1333
|
+
" ",
|
|
1334
|
+
p.sku ? `(${p.sku})` : ""
|
|
1335
|
+
]
|
|
1336
|
+
},
|
|
1337
|
+
p.id
|
|
1338
|
+
)),
|
|
1339
|
+
inventoryParts.filter(
|
|
1340
|
+
(p) => {
|
|
1341
|
+
var _a;
|
|
1342
|
+
return p.title.toLowerCase().includes(partSearch.toLowerCase()) || ((_a = p.sku) == null ? void 0 : _a.toLowerCase().includes(partSearch.toLowerCase()));
|
|
1343
|
+
}
|
|
1344
|
+
).length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 text-sm text-ui-fg-subtle", children: "No parts found" })
|
|
1345
|
+
] })
|
|
1346
|
+
] }),
|
|
1017
1347
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1018
1348
|
ui.Button,
|
|
1019
1349
|
{
|
|
@@ -1046,6 +1376,18 @@ const RepairDetailPage = () => {
|
|
|
1046
1376
|
onChange: (e) => setCustomPartPrice(e.target.value)
|
|
1047
1377
|
}
|
|
1048
1378
|
),
|
|
1379
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1380
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1381
|
+
"input",
|
|
1382
|
+
{
|
|
1383
|
+
type: "checkbox",
|
|
1384
|
+
id: "vat-toggle",
|
|
1385
|
+
checked: customPartTaxable,
|
|
1386
|
+
onChange: (e) => setCustomPartTaxable(e.target.checked)
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1389
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "vat-toggle", className: "text-xs", children: "VAT?" })
|
|
1390
|
+
] }),
|
|
1049
1391
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
1392
|
ui.Button,
|
|
1051
1393
|
{
|