import { V as C, cO as W, cq as $, fm as G, d as H, co as K, f as j, e as J, r as l, a as L, Z as Q, gJ as X, aw as Z, d9 as Y, c as S, o as x, w as o, j as s, W as ee, l as r, ds as te, aE as oe, B as ae, p as I, H as ne, N as se, h3 as ie, X as le, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as re } from "./BasicForm-dL_oCSPM.js";
import { _ as ce } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import { B as pe } from "./Table-0PViRYCf.js";
import { _ as de } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { y as me, b as ue, u as fe } from "./template-rpthWlT9.js";
import { g as ye } from "./planner-BebmniHR.js";
import { u as _e } from "./useForm-CKmgcynv.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./componentSetting-DVhNDBTO.js";
import "./ImageUpload-DUsnro3W.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./tabsView-BXskTdVh.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./propTypes-CebMRUpe.js";
import "./BasicSelect-C_uwzMkE.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./dictionary-BRse4lkf.js";
import "./index-DkvzUEqh.js";
import "./index-kKnqLkWM.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./props-CLtNejQT.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./Flex-CTSf12gq.js";
let nt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: i } = C();
    await me();
    function be(a) {
        return console.log("props?.readOnly: ", a?.readOnly), {
            addSchemas: [
                {
                    field: "reportNum",
                    label: i("hsqe.auditInspection.vesselInspection.formReportNum"),
                    component: "NInput",
                    componentProps: {
                        disabled: a?.readOnly
                    }
                },
                {
                    field: "reportDate",
                    label: i("hsqe.auditInspection.psc.raisedOn"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "date",
                        valueFormat: "yyyy-MM-dd",
                        disabled: a?.readOnly || !1
                    }
                },
                {
                    field: "startDate",
                    label: i("hsqe.auditInspection.psc.inspectionFrom"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "daterange",
                        valueFormat: "yyyy-MM-dd"
                    }
                },
                {
                    field: "countryId",
                    label: i("hsqe.auditInspection.psc.state"),
                    component: "NSelect",
                    componentProps: {
                        disabled: a?.readOnly || !1,
                        options: [
                            {
                                value: 1,
                                label: "Routine"
                            },
                            {
                                value: 2,
                                label: "Repair"
                            },
                            {
                                value: 3,
                                label: "Accompany 3rd party inspection"
                            },
                            {
                                value: 4,
                                label: "Other"
                            }
                        ]
                    }
                },
                {
                    field: "portId",
                    label: i("hsqe.auditInspection.psc.port"),
                    component: "NInput",
                    slot: "visitPlace",
                    componentProps: {
                        disabled: a?.readOnly || !1
                    }
                },
                {
                    field: "mouCode",
                    label: i("hsqe.auditInspection.psc.mou"),
                    component: "NSelect",
                    componentProps: {
                        disabled: a?.readOnly || !1,
                        options: []
                    }
                },
                {
                    field: "checkbox",
                    label: "",
                    component: "NCheckbox",
                    componentProps: {
                        disabled: a?.readOnly || !1,
                        options: [
                            {
                                value: "nilDeficiency",
                                label: i("hsqe.auditInspection.psc.nilDeficiency")
                            },
                            {
                                value: "detained",
                                label: i("hsqe.auditInspection.psc.detained")
                            }
                        ]
                    },
                    giProps: {
                        span: 1
                    }
                },
                {
                    field: "pscReport",
                    label: i("hsqe.auditInspection.psc.pscReport"),
                    component: "SingleImageUpload",
                    componentProps: (d)=>({
                            disabled: a?.readOnly || !1,
                            action: `${$().urlPrefix}/files`,
                            headers: {
                                timestamp: new Date().getTime(),
                                authorization: `${W.get(G)}`
                            },
                            onUploadChange: (u)=>{
                                console.log("file", u);
                            }
                        }),
                    giProps: {
                        span: 4
                    }
                }
            ]
        };
    }
    nt = H({
        __name: "index",
        setup (a) {
            const f = K({
                storage: localStorage
            }), d = j(), u = J(), { t: e } = C(), y = l(!1), _ = l([]), [R, { submit: ge, getFieldsValue: b, setFieldsValue: k }] = _e({
                schemas: _,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), w = L({
                width: 140,
                title: e("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (t) {
                    return console.log("record: ", t), Q(de, {
                        actions: [
                            {
                                label: e("common.optionsViewText"),
                                onClick: ()=>{}
                            },
                            {
                                label: e("common.optionsEditText"),
                                onClick: ()=>{}
                            }
                        ]
                    });
                }
            }), m = l({}), D = {
                gridProps: {
                    cols: "2"
                },
                labelWidth: 80,
                submitButtonText: e("common.searchText"),
                showAdvancedButton: !1,
                schemas: [
                    {
                        field: "namePrefix",
                        component: "NInput",
                        label: e("hsqe.planner.modal.planPort")
                    }
                ]
            }, g = [
                {
                    title: e("hsqe.question.serialNo"),
                    key: "id"
                },
                {
                    title: e("hsqe.deficiency.deficiencyCode"),
                    key: "port"
                },
                {
                    title: e("hsqe.auditInspection.psc.actionCode"),
                    key: "country"
                },
                {
                    title: e("hsqe.deficiency.dueDate"),
                    key: "expirationTime"
                },
                {
                    title: e("hsqe.deficiency.status"),
                    key: "status"
                },
                {
                    title: e("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.basicInfo.description"),
                    key: "description"
                }
            ];
            l(""), l(), l(f.get(X, ""));
            const O = be({
                readOnly: y.value
            });
            _.value = O.addSchemas;
            const N = l(!1);
            async function T() {
                const t = await ue({
                    templateCode: "pscReport",
                    uuid: d.query.uuid
                });
                console.log("res: ", t);
                const n = l({
                    ...t
                });
                console.log("formData: ", n.value), k(n.value), d.query.type == "view" && t.approveShow == 1 && t.approveStatus != 5 && (N.value = !0);
            }
            function h(t) {
                return ye({
                    ...t,
                    ...r(m)
                });
            }
            async function B() {
                console.log(b());
                const t = await fe({
                    template_code: "pscReport",
                    uuid: d.query.uuid
                });
                console.log(t);
            }
            function F() {
                u.push({
                    name: "Add_HSQE_AuditInspection_ReportList_PSCDeficiencyReport"
                });
            }
            return Z(()=>{
                T();
            }), (t, n)=>{
                const v = ae, V = ce, A = re, P = ee, E = se, U = ne, M = le, z = Y("debounce");
                return x(), S(M, null, {
                    default: o(()=>[
                            s(P, {
                                bordered: !1,
                                class: "mt-3 py-3 proCard",
                                title: "Basic Details",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                "header-extra": o(()=>[
                                        oe((x(), S(v, {
                                            quaternary: "",
                                            type: "primary",
                                            strong: "",
                                            secondary: ""
                                        }, {
                                            default: o(()=>n[1] || (n[1] = [
                                                    I(" Save ")
                                                ])),
                                            _: 1
                                        })), [
                                            [
                                                z,
                                                ()=>B(),
                                                "1000"
                                            ]
                                        ])
                                    ]),
                                default: o(()=>[
                                        s(A, {
                                            onRegister: r(R)
                                        }, {
                                            visitPlace: o(({ model: c, field: q })=>[
                                                    s(V, {
                                                        ref: "portTableSelectRef",
                                                        labelField: "port",
                                                        valueField: "id",
                                                        value: c[q],
                                                        "onUpdate:value": (p)=>c[q] = p,
                                                        formValues: r(m),
                                                        "onUpdate:formValues": n[0] || (n[0] = (p)=>te(m) ? m.value = p : null),
                                                        multiple: !1,
                                                        formProps: D,
                                                        disabled: r(y),
                                                        tableProps: {
                                                            rowKey: (p)=>p.id,
                                                            request: h,
                                                            columns: g,
                                                            pagination: {
                                                                simple: !0
                                                            }
                                                        }
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "formValues",
                                                        "disabled",
                                                        "tableProps"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            s(P, {
                                bordered: !1,
                                class: "mt-3 py-3 proCard",
                                title: "Deficiencys",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                default: o(()=>[
                                        s(r(pe), {
                                            ref: "basicTableRef",
                                            columns: g,
                                            request: (c)=>h(c, r(b)()),
                                            immediate: !1,
                                            "row-key": (c)=>c.id,
                                            actionColumn: r(w)
                                        }, {
                                            tableTitle: o(()=>[
                                                    s(U, null, {
                                                        default: o(()=>[
                                                                s(v, {
                                                                    type: "primary",
                                                                    onClick: F
                                                                }, {
                                                                    icon: o(()=>[
                                                                            s(E, null, {
                                                                                default: o(()=>[
                                                                                        s(r(ie))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: o(()=>[
                                                                            n[2] || (n[2] = I(" Add "))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { nt as default, __tla };
