@tonzxz/government-forms 0.1.0

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.
Files changed (325) hide show
  1. package/FORM_CATALOG.md +44 -0
  2. package/README.md +165 -0
  3. package/dist/definitions.d.ts +1147 -0
  4. package/dist/definitions.js +60 -0
  5. package/dist/forms/iar.d.ts +172 -0
  6. package/dist/forms/iar.js +6 -0
  7. package/dist/forms/ics.d.ts +48 -0
  8. package/dist/forms/ics.js +6 -0
  9. package/dist/forms/iirup.d.ts +54 -0
  10. package/dist/forms/iirup.js +6 -0
  11. package/dist/forms/iirusp.d.ts +32 -0
  12. package/dist/forms/iirusp.js +6 -0
  13. package/dist/forms/itr.d.ts +42 -0
  14. package/dist/forms/itr.js +6 -0
  15. package/dist/forms/par.d.ts +84 -0
  16. package/dist/forms/par.js +6 -0
  17. package/dist/forms/ppelc.d.ts +34 -0
  18. package/dist/forms/ppelc.js +6 -0
  19. package/dist/forms/pr.d.ts +27 -0
  20. package/dist/forms/pr.js +6 -0
  21. package/dist/forms/property-card.d.ts +68 -0
  22. package/dist/forms/property-card.js +6 -0
  23. package/dist/forms/ptr.d.ts +54 -0
  24. package/dist/forms/ptr.js +6 -0
  25. package/dist/forms/regspi.d.ts +32 -0
  26. package/dist/forms/regspi.js +6 -0
  27. package/dist/forms/ris.d.ts +66 -0
  28. package/dist/forms/ris.js +6 -0
  29. package/dist/forms/rlsddp.d.ts +54 -0
  30. package/dist/forms/rlsddp.js +6 -0
  31. package/dist/forms/rlsddsp.d.ts +42 -0
  32. package/dist/forms/rlsddsp.js +6 -0
  33. package/dist/forms/rpci.d.ts +32 -0
  34. package/dist/forms/rpci.js +6 -0
  35. package/dist/forms/rpcppe.d.ts +32 -0
  36. package/dist/forms/rpcppe.js +6 -0
  37. package/dist/forms/rpcsp.d.ts +32 -0
  38. package/dist/forms/rpcsp.js +6 -0
  39. package/dist/forms/rrsp.d.ts +32 -0
  40. package/dist/forms/rrsp.js +6 -0
  41. package/dist/forms/rsmi.d.ts +32 -0
  42. package/dist/forms/rsmi.js +6 -0
  43. package/dist/forms/rsmp.d.ts +33 -0
  44. package/dist/forms/rsmp.js +6 -0
  45. package/dist/forms/rspi.d.ts +32 -0
  46. package/dist/forms/rspi.js +6 -0
  47. package/dist/forms/spc.d.ts +37 -0
  48. package/dist/forms/spc.js +6 -0
  49. package/dist/forms/splc.d.ts +41 -0
  50. package/dist/forms/splc.js +6 -0
  51. package/dist/forms/stock-card.d.ts +28 -0
  52. package/dist/forms/stock-card.js +6 -0
  53. package/dist/forms/wmr.d.ts +32 -0
  54. package/dist/forms/wmr.js +6 -0
  55. package/dist/gam/components/gam-report-workbench.d.ts +40 -0
  56. package/dist/gam/components/gam-report-workbench.js +2 -0
  57. package/dist/gam/components/grand-total-computation.d.ts +10 -0
  58. package/dist/gam/components/grand-total-computation.js +26 -0
  59. package/dist/gam/components/iar-preview.d.ts +30 -0
  60. package/dist/gam/components/iar-preview.js +150 -0
  61. package/dist/gam/components/ics-preview.d.ts +31 -0
  62. package/dist/gam/components/ics-preview.js +114 -0
  63. package/dist/gam/components/iirup-preview.d.ts +42 -0
  64. package/dist/gam/components/iirup-preview.js +237 -0
  65. package/dist/gam/components/itr-preview.d.ts +31 -0
  66. package/dist/gam/components/itr-preview.js +180 -0
  67. package/dist/gam/components/par-preview.d.ts +28 -0
  68. package/dist/gam/components/par-preview.js +95 -0
  69. package/dist/gam/components/ppelc-preview.d.ts +28 -0
  70. package/dist/gam/components/ppelc-preview.js +128 -0
  71. package/dist/gam/components/property-card-preview.d.ts +21 -0
  72. package/dist/gam/components/property-card-preview.js +117 -0
  73. package/dist/gam/components/ptr-preview.d.ts +36 -0
  74. package/dist/gam/components/ptr-preview.js +122 -0
  75. package/dist/gam/components/purchase-order-page-client.d.ts +66 -0
  76. package/dist/gam/components/purchase-order-page-client.js +179 -0
  77. package/dist/gam/components/reg-spi-preview.d.ts +28 -0
  78. package/dist/gam/components/reg-spi-preview.js +138 -0
  79. package/dist/gam/components/ris-form.d.ts +13 -0
  80. package/dist/gam/components/ris-form.js +20 -0
  81. package/dist/gam/components/ris-preview.d.ts +7 -0
  82. package/dist/gam/components/ris-preview.js +16 -0
  83. package/dist/gam/components/rlsddp-preview.d.ts +34 -0
  84. package/dist/gam/components/rlsddp-preview.js +251 -0
  85. package/dist/gam/components/rlsddsp-preview.d.ts +33 -0
  86. package/dist/gam/components/rlsddsp-preview.js +226 -0
  87. package/dist/gam/components/rpci-preview.d.ts +27 -0
  88. package/dist/gam/components/rpci-preview.js +123 -0
  89. package/dist/gam/components/rpcppe-preview.d.ts +28 -0
  90. package/dist/gam/components/rpcppe-preview.js +133 -0
  91. package/dist/gam/components/rpcsp-preview.d.ts +29 -0
  92. package/dist/gam/components/rpcsp-preview.js +81 -0
  93. package/dist/gam/components/rspi-preview.d.ts +23 -0
  94. package/dist/gam/components/rspi-preview.js +72 -0
  95. package/dist/gam/components/spc-preview.d.ts +23 -0
  96. package/dist/gam/components/spc-preview.js +149 -0
  97. package/dist/gam/components/splc-entry-form.d.ts +14 -0
  98. package/dist/gam/components/splc-entry-form.js +6 -0
  99. package/dist/gam/components/splc-preview.d.ts +27 -0
  100. package/dist/gam/components/splc-preview.js +192 -0
  101. package/dist/gam/components/stock-card-preview.d.ts +14 -0
  102. package/dist/gam/components/stock-card-preview.js +17 -0
  103. package/dist/gam/config/new-report-config.d.ts +1094 -0
  104. package/dist/gam/config/new-report-config.js +1478 -0
  105. package/dist/gam/purchase-order-flow.d.ts +146 -0
  106. package/dist/gam/purchase-order-flow.js +173 -0
  107. package/dist/gam/purchase-request/workflow.d.ts +19 -0
  108. package/dist/gam/purchase-request/workflow.js +45 -0
  109. package/dist/gam/types/ris-types.d.ts +37 -0
  110. package/dist/gam/types/ris-types.js +1 -0
  111. package/dist/gam/utils/export-ics-xlsx.d.ts +28 -0
  112. package/dist/gam/utils/export-ics-xlsx.js +273 -0
  113. package/dist/gam/utils/export-par-xlsx.d.ts +18 -0
  114. package/dist/gam/utils/export-par-xlsx.js +181 -0
  115. package/dist/gam/utils/export-preview-pdf.d.ts +13 -0
  116. package/dist/gam/utils/export-preview-pdf.js +270 -0
  117. package/dist/gam/utils/export-report-xlsx.d.ts +228 -0
  118. package/dist/gam/utils/export-report-xlsx.js +873 -0
  119. package/dist/gam/utils/line-totals.d.ts +6 -0
  120. package/dist/gam/utils/line-totals.js +18 -0
  121. package/dist/gam/utils/monetary-input.d.ts +6 -0
  122. package/dist/gam/utils/monetary-input.js +18 -0
  123. package/dist/gam/utils/print-element.d.ts +8 -0
  124. package/dist/gam/utils/print-element.js +157 -0
  125. package/dist/government-form.d.ts +16 -0
  126. package/dist/government-form.js +45 -0
  127. package/dist/index.d.ts +49 -0
  128. package/dist/index.js +50 -0
  129. package/dist/internal/components/configurable-form-layout.d.ts +20 -0
  130. package/dist/internal/components/configurable-form-layout.js +49 -0
  131. package/dist/internal/components/ui/badge.d.ts +7 -0
  132. package/dist/internal/components/ui/badge.js +34 -0
  133. package/dist/internal/components/ui/button.d.ts +10 -0
  134. package/dist/internal/components/ui/button.js +35 -0
  135. package/dist/internal/components/ui/calendar.d.ts +8 -0
  136. package/dist/internal/components/ui/calendar.js +77 -0
  137. package/dist/internal/components/ui/command.d.ts +19 -0
  138. package/dist/internal/components/ui/command.js +36 -0
  139. package/dist/internal/components/ui/date-input.d.ts +14 -0
  140. package/dist/internal/components/ui/date-input.js +33 -0
  141. package/dist/internal/components/ui/date-picker.d.ts +19 -0
  142. package/dist/internal/components/ui/date-picker.js +34 -0
  143. package/dist/internal/components/ui/dialog.d.ts +18 -0
  144. package/dist/internal/components/ui/dialog.js +38 -0
  145. package/dist/internal/components/ui/input-group.d.ts +18 -0
  146. package/dist/internal/components/ui/input-group.js +57 -0
  147. package/dist/internal/components/ui/input.d.ts +3 -0
  148. package/dist/internal/components/ui/input.js +12 -0
  149. package/dist/internal/components/ui/label.d.ts +3 -0
  150. package/dist/internal/components/ui/label.js +7 -0
  151. package/dist/internal/components/ui/popover.d.ts +9 -0
  152. package/dist/internal/components/ui/popover.js +23 -0
  153. package/dist/internal/components/ui/select.d.ts +17 -0
  154. package/dist/internal/components/ui/select.js +35 -0
  155. package/dist/internal/components/ui/switch.d.ts +5 -0
  156. package/dist/internal/components/ui/switch.js +8 -0
  157. package/dist/internal/components/ui/table.d.ts +10 -0
  158. package/dist/internal/components/ui/table.js +28 -0
  159. package/dist/internal/components/ui/tabs.d.ts +10 -0
  160. package/dist/internal/components/ui/tabs.js +29 -0
  161. package/dist/internal/components/ui/textarea.d.ts +3 -0
  162. package/dist/internal/components/ui/textarea.js +7 -0
  163. package/dist/internal/components/ui/tooltip.d.ts +6 -0
  164. package/dist/internal/components/ui/tooltip.js +17 -0
  165. package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.d.ts +112 -0
  166. package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.js +91 -0
  167. package/dist/internal/hooks/use-form-field-order.d.ts +7 -0
  168. package/dist/internal/hooks/use-form-field-order.js +43 -0
  169. package/dist/internal/lib/utils.d.ts +2 -0
  170. package/dist/internal/lib/utils.js +3 -0
  171. package/dist/inventory/components/inventory-item-form.d.ts +7 -0
  172. package/dist/inventory/components/inventory-item-form.js +5 -0
  173. package/dist/inventory/components/inventory-item-preview.d.ts +6 -0
  174. package/dist/inventory/components/inventory-item-preview.js +5 -0
  175. package/dist/inventory/iar.d.ts +4 -0
  176. package/dist/inventory/iar.js +4 -0
  177. package/dist/inventory/ics.d.ts +2 -0
  178. package/dist/inventory/ics.js +3 -0
  179. package/dist/inventory/iirup.d.ts +2 -0
  180. package/dist/inventory/iirup.js +3 -0
  181. package/dist/inventory/iirusp.d.ts +4 -0
  182. package/dist/inventory/iirusp.js +4 -0
  183. package/dist/inventory/index.d.ts +3 -0
  184. package/dist/inventory/index.js +4 -0
  185. package/dist/inventory/item.d.ts +3 -0
  186. package/dist/inventory/item.js +3 -0
  187. package/dist/inventory/itr.d.ts +4 -0
  188. package/dist/inventory/itr.js +4 -0
  189. package/dist/inventory/par.d.ts +2 -0
  190. package/dist/inventory/par.js +3 -0
  191. package/dist/inventory/po.d.ts +2 -0
  192. package/dist/inventory/po.js +2 -0
  193. package/dist/inventory/ppelc.d.ts +2 -0
  194. package/dist/inventory/ppelc.js +3 -0
  195. package/dist/inventory/pplc.d.ts +2 -0
  196. package/dist/inventory/pplc.js +4 -0
  197. package/dist/inventory/pr.d.ts +4 -0
  198. package/dist/inventory/pr.js +4 -0
  199. package/dist/inventory/property-card.d.ts +2 -0
  200. package/dist/inventory/property-card.js +3 -0
  201. package/dist/inventory/ptr.d.ts +2 -0
  202. package/dist/inventory/ptr.js +3 -0
  203. package/dist/inventory/regspi.d.ts +4 -0
  204. package/dist/inventory/regspi.js +4 -0
  205. package/dist/inventory/ris.d.ts +4 -0
  206. package/dist/inventory/ris.js +4 -0
  207. package/dist/inventory/rlsddp.d.ts +4 -0
  208. package/dist/inventory/rlsddp.js +4 -0
  209. package/dist/inventory/rlsddsp.d.ts +2 -0
  210. package/dist/inventory/rlsddsp.js +3 -0
  211. package/dist/inventory/rpci.d.ts +2 -0
  212. package/dist/inventory/rpci.js +3 -0
  213. package/dist/inventory/rpcppe.d.ts +2 -0
  214. package/dist/inventory/rpcppe.js +3 -0
  215. package/dist/inventory/rpcsp.d.ts +2 -0
  216. package/dist/inventory/rpcsp.js +3 -0
  217. package/dist/inventory/rrsp.d.ts +2 -0
  218. package/dist/inventory/rrsp.js +3 -0
  219. package/dist/inventory/rsmi.d.ts +4 -0
  220. package/dist/inventory/rsmi.js +4 -0
  221. package/dist/inventory/rsmp.d.ts +4 -0
  222. package/dist/inventory/rsmp.js +4 -0
  223. package/dist/inventory/rspi.d.ts +2 -0
  224. package/dist/inventory/rspi.js +3 -0
  225. package/dist/inventory/spc.d.ts +2 -0
  226. package/dist/inventory/spc.js +3 -0
  227. package/dist/inventory/splc.d.ts +3 -0
  228. package/dist/inventory/splc.js +4 -0
  229. package/dist/inventory/stock-card.d.ts +4 -0
  230. package/dist/inventory/stock-card.js +4 -0
  231. package/dist/inventory/types.d.ts +11 -0
  232. package/dist/inventory/types.js +1 -0
  233. package/dist/inventory/wmr.d.ts +4 -0
  234. package/dist/inventory/wmr.js +4 -0
  235. package/dist/lib/rpcsp-accountable-person.d.ts +1 -0
  236. package/dist/lib/rpcsp-accountable-person.js +10 -0
  237. package/dist/reports/iar/_components/create-form.d.ts +13 -0
  238. package/dist/reports/iar/_components/create-form.js +92 -0
  239. package/dist/reports/iar/_components/document-preview.d.ts +11 -0
  240. package/dist/reports/iar/_components/document-preview.js +131 -0
  241. package/dist/reports/iar/types.d.ts +97 -0
  242. package/dist/reports/iar/types.js +24 -0
  243. package/dist/reports/iirusp/_components/create-form.d.ts +17 -0
  244. package/dist/reports/iirusp/_components/create-form.js +118 -0
  245. package/dist/reports/iirusp/_components/document-preview.d.ts +8 -0
  246. package/dist/reports/iirusp/_components/document-preview.js +389 -0
  247. package/dist/reports/iirusp/types.d.ts +134 -0
  248. package/dist/reports/iirusp/types.js +29 -0
  249. package/dist/reports/iirusp/utils.d.ts +29 -0
  250. package/dist/reports/iirusp/utils.js +488 -0
  251. package/dist/reports/itr/_components/create-form.d.ts +28 -0
  252. package/dist/reports/itr/_components/create-form.js +90 -0
  253. package/dist/reports/itr/_components/document-preview.d.ts +6 -0
  254. package/dist/reports/itr/_components/document-preview.js +7 -0
  255. package/dist/reports/itr/types.d.ts +68 -0
  256. package/dist/reports/itr/types.js +27 -0
  257. package/dist/reports/itr/utils.d.ts +24 -0
  258. package/dist/reports/itr/utils.js +76 -0
  259. package/dist/reports/pr/_components/create-form.d.ts +16 -0
  260. package/dist/reports/pr/_components/create-form.js +52 -0
  261. package/dist/reports/pr/_components/document-preview.d.ts +7 -0
  262. package/dist/reports/pr/_components/document-preview.js +9 -0
  263. package/dist/reports/pr/types.d.ts +69 -0
  264. package/dist/reports/pr/types.js +1 -0
  265. package/dist/reports/pr/utils.d.ts +72 -0
  266. package/dist/reports/pr/utils.js +572 -0
  267. package/dist/reports/regspi/_components/create-form.d.ts +19 -0
  268. package/dist/reports/regspi/_components/create-form.js +33 -0
  269. package/dist/reports/regspi/_components/document-preview.d.ts +6 -0
  270. package/dist/reports/regspi/_components/document-preview.js +7 -0
  271. package/dist/reports/regspi/types.d.ts +29 -0
  272. package/dist/reports/regspi/types.js +24 -0
  273. package/dist/reports/regspi/utils.d.ts +48 -0
  274. package/dist/reports/regspi/utils.js +98 -0
  275. package/dist/reports/ris/_components/create-form.d.ts +36 -0
  276. package/dist/reports/ris/_components/create-form.js +149 -0
  277. package/dist/reports/ris/_components/document-preview.d.ts +8 -0
  278. package/dist/reports/ris/_components/document-preview.js +31 -0
  279. package/dist/reports/ris/types.d.ts +93 -0
  280. package/dist/reports/ris/types.js +1 -0
  281. package/dist/reports/rlsddp/_components/create-form.d.ts +11 -0
  282. package/dist/reports/rlsddp/_components/create-form.js +165 -0
  283. package/dist/reports/rlsddp/_components/document-preview.d.ts +8 -0
  284. package/dist/reports/rlsddp/_components/document-preview.js +15 -0
  285. package/dist/reports/rlsddp/types.d.ts +105 -0
  286. package/dist/reports/rlsddp/types.js +31 -0
  287. package/dist/reports/rrsp/components/rrsp-preview.d.ts +21 -0
  288. package/dist/reports/rrsp/components/rrsp-preview.js +155 -0
  289. package/dist/reports/rsmi/components/rsmi-create-form.d.ts +20 -0
  290. package/dist/reports/rsmi/components/rsmi-create-form.js +8 -0
  291. package/dist/reports/rsmi/components/rsmi-document-body.d.ts +15 -0
  292. package/dist/reports/rsmi/components/rsmi-document-body.js +12 -0
  293. package/dist/reports/rsmi/components/rsmi-types.d.ts +45 -0
  294. package/dist/reports/rsmi/components/rsmi-types.js +1 -0
  295. package/dist/reports/rsmi/components/rsmi-utils.d.ts +2 -0
  296. package/dist/reports/rsmi/components/rsmi-utils.js +18 -0
  297. package/dist/reports/rsmp/components/rsmp-create-modal.d.ts +5 -0
  298. package/dist/reports/rsmp/components/rsmp-create-modal.js +7 -0
  299. package/dist/reports/rsmp/components/rsmp-preview-modal.d.ts +11 -0
  300. package/dist/reports/rsmp/components/rsmp-preview-modal.js +47 -0
  301. package/dist/reports/rsmp/components/rsmp-types.d.ts +44 -0
  302. package/dist/reports/rsmp/components/rsmp-types.js +1 -0
  303. package/dist/reports/rsmp/components/rsmp-utils.d.ts +5 -0
  304. package/dist/reports/rsmp/components/rsmp-utils.js +41 -0
  305. package/dist/reports/rsmp/lib/rsmp-grouping.d.ts +14 -0
  306. package/dist/reports/rsmp/lib/rsmp-grouping.js +75 -0
  307. package/dist/reports/stock-card/_components/create-form.d.ts +13 -0
  308. package/dist/reports/stock-card/_components/create-form.js +39 -0
  309. package/dist/reports/stock-card/_components/document-preview.d.ts +7 -0
  310. package/dist/reports/stock-card/_components/document-preview.js +29 -0
  311. package/dist/reports/stock-card/types.d.ts +31 -0
  312. package/dist/reports/stock-card/types.js +1 -0
  313. package/dist/reports/stock-card/utils.d.ts +32 -0
  314. package/dist/reports/stock-card/utils.js +248 -0
  315. package/dist/reports/wmr/_components/create-form.d.ts +22 -0
  316. package/dist/reports/wmr/_components/create-form.js +61 -0
  317. package/dist/reports/wmr/_components/document-preview.d.ts +10 -0
  318. package/dist/reports/wmr/_components/document-preview.js +59 -0
  319. package/dist/reports/wmr/types.d.ts +45 -0
  320. package/dist/reports/wmr/types.js +1 -0
  321. package/dist/reports/wmr/utils.d.ts +32 -0
  322. package/dist/reports/wmr/utils.js +343 -0
  323. package/dist/styles.css +4492 -0
  324. package/extraction-manifest.json +620 -0
  325. package/package.json +197 -0
@@ -0,0 +1,572 @@
1
+ import * as XLSX from "xlsx-js-style";
2
+ export { getInventoryCategoryForPr, getPrSubtypeOptions, isPurchaseOrderEligiblePr, PR_OTHER_SUBTYPES, PR_REQUEST_TYPES, PR_SERVICE_SUBTYPES, requiresPrSubtype, shouldBypassPrForIar, } from "../../gam/purchase-request/workflow.js";
3
+ export const PR_OFFICE_SECTION_OPTIONS = [
4
+ "FAD - Personnel Section",
5
+ "FAD - General Services",
6
+ "FAD - Accounting Section",
7
+ "FAD - Property and Supply Section",
8
+ "FAD - Records Section",
9
+ "FAD - Cash Section",
10
+ "Special Production Division",
11
+ "Special Operation Division",
12
+ "Planning Division",
13
+ "Office Director",
14
+ ];
15
+ export function resolvePrOfficeSectionDefault(user, sessionOfficeId, offices) {
16
+ const assignedOfficeId = user ? (user.officeId ?? null) : (sessionOfficeId ?? null);
17
+ const assignedOffice = assignedOfficeId
18
+ ? offices.find(office => office.id === assignedOfficeId)
19
+ : undefined;
20
+ const officeName = assignedOffice?.name.trim();
21
+ if (officeName)
22
+ return officeName;
23
+ const assignedDivisionId = user?.divisionId ?? assignedOffice?.divisionId ?? null;
24
+ const divisionName = assignedDivisionId
25
+ ? offices.find(office => office.divisionId === assignedDivisionId)?.divisionName?.trim()
26
+ : undefined;
27
+ return divisionName || "";
28
+ }
29
+ export function getPrOfficeSectionOptions(currentValue) {
30
+ const options = [...PR_OFFICE_SECTION_OPTIONS];
31
+ const normalizedValue = currentValue?.trim();
32
+ if (normalizedValue && !new Set(options).has(normalizedValue))
33
+ options.push(normalizedValue);
34
+ return options;
35
+ }
36
+ export function shouldApplyPrOfficeSectionDefault(isEditingRecord, hasUserEdited, currentValue, assignedDefault) {
37
+ return !isEditingRecord && !hasUserEdited && !currentValue.trim() && Boolean(assignedDefault.trim());
38
+ }
39
+ export function generatePrNo(sequence = 1) {
40
+ const date = new Date();
41
+ const year = date.getFullYear();
42
+ const month = String(date.getMonth() + 1).padStart(2, "0");
43
+ return `PR-${year}-${month}(${String(sequence).padStart(4, "0")})`;
44
+ }
45
+ export function formatCurrency(value) {
46
+ return new Intl.NumberFormat("en-PH", { style: "currency", currency: "PHP" }).format(value);
47
+ }
48
+ export function formatPrDate(value) {
49
+ return new Date(value).toLocaleDateString("en-PH", {
50
+ year: "numeric",
51
+ month: "long",
52
+ day: "2-digit",
53
+ });
54
+ }
55
+ export function formatDateTime(value) {
56
+ return new Date(value).toLocaleString("en-PH", {
57
+ year: "numeric",
58
+ month: "short",
59
+ day: "2-digit",
60
+ hour: "2-digit",
61
+ minute: "2-digit",
62
+ });
63
+ }
64
+ export function getItemTotal(item) {
65
+ return (Number(item.quantity) || 0) * (Number(item.unitCost) || 0);
66
+ }
67
+ export function getRecordTotal(record) {
68
+ return record.items.reduce((sum, item) => sum + getItemTotal(item), 0);
69
+ }
70
+ function normalizeInventoryStockNo(value) {
71
+ return value.trim().toUpperCase();
72
+ }
73
+ export function getSelectablePrInventoryItems(inventoryItems, inventoryCategory, currentItems, editingItemId = null) {
74
+ if (!inventoryCategory)
75
+ return [];
76
+ const usedItemIds = new Set();
77
+ const usedStockNos = new Set();
78
+ for (const item of currentItems) {
79
+ if (item.id === editingItemId)
80
+ continue;
81
+ if (item.itemId !== null && item.itemId !== undefined)
82
+ usedItemIds.add(item.itemId);
83
+ const stockNo = normalizeInventoryStockNo(item.stockNo);
84
+ if (stockNo)
85
+ usedStockNos.add(stockNo);
86
+ }
87
+ return inventoryItems.filter(item => {
88
+ if (item.category !== inventoryCategory)
89
+ return false;
90
+ if (item.stockStatus !== "In Stock" &&
91
+ item.stockStatus !== "Low Stock" &&
92
+ item.stockStatus !== "Out of Stock") {
93
+ return false;
94
+ }
95
+ if (item.itemId !== null && item.itemId !== undefined && usedItemIds.has(item.itemId)) {
96
+ return false;
97
+ }
98
+ return !usedStockNos.has(normalizeInventoryStockNo(item.stockNo));
99
+ });
100
+ }
101
+ export function buildPrItemFromDraft(currentItems, draft, editingItemId = null) {
102
+ if (draft.description.trim().length === 0) {
103
+ return { item: null, error: "Item description is required." };
104
+ }
105
+ const quantity = Number(draft.quantity);
106
+ if (!Number.isFinite(quantity) || quantity <= 0) {
107
+ return { item: null, error: "Item quantity must be greater than zero." };
108
+ }
109
+ const unitCost = Number(draft.unitCost);
110
+ if (!Number.isFinite(unitCost) || unitCost <= 0) {
111
+ return { item: null, error: "Unit cost must be greater than zero." };
112
+ }
113
+ const normalizedDraftStockNo = normalizeInventoryStockNo(draft.stockNo);
114
+ const isDuplicateInventoryItem = currentItems.some(item => {
115
+ if (item.id === editingItemId)
116
+ return false;
117
+ if (draft.itemId !== null &&
118
+ draft.itemId !== undefined &&
119
+ item.itemId === draft.itemId) {
120
+ return true;
121
+ }
122
+ return (normalizedDraftStockNo.length > 0 &&
123
+ normalizeInventoryStockNo(item.stockNo) === normalizedDraftStockNo);
124
+ });
125
+ if (isDuplicateInventoryItem) {
126
+ return {
127
+ item: null,
128
+ error: "This inventory item is already added to the Purchase Request.",
129
+ };
130
+ }
131
+ if (editingItemId && !currentItems.some(item => item.id === editingItemId)) {
132
+ return { item: null, error: "The item being edited is no longer in the Purchase Request." };
133
+ }
134
+ let sequence = currentItems.length + 1;
135
+ let generatedId = `ITEM-${String(sequence).padStart(3, "0")}`;
136
+ while (currentItems.some(item => item.id === generatedId)) {
137
+ sequence += 1;
138
+ generatedId = `ITEM-${String(sequence).padStart(3, "0")}`;
139
+ }
140
+ return {
141
+ item: {
142
+ id: editingItemId ?? generatedId,
143
+ itemId: draft.itemId ?? null,
144
+ stockNo: draft.stockNo.trim(),
145
+ unit: draft.unit.trim(),
146
+ description: draft.description.trim(),
147
+ quantity: draft.quantity,
148
+ unitCost: draft.unitCost,
149
+ },
150
+ error: null,
151
+ };
152
+ }
153
+ export function resolvePrWorkflowSignatories(summary, requestor) {
154
+ if (!summary)
155
+ return requestor ? { requestedBy: requestor } : {};
156
+ const [approvedByStep, fundsAvailabilityStep] = summary.steps;
157
+ return {
158
+ requestedBy: {
159
+ name: requestor?.name ?? summary.submittedByName ?? undefined,
160
+ designation: requestor?.designation ??
161
+ summary.submittedByDesignationName ??
162
+ summary.submittedByOfficeName ??
163
+ undefined,
164
+ },
165
+ approvedBy: approvedByStep?.status === "Approved"
166
+ ? {
167
+ name: approvedByStep.approverUserName ?? undefined,
168
+ designation: approvedByStep.approverDesignationName ??
169
+ approvedByStep.approverOfficeName ??
170
+ undefined,
171
+ }
172
+ : undefined,
173
+ fundsAvailability: fundsAvailabilityStep?.status === "Approved"
174
+ ? {
175
+ name: fundsAvailabilityStep.approverUserName ?? undefined,
176
+ designation: fundsAvailabilityStep.approverDesignationName ??
177
+ fundsAvailabilityStep.approverOfficeName ??
178
+ undefined,
179
+ }
180
+ : undefined,
181
+ };
182
+ }
183
+ export function buildPurchaseRequestSheetModel(record, signatories) {
184
+ const items = record.items.slice(0, 12);
185
+ const officeSection = record.officeSection || record.officeName || record.officeId || "-";
186
+ const rows = [
187
+ createRow([
188
+ cell("PURCHASE REQUEST", "title"),
189
+ cell("", "title"),
190
+ cell("", "title"),
191
+ cell("", "title"),
192
+ cell("", "title"),
193
+ cell("", "title"),
194
+ ]),
195
+ createRow([
196
+ cell(`Entity Name: ${record.entityName || "-"}`, "meta"),
197
+ cell("", "meta"),
198
+ cell("", "meta"),
199
+ cell("", "meta"),
200
+ cell(`Fund Cluster: ${record.fundCluster || "-"}`, "meta"),
201
+ cell("", "meta"),
202
+ ]),
203
+ createRow([
204
+ cell(`Office/Section: ${officeSection}`, "meta"),
205
+ cell("", "meta"),
206
+ cell(`PR No: ${record.prNo || "-"}`, "meta"),
207
+ cell("", "meta"),
208
+ cell(`Date: ${formatPrDate(record.date || record.createdAt)}`, "meta"),
209
+ cell("", "meta"),
210
+ ]),
211
+ createRow([
212
+ cell(`Responsibility Center Code: ${record.responsibilityCenterCode || "-"}`, "meta"),
213
+ cell("", "meta"),
214
+ cell("", "meta"),
215
+ cell("", "meta"),
216
+ cell("", "meta"),
217
+ cell("", "meta"),
218
+ ]),
219
+ createRow([
220
+ cell("", "blank"),
221
+ cell("", "blank"),
222
+ cell("", "blank"),
223
+ cell("", "blank"),
224
+ cell("", "blank"),
225
+ cell("", "blank"),
226
+ ]),
227
+ createRow([
228
+ cell("Stock/Property No.", "header"),
229
+ cell("Unit", "header"),
230
+ cell("Item Description", "header"),
231
+ cell("Quantity", "header"),
232
+ cell("Unit Cost", "header"),
233
+ cell("Total Cost", "header"),
234
+ ]),
235
+ ];
236
+ for (const item of items) {
237
+ rows.push(createRow([
238
+ cell(item.stockNo || "", "item-text"),
239
+ cell(item.unit || "", "item-center"),
240
+ cell(item.description || "", "item-text"),
241
+ cell(item.quantity || "", "item-center"),
242
+ cell(formatCurrency(Number(item.unitCost) || 0), "item-number"),
243
+ cell(formatCurrency(getItemTotal(item)), "item-number"),
244
+ ]));
245
+ }
246
+ const minimumBodyRows = 12;
247
+ const blankRowsAfterItems = Math.max(0, minimumBodyRows - items.length - 1);
248
+ for (let index = 0; index < blankRowsAfterItems; index += 1) {
249
+ rows.push(createRow([
250
+ cell("", "item-text"),
251
+ cell("", "item-center"),
252
+ cell("", "item-text"),
253
+ cell("", "item-center"),
254
+ cell("", "item-number"),
255
+ cell("", "item-number"),
256
+ ]));
257
+ }
258
+ const nothingRowIndex = rows.length;
259
+ rows.push(createRow([
260
+ cell("", "item-text"),
261
+ cell("", "item-center"),
262
+ cell("***nothing follows***", "nothing"),
263
+ cell("", "item-center"),
264
+ cell("", "item-number"),
265
+ cell("", "item-number"),
266
+ ]));
267
+ const totalAmountRowIndex = rows.length;
268
+ rows.push(createRow([
269
+ cell("Total Amount", "total-label"),
270
+ cell("", "total-label"),
271
+ cell("", "total-label"),
272
+ cell("", "total-label"),
273
+ cell("", "total-label"),
274
+ cell(formatCurrency(getRecordTotal(record)), "total-value"),
275
+ ]));
276
+ const purposeLabelRowIndex = rows.length + 1;
277
+ rows.push(createRow([
278
+ cell("", "item-text"),
279
+ cell("", "item-center"),
280
+ cell("", "item-text"),
281
+ cell("", "item-center"),
282
+ cell("", "item-number"),
283
+ cell("", "item-number"),
284
+ ]));
285
+ rows.push(createRow([
286
+ cell("Purpose:", "purpose-label"),
287
+ cell(record.purpose || "-", "purpose-value"),
288
+ cell("", "purpose-value"),
289
+ cell("", "purpose-value"),
290
+ cell("", "purpose-value"),
291
+ cell("", "purpose-value"),
292
+ ]));
293
+ const requestedByRowIndex = rows.length + 1;
294
+ rows.push(createRow([
295
+ cell("", "purpose-value"),
296
+ cell("", "purpose-value"),
297
+ cell("", "purpose-value"),
298
+ cell("", "purpose-value"),
299
+ cell("", "purpose-value"),
300
+ cell("", "purpose-value"),
301
+ ]));
302
+ rows.push(createRow([
303
+ cell("Signature", "signature-label"),
304
+ cell("Requested by:", "signature-heading"),
305
+ cell("", "signature-heading"),
306
+ cell("Approved by:", "signature-heading"),
307
+ cell("", "signature-heading"),
308
+ cell("", "signature-heading"),
309
+ ]), createRow([
310
+ cell("Printed Name", "signature-label"),
311
+ cell(signatories?.requestedBy?.name ?? "", "signature-line"),
312
+ cell("", "signature-line"),
313
+ cell(signatories?.approvedBy?.name ?? "", "signature-line"),
314
+ cell("", "signature-line"),
315
+ cell("", "signature-line"),
316
+ ]), createRow([
317
+ cell("Designation", "signature-label"),
318
+ cell(signatories?.requestedBy?.designation ?? "", "designation"),
319
+ cell("", "designation"),
320
+ cell(signatories?.approvedBy?.designation ?? "", "designation"),
321
+ cell("", "designation"),
322
+ cell("", "designation"),
323
+ ]), createRow([
324
+ cell("Signature", "signature-label"),
325
+ cell("Certification as to Funds Availability", "signature-heading"),
326
+ cell("", "signature-heading"),
327
+ cell("", "signature-heading"),
328
+ cell("", "signature-heading"),
329
+ cell("", "signature-heading"),
330
+ ]), createRow([
331
+ cell("Printed Name", "signature-label"),
332
+ cell(signatories?.fundsAvailability?.name ?? "", "signature-line"),
333
+ cell("", "signature-line"),
334
+ cell("", "signature-line"),
335
+ cell("", "signature-line"),
336
+ cell("", "signature-line"),
337
+ ]), createRow([
338
+ cell("Designation", "signature-label"),
339
+ cell(signatories?.fundsAvailability?.designation ?? "", "designation"),
340
+ cell("", "designation"),
341
+ cell("", "designation"),
342
+ cell("", "designation"),
343
+ cell("", "designation"),
344
+ ]));
345
+ const merges = [
346
+ range(0, 0, 0, 5),
347
+ range(1, 0, 1, 3),
348
+ range(1, 4, 1, 5),
349
+ range(2, 0, 2, 1),
350
+ range(2, 2, 2, 3),
351
+ range(2, 4, 2, 5),
352
+ range(3, 0, 3, 5),
353
+ range(totalAmountRowIndex, 0, totalAmountRowIndex, 4),
354
+ range(purposeLabelRowIndex, 1, purposeLabelRowIndex, 5),
355
+ range(purposeLabelRowIndex + 1, 0, purposeLabelRowIndex + 1, 5),
356
+ range(requestedByRowIndex, 1, requestedByRowIndex, 2),
357
+ range(requestedByRowIndex, 3, requestedByRowIndex, 5),
358
+ range(requestedByRowIndex + 1, 1, requestedByRowIndex + 1, 2),
359
+ range(requestedByRowIndex + 1, 3, requestedByRowIndex + 1, 5),
360
+ range(requestedByRowIndex + 2, 1, requestedByRowIndex + 2, 2),
361
+ range(requestedByRowIndex + 2, 3, requestedByRowIndex + 2, 5),
362
+ range(requestedByRowIndex + 3, 1, requestedByRowIndex + 3, 5),
363
+ range(requestedByRowIndex + 4, 1, requestedByRowIndex + 4, 5),
364
+ range(requestedByRowIndex + 5, 1, requestedByRowIndex + 5, 5),
365
+ ];
366
+ return {
367
+ rows,
368
+ merges,
369
+ cols: [{ wch: 22 }, { wch: 10 }, { wch: 30 }, { wch: 12 }, { wch: 14 }, { wch: 16 }],
370
+ rowHeights: rows.map((_row, index) => {
371
+ if (index === 0)
372
+ return { hpt: 24 };
373
+ if (index === nothingRowIndex)
374
+ return { hpt: 22 };
375
+ if (index === totalAmountRowIndex)
376
+ return { hpt: 24 };
377
+ if (index === purposeLabelRowIndex)
378
+ return { hpt: 30 };
379
+ if (index === purposeLabelRowIndex + 1)
380
+ return { hpt: 26 };
381
+ if (index >= requestedByRowIndex && index <= requestedByRowIndex + 5)
382
+ return { hpt: 24 };
383
+ return { hpt: 20 };
384
+ }),
385
+ };
386
+ }
387
+ export function buildPurchaseRequestWorksheetData(record, signatories) {
388
+ return buildPurchaseRequestSheetModel(record, signatories).rows.map(row => row.map(cellValue => cellValue.value));
389
+ }
390
+ export function exportPurchaseRequestXlsx(record, signatories) {
391
+ const model = buildPurchaseRequestSheetModel(record, signatories);
392
+ const sheet = XLSX.utils.aoa_to_sheet(buildPurchaseRequestWorksheetData(record, signatories));
393
+ sheet["!cols"] = model.cols;
394
+ sheet["!rows"] = model.rowHeights;
395
+ sheet["!merges"] = model.merges;
396
+ for (let rowIndex = 0; rowIndex < model.rows.length; rowIndex += 1) {
397
+ for (let columnIndex = 0; columnIndex < model.rows[rowIndex].length; columnIndex += 1) {
398
+ const address = XLSX.utils.encode_cell({ r: rowIndex, c: columnIndex });
399
+ const worksheetCell = sheet[address];
400
+ if (!worksheetCell)
401
+ continue;
402
+ worksheetCell.s = getXlsxStyle(model.rows[rowIndex][columnIndex]);
403
+ }
404
+ }
405
+ const workbook = XLSX.utils.book_new();
406
+ XLSX.utils.book_append_sheet(workbook, sheet, "Purchase Request");
407
+ const dateSuffix = new Date().toISOString().slice(0, 10);
408
+ const safePrNo = record.prNo.replace(/[^a-zA-Z0-9-_]/g, "_");
409
+ XLSX.writeFile(workbook, `${safePrNo || "purchase-request"}-${dateSuffix}.xlsx`);
410
+ }
411
+ export function exportPurchaseRequestCsv(record) {
412
+ const csv = buildPurchaseRequestCsv(record);
413
+ const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });
414
+ const url = URL.createObjectURL(blob);
415
+ const anchor = document.createElement("a");
416
+ const dateSuffix = new Date().toISOString().slice(0, 10);
417
+ const safePrNo = record.prNo.replace(/[^a-zA-Z0-9-_]/g, "_");
418
+ anchor.href = url;
419
+ anchor.download = `${safePrNo || "purchase-request"}-${dateSuffix}.csv`;
420
+ document.body.appendChild(anchor);
421
+ anchor.click();
422
+ document.body.removeChild(anchor);
423
+ URL.revokeObjectURL(url);
424
+ }
425
+ export function buildPurchaseRequestCsv(record) {
426
+ const sheet = XLSX.utils.aoa_to_sheet(buildPurchaseRequestWorksheetData(record));
427
+ return XLSX.utils.sheet_to_csv(sheet);
428
+ }
429
+ function createRow(cells) {
430
+ return cells;
431
+ }
432
+ function cell(value, kind) {
433
+ return { value, kind };
434
+ }
435
+ function range(sRow, sCol, eRow, eCol) {
436
+ return { s: { r: sRow, c: sCol }, e: { r: eRow, c: eCol } };
437
+ }
438
+ function getXlsxStyle(cellValue) {
439
+ const base = {
440
+ font: { name: "Times New Roman", sz: 11 },
441
+ border: fullBorder(),
442
+ fill: { patternType: "solid", fgColor: { rgb: "FFFFFF" } },
443
+ alignment: { vertical: "center", wrapText: true },
444
+ };
445
+ switch (cellValue.kind) {
446
+ case "title":
447
+ return {
448
+ ...base,
449
+ font: { name: "Times New Roman", sz: 14, bold: true },
450
+ alignment: { horizontal: "center", vertical: "center" },
451
+ border: noBorder(),
452
+ };
453
+ case "meta":
454
+ return {
455
+ ...base,
456
+ font: { ...base.font, bold: true },
457
+ };
458
+ case "header":
459
+ return {
460
+ ...base,
461
+ font: { ...base.font, bold: true },
462
+ alignment: { horizontal: "center", vertical: "center", wrapText: true },
463
+ };
464
+ case "item-center":
465
+ return {
466
+ ...base,
467
+ alignment: { horizontal: "center", vertical: "center" },
468
+ };
469
+ case "item-number":
470
+ case "total-value":
471
+ return {
472
+ ...base,
473
+ font: cellValue.kind === "total-value" ? { ...base.font, bold: true } : base.font,
474
+ alignment: { horizontal: "right", vertical: "center" },
475
+ };
476
+ case "nothing":
477
+ return {
478
+ ...base,
479
+ font: { ...base.font, italic: true },
480
+ alignment: { horizontal: "center", vertical: "center" },
481
+ };
482
+ case "purpose-label":
483
+ case "signature-label":
484
+ case "signature-heading":
485
+ case "designation":
486
+ case "total-label":
487
+ return {
488
+ ...base,
489
+ font: { ...base.font, bold: true },
490
+ alignment: {
491
+ horizontal: cellValue.kind === "designation"
492
+ ? "center"
493
+ : cellValue.kind === "total-label"
494
+ ? "left"
495
+ : "left",
496
+ vertical: "center",
497
+ wrapText: true,
498
+ },
499
+ };
500
+ case "signature-line":
501
+ return {
502
+ ...base,
503
+ alignment: { horizontal: "center", vertical: "center" },
504
+ };
505
+ case "blank":
506
+ return {
507
+ ...base,
508
+ };
509
+ default:
510
+ return base;
511
+ }
512
+ }
513
+ function fullBorder() {
514
+ return {
515
+ top: { style: "thin", color: { rgb: "000000" } },
516
+ bottom: { style: "thin", color: { rgb: "000000" } },
517
+ left: { style: "thin", color: { rgb: "000000" } },
518
+ right: { style: "thin", color: { rgb: "000000" } },
519
+ };
520
+ }
521
+ function noBorder() {
522
+ return {};
523
+ }
524
+ export function getExcelPreviewCellClassName(kind) {
525
+ switch (kind) {
526
+ case "title":
527
+ return "border border-slate-400 bg-white text-center font-bold";
528
+ case "meta":
529
+ return "border border-slate-400 bg-white font-semibold";
530
+ case "header":
531
+ return "border border-slate-500 bg-slate-100 text-center font-semibold";
532
+ case "item-center":
533
+ return "border border-slate-300 bg-white text-center";
534
+ case "item-number":
535
+ case "total-value":
536
+ return "border border-slate-300 bg-white text-right";
537
+ case "nothing":
538
+ return "border border-slate-300 bg-white text-center italic text-slate-500";
539
+ case "purpose-label":
540
+ case "signature-label":
541
+ case "signature-heading":
542
+ case "designation":
543
+ case "total-label":
544
+ return "border border-slate-400 bg-white font-semibold";
545
+ case "signature-line":
546
+ return "border border-slate-300 bg-white";
547
+ default:
548
+ return "border border-slate-300 bg-white";
549
+ }
550
+ }
551
+ export const EMPTY_BASIC_FORM = {
552
+ purpose: "",
553
+ entityName: "",
554
+ fundCluster: "",
555
+ fundSource: "",
556
+ fundType: "",
557
+ officeId: undefined,
558
+ officeSection: "",
559
+ requestedByDesignation: "Requestor",
560
+ requestType: "",
561
+ requestSubtype: "",
562
+ responsibilityCenterCode: "",
563
+ date: new Date().toISOString().slice(0, 10),
564
+ };
565
+ export const EMPTY_ITEM_DRAFT = {
566
+ registrationKey: null,
567
+ stockNo: "",
568
+ unit: "",
569
+ description: "",
570
+ quantity: "1",
571
+ unitCost: "",
572
+ };
@@ -0,0 +1,19 @@
1
+ import { type BasicForm, type EntryRow } from "../types.js";
2
+ type Props = {
3
+ activeTab: string;
4
+ onTabChange: (tab: string) => void;
5
+ basicForm: BasicForm;
6
+ onBasicFormChange: (update: Partial<BasicForm>) => void;
7
+ entries: EntryRow[];
8
+ entryDraft: Omit<EntryRow, "id">;
9
+ onEntryDraftChange: (update: Partial<Omit<EntryRow, "id">>) => void;
10
+ editingEntryId: string | null;
11
+ onSaveEntry: () => void;
12
+ onEditEntry: (entry: EntryRow) => void;
13
+ onCancelEntryEdit: () => void;
14
+ onRemoveEntry: (id: string) => void;
15
+ modalMode: "create" | "view" | "edit";
16
+ regSpiNo?: string;
17
+ };
18
+ export declare function CreateForm({ activeTab, onTabChange, basicForm, onBasicFormChange, entries, entryDraft, onEntryDraftChange, editingEntryId, onSaveEntry, onEditEntry, onCancelEntryEdit, onRemoveEntry, regSpiNo, }: Props): import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ConfigurableFormLayout, } from "../../../internal/components/configurable-form-layout.js";
4
+ import { DateInput } from "../../../internal/components/ui/date-input.js";
5
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../internal/components/ui/tabs.js";
6
+ import { fmtDate, fmtQtyShort } from "../utils.js";
7
+ export function CreateForm({ activeTab, onTabChange, basicForm, onBasicFormChange, entries, entryDraft, onEntryDraftChange, editingEntryId, onSaveEntry, onEditEntry, onCancelEntryEdit, onRemoveEntry, regSpiNo, }) {
8
+ const inputCls = "w-full rounded-md border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground/70";
9
+ const inputSmCls = "w-full rounded-md border bg-background px-3 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/70";
10
+ const fields = [
11
+ {
12
+ id: "entityName",
13
+ label: "Entity Name *",
14
+ render: () => (_jsx("input", { value: basicForm.entityName, onChange: e => onBasicFormChange({ entityName: e.target.value }), placeholder: "Entity Name", className: inputCls })),
15
+ },
16
+ {
17
+ id: "fundCluster",
18
+ label: "Fund Cluster *",
19
+ render: () => (_jsx("input", { value: basicForm.fundCluster, onChange: e => onBasicFormChange({ fundCluster: e.target.value }), placeholder: "Fund Cluster", className: inputCls })),
20
+ },
21
+ {
22
+ id: "semiExpendableProperty",
23
+ label: "Semi-Expendable Property",
24
+ render: () => (_jsx("input", { value: basicForm.semiExpendableProperty, onChange: e => onBasicFormChange({ semiExpendableProperty: e.target.value }), placeholder: "Semi-Expendable Property", className: inputCls })),
25
+ },
26
+ {
27
+ id: "sheetNumber",
28
+ label: "Sheet Number",
29
+ render: () => (_jsx("input", { value: basicForm.sheetNumber, onChange: e => onBasicFormChange({ sheetNumber: e.target.value }), placeholder: "Sheet Number", className: inputCls })),
30
+ },
31
+ ];
32
+ return (_jsxs(Tabs, { value: activeTab, onValueChange: onTabChange, children: [_jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [_jsx(TabsTrigger, { value: "basic", children: "Basic Info" }), _jsx(TabsTrigger, { value: "entries", children: "Entries" })] }), _jsx(TabsContent, { value: "basic", className: "mt-4", children: _jsx(ConfigurableFormLayout, { formKey: "regspi-basic-info", fields: fields, header: _jsxs("div", { className: "rounded-md border border-indigo-200 bg-indigo-50 p-3 dark:border-indigo-900/70 dark:bg-indigo-500/10", children: [_jsx("p", { className: "text-muted-foreground text-xs font-medium", children: "RegSPI Number" }), _jsx("p", { className: "text-foreground font-mono text-sm", children: regSpiNo ?? "Generating…" })] }) }) }), _jsxs(TabsContent, { value: "entries", className: "mt-4 space-y-3", children: [_jsx("div", { className: "overflow-x-auto rounded-md border", children: _jsxs("table", { className: "min-w-full border-collapse text-xs", children: [_jsx("thead", { className: "bg-muted/60 text-muted-foreground", children: _jsxs("tr", { children: [_jsx("th", { className: "border p-1 text-left", children: "Date" }), _jsx("th", { className: "border p-1 text-left", children: "ICS/RRSP No." }), _jsx("th", { className: "border p-1 text-left", children: "Semi-Exp. Property No." }), _jsx("th", { className: "border p-1 text-left", children: "Item Desc." }), _jsx("th", { className: "border p-1 text-center", children: "Est. Useful Life" }), _jsx("th", { className: "border p-1 text-center", children: "Issued" }), _jsx("th", { className: "border p-1 text-center", children: "Returned" }), _jsx("th", { className: "border p-1 text-center", children: "Reissued" }), _jsx("th", { className: "border p-1 text-center", children: "Disposed" }), _jsx("th", { className: "border p-1 text-center", children: "Balance" }), _jsx("th", { className: "border p-1 text-left", children: "Action" })] }) }), _jsxs("tbody", { children: [entries.map(entry => (_jsxs("tr", { children: [_jsx("td", { className: "border p-1", children: fmtDate(entry.entryDate) }), _jsx("td", { className: "border p-1", children: entry.iicRrspNo }), _jsx("td", { className: "border p-1", children: entry.semiExpendablePropertyNo }), _jsx("td", { className: "border p-1", children: entry.itemDescription }), _jsx("td", { className: "border p-1 text-center", children: entry.estimatedUsefulLife }), _jsx("td", { className: "border p-1 text-center", children: fmtQtyShort(entry.issuedQty) }), _jsx("td", { className: "border p-1 text-center", children: fmtQtyShort(entry.returnedQty) }), _jsx("td", { className: "border p-1 text-center", children: fmtQtyShort(entry.reissuedQty) }), _jsx("td", { className: "border p-1 text-center", children: fmtQtyShort(entry.disposedQty) }), _jsx("td", { className: "border p-1 text-center", children: fmtQtyShort(entry.balance) }), _jsx("td", { className: "border p-1", children: _jsxs("div", { className: "flex gap-1", children: [_jsx("button", { type: "button", onClick: () => onEditEntry(entry), className: "rounded border px-2 py-0.5 text-xs", children: "Edit" }), _jsx("button", { type: "button", onClick: () => onRemoveEntry(entry.id), className: "rounded border px-2 py-0.5 text-xs", children: "Remove" })] }) })] }, entry.id))), entries.length === 0 && (_jsx("tr", { children: _jsx("td", { className: "text-muted-foreground border p-3 text-center", colSpan: 11, children: "No entries added yet." }) }))] })] }) }), _jsxs("div", { className: "bg-card text-card-foreground space-y-2 rounded-md border p-3", children: [_jsx("p", { className: "text-foreground text-xs font-semibold", children: editingEntryId ? "Edit Entry Row" : "Add Entry Row" }), _jsxs("div", { className: "grid gap-2 md:grid-cols-3", children: [_jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Date" }), _jsx(DateInput, { value: entryDraft.entryDate, onValueChange: entryDate => onEntryDraftChange({ entryDate }), className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Reference" }), _jsx("input", { value: entryDraft.reference, onChange: e => onEntryDraftChange({ reference: e.target.value }), placeholder: "Reference", className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "IIC / RRSP No." }), _jsx("input", { value: entryDraft.iicRrspNo, onChange: e => onEntryDraftChange({ iicRrspNo: e.target.value }), placeholder: "IIC / RRSP No.", className: inputSmCls })] })] }), _jsxs("div", { className: "grid gap-2 md:grid-cols-3", children: [_jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Semi-Exp. Property No." }), _jsx("input", { value: entryDraft.semiExpendablePropertyNo, onChange: e => onEntryDraftChange({ semiExpendablePropertyNo: e.target.value }), placeholder: "Property No.", className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Item Description" }), _jsx("input", { value: entryDraft.itemDescription, onChange: e => onEntryDraftChange({ itemDescription: e.target.value }), placeholder: "Item Description", className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Est. Useful Life" }), _jsx("input", { value: entryDraft.estimatedUsefulLife, onChange: e => onEntryDraftChange({ estimatedUsefulLife: e.target.value }), placeholder: "e.g. 3 years", className: inputSmCls })] })] }), _jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [_jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Issued Qty." }), _jsx("input", { type: "number", min: 0, value: entryDraft.issuedQty, onChange: e => onEntryDraftChange({ issuedQty: e.target.value }), className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Issued Office / Officer" }), _jsx("input", { value: entryDraft.issuedOfficeOfficer, onChange: e => onEntryDraftChange({ issuedOfficeOfficer: e.target.value }), placeholder: "Office / Officer", className: inputSmCls })] })] }), _jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [_jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Returned Qty." }), _jsx("input", { type: "number", min: 0, value: entryDraft.returnedQty, onChange: e => onEntryDraftChange({ returnedQty: e.target.value }), className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Returned Office / Officer" }), _jsx("input", { value: entryDraft.returnedOfficeOfficer, onChange: e => onEntryDraftChange({ returnedOfficeOfficer: e.target.value }), placeholder: "Office / Officer", className: inputSmCls })] })] }), _jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [_jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Reissued Qty." }), _jsx("input", { type: "number", min: 0, value: entryDraft.reissuedQty, onChange: e => onEntryDraftChange({ reissuedQty: e.target.value }), className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Reissued Office / Officer" }), _jsx("input", { value: entryDraft.reissuedOfficeOfficer, onChange: e => onEntryDraftChange({ reissuedOfficeOfficer: e.target.value }), placeholder: "Office / Officer", className: inputSmCls })] })] }), _jsxs("div", { className: "grid gap-2 md:grid-cols-4", children: [_jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Disposed (Qty.)" }), _jsx("input", { type: "number", min: 0, value: entryDraft.disposedQty, onChange: e => onEntryDraftChange({ disposedQty: e.target.value }), className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Balance" }), _jsx("input", { type: "number", min: 0, value: entryDraft.balance, onChange: e => onEntryDraftChange({ balance: e.target.value }), className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Amount" }), _jsx("input", { type: "number", min: 0, value: entryDraft.amount, onChange: e => onEntryDraftChange({ amount: e.target.value }), className: inputSmCls })] }), _jsxs("div", { children: [_jsx("label", { className: "text-muted-foreground mb-0.5 block text-xs", children: "Remarks" }), _jsx("input", { value: entryDraft.remarks, onChange: e => onEntryDraftChange({ remarks: e.target.value }), placeholder: "Remarks", className: inputSmCls })] })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx("button", { type: "button", onClick: onSaveEntry, className: "bg-primary rounded-md px-3 py-2 text-sm text-white", children: editingEntryId ? "Update Entry" : "Add Entry" }), editingEntryId ? (_jsx("button", { type: "button", onClick: onCancelEntryEdit, className: "rounded-md border px-3 py-2 text-sm", children: "Cancel" })) : null] })] })] })] }));
33
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * document-preview.tsx
3
+ * Paper form layout for the Registry of Semi-Expendable Property Issued.
4
+ * Matches the official printed RegSPI form exactly.
5
+ */
6
+ export { RegSpiPreview as DocumentPreview } from "../../../gam/components/reg-spi-preview.js";
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ /**
3
+ * document-preview.tsx
4
+ * Paper form layout for the Registry of Semi-Expendable Property Issued.
5
+ * Matches the official printed RegSPI form exactly.
6
+ */
7
+ export { RegSpiPreview as DocumentPreview } from "../../../gam/components/reg-spi-preview.js";