File "Settings-1.0.13-f2588cba.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/.wp-cli/wp-content/plugins/wp-data-access/assets/dist/Settings-1.0.13-f2588cba.js
File size: 40.21 KB
MIME-type: text/plain
Charset: utf-8

import{a5 as He,l as a,r as b,bo as Ye,a6 as ee,cz as Pe,d4 as je,d5 as Je,d6 as De,d7 as Me,d8 as Ne,j as e,d9 as de,cb as E,da as Ke,db as Qe,_ as Xe,dc as Ze,c8 as $e,J as D,dd as ce,de as Ie,df as es,dg as ss,dh as ts,di as is,dj as ns,dk as v,dl as rs,dm as te,cL as z,dn as ls,b as as,e as P,C as M,dp as os,dq as pe,dr as ds,bC as cs,P as ps,ds as us,y as ve,B as xs,dt as hs,du as gs,dv as ms}from"./main-1.0.13.js";import{u as Q,a as F,v as js,ag as Le,c as q,B as u,aA as fs,am as we,aB as bs,ap as ys,aq as Ss,ar as Cs,as as Ts,D as Ee,e as fe,T as be,aC as vs,q as ws,r as _s,s as Oe,h as Ve,R as Fs,C as Rs,G as ks,av as Us,A as As,g as Ps}from"./main-1.0.13-4cbe632d.js";import{A as _e}from"./AdminTheme-1.0.13-a1e60de2.js";import{u as Ge,S as Ns,a as Ls,I as ne,b as Es,c as Os,d as ue,T as Vs,M as Gs,P as zs,D as Bs,e as Ws,f as qs,g as Hs,h as Ys,i as Js}from"./useMetadataColumns-1.0.13-00fd71bb.js";import{S as re,a as Z,C as Te,R as Ds,B as Ms,b as Ks,c as Qs,d as Xs,e as xe,k as Zs}from"./settings-1.0.13-650559d5.js";import{i as $s,g as Is,h as et}from"./index.esm-1.0.13-0afa0259.js";import{u as ze}from"./useStoreTable-1.0.13-383948b4.js";import{d as st,e as tt,c as it}from"./index.esm-1.0.13-cc102a96.js";import{P as X}from"./PremiumFeature-1.0.13-d257b3ff.js";import{E as he}from"./EnumTypeEnum-1.0.13-7ffcf33a.js";import{A as H,a as Y}from"./AccordionSummary-1.0.13-0885ed32.js";import{A as J,L as se}from"./Link-1.0.13-03de5435.js";import{F as _,b as O,a as w,T as V,I as ye,S as Se}from"./TextField-1.0.13-7258d491.js";import{a as nt,S as rt}from"./ScopeEnum-1.0.13-d05c4b00.js";import{R as Ce}from"./RadioGroup-1.0.13-1d87a31c.js";import{R as B}from"./Radio-1.0.13-befab7cd.js";import{F as $}from"./FormControlLabel-1.0.13-143a10df.js";import{I as W,T as Be}from"./iconBase-1.0.13-98e06aa9.js";import{C as N}from"./CssUnitTextField-1.0.13-9657903d.js";import{u as lt,C as at,a as Fe,b as Re}from"./useApp-1.0.13-075adc22.js";import{D as ot,T as dt,a as ge}from"./DefaultWhere-1.0.13-d139ab5a.js";import{M as ie}from"./MenuItem-1.0.13-e7719456.js";import{j as ct,k as pt,l as ut}from"./ActionsApp-1.0.13-9ce21fa9.js";import{S as xt,a as ht,b as gt}from"./Stepper-1.0.13-4e64ee4c.js";import{B as K,C as ke,a as Ue}from"./useScreenSize-1.0.13-fa31f819.js";import"./index-1.0.13-93f67fc3.js";import mt from"./ThemeSettings-1.0.13-5f20f682.js";import{T as me}from"./Tabs-1.0.13-f71c8d5c.js";import"./ActionsDml-1.0.13-147ce8d4.js";import"./Menu-1.0.13-2a06ef00.js";import"./useTableUpdater-1.0.13-f903232c.js";import"./Checkbox-1.0.13-3ec10fcc.js";import"./Close-1.0.13-b137ce2f.js";import"./DialogContent-1.0.13-5873ffb9.js";import"./useSlot-1.0.13-62ad37b6.js";import"./ActionsExplorer-1.0.13-5e860b61.js";import"./index-1.0.13-81ade722.js";const le=s=>{const n=Q(t=>He(t,s));return a.debug("metaData",n),n},We=s=>{const n=F();return b.useCallback((t,i)=>{ct({app_id:t.app.app[0].app_id,cnt_id:t.app.container[0].cnt_id},r=>{const d=r==null?void 0:r.data;if(a.debug("response data",d),Array.isArray(d)){const o=Ye(ee.getState(),s)??[];for(let g=0;g<d.length;g++){const m=Pe(d[g]);if(m!==null&&m.cnt_id_master===t.app.container[0].cnt_id){let y="";for(let l=0;l<o.length;l++)je(ee.getState(),o[l].appId)!==void 0&&o[l].container.cnt_id===d[g].cnt_id&&(y=o[l].appId);if(y===""){const l={appId:js(),container:d[g]};n(Je({appId:s,detail:l}))}else{const l={appId:y,container:d[g]};n(De({appId:s,detail:l}))}}}}else a.error("error loading details",r),i!==void 0&&i()},r=>{a.error("error loading details",r),i!==void 0&&i()})},[s])},jt=s=>{const n=Q(t=>Me(t,s));return a.debug("detailDisplayType",n),n},L=s=>{const n=F();return i=>{n(Ne({appId:s,isUpdated:i}))}},ft=({appId:s,columnIndex:n,tableColumn:t})=>{a.debug(s,n,t),F();const i=le(s),r=Le(s);L(s);const d=o=>[];return e.jsxs(H,{disableGutters:!0,children:[e.jsxs(Y,{expandIcon:e.jsx(q,{}),sx:{fontSize:"1rem","& .MuiAccordionSummary-content":{padding:"1rem",alignItems:"center"}},children:[e.jsx(st,{}),e.jsx("span",{style:{paddingLeft:"0.5rem"},children:"Grid positioning"})]}),e.jsxs(J,{sx:{paddingTop:"0.5rem"},children:[e.jsxs(u,{children:[e.jsxs(_,{sx:{display:"grid"},children:[e.jsx(O,{children:"Grid cells"}),e.jsx(nt,{value:t.cells,min:1,max:r.cellsPerRow,step:1,marks:d(r.cellsPerRow),valueLabelDisplay:"auto",disabled:!0,onChange:(o,g)=>{a.debug(o,g)},sx:{width:"calc(100% - 40px)",margin:"20px"}})]}),e.jsx(w,{children:"Number of grid cells used (can be changed in FORM > Grid)."}),e.jsxs(_,{sx:{width:"100%"},children:[e.jsx(O,{sx:{margin:"15px 0 5px 0"},children:"Grid positioning"}),e.jsx(Ce,{sx:{flexDirection:"column",alignContent:"flex-start",marginLeft:"10px",marginBottom:"5px"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",justifyContent:"center",alignItems:"center"},children:[e.jsxs(O,{className:"align-label-radio",children:[e.jsx(B,{checked:t.cellClass===de.AUTO,disabled:!0,onChange:o=>{o.stopPropagation()}}),"Auto"]}),e.jsxs(O,{className:"align-label-radio",children:[e.jsx(B,{checked:t.cellClass===de.START,disabled:!0,onChange:o=>{o.stopPropagation()}}),"Start"]}),e.jsxs(O,{className:"align-label-radio",children:[e.jsx(B,{checked:t.cellClass===de.END,disabled:!0,onChange:o=>{o.stopPropagation()}}),"End"]}),e.jsxs(O,{children:[e.jsx(B,{checked:typeof t.cellClass=="number",disabled:!0,onChange:o=>{o.stopPropagation()}}),"Add"]}),e.jsxs("div",{style:{marginLeft:"10px",gridColumn:"span 2",display:"grid",gridTemplateColumns:"auto auto",alignItems:"center"},children:[e.jsx(V,{id:"pp-cells-before",sx:{width:"60px"},className:"pp-cells-before",type:"number",defaultValue:1,InputProps:{inputProps:{min:1,max:r.cellsPerRow-1}},disabled:!0,InputLabelProps:{shrink:!0},onChange:o=>{o.stopPropagation()}}),e.jsx(O,{sx:{marginLeft:"10px"},children:"cell(s) before"})]})]})})]}),e.jsx(w,{children:"Grid positioning relative to surrounding cells."}),t.computedField&&n!==void 0&&(i==null?void 0:i.columns[n])!==void 0&&i.columns[n].data_type==="enum"&&e.jsxs(u,{sx:{marginTop:"20px"},children:[e.jsx(O,{children:"Show values in"}),e.jsxs(Ce,{sx:{flexDirection:"column",alignContent:"flex-start",margin:"10px 0 5px 10px"},children:[e.jsxs(O,{className:"align-label-radio",children:[e.jsx(B,{checked:t.updatableEnum===void 0||t.updatableEnum===he.LIST,disabled:!0,onChange:o=>{o.stopPropagation()}}),"Drop-down List"]}),e.jsxs(O,{className:"align-label-radio",children:[e.jsx(B,{checked:t.updatableEnum===he.RADIO_HORIZONTAL,disabled:!0,onChange:o=>{o.stopPropagation()}}),"Horizontal radio group"]}),e.jsxs(O,{className:"align-label-radio",children:[e.jsx(B,{checked:t.updatableEnum===he.RADIO_VERTICAL,disabled:!0,onChange:o=>{o.stopPropagation()}}),"Vertical radio group"]})]})]})]}),e.jsx(X,{single:!1})]})]})},bt=({appId:s,columnIndex:n,tableColumn:t,columnMetaData:i})=>{a.debug(s,n,t),F(),L(s);const[r,d]=b.useState(!1);return t.computedField!==void 0||n===void 0||i===void 0||(i==null?void 0:i.data_type)!==void 0&&E(i.data_type)!=="number"?null:e.jsxs(H,{disableGutters:!0,children:[e.jsxs(Y,{expandIcon:e.jsx(q,{}),sx:{fontSize:"1rem","& .MuiAccordionSummary-content":{padding:"1rem",alignItems:"center"}},children:[e.jsx(tt,{}),e.jsx("span",{style:{paddingLeft:"0.5rem"},children:"Validation"})]}),e.jsxs(J,{sx:{paddingTop:"1rem"},children:[e.jsxs(_,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"10px"},children:[e.jsx(V,{error:r,type:"number",label:"Minimum value allowed",disabled:!0,value:t.numericMin??"",required:!1,InputLabelProps:{shrink:!0},onChange:o=>{a.debug(o)}}),e.jsx(V,{error:r,type:"number",label:"Maximum value allowed",disabled:!0,value:t.numericMax??"",required:!1,InputLabelProps:{shrink:!0},onChange:o=>{a.debug(o)}})]}),e.jsx(X,{})]})]})},yt=({appId:s,columnIndex:n,tableColumn:t,columnMetaData:i})=>{a.debug(s,n,t,i);const r=F(),d=L(s),[o,g]=b.useState(!1),m=Ge(s),y={marginTop:"20px",marginLeft:"10px"};return e.jsxs(H,{disableGutters:!0,children:[e.jsxs(Y,{expandIcon:e.jsx(q,{}),sx:{fontSize:"1rem","& .MuiAccordionSummary-content":{padding:"1rem",alignItems:"center"}},children:[e.jsx(it,{}),e.jsx("span",{style:{paddingLeft:"0.5rem"},children:"Column settings"})]}),e.jsxs(J,{sx:{display:"grid",gridGap:"2rem",paddingTop:"1rem"},children:[(t.computedField||m[t.columnName]!==void 0&&(E(m[t.columnName].data_type)==="float"||E(m[t.columnName].data_type)==="number"||E(m[t.columnName].data_type)==="time"||E(m[t.columnName].data_type,!0)==="date"||E(m[t.columnName].data_type,!0)==="datetime"||E(m[t.columnName].data_type,!0)==="timestamp"||E(m[t.columnName].data_type,!0)==="time"))&&e.jsx(u,{children:e.jsxs(_,{children:[e.jsx($,{control:e.jsx(re,{checked:!1,disabled:!0,onClick:l=>{l.stopPropagation()}}),label:"Localize",labelPlacement:"end"}),e.jsx(w,{children:t.computedField||m[t.columnName]!==void 0&&(E(m[t.columnName].data_type)==="float"||E(m[t.columnName].data_type)==="number")?"Localizes decimal and thousands seperators.":"Localizes date and time fields."})]})}),e.jsxs(_,{children:[e.jsx(V,{type:"text",variant:"outlined",label:"Default value",value:t.defaultValue??"",placeholder:(i==null?void 0:i.column_default)??"",InputLabelProps:{shrink:!0},onChange:l=>{r(Ke({appId:s,index:n,defaultValue:l.target.value})),d(!0),l.stopPropagation()}}),e.jsxs(w,{component:"div",children:[e.jsx(e.Fragment,{children:(i==null?void 0:i.column_default)!==void 0&&(i==null?void 0:i.column_default)!==null&&(i==null?void 0:i.column_default)!==""&&e.jsx(u,{sx:{fontWeight:"bold"},children:"Leave empty to use column default constraint."})}),e.jsxs("div",{children:["Only applied on insert ",o?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:e.jsx(se,{sx:{cursor:"pointer"},underline:"none",onClick:()=>{g(!1)},children:"(hide examples)"})}),e.jsxs("ul",{style:{listStyle:"disc",padding:"0 40px"},children:[e.jsx("li",{children:"Hello World"}),e.jsx("li",{children:"@wpda_wp_user_id"}),e.jsx("li",{children:"@now"})]}),e.jsx("div",{style:y,children:"Notes"}),e.jsxs("ul",{style:{listStyle:"disc",padding:"0 40px"},children:[e.jsx("li",{children:"@wpda_wp_user_id returns the WordPress user ID or 0 for anonymous requests"}),e.jsx("li",{children:"@now returns the current date/time and works with date/time fields only"}),e.jsxs("li",{children:["Column default constraints defined in the database are automatically applied",(i==null?void 0:i.column_default)!==void 0&&(i==null?void 0:i.column_default)!==null&&(i==null?void 0:i.column_default)!==""&&e.jsxs(e.Fragment,{children:[" (current value is ",e.jsx("strong",{children:i==null?void 0:i.column_default}),")"]})]})]})]}):e.jsx("span",{children:e.jsx(se,{sx:{cursor:"pointer"},underline:"none",onClick:()=>{g(!0)},children:"(show examples)"})})]})]})]}),((i==null?void 0:i.data_type)!==void 0&&i.data_type.toLowerCase()!=="text"&&i.data_type.toLowerCase()!=="enum"&&i.data_type.toLowerCase()!=="set"&&i.column_type.toLowerCase()!=="tinyint(1)"&&(E(i.data_type)==="string"||E(i.data_type)==="number")||t.computedField)&&e.jsxs(_,{children:[e.jsx(u,{sx:{display:"grid",gridTemplateColumns:"auto auto",gridGap:"10px",alignItems:"center"},children:e.jsxs(e.Fragment,{children:[e.jsx(V,{type:"text",variant:"outlined",label:"Prefix",value:t.prefix,disabled:!0,InputLabelProps:{shrink:!0},onChange:l=>{l.stopPropagation()}}),e.jsx(V,{type:"text",variant:"outlined",label:"Suffix",value:t.suffix,disabled:!0,InputLabelProps:{shrink:!0},onChange:l=>{l.stopPropagation()}})]})}),e.jsx(w,{children:"Adds a prefix and/or suffix to the column content."})]}),e.jsxs(_,{children:[e.jsx(V,{type:"text",variant:"outlined",label:"CSS classes",fullWidth:!0,value:t.classNames,disabled:!0,InputLabelProps:{shrink:!0},onChange:l=>{l.stopPropagation()}}),e.jsx(w,{children:"CSS classes (seperated by spaces) for custom styling."})]}),e.jsxs(_,{children:[e.jsx(V,{type:"text",variant:"outlined",label:"Hint",fullWidth:!0,value:t.hint,disabled:!0,InputLabelProps:{shrink:!0},onChange:l=>{l.stopPropagation()}}),e.jsx(w,{children:"Help text displayed below data entry field."})]}),e.jsx(X,{single:!1,margin:"0"})]})]})},St=({appId:s,columnIndex:n,tableColumn:t})=>{var l,C;a.debug(s,n,t);const i=F(),r=L(s),d=ze(s),o=le(s),m=Ge(s)[t.columnName],y=(R,x)=>{i(Qe({appId:s,index:R,lookup:x})),r(!0)};return e.jsxs(e.Fragment,{children:[e.jsx(ft,{appId:s,columnIndex:n,tableColumn:t}),e.jsx(yt,{appId:s,columnIndex:n,tableColumn:t,columnMetaData:m}),(((l=o==null?void 0:o.privs)==null?void 0:l.insert)||((C=o==null?void 0:o.privs)==null?void 0:C.update))&&(d.table.transactions.insert||d.table.transactions.update)&&e.jsx(bt,{appId:s,columnIndex:n,tableColumn:t,columnMetaData:m}),e.jsx(Ns,{appId:s,columnIndex:n,tableColumn:t,columnMetaData:m,setLookup:y}),e.jsx(Ls,{columnMetaData:m})]})};b.lazy(()=>Xe(()=>import("./ComputedFieldMore-1.0.13-c76766d6.js"),["./ComputedFieldMore-1.0.13-c76766d6.js","./main-1.0.13.js","./main-1.0.13-4cbe632d.js","./iconBase-1.0.13-98e06aa9.js","./main-1.0.13-dd4484b4.css","./settings-1.0.13-650559d5.js","./FormControlLabel-1.0.13-143a10df.js","./TextField-1.0.13-7258d491.js","./Close-1.0.13-b137ce2f.js","./Menu-1.0.13-2a06ef00.js","./useScreenSize-1.0.13-fa31f819.js","./DialogContent-1.0.13-5873ffb9.js","./AdminTheme-1.0.13-a1e60de2.js","./Tabs-1.0.13-f71c8d5c.js","./settings-1.0.13-e7dd0b92.css","./index.esm-1.0.13-0afa0259.js","./MenuItem-1.0.13-e7719456.js"],import.meta.url));const Ct=({appId:s,columnIndex:n})=>{a.debug(s,n);const t=F(),i=ze(s),r=Q(c=>Ze(c,s,n));a.debug("tableColumn",r);const d=L(s),o=(c,p)=>{a.debug(c,p),t(Ie({appId:s,index:c,visible:p})),d(!0)},g=(c,p)=>{a.debug(c,p),t(es({appId:s,index:c,more:p})),d(!0)},m=(c,p)=>{a.debug(c,p),t(ss({appId:s,index:c,updatable:p})),d(!0)};$e.TEXT;const[y,l]=b.useState(!1),[C,R]=b.useState(void 0),x=c=>{c!==void 0&&(t(ts({appId:s,index:c})),d(!0))},k=(c,p,T)=>(a.debug(c,p,T),e.jsxs(e.Fragment,{children:[e.jsx(u,{children:e.jsx(Es,{id:c,enabled:!1})}),e.jsxs(u,{sx:{display:"inline-grid",gridTemplateColumns:r.computedField!==void 0?"auto auto":"auto",justifyContent:"start",alignItems:"center",gap:"10px","& svg":{opacity:"0.5"}},children:[r.computedField!==void 0&&e.jsx($s,{}),e.jsx(O,{children:p})]})]}));return e.jsxs(e.Fragment,{children:[e.jsxs(H,{disableGutters:!0,slotProps:{transition:{unmountOnExit:!0}},children:[e.jsxs(Y,{className:"pp-column-settings",expandIcon:e.jsx(q,{}),sx:{justifyContent:"space-between"},children:[e.jsx(u,{sx:{display:"grid",gridTemplateColumns:"auto 1fr",alignItems:"center","& svg":{display:"flex"}},children:k(r.columnName,r.columnLabel,n)}),e.jsxs(u,{style:{display:"grid",gridTemplateColumns:"40px 40px 40px"},children:[e.jsx(Z,{title:"Visibility",position:"bottom",children:e.jsx(W,{onClick:c=>{r.visible?r.more?(o(n,!1),g(n,!1)):g(n,!0):r.more?g(n,!1):o(n,!0),c.stopPropagation()},children:r.visible?e.jsx(e.Fragment,{children:r.more?e.jsx(ne,{checked:!0,children:e.jsx(fs,{})}):e.jsx(ne,{checked:!0,children:e.jsx(we,{})})}):e.jsx(ne,{checked:!1,children:e.jsx(we,{})})})}),r.computedField?e.jsx(e.Fragment,{children:e.jsx(Z,{title:"Delete",position:"bottom",children:e.jsx(W,{onClick:c=>{l(!0),R(n),c.stopPropagation()},children:e.jsx(ys,{})})})}):e.jsx(Z,{title:"Updatable",position:"bottom",disabled:!i.table.transactions.insert&&!i.table.transactions.update,children:e.jsx(W,{disabled:!i.table.transactions.insert&&!i.table.transactions.update,onClick:c=>{m(n,!r.updatable),c.stopPropagation()},children:e.jsx(ne,{checked:r.updatable&&(i.table.transactions.insert||i.table.transactions.update),disabled:!i.table.transactions.insert&&!i.table.transactions.update,children:e.jsx(bs,{})})})}),e.jsx(Z,{title:"Alignment",position:"bottom",children:e.jsxs(W,{onClick:c=>{r.alignment===D.LEFT?t(ce({appId:s,index:n,alignment:D.CENTER})):r.alignment===D.CENTER?t(ce({appId:s,index:n,alignment:D.RIGHT})):r.alignment===D.RIGHT&&t(ce({appId:s,index:n,alignment:D.LEFT})),d(!0),c.stopPropagation()},children:[r.alignment===D.LEFT&&e.jsx(Ss,{}),r.alignment===D.CENTER&&e.jsx(Cs,{}),r.alignment===D.RIGHT&&e.jsx(Ts,{})]})})]})]}),e.jsx(J,{children:e.jsx(St,{appId:s,columnIndex:n,tableColumn:r})})]},n),e.jsx(Te,{title:"Delete computed field?",message:"Are you sure you want to delete this computed field? This action cannot be undone!",open:y,setOpen:l,onConfirm:()=>x(C)})]})},Tt=({appId:s})=>{a.debug(s),F();const n=Os(ue(zs),ue(Gs),ue(Vs));L(s);const t=r=>{const{active:d,over:o}=r;(d==null?void 0:d.id)!==(o==null?void 0:o.id)&&a.debug(d,o)},i=Q(r=>is(r,s));return i===void 0||i.length===0?null:e.jsxs(e.Fragment,{children:[e.jsx(Bs,{autoScroll:!0,sensors:n,collisionDetection:Ws,onDragEnd:t,children:e.jsx(qs,{items:i,children:i.map((r,d)=>e.jsx(Hs,{id:r,children:e.jsx(Ct,{appId:s,columnIndex:d})},r))})}),e.jsx(Ys,{appId:s,target:Ee.FORM})]})},vt=()=>{const s=Q(n=>ns(n));return a.debug("hideThemeSetting",s),s},wt=({appId:s,formSettings:n})=>(F(),L(s),e.jsxs(H,{defaultExpanded:!1,disableGutters:!0,children:[e.jsx(Y,{expandIcon:e.jsx(q,{}),children:"Field layout"}),e.jsxs(J,{sx:{display:"grid",gap:"20px"},children:[e.jsxs(_,{children:[e.jsxs(Ce,{value:n.fieldVariant,sx:{flexDirection:"row"},onChange:t=>{a.debug(t)},children:[e.jsx($,{control:e.jsx(B,{disabled:!0}),value:"outlined",label:"Outlined"},"outlined"),e.jsx($,{control:e.jsx(B,{disabled:!0}),value:"filled",label:"Filled"},"filled"),e.jsx($,{control:e.jsx(B,{disabled:!0}),value:"standard",label:"Standard"},"standard")]}),e.jsx(w,{children:"Applies to data entry forms only."})]}),e.jsx($,{control:e.jsx(re,{checked:n.hideHintsInViewMode,disabled:!0,onChange:(t,i)=>{t.stopPropagation()}}),label:"Hide hints in view mode",labelPlacement:"end"}),e.jsx(X,{})]})]})),_t=({appId:s,formSettings:n,updateSettings:t})=>{F(),L(s);const[i,r]=b.useState(!1);return e.jsxs(H,{defaultExpanded:!1,disableGutters:!0,children:[e.jsx(Y,{expandIcon:e.jsx(q,{}),children:"Grid"}),e.jsxs(J,{sx:{display:"grid",gridTemplateColumns:"repeat(1, 1fr)",gap:"20px",marginTop:"5px"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[e.jsx(V,{type:"number",label:"Cells per row",value:n.cellsPerRow,disabled:!0,InputLabelProps:{shrink:!0},onChange:d=>{a.debug(d)}}),e.jsx(N,{label:"Space between cells",textField:{cssValue:n.spacing.betweenCells,cssUnit:n.spacing.betweenCellsUnit},defaultValue:{cssValue:v.betweenCells,cssUnit:v.betweenCellsUnit},updateSettings:d=>{a.debug(d)}})]}),e.jsx($,{control:e.jsx(re,{disabled:!0,checked:n.showGrid,onChange:(d,o)=>{a.debug(d,o)}}),label:"Show grid"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",marginTop:"10px"},children:[e.jsx(N,{label:"Padding top",textField:{cssValue:n.spacing.aroundGridTop,cssUnit:n.spacing.aroundGridTopUnit},defaultValue:{cssValue:v.aroundGridTop,cssUnit:v.aroundGridTopUnit},updateSettings:d=>{a.debug(d)}}),e.jsx(N,{label:"Padding bottom",textField:{cssValue:n.spacing.aroundGridBottom,cssUnit:n.spacing.aroundGridBottomUnit},defaultValue:{cssValue:v.aroundGridBottom,cssUnit:v.aroundGridBottomUnit},updateSettings:d=>{a.debug(d)}}),e.jsx(N,{label:"Padding left",textField:{cssValue:n.spacing.aroundGridLeft,cssUnit:n.spacing.aroundGridLeftUnit},defaultValue:{cssValue:v.aroundGridLeft,cssUnit:v.aroundGridLeftUnit},updateSettings:d=>{a.debug(d)}}),e.jsx(N,{label:"Padding right",textField:{cssValue:n.spacing.aroundGridRight,cssUnit:n.spacing.aroundGridRightUnit},defaultValue:{cssValue:v.aroundGridRight,cssUnit:v.aroundGridRightUnit},updateSettings:d=>{a.debug(d)}})]}),e.jsxs(w,{component:"div",sx:{marginTop:"10px"},children:[e.jsxs(se,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>r(!i),children:[e.jsx(fe,{}),"How to use the grid?"]}),i&&e.jsxs(u,{sx:{marginTop:"20px",display:"grid",gap:"20px"},children:[e.jsxs(u,{children:["All form fields are organized into a form grid, which consists of ",e.jsx("strong",{children:"rows"})," and ",e.jsx("strong",{children:"cells"}),'. Each row contains a fixed number of cells, determined by the "Cells per row" setting. The grid ensures consistent layout and alignment for all form fields.']}),e.jsxs(u,{children:["Each form field can occupy from 1 to n cells, where n is the number of cells per row. This value can be adjusted on a per-column basis in ",e.jsx("strong",{children:"Grid positioning"}),". To access the grid position for a specific column, open the ",e.jsx("strong",{children:"COLUMNS"})," section, navigate to the column, and select the ",e.jsx("strong",{children:"Grid positioning"})," option. Grid positioning allows you to adjust the display of empty cells before a field or position a field at the beginning or end of a row."]}),e.jsxs(u,{children:["The grid can be displayed during form design to visualize column positioning and spacing. This feature is available only in the ",e.jsx("strong",{children:"Form Builder"})," and is not visible during runtime."]})]})]}),e.jsx(X,{single:!1})]})]})},Ft=({formSettings:s,updateSettings:n})=>e.jsxs(H,{defaultExpanded:!1,disableGutters:!0,children:[e.jsx(Y,{expandIcon:e.jsx(q,{}),children:"Cells"}),e.jsxs(J,{style:{display:"grid",gridTemplateColumns:"repeat(1, 1fr)"},children:[e.jsxs(_,{children:[e.jsxs(u,{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",marginTop:"5px"},children:[e.jsx(N,{label:"Padding top",textField:{cssValue:s.spacing.cellTop,cssUnit:s.spacing.cellTopUnit},defaultValue:{cssValue:v.cellTop,cssUnit:v.cellTopUnit},updateSettings:t=>{a.debug(t)}}),e.jsx(N,{label:"Padding bottom",textField:{cssValue:s.spacing.cellBottom,cssUnit:s.spacing.cellBottomUnit},defaultValue:{cssValue:v.cellBottom,cssUnit:v.cellBottomUnit},updateSettings:t=>{a.debug(t)}}),e.jsx(N,{label:"Padding left",textField:{cssValue:s.spacing.cellLeft,cssUnit:s.spacing.cellLeftUnit},defaultValue:{cssValue:v.cellLeft,cssUnit:v.cellLeftUnit},updateSettings:t=>{a.debug(t)}}),e.jsx(N,{label:"Padding right",textField:{cssValue:s.spacing.cellRight,cssUnit:s.spacing.cellRightUnit},defaultValue:{cssValue:v.cellRight,cssUnit:v.cellRightUnit},updateSettings:t=>{a.debug(t)}})]}),e.jsx(w,{sx:{marginTop:"20px"},children:"Spacing around cells."})]}),e.jsx(X,{single:!1})]})]}),Rt=({formSettings:s,updateSettings:n})=>e.jsxs(H,{defaultExpanded:!1,disableGutters:!0,children:[e.jsx(Y,{expandIcon:e.jsx(q,{}),children:"Field spacing"}),e.jsxs(J,{sx:{display:"grid"},children:[e.jsxs(_,{children:[e.jsxs(u,{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",marginTop:"5px"},children:[e.jsx(N,{label:"Padding top",textField:{cssValue:s.spacing.fieldTop,cssUnit:s.spacing.fieldTopUnit},defaultValue:{cssValue:v.fieldTop,cssUnit:v.fieldTopUnit},updateSettings:t=>{a.debug(t)}}),e.jsx(N,{label:"Padding bottom",textField:{cssValue:s.spacing.fieldBottom,cssUnit:s.spacing.fieldBottomUnit},defaultValue:{cssValue:v.fieldBottom,cssUnit:v.fieldBottomUnit},updateSettings:t=>{a.debug(t)}}),e.jsx(N,{label:"Padding left",textField:{cssValue:s.spacing.fieldLeft,cssUnit:s.spacing.fieldLeftUnit},defaultValue:{cssValue:v.fieldLeft,cssUnit:v.fieldLeftUnit},updateSettings:t=>{a.debug(t)}}),e.jsx(N,{label:"Padding right",textField:{cssValue:s.spacing.fieldRight,cssUnit:s.spacing.fieldRightUnit},defaultValue:{cssValue:v.fieldRight,cssUnit:v.fieldRightUnit},updateSettings:t=>{a.debug(t)}})]}),e.jsx(w,{sx:{marginTop:"20px"},children:"Spacing within data entry fields."})]}),e.jsx(X,{single:!1})]})]}),kt=({appId:s,formSettings:n})=>{var d;const t=F(),i=L(s),r=le(s);return!((d=r==null?void 0:r.privs)!=null&&d.update)||r.primary_key.length===0?null:e.jsxs(H,{defaultExpanded:!1,disableGutters:!0,children:[e.jsx(Y,{expandIcon:e.jsx(q,{}),children:"Null value handling"}),e.jsxs(J,{sx:{display:"grid"},children:[e.jsx($,{control:e.jsx(re,{checked:n.preserveSpacesOnUpdate,onChange:(o,g)=>{t(rs({appId:s,preserveSpaces:g})),i(!0),o.stopPropagation()}}),label:"Preserve empty strings on update",labelPlacement:"end"}),e.jsx(w,{children:"Enable to preserve empty strings for mandatory columns. Works only if the actual column value contains an empty spaces. Does not allow strings to be emptied."}),e.jsx(w,{children:"This feature is enabled by default on WordPress tables."}),e.jsx(w,{sx:{fontWeight:"bold"},children:"Do NOT change the default unless you really need to!"})]})]})},Ae=({appId:s,app:n,relationship:t,metaData:i,isRelationTable:r})=>{a.debug(s,n,t,i);const d=F(),o=L(s),[g,m]=b.useState(t.sql!==void 0&&t.sql!==""),[y,l]=b.useState(r?t.relationJoins.split(",").map(c=>{const p=c.split("=");return{masterColumn:p[0],detailColumn:p[1]??""}}):t.joins.split(",").map(c=>{const p=c.split("=");return{masterColumn:p[0],detailColumn:p[1]??""}}));a.debug("joins",y),b.useEffect(()=>{const c={...t};r?c.relationJoins=y.map(p=>p.masterColumn+"="+p.detailColumn).join(","):c.joins=y.map(p=>p.masterColumn+"="+p.detailColumn).join(","),d(te({appId:s,relationship:c})),o(!0)},[y]);const C=r?t.tbl:i.app.container[0].cnt_tbl,R=r?t.cls:i.app.container[0].cnt_cls===void 0||i.app.container[0].cnt_cls===null||i.app.container[0].cnt_cls===""?{}:JSON.parse(i.app.container[0].cnt_cls),x=r?n.appRelationTable:n.appTable,k=r?n.appRelationColumns:n.appColumns;return e.jsxs(u,{children:[...y.map((c,p)=>e.jsxs(u,{sx:{display:"grid",marginTop:"10px"},children:[e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) 20px minmax(0, 1fr) auto",alignItems:"center"},children:[e.jsxs(_,{children:[e.jsx(ye,{variant:"outlined",children:"master *"}),e.jsxs(Se,{MenuProps:{id:"pp-select-menu"},label:"master *",value:c.masterColumn,onChange:T=>{const U=[...y];U[p].masterColumn=T.target.value,l(U),o(!0)},children:[...R.map(T=>T.isSelected?e.jsxs(ie,{value:T.columnName,children:[C,".",T.columnName]}):null)]})]}),e.jsx(u,{sx:{textAlign:"center"},children:"="}),e.jsxs(_,{children:[e.jsx(ye,{variant:"outlined",children:"detail *"}),e.jsxs(Se,{MenuProps:{id:"pp-select-menu"},label:"detail *",value:c.detailColumn,onChange:T=>{const U=[...y];U[p].detailColumn=T.target.value,l(U),o(!0)},children:[...k.map(T=>T.isSelected?e.jsxs(ie,{value:T.columnName,children:[x,".",T.columnName]}):null)]})]}),e.jsx(u,{children:p===0?e.jsx(be,{title:"Add condition",children:e.jsx(W,{color:"primary",onClick:()=>{const T=[...y];T.push({masterColumn:"",detailColumn:""}),l(T),o(!0)},children:e.jsx(Is,{})})}):e.jsx(be,{title:"Delete condition",children:e.jsx(W,{color:"primary",onClick:()=>{const T=[...y];T.splice(p,1),l(T),o(!0)},children:e.jsx(et,{})})})})]}),e.jsx(u,{children:e.jsx(_,{children:e.jsx(w,{children:"Updating requires a table reload."})})})]})),e.jsx(u,{sx:{marginTop:"20px"},children:g?e.jsxs(_,{fullWidth:!0,children:[e.jsx(V,{fullWidth:!0,label:"Optional conditions",multiline:!0,minRows:1,maxRows:10,value:r?t.relationSql:t.sql,placeholder:"Use this field to add additional conditions to show specific details only or leave blank",onChange:c=>{const p={...t};r?p.relationSql=c.target.value:p.sql=c.target.value,d(te({appId:s,relationship:p})),o(!0)}}),e.jsx(ot,{})]}):e.jsxs(se,{onClick:()=>m(!0),sx:{textDecoration:"none",cursor:"pointer",display:"flex",alignItems:"center",gap:"5px"},children:[e.jsx(vs,{}),e.jsx("span",{children:"Add SQL conditions"})]})}),t.cardinality===z.ONE_TO_ONE&&e.jsx(u,{sx:{marginTop:"20px"},children:e.jsx(_,{fullWidth:!0,children:e.jsx(w,{children:"A join for a 1:1 relationship must return exactly one record. An error is shown when a detail query returns more than 1 record."})})})]})},Ut=({appId:s,metaData:n,isUpdating:t,initialRelationships:i,initialTitle:r,embedded:d,enableWizard:o})=>{const g=F(),m=We(s),y=L(s),l=lt(),[C,R]=b.useState(d);a.debug("typeSelected",C);const x=Q(h=>ls(h));a.debug("relationship",x),b.useEffect(()=>{const h={...x};h.title=l.appTitle??"",h.dbs=l.appDatabase??"",h.tbl=l.appTable??"",h.cls=l.appColumns,h.relationTbl=l.appRelationTable??"",h.relationCls=l.appRelationColumns,g(te({appId:s,relationship:h}))},[l.appDatabase,l.appTable,l.appRelationTable,l.appColumns,l.appRelationColumns,l.appTitle]);const[k,c]=b.useState(""),p=b.useMemo(()=>x.cardinality===z.MANY_TO_MANY?["Relationship title","Select join table","Define join table join condition","Select relation table","Define relation table join condition"]:["Relationship title","Select data source","Define join condition"],[x.cardinality]),[T,U]=b.useState(0),I=h=>{switch(a.debug(h),h){case 0:if(l.appTitle===""||l.appTitle===null||r!==l.appTitle&&i.filter(j=>j.title===l.appTitle).length>0)return c("title"),!1;c("");break;case 1:if(l.appDatabase===""||l.appDatabase===null||l.appTable===""||l.appTable===null||l.appColumns.filter(j=>j.isSelected===!0).length===0)return!1;c("");break;case 2:if(x.joins==="=")return!1;c("");break;case 3:if(l.appRelationColumns.filter(j=>j.isSelected===!0).length===0)return!1;c("");break;case 4:if(x.relationJoins==="=")return!1;c("");break}return!0},G=h=>(a.debug(h),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",justifyContent:"space-between",alignItems:"center",gap:"5px"},children:[h===0?e.jsx(u,{}):e.jsx(K,{variant:"contained",startIcon:e.jsx(ws,{}),onClick:()=>{U(h-1)},children:"Previous"}),h===2&&x.cardinality!==z.MANY_TO_MANY||h===4&&x.cardinality===z.MANY_TO_MANY?e.jsx(K,{variant:"contained",startIcon:e.jsx(_s,{}),onClick:()=>{I(h)&&U(h+1)},children:"Finish"}):e.jsx(K,{variant:"contained",endIcon:e.jsx(Oe,{}),onClick:()=>{I(h)&&U(h+1)},children:"Next"})]}));return C?e.jsxs(e.Fragment,{children:[e.jsx(xt,{activeStep:T,orientation:"vertical",sx:{marginBottom:0},children:p.map((h,j)=>e.jsxs(ht,{children:[e.jsx(gt,{children:h}),e.jsx(Js,{children:e.jsxs(u,{sx:{display:"grid",gap:"20px",marginTop:"20px"},children:[j===0&&e.jsxs(e.Fragment,{children:[e.jsx(V,{type:"text",label:"Title",error:k==="title",value:l.appTitle,fullWidth:!0,required:!0,helperText:"Container title (must be unique witin this form)",autoComplete:"off",onChange:f=>{g(as({appTitle:f.target.value}));const S={...x};S.title=f.target.value,g(te({appId:s,relationship:S})),y(!0)}}),G(j)]}),j===1&&e.jsxs(e.Fragment,{children:[e.jsx(at,{}),e.jsx(Fe,{isDetail:!0}),e.jsx(Re,{app:l}),G(j)]}),j===2&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{appId:s,app:l,metaData:n,relationship:x}),G(j)]}),x.cardinality===z.MANY_TO_MANY&&j===3&&e.jsxs(e.Fragment,{children:[e.jsx(Fe,{isDetail:!0,isRelationTable:!0}),e.jsx(Re,{app:l,isRelationTable:!0}),G(j)]}),x.cardinality===z.MANY_TO_MANY&&j===4&&e.jsxs(e.Fragment,{children:[e.jsx(Ae,{appId:s,app:l,metaData:n,relationship:x,isRelationTable:!0}),G(j)]})]})})]},h))}),T===p.length&&e.jsxs(u,{sx:{marginTop:"20px",display:"grid",gap:"20px"},children:[e.jsx(u,{children:"Relationship wizard successfully completed. Click button below to activate."}),e.jsx(K,{fullWidth:!0,variant:"contained",onClick:()=>{const h={app_id:n.app.container[0].app_id,app_title:x.title,app_dbs:x.dbs,app_tbl:x.tbl,app_cls:x.cls},j={cnt_id_master:n.app.container[0].cnt_id,cardinality:x.cardinality,join_condition:x.joins,sql:x.sql};x.cardinality===z.MANY_TO_MANY&&(j.relation_tbl=x.relationTbl,j.relation_cls=x.relationCls,j.relation_join_condition=x.relationJoins,j.relation_sql=x.relationSql),h.app_relation=JSON.stringify(j),t?(h.app_cnt=l.appCntId,ut(h,f=>{a.debug(f),(f==null?void 0:f.code)==="ok"&&(f==null?void 0:f.message)===""?(o(!1),P("Relationship updated",{variant:"success"}),m(n,()=>{P(M.contactSupport,{variant:"error"})}),y(!1)):P(M.contactSupport,{variant:"error"})},f=>{a.error(f),P(M.contactSupport,{variant:"error"})},!1)):pt(h,f=>{a.debug(f),(f==null?void 0:f.code)==="ok"&&(f==null?void 0:f.message)===""?(o(!1),P("Relationship created",{variant:"success"}),m(n,()=>{P(M.contactSupport,{variant:"error"})}),y(!1)):P(M.contactSupport,{variant:"error"})},f=>{a.error(f),P(M.contactSupport,{variant:"error"})},!1)},children:t?"Update relationship":"Create relationship"})]})]}):e.jsx(u,{children:e.jsxs(_,{fullWidth:!0,children:[e.jsxs(dt,{fullWidth:!0,color:"primary",exclusive:!0,value:x.cardinality,onChange:(h,j)=>{if(j!==null){const f={...x};f.cardinality=j,g(te({appId:s,relationship:f}))}y(!0),R(!0)},children:[e.jsx(ge,{value:z.ONE_TO_ONE,children:"1:1"}),e.jsx(ge,{value:z.ONE_TO_MANY,children:"1:m"}),e.jsx(ge,{value:z.MANY_TO_MANY,children:"m:m"})]}),e.jsx(w,{children:"Select cardinality."})]})})},At=({children:s,appId:n,embedded:t,enableWizard:i})=>{const r=L(n),d=()=>e.jsxs(u,{children:[e.jsx(u,{sx:{paddingTop:"30px"},children:s}),e.jsx(be,{title:"Close",sx:{position:"absolute",top:0,right:"8px"},children:e.jsx(W,{onClick:()=>{i(!1),r(!1)},children:e.jsx(Ve,{})})})]});return t?e.jsxs(u,{sx:{marginLeft:"-10px",marginRight:"-10px",position:"relative"},children:[e.jsx(Be,{component:"div",sx:{height:"40px",display:"flex",alignItems:"center",marginBottom:"-10px"},children:"Relationship Wizard"}),d()]}):e.jsx(u,{children:e.jsxs("fieldset",{className:"pp-fieldset",style:{padding:"20px",position:"relative"},children:[e.jsx("legend",{children:"Relationship Wizard"}),d()]})})},Pt=({appId:s,updateSettings:n})=>{var G;a.debug(s);const t=F();Fs();const i=jt(s),r=Rs(s);ks(),We(s);const[d,o]=b.useState(!1);a.debug("wizardOn",d);const[g,m]=b.useState(!1);a.debug("wizardIsUpdating",g);const[y,l]=b.useState("");a.debug("wizardTitle",y);const C=le(s);a.debug(C);const[R,x]=b.useState([]);a.debug(R),b.useEffect(()=>{var j,f;const h=[];if(r!==void 0&&r.length>0&&((j=C==null?void 0:C.app)==null?void 0:j.container)!==void 0&&Array.isArray((f=C==null?void 0:C.app)==null?void 0:f.container)){const S=C.app.container[0].cnt_id,ae=C.app.container[0].cnt_tbl;for(let A=0;A<r.length;A++){const oe=Pe(r[A].container);if(oe!==null&&oe.cnt_id_master===S){const qe=r[A].appId;h.push({appId:qe,dbAppId:r[A].container.app_id,cntId:r[A].container.cnt_id,title:r[A].container.cnt_title,dbs:r[A].container.cnt_dbs,tbl:r[A].container.cnt_tbl,cls:r[A].container.cnt_cls===void 0||r[A].container.cnt_cls===null||r[A].container.cnt_cls===""?{}:JSON.parse(r[A].container.cnt_cls),relation:oe,parentTbl:ae})}}}x(h)},[s,(G=C==null?void 0:C.app)==null?void 0:G.container,r]),b.useState(""),b.useState(-1);const[k,c]=b.useState(!1);b.useState("");const[p,T]=b.useState(!1),[U,I]=b.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(H,{defaultExpanded:!1,disableGutters:!0,children:[e.jsx(Y,{expandIcon:e.jsx(q,{}),children:"Relationships"}),e.jsxs(J,{children:[e.jsx(u,{sx:{marginBottom:"30px"},children:d?e.jsx(e.Fragment,{children:!g&&e.jsx(At,{appId:s,embedded:!1,enableWizard:o,children:e.jsx(Ut,{appId:s,embedded:!1,metaData:C,isUpdating:g,enableWizard:o,initialRelationships:R,initialTitle:""})})}):e.jsx(K,{variant:"contained",fullWidth:!0,disabled:!0,startIcon:e.jsx(Us,{}),endIcon:e.jsx(Oe,{}),onClick:()=>{},children:"Start relationship wizard"})}),!1,e.jsx(e.Fragment,{children:R.length>0&&e.jsx(u,{sx:{marginTop:"30px"},children:e.jsxs(_,{fullWidth:!0,children:[e.jsx(ye,{variant:"outlined",children:"Display type"}),e.jsxs(Se,{MenuProps:{id:"pp-select-menu"},value:i,label:"Display type",onChange:h=>{t(os({appId:s,displayType:h.target.value})),n(!0)},children:[e.jsx(ie,{value:pe.ACOORDION,children:"Accordion"}),e.jsx(ie,{value:pe.TAB,children:"Tabs"}),e.jsx(ie,{value:pe.TITLE,children:"Titles"})]}),e.jsx(w,{children:"Select how relationships should be displayed."})]})})}),e.jsxs(w,{component:"div",sx:{marginTop:"30px"},children:[e.jsxs(se,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>T(!p),children:[e.jsx(fe,{}),"How to use the relationship wizard?"]}),p&&e.jsxs(u,{sx:{marginTop:"20px",marginBottom:"30px",display:"grid",gap:"20px"},children:[e.jsx(u,{children:"The following relationship types are supported:"}),e.jsxs("ul",{style:{listStyle:"disc",padding:"0 40px"},children:[e.jsx("li",{children:"one to one relationship (1:1)"}),e.jsx("li",{children:"one to many relationship (1:m)"}),e.jsx("li",{children:"many to many relationship (m:m)"})]}),e.jsxs(u,{children:["To add a relationship, click the ",e.jsx("strong",{children:"start relationship wizard"})," button and follow the instructions. Relationships are added to the bottom of the form. Use the display type to define how relationships are displayed (possible values are: ",e.jsx("strong",{children:"Accordion"}),", ",e.jsx("strong",{children:"Tabs"})," or ",e.jsx("strong",{children:"Titles"}),")."]})]})]}),e.jsxs(w,{component:"div",children:[e.jsxs(se,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>I(!U),children:[e.jsx(fe,{}),"How to create a multi level master detail form?"]}),U&&e.jsx(u,{sx:{marginTop:"20px",display:"grid",gap:"20px"},children:e.jsxs(u,{children:["Add a ",e.jsx("strong",{children:"relationship"})," to the ",e.jsx("strong",{children:"master table"})," using the ",e.jsx("strong",{children:"relationship wizard"}),". Open the ",e.jsx("strong",{children:"detail table"})," and navigate to the detail form using the new or edit button. Open the ",e.jsx("strong",{children:"Form Builder"})," of the detail form. The button to access the ",e.jsx("strong",{children:"Form Builder"})," is available from the table footer. Open the ",e.jsx("strong",{children:"Relationships"})," section and start the ",e.jsx("strong",{children:"relationship wizard"}),"."]})})]}),e.jsx(X,{})]})]}),k&&e.jsx(Te,{title:"Delete Relationship?",message:"Are you sure you want to delete this relationship? This action cannot be undone!",open:k,setOpen:c,onConfirm:()=>{}})]})},Nt=()=>{const s=Q(n=>ds(n));return a.debug("isRelationForm",s),s},Lt=({appId:s})=>{a.debug(s),F(),L(s);const n=Nt(),t=Le(s),i=r=>{a.debug(r)};return e.jsxs(e.Fragment,{children:[n!==!0&&e.jsx(Pt,{appId:s,updateSettings:i}),e.jsx(wt,{appId:s,formSettings:t}),e.jsx(_t,{appId:s,formSettings:t,updateSettings:i}),e.jsx(Ft,{formSettings:t,updateSettings:i}),e.jsx(Rt,{formSettings:t,updateSettings:i}),e.jsx(kt,{appId:s,formSettings:t})]})},fi=({appId:s})=>{var j,f;a.debug(s);const n=F(),t=vt(),[i,r]=b.useState(je(ee.getState(),s));a.debug(i);const[d,o]=b.useState(cs(ee.getState(),s));a.debug(d);const g=()=>ms(ee.getState(),s),m=S=>{n(Ne({appId:s,isUpdated:S}))},[y,l]=b.useState(!1),C=((j=_e)==null?void 0:j.palette.mode)===ps.LIGHT?(f=_e)==null?void 0:f.palette.primary.main:"",R=S=>{n(xs({anchor:S}))},x=()=>{i!==void 0&&n(hs({appId:s,formState:i}))},k=()=>{n(gs({})),m(!1)},c=()=>{g()?l(!0):(x(),k())},p=()=>{Zs(s,rt.GLOBAL,S=>{if(a.debug(S),S!=null&&S.code&&(S==null?void 0:S.message)!==void 0)switch(S.code){case"ok":r(je(ee.getState(),s)),P(S.message,{variant:"success"});break;case"info":P(S.message,{variant:"info"});break;default:a.error(S),P(S.message??M.contactSupport,{variant:"error"})}else a.error(S),P(M.contactSupport,{variant:"error"})},S=>{a.error("error",S),P(S??M.contactSupport,{variant:"error"})}),m(!1)},T=()=>{g()?(p(),setTimeout(()=>{k()},1e3)):k()},[U,I]=b.useState("1"),G=(S,ae)=>{I(ae)},h=Q(S=>us(S,s));return e.jsx(e.Fragment,{children:h&&e.jsxs(e.Fragment,{children:[e.jsxs(Ds,{closeDrawer:c,children:[e.jsx(As,{position:"static",elevation:4,sx:{borderRadius:0},children:e.jsxs(Ps,{className:"pp-setting-toolbar",sx:{borderRadius:0},children:[e.jsx(Be,{variant:"h5",noWrap:!0,component:"div",className:"unselectable",sx:{flexGrow:1,display:{xs:"none",sm:"block"},paddingLeft:"6px"},children:"Form Builder"}),e.jsx(Z,{title:"Dock to left",position:"bottom",children:e.jsx(W,{onClick:()=>{R(ve.LEFT)},size:"large",color:"inherit",sx:{fontSize:"1em"},children:e.jsx(Ms,{})})}),e.jsx(Z,{title:"Dock to right",position:"bottom",children:e.jsx(W,{onClick:()=>{R(ve.RIGHT)},size:"large",color:"inherit",sx:{fontSize:"1em"},children:e.jsx(Ks,{})})}),e.jsx(Z,{title:"Close",position:"bottom",children:e.jsx(W,{onClick:c,size:"large",color:"inherit",sx:{fontSize:"1.4em"},children:e.jsx(Ve,{})})})]})}),e.jsx(ke,{className:"pp-settings-container",children:e.jsx(Ue,{sx:{padding:0,margin:0},children:e.jsxs(Qs,{value:U,children:[e.jsxs(Xs,{variant:"fullWidth",textColor:"primary",onChange:G,sx:{width:"100%",height:"80px",padding:0,margin:0,backgroundColor:"rgb(242, 242, 242)"},children:[e.jsx(me,{label:"Form",value:"1",sx:{fontWeight:"bold",fontSize:"110%",height:"80px"}}),e.jsx(me,{label:"Columns",value:"2",sx:{fontWeight:"bold",fontSize:"110%",height:"80px"}}),t!==!0&&e.jsx(me,{label:"Theme",value:"3",sx:{fontWeight:"bold",fontSize:"110%",height:"80px"}})]}),e.jsxs(u,{sx:{margin:0,padding:0,overflowY:"auto",height:"calc(100vh - 250px)","& > div.MuiTabPanel-root":{padding:0}},children:[e.jsx(xe,{value:"1",children:e.jsx(Lt,{appId:s})}),e.jsx(xe,{value:"2",children:e.jsx(Tt,{appId:s})}),t!==!0&&e.jsx(xe,{value:"3",children:e.jsx(mt,{appId:s,source:Ee.FORM,setIsUpdated:m})})]})]})})}),e.jsx(ke,{className:"pp-setting-footer",sx:{borderRadius:0,backgroundColor:C},children:e.jsxs(Ue,{className:"pp-setting-footer-buttons",sx:{borderRadius:0},children:[e.jsx(K,{variant:"outlined",className:"footer_action_button_apply",onClick:p,children:"Apply"}),e.jsx(K,{variant:"outlined",className:"footer_action_button",onClick:T,children:"OK"}),e.jsx(K,{variant:"outlined",className:"footer_action_button",onClick:c,children:"Cancel"})]})})]}),e.jsx(Te,{title:"Close Form Builder?",message:"All uncommitted changes will be lost!",open:y,setOpen:l,onConfirm:()=>{x(),k()},onKeep:()=>{k()}})]})})};export{fi as default};