var D=Object.defineProperty,M=Object.defineProperties;var I=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var y=(s,a,t)=>a in s?D(s,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[a]=t,c=(s,a)=>{for(var t in a||(a={}))O.call(a,t)&&y(s,t,a[t]);if(w)for(var t of w(a))q.call(a,t)&&y(s,t,a[t]);return s},g=(s,a)=>M(s,I(a));var h=(s,a,t)=>new Promise((o,n)=>{var f=l=>{try{p(t.next(l))}catch(d){n(d)}},b=l=>{try{p(t.throw(l))}catch(d){n(d)}},p=l=>l.done?o(l.value):Promise.resolve(l.value).then(f,b);p((t=t.apply(s,a)).next())});import{u as A,c as k,d as x,a as R,b as z}from"./vxe-table-D0Ytu0oZ.js";import{u as E}from"./useRoleAccess-rNIDgdat.js";import{b6 as i}from"./bootstrap-Bqxdt4iG.js";import{u as G}from"./storage-leases-DxTjNUp2.js";import{a as N}from"./storage-leases-DIh1SO1g.js";import{b as S}from"./format-DSCuLcwt.js";import{a1 as P,ap as F,aj as j,p as $,a9 as H}from"../jse/index-index-BUJ_4tQs.js";const V=P({name:"StorageLeaseDetailList",__name:"storage-lease-detail-list",props:{storageLeaseId:{default:""},embedded:{type:Boolean,default:!1},expandMode:{type:Boolean,default:!1}},emits:["add","delete","edit"],setup(s,{expose:a,emit:t}){const o=s,n=t,f=G(),{canEdit:b,showAction:p}=E(),l=b("storage_leases");let d="storage-lease-detail-list";o.expandMode?d="expand-storage-lease-detail-list":o.embedded&&(d="embedded-storage-lease-detail-list");const L=N.map(e=>({value:e.value,label:e.label,color:e.color})),v=()=>{n("add")},C=[{icon:"lucide:edit",title:i("page.table.actions.edit"),onClick:e=>n("edit",e),show:l},{icon:"lucide:trash-2",title:i("page.table.actions.delete"),hoverClass:"hover:text-red-500",onClick:e=>n("delete",e),show:l}],_=[{text:i("page.storageLeases.detail.addPeriod"),type:"primary",onClick:v,show:p("storage_leases","edit")}],[T,B]=A(g(c({},z),{formOptions:g(c({},R),{schema:[{fieldName:"action",label:i("page.storageLeases.detailTable.action"),component:"Select",componentProps:{allowClear:!0,options:L,placeholder:i("page.storageLeases.detailTable.action"),size:"small"}}]}),gridOptions:g(c({},x),{id:d,height:o.embedded?350:void 0,maxHeight:o.expandMode?500:void 0,toolbarConfig:o.expandMode?{enabled:!1}:g(c({},x.toolbarConfig),{buttons:_.map(e=>({buttonRender:{name:"ToolbarButton",props:e}}))}),pagerConfig:o.expandMode?void 0:x.pagerConfig,columns:[...o.expandMode?[]:[{type:"seq",field:"_seq",title:i("page.table.common.seq"),width:50,align:"center"},{field:"actions",title:i("page.table.common.actions"),width:k(C.length),align:"center",fixed:"left",cellRender:{name:"CellActions",props:{actions:C}}}],{field:"action",title:i("page.storageLeases.detailTable.action"),width:100,align:"center",cellRender:{name:"CellStatus",props:{options:L}}},{field:"startDate",title:i("page.storageLeases.detailTable.startDate"),width:100,align:"left",formatter:S},{field:"endDate",title:i("page.storageLeases.detailTable.endDate"),width:100,align:"left",formatter:S},{field:"duration",title:i("page.storageLeases.detailTable.duration"),width:80,align:"right",formatter:({cellValue:e})=>e?`${e} Days`:"-"},{field:"insured",title:i("page.storageLeases.detailTable.insured"),width:80,align:"center",cellRender:{name:"CellStatus",props:{options:[{value:!0,label:"Yes",color:"success"},{value:!1,label:"No",color:"default"}]}}},...o.expandMode?[]:[{field:"sumInsured",title:i("page.storageLeases.detailTable.sumInsured"),width:100,align:"right",formatter:({cellValue:e})=>e>0?Number(e).toFixed(2):"-"}]],proxyConfig:{autoLoad:!o.embedded&&!o.expandMode,ajax:{query:(ae,oe)=>h(null,[ae,oe],function*({page:e,sort:r},m){if(!o.storageLeaseId)return{items:[],total:0,page:1,pageSize:100};const u={storageLeaseId:o.storageLeaseId,page:e.currentPage,pageSize:e.pageSize};return m!=null&&m.action&&(u.action=m.action),r!=null&&r.field&&(u.sortBy=r.field,u.sortOrder=r.order),yield f.getDetails(u)})},sort:!0}})}));return a({query:()=>h(null,null,function*(){return B.query()})}),(e,r)=>(j(),F("div",null,[$(H(T))]))}});export{V as _};
