import{j as r}from"./cm-1.0.63-CSIRHMXC.js";import{e as p,n as B,aH as N,l as U}from"./index-1.0.63-oIDff4nA.js";import{a as q}from"./hooks-1.0.63-CWs3kTdT.js";import{l as w,at as A,bA as H,H as _}from"./lib-1.0.63-DJZPtMem.js";import{R as C}from"./SharedContainer-1.0.63-BGBqroWN.js";import{C as F}from"./ConfirmDialog-1.0.63-eXgm3P8b.js";import{r as K}from"./redux-1.0.63-Df-eBzJn.js";import{d as S}from"./ActionsDml-1.0.63-nhbCczlS.js";import{e as c}from"./notistack-1.0.63-B49ULGrj.js";import{a as G}from"./AppTheme-1.0.63-CLc-SnB5.js";import{u as I}from"./useAppFunctions-1.0.63-DX15IlIH.js";import{B as J}from"./Spinner-1.0.63-zcgIyS7Z.js";import{C as Q}from"./Checkbox-1.0.63-DPBXeOde.js";import{I as x}from"./iconBase-1.0.63-CFvHhC4t.js";import"./vendor-1.0.63-CN03Eozo.js";import"./Typography-1.0.63-mecuj_Wl.js";import"./ButtonBase-1.0.63-CF10PFMS.js";import"./useEnhancedEffect-1.0.63-DnR0ZFqV.js";import"./ThemeProvider-1.0.63-Cq0KMgkh.js";import"./Modal-1.0.63-fMXTbfks.js";import"./loglevel-1.0.63-BZ7XahX3.js";import"./lodash-1.0.63-hMxolcpJ.js";import"./moment-1.0.63-C5S46NFB.js";import"./cmJson-1.0.63-CyZ2MfFg.js";import"./rehyperaw-1.0.63-AkovKNCK.js";import"./markdown-1.0.63-BJvkzZkj.js";import"./AdminTheme-1.0.63-DhJ0rrw5.js";import"./useStoreFormSettings-1.0.63-CruqV90e.js";import"./useRemoveAppFromStore-1.0.63-DNpeLtWd.js";import"./Languages-1.0.63-DsTK0dJK.js";import"./useChartSettings-1.0.63-BMkc1WeB.js";import"./useLocaleUd-1.0.63-CjhlhnHj.js";import"./RestApi-1.0.63-BUfzocgq.js";import"./useScreenSize-1.0.63-DVLFV7fE.js";import"./cjs-1.0.63-4A2xol4v.js";import"./useMetadata-1.0.63-SO3BYgAj.js";import"./index-1.0.63-CrdGWoQq.js";import"./dayjs.min-1.0.63--tEOvUER.js";import"./dompurify-1.0.63-DhD2mIk-.js";import"./useFormDetails-1.0.63-B2jPpIRk.js";import"./DynamicModeEnum-1.0.63-BXuL5kgA.js";import"./StoreTypeEnum-1.0.63-Cbd7XZ4r.js";import"./FallbackSpinner-1.0.63-BLl5ldYH.js";import"./main-1.0.63.js";import"./DialogContent-1.0.63-B3W-DlSe.js";import"./index-1.0.63-BT4mpIxR.js";import"./getThemeProps-1.0.63-5ZzcWe3G.js";import"./SwitchBase-1.0.63-Br-lbcZ1.js";import"./Select-1.0.63-BMejr8a7.js";import"./Menu-1.0.63-DLh4HkF0.js";import"./createSvgIcon-1.0.63-DWL3J-DK.js";const Qi=({metaData:o,appId:m,rowData:l,storeTableSettings:n,appLanguage:t,locale:E,showForm:u,refetch:P,rowIndex:d,rowSelected:j,hasBulkActions:z,table:X,tableStore:h,requery:Y,getComponentWidth:e})=>{var R,v;w.debug(o,m,l,d,j);const s={};o.primary_key.map(i=>{l[i]&&(s[i]=l[i])}),w.debug("rowId",s);const a=q(),[M,k]=K.useState(!1),y=Object.keys(s).length>0,O=n.viewLink,T=!A(o)&&((R=o==null?void 0:o.privs)==null?void 0:R.update)&&n.transactions.update&&h.state.permissions.update!==!1&&y,V=!A(o)&&((v=o==null?void 0:o.privs)==null?void 0:v.delete)&&n.transactions.delete&&h.state.permissions.delete!==!1&&y;return I(m),r.jsxs(J,{sx:{display:"flex",alignItems:"center",gap:0},children:[z&&r.jsx(p,{title:E.toggleSelectRow,children:r.jsx(Q,{checked:j,size:e()<500?"small":"medium",sx:{"& input":{width:e()<500?"36px !important":"40px !important",height:e()<500?"36px !important":"40px !important",margin:"0 !important"},padding:"8px !important"},inputProps:{className:"pp-row-selection-checkbox"}})}),O&&r.jsx(p,{title:t.view,children:r.jsx(x,{color:"primary",size:e()<500?"small":"medium",onClick:i=>{Object.keys(s).length===0&&a(H({appId:m,data:l,context:null})),u(s,C.VIEW,d),i.stopPropagation()},children:r.jsx(B,{})})}),T&&r.jsx(p,{title:t.edit,children:r.jsx(x,{color:"primary",size:e()<500?"small":"medium",onClick:i=>{u(s,C.UPDATE,d),i.stopPropagation()},children:r.jsx(N,{})})}),V&&r.jsxs(r.Fragment,{children:[r.jsx(p,{title:t.delete,children:r.jsx(x,{color:"error",size:e()<500?"small":"medium",onClick:i=>{k(!0),i.stopPropagation()},children:r.jsx(U,{})})}),r.jsx(F,{title:t.deleteRowTitle,message:t.deleteRowMessage,open:M,setOpen:k,onConfirm:()=>{a(_({appId:m,property:{isRowCountUpdated:!0}})),S(m,s,i=>{var b;if(i!=null&&i.code&&(i!=null&&i.message)){let f=i.code;switch(((b=o==null?void 0:o.table_info)==null?void 0:b.engine)==="CONNECT"&&f==="info"&&(f="ok"),f){case"ok":c(t.deletedSuccessful,{variant:"success"}),P();break;default:console.error(i),c(i.message??t.invalidResponse,{variant:"error"})}}else console.error(i),c(t.invalidResponse,{variant:"error"})},i=>{console.error("error",i),c(i??t.invalidResponse,{variant:"error"})})},locale:t,theme:G})]})]})};export{Qi as default};
