import { d as G, V as H, r as p, c as d, o as m, w as o, j as u, l as e, ds as T, D as h, H as J, aI as Q, p as k, A as C, B as Y, ca as x, gW as M, gX as R, X as Z, ac as ee, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as te } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import { c as oe, __tla as __tla_1 } from "./columns-DY6kUOTk.js";
import { B as ae } from "./Table-0PViRYCf.js";
import { B as le } from "./BasicForm-dL_oCSPM.js";
import { u as se } from "./useForm-CKmgcynv.js";
import { i as re, __tla as __tla_2 } from "./schemas-BqGurRC_.js";
import { aa as ne } from "./template-rpthWlT9.js";
import { g as ie } from "./planner-BebmniHR.js";
let ye;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    let ue;
    ue = {
        name: "IMOCrewlist"
    };
    ye = G({
        ...ue,
        props: {
            readonly: {
                type: Boolean,
                default: !1
            }
        },
        setup (q, { expose: U }) {
            const { t: r } = H(), I = q, f = p(), S = p([]), c = p(), g = p(I.readonly), V = p([]), B = oe(), { methods: { updateIsEditIMO: O } } = B, { iMOschemas: L, methods: A } = re(), [D, { getFieldsValue: E, setFieldsValue: N }] = se({
                gridProps: {
                    cols: 12
                },
                schemas: L,
                labelPlacement: "top",
                showActionButtonGroup: !1,
                showAdvancedButton: !1
            }), l = p({}), y = {
                gridProps: {
                    cols: "2"
                },
                labelWidth: 80,
                submitButtonText: r("common.searchText"),
                showAdvancedButton: !1,
                schemas: [
                    {
                        field: "namePrefix",
                        component: "NInput",
                        label: r("hsqe.planner.modal.planPort")
                    }
                ]
            }, P = [
                {
                    title: r("hsqe.planner.modal.port"),
                    key: "port"
                },
                {
                    title: r("hsqe.planner.modal.country"),
                    key: "country"
                }
            ];
            function w(v) {
                return ie({
                    ...v,
                    ...e(l)
                });
            }
            function z() {
                c.value = !0, O(e(c));
            }
            function F() {
                c.value = !1, O(e(c));
            }
            function K() {
                return f.value?.getDataSource();
            }
            function W() {
                return {
                    ...E()
                };
            }
            async function X(v, s, _) {
                await F(), A.updateIsEditIMO(I.readonly);
                let b = await Promise.all(_.map(async (n)=>(n.nationalId ? n.provinceList = await ne({
                        countryId: n.nationalId
                    }) : n.provinceList = [], n)));
                S.value = b, N({
                    vesselId: v.id,
                    ...s,
                    flagStateId: v.flagStateId
                }), V.value = B.IMOCrewlistColumns, ee(()=>{
                    f.value?.reload(), f.value?.setBordered(!0), f.value?.setStriped(!1);
                });
            }
            return U({
                handleOpen: X,
                infoVo: W,
                voList: K
            }), (v, s)=>{
                const _ = te, b = Y, n = Q, $ = J, j = Z;
                return m(), d(j, null, {
                    default: o(()=>[
                            u(e(le), {
                                onRegister: e(D)
                            }, {
                                onBroadPort: o(({ model: a, field: i })=>[
                                        u(_, {
                                            ref: "portTableSelectRef",
                                            labelField: "port",
                                            valueField: "id",
                                            value: a[i],
                                            "onUpdate:value": (t)=>a[i] = t,
                                            formValues: e(l),
                                            "onUpdate:formValues": s[0] || (s[0] = (t)=>T(l) ? l.value = t : null),
                                            multiple: !1,
                                            formProps: y,
                                            disabled: e(g),
                                            selectTitle: e(r)("hsqe.planner.modal.selectPort"),
                                            class: "w-full",
                                            tableProps: {
                                                rowKey: (t)=>t.id,
                                                request: w,
                                                columns: P,
                                                pagination: {
                                                    simple: !0
                                                }
                                            }
                                        }, null, 8, [
                                            "value",
                                            "onUpdate:value",
                                            "formValues",
                                            "disabled",
                                            "selectTitle",
                                            "tableProps"
                                        ])
                                    ]),
                                upBroadPort: o(({ model: a, field: i })=>[
                                        u(_, {
                                            ref: "portTableSelectRef",
                                            labelField: "port",
                                            valueField: "id",
                                            value: a[i],
                                            "onUpdate:value": (t)=>a[i] = t,
                                            formValues: e(l),
                                            "onUpdate:formValues": s[1] || (s[1] = (t)=>T(l) ? l.value = t : null),
                                            multiple: !1,
                                            formProps: y,
                                            disabled: e(g),
                                            selectTitle: e(r)("hsqe.planner.modal.selectPort"),
                                            class: "w-full",
                                            tableProps: {
                                                rowKey: (t)=>t.id,
                                                request: w,
                                                columns: P,
                                                pagination: {
                                                    simple: !0
                                                }
                                            }
                                        }, null, 8, [
                                            "value",
                                            "onUpdate:value",
                                            "formValues",
                                            "disabled",
                                            "selectTitle",
                                            "tableProps"
                                        ])
                                    ]),
                                portArrivalFrom: o(({ model: a, field: i })=>[
                                        u(_, {
                                            ref: "portTableSelectRef",
                                            labelField: "port",
                                            valueField: "id",
                                            value: a[i],
                                            "onUpdate:value": (t)=>a[i] = t,
                                            formValues: e(l),
                                            "onUpdate:formValues": s[2] || (s[2] = (t)=>T(l) ? l.value = t : null),
                                            multiple: !1,
                                            formProps: y,
                                            disabled: e(g),
                                            selectTitle: e(r)("hsqe.planner.modal.selectPort"),
                                            class: "w-full",
                                            tableProps: {
                                                rowKey: (t)=>t.id,
                                                request: w,
                                                columns: P,
                                                pagination: {
                                                    simple: !0
                                                }
                                            }
                                        }, null, 8, [
                                            "value",
                                            "onUpdate:value",
                                            "formValues",
                                            "disabled",
                                            "selectTitle",
                                            "tableProps"
                                        ])
                                    ]),
                                _: 1
                            }, 8, [
                                "onRegister"
                            ]),
                            u(e(ae), {
                                ref_key: "crewIMOTableRef",
                                ref: f,
                                columns: e(V),
                                dataSource: e(S),
                                "row-key": (a)=>a.id,
                                autoScrollX: !0,
                                immediate: !1,
                                pagination: !1,
                                "can-resize": !1,
                                "show-table-setting": !1
                            }, {
                                toolbar: o(()=>[
                                        e(g) ? h("", !0) : (m(), d($, {
                                            key: 0,
                                            reverse: ""
                                        }, {
                                            default: o(()=>[
                                                    e(c) ? h("", !0) : (m(), d(n, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: o(()=>[
                                                                u(b, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: z
                                                                }, {
                                                                    icon: o(()=>[
                                                                            (m(), d(x(e(M)(e(R).edit))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: o(()=>[
                                                                k(" " + C(e(r)("common.optionsEditText")), 1)
                                                            ]),
                                                        _: 1
                                                    })),
                                                    e(c) ? (m(), d(n, {
                                                        key: 1,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: o(()=>[
                                                                u(b, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: s[3] || (s[3] = (a)=>F())
                                                                }, {
                                                                    icon: o(()=>[
                                                                            (m(), d(x(e(M)(e(R).save))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: o(()=>[
                                                                k(" " + C(e(r)("common.saveText")), 1)
                                                            ]),
                                                        _: 1
                                                    })) : h("", !0)
                                                ]),
                                            _: 1
                                        }))
                                    ]),
                                _: 1
                            }, 8, [
                                "columns",
                                "dataSource",
                                "row-key"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { ye as _, __tla };
