var k=Object.defineProperty,q=Object.defineProperties;var v=Object.getOwnPropertyDescriptors;var y=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var x=(r,t,e)=>t in r?k(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,p=(r,t)=>{for(var e in t||(t={}))E.call(t,e)&&x(r,e,t[e]);if(y)for(var e of y(t))O.call(t,e)&&x(r,e,t[e]);return r},m=(r,t)=>q(r,v(t));var b=(r,t,e)=>new Promise((c,d)=>{var g=i=>{try{s(e.next(i))}catch(l){d(l)}},h=i=>{try{s(e.throw(i))}catch(l){d(l)}},s=i=>i.done?c(i.value):Promise.resolve(i.value).then(g,h);s((e=e.apply(r,t)).next())});import{u as T,c as G,d as A,a as L,b as P}from"./vxe-table-D0Ytu0oZ.js";import{u as z}from"./useRoleAccess-rNIDgdat.js";import{b6 as o}from"./bootstrap-Bqxdt4iG.js";import{u as N}from"./currencies-Bq32ahPb.js";import{u as $,T as j}from"./data-refresh-BZ1_-6mk.js";import{a as U}from"./format-DSCuLcwt.js";import{_ as F}from"./currency-create-drawer.vue_vue_type_script_setup_true_lang-DuIJotQA.js";import{_ as W}from"./currency-edit-drawer.vue_vue_type_script_setup_true_lang-Dgjry134.js";import{a1 as Y,U as H,ap as J,aj as K,p as C,a9 as w}from"../jse/index-index-BUJ_4tQs.js";import{u as D}from"./use-drawer-CLDmRz16.js";import"./upload-CodF4Wan.js";import"./index-BsjhuR3T.js";import"./Trigger-CftQioxV.js";import"./ResizeObserver.es-CDE7jhPe.js";import"./index-BZQGaz5w.js";import"./hasIn-DSO9yTkt.js";import"./isSymbol-sd7i9LG0.js";import"./isPlainObject-DJcwgk9A.js";import"./responsiveObserve-EPi7c3G5.js";import"./useFlexGapSupport-D8tKQOva.js";import"./_arrayIncludes-B8uzE354.js";import"./debounce-CYGc35EV.js";import"./index-BF1oQ5ik.js";import"./colors-CU1bIFfE.js";import"./roundedArrow-EYTrNAJt.js";import"./collapseMotion-DHKv0-UU.js";import"./FormItemContext-DjC4AFm9.js";import"./EyeOutlined-CSPqLYav.js";import"./CheckOutlined-CyOADmg7.js";import"./useRefs-BqD5DJTx.js";import"./useMergedState-mzgb8Um4.js";import"./index-CTgUvPXx.js";import"./css-BPcmMxJM.js";import"./LeftOutlined-pMa7biV7.js";import"./index-axp3BSAN.js";import"./useCreateDrawer-JEzOVO6Z.js";import"./useDrawerCloseConfirm-Q-yISXm7.js";import"./index-nmF6dqm7.js";import"./currency-form.vue_vue_type_script_setup_true_lang-2WEncv_c.js";import"./useEntityForm-CMwp7TbN.js";import"./useEditDrawer-JG4PTzvo.js";import"./x-CmzO4AZ3.js";import"./Separator.vue_vue_type_script_setup_true_lang-V0MBJaAb.js";const M={class:"flex h-full flex-col"},$e=Y({name:"CurrencyList",__name:"currency-list",setup(r){const t=N(),e=$(),{showAction:c}=z(),[d,g]=D({connectedComponent:F}),[h,s]=D({connectedComponent:W}),i=()=>{g.open()},l=a=>{s.setData({currencyId:a.id}).open()},R=a=>b(null,null,function*(){yield t.remove(a.id),e.invalidateCurrencies()}),_=[{icon:"lucide:edit",title:o("page.table.actions.edit"),onClick:l,show:c("currencies","edit"),testId:"edit-currency"},{icon:"lucide:trash-2",title:o("page.table.actions.delete"),hoverClass:"hover:text-red-500",onClick:R,show:c("currencies","delete"),testId:"delete-currency"}],S=[{text:o("page.currencies.toolbar.create"),type:"primary",onClick:i,show:c("currencies","create"),attrs:{"data-testid":"create-currency-btn"}}],[B,I]=T(m(p({},P),{formOptions:m(p({},L),{schema:[{fieldName:"code",label:o("page.currencies.table.code"),component:"Input",componentProps:{placeholder:o("page.currencies.form.codePlaceholder"),size:"small"}}]}),gridOptions:m(p({},A),{id:j.CURRENCY_LIST,toolbarConfig:m(p({},A.toolbarConfig),{buttons:S.map(a=>({buttonRender:{name:"ToolbarButton",props:a}}))}),columns:[{type:"seq",field:"_seq",title:o("page.table.common.seq"),width:"auto",align:"center"},{field:"actions",title:o("page.table.common.actions"),width:G(_.length),align:"center",fixed:"left",cellRender:{name:"CellActions",props:{actions:_}}},{field:"code",title:o("page.currencies.table.code"),width:"auto",sortable:!0,align:"left"},{field:"name",title:o("page.currencies.table.name"),width:"auto",sortable:!0,align:"left"},{field:"symbol",title:o("page.currencies.table.symbol"),width:"auto",align:"center"},{field:"exchangeRate",title:o("page.currencies.table.exchangeRate"),width:"auto",sortable:!0,align:"right"},{field:"createdAt",title:o("page.table.common.createdAt"),width:"auto",sortable:!0,align:"left",formatter:U}],sortConfig:{remote:!0,trigger:"default",defaultSort:{field:"code",order:"asc"}},proxyConfig:{ajax:{query:(Fe,We)=>b(null,[Fe,We],function*({page:a,sort:n},u){const f={page:a.currentPage,pageSize:a.pageSize};return u!=null&&u.code&&(f.code=u.code),n!=null&&n.field&&(f.sortBy=n.field,f.sortOrder=n.order),yield t.getList(f)})},sort:!0}})}));return H(()=>e.currenciesVersion,()=>{I.query()}),(a,n)=>(K(),J("div",M,[C(w(B),{class:"flex-1"}),C(w(d)),C(w(h))]))}});export{$e as default};
