@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,45 @@
1
+ export type RsmiBasicForm = {
2
+ rsmiNo: string;
3
+ entityName: string;
4
+ fundCluster: string;
5
+ serialNo: string;
6
+ reportDate: string;
7
+ supplyCustodianName: string;
8
+ accountingStaffName: string;
9
+ totalIssuedQty: string;
10
+ totalIssuedValue: string;
11
+ };
12
+ export type RsmiLine = {
13
+ id: string;
14
+ risNo: string;
15
+ responsibilityCenterCode: string;
16
+ stockNo: string;
17
+ item: string;
18
+ unit: string;
19
+ quantityIssued: string;
20
+ unitCost: string;
21
+ amount: string;
22
+ recapitulationId?: string;
23
+ };
24
+ export type RsmiRecapLine = {
25
+ id: string;
26
+ stockNo: string;
27
+ quantity: string;
28
+ uacsCode: string;
29
+ unitCost: string;
30
+ totalCost: string;
31
+ lineId?: string;
32
+ };
33
+ export type RsmiStatus = "Draft" | "Submitted" | "Approved" | "Posted" | "Cancelled";
34
+ export type RsmiRecord = RsmiBasicForm & {
35
+ id: string;
36
+ backendId?: number;
37
+ lines: RsmiLine[];
38
+ recapitulation: RsmiRecapLine[];
39
+ status: RsmiStatus;
40
+ createdAt: string;
41
+ supplyCustodian?: string;
42
+ designatedAccountingStaff?: string;
43
+ };
44
+ export type RsmiRecapLineDraft = Omit<RsmiRecapLine, "id">;
45
+ export type RsmiLineDraft = Omit<RsmiLine, "id">;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function formatCurrency(value: string | number): string;
2
+ export declare function formatDate(date: string | Date): string;
@@ -0,0 +1,18 @@
1
+ export function formatCurrency(value) {
2
+ const amount = typeof value === "string" ? parseFloat(value) : value;
3
+ if (isNaN(amount))
4
+ return "₱0.00";
5
+ return new Intl.NumberFormat("en-PH", {
6
+ style: "currency",
7
+ currency: "PHP",
8
+ }).format(amount);
9
+ }
10
+ export function formatDate(date) {
11
+ if (!date)
12
+ return "-";
13
+ return new Date(date).toLocaleDateString("en-PH", {
14
+ year: "numeric",
15
+ month: "2-digit",
16
+ day: "2-digit",
17
+ });
18
+ }
@@ -0,0 +1,5 @@
1
+ import type { RsmpForm } from "./rsmp-types.js";
2
+ export declare function RsmpCreateForm({ form, setForm }: {
3
+ form: RsmpForm;
4
+ setForm: (form: RsmpForm) => void;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { DateInput } from "../../../internal/components/ui/date-input.js";
4
+ export function RsmpCreateForm({ form, setForm }) {
5
+ const setField = (field, value) => setForm({ ...form, [field]: value });
6
+ return (_jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "RSMP No." }), _jsx("input", { value: form.rsmpNo, onChange: event => setField("rsmpNo", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "For the Month of" }), _jsx("input", { type: "month", value: form.reportMonth, onChange: event => setField("reportMonth", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Report Date" }), _jsx(DateInput, { type: "date", value: form.reportDate, onChange: event => setField("reportDate", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm md:col-span-2", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Supplier" }), _jsx("input", { value: form.supplier, onChange: event => setField("supplier", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "P.O. No." }), _jsx("input", { value: form.poNo, onChange: event => setField("poNo", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "P.O. Date" }), _jsx(DateInput, { type: "date", value: form.poDate, onChange: event => setField("poDate", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Invoice No." }), _jsx("input", { value: form.invoiceNo, onChange: event => setField("invoiceNo", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Invoice Date" }), _jsx(DateInput, { type: "date", value: form.invoiceDate, onChange: event => setField("invoiceDate", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Item Code" }), _jsx("input", { value: form.itemCode, onChange: event => setField("itemCode", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Unit" }), _jsx("input", { value: form.unitOfMeasurement, onChange: event => setField("unitOfMeasurement", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm md:col-span-2", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Item Name" }), _jsx("input", { value: form.itemName, onChange: event => setField("itemName", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Quantity Purchased" }), _jsx("input", { type: "number", min: "0", step: "0.01", value: form.quantityPurchased, onChange: event => setField("quantityPurchased", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Unit Cost" }), _jsx("input", { type: "number", min: "0", step: "0.01", value: form.unitCost, onChange: event => setField("unitCost", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Reference Document" }), _jsx("input", { value: form.referenceDoc, onChange: event => setField("referenceDoc", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Status" }), _jsxs("select", { value: form.status, onChange: event => setField("status", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm", children: [_jsx("option", { value: "Draft", children: "Draft" }), _jsx("option", { value: "Submitted", children: "Submitted" }), _jsx("option", { value: "Approved", children: "Approved" }), _jsx("option", { value: "Cancelled", children: "Cancelled" })] })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Prepared By" }), _jsx("input", { value: form.preparedBy, onChange: event => setField("preparedBy", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] }), _jsxs("label", { className: "space-y-1 text-sm", children: [_jsx("span", { className: "font-medium text-slate-700", children: "Noted By" }), _jsx("input", { value: form.notedBy, onChange: event => setField("notedBy", event.target.value), className: "h-9 w-full rounded-md border px-3 text-sm" })] })] }));
7
+ }
@@ -0,0 +1,11 @@
1
+ import type { RsmpReport } from "../lib/rsmp-grouping.js";
2
+ import type { RsmpRecord } from "./rsmp-types.js";
3
+ type RsmpDocumentPreviewProps = {
4
+ report: RsmpReport;
5
+ record?: never;
6
+ } | {
7
+ report?: never;
8
+ record: RsmpRecord;
9
+ };
10
+ export declare function RsmpDocumentPreview(props: RsmpDocumentPreviewProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { formatQuantity } from "./rsmp-utils.js";
4
+ function formatTemplateDate(value) {
5
+ if (!value)
6
+ return "";
7
+ const date = new Date(value);
8
+ if (Number.isNaN(date.getTime()))
9
+ return value;
10
+ return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
11
+ }
12
+ function formatReportMonth(value, fallbackDate) {
13
+ const source = value || fallbackDate.slice(0, 7);
14
+ const parsed = new Date(`${source}-01T00:00:00`);
15
+ if (Number.isNaN(parsed.getTime()))
16
+ return source;
17
+ return parsed.toLocaleDateString("en-PH", { month: "long", year: "numeric" });
18
+ }
19
+ function formatMoneyPlain(value) {
20
+ const numeric = Number(value);
21
+ if (!Number.isFinite(numeric))
22
+ return "-";
23
+ return numeric.toLocaleString("en-PH", {
24
+ minimumFractionDigits: 2,
25
+ maximumFractionDigits: 2,
26
+ });
27
+ }
28
+ export function RsmpDocumentPreview(props) {
29
+ const report = props.report ??
30
+ {
31
+ id: props.record.id,
32
+ rsmpNo: props.record.rsmpNo.replace(/^AUTO-/i, ""),
33
+ sourceReference: props.record.referenceDoc,
34
+ reportMonth: props.record.reportMonth,
35
+ reportDate: props.record.reportDate,
36
+ preparedBy: props.record.preparedBy,
37
+ notedBy: props.record.notedBy,
38
+ status: props.record.status,
39
+ totalCost: props.record.totalCost,
40
+ items: [props.record],
41
+ };
42
+ const rows = [
43
+ ...report.items,
44
+ ...Array.from({ length: Math.max(0, 27 - report.items.length) }, () => null),
45
+ ];
46
+ return (_jsx("div", { "data-pdf-page": true, "data-pdf-orientation": "portrait", className: "w-[760px] bg-white p-[34px] [font-family:'Times_New_Roman',Times,serif] text-black shadow-sm", children: _jsxs("div", { className: "min-h-[900px] border-[2px] border-black pb-5 text-[10px] leading-[1.15]", children: [_jsxs("div", { className: "relative h-[164px] border-b-[2px] border-black text-center", children: [_jsx("img", { src: "/bcs.png", alt: "", className: "absolute top-[54px] left-[108px] size-16 object-contain" }), _jsxs("div", { className: "pt-5 leading-[1.15] font-bold", children: [_jsx("p", { className: "text-[15px]", children: "BUREAU OF COMMUNICATIONS SERVICES" }), _jsx("p", { children: "Malaca\u00F1ang, Manila" }), _jsx("p", { className: "mt-4 text-[13px]", children: "FINANCE AND ADMINISTRATIVE DIVISION" }), _jsx("p", { className: "text-[13px]", children: "PROPERTY & SUPPLY SECTION" }), _jsx("p", { className: "mt-4 text-[13px]", children: "REPORT OF SUPPLIES AND MATERIALS PURCHASED" }), _jsxs("p", { children: ["For the Month of", " ", _jsx("span", { className: "inline-block min-w-28 border-b border-black px-2 pb-1 leading-none", children: formatReportMonth(report.reportMonth, report.reportDate) })] })] })] }), _jsxs("table", { className: "w-full table-fixed border-collapse text-[10px]", children: [_jsxs("colgroup", { children: [_jsx("col", { className: "w-[15%]" }), _jsx("col", { className: "w-[17.2%]" }), _jsx("col", { className: "w-[9.8%]" }), _jsx("col", { className: "w-[7.5%]" }), _jsx("col", { className: "w-[6.5%]" }), _jsx("col", { className: "w-[7.8%]" }), _jsx("col", { className: "w-[4%]" }), _jsx("col", { className: "w-[4.6%]" }), _jsx("col", { className: "w-[8%]" }), _jsx("col", { className: "w-[9%]" }), _jsx("col", { className: "w-[10.6%]" })] }), _jsx("thead", { children: _jsxs("tr", { className: "h-[34px] border-b-[2px] border-black text-center leading-[1.1] font-bold", children: [_jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "SUPPLIER" }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "ITEMS" }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "P.O. NO." }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "DATE" }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "INV. NO." }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "DATE" }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "QTY" }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "UNIT" }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "UNIT PRICE" }), _jsx("th", { className: "border-r border-black px-0.5 align-middle", children: "AMOUNT" }), _jsx("th", { className: "px-0.5 align-middle", children: "TOTAL" })] }) }), _jsx("tbody", { children: rows.map((row, index) => (_jsxs("tr", { className: "h-[18px] border-b border-black text-[9px] leading-none", children: [_jsx("td", { className: "border-r border-black px-1 align-middle", children: row?.supplier ?? "" }), _jsx("td", { className: "border-r border-black px-1 align-middle", children: row?.itemName ?? "" }), _jsx("td", { className: "border-r border-black px-1 text-center align-middle", children: row?.poNo ?? "" }), _jsx("td", { className: "border-r border-black px-1 text-center align-middle", children: row ? formatTemplateDate(row.poDate) : "" }), _jsx("td", { className: "border-r border-black px-1 text-center align-middle", children: row?.invoiceNo ?? "" }), _jsx("td", { className: "border-r border-black px-1 text-center align-middle", children: row ? formatTemplateDate(row.invoiceDate) : "" }), _jsx("td", { className: "border-r border-black px-1 text-center align-middle", children: row ? formatQuantity(row.quantityPurchased) : "" }), _jsx("td", { className: "border-r border-black px-1 text-center align-middle", children: row?.unitOfMeasurement ?? "" }), _jsx("td", { className: "border-r border-black px-1 text-right align-middle", children: row ? formatMoneyPlain(row.unitCost) : "" }), _jsx("td", { className: "border-r border-black px-1 text-right align-middle", children: row ? formatMoneyPlain(row.totalCost) : "" }), _jsx("td", { className: "px-1 text-right align-middle", children: row ? formatMoneyPlain(row.totalCost) : "-" })] }, row ? String(row.backendId) : `blank-${index}`))) }), _jsx("tfoot", { children: _jsxs("tr", { className: "h-[25px] border-t-[2px] border-b-[2px] border-black align-middle font-bold", children: [_jsx("td", { colSpan: 9, className: "px-1 align-middle text-[12px]", children: "TOTAL PURCHASES FOR THE MONTH OF" }), _jsx("td", { className: "px-1 text-center align-middle", children: "P" }), _jsx("td", { className: "px-1 text-right align-middle", children: formatMoneyPlain(report.totalCost) })] }) })] }), _jsxs("div", { className: "grid grid-cols-2 px-28 pt-5 text-center text-[13px]", children: [_jsxs("div", { children: [_jsx("p", { children: "Prepared by:" }), _jsx("div", { className: "h-10" }), _jsx("p", { children: report.preparedBy || "Supply Clerk" })] }), _jsxs("div", { children: [_jsx("p", { children: "Noted by:" }), _jsx("div", { className: "h-10" }), _jsx("p", { children: report.notedBy || "Property & Supply Section Chief" })] })] }), _jsxs("div", { className: "mt-5 flex justify-between px-1 text-[12px]", children: [_jsxs("div", { children: [_jsx("p", { children: "F-FAS-16" }), _jsx("p", { children: "Rev. 0 (03-16-23)" })] }), _jsx("p", { className: "self-end", children: "Page 1 of 1" })] })] }) }));
47
+ }
@@ -0,0 +1,44 @@
1
+ export type RsmpStatus = "Draft" | "Submitted" | "Approved" | "Cancelled";
2
+ export type RsmpRecord = {
3
+ id: string;
4
+ backendId: number;
5
+ rsmpNo: string;
6
+ supplier: string;
7
+ itemCode: string;
8
+ itemName: string;
9
+ poNo: string;
10
+ poDate: string;
11
+ invoiceNo: string;
12
+ invoiceDate: string;
13
+ unitOfMeasurement: string;
14
+ quantityPurchased: string;
15
+ unitCost: string;
16
+ totalCost: string;
17
+ referenceDoc: string;
18
+ reportMonth: string;
19
+ reportDate: string;
20
+ preparedBy: string;
21
+ notedBy: string;
22
+ status: RsmpStatus;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ };
26
+ export type RsmpForm = {
27
+ rsmpNo: string;
28
+ supplier: string;
29
+ itemCode: string;
30
+ itemName: string;
31
+ poNo: string;
32
+ poDate: string;
33
+ invoiceNo: string;
34
+ invoiceDate: string;
35
+ unitOfMeasurement: string;
36
+ quantityPurchased: string;
37
+ unitCost: string;
38
+ referenceDoc: string;
39
+ reportMonth: string;
40
+ reportDate: string;
41
+ preparedBy: string;
42
+ notedBy: string;
43
+ status: RsmpStatus;
44
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare function formatDate(value: string): string;
2
+ export declare function formatQuantity(value: string): string;
3
+ export declare function formatCurrency(value: string): string;
4
+ export declare function todayInputDate(): string;
5
+ export declare function toAmount(value: string): string;
@@ -0,0 +1,41 @@
1
+ export function formatDate(value) {
2
+ if (!value)
3
+ return "-";
4
+ const date = new Date(value);
5
+ if (Number.isNaN(date.getTime()))
6
+ return value;
7
+ return date.toLocaleDateString("en-PH", {
8
+ year: "numeric",
9
+ month: "short",
10
+ day: "2-digit",
11
+ });
12
+ }
13
+ export function formatQuantity(value) {
14
+ const numeric = Number(value);
15
+ if (!Number.isFinite(numeric))
16
+ return "0.00";
17
+ return numeric.toLocaleString("en-PH", {
18
+ minimumFractionDigits: 2,
19
+ maximumFractionDigits: 2,
20
+ });
21
+ }
22
+ export function formatCurrency(value) {
23
+ const numeric = Number(value);
24
+ if (!Number.isFinite(numeric))
25
+ return "PHP 0.00";
26
+ return numeric.toLocaleString("en-PH", {
27
+ style: "currency",
28
+ currency: "PHP",
29
+ minimumFractionDigits: 2,
30
+ maximumFractionDigits: 2,
31
+ });
32
+ }
33
+ export function todayInputDate() {
34
+ return new Date().toISOString().slice(0, 10);
35
+ }
36
+ export function toAmount(value) {
37
+ const numeric = Number(value);
38
+ if (!Number.isFinite(numeric) || numeric <= 0)
39
+ return "0.00";
40
+ return numeric.toFixed(2);
41
+ }
@@ -0,0 +1,14 @@
1
+ import type { RsmpRecord } from "../components/rsmp-types.js";
2
+ export type RsmpReport = {
3
+ id: string;
4
+ rsmpNo: string;
5
+ sourceReference: string;
6
+ reportMonth: string;
7
+ reportDate: string;
8
+ preparedBy: string;
9
+ notedBy: string;
10
+ status: RsmpRecord["status"];
11
+ totalCost: string;
12
+ items: RsmpRecord[];
13
+ };
14
+ export declare function groupRsmpLines(lines: RsmpRecord[]): RsmpReport[];
@@ -0,0 +1,75 @@
1
+ function reportPeriod(line) {
2
+ if (/^\d{4}-\d{2}$/.test(line.reportMonth))
3
+ return line.reportMonth;
4
+ for (const value of [line.reportDate, line.createdAt]) {
5
+ const match = value.match(/^(\d{4})-(\d{2})/);
6
+ if (match)
7
+ return `${match[1]}-${match[2]}`;
8
+ }
9
+ return "Unknown";
10
+ }
11
+ function iarIdentity(line) {
12
+ const sources = [line.referenceDoc, line.rsmpNo];
13
+ for (const source of sources) {
14
+ const match = source.toUpperCase().match(/(?:^|-)IAR-(\d{4})-(\d+)/);
15
+ if (match) {
16
+ return {
17
+ key: `IAR-${match[1]}-${match[2]}`,
18
+ year: match[1],
19
+ sequence: match[2],
20
+ };
21
+ }
22
+ }
23
+ return null;
24
+ }
25
+ function withoutAutoPrefix(value) {
26
+ return value.replace(/^AUTO-/i, "");
27
+ }
28
+ function reportStatus(items) {
29
+ const priority = ["Cancelled", "Draft", "Submitted", "Approved"];
30
+ return priority.find(status => items.some(item => item.status === status)) ?? "Draft";
31
+ }
32
+ function toTimestamp(value) {
33
+ const timestamp = new Date(value).getTime();
34
+ return Number.isFinite(timestamp) ? timestamp : 0;
35
+ }
36
+ export function groupRsmpLines(lines) {
37
+ const groups = new Map();
38
+ for (const line of lines) {
39
+ const period = reportPeriod(line);
40
+ const iar = iarIdentity(line);
41
+ const key = iar ? `${period}:${iar.key}` : `${period}:ROW:${line.backendId}`;
42
+ const items = groups.get(key) ?? [];
43
+ items.push(line);
44
+ groups.set(key, items);
45
+ }
46
+ return Array.from(groups.entries())
47
+ .map(([id, items]) => {
48
+ const latest = [...items].sort((a, b) => toTimestamp(b.reportDate || b.createdAt) - toTimestamp(a.reportDate || a.createdAt))[0];
49
+ const period = reportPeriod(latest);
50
+ const iar = iarIdentity(latest);
51
+ const [periodYear = "", periodMonth = ""] = period.split("-");
52
+ const rsmpNo = iar
53
+ ? `RSMP-${iar.year || periodYear}-${periodMonth}-${iar.sequence.padStart(4, "0")}`
54
+ : withoutAutoPrefix(latest.rsmpNo);
55
+ const total = items.reduce((sum, item) => sum + (Number(item.totalCost) || 0), 0);
56
+ return {
57
+ id,
58
+ rsmpNo,
59
+ sourceReference: iar?.key ?? latest.referenceDoc,
60
+ reportMonth: period,
61
+ reportDate: latest.reportDate,
62
+ preparedBy: latest.preparedBy,
63
+ notedBy: latest.notedBy,
64
+ status: reportStatus(items),
65
+ totalCost: total.toFixed(2),
66
+ items: [...items].sort((a, b) => a.itemName.localeCompare(b.itemName)),
67
+ };
68
+ })
69
+ .sort((a, b) => {
70
+ const dateDifference = toTimestamp(b.reportDate) - toTimestamp(a.reportDate);
71
+ if (dateDifference !== 0)
72
+ return dateDifference;
73
+ return b.rsmpNo.localeCompare(a.rsmpNo);
74
+ });
75
+ }
@@ -0,0 +1,13 @@
1
+ import type { ScEntry, ScFormData } from "../types.js";
2
+ type CreateFormProps = {
3
+ activeTab: string;
4
+ onActiveTabChange: (tab: string) => void;
5
+ scNo: string;
6
+ formData: ScFormData;
7
+ onFormFieldChange: (field: keyof ScFormData, value: string) => void;
8
+ onEntryFieldChange: (index: number, field: keyof ScEntry, value: string) => void;
9
+ onAddEntry: () => void;
10
+ onRemoveEntry: (index: number) => void;
11
+ };
12
+ export declare function StockCardCreateForm({ activeTab, onActiveTabChange, scNo, formData, onFormFieldChange, onEntryFieldChange, onAddEntry, onRemoveEntry, }: CreateFormProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,39 @@
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 { Button } from "../../../internal/components/ui/button.js";
5
+ import { DateInput } from "../../../internal/components/ui/date-input.js";
6
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../internal/components/ui/tabs.js";
7
+ export function StockCardCreateForm({ activeTab, onActiveTabChange, scNo, formData, onFormFieldChange, onEntryFieldChange, onAddEntry, onRemoveEntry, }) {
8
+ const inputCls = "w-full rounded-md border px-3 py-2 text-sm dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100";
9
+ const readonlyCls = "w-full rounded-md border bg-gray-50 px-3 py-2 text-sm text-gray-500 dark:border-slate-700 dark:bg-slate-800/60 dark:text-slate-400";
10
+ const fields = [
11
+ {
12
+ id: "itemCode",
13
+ label: "Item Code",
14
+ render: () => (_jsx("input", { value: formData.itemCode, onChange: e => onFormFieldChange("itemCode", e.target.value), placeholder: "Stock/Property No.", className: inputCls, required: true })),
15
+ },
16
+ {
17
+ id: "scNo",
18
+ label: "Stock Card No.",
19
+ render: () => _jsx("input", { value: scNo, readOnly: true, className: readonlyCls }),
20
+ },
21
+ {
22
+ id: "itemName",
23
+ label: "Description",
24
+ render: () => (_jsx("input", { value: formData.itemName, onChange: e => onFormFieldChange("itemName", e.target.value), placeholder: "Item name or description", className: inputCls, required: true })),
25
+ },
26
+ {
27
+ id: "reorderPoint",
28
+ label: "Re-order Point",
29
+ render: () => (_jsx("input", { value: formData.reorderPoint, onChange: e => onFormFieldChange("reorderPoint", e.target.value), placeholder: "Re-order point", className: inputCls })),
30
+ },
31
+ {
32
+ id: "unitOfMeasurement",
33
+ label: "Unit of Measurement",
34
+ fullWidth: true,
35
+ render: () => (_jsx("input", { value: formData.unitOfMeasurement, onChange: e => onFormFieldChange("unitOfMeasurement", e.target.value), placeholder: "e.g. pcs, box, ream", className: inputCls })),
36
+ },
37
+ ];
38
+ return (_jsxs(Tabs, { value: activeTab, onValueChange: onActiveTabChange, 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: "stock-card-basic-info", fields: fields, header: _jsx("div", { className: "rounded-md border border-indigo-200 bg-indigo-50 p-4 dark:border-indigo-800 dark:bg-indigo-950/30", children: _jsx("div", { className: "flex items-center justify-between", children: _jsxs("div", { children: [_jsx("p", { className: "text-muted-foreground text-xs font-medium", children: "Auto-Generated Stock Card No." }), _jsx("p", { className: "text-3xl font-semibold text-slate-700 dark:text-slate-300", children: scNo })] }) }) }) }) }), _jsxs(TabsContent, { value: "entries", className: "mt-4 space-y-3", children: [_jsx("div", { className: "overflow-x-auto rounded-md border dark:border-slate-700", children: _jsxs("table", { className: "min-w-full border-collapse text-xs", children: [_jsx("thead", { className: "bg-gray-50 dark:bg-slate-800", children: _jsxs("tr", { children: [_jsx("th", { className: "border p-2 text-left dark:border-slate-700", children: "Date" }), _jsx("th", { className: "border p-2 text-left dark:border-slate-700", children: "Reference" }), _jsx("th", { className: "border p-2 text-right dark:border-slate-700", children: "Receipt Qty" }), _jsx("th", { className: "border p-2 text-right dark:border-slate-700", children: "Issue Qty" }), _jsx("th", { className: "border p-2 text-left dark:border-slate-700", children: "Office/Officer" }), _jsx("th", { className: "border p-2 text-right dark:border-slate-700", children: "Balance Qty" }), _jsx("th", { className: "border p-2 text-left dark:border-slate-700", children: "No. of Days to Consume" }), _jsx("th", { className: "border p-2 text-left dark:border-slate-700", children: "Action" })] }) }), _jsx("tbody", { children: formData.entries.map((entry, index) => (_jsxs("tr", { children: [_jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx(DateInput, { type: "date", value: entry.transactionDate, onChange: e => onEntryFieldChange(index, "transactionDate", e.target.value), className: "w-full rounded border px-2 py-1 text-xs dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100" }) }), _jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx("input", { value: entry.referenceDoc, onChange: e => onEntryFieldChange(index, "referenceDoc", e.target.value), placeholder: "e.g. PR-2026-06(0001)", className: "w-full rounded border px-2 py-1 text-xs dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100" }) }), _jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx("input", { type: "number", min: 0, step: "0.01", value: entry.receiptQty, onChange: e => onEntryFieldChange(index, "receiptQty", e.target.value), className: "w-full rounded border px-2 py-1 text-right text-xs dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100" }) }), _jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx("input", { type: "number", min: 0, step: "0.01", value: entry.issueQty, onChange: e => onEntryFieldChange(index, "issueQty", e.target.value), className: "w-full rounded border px-2 py-1 text-right text-xs dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100" }) }), _jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx("input", { value: entry.office, onChange: e => onEntryFieldChange(index, "office", e.target.value), placeholder: "Office/Officer receiving item", className: "w-full rounded border px-2 py-1 text-xs dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100" }) }), _jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx("input", { type: "number", step: "0.01", value: entry.balanceQty, onChange: e => onEntryFieldChange(index, "balanceQty", e.target.value), className: "w-full rounded border px-2 py-1 text-right text-xs dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100" }) }), _jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx("input", { type: "number", min: 0, value: entry.daysToConsume, onChange: e => onEntryFieldChange(index, "daysToConsume", e.target.value), className: "w-full rounded border px-2 py-1 text-right text-xs dark:border-slate-600 dark:bg-slate-900 dark:text-slate-100" }) }), _jsx("td", { className: "border p-1.5 dark:border-slate-700", children: _jsx("button", { type: "button", onClick: () => onRemoveEntry(index), className: "rounded border px-2 py-1 text-xs text-red-600 hover:bg-red-50 disabled:opacity-30 dark:border-slate-600 dark:text-red-400 dark:hover:bg-red-950/30", disabled: formData.entries.length <= 1, children: "Remove" }) })] }, index))) })] }) }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onAddEntry, children: "+ Add Entry Row" })] })] }));
39
+ }
@@ -0,0 +1,7 @@
1
+ import type { ScRecord } from "../types.js";
2
+ type DocumentPreviewProps = {
3
+ entityName?: string;
4
+ record: ScRecord;
5
+ };
6
+ export declare function ScDocumentPreview({ record, entityName }: DocumentPreviewProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { formatQty, formatStockCardEntryDate, STOCK_CARD_ROWS_PER_PAGE } from "../utils.js";
4
+ const ROWS_PER_PAGE = STOCK_CARD_ROWS_PER_PAGE;
5
+ function ScPage({ header, entries, startBalance, totalRows, pageIndex, }) {
6
+ const fillRows = totalRows - entries.length;
7
+ return (_jsx("div", { "data-pdf-page": "true", "data-pdf-orientation": "portrait", "data-pdf-fit-one-page": "true", className: "mx-auto min-h-280.75 w-198.5 border border-black bg-[#fbf7e9] font-serif text-[10px] text-black", children: _jsxs("div", { className: "px-1 py-1", children: [header, _jsxs("table", { className: "mt-0 w-full border-collapse", children: [_jsxs("thead", { children: [_jsxs("tr", { className: "h-6 text-center leading-tight font-bold", children: [_jsx("th", { rowSpan: 2, className: "border border-black px-1 py-0.5 align-middle", children: "Date" }), _jsx("th", { rowSpan: 2, className: "border border-black px-1 py-0.5 align-middle", children: "Ref." }), _jsx("th", { className: "border border-black px-1 py-0.5 align-middle", children: "Receipt" }), _jsx("th", { colSpan: 2, className: "border border-black px-1 py-0.5 align-middle", children: "Issuance" }), _jsx("th", { className: "border border-black px-1 py-0.5 align-middle", children: "Balance" }), _jsx("th", { rowSpan: 2, className: "border border-black px-1 py-0.5 align-middle", children: "No. of Days to Consume" })] }), _jsxs("tr", { className: "h-6 text-center leading-tight font-bold", children: [_jsx("th", { className: "border border-black px-1 py-0.5 align-middle", children: "Quantity" }), _jsx("th", { className: "border border-black px-1 py-0.5 align-middle", children: "Quantity" }), _jsx("th", { className: "border border-black px-1 py-0.5 align-middle", children: "Office/Officer" }), _jsx("th", { className: "border border-black px-1 py-0.5 align-middle", children: "Quantity" })] })] }), _jsxs("tbody", { children: [entries.map((entry, index) => {
8
+ const runningBalance = entries
9
+ .slice(0, index + 1)
10
+ .reduce((balance, current) => balance + (Number(current.receiptQty) || 0) - (Number(current.issueQty) || 0), startBalance);
11
+ return (_jsxs("tr", { className: "h-5 align-top", children: [_jsx("td", { className: "border-x border-b border-black px-1 py-0.5 text-center align-middle", children: entry.transactionDate ? formatStockCardEntryDate(entry.transactionDate) : "" }), _jsx("td", { className: "border-x border-b border-black px-1 py-0.5 align-middle", children: entry.referenceDoc || "" }), _jsx("td", { className: "border-x border-b border-black px-1 py-0.5 text-right align-middle", children: formatQty(entry.receiptQty) }), _jsx("td", { className: "border-x border-b border-black px-1 py-0.5 text-right align-middle", children: formatQty(entry.issueQty) }), _jsx("td", { className: "border-x border-b border-black px-1 py-0.5 align-middle", children: entry.office || "" }), _jsx("td", { className: "border-x border-b border-black px-1 py-0.5 text-right align-middle", children: formatQty(runningBalance) }), _jsx("td", { className: "border-x border-b border-black px-1 py-0.5 text-center align-middle", children: entry.daysToConsume || "" })] }, index));
12
+ }), Array.from({ length: fillRows }).map((_, i) => (_jsxs("tr", { className: "h-5 align-top", children: [_jsx("td", { className: "border-x border-b border-black px-2" }), _jsx("td", { className: "border-x border-b border-black px-2" }), _jsx("td", { className: "border-x border-b border-black px-2" }), _jsx("td", { className: "border-x border-b border-black px-2" }), _jsx("td", { className: "border-x border-b border-black px-2" }), _jsx("td", { className: "border-x border-b border-black px-2" }), _jsx("td", { className: "border-x border-b border-black px-2" })] }, `blank-${i}`)))] })] }), pageIndex > 0 && (_jsx("p", { className: "mt-2 text-right text-[9px] text-black", children: "... continued from previous page" }))] }) }));
13
+ }
14
+ export function ScDocumentPreview({ record, entityName = "" }) {
15
+ const sorted = [...record.entries].sort((a, b) => new Date(a.transactionDate).getTime() - new Date(b.transactionDate).getTime());
16
+ const header = (_jsxs(_Fragment, { children: [_jsx("h4", { className: "mt-2 text-center text-[30px] leading-none font-bold", children: "STOCK CARD" }), _jsx("h3", { className: "text-center text-[24px] leading-none font-bold uppercase", children: entityName }), _jsx("p", { className: "mt-1 mb-2 min-h-5 text-center text-[16px] leading-5 font-bold", children: "Agency" }), _jsx("table", { className: "w-full border-collapse", children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsxs("td", { className: "border border-black px-1 py-1 text-[10px]", children: [_jsx("span", { className: "font-bold", children: "Item: " }), record.itemCode] }), _jsxs("td", { className: "border border-black px-1 py-1 text-[10px]", children: [_jsx("span", { className: "font-bold", children: "Description: " }), record.itemName] }), _jsxs("td", { className: "border border-black px-1 py-1 text-[10px]", children: [_jsx("span", { className: "font-bold", children: "Stock No: " }), record.stockCardNo] })] }), _jsxs("tr", { children: [_jsx("td", { className: "border border-black px-1 py-1 text-[10px]" }), _jsx("td", { className: "border border-black px-1 py-1 text-[10px]" }), _jsxs("td", { className: "border border-black px-1 py-1 text-[10px]", children: [_jsx("span", { className: "font-bold", children: "Re-order Point: " }), record.reorderPoint] })] })] }) })] }));
17
+ const pages = [];
18
+ for (let i = 0; i < sorted.length; i += ROWS_PER_PAGE) {
19
+ const chunk = sorted.slice(i, i + ROWS_PER_PAGE);
20
+ const prevBalance = sorted.slice(0, i).reduce((sum, e) => {
21
+ return sum + (Number(e.receiptQty) || 0) - (Number(e.issueQty) || 0);
22
+ }, 0);
23
+ pages.push({ entries: chunk, startBalance: prevBalance });
24
+ }
25
+ if (pages.length === 0) {
26
+ pages.push({ entries: [], startBalance: 0 });
27
+ }
28
+ return (_jsx("div", { className: "mx-auto w-full max-w-full overflow-x-auto", children: _jsx("div", { className: "mx-auto w-fit space-y-3 p-1", children: pages.map((page, i) => (_jsx(ScPage, { header: header, entries: page.entries, startBalance: page.startBalance, totalRows: ROWS_PER_PAGE, pageIndex: i }, i))) }) }));
29
+ }
@@ -0,0 +1,31 @@
1
+ export type ScStatus = "Draft" | "Submitted" | "Approved";
2
+ export type ScEntry = {
3
+ transactionDate: string;
4
+ referenceDoc: string;
5
+ receiptQty: string;
6
+ office: string;
7
+ issueQty: string;
8
+ balanceQty: string;
9
+ daysToConsume: string;
10
+ };
11
+ export type ScRecord = {
12
+ id: string;
13
+ stockCardNo: string;
14
+ itemCode: string;
15
+ itemName: string;
16
+ reorderPoint: string;
17
+ unitOfMeasurement: string;
18
+ warehouse: string;
19
+ entries: ScEntry[];
20
+ status: ScStatus;
21
+ createdAt: string;
22
+ updatedAt?: string;
23
+ };
24
+ export type ScFormData = {
25
+ itemCode: string;
26
+ itemName: string;
27
+ reorderPoint: string;
28
+ unitOfMeasurement: string;
29
+ warehouse: string;
30
+ entries: ScEntry[];
31
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import * as XLSX from "xlsx-js-style";
2
+ import type { ScEntry, ScFormData, ScRecord } from "./types.js";
3
+ export declare const EMPTY_ENTRY: ScEntry;
4
+ export declare const EMPTY_FORM: ScFormData;
5
+ export declare function generateScNo(index: number, itemCode: string): string;
6
+ export declare function formatQty(value: string | number): string;
7
+ export declare function formatScDate(value: string): string;
8
+ export declare function formatDateTime(value: string): string;
9
+ export declare function computeRunningBalance(entries: ScEntry[]): string;
10
+ type CellKind = "title" | "meta" | "header" | "item-text" | "item-center" | "item-number" | "blank";
11
+ export type StockCardSheetCell = {
12
+ value: string | number;
13
+ kind: CellKind;
14
+ };
15
+ export type StockCardSheetModel = {
16
+ rows: StockCardSheetCell[][];
17
+ merges: XLSX.Range[];
18
+ cols: {
19
+ wch: number;
20
+ }[];
21
+ rowHeights: {
22
+ hpt: number;
23
+ }[];
24
+ };
25
+ export declare const STOCK_CARD_ROWS_PER_PAGE = 44;
26
+ export declare function formatStockCardEntryDate(value: string): string;
27
+ export declare function buildStockCardSheetModel(record: ScRecord): StockCardSheetModel;
28
+ export declare function getExcelPreviewCellClassName(kind: CellKind): string;
29
+ export declare function makeEmptyForm(): ScFormData;
30
+ export declare function exportStockCardXlsx(record: ScRecord): void;
31
+ export declare function exportStockCardCsv(record: ScRecord): void;
32
+ export {};