var d=(s,c,o)=>new Promise((l,n)=>{var m=e=>{try{a(o.next(e))}catch(i){n(i)}},p=e=>{try{a(o.throw(e))}catch(i){n(i)}},a=e=>e.done?l(e.value):Promise.resolve(e.value).then(m,p);a((o=o.apply(s,c)).next())});import{u as k}from"./useEntityForm-CMwp7TbN.js";import{cd as D,b6 as t}from"./bootstrap-Bqxdt4iG.js";import{a1 as h,E as I,ap as N,aj as P,p as g,a9 as A}from"../jse/index-index-BUJ_4tQs.js";const M=h({__name:"inventory-detail-form",props:{inventoryDetail:{default:null},mode:{}},emits:["cancel","submit"],setup(s,{expose:c,emit:o}){const l=s,n=o,m=D(),p=()=>d(null,null,function*(){try{return yield m.fetchOptions()}catch(r){return console.error("Failed to fetch location options:",r),[]}}),a={locationId:null,estimatedArrivalTime:null,preAlertQty:0,stockInQty:0,toPackQty:0,packedQty:0,toStockOutQty:0,stockOutQty:0},e=I(()=>[{component:"ApiSelect",componentProps:{"data-testid":"inventory-detail-form-location-select",id:"inventory-detail-form-location-select",api:p,placeholder:t("page.inventoryDetails.form.locationPlaceholder"),showSearch:!0,allowClear:!0},fieldName:"locationId",formItemClass:"col-span-2",label:t("page.inventoryDetails.form.location")},{component:"DatePicker",componentProps:{"data-testid":"inventory-detail-form-estimatedArrivalTime-input",placeholder:t("page.inventoryDetails.form.estimatedArrivalTimePlaceholder"),format:"DD/MM/YYYY",valueFormat:"YYYY-MM-DD",allowClear:!0},fieldName:"estimatedArrivalTime",formItemClass:"col-span-2",label:t("page.inventoryDetails.form.estimatedArrivalTime")},{component:"Divider",componentProps:{orientation:"left",orientationMargin:0},fieldName:"_divider_quantities",formItemClass:"col-span-2",hideLabel:!0,renderComponentContent:()=>({default:()=>t("page.inventoryDetails.form.quantities")})},{component:"InputNumber",componentProps:{"data-testid":"inventory-detail-form-preAlertQty-input",min:0,precision:0},fieldName:"preAlertQty",label:t("page.inventoryDetails.table.preAlertQty")},{component:"InputNumber",componentProps:{"data-testid":"inventory-detail-form-stockInQty-input",min:0,precision:0},fieldName:"stockInQty",label:t("page.inventoryDetails.table.stockInQty")},{component:"InputNumber",componentProps:{"data-testid":"inventory-detail-form-toPackQty-input",min:0,precision:0},fieldName:"toPackQty",label:t("page.inventoryDetails.table.toPackQty")},{component:"InputNumber",componentProps:{"data-testid":"inventory-detail-form-packedQty-input",min:0,precision:0},fieldName:"packedQty",label:t("page.inventoryDetails.table.packedQty")},{component:"InputNumber",componentProps:{"data-testid":"inventory-detail-form-toStockOutQty-input",min:0,precision:0},fieldName:"toStockOutQty",label:t("page.inventoryDetails.table.toStockOutQty")},{component:"InputNumber",componentProps:{"data-testid":"inventory-detail-form-stockOutQty-input",min:0,precision:0},fieldName:"stockOutQty",label:t("page.inventoryDetails.table.stockOutQty")}]),{Form:i,formApi:u,focus:y,isDirty:f,resetForm:v,submitForm:b,watchEntity:Q}=k({emptyValues:a,firstInputId:"inventory-detail-form-location-select",schema:e,wrapperClass:"grid-cols-2 gap-x-6"});return Q(()=>l.inventoryDetail,()=>l.mode),c({cancel:()=>{n("cancel")},focus:y,formApi:u,isDirty:f,resetForm:v,submit:()=>d(null,null,function*(){const r=yield b();r&&n("submit",r)})}),(r,O)=>(P(),N("div",null,[g(A(i))]))}});export{M as _};
