import{D as T,_ as A}from"./DropdownMenu.90d44aab.js";import{d as I,r as D,v as U,b as e,t as h,w,U as $,N as r,x as l,c as n,L as f,W as S,aq as z,X as L,F as y,D as v,O as N,Q as x,q as M,K as E,a as q,B as F,A as W,G as B}from"./registerWidgets.7afd6438.js";import{M as j}from"./Modal.94284cfc.js";import{L as G}from"./LoadingIndicator.b2e0f173.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]="36e491e4-aca8-4774-bbdd-45339162a4dd",o._sentryDebugIdIdentifier="sentry-dbid-36e491e4-aca8-4774-bbdd-45339162a4dd")}catch{}})();const H=o=>(N("data-v-ed693c76"),o=o(),x(),o),K={class:"main-text"},O={class:"fields"},Q=["onUpdate:modelValue","type"],X=["onUpdate:modelValue"],Y=["value"],J=H(()=>l("div",{class:"separator"},null,-1)),P={class:"buttons"},R=I({__name:"CreationModal",props:{entityName:{},fields:{}},emits:["create"],setup(o,{expose:u,emit:_}){const d=D(null),c=U({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"},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(),h(j,{ref_key:"modalRef",ref:d,"container-style":b,"header-style":g,"content-style":t},{header:w(()=>[$(" Create a new "+r(i.entityName),1)]),content:w(()=>[l("div",K," You may edit the "+r(i.entityName)+" name afterwards at Settings. ",1),l("div",O,[(e(!0),n(y,null,f(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"?S((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,Q)),[[z,c.inputValue[s.key]]]):Array.isArray(s.type)?S((e(),n("select",{key:1,"onUpdate:modelValue":a=>c.inputValue[s.key]=a,class:"ws-name"},[(e(!0),n(y,null,f(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,Y))),128))],8,X)),[[L,c.inputValue[s.key]]]):v("",!0)])}),128))]),J,l("div",P,[l("button",{class:"cancel",onClick:m},"Cancel"),l("button",{class:"create",onClick:p},"Create "+r(i.entityName),1)])]),_:1},512))}});const Z=M(R,[["__scopeId","data-v-ed693c76"]]),ee=o=>(N("data-v-8365dfdd"),o=o(),x(),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=D(null),c=()=>{var t;_.fields?(t=d.value)==null||t.open():u("create",{})};async function b(t){u("create",t)}const g=E(()=>({"--columnCount":`${_.table.columns.length}`}));return(t,V)=>{const m=q("router-link");return e(),n(y,null,[t.loading?(e(),h(G,{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,[F(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:W(g.value)},[l("th",null,[(e(!0),n(y,null,f(t.table.columns,(p,i)=>(e(),n("td",{key:i,class:"cell"},r(p.name),1))),128))]),(e(!0),n(y,null,f(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,f(p.cells,(s,k)=>{var a;return e(),n("td",{key:k,class:B((a=s.classes)!=null?a:[])},[s.actions?(e(),h(T,{key:0,title:"Actions","highlight-last":!0,options:s.actions,payload:{key:p.key}},null,8,["options","payload"])):s.link?(e(),h(m,{key:1,to:s.link,class:"runtime-title"},{default:w(()=>[$(r(s.text),1)]),_:2},1032,["to"])):(e(),n("div",de,r(s.text),1))],2)}),128))],2)}),128))],4))])),t.fields?(e(),h(Z,{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=M(ce,[["__scopeId","data-v-8365dfdd"]]);export{me as C};
//# sourceMappingURL=CrudView.ab882a67.js.map
