1import{r as m,u as K,a as V,j as e}from"./app-C4JvTZ4X.js";import{A as q}from"./AlertFlashMessage-CokzZbgO.js";import{A as z}from"./AllErrorsAlert-CmuKW_Ff.js";import{S as O}from"./SubmitButton-BB6FRUtX.js";import{F as j}from"./FormFileUpload-CrJ4ec3Q.js";import{U as k}from"./UploadedImageDisplay-C7jPsO6a.js";import{F as n}from"./FormField-XBvldCIh.js";import{F as v}from"./FormFieldTextArea-B8geyHQy.js";import{F as N}from"./FormLabel-ew1pXad_.js";import{P as B}from"./progress-with-value--hhB5ned.js";import{T as C,a as F,b as p,c as y}from"./tabs-DBLv06KW.js";import{u as R}from"./use-translation-DHeTNDjg.js";import{A as W}from"./app-layout-DipAfKBm.js";import{t as $,c as G}from"./utils-D-_GmQbo.js";import S from"./my-ckeditor5-DRuF2J-q.js";/* empty css */import"./alert-B3Ey3W5a.js";import"./index-DS3HsZ3l.js";import"./button-DwBH6lL2.js";import"./index-BnEBJ9Wz.js";import"./info-UE6bRlbL.js";import"./createLucideIcon-CG5pTxDe.js";import"./x-7V8JLukm.js";import"./triangle-alert-Ch5p_wxt.js";import"./circle-check-big-CWd3UmC5.js";import"./octagon-alert-hX241wm-.js";import"./loader-circle-Bg_lRT1l.js";import"./FormErrorLabel-B7toGHpC.js";import"./input-CXgJ6cwP.js";import"./index-C7FVmubS.js";import"./index-BUMI5Alo.js";import"./index-BCqfIV5N.js";import"./index-C1Q1gb3i.js";import"./index-Biqe_qgI.js";import"./trash-2-Ck_sCjel.js";import"./use-permission-CK130x0H.js";import"./DeleteItemButton-COcgce2A.js";import"./dialog-BIWoJHtY.js";import"./index-CU5i4-2y.js";import"./index-ZA8bFkQr.js";import"./index-Brt361Md.js";import"./index-CncQ0HDQ.js";import"./index-DKCyn46H.js";import"./index-D3-XjAM9.js";import"./index-DVpavd6F.js";import"./index-gurXTEHv.js";import"./TooltipButton-tq94Z8F0.js";import"./tooltip-CfAoH_lu.js";import"./index-C2zllJwD.js";import"./index-1Iy5L9JG.js";import"./index-DelJNRNC.js";import"./label-BVf5Wk56.js";import"./index-ByS91XrP.js";import"./index-DK18vE91.js";import"./index-BNLLGoB_.js";import"./index-CcydzTQq.js";import"./index-DvELN_gx.js";import"./loader-CdHOsRsC.js";import"./collapsible-BQUm2Zt6.js";import"./sheet-C71cKAy0.js";import"./index-CgIuvsw-.js";import"./chevron-down-D0J9amyA.js";import"./dropdown-menu-K5FuZT9g.js";import"./avatar-SZNIcfMU.js";import"./use-initials-DfFBynvq.js";import"./index-OuPLi5q8.js";import"./index-CMWG4mbA.js";import"./chevrons-up-down-BPnwhvhm.js";import"./app-logo-icon-Uqsnih5R.js";import"./layout-list-CLFjrdKt.js";import"./files-BVhu-BW8.js";import"./languages-B7xwLKOF.js";import"./folder-pNH1Xiam.js";import"./book-open-C8JpCXc1.js";import"./breadcrumb-CtIJ41Ax.js";import"./chevron-right-nv3r_WUc.js";import"./NavLanguage-DTCXbuG6.js";import"./SwitchDarkModeSmoothAnimated-BY8_nwf6.js";import"./moon-DMb90bbG.js";import"./house-BjSWKC5i.js";import"./ckeditor5-GfAvKE5S.js";import"./CustomerPlugin-B_DRpgXz.js";import"./MyFileManager-BLtdIYK1.js";import"./FileManagerContext-_9LUEZYb.js";import"./my-file-manager-dialog-BgbrxW-t.js";import"./action-dropdown-B45Yae5_.js";import"./folder-plus-CK3-UDEf.js";import"./action-top-DNJYD7c4.js";import"./add-files-DiAWDxUR.js";import"./add-folder-BWIcqH5-.js";import"./files-table-data-BF_VwxaE.js";import"./NoDataDisplay-A1bi0TIj.js";import"./copy-file-url-BZ1tZawJ.js";import"./delete-file-button-BgAbomIn.js";import"./pagination-BYcypKqS.js";import"./chevrons-right-C6c8FsmF.js";import"./view-image-DiPm_1b9.js";import"./view-CRzJxBYd.js";import"./filter-NIuIDJ0t.js";import"./image-qMu2rQCZ.js";import"./file-text--557ZxSH.js";import"./search-input-BHhfEglo.js";import"./search-BjuOUtZ8.js";import"./sidebar-tree-CgWxgLxf.js";import"./scroll-area-DGUBvNTf.js";import"./index-BdQq_4o_.js";import"./tree-D7uU8bWh.js";import"./top-breadcrumb-DBUA4y1w.js";import"./dialog-DteKLvGP.js";import"./rotate-cw-CCTQ_lNI.js";function Xr({editData:r,readOnly:w}){const[l,c]=m.useState({message:"",type:"message"}),[_,I]=m.useState("default"),{types:P,parents:H,selected_page_code:A}=K().props,[d,h]=m.useState(null),[x,g]=m.useState(null),{data:s,setData:i,post:b,processing:L,transform:T,progress:f,errors:t,reset:M}=V({code:r?.code||"",parent_code:r?.parent_code||A?.toString()||null,type_code:r?.type_code||P[0]?.code||"",name:r?.name||"",name_kh:r?.name_kh||"",order_index:r?.order_index||1e4,short_description:r?.short_description||"",short_description_kh:r?.short_description_kh||"",long_description:r?.long_description||"",long_description_kh:r?.long_description_kh||"",button_title:r?.button_title||"",button_title_kh:r?.button_title_kh||"",link:r?.link||"",icon:r?.icon||"",total_views_count:r?.total_views_count||0}),U=o=>{o.preventDefault(),T(()=>({...s,icon:d?d[0]:null,images:x||null}
1)),r?.id?b(`/admin/pages/${r.id}/update`,{onSuccess:u=>{h(null),g(null),c({message:u.props.flash?.success,type:"success"})}}):b("/admin/pages",{onSuccess:u=>{M(),h(null),g(null),c({message:u.props.flash?.success,type:"success"})}})},E=[{title:"Dashboard",href:"/dashboard"},{title:"Pages",href:"/admin/pages"},{title:r?.name||"Create",href:"#"}],{t:a}=R();return e.jsx(W,{breadcrumbs:E,children:e.jsxs("form",{onSubmit:U,className:"form",children:[e.jsx(q,{type:l.type,flashMessage:l.message,setFlashMessage:c},l.message),t&&e.jsx(z,{title:"Please fix the following errors",errors:t}),e.jsx("div",{className:"sticky top-0",children:e.jsx(C,{value:_,onValueChange:o=>I(o),children:e.jsxs(F,{className:"border bg-border/50 p-1 dark:border-white/20",children:[e.jsx(p,{value:"default",className:"h-full dark:data-[state=active]:bg-white/20",children:a("Default")}),e.jsx(p,{value:"khmer",className:"h-full dark:data-[state=active]:bg-white/20",children:a("Khmer")})]})})}),_=="khmer"?e.jsxs("div",{className:"form-field-container md:grid-cols-1",children:[e.jsx(n,{id:"name_kh",name:"name_kh",label:"Name Khmer",value:s.name_kh,onChange:o=>i("name_kh",o),error:t.name_kh,containerClassName:"col-span-2"}),e.jsx(v,{id:"short_description_kh",name:"short_description_kh",label:"Short Description Khmer",value:s.short_description_kh,onChange:o=>i("short_description_kh",o),error:t.short_description_kh,containerClassName:"col-span-2"}),e.jsxs("div",{className:"col-span-2 grid content-start gap-2",children:[e.jsx(N,{label:"Long Description Khmer"}),e.jsx(S,{data:s.long_description_kh||"",setData:o=>i("long_description_kh",o)})]})]}):e.jsxs("div",{className:"form-field-container",children:[e.jsx(n,{disable:r?.children_count,id:"code",name:"code",label:"Code",value:s.code,onChange:o=>i("code",$(o)),error:t.code,description:r?.children_count>0?"Page has children â cannot update code.":"Example: my-item-code"}),e.jsx(n,{required:!0,type:"number",id:"order_index",name:"order_index",label:"Order Index",value:s.order_index||100,onChange:o=>i("order_index",Number(o)),error:t.order_index,description:"Lower number has higher priority."}),e.jsx(n,{required:!0,id:"name",name:"name",label:"Name",value:s.name,onChange:o=>i("name",o),error:t.name,containerClassName:"col-span-2"}),e.jsx(v,{id:"short_description",name:"short_description",label:"Short Description",value:s.short_description,onChange:o=>i("short_description",o),error:t.short_description,containerClassName:"col-span-2"}),e.jsxs("div",{className:"col-span-2 grid content-start gap-2",children:[e.jsx(N,{label:"Long Description"}),e.jsx(S,{data:s.long_description||"",setData:o=>i("long_description",o)})]}),e.jsx("div",{className:"col-span-2",children:e.jsxs(C,{defaultValue:"icon",className:"w-full rounded-lg bg-muted/80 p-4",children:[e.jsxs(F,{className:"border bg-border/50 p-1 dark:border-white/20",children:[e.jsx(p,{value:"icon",className:"h-full dark:data-[state=active]:bg-white/20",children:a("Icon")}),e.jsx(p,{value:"images",className:"h-full dark:data-[state=active]:bg-white/20",children:a("Images")})]}),e.jsx(y,{value:"icon",children:e.jsxs("div",{className:G("form-field-container",!r?.icon&&"md:grid-cols-1"),children:[e.jsx(j,{id:"icon",label:"Icon",files:d,setFiles:h},r?.icon),r?.icon&&e.jsx(k,{containerClassName:"mt-0",imageContainerClassName:"flex-1",label:"Uploaded Icon",images:r?.icon,basePath:"/assets/images/pages/thumb/"})]})}),e.jsx(y,{value:"images",children:e.jsxs("div",{children:[e.jsx(j,{dropzoneOptions:{maxFiles:100,maxSize:1024*1024*4,multiple:!0,accept:{"image/jpeg":[".jpeg",".jpg"],"image/png":[".png"],"image/gif":[".gif"],"image/webp":[".webp"]}},id:"images",label:"Images",files:x,setFiles:g},r?.images?.map(o=>o.image||o).join("-")),r?.images?.length>0&&e.jsx(k,{label:"Uploaded Images",permission:"page update",images:r?.images,deletePath:"/admin/pages/images/",basePath:"/assets/images/pages/thumb/"})]})})]})})]}),f&&e.jsx(B,{value:f.percentage,position:"start"}),!w&&e.jsx(O,{processing:L})]})})}export{Xr as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.