System.register(["./preload-helper-legacy.CIXZiioE.js","../apps/settings/index-legacy.Bb8z3cGQ.js","./GroupEditFields.vue_vue_type_script_setup_true_lang-legacy.BV5Am7nG.js","./index-legacy.Ccwy_0FI.js","./EditOutlined-legacy.DDjyzCfn.js","./DeleteOutlined-legacy.Bc-rhxYC.js","./index-legacy.CkYl86X9.js"],function(e,t){"use strict";var a,l,n,i,r,o,d,c,s,u,y,f,v,p,b,k,g,j,m,O,h,_,D,x,w;return{setters:[e=>{a=e.h,l=e.ax,n=e.d,i=e.ar,r=e.A,o=e.bn,d=e.bq,c=e.bu,s=e.bo,u=e.bp,y=e.aa,f=e.a9,v=e.a4,p=e.N,b=e.br,k=e.bs,g=e.bw,j=e.r},e=>{m=e.p,O=e.s},e=>{h=e._},e=>{_=e.A},e=>{D=e.E},e=>{x=e.D},e=>{w=e.A}],execute:function(){var t={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z"}}]},name:"save",theme:"outlined"};function C(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?Object(arguments[t]):{},l=Object.keys(a);"function"==typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(a).filter(function(e){return Object.getOwnPropertyDescriptor(a,e).enumerable}))),l.forEach(function(t){H(e,t,a[t])})}return e}function H(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var M=function(e,n){var i=C({},e,n.attrs);return a(l,C({},i,{icon:t}),null)};M.displayName="SaveOutlined",M.inheritAttrs=!1;const S={key:0,class:"editable-row-operations"},A={class:"editable-cell"},P=["loading","onClick"],U=["onClick"],V={key:0},z=["innerHTML"],F={key:1},L=["innerHTML"];e("_",n({__name:"DataTableControl",props:{params:{type:Object,required:!0},data:{type:Object,required:!0},editFields:{type:Object,required:!1,default:()=>({})}},emits:["fieldData","fieldUpdatedData","fieldUpdatedPopupData","fieldDeletedData"],setup(e,{emit:t}){var l,n;const C=e,{params:H,data:T,editFields:q}=i(C),E=H.value,N=r(null!==(l=E.paginated)&&void 0!==l&&l),G=E.fields,B=r(E.classes),I=r(T),J=E.editable,K=E.can_delete,Q=E.edit_action,R=E.delete_action,W=r(null===(n=E.inline_edit)||void 0===n||n),X=r(!1),Y=j([]),Z=t,$=r([]),ee=e=>{for(const[t,a]of Object.entries(e))$.value[t]=a},te=e=>{const t=[];for(const[a,l]of Object.entries(q.value))t[l.id]=l;return void 0!==t[e]?t[e]:{}},ae=e=>Array.isArray(e)?e.join(", "):e;return(e,t)=>(o(),d(f(w),{class:g(B.value),"data-source":I.value,columns:f(G),pagination:N.value,bordered:""},{bodyCell:c(({column:e,text:l,record:n})=>["operation"===e.key?(o(),s("div",S,[u("div",A,[Y[n.key]&&W.value?(o(),s(y,{key:0},[u("a",{loading:X.value,onClick:e=>(async e=>{const t=[{key:"action",value:Q}],a={};a.key=e;for(const[n,i]of Object.entries($.value)){let e=i;"object"==typeof i&&null!==i&&(e=JSON.stringify(i)),t.push({key:n,value:e}),a[n]=i}try{"success"===await O(t)&&Z("fieldUpdatedData",a)}catch(l){console.error(l)}finally{X.value=!1}delete Y[e]})(n.key)},[a(f(M))],8,P),t[0]||(t[0]=v("   ",-1)),a(f(_),{title:"Sure to cancel?",onConfirm:e=>{return t=n.key,void delete Y[t];var t}},{default:c(()=>[u("a",null,[a(f(p))])]),_:1},8,["onConfirm"])],64)):(o(),s(y,{key:1},[f(J)?(o(),s("a",{key:0,onClick:e=>{return t=n.key,Y[t]=window.lodash.cloneDeep(I.value.filter(e=>t===e.key)[0]),$.value=Y[t],void(!1===W.value?Z("fieldUpdatedPopupData",Y[t]):Z("fieldUpdatedData",Y[t]));var t}},[a(f(D))],8,U)):b("",!0),t[1]||(t[1]=v("   ",-1)),f(K)?(o(),s(y,{key:1},[I.value.length?(o(),d(f(_),{key:0,title:"Sure to delete?",onConfirm:e=>(async e=>{const t=I.value.filter(t=>e===t.key)[0],a=[{key:"action",value:R}];for(const[n,i]of Object.entries(t))a.push({key:n,value:i});try{"success"===await O(a)&&Z("fieldDeletedData",e)}catch(l){console.error(l)}finally{X.value=!1}})(n.key)},{default:c(()=>[u("a",null,[a(f(x))])]),_:1},8,["onConfirm"])):b("",!0)],64)):b("",!0)],64))])])):(o(),s(y,{key:1},[W.value?(o(),s("div",V,[Y[n.key]?(o(),d(h,{key:0,"editable-data":Y[n.key],"field-value":Y[n.key][e.dataIndex],"field-data":te(e.field),onFieldUpdatedData:ee},null,8,["editable-data","field-value","field-data"])):(o(),s(y,{key:1},[v(k(e.prefix)+" ",1),u("span",{innerHTML:f(m)(ae(l))},null,8,z),v(" "+k(e.suffix),1)],64))])):(o(),s("div",F,[v(k(e.prefix)+" ",1),u("span",{innerHTML:f(m)(ae(l))},null,8,L),v(" "+k(e.suffix),1)]))],64))]),_:1},8,["class","data-source","columns","pagination"]))}}))}}});
