lms/public/build/assets/custom-page-create-form-YLkT7-Qi.js
2025-12-15 12:26:23 +01:00

2 lines
3.1 KiB
JavaScript

import{u as w,r as D,b as N,j as e}from"./vendor-BKmmeuxg.js";import{I as i}from"./input-error-LaPr_4wd.js";import{L as S}from"./loading-button-BnTVAMJ7.js";import{B as I}from"./button-BpNwv2aE.js";import{D as F,a as L,b as R,c as T,d as B}from"./dialog-B2gN9MvT.js";import{I as d}from"./input-DM0goJrn.js";import{L as t}from"./label-HmIcv5Yx.js";import{R as E,a as h}from"./radio-group-C0C2vfl-.js";import{S as H}from"./scroll-area-C8HGru-R.js";import{T as x}from"./textarea-CyndvowL.js";import{o as c}from"./inertia-SZXqLvQm.js";import{k as G}from"./richtor-CRcM6Du2.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const Z=({title:j,actionComponent:u})=>{const{props:g}=w(),{translate:f}=g,{input:a,button:p,common:l}=f,[v,m]=D.useState(!1),{data:o,setData:r,post:_,reset:C,errors:n,processing:b}=N({name:"",slug:"",title:"",description:"",meta_description:"",meta_keywords:"",active:!0}),y=s=>{s.preventDefault(),_(route("settings.custom-page.store"),{onSuccess:()=>{C(),m(!1)}})};return e.jsxs(F,{open:v,onOpenChange:m,children:[e.jsx(L,{children:u}),e.jsx(R,{className:"p-0",children:e.jsxs(H,{className:"max-h-[90vh] p-6",children:[e.jsx(T,{className:"mb-6",children:e.jsx(B,{children:j})}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(t,{children:l.name}),e.jsx(d,{name:"name",value:o.name,onChange:s=>c(s,r),placeholder:a.page_name_placeholder}),e.jsx(i,{message:n.name})]}),e.jsxs("div",{children:[e.jsx(t,{children:a.slug}),e.jsx(d,{name:"slug",value:o.slug,onChange:s=>c(s,r),placeholder:a.page_slug_placeholder}),e.jsx(i,{message:n.slug})]}),e.jsxs("div",{children:[e.jsx(t,{children:l.title}),e.jsx(d,{name:"title",value:o.title,onChange:s=>c(s,r),placeholder:a.page_title_placeholder}),e.jsx(i,{message:n.title})]}),e.jsxs("div",{children:[e.jsx(t,{children:a.page_contents}),e.jsx(G,{ssr:!1,output:"html",placeholder:{paragraph:a.description_placeholder,imageCaption:a.image_url_placeholder},contentMaxHeight:640,initialContent:o.description,onContentChange:s=>r(k=>({...k,description:s}))}),e.jsx(i,{message:n.description})]}),e.jsxs("div",{children:[e.jsx(t,{children:a.meta_description}),e.jsx(x,{rows:3,name:"meta_description",value:o.meta_description,onChange:s=>c(s,r),placeholder:a.meta_description_placeholder}),e.jsx(i,{message:n.meta_description})]}),e.jsxs("div",{children:[e.jsx(t,{children:a.meta_keywords}),e.jsx(x,{rows:2,name:"meta_keywords",value:o.meta_keywords,onChange:s=>c(s,r),placeholder:a.meta_keywords_placeholder}),e.jsx(i,{message:n.meta_keywords})]}),e.jsxs("div",{children:[e.jsx(t,{children:l.status}),e.jsxs(E,{value:o.active?"on":"off",onValueChange:s=>r("active",s==="on"),children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(h,{value:"off",id:"off"}),e.jsx(t,{htmlFor:"off",children:l.off})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(h,{value:"on",id:"on"}),e.jsx(t,{htmlFor:"on",children:l.on})]})]}),e.jsx(i,{message:n.active})]}),e.jsxs("div",{className:"flex justify-end gap-4",children:[e.jsx(I,{variant:"outline",type:"button",onClick:()=>m(!1),children:p.cancel}),e.jsx(S,{loading:b,type:"submit",children:p.submit})]})]})]})})]})};export{Z as default};