medusajs-documents-plugin 1.1.20 → 1.1.23

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.
@@ -345,11 +345,11 @@ const DocumentsPage = () => {
345
345
  pdf_payment_details: "",
346
346
  pdf_terms: "",
347
347
  // Template Choices
348
- invoice_template: "modern",
348
+ invoice_template: "zoho_exact",
349
349
  packing_slip_template: "modern",
350
- receipt_template: "modern",
351
- estimate_template: "modern",
352
- job_card_template: "modern",
350
+ receipt_template: "zoho_exact",
351
+ estimate_template: "zoho_exact",
352
+ job_card_template: "standard",
353
353
  custom_doc_template: "modern",
354
354
  // Customizable Notification Templates
355
355
  email_subject_template: "",
@@ -671,6 +671,48 @@ const DocumentsPage = () => {
671
671
  alert("Error syncing to Zoho Books.");
672
672
  }
673
673
  };
674
+ const handleDeleteDocument = async (docId) => {
675
+ if (!confirm("Are you sure you want to delete this document record?")) return;
676
+ try {
677
+ const res = await fetch(`/admin/documents/${docId}`, {
678
+ method: "DELETE",
679
+ credentials: "include"
680
+ });
681
+ const data = await res.json();
682
+ if (res.ok && data.success) {
683
+ alert("Document deleted successfully!");
684
+ loadDocuments();
685
+ } else {
686
+ alert(`Failed to delete document: ${data.message || "Unknown error"}`);
687
+ }
688
+ } catch (e) {
689
+ alert(`Error deleting document: ${e.message}`);
690
+ }
691
+ };
692
+ const handleDeleteRepairDocuments = async (repairTicketId) => {
693
+ var _a, _b, _c;
694
+ if (!confirm(
695
+ "Are you sure you want to delete ALL generated documents for this repair ticket (including in Zoho Books)? This will allow documents to be cleanly regenerated with updated ticket information."
696
+ )) {
697
+ return;
698
+ }
699
+ try {
700
+ const res = await fetch(`/admin/documents/repair/${repairTicketId}`, {
701
+ method: "DELETE",
702
+ credentials: "include"
703
+ });
704
+ const data = await res.json();
705
+ if (res.ok && data.success) {
706
+ const zohoCount = (((_a = data.deleted_zoho_invoices) == null ? void 0 : _a.length) || 0) + (((_b = data.deleted_zoho_estimates) == null ? void 0 : _b.length) || 0) + (((_c = data.deleted_zoho_payments) == null ? void 0 : _c.length) || 0);
707
+ alert(`Successfully deleted ${data.deleted_records || 0} document record(s)${zohoCount > 0 ? ` and ${zohoCount} Zoho document(s)` : ""}!`);
708
+ loadDocuments();
709
+ } else {
710
+ alert(`Failed to delete repair documents: ${data.message || "Unknown error"}`);
711
+ }
712
+ } catch (e) {
713
+ alert(`Error deleting repair documents: ${e.message}`);
714
+ }
715
+ };
674
716
  const filteredDocs = documents.filter((doc) => {
675
717
  var _a, _b, _c, _d;
676
718
  if (typeFilter !== "all" && doc.type !== typeFilter) return false;
@@ -1018,6 +1060,22 @@ const DocumentsPage = () => {
1018
1060
  title: "Copy Short Payment Link",
1019
1061
  children: "Copy Link"
1020
1062
  }
1063
+ ),
1064
+ /* @__PURE__ */ jsxRuntime.jsx(
1065
+ "button",
1066
+ {
1067
+ type: "button",
1068
+ onClick: () => {
1069
+ if (doc.repair_ticket_id) {
1070
+ handleDeleteRepairDocuments(doc.repair_ticket_id);
1071
+ } else {
1072
+ handleDeleteDocument(doc.id);
1073
+ }
1074
+ },
1075
+ className: "p-1.5 rounded hover:bg-ui-bg-subtle text-ui-fg-subtle hover:text-red-600 transition-colors",
1076
+ title: doc.repair_ticket_id ? "Delete / Reset All Documents for this Repair Ticket (including in Zoho Books)" : "Delete Document Record",
1077
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "w-4 h-4 text-red-500 hover:text-red-700" })
1078
+ }
1021
1079
  )
1022
1080
  ] }) })
1023
1081
  ]
@@ -1033,15 +1091,30 @@ const DocumentsPage = () => {
1033
1091
  ")"
1034
1092
  ] })
1035
1093
  ] }),
1036
- /* @__PURE__ */ jsxRuntime.jsx(
1037
- "button",
1038
- {
1039
- type: "button",
1040
- onClick: () => toggleGroup(group.groupId),
1041
- className: "text-[11px] text-ui-fg-interactive hover:underline",
1042
- children: "Collapse"
1043
- }
1044
- )
1094
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
1095
+ group.repair_ticket_id && /* @__PURE__ */ jsxRuntime.jsxs(
1096
+ "button",
1097
+ {
1098
+ type: "button",
1099
+ onClick: () => handleDeleteRepairDocuments(group.repair_ticket_id),
1100
+ className: "text-[11px] text-red-600 hover:text-red-700 hover:underline flex items-center gap-1 font-medium",
1101
+ title: "Delete all generated documents for this repair job in database & Zoho Books to allow clean regeneration",
1102
+ children: [
1103
+ /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "w-3 h-3" }),
1104
+ " Reset / Delete Job Documents"
1105
+ ]
1106
+ }
1107
+ ),
1108
+ /* @__PURE__ */ jsxRuntime.jsx(
1109
+ "button",
1110
+ {
1111
+ type: "button",
1112
+ onClick: () => toggleGroup(group.groupId),
1113
+ className: "text-[11px] text-ui-fg-interactive hover:underline",
1114
+ children: "Collapse"
1115
+ }
1116
+ )
1117
+ ] })
1045
1118
  ] }),
1046
1119
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto rounded border border-ui-border-base bg-ui-bg-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full text-left border-collapse", children: [
1047
1120
  /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-b border-ui-border-base bg-ui-bg-subtle text-[11px] text-ui-fg-muted font-medium", children: [
@@ -1135,6 +1208,22 @@ const DocumentsPage = () => {
1135
1208
  title: "Copy Short Link",
1136
1209
  children: "Copy Link"
1137
1210
  }
1211
+ ),
1212
+ /* @__PURE__ */ jsxRuntime.jsx(
1213
+ "button",
1214
+ {
1215
+ type: "button",
1216
+ onClick: () => {
1217
+ if (subDoc.repair_ticket_id) {
1218
+ handleDeleteRepairDocuments(subDoc.repair_ticket_id);
1219
+ } else {
1220
+ handleDeleteDocument(subDoc.id);
1221
+ }
1222
+ },
1223
+ className: "p-1 rounded hover:bg-ui-bg-subtle text-ui-fg-subtle hover:text-red-600 transition-colors",
1224
+ title: subDoc.repair_ticket_id ? "Delete / Reset All Documents for this Repair Ticket (including in Zoho Books)" : "Delete Document Record",
1225
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "w-3.5 h-3.5 text-red-500 hover:text-red-700" })
1226
+ }
1138
1227
  )
1139
1228
  ] }) })
1140
1229
  ] }, subDoc.id);
@@ -1213,6 +1302,22 @@ const DocumentsPage = () => {
1213
1302
  title: "Copy Short Payment Link",
1214
1303
  children: "Copy Link"
1215
1304
  }
1305
+ ),
1306
+ /* @__PURE__ */ jsxRuntime.jsx(
1307
+ "button",
1308
+ {
1309
+ type: "button",
1310
+ onClick: () => {
1311
+ if (doc.repair_ticket_id) {
1312
+ handleDeleteRepairDocuments(doc.repair_ticket_id);
1313
+ } else {
1314
+ handleDeleteDocument(doc.id);
1315
+ }
1316
+ },
1317
+ className: "p-1.5 rounded hover:bg-ui-bg-subtle text-ui-fg-subtle hover:text-red-600 transition-colors",
1318
+ title: doc.repair_ticket_id ? "Delete / Reset All Documents for this Repair Ticket (including in Zoho Books)" : "Delete Document Record",
1319
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, { className: "w-4 h-4 text-red-500 hover:text-red-700" })
1320
+ }
1216
1321
  )
1217
1322
  ] }) })
1218
1323
  ] }, doc.id);
@@ -1273,11 +1378,12 @@ const DocumentsPage = () => {
1273
1378
  /* @__PURE__ */ jsxRuntime.jsxs(
1274
1379
  ui.Select,
1275
1380
  {
1276
- value: settings.invoice_template || "modern",
1381
+ value: settings.invoice_template || "zoho_exact",
1277
1382
  onValueChange: (v) => updateSettingField("invoice_template", v),
1278
1383
  children: [
1279
1384
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
1280
1385
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
1386
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1281
1387
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "modern", children: "Modern Minimalist" }),
1282
1388
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "classic", children: "Classic Corporate" }),
1283
1389
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1291,8 +1397,8 @@ const DocumentsPage = () => {
1291
1397
  {
1292
1398
  variant: "secondary",
1293
1399
  size: "small",
1294
- onClick: () => handlePreviewTemplate(settings.invoice_template || "modern", "invoice"),
1295
- isLoading: previewLoading === `${settings.invoice_template || "modern"}-invoice`,
1400
+ onClick: () => handlePreviewTemplate(settings.invoice_template || "zoho_exact", "invoice"),
1401
+ isLoading: previewLoading === `${settings.invoice_template || "zoho_exact"}-invoice`,
1296
1402
  children: [
1297
1403
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1298
1404
  " Preview Invoice Template"
@@ -1341,11 +1447,12 @@ const DocumentsPage = () => {
1341
1447
  /* @__PURE__ */ jsxRuntime.jsxs(
1342
1448
  ui.Select,
1343
1449
  {
1344
- value: settings.receipt_template || "modern",
1450
+ value: settings.receipt_template || "zoho_exact",
1345
1451
  onValueChange: (v) => updateSettingField("receipt_template", v),
1346
1452
  children: [
1347
1453
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
1348
1454
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
1455
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1349
1456
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "modern", children: "Modern Minimalist" }),
1350
1457
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "classic", children: "Classic Corporate" }),
1351
1458
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1359,8 +1466,8 @@ const DocumentsPage = () => {
1359
1466
  {
1360
1467
  variant: "secondary",
1361
1468
  size: "small",
1362
- onClick: () => handlePreviewTemplate(settings.receipt_template || "modern", "receipt"),
1363
- isLoading: previewLoading === `${settings.receipt_template || "modern"}-receipt`,
1469
+ onClick: () => handlePreviewTemplate(settings.receipt_template || "zoho_exact", "receipt"),
1470
+ isLoading: previewLoading === `${settings.receipt_template || "zoho_exact"}-receipt`,
1364
1471
  children: [
1365
1472
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1366
1473
  " Preview Receipt Template"
@@ -1375,11 +1482,12 @@ const DocumentsPage = () => {
1375
1482
  /* @__PURE__ */ jsxRuntime.jsxs(
1376
1483
  ui.Select,
1377
1484
  {
1378
- value: settings.estimate_template || "modern",
1485
+ value: settings.estimate_template || "zoho_exact",
1379
1486
  onValueChange: (v) => updateSettingField("estimate_template", v),
1380
1487
  children: [
1381
1488
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
1382
1489
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
1490
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1383
1491
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "modern", children: "Modern Minimalist" }),
1384
1492
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "classic", children: "Classic Corporate" }),
1385
1493
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1393,8 +1501,8 @@ const DocumentsPage = () => {
1393
1501
  {
1394
1502
  variant: "secondary",
1395
1503
  size: "small",
1396
- onClick: () => handlePreviewTemplate(settings.estimate_template || "modern", "estimate"),
1397
- isLoading: previewLoading === `${settings.estimate_template || "modern"}-estimate`,
1504
+ onClick: () => handlePreviewTemplate(settings.estimate_template || "zoho_exact", "estimate"),
1505
+ isLoading: previewLoading === `${settings.estimate_template || "zoho_exact"}-estimate`,
1398
1506
  children: [
1399
1507
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1400
1508
  " Preview Estimate Template"
@@ -1416,7 +1524,8 @@ const DocumentsPage = () => {
1416
1524
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
1417
1525
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "modern", children: "Modern Minimalist" }),
1418
1526
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "classic", children: "Classic Corporate" }),
1419
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
1527
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "minimal", children: "Clean Tech Monospace" }),
1528
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" })
1420
1529
  ] })
1421
1530
  ]
1422
1531
  }
@@ -1443,11 +1552,13 @@ const DocumentsPage = () => {
1443
1552
  /* @__PURE__ */ jsxRuntime.jsxs(
1444
1553
  ui.Select,
1445
1554
  {
1446
- value: settings.job_card_template || "modern",
1555
+ value: settings.job_card_template || "standard",
1447
1556
  onValueChange: (v) => updateSettingField("job_card_template", v),
1448
1557
  children: [
1449
1558
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, {}) }),
1450
1559
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
1560
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "standard", children: "Workshop Intake Job Card (Standard)" }),
1561
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1451
1562
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "modern", children: "Modern Minimalist" }),
1452
1563
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "classic", children: "Classic Corporate" }),
1453
1564
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1461,8 +1572,8 @@ const DocumentsPage = () => {
1461
1572
  {
1462
1573
  variant: "secondary",
1463
1574
  size: "small",
1464
- onClick: () => handlePreviewTemplate(settings.job_card_template || "modern", "job_card"),
1465
- isLoading: previewLoading === `${settings.job_card_template || "modern"}-job_card`,
1575
+ onClick: () => handlePreviewTemplate(settings.job_card_template || "standard", "job_card"),
1576
+ isLoading: previewLoading === `${settings.job_card_template || "standard"}-job_card`,
1466
1577
  children: [
1467
1578
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1468
1579
  " Preview Job Card Template"
@@ -344,11 +344,11 @@ const DocumentsPage = () => {
344
344
  pdf_payment_details: "",
345
345
  pdf_terms: "",
346
346
  // Template Choices
347
- invoice_template: "modern",
347
+ invoice_template: "zoho_exact",
348
348
  packing_slip_template: "modern",
349
- receipt_template: "modern",
350
- estimate_template: "modern",
351
- job_card_template: "modern",
349
+ receipt_template: "zoho_exact",
350
+ estimate_template: "zoho_exact",
351
+ job_card_template: "standard",
352
352
  custom_doc_template: "modern",
353
353
  // Customizable Notification Templates
354
354
  email_subject_template: "",
@@ -670,6 +670,48 @@ const DocumentsPage = () => {
670
670
  alert("Error syncing to Zoho Books.");
671
671
  }
672
672
  };
673
+ const handleDeleteDocument = async (docId) => {
674
+ if (!confirm("Are you sure you want to delete this document record?")) return;
675
+ try {
676
+ const res = await fetch(`/admin/documents/${docId}`, {
677
+ method: "DELETE",
678
+ credentials: "include"
679
+ });
680
+ const data = await res.json();
681
+ if (res.ok && data.success) {
682
+ alert("Document deleted successfully!");
683
+ loadDocuments();
684
+ } else {
685
+ alert(`Failed to delete document: ${data.message || "Unknown error"}`);
686
+ }
687
+ } catch (e) {
688
+ alert(`Error deleting document: ${e.message}`);
689
+ }
690
+ };
691
+ const handleDeleteRepairDocuments = async (repairTicketId) => {
692
+ var _a, _b, _c;
693
+ if (!confirm(
694
+ "Are you sure you want to delete ALL generated documents for this repair ticket (including in Zoho Books)? This will allow documents to be cleanly regenerated with updated ticket information."
695
+ )) {
696
+ return;
697
+ }
698
+ try {
699
+ const res = await fetch(`/admin/documents/repair/${repairTicketId}`, {
700
+ method: "DELETE",
701
+ credentials: "include"
702
+ });
703
+ const data = await res.json();
704
+ if (res.ok && data.success) {
705
+ const zohoCount = (((_a = data.deleted_zoho_invoices) == null ? void 0 : _a.length) || 0) + (((_b = data.deleted_zoho_estimates) == null ? void 0 : _b.length) || 0) + (((_c = data.deleted_zoho_payments) == null ? void 0 : _c.length) || 0);
706
+ alert(`Successfully deleted ${data.deleted_records || 0} document record(s)${zohoCount > 0 ? ` and ${zohoCount} Zoho document(s)` : ""}!`);
707
+ loadDocuments();
708
+ } else {
709
+ alert(`Failed to delete repair documents: ${data.message || "Unknown error"}`);
710
+ }
711
+ } catch (e) {
712
+ alert(`Error deleting repair documents: ${e.message}`);
713
+ }
714
+ };
673
715
  const filteredDocs = documents.filter((doc) => {
674
716
  var _a, _b, _c, _d;
675
717
  if (typeFilter !== "all" && doc.type !== typeFilter) return false;
@@ -1017,6 +1059,22 @@ const DocumentsPage = () => {
1017
1059
  title: "Copy Short Payment Link",
1018
1060
  children: "Copy Link"
1019
1061
  }
1062
+ ),
1063
+ /* @__PURE__ */ jsx(
1064
+ "button",
1065
+ {
1066
+ type: "button",
1067
+ onClick: () => {
1068
+ if (doc.repair_ticket_id) {
1069
+ handleDeleteRepairDocuments(doc.repair_ticket_id);
1070
+ } else {
1071
+ handleDeleteDocument(doc.id);
1072
+ }
1073
+ },
1074
+ className: "p-1.5 rounded hover:bg-ui-bg-subtle text-ui-fg-subtle hover:text-red-600 transition-colors",
1075
+ title: doc.repair_ticket_id ? "Delete / Reset All Documents for this Repair Ticket (including in Zoho Books)" : "Delete Document Record",
1076
+ children: /* @__PURE__ */ jsx(Trash, { className: "w-4 h-4 text-red-500 hover:text-red-700" })
1077
+ }
1020
1078
  )
1021
1079
  ] }) })
1022
1080
  ]
@@ -1032,15 +1090,30 @@ const DocumentsPage = () => {
1032
1090
  ")"
1033
1091
  ] })
1034
1092
  ] }),
1035
- /* @__PURE__ */ jsx(
1036
- "button",
1037
- {
1038
- type: "button",
1039
- onClick: () => toggleGroup(group.groupId),
1040
- className: "text-[11px] text-ui-fg-interactive hover:underline",
1041
- children: "Collapse"
1042
- }
1043
- )
1093
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
1094
+ group.repair_ticket_id && /* @__PURE__ */ jsxs(
1095
+ "button",
1096
+ {
1097
+ type: "button",
1098
+ onClick: () => handleDeleteRepairDocuments(group.repair_ticket_id),
1099
+ className: "text-[11px] text-red-600 hover:text-red-700 hover:underline flex items-center gap-1 font-medium",
1100
+ title: "Delete all generated documents for this repair job in database & Zoho Books to allow clean regeneration",
1101
+ children: [
1102
+ /* @__PURE__ */ jsx(Trash, { className: "w-3 h-3" }),
1103
+ " Reset / Delete Job Documents"
1104
+ ]
1105
+ }
1106
+ ),
1107
+ /* @__PURE__ */ jsx(
1108
+ "button",
1109
+ {
1110
+ type: "button",
1111
+ onClick: () => toggleGroup(group.groupId),
1112
+ className: "text-[11px] text-ui-fg-interactive hover:underline",
1113
+ children: "Collapse"
1114
+ }
1115
+ )
1116
+ ] })
1044
1117
  ] }),
1045
1118
  /* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded border border-ui-border-base bg-ui-bg-base", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-left border-collapse", children: [
1046
1119
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-ui-border-base bg-ui-bg-subtle text-[11px] text-ui-fg-muted font-medium", children: [
@@ -1134,6 +1207,22 @@ const DocumentsPage = () => {
1134
1207
  title: "Copy Short Link",
1135
1208
  children: "Copy Link"
1136
1209
  }
1210
+ ),
1211
+ /* @__PURE__ */ jsx(
1212
+ "button",
1213
+ {
1214
+ type: "button",
1215
+ onClick: () => {
1216
+ if (subDoc.repair_ticket_id) {
1217
+ handleDeleteRepairDocuments(subDoc.repair_ticket_id);
1218
+ } else {
1219
+ handleDeleteDocument(subDoc.id);
1220
+ }
1221
+ },
1222
+ className: "p-1 rounded hover:bg-ui-bg-subtle text-ui-fg-subtle hover:text-red-600 transition-colors",
1223
+ title: subDoc.repair_ticket_id ? "Delete / Reset All Documents for this Repair Ticket (including in Zoho Books)" : "Delete Document Record",
1224
+ children: /* @__PURE__ */ jsx(Trash, { className: "w-3.5 h-3.5 text-red-500 hover:text-red-700" })
1225
+ }
1137
1226
  )
1138
1227
  ] }) })
1139
1228
  ] }, subDoc.id);
@@ -1212,6 +1301,22 @@ const DocumentsPage = () => {
1212
1301
  title: "Copy Short Payment Link",
1213
1302
  children: "Copy Link"
1214
1303
  }
1304
+ ),
1305
+ /* @__PURE__ */ jsx(
1306
+ "button",
1307
+ {
1308
+ type: "button",
1309
+ onClick: () => {
1310
+ if (doc.repair_ticket_id) {
1311
+ handleDeleteRepairDocuments(doc.repair_ticket_id);
1312
+ } else {
1313
+ handleDeleteDocument(doc.id);
1314
+ }
1315
+ },
1316
+ className: "p-1.5 rounded hover:bg-ui-bg-subtle text-ui-fg-subtle hover:text-red-600 transition-colors",
1317
+ title: doc.repair_ticket_id ? "Delete / Reset All Documents for this Repair Ticket (including in Zoho Books)" : "Delete Document Record",
1318
+ children: /* @__PURE__ */ jsx(Trash, { className: "w-4 h-4 text-red-500 hover:text-red-700" })
1319
+ }
1215
1320
  )
1216
1321
  ] }) })
1217
1322
  ] }, doc.id);
@@ -1272,11 +1377,12 @@ const DocumentsPage = () => {
1272
1377
  /* @__PURE__ */ jsxs(
1273
1378
  Select,
1274
1379
  {
1275
- value: settings.invoice_template || "modern",
1380
+ value: settings.invoice_template || "zoho_exact",
1276
1381
  onValueChange: (v) => updateSettingField("invoice_template", v),
1277
1382
  children: [
1278
1383
  /* @__PURE__ */ jsx(Select.Trigger, { size: "small", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
1279
1384
  /* @__PURE__ */ jsxs(Select.Content, { children: [
1385
+ /* @__PURE__ */ jsx(Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1280
1386
  /* @__PURE__ */ jsx(Select.Item, { value: "modern", children: "Modern Minimalist" }),
1281
1387
  /* @__PURE__ */ jsx(Select.Item, { value: "classic", children: "Classic Corporate" }),
1282
1388
  /* @__PURE__ */ jsx(Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1290,8 +1396,8 @@ const DocumentsPage = () => {
1290
1396
  {
1291
1397
  variant: "secondary",
1292
1398
  size: "small",
1293
- onClick: () => handlePreviewTemplate(settings.invoice_template || "modern", "invoice"),
1294
- isLoading: previewLoading === `${settings.invoice_template || "modern"}-invoice`,
1399
+ onClick: () => handlePreviewTemplate(settings.invoice_template || "zoho_exact", "invoice"),
1400
+ isLoading: previewLoading === `${settings.invoice_template || "zoho_exact"}-invoice`,
1295
1401
  children: [
1296
1402
  /* @__PURE__ */ jsx(ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1297
1403
  " Preview Invoice Template"
@@ -1340,11 +1446,12 @@ const DocumentsPage = () => {
1340
1446
  /* @__PURE__ */ jsxs(
1341
1447
  Select,
1342
1448
  {
1343
- value: settings.receipt_template || "modern",
1449
+ value: settings.receipt_template || "zoho_exact",
1344
1450
  onValueChange: (v) => updateSettingField("receipt_template", v),
1345
1451
  children: [
1346
1452
  /* @__PURE__ */ jsx(Select.Trigger, { size: "small", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
1347
1453
  /* @__PURE__ */ jsxs(Select.Content, { children: [
1454
+ /* @__PURE__ */ jsx(Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1348
1455
  /* @__PURE__ */ jsx(Select.Item, { value: "modern", children: "Modern Minimalist" }),
1349
1456
  /* @__PURE__ */ jsx(Select.Item, { value: "classic", children: "Classic Corporate" }),
1350
1457
  /* @__PURE__ */ jsx(Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1358,8 +1465,8 @@ const DocumentsPage = () => {
1358
1465
  {
1359
1466
  variant: "secondary",
1360
1467
  size: "small",
1361
- onClick: () => handlePreviewTemplate(settings.receipt_template || "modern", "receipt"),
1362
- isLoading: previewLoading === `${settings.receipt_template || "modern"}-receipt`,
1468
+ onClick: () => handlePreviewTemplate(settings.receipt_template || "zoho_exact", "receipt"),
1469
+ isLoading: previewLoading === `${settings.receipt_template || "zoho_exact"}-receipt`,
1363
1470
  children: [
1364
1471
  /* @__PURE__ */ jsx(ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1365
1472
  " Preview Receipt Template"
@@ -1374,11 +1481,12 @@ const DocumentsPage = () => {
1374
1481
  /* @__PURE__ */ jsxs(
1375
1482
  Select,
1376
1483
  {
1377
- value: settings.estimate_template || "modern",
1484
+ value: settings.estimate_template || "zoho_exact",
1378
1485
  onValueChange: (v) => updateSettingField("estimate_template", v),
1379
1486
  children: [
1380
1487
  /* @__PURE__ */ jsx(Select.Trigger, { size: "small", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
1381
1488
  /* @__PURE__ */ jsxs(Select.Content, { children: [
1489
+ /* @__PURE__ */ jsx(Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1382
1490
  /* @__PURE__ */ jsx(Select.Item, { value: "modern", children: "Modern Minimalist" }),
1383
1491
  /* @__PURE__ */ jsx(Select.Item, { value: "classic", children: "Classic Corporate" }),
1384
1492
  /* @__PURE__ */ jsx(Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1392,8 +1500,8 @@ const DocumentsPage = () => {
1392
1500
  {
1393
1501
  variant: "secondary",
1394
1502
  size: "small",
1395
- onClick: () => handlePreviewTemplate(settings.estimate_template || "modern", "estimate"),
1396
- isLoading: previewLoading === `${settings.estimate_template || "modern"}-estimate`,
1503
+ onClick: () => handlePreviewTemplate(settings.estimate_template || "zoho_exact", "estimate"),
1504
+ isLoading: previewLoading === `${settings.estimate_template || "zoho_exact"}-estimate`,
1397
1505
  children: [
1398
1506
  /* @__PURE__ */ jsx(ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1399
1507
  " Preview Estimate Template"
@@ -1415,7 +1523,8 @@ const DocumentsPage = () => {
1415
1523
  /* @__PURE__ */ jsxs(Select.Content, { children: [
1416
1524
  /* @__PURE__ */ jsx(Select.Item, { value: "modern", children: "Modern Minimalist" }),
1417
1525
  /* @__PURE__ */ jsx(Select.Item, { value: "classic", children: "Classic Corporate" }),
1418
- /* @__PURE__ */ jsx(Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
1526
+ /* @__PURE__ */ jsx(Select.Item, { value: "minimal", children: "Clean Tech Monospace" }),
1527
+ /* @__PURE__ */ jsx(Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" })
1419
1528
  ] })
1420
1529
  ]
1421
1530
  }
@@ -1442,11 +1551,13 @@ const DocumentsPage = () => {
1442
1551
  /* @__PURE__ */ jsxs(
1443
1552
  Select,
1444
1553
  {
1445
- value: settings.job_card_template || "modern",
1554
+ value: settings.job_card_template || "standard",
1446
1555
  onValueChange: (v) => updateSettingField("job_card_template", v),
1447
1556
  children: [
1448
1557
  /* @__PURE__ */ jsx(Select.Trigger, { size: "small", children: /* @__PURE__ */ jsx(Select.Value, {}) }),
1449
1558
  /* @__PURE__ */ jsxs(Select.Content, { children: [
1559
+ /* @__PURE__ */ jsx(Select.Item, { value: "standard", children: "Workshop Intake Job Card (Standard)" }),
1560
+ /* @__PURE__ */ jsx(Select.Item, { value: "zoho_exact", children: "Zoho Books Exact Layout" }),
1450
1561
  /* @__PURE__ */ jsx(Select.Item, { value: "modern", children: "Modern Minimalist" }),
1451
1562
  /* @__PURE__ */ jsx(Select.Item, { value: "classic", children: "Classic Corporate" }),
1452
1563
  /* @__PURE__ */ jsx(Select.Item, { value: "minimal", children: "Clean Tech Monospace" })
@@ -1460,8 +1571,8 @@ const DocumentsPage = () => {
1460
1571
  {
1461
1572
  variant: "secondary",
1462
1573
  size: "small",
1463
- onClick: () => handlePreviewTemplate(settings.job_card_template || "modern", "job_card"),
1464
- isLoading: previewLoading === `${settings.job_card_template || "modern"}-job_card`,
1574
+ onClick: () => handlePreviewTemplate(settings.job_card_template || "standard", "job_card"),
1575
+ isLoading: previewLoading === `${settings.job_card_template || "standard"}-job_card`,
1465
1576
  children: [
1466
1577
  /* @__PURE__ */ jsx(ArrowDownTray, { className: "w-3.5 h-3.5 mr-1" }),
1467
1578
  " Preview Job Card Template"