import{D as T,_ as A}from"./DropdownMenu.ecdd2e52.js";import{d as I,r as $,E as z,b as e,u as f,eq as w,bh as D,eA as r,er as l,c as n,ez as h,aS as V,eZ as E,eE as U,bw as y,eu as v,eB as M,eC as N,t as x,F as L,a as F,c2 as j,et as q,ew as B}from"./registerWidgets.6f5be576.js";import{M as H}from"./Modal.dd94f88f.js";import{L as W}from"./LoadingIndicator.2446cb23.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]="9140c185-5f37-4d69-aadb-cd053da2f0bf",o._sentryDebugIdIdentifier="sentry-dbid-9140c185-5f37-4d69-aadb-cd053da2f0bf")}catch{}})();const Y=o=>(M("data-v-2df56f03"),o=o(),N(),o),Z={class:"main-text"},G={class:"fields"},J=["onUpdate:modelValue","type"],K=["onUpdate:modelValue"],O=["value"],P=Y(()=>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:{}}),b={maxWidth:"350px",height:"unset",padding:"30px"},g={borderBottom:"none",fontSize:"18px",marginBottom:"17px",display:"flex",flexDirection:"column",justifyContent:"center",color:"#4E596A",lineHeight:"22px"},t={color:"#414A58",fontSize:"14px",alignItems:"unset"},S=()=>{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:S,close:m}),(i,C)=>(e(),f(H,{ref_key:"modalRef",ref:d,"container-style":b,"header-style":g,"content-style":t},{header:w(()=>[D(" Create a new "+r(i.entityName),1)]),content:w(()=>[l("div",Z,"You may edit the "+r(i.entityName)+" name afterwards at Settings.",1),l("div",G,[(e(!0),n(y,null,h(i.fields,s=>{var k;return e(),n("div",{key:s.key,class:"field"},[l("label",null,r(s.label),1),!s.type||typeof s.type=="string"?V((e(),n("input",{key:0,"onUpdate:modelValue":a=>c.inputValue[s.key]=a,type:(k=s.type)!=null?k:"text",class:"ws-name"},null,8,J)),[[E,c.inputValue[s.key]]]):Array.isArray(s.type)?V((e(),n("select",{key:1,"onUpdate:modelValue":a=>c.inputValue[s.key]=a,class:"ws-name"},[(e(!0),n(y,null,h(s.type,a=>(e(),n("option",{key:typeof a=="string"?a:a.value,value:typeof a=="string"?a:a.value},r(typeof a=="string"?a:a.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 X=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"},ne={class:"title-wrapper"},ae={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 b(t){u("create",t)}const g=L(()=>({"--columnCount":`${_.table.columns.length}`}));return(t,S)=>{const m=F("router-link");return e(),n(y,null,[t.loading?(e(),f(W,{key:0})):(e(),n("div",te,[l("div",se,[l("div",ne,[l("h1",null,r(t.title),1),l("p",ae,r(t.description),1),t.createButtonText?(e(),n("button",{key:0,onClick:c},r(t.createButtonText),1)):v("",!0)])]),t.table.rows.length===0?(e(),n("div",oe,[le,l("div",ie,r(t.emptyTitle),1),l("div",re,[j(t.$slots,"empty-description",{},void 0,!0)]),t.createButtonText?(e(),n("button",{key:0,onClick:c},r(t.createButtonText),1)):v("",!0)])):(e(),n("table",{key:1,style:q(g.value)},[l("th",null,[(e(!0),n(y,null,h(t.table.columns,(p,i)=>(e(),n("td",{key:i,class:"cell"},r(p.name),1))),128))]),(e(!0),n(y,null,h(t.table.rows,(p,i)=>{var C;return e(),n("tr",{key:i,class:B((C=p.classes)!=null?C:[])},[(e(!0),n(y,null,h(p.cells,(s,k)=>{var a;return e(),n("td",{key:k,class:B((a=s.classes)!=null?a:[])},[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(),n("div",de,r(s.text),1))],2)}),128))],2)}),128))],4))])),t.fields?(e(),f(X,{key:2,ref_key:"modalRef",ref:d,fields:t.fields,"entity-name":t.entityName,onCreate:b},null,8,["fields","entity-name"])):v("",!0)],64)}}});const me=x(ce,[["__scopeId","data-v-8365dfdd"]]);export{me as C};
//# sourceMappingURL=CrudView.81000b9b.js.map
