import{D as T,_ as A}from"./DropdownMenu.dd15f4e3.js";import{d as I,r as $,G as z,b as e,c as f,w,b0 as D,eA as r,e as l,d2 as a,ez as h,ak as S,eW as L,eX as U,bu as y,eu as v,eB as M,eC as N,v as x,H as E,a as H,aL as W,et as j,ew as B}from"./registerWidgets.e46eca28.js";import{M as F}from"./Modal.47e24ea4.js";import{L as G}from"./LoadingIndicator.623149e9.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[u]="a0e0daa9-8eec-44a9-9753-ad6262efaf31",o._sentryDebugIdIdentifier="sentry-dbid-a0e0daa9-8eec-44a9-9753-ad6262efaf31")}catch{}})();const X=o=>(M("data-v-2df56f03"),o=o(),N(),o),Y={class:"main-text"},q={class:"fields"},J=["onUpdate:modelValue","type"],K=["onUpdate:modelValue"],O=["value"],P=X(()=>l("div",{class:"separator"},null,-1)),Q={class:"buttons"},R=I({__name:"CreationModal",props:{entityName:{},fields:{}},emits:["create"],setup(o,{expose:u,emit:_}){const d=$(null),c=z({inputValue:{}}),g={maxWidth:"350px",height:"unset",padding:"30px"},b={borderBottom:"none",fontSize:"18px",marginBottom:"17px",display:"flex",flexDirection:"column",justifyContent:"center",color:"#4E596A",lineHeight:"22px"},t={color:"#414A58",fontSize:"14px",alignItems:"unset"},V=()=>{var i;return(i=d==null?void 0:d.value)==null?void 0:i.open()},m=()=>{var i;return(i=d==null?void 0:d.value)==null?void 0:i.close()},p=()=>{_("create",c.inputValue),m()};return u({open:V,close:m}),(i,C)=>(e(),f(F,{ref_key:"modalRef",ref:d,"container-style":g,"header-style":b,"content-style":t},{header:w(()=>[D(" Create a new "+r(i.entityName),1)]),content:w(()=>[l("div",Y,"You may edit the "+r(i.entityName)+" name afterwards at Settings.",1),l("div",q,[(e(!0),a(y,null,h(i.fields,s=>{var k;return e(),a("div",{key:s.key,class:"field"},[l("label",null,r(s.label),1),!s.type||typeof s.type=="string"?S((e(),a("input",{key:0,"onUpdate:modelValue":n=>c.inputValue[s.key]=n,type:(k=s.type)!=null?k:"text",class:"ws-name"},null,8,J)),[[L,c.inputValue[s.key]]]):Array.isArray(s.type)?S((e(),a("select",{key:1,"onUpdate:modelValue":n=>c.inputValue[s.key]=n,class:"ws-name"},[(e(!0),a(y,null,h(s.type,n=>(e(),a("option",{key:typeof n=="string"?n:n.value,value:typeof n=="string"?n:n.value},r(typeof n=="string"?n:n.label),9,O))),128))],8,K)),[[U,c.inputValue[s.key]]]):v("",!0)])}),128))]),P,l("div",Q,[l("button",{class:"cancel",onClick:m},"Cancel"),l("button",{class:"create",onClick:p},"Create "+r(i.entityName),1)])]),_:1},512))}});const Z=x(R,[["__scopeId","data-v-2df56f03"]]),ee=o=>(M("data-v-8365dfdd"),o=o(),N(),o),te={key:1,class:"crud-view"},se={class:"header"},ae={class:"title-wrapper"},ne={class:"description"},oe={key:0,class:"empty-list"},le=ee(()=>l("img",{src:A},null,-1)),ie={class:"empty-list-title"},re={class:"empty-list-description"},de={key:2},ce=I({__name:"CrudView",props:{loading:{type:Boolean},title:{},description:{},createButtonText:{},emptyTitle:{},entityName:{},fields:{},table:{}},emits:["create"],setup(o,{emit:u}){const _=o,d=$(null),c=()=>{var t;_.fields?(t=d.value)==null||t.open():u("create",{})};async function g(t){u("create",t)}const b=E(()=>({"--columnCount":`${_.table.columns.length}`}));return(t,V)=>{const m=H("router-link");return e(),a(y,null,[t.loading?(e(),f(G,{key:0})):(e(),a("div",te,[l("div",se,[l("div",ae,[l("h1",null,r(t.title),1),l("p",ne,r(t.description),1),t.createButtonText?(e(),a("button",{key:0,onClick:c},r(t.createButtonText),1)):v("",!0)])]),t.table.rows.length===0?(e(),a("div",oe,[le,l("div",ie,r(t.emptyTitle),1),l("div",re,[W(t.$slots,"empty-description",{},void 0,!0)]),t.createButtonText?(e(),a("button",{key:0,onClick:c},r(t.createButtonText),1)):v("",!0)])):(e(),a("table",{key:1,style:j(b.value)},[l("th",null,[(e(!0),a(y,null,h(t.table.columns,(p,i)=>(e(),a("td",{key:i,class:"cell"},r(p.name),1))),128))]),(e(!0),a(y,null,h(t.table.rows,(p,i)=>{var C;return e(),a("tr",{key:i,class:B((C=p.classes)!=null?C:[])},[(e(!0),a(y,null,h(p.cells,(s,k)=>{var n;return e(),a("td",{key:k,class:B((n=s.classes)!=null?n:[])},[s.actions?(e(),f(T,{key:0,title:"Actions","highlight-last":!0,options:s.actions,payload:{key:p.key}},null,8,["options","payload"])):s.link?(e(),f(m,{key:1,to:s.link,class:"runtime-title"},{default:w(()=>[D(r(s.text),1)]),_:2},1032,["to"])):(e(),a("div",de,r(s.text),1))],2)}),128))],2)}),128))],4))])),t.fields?(e(),f(Z,{key:2,ref_key:"modalRef",ref:d,fields:t.fields,"entity-name":t.entityName,onCreate:g},null,8,["fields","entity-name"])):v("",!0)],64)}}});const me=x(ce,[["__scopeId","data-v-8365dfdd"]]);export{me as C};
//# sourceMappingURL=CrudView.2fb3f52f.js.map
