@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.
- package/FORM_CATALOG.md +44 -0
- package/README.md +165 -0
- package/dist/definitions.d.ts +1147 -0
- package/dist/definitions.js +60 -0
- package/dist/forms/iar.d.ts +172 -0
- package/dist/forms/iar.js +6 -0
- package/dist/forms/ics.d.ts +48 -0
- package/dist/forms/ics.js +6 -0
- package/dist/forms/iirup.d.ts +54 -0
- package/dist/forms/iirup.js +6 -0
- package/dist/forms/iirusp.d.ts +32 -0
- package/dist/forms/iirusp.js +6 -0
- package/dist/forms/itr.d.ts +42 -0
- package/dist/forms/itr.js +6 -0
- package/dist/forms/par.d.ts +84 -0
- package/dist/forms/par.js +6 -0
- package/dist/forms/ppelc.d.ts +34 -0
- package/dist/forms/ppelc.js +6 -0
- package/dist/forms/pr.d.ts +27 -0
- package/dist/forms/pr.js +6 -0
- package/dist/forms/property-card.d.ts +68 -0
- package/dist/forms/property-card.js +6 -0
- package/dist/forms/ptr.d.ts +54 -0
- package/dist/forms/ptr.js +6 -0
- package/dist/forms/regspi.d.ts +32 -0
- package/dist/forms/regspi.js +6 -0
- package/dist/forms/ris.d.ts +66 -0
- package/dist/forms/ris.js +6 -0
- package/dist/forms/rlsddp.d.ts +54 -0
- package/dist/forms/rlsddp.js +6 -0
- package/dist/forms/rlsddsp.d.ts +42 -0
- package/dist/forms/rlsddsp.js +6 -0
- package/dist/forms/rpci.d.ts +32 -0
- package/dist/forms/rpci.js +6 -0
- package/dist/forms/rpcppe.d.ts +32 -0
- package/dist/forms/rpcppe.js +6 -0
- package/dist/forms/rpcsp.d.ts +32 -0
- package/dist/forms/rpcsp.js +6 -0
- package/dist/forms/rrsp.d.ts +32 -0
- package/dist/forms/rrsp.js +6 -0
- package/dist/forms/rsmi.d.ts +32 -0
- package/dist/forms/rsmi.js +6 -0
- package/dist/forms/rsmp.d.ts +33 -0
- package/dist/forms/rsmp.js +6 -0
- package/dist/forms/rspi.d.ts +32 -0
- package/dist/forms/rspi.js +6 -0
- package/dist/forms/spc.d.ts +37 -0
- package/dist/forms/spc.js +6 -0
- package/dist/forms/splc.d.ts +41 -0
- package/dist/forms/splc.js +6 -0
- package/dist/forms/stock-card.d.ts +28 -0
- package/dist/forms/stock-card.js +6 -0
- package/dist/forms/wmr.d.ts +32 -0
- package/dist/forms/wmr.js +6 -0
- package/dist/gam/components/gam-report-workbench.d.ts +40 -0
- package/dist/gam/components/gam-report-workbench.js +2 -0
- package/dist/gam/components/grand-total-computation.d.ts +10 -0
- package/dist/gam/components/grand-total-computation.js +26 -0
- package/dist/gam/components/iar-preview.d.ts +30 -0
- package/dist/gam/components/iar-preview.js +150 -0
- package/dist/gam/components/ics-preview.d.ts +31 -0
- package/dist/gam/components/ics-preview.js +114 -0
- package/dist/gam/components/iirup-preview.d.ts +42 -0
- package/dist/gam/components/iirup-preview.js +237 -0
- package/dist/gam/components/itr-preview.d.ts +31 -0
- package/dist/gam/components/itr-preview.js +180 -0
- package/dist/gam/components/par-preview.d.ts +28 -0
- package/dist/gam/components/par-preview.js +95 -0
- package/dist/gam/components/ppelc-preview.d.ts +28 -0
- package/dist/gam/components/ppelc-preview.js +128 -0
- package/dist/gam/components/property-card-preview.d.ts +21 -0
- package/dist/gam/components/property-card-preview.js +117 -0
- package/dist/gam/components/ptr-preview.d.ts +36 -0
- package/dist/gam/components/ptr-preview.js +122 -0
- package/dist/gam/components/purchase-order-page-client.d.ts +66 -0
- package/dist/gam/components/purchase-order-page-client.js +179 -0
- package/dist/gam/components/reg-spi-preview.d.ts +28 -0
- package/dist/gam/components/reg-spi-preview.js +138 -0
- package/dist/gam/components/ris-form.d.ts +13 -0
- package/dist/gam/components/ris-form.js +20 -0
- package/dist/gam/components/ris-preview.d.ts +7 -0
- package/dist/gam/components/ris-preview.js +16 -0
- package/dist/gam/components/rlsddp-preview.d.ts +34 -0
- package/dist/gam/components/rlsddp-preview.js +251 -0
- package/dist/gam/components/rlsddsp-preview.d.ts +33 -0
- package/dist/gam/components/rlsddsp-preview.js +226 -0
- package/dist/gam/components/rpci-preview.d.ts +27 -0
- package/dist/gam/components/rpci-preview.js +123 -0
- package/dist/gam/components/rpcppe-preview.d.ts +28 -0
- package/dist/gam/components/rpcppe-preview.js +133 -0
- package/dist/gam/components/rpcsp-preview.d.ts +29 -0
- package/dist/gam/components/rpcsp-preview.js +81 -0
- package/dist/gam/components/rspi-preview.d.ts +23 -0
- package/dist/gam/components/rspi-preview.js +72 -0
- package/dist/gam/components/spc-preview.d.ts +23 -0
- package/dist/gam/components/spc-preview.js +149 -0
- package/dist/gam/components/splc-entry-form.d.ts +14 -0
- package/dist/gam/components/splc-entry-form.js +6 -0
- package/dist/gam/components/splc-preview.d.ts +27 -0
- package/dist/gam/components/splc-preview.js +192 -0
- package/dist/gam/components/stock-card-preview.d.ts +14 -0
- package/dist/gam/components/stock-card-preview.js +17 -0
- package/dist/gam/config/new-report-config.d.ts +1094 -0
- package/dist/gam/config/new-report-config.js +1478 -0
- package/dist/gam/purchase-order-flow.d.ts +146 -0
- package/dist/gam/purchase-order-flow.js +173 -0
- package/dist/gam/purchase-request/workflow.d.ts +19 -0
- package/dist/gam/purchase-request/workflow.js +45 -0
- package/dist/gam/types/ris-types.d.ts +37 -0
- package/dist/gam/types/ris-types.js +1 -0
- package/dist/gam/utils/export-ics-xlsx.d.ts +28 -0
- package/dist/gam/utils/export-ics-xlsx.js +273 -0
- package/dist/gam/utils/export-par-xlsx.d.ts +18 -0
- package/dist/gam/utils/export-par-xlsx.js +181 -0
- package/dist/gam/utils/export-preview-pdf.d.ts +13 -0
- package/dist/gam/utils/export-preview-pdf.js +270 -0
- package/dist/gam/utils/export-report-xlsx.d.ts +228 -0
- package/dist/gam/utils/export-report-xlsx.js +873 -0
- package/dist/gam/utils/line-totals.d.ts +6 -0
- package/dist/gam/utils/line-totals.js +18 -0
- package/dist/gam/utils/monetary-input.d.ts +6 -0
- package/dist/gam/utils/monetary-input.js +18 -0
- package/dist/gam/utils/print-element.d.ts +8 -0
- package/dist/gam/utils/print-element.js +157 -0
- package/dist/government-form.d.ts +16 -0
- package/dist/government-form.js +45 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +50 -0
- package/dist/internal/components/configurable-form-layout.d.ts +20 -0
- package/dist/internal/components/configurable-form-layout.js +49 -0
- package/dist/internal/components/ui/badge.d.ts +7 -0
- package/dist/internal/components/ui/badge.js +34 -0
- package/dist/internal/components/ui/button.d.ts +10 -0
- package/dist/internal/components/ui/button.js +35 -0
- package/dist/internal/components/ui/calendar.d.ts +8 -0
- package/dist/internal/components/ui/calendar.js +77 -0
- package/dist/internal/components/ui/command.d.ts +19 -0
- package/dist/internal/components/ui/command.js +36 -0
- package/dist/internal/components/ui/date-input.d.ts +14 -0
- package/dist/internal/components/ui/date-input.js +33 -0
- package/dist/internal/components/ui/date-picker.d.ts +19 -0
- package/dist/internal/components/ui/date-picker.js +34 -0
- package/dist/internal/components/ui/dialog.d.ts +18 -0
- package/dist/internal/components/ui/dialog.js +38 -0
- package/dist/internal/components/ui/input-group.d.ts +18 -0
- package/dist/internal/components/ui/input-group.js +57 -0
- package/dist/internal/components/ui/input.d.ts +3 -0
- package/dist/internal/components/ui/input.js +12 -0
- package/dist/internal/components/ui/label.d.ts +3 -0
- package/dist/internal/components/ui/label.js +7 -0
- package/dist/internal/components/ui/popover.d.ts +9 -0
- package/dist/internal/components/ui/popover.js +23 -0
- package/dist/internal/components/ui/select.d.ts +17 -0
- package/dist/internal/components/ui/select.js +35 -0
- package/dist/internal/components/ui/switch.d.ts +5 -0
- package/dist/internal/components/ui/switch.js +8 -0
- package/dist/internal/components/ui/table.d.ts +10 -0
- package/dist/internal/components/ui/table.js +28 -0
- package/dist/internal/components/ui/tabs.d.ts +10 -0
- package/dist/internal/components/ui/tabs.js +29 -0
- package/dist/internal/components/ui/textarea.d.ts +3 -0
- package/dist/internal/components/ui/textarea.js +7 -0
- package/dist/internal/components/ui/tooltip.d.ts +6 -0
- package/dist/internal/components/ui/tooltip.js +17 -0
- package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.d.ts +112 -0
- package/dist/internal/contracts/modules/v1/reg-spi-reports/reg-spi-reports.schema.js +91 -0
- package/dist/internal/hooks/use-form-field-order.d.ts +7 -0
- package/dist/internal/hooks/use-form-field-order.js +43 -0
- package/dist/internal/lib/utils.d.ts +2 -0
- package/dist/internal/lib/utils.js +3 -0
- package/dist/inventory/components/inventory-item-form.d.ts +7 -0
- package/dist/inventory/components/inventory-item-form.js +5 -0
- package/dist/inventory/components/inventory-item-preview.d.ts +6 -0
- package/dist/inventory/components/inventory-item-preview.js +5 -0
- package/dist/inventory/iar.d.ts +4 -0
- package/dist/inventory/iar.js +4 -0
- package/dist/inventory/ics.d.ts +2 -0
- package/dist/inventory/ics.js +3 -0
- package/dist/inventory/iirup.d.ts +2 -0
- package/dist/inventory/iirup.js +3 -0
- package/dist/inventory/iirusp.d.ts +4 -0
- package/dist/inventory/iirusp.js +4 -0
- package/dist/inventory/index.d.ts +3 -0
- package/dist/inventory/index.js +4 -0
- package/dist/inventory/item.d.ts +3 -0
- package/dist/inventory/item.js +3 -0
- package/dist/inventory/itr.d.ts +4 -0
- package/dist/inventory/itr.js +4 -0
- package/dist/inventory/par.d.ts +2 -0
- package/dist/inventory/par.js +3 -0
- package/dist/inventory/po.d.ts +2 -0
- package/dist/inventory/po.js +2 -0
- package/dist/inventory/ppelc.d.ts +2 -0
- package/dist/inventory/ppelc.js +3 -0
- package/dist/inventory/pplc.d.ts +2 -0
- package/dist/inventory/pplc.js +4 -0
- package/dist/inventory/pr.d.ts +4 -0
- package/dist/inventory/pr.js +4 -0
- package/dist/inventory/property-card.d.ts +2 -0
- package/dist/inventory/property-card.js +3 -0
- package/dist/inventory/ptr.d.ts +2 -0
- package/dist/inventory/ptr.js +3 -0
- package/dist/inventory/regspi.d.ts +4 -0
- package/dist/inventory/regspi.js +4 -0
- package/dist/inventory/ris.d.ts +4 -0
- package/dist/inventory/ris.js +4 -0
- package/dist/inventory/rlsddp.d.ts +4 -0
- package/dist/inventory/rlsddp.js +4 -0
- package/dist/inventory/rlsddsp.d.ts +2 -0
- package/dist/inventory/rlsddsp.js +3 -0
- package/dist/inventory/rpci.d.ts +2 -0
- package/dist/inventory/rpci.js +3 -0
- package/dist/inventory/rpcppe.d.ts +2 -0
- package/dist/inventory/rpcppe.js +3 -0
- package/dist/inventory/rpcsp.d.ts +2 -0
- package/dist/inventory/rpcsp.js +3 -0
- package/dist/inventory/rrsp.d.ts +2 -0
- package/dist/inventory/rrsp.js +3 -0
- package/dist/inventory/rsmi.d.ts +4 -0
- package/dist/inventory/rsmi.js +4 -0
- package/dist/inventory/rsmp.d.ts +4 -0
- package/dist/inventory/rsmp.js +4 -0
- package/dist/inventory/rspi.d.ts +2 -0
- package/dist/inventory/rspi.js +3 -0
- package/dist/inventory/spc.d.ts +2 -0
- package/dist/inventory/spc.js +3 -0
- package/dist/inventory/splc.d.ts +3 -0
- package/dist/inventory/splc.js +4 -0
- package/dist/inventory/stock-card.d.ts +4 -0
- package/dist/inventory/stock-card.js +4 -0
- package/dist/inventory/types.d.ts +11 -0
- package/dist/inventory/types.js +1 -0
- package/dist/inventory/wmr.d.ts +4 -0
- package/dist/inventory/wmr.js +4 -0
- package/dist/lib/rpcsp-accountable-person.d.ts +1 -0
- package/dist/lib/rpcsp-accountable-person.js +10 -0
- package/dist/reports/iar/_components/create-form.d.ts +13 -0
- package/dist/reports/iar/_components/create-form.js +92 -0
- package/dist/reports/iar/_components/document-preview.d.ts +11 -0
- package/dist/reports/iar/_components/document-preview.js +131 -0
- package/dist/reports/iar/types.d.ts +97 -0
- package/dist/reports/iar/types.js +24 -0
- package/dist/reports/iirusp/_components/create-form.d.ts +17 -0
- package/dist/reports/iirusp/_components/create-form.js +118 -0
- package/dist/reports/iirusp/_components/document-preview.d.ts +8 -0
- package/dist/reports/iirusp/_components/document-preview.js +389 -0
- package/dist/reports/iirusp/types.d.ts +134 -0
- package/dist/reports/iirusp/types.js +29 -0
- package/dist/reports/iirusp/utils.d.ts +29 -0
- package/dist/reports/iirusp/utils.js +488 -0
- package/dist/reports/itr/_components/create-form.d.ts +28 -0
- package/dist/reports/itr/_components/create-form.js +90 -0
- package/dist/reports/itr/_components/document-preview.d.ts +6 -0
- package/dist/reports/itr/_components/document-preview.js +7 -0
- package/dist/reports/itr/types.d.ts +68 -0
- package/dist/reports/itr/types.js +27 -0
- package/dist/reports/itr/utils.d.ts +24 -0
- package/dist/reports/itr/utils.js +76 -0
- package/dist/reports/pr/_components/create-form.d.ts +16 -0
- package/dist/reports/pr/_components/create-form.js +52 -0
- package/dist/reports/pr/_components/document-preview.d.ts +7 -0
- package/dist/reports/pr/_components/document-preview.js +9 -0
- package/dist/reports/pr/types.d.ts +69 -0
- package/dist/reports/pr/types.js +1 -0
- package/dist/reports/pr/utils.d.ts +72 -0
- package/dist/reports/pr/utils.js +572 -0
- package/dist/reports/regspi/_components/create-form.d.ts +19 -0
- package/dist/reports/regspi/_components/create-form.js +33 -0
- package/dist/reports/regspi/_components/document-preview.d.ts +6 -0
- package/dist/reports/regspi/_components/document-preview.js +7 -0
- package/dist/reports/regspi/types.d.ts +29 -0
- package/dist/reports/regspi/types.js +24 -0
- package/dist/reports/regspi/utils.d.ts +48 -0
- package/dist/reports/regspi/utils.js +98 -0
- package/dist/reports/ris/_components/create-form.d.ts +36 -0
- package/dist/reports/ris/_components/create-form.js +149 -0
- package/dist/reports/ris/_components/document-preview.d.ts +8 -0
- package/dist/reports/ris/_components/document-preview.js +31 -0
- package/dist/reports/ris/types.d.ts +93 -0
- package/dist/reports/ris/types.js +1 -0
- package/dist/reports/rlsddp/_components/create-form.d.ts +11 -0
- package/dist/reports/rlsddp/_components/create-form.js +165 -0
- package/dist/reports/rlsddp/_components/document-preview.d.ts +8 -0
- package/dist/reports/rlsddp/_components/document-preview.js +15 -0
- package/dist/reports/rlsddp/types.d.ts +105 -0
- package/dist/reports/rlsddp/types.js +31 -0
- package/dist/reports/rrsp/components/rrsp-preview.d.ts +21 -0
- package/dist/reports/rrsp/components/rrsp-preview.js +155 -0
- package/dist/reports/rsmi/components/rsmi-create-form.d.ts +20 -0
- package/dist/reports/rsmi/components/rsmi-create-form.js +8 -0
- package/dist/reports/rsmi/components/rsmi-document-body.d.ts +15 -0
- package/dist/reports/rsmi/components/rsmi-document-body.js +12 -0
- package/dist/reports/rsmi/components/rsmi-types.d.ts +45 -0
- package/dist/reports/rsmi/components/rsmi-types.js +1 -0
- package/dist/reports/rsmi/components/rsmi-utils.d.ts +2 -0
- package/dist/reports/rsmi/components/rsmi-utils.js +18 -0
- package/dist/reports/rsmp/components/rsmp-create-modal.d.ts +5 -0
- package/dist/reports/rsmp/components/rsmp-create-modal.js +7 -0
- package/dist/reports/rsmp/components/rsmp-preview-modal.d.ts +11 -0
- package/dist/reports/rsmp/components/rsmp-preview-modal.js +47 -0
- package/dist/reports/rsmp/components/rsmp-types.d.ts +44 -0
- package/dist/reports/rsmp/components/rsmp-types.js +1 -0
- package/dist/reports/rsmp/components/rsmp-utils.d.ts +5 -0
- package/dist/reports/rsmp/components/rsmp-utils.js +41 -0
- package/dist/reports/rsmp/lib/rsmp-grouping.d.ts +14 -0
- package/dist/reports/rsmp/lib/rsmp-grouping.js +75 -0
- package/dist/reports/stock-card/_components/create-form.d.ts +13 -0
- package/dist/reports/stock-card/_components/create-form.js +39 -0
- package/dist/reports/stock-card/_components/document-preview.d.ts +7 -0
- package/dist/reports/stock-card/_components/document-preview.js +29 -0
- package/dist/reports/stock-card/types.d.ts +31 -0
- package/dist/reports/stock-card/types.js +1 -0
- package/dist/reports/stock-card/utils.d.ts +32 -0
- package/dist/reports/stock-card/utils.js +248 -0
- package/dist/reports/wmr/_components/create-form.d.ts +22 -0
- package/dist/reports/wmr/_components/create-form.js +61 -0
- package/dist/reports/wmr/_components/document-preview.d.ts +10 -0
- package/dist/reports/wmr/_components/document-preview.js +59 -0
- package/dist/reports/wmr/types.d.ts +45 -0
- package/dist/reports/wmr/types.js +1 -0
- package/dist/reports/wmr/utils.d.ts +32 -0
- package/dist/reports/wmr/utils.js +343 -0
- package/dist/styles.css +4492 -0
- package/extraction-manifest.json +620 -0
- package/package.json +197 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { Button } from "../../../internal/components/ui/button.js";
|
|
5
|
+
import { DateInput } from "../../../internal/components/ui/date-input.js";
|
|
6
|
+
import { Input } from "../../../internal/components/ui/input.js";
|
|
7
|
+
import { Label } from "../../../internal/components/ui/label.js";
|
|
8
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../internal/components/ui/tabs.js";
|
|
9
|
+
import { ConfigurableFormLayout, } from "../../../internal/components/configurable-form-layout.js";
|
|
10
|
+
import { EMPTY_ITEM_DRAFT } from "../types.js";
|
|
11
|
+
import { calcCarryingAmount, calcLineDisposalTotal, calcTotalCost, fmtNum } from "../utils.js";
|
|
12
|
+
const fieldInput = "bg-background text-foreground placeholder:text-muted-foreground/70 h-9 w-full rounded-md border px-3 py-2 text-sm";
|
|
13
|
+
const numericInput = `${fieldInput} text-right`;
|
|
14
|
+
export function IiruspCreateForm({ form, items, currentRole, canEditHeader, canEditInventory, canEditDisposal, canManageRows, activeTab, formError, onTabChange, onFormChange, onItemsChange, }) {
|
|
15
|
+
const setField = (key, value) => {
|
|
16
|
+
onFormChange({ ...form, [key]: value });
|
|
17
|
+
};
|
|
18
|
+
const setItem = (index, key, value) => {
|
|
19
|
+
onItemsChange(items.map((item, i) => (i === index ? { ...item, [key]: value } : item)));
|
|
20
|
+
};
|
|
21
|
+
const formatOptionalNumber = (value) => {
|
|
22
|
+
if (value === null || value === undefined)
|
|
23
|
+
return "";
|
|
24
|
+
if (typeof value === "string" && value.trim().length === 0)
|
|
25
|
+
return "";
|
|
26
|
+
return fmtNum(value);
|
|
27
|
+
};
|
|
28
|
+
const itemCalculationKey = items
|
|
29
|
+
.map(item => `${item.qty}|${item.unitCost}|${item.accumulatedImpairmentLosses}|${item.sale}|${item.transfer}|${item.destruction}`)
|
|
30
|
+
.join(",");
|
|
31
|
+
// Recompute derived per-row numbers whenever inputs change.
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
let dirty = false;
|
|
34
|
+
const next = items.map(item => {
|
|
35
|
+
const totalCost = calcTotalCost(item.qty, item.unitCost);
|
|
36
|
+
const carryingAmount = calcCarryingAmount(totalCost, item.accumulatedImpairmentLosses);
|
|
37
|
+
const lineTotal = canEditDisposal
|
|
38
|
+
? calcLineDisposalTotal(item.sale, item.transfer, item.destruction)
|
|
39
|
+
: item.total;
|
|
40
|
+
if (item.totalCost !== totalCost ||
|
|
41
|
+
item.carryingAmount !== carryingAmount ||
|
|
42
|
+
item.total !== lineTotal) {
|
|
43
|
+
dirty = true;
|
|
44
|
+
return { ...item, totalCost, carryingAmount, total: lineTotal };
|
|
45
|
+
}
|
|
46
|
+
return item;
|
|
47
|
+
});
|
|
48
|
+
if (dirty)
|
|
49
|
+
onItemsChange(next);
|
|
50
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
|
+
}, [
|
|
52
|
+
canEditDisposal,
|
|
53
|
+
itemCalculationKey,
|
|
54
|
+
]);
|
|
55
|
+
const addRow = () => {
|
|
56
|
+
if (!canManageRows)
|
|
57
|
+
return;
|
|
58
|
+
onItemsChange([...items, { ...EMPTY_ITEM_DRAFT }]);
|
|
59
|
+
};
|
|
60
|
+
const removeRow = (index) => {
|
|
61
|
+
if (!canManageRows)
|
|
62
|
+
return;
|
|
63
|
+
onItemsChange(items.filter((_, i) => i !== index));
|
|
64
|
+
};
|
|
65
|
+
const fields = [
|
|
66
|
+
{
|
|
67
|
+
id: "asAtDate",
|
|
68
|
+
label: "As at *",
|
|
69
|
+
render: () => (_jsx(DateInput, { value: form.asAtDate ?? "", onValueChange: value => setField("asAtDate", value), disabled: !canEditHeader })),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "fundCluster",
|
|
73
|
+
label: "Fund Cluster *",
|
|
74
|
+
render: () => (_jsx(Input, { value: form.fundCluster, onChange: e => setField("fundCluster", e.target.value), placeholder: "e.g. 101", disabled: !canEditHeader })),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "entityName",
|
|
78
|
+
label: "Entity Name *",
|
|
79
|
+
fullWidth: true,
|
|
80
|
+
render: () => (_jsx(Input, { value: form.entityName, onChange: e => setField("entityName", e.target.value), placeholder: "Entity Name", disabled: !canEditHeader })),
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "nameOfAccountableOfficer",
|
|
84
|
+
label: "Requested by",
|
|
85
|
+
render: () => (_jsx(Input, { value: form.nameOfAccountableOfficer, onChange: e => setField("nameOfAccountableOfficer", e.target.value), disabled: !canEditHeader })),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "designation",
|
|
89
|
+
label: "Requested by designation",
|
|
90
|
+
render: () => (_jsx(Input, { value: form.designation, onChange: e => setField("designation", e.target.value), disabled: !canEditHeader })),
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "station",
|
|
94
|
+
label: "Station",
|
|
95
|
+
render: () => (_jsx(Input, { value: form.station, onChange: e => setField("station", e.target.value), disabled: !canEditHeader })),
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "witnessDispositionDate",
|
|
99
|
+
label: "Date Disposition Witnessed",
|
|
100
|
+
render: () => (_jsx(DateInput, { value: form.witnessDispositionDate ?? "", onValueChange: value => setField("witnessDispositionDate", value), disabled: !canEditDisposal })),
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
return (_jsxs("div", { className: "flex flex-col gap-3", children: [formError && (_jsx("div", { className: "rounded border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700", children: formError })), _jsxs(Tabs, { value: activeTab, onValueChange: onTabChange, className: "flex flex-col", children: [_jsxs(TabsList, { className: "grid w-full grid-cols-2", children: [_jsx(TabsTrigger, { value: "basic", children: "Header" }), _jsx(TabsTrigger, { value: "items", children: "Inventory Items" })] }), _jsxs(TabsContent, { value: "basic", className: "mt-3 space-y-3", children: [_jsx(ConfigurableFormLayout, { formKey: "iirusp-basic-info", fields: fields, header: _jsxs("p", { className: "bg-muted/45 text-muted-foreground rounded border px-3 py-2 text-[11px]", children: ["Role mode: ", _jsx("span", { className: "font-semibold", children: currentRole ?? "unknown" }), ". Requestor fills Requested by + Inventory. Auditor/Approver fill Inspection and Disposal."] }) }), _jsxs("p", { className: "bg-muted/45 text-muted-foreground rounded border px-3 py-2 text-[11px]", children: ["Approver signatories (Requested by, Approved by, Inspection Officer, Witness) are sourced from the office's", " ", _jsx("span", { className: "font-mono", children: "document_approvers" }), " template and created automatically on save."] })] }), _jsxs(TabsContent, { value: "items", className: "mt-3 space-y-3", children: [_jsxs("div", { className: "bg-muted/45 text-muted-foreground rounded border px-3 py-2 text-xs", children: ["Inventory rows: ", _jsx("span", { className: "font-semibold", children: items.length }), ". Scroll down to complete each section."] }), items.map((item, index) => (_jsxs("div", { className: "bg-card text-card-foreground space-y-4 rounded-lg border p-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-3 border-b pb-3", children: [_jsxs("div", { children: [_jsxs("p", { className: "text-sm font-semibold", children: ["Item ", index + 1] }), _jsx("p", { className: "text-muted-foreground text-xs", children: item.particularsArticles || item.propertyNo || "New inventory item" })] }), canManageRows ? (_jsx(Button, { type: "button", size: "sm", variant: "outline", onClick: () => removeRow(index), children: "Remove" })) : null] }), _jsxs("section", { className: "space-y-3", children: [_jsx("h4", { className: "text-muted-foreground text-xs font-semibold uppercase", children: "Inventory" }), [
|
|
104
|
+
["Date Acquired", "dateAcquired", "date"],
|
|
105
|
+
["Particulars / Articles", "particularsArticles", "text"],
|
|
106
|
+
["Property No.", "propertyNo", "text"],
|
|
107
|
+
["Quantity", "qty", "number"],
|
|
108
|
+
["Unit Cost", "unitCost", "number"],
|
|
109
|
+
["Accumulated Impairment Losses", "accumulatedImpairmentLosses", "number"],
|
|
110
|
+
["Remarks", "remarks", "text"],
|
|
111
|
+
].map(([label, key, type]) => (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { children: label }), _jsx("input", { type: type, step: type === "number" ? "0.01" : undefined, value: item[key] ?? "", onChange: event => setItem(index, key, event.target.value), className: type === "number" ? numericInput : fieldInput, disabled: !canEditInventory })] }, key))), _jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { children: "Total Cost" }), _jsx("div", { className: "bg-muted/45 rounded-md border px-3 py-2 text-right text-sm font-medium", children: fmtNum(item.totalCost) })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { children: "Carrying Amount" }), _jsx("div", { className: "bg-muted/45 rounded-md border px-3 py-2 text-right text-sm font-medium", children: fmtNum(item.carryingAmount) })] })] })] }), _jsxs("section", { className: "space-y-3 border-t pt-4", children: [_jsx("h4", { className: "text-muted-foreground text-xs font-semibold uppercase", children: "Inspection and Disposal" }), [
|
|
112
|
+
["Sale", "sale", "number"],
|
|
113
|
+
["Transfer", "transfer", "number"],
|
|
114
|
+
["Destruction", "destruction", "number"],
|
|
115
|
+
["Others (Specify)", "othersSpecify", "text"],
|
|
116
|
+
["Appraised Value", "appraisedValue", "number"],
|
|
117
|
+
].map(([label, key, type]) => (_jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { children: label }), _jsx("input", { type: type, step: type === "number" ? "0.01" : undefined, value: item[key] ?? "", onChange: event => setItem(index, key, event.target.value), className: type === "number" ? numericInput : fieldInput, disabled: !canEditDisposal })] }, key))), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { children: "Disposal Total" }), _jsx("div", { className: "bg-muted/45 rounded-md border px-3 py-2 text-right text-sm font-medium", children: formatOptionalNumber(item.total) })] })] }), _jsxs("section", { className: "space-y-3 border-t pt-4", children: [_jsx("h4", { className: "text-muted-foreground text-xs font-semibold uppercase", children: "Record of Sales" }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { children: "OR No." }), _jsx("input", { value: item.orNo, onChange: event => setItem(index, "orNo", event.target.value), className: fieldInput, disabled: !canEditDisposal })] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Label, { children: "Amount" }), _jsx("input", { type: "number", step: "0.01", value: item.amount, onChange: event => setItem(index, "amount", event.target.value), className: numericInput, disabled: !canEditDisposal })] })] })] }, item.sourceIssuedItemId ?? index))), items.length === 0 ? (_jsx("div", { className: "text-muted-foreground rounded-md border border-dashed p-4 text-center text-sm", children: "No items yet." })) : null, canManageRows ? (_jsx(Button, { type: "button", size: "sm", variant: "outline", onClick: addRow, children: "+ Add Item" })) : (_jsx("p", { className: "text-xs text-muted-foreground", children: "Rows are generated from selected issued items above. Use selection checkboxes to add or remove rows." }))] })] })] }));
|
|
118
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IiruspItem, IiruspRecord } from "../types.js";
|
|
2
|
+
interface IiruspDocumentPreviewProps {
|
|
3
|
+
record: IiruspRecord;
|
|
4
|
+
/** Items to render. Falls back to record.items if omitted. */
|
|
5
|
+
items?: IiruspItem[];
|
|
6
|
+
}
|
|
7
|
+
export declare function IiruspDocumentPreview({ record, items: itemsProp }: IiruspDocumentPreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { fmtNum, formatIiruspDate, sumItems } from "../utils.js";
|
|
5
|
+
const FIXED_ROWS = 16;
|
|
6
|
+
function chunkItemsForPreview(items) {
|
|
7
|
+
if (items.length === 0)
|
|
8
|
+
return [[]];
|
|
9
|
+
const pages = [];
|
|
10
|
+
for (let index = 0; index < items.length; index += FIXED_ROWS) {
|
|
11
|
+
pages.push(items.slice(index, index + FIXED_ROWS));
|
|
12
|
+
}
|
|
13
|
+
return pages;
|
|
14
|
+
}
|
|
15
|
+
function Underline({ children, width }) {
|
|
16
|
+
return (_jsx("span", { style: {
|
|
17
|
+
boxSizing: "border-box",
|
|
18
|
+
display: "inline-block",
|
|
19
|
+
borderBottom: "1px solid #000",
|
|
20
|
+
minWidth: width ?? "80px",
|
|
21
|
+
height: "5.8mm",
|
|
22
|
+
padding: "0.5mm 1mm 1.8mm",
|
|
23
|
+
textAlign: "center",
|
|
24
|
+
lineHeight: 1,
|
|
25
|
+
verticalAlign: "bottom",
|
|
26
|
+
}, children: children }));
|
|
27
|
+
}
|
|
28
|
+
function LabeledLine({ label, children, align = "left", }) {
|
|
29
|
+
return (_jsxs("div", { style: { display: "flex", alignItems: "flex-end", gap: "1.8mm", width: "100%" }, children: [_jsx("span", { style: {
|
|
30
|
+
flex: "0 0 auto",
|
|
31
|
+
fontWeight: "bold",
|
|
32
|
+
paddingBottom: "1.4mm",
|
|
33
|
+
lineHeight: 1,
|
|
34
|
+
}, children: label }), _jsx("span", { style: {
|
|
35
|
+
boxSizing: "border-box",
|
|
36
|
+
flex: "1 1 auto",
|
|
37
|
+
minWidth: 0,
|
|
38
|
+
height: "5.8mm",
|
|
39
|
+
borderBottom: "1px solid #000",
|
|
40
|
+
padding: "0.7mm 1mm 1.7mm",
|
|
41
|
+
lineHeight: 1,
|
|
42
|
+
textAlign: align,
|
|
43
|
+
}, children: children })] }));
|
|
44
|
+
}
|
|
45
|
+
function findSignature(signatures, sequenceNo) {
|
|
46
|
+
return signatures?.find(s => s.sequenceNo === sequenceNo);
|
|
47
|
+
}
|
|
48
|
+
function witnessDispositionParts(value) {
|
|
49
|
+
if (!value)
|
|
50
|
+
return { day: "", month: "", year: "" };
|
|
51
|
+
const d = new Date(value);
|
|
52
|
+
if (Number.isNaN(d.getTime()))
|
|
53
|
+
return { day: "", month: "", year: "" };
|
|
54
|
+
return {
|
|
55
|
+
day: String(d.getDate()),
|
|
56
|
+
month: d.toLocaleDateString("en-PH", { month: "long" }),
|
|
57
|
+
year: String(d.getFullYear()),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function hasInputValue(value) {
|
|
61
|
+
if (value === null || value === undefined)
|
|
62
|
+
return false;
|
|
63
|
+
if (typeof value === "number")
|
|
64
|
+
return !Number.isNaN(value);
|
|
65
|
+
return value.trim().length > 0;
|
|
66
|
+
}
|
|
67
|
+
export function IiruspDocumentPreview({ record, items: itemsProp }) {
|
|
68
|
+
const items = React.useMemo(() => itemsProp ?? record.items ?? [], [itemsProp, record.items]);
|
|
69
|
+
const itemPages = React.useMemo(() => chunkItemsForPreview(items), [items]);
|
|
70
|
+
const [activePage, setActivePage] = React.useState(0);
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
setActivePage(prev => Math.min(prev, itemPages.length - 1));
|
|
73
|
+
}, [itemPages.length]);
|
|
74
|
+
const pageItems = itemPages[activePage] ?? [];
|
|
75
|
+
const rows = Array.from({ length: FIXED_ROWS }, (_, i) => pageItems[i] ?? null);
|
|
76
|
+
const isLastPage = activePage === itemPages.length - 1;
|
|
77
|
+
const totals = {
|
|
78
|
+
qty: sumItems(items, "qty"),
|
|
79
|
+
totalCost: sumItems(items, "totalCost"),
|
|
80
|
+
accImpair: sumItems(items, "accumulatedImpairmentLosses"),
|
|
81
|
+
carrying: sumItems(items, "carryingAmount"),
|
|
82
|
+
sale: sumItems(items, "sale"),
|
|
83
|
+
transfer: sumItems(items, "transfer"),
|
|
84
|
+
destruction: sumItems(items, "destruction"),
|
|
85
|
+
total: sumItems(items, "total"),
|
|
86
|
+
appraisedValue: sumItems(items, "appraisedValue"),
|
|
87
|
+
amount: sumItems(items, "amount"),
|
|
88
|
+
};
|
|
89
|
+
const hasDisposalValues = {
|
|
90
|
+
sale: items.some(item => hasInputValue(item.sale)),
|
|
91
|
+
transfer: items.some(item => hasInputValue(item.transfer)),
|
|
92
|
+
destruction: items.some(item => hasInputValue(item.destruction)),
|
|
93
|
+
total: items.some(item => hasInputValue(item.total)),
|
|
94
|
+
appraisedValue: items.some(item => hasInputValue(item.appraisedValue)),
|
|
95
|
+
amount: items.some(item => hasInputValue(item.amount)),
|
|
96
|
+
};
|
|
97
|
+
const requested = findSignature(record.signatures, 1);
|
|
98
|
+
const approved = findSignature(record.signatures, 2);
|
|
99
|
+
const inspection = findSignature(record.signatures, 3);
|
|
100
|
+
const witness = findSignature(record.signatures, 4);
|
|
101
|
+
const wd = witnessDispositionParts(record.witnessDispositionDate);
|
|
102
|
+
const b = "1px solid #000";
|
|
103
|
+
const headerTh = {
|
|
104
|
+
border: b,
|
|
105
|
+
boxSizing: "border-box",
|
|
106
|
+
padding: "3px 2px",
|
|
107
|
+
fontSize: "5.9pt",
|
|
108
|
+
fontWeight: "bold",
|
|
109
|
+
textAlign: "center",
|
|
110
|
+
verticalAlign: "middle",
|
|
111
|
+
lineHeight: 1.2,
|
|
112
|
+
whiteSpace: "normal",
|
|
113
|
+
overflowWrap: "anywhere",
|
|
114
|
+
wordBreak: "normal",
|
|
115
|
+
};
|
|
116
|
+
const sectionTh = {
|
|
117
|
+
...headerTh,
|
|
118
|
+
padding: "4px 3px",
|
|
119
|
+
fontSize: "6.2pt",
|
|
120
|
+
lineHeight: 1.25,
|
|
121
|
+
letterSpacing: "0.05px",
|
|
122
|
+
};
|
|
123
|
+
const numTh = {
|
|
124
|
+
border: b,
|
|
125
|
+
boxSizing: "border-box",
|
|
126
|
+
padding: "2.5px 1px",
|
|
127
|
+
fontSize: "5.5pt",
|
|
128
|
+
textAlign: "center",
|
|
129
|
+
verticalAlign: "middle",
|
|
130
|
+
fontStyle: "italic",
|
|
131
|
+
lineHeight: 1.15,
|
|
132
|
+
};
|
|
133
|
+
const td = {
|
|
134
|
+
border: b,
|
|
135
|
+
boxSizing: "border-box",
|
|
136
|
+
padding: "3px 2.5px",
|
|
137
|
+
fontSize: "5.9pt",
|
|
138
|
+
lineHeight: 1.2,
|
|
139
|
+
verticalAlign: "middle",
|
|
140
|
+
minHeight: "20px",
|
|
141
|
+
};
|
|
142
|
+
const dateTd = {
|
|
143
|
+
...td,
|
|
144
|
+
height: "auto",
|
|
145
|
+
minHeight: "19px",
|
|
146
|
+
whiteSpace: "normal",
|
|
147
|
+
overflowWrap: "anywhere",
|
|
148
|
+
wordBreak: "normal",
|
|
149
|
+
lineHeight: 1.2,
|
|
150
|
+
};
|
|
151
|
+
const numTd = {
|
|
152
|
+
...td,
|
|
153
|
+
padding: "3px 2px",
|
|
154
|
+
fontSize: "5.7pt",
|
|
155
|
+
textAlign: "right",
|
|
156
|
+
whiteSpace: "nowrap",
|
|
157
|
+
};
|
|
158
|
+
const wrappedTextTd = {
|
|
159
|
+
...td,
|
|
160
|
+
whiteSpace: "normal",
|
|
161
|
+
overflowWrap: "anywhere",
|
|
162
|
+
wordBreak: "normal",
|
|
163
|
+
};
|
|
164
|
+
const sectionSplitLeft = { borderLeft: "2px solid #000" };
|
|
165
|
+
const showPaginationControls = itemPages.length > 1;
|
|
166
|
+
const canGoPrev = activePage > 0;
|
|
167
|
+
const canGoNext = activePage < itemPages.length - 1;
|
|
168
|
+
const navButtonStyle = {
|
|
169
|
+
border: "1px solid #94a3b8",
|
|
170
|
+
background: "#fff",
|
|
171
|
+
padding: "2px 8px",
|
|
172
|
+
fontSize: "7pt",
|
|
173
|
+
borderRadius: "4px",
|
|
174
|
+
cursor: "pointer",
|
|
175
|
+
};
|
|
176
|
+
const navButtonDisabledStyle = {
|
|
177
|
+
opacity: 0.45,
|
|
178
|
+
cursor: "not-allowed",
|
|
179
|
+
};
|
|
180
|
+
return (_jsxs("div", { "data-pdf-page": "true", "data-pdf-orientation": "landscape", style: {
|
|
181
|
+
width: "297mm",
|
|
182
|
+
minHeight: "210mm",
|
|
183
|
+
margin: "0 auto",
|
|
184
|
+
padding: "4mm 7mm 5mm",
|
|
185
|
+
fontFamily: "Arial, sans-serif",
|
|
186
|
+
fontSize: "7pt",
|
|
187
|
+
backgroundColor: "#fff",
|
|
188
|
+
color: "#000",
|
|
189
|
+
boxSizing: "border-box",
|
|
190
|
+
position: "relative",
|
|
191
|
+
}, children: [showPaginationControls ? (_jsxs("div", { style: {
|
|
192
|
+
width: "269mm",
|
|
193
|
+
margin: "2mm auto 0",
|
|
194
|
+
display: "flex",
|
|
195
|
+
alignItems: "center",
|
|
196
|
+
justifyContent: "space-between",
|
|
197
|
+
fontSize: "7pt",
|
|
198
|
+
fontFamily: "Arial, sans-serif",
|
|
199
|
+
}, children: [_jsx("button", { type: "button", onClick: () => setActivePage(prev => Math.max(prev - 1, 0)), disabled: !canGoPrev, style: {
|
|
200
|
+
...navButtonStyle,
|
|
201
|
+
...(canGoPrev ? undefined : navButtonDisabledStyle),
|
|
202
|
+
}, children: "Previous Page" }), _jsxs("div", { style: { fontWeight: 600 }, children: ["Page ", activePage + 1, " of ", itemPages.length] }), _jsx("button", { type: "button", onClick: () => setActivePage(prev => Math.min(prev + 1, itemPages.length - 1)), disabled: !canGoNext, style: {
|
|
203
|
+
...navButtonStyle,
|
|
204
|
+
...(canGoNext ? undefined : navButtonDisabledStyle),
|
|
205
|
+
}, children: "Next Page" })] })) : null, _jsxs("div", { style: { width: "100%", marginTop: showPaginationControls ? "2mm" : "0" }, children: [_jsx("div", { style: { textAlign: "right", fontStyle: "italic", fontSize: "7pt", marginBottom: "1mm" }, children: "Annex A.10" }), _jsxs("div", { style: { textAlign: "center", marginBottom: "4mm" }, children: [_jsx("div", { style: {
|
|
206
|
+
fontSize: "10pt",
|
|
207
|
+
fontWeight: "bold",
|
|
208
|
+
letterSpacing: "0.2px",
|
|
209
|
+
lineHeight: 1.2,
|
|
210
|
+
}, children: "INVENTORY AND INSPECTION REPORT OF UNSERVICEABLE SEMI-EXPENDABLE PROPERTY" }), _jsxs("div", { style: { fontSize: "8pt", marginTop: "1.5mm" }, children: ["As at ", _jsx(Underline, { width: "340px", children: formatIiruspDate(record.asAtDate) || " " })] })] }), _jsxs("div", { style: {
|
|
211
|
+
display: "flex",
|
|
212
|
+
justifyContent: "space-between",
|
|
213
|
+
marginBottom: "2.5mm",
|
|
214
|
+
fontSize: "7.5pt",
|
|
215
|
+
}, children: [_jsx("div", { style: { width: "66%" }, children: _jsx(LabeledLine, { label: "Entity Name:", align: "center", children: record.entityName || " " }) }), _jsx("div", { style: { width: "28%" }, children: _jsx(LabeledLine, { label: "Fund Cluster:", align: "center", children: record.fundCluster || " " }) })] }), _jsxs("div", { style: {
|
|
216
|
+
display: "grid",
|
|
217
|
+
gridTemplateColumns: "42% 26% 26%",
|
|
218
|
+
columnGap: "2%",
|
|
219
|
+
width: "90%",
|
|
220
|
+
marginRight: "auto",
|
|
221
|
+
alignItems: "start",
|
|
222
|
+
marginBottom: "4mm",
|
|
223
|
+
fontSize: "7.5pt",
|
|
224
|
+
}, children: [_jsxs("div", { style: { textAlign: "left" }, children: [_jsx(Underline, { width: "96%", children: record.nameOfAccountableOfficer || " " }), _jsx("div", { style: {
|
|
225
|
+
fontSize: "5.8pt",
|
|
226
|
+
fontStyle: "italic",
|
|
227
|
+
marginTop: "0.8mm",
|
|
228
|
+
paddingLeft: "4mm",
|
|
229
|
+
}, children: "(Name of Accountable Officer)" })] }), _jsxs("div", { style: { textAlign: "left" }, children: [_jsx(Underline, { width: "96%", children: record.designation || " " }), _jsx("div", { style: {
|
|
230
|
+
fontSize: "5.8pt",
|
|
231
|
+
fontStyle: "italic",
|
|
232
|
+
marginTop: "0.8mm",
|
|
233
|
+
paddingLeft: "3.5mm",
|
|
234
|
+
}, children: "(Designation)" })] }), _jsxs("div", { style: { textAlign: "left" }, children: [_jsx(Underline, { width: "96%", children: record.station || " " }), _jsx("div", { style: {
|
|
235
|
+
fontSize: "5.8pt",
|
|
236
|
+
fontStyle: "italic",
|
|
237
|
+
marginTop: "0.8mm",
|
|
238
|
+
paddingLeft: "3.5mm",
|
|
239
|
+
}, children: "(Station)" })] })] }), _jsxs("table", { style: {
|
|
240
|
+
width: "100%",
|
|
241
|
+
borderCollapse: "collapse",
|
|
242
|
+
tableLayout: "fixed",
|
|
243
|
+
marginTop: "0.6mm",
|
|
244
|
+
}, children: [_jsxs("colgroup", { children: [_jsx("col", { style: { width: "5.5%" } }), _jsx("col", { style: { width: "12.0%" } }), _jsx("col", { style: { width: "8.0%" } }), _jsx("col", { style: { width: "3.5%" } }), _jsx("col", { style: { width: "5.5%" } }), _jsx("col", { style: { width: "5.5%" } }), _jsx("col", { style: { width: "6.5%" } }), _jsx("col", { style: { width: "5.5%" } }), _jsx("col", { style: { width: "6.0%" } }), _jsx("col", { style: { width: "4.5%" } }), _jsx("col", { style: { width: "4.5%" } }), _jsx("col", { style: { width: "5.0%" } }), _jsx("col", { style: { width: "5.5%" } }), _jsx("col", { style: { width: "5.0%" } }), _jsx("col", { style: { width: "5.0%" } }), _jsx("col", { style: { width: "6.5%" } }), _jsx("col", { style: { width: "6.0%" } })] }), _jsxs("thead", { children: [_jsxs("tr", { children: [_jsx("th", { colSpan: 9, style: sectionTh, children: "INVENTORY" }), _jsx("th", { colSpan: 6, style: { ...sectionTh, ...sectionSplitLeft }, children: "INSPECTION AND DISPOSAL" }), _jsx("th", { colSpan: 2, style: sectionTh, children: "RECORD OF SALES" })] }), _jsxs("tr", { children: [_jsx("th", { style: headerTh, children: "Date Acquired" }), _jsx("th", { style: headerTh, children: "Particulars/Articles" }), _jsxs("th", { style: { ...headerTh, wordBreak: "break-word", letterSpacing: "-0.2px" }, children: ["Semi-expendable", _jsx("br", {}), "Property No."] }), _jsx("th", { style: headerTh, children: "Qty" }), _jsx("th", { style: headerTh, children: "Unit Cost" }), _jsx("th", { style: headerTh, children: "Total Cost" }), _jsxs("th", { style: {
|
|
245
|
+
...headerTh,
|
|
246
|
+
wordBreak: "break-word",
|
|
247
|
+
fontSize: "5pt",
|
|
248
|
+
letterSpacing: "-0.2px",
|
|
249
|
+
}, children: ["Accumulated", _jsx("br", {}), "Impairment", _jsx("br", {}), "Losses"] }), _jsx("th", { style: headerTh, children: "Carrying Amount" }), _jsx("th", { style: headerTh, children: "Remarks" }), _jsx("th", { style: { ...headerTh, ...sectionSplitLeft }, children: "Sale" }), _jsx("th", { style: headerTh, children: "Transfer" }), _jsx("th", { style: headerTh, children: "Destruction" }), _jsxs("th", { style: { ...headerTh, wordBreak: "break-word" }, children: ["Others", _jsx("br", {}), "(Specify)"] }), _jsx("th", { style: headerTh, children: "Total" }), _jsxs("th", { style: { ...headerTh, wordBreak: "break-word" }, children: ["Appraised", _jsx("br", {}), "Value"] }), _jsx("th", { style: headerTh, children: "OR No." }), _jsx("th", { style: headerTh, children: "Amount" })] }), _jsx("tr", { children: [
|
|
250
|
+
"(1)",
|
|
251
|
+
"(2)",
|
|
252
|
+
"(3)",
|
|
253
|
+
"(4)",
|
|
254
|
+
"(5)",
|
|
255
|
+
"(6)",
|
|
256
|
+
"(7)",
|
|
257
|
+
"(8)",
|
|
258
|
+
"(9)",
|
|
259
|
+
"(10)",
|
|
260
|
+
"(11)",
|
|
261
|
+
"(12)",
|
|
262
|
+
"(13)",
|
|
263
|
+
"(14)",
|
|
264
|
+
"(15)",
|
|
265
|
+
"(16)",
|
|
266
|
+
"(17)",
|
|
267
|
+
].map((n, index) => (_jsx("th", { style: index === 9 ? { ...numTh, ...sectionSplitLeft } : numTh, children: n }, n))) })] }), _jsxs("tbody", { children: [rows.map((item, idx) => (_jsxs("tr", { children: [_jsx("td", { style: dateTd, children: item ? formatIiruspDate(item.dateAcquired) : " " }), _jsx("td", { style: wrappedTextTd, title: item?.particularsArticles || "", children: item?.particularsArticles || " " }), _jsx("td", { style: wrappedTextTd, title: item?.propertyNo || "", children: item?.propertyNo || " " }), _jsx("td", { style: numTd, children: item ? fmtNum(item.qty) : " " }), _jsx("td", { style: numTd, children: item ? fmtNum(item.unitCost) : " " }), _jsx("td", { style: numTd, children: item ? fmtNum(item.totalCost) : " " }), _jsx("td", { style: numTd, children: item ? fmtNum(item.accumulatedImpairmentLosses) : " " }), _jsx("td", { style: numTd, children: item ? fmtNum(item.carryingAmount) : " " }), _jsx("td", { style: wrappedTextTd, title: item?.remarks || "", children: item?.remarks || " " }), _jsx("td", { style: { ...numTd, ...sectionSplitLeft }, children: item && hasInputValue(item.sale) ? fmtNum(item.sale) : " " }), _jsx("td", { style: numTd, children: item && hasInputValue(item.transfer) ? fmtNum(item.transfer) : " " }), _jsx("td", { style: numTd, children: item && hasInputValue(item.destruction) ? fmtNum(item.destruction) : " " }), _jsx("td", { style: wrappedTextTd, title: item?.othersSpecify || "", children: item?.othersSpecify || " " }), _jsx("td", { style: numTd, children: item && hasInputValue(item.total) ? fmtNum(item.total) : " " }), _jsx("td", { style: numTd, children: item && hasInputValue(item.appraisedValue) ? fmtNum(item.appraisedValue) : " " }), _jsx("td", { style: wrappedTextTd, title: item?.orNo || "", children: item?.orNo || " " }), _jsx("td", { style: numTd, children: item && hasInputValue(item.amount) ? fmtNum(item.amount) : " " })] }, idx))), isLastPage ? (_jsxs("tr", { children: [_jsx("td", { colSpan: 3, style: { ...td, textAlign: "center" } }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: fmtNum(totals.qty) }), _jsx("td", { style: numTd, children: " " }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: fmtNum(totals.totalCost) }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: fmtNum(totals.accImpair) }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: fmtNum(totals.carrying) }), _jsx("td", { style: td, children: " " }), _jsx("td", { style: { ...numTd, ...sectionSplitLeft, fontWeight: "bold" }, children: hasDisposalValues.sale ? fmtNum(totals.sale) : " " }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: hasDisposalValues.transfer ? fmtNum(totals.transfer) : " " }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: hasDisposalValues.destruction ? fmtNum(totals.destruction) : " " }), _jsx("td", { style: td, children: " " }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: hasDisposalValues.total ? fmtNum(totals.total) : " " }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: hasDisposalValues.appraisedValue ? fmtNum(totals.appraisedValue) : " " }), _jsx("td", { style: td, children: " " }), _jsx("td", { style: { ...numTd, fontWeight: "bold" }, children: hasDisposalValues.amount ? fmtNum(totals.amount) : " " })] })) : null] })] }), isLastPage ? (_jsxs(_Fragment, { children: [_jsx("table", { style: { width: "100%", borderCollapse: "collapse", marginTop: "0" }, children: _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { style: {
|
|
268
|
+
border: b,
|
|
269
|
+
borderTop: b,
|
|
270
|
+
borderRight: "2px solid #000",
|
|
271
|
+
padding: "4px 5px",
|
|
272
|
+
width: "56%",
|
|
273
|
+
verticalAlign: "top",
|
|
274
|
+
fontSize: "6.1pt",
|
|
275
|
+
lineHeight: 1.2,
|
|
276
|
+
height: "18mm",
|
|
277
|
+
}, children: "I HEREBY request inspection and disposition, pursuant to Section 79 of P.D. No. 1445, of the property enumerated above." }), _jsx("td", { style: {
|
|
278
|
+
border: b,
|
|
279
|
+
borderTop: b,
|
|
280
|
+
borderLeft: "none",
|
|
281
|
+
borderRight: "none",
|
|
282
|
+
borderBottom: "none",
|
|
283
|
+
padding: "4px 5px",
|
|
284
|
+
width: "25%",
|
|
285
|
+
verticalAlign: "top",
|
|
286
|
+
fontSize: "6.1pt",
|
|
287
|
+
lineHeight: 1.2,
|
|
288
|
+
height: "18mm",
|
|
289
|
+
}, children: "I CERTIFY that I have inspected each and every article enumerated in this report, and that the disposition made thereof was, in my judgment, the best for the public interest." }), _jsxs("td", { style: {
|
|
290
|
+
border: b,
|
|
291
|
+
borderTop: b,
|
|
292
|
+
borderLeft: "none",
|
|
293
|
+
borderBottom: "none",
|
|
294
|
+
padding: "4px 5px",
|
|
295
|
+
width: "19%",
|
|
296
|
+
verticalAlign: "top",
|
|
297
|
+
fontSize: "6.1pt",
|
|
298
|
+
lineHeight: 1.2,
|
|
299
|
+
height: "18mm",
|
|
300
|
+
}, children: ["I CERTIFY that I have witnessed the disposition of the articles enumerated on this report this ", _jsx(Underline, { width: "22px", children: wd.day || " " }), " day of", " ", _jsx(Underline, { width: "60px", children: wd.month || " " }), " ", _jsx(Underline, { width: "38px", children: wd.year || " " }), "."] })] }) }) }), _jsx("table", { style: { width: "100%", borderCollapse: "collapse", marginTop: "0" }, children: _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { style: {
|
|
301
|
+
border: b,
|
|
302
|
+
borderTop: "none",
|
|
303
|
+
borderRight: "2px solid #000",
|
|
304
|
+
padding: "4px 5px",
|
|
305
|
+
width: "56%",
|
|
306
|
+
verticalAlign: "top",
|
|
307
|
+
height: "27mm",
|
|
308
|
+
}, children: _jsx(RequestedApprovalBlock, { requested: requested, approved: approved, designation: record.designation }) }), _jsx("td", { style: {
|
|
309
|
+
border: b,
|
|
310
|
+
borderTop: "none",
|
|
311
|
+
borderLeft: "none",
|
|
312
|
+
borderRight: "none",
|
|
313
|
+
padding: "4px 5px",
|
|
314
|
+
width: "25%",
|
|
315
|
+
verticalAlign: "top",
|
|
316
|
+
height: "27mm",
|
|
317
|
+
}, children: _jsx(SingleRoleSignatureBlock, { title: "Inspection Officer", signature: inspection }) }), _jsx("td", { style: {
|
|
318
|
+
border: b,
|
|
319
|
+
borderTop: "none",
|
|
320
|
+
borderLeft: "none",
|
|
321
|
+
padding: "4px 5px",
|
|
322
|
+
width: "19%",
|
|
323
|
+
verticalAlign: "top",
|
|
324
|
+
height: "27mm",
|
|
325
|
+
}, children: _jsx(SingleRoleSignatureBlock, { title: "Witness", signature: witness }) })] }) }) })] })) : null] })] }));
|
|
326
|
+
}
|
|
327
|
+
function SignatureVisual({ signature }) {
|
|
328
|
+
const name = signature?.signedByName ?? "";
|
|
329
|
+
const signatureImage = signature?.signature?.trim();
|
|
330
|
+
// Seed data uses Picsum placeholder URLs. They are not reliable/CORS-safe for
|
|
331
|
+
// html2canvas, so omit them from printable previews and retain the signer's name.
|
|
332
|
+
const canRenderSignatureImage = Boolean(signatureImage && !/^https?:\/\/picsum\.photos\//i.test(signatureImage));
|
|
333
|
+
return (_jsxs("div", { style: { textAlign: "center" }, children: [_jsx("div", { style: { height: "18px" }, children: canRenderSignatureImage && signatureImage && (
|
|
334
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
335
|
+
_jsx("img", { src: signatureImage, alt: signature?.label ?? "Signature", crossOrigin: "anonymous", style: { height: "18px", margin: "0 auto" } })) }), _jsx("div", { style: {
|
|
336
|
+
borderBottom: "1px solid #000",
|
|
337
|
+
minHeight: "7mm",
|
|
338
|
+
display: "flex",
|
|
339
|
+
alignItems: "flex-end",
|
|
340
|
+
justifyContent: "center",
|
|
341
|
+
padding: "0 1mm 1.8mm",
|
|
342
|
+
boxSizing: "border-box",
|
|
343
|
+
lineHeight: 1,
|
|
344
|
+
fontWeight: 500,
|
|
345
|
+
fontSize: "6.5pt",
|
|
346
|
+
}, children: name || " " })] }));
|
|
347
|
+
}
|
|
348
|
+
function RequestedApprovalBlock({ requested, approved, designation, }) {
|
|
349
|
+
return (_jsx("div", { style: { fontSize: "6.2pt", paddingLeft: "1mm", paddingTop: "0.5mm" }, children: _jsxs("div", { style: { display: "flex", justifyContent: "space-between" }, children: [_jsxs("div", { style: { width: "48%" }, children: [_jsx("div", { style: { marginBottom: "4mm" }, children: "Requested by:" }), _jsxs("div", { style: { textAlign: "center", width: "90%", margin: "0 auto" }, children: [_jsx(SignatureVisual, { signature: requested }), _jsx("div", { style: {
|
|
350
|
+
fontSize: "5.4pt",
|
|
351
|
+
fontStyle: "italic",
|
|
352
|
+
textAlign: "center",
|
|
353
|
+
lineHeight: 1.1,
|
|
354
|
+
marginTop: "1.2mm",
|
|
355
|
+
marginBottom: "3mm",
|
|
356
|
+
}, children: "(Signature over Printed Name of Accountable Officer)" }), _jsx("div", { style: {
|
|
357
|
+
borderBottom: "1px solid #000",
|
|
358
|
+
minHeight: "6mm",
|
|
359
|
+
display: "flex",
|
|
360
|
+
alignItems: "flex-end",
|
|
361
|
+
justifyContent: "center",
|
|
362
|
+
padding: "0 1mm 1.6mm",
|
|
363
|
+
boxSizing: "border-box",
|
|
364
|
+
lineHeight: 1,
|
|
365
|
+
fontWeight: 500,
|
|
366
|
+
fontSize: "6.5pt",
|
|
367
|
+
}, children: designation || " " }), _jsx("div", { style: {
|
|
368
|
+
fontSize: "5.4pt",
|
|
369
|
+
fontStyle: "italic",
|
|
370
|
+
textAlign: "center",
|
|
371
|
+
lineHeight: 1.1,
|
|
372
|
+
marginTop: "1.1mm",
|
|
373
|
+
}, children: "(Designation of Accountable Officer)" })] })] }), _jsxs("div", { style: { width: "48%" }, children: [_jsx("div", { style: { marginBottom: "4mm" }, children: "Approved by:" }), _jsxs("div", { style: { textAlign: "center", width: "90%", margin: "0 auto" }, children: [_jsx(SignatureVisual, { signature: approved }), _jsx("div", { style: {
|
|
374
|
+
fontSize: "5.4pt",
|
|
375
|
+
fontStyle: "italic",
|
|
376
|
+
textAlign: "center",
|
|
377
|
+
lineHeight: 1.1,
|
|
378
|
+
marginTop: "1.2mm",
|
|
379
|
+
}, children: "(Signature over Printed Name of Authorized Official)" })] })] })] }) }));
|
|
380
|
+
}
|
|
381
|
+
function SingleRoleSignatureBlock({ title, signature, }) {
|
|
382
|
+
return (_jsxs("div", { style: { fontSize: "6.2pt", paddingLeft: "1mm", paddingTop: "0.5mm" }, children: [_jsxs("div", { style: { marginBottom: "4mm" }, children: [title, ":"] }), _jsxs("div", { style: { textAlign: "center", width: "85%", margin: "0 auto" }, children: [_jsx(SignatureVisual, { signature: signature }), _jsxs("div", { style: {
|
|
383
|
+
fontSize: "5.4pt",
|
|
384
|
+
fontStyle: "italic",
|
|
385
|
+
textAlign: "center",
|
|
386
|
+
lineHeight: 1.1,
|
|
387
|
+
marginTop: "1.2mm",
|
|
388
|
+
}, children: ["(Signature over Printed Name of ", title, ")"] })] })] }));
|
|
389
|
+
}
|