import{A as _,f as k}from"./fields-DIa_lWOD.js";import{_ as b,x as T,Z as $,a as v,r as i,e as C,o as d,g as E,f as c,w as s,V as a,F as h,c as n,J as g,p as w,B as S,ah as B}from"./app-DGDivIsO.js";const D=T({props:{btnType:{default:"default"},tooltip:{default:!0},customType:{default:"button"}},emits:["onAddSuccess"],components:{PlusOutlined:$,AddEdit:_},setup(e,{emit:p}){const{permsArray:m}=v(),{customerInitData:l,customerAddEditUrl:f}=k(),o=i(!1),r=i("add"),t=i({...l});return{permsArray:m,visible:o,addEditType:r,customerAddEditUrl:f,formData:t,addEditSuccess:()=>{o.value=!1,t.value={...l},p("onAddSuccess")},onClose:()=>{o.value=!1},showAdd:()=>{o.value=!0}}}}),O={key:0};function P(e,p,m,l,f,o){const r=w,t=C("PlusOutlined"),u=S,y=B,A=C("AddEdit");return e.permsArray.includes("customers_create")||e.permsArray.includes("admin")?(d(),E("div",O,[e.customType=="menu"?(d(),c(r,{onClick:e.showAdd,key:"customers"},{icon:s(()=>[a(e.$slots,"icon")]),default:s(()=>[a(e.$slots,"default")]),_:3},8,["onClick"])):(d(),E(h,{key:1},[e.tooltip?(d(),c(y,{key:0,placement:"topLeft",title:e.$t("customer.add"),"arrow-point-at-center":""},{default:s(()=>[n(u,{onClick:e.showAdd,class:"ml-5 no-border-radius",type:e.btnType},{icon:s(()=>[n(t)]),default:s(()=>[a(e.$slots,"default")]),_:3},8,["onClick","type"])]),_:3},8,["title"])):(d(),c(u,{key:1,onClick:e.showAdd,class:"ml-5 no-border-radius",type:e.btnType},{icon:s(()=>[n(t)]),default:s(()=>[a(e.$slots,"default")]),_:3},8,["onClick","type"]))],64)),n(A,{addEditType:e.addEditType,visible:e.visible,url:e.customerAddEditUrl,onAddEditSuccess:e.addEditSuccess,onClosed:e.onClose,addEditData:e.formData,data:e.formData,pageTitle:e.$t("customer.add"),successMessage:e.$t("customer.created")},null,8,["addEditType","visible","url","onAddEditSuccess","onClosed","addEditData","data","pageTitle","successMessage"])])):g("",!0)}const M=b(D,[["render",P]]);export{M as C};
