import{jsx as r,jsxs as i}from"react/jsx-runtime";import{C as L}from"./combobox-gnkJUuRk.js";import{I as n}from"./input-error-BbsDx4-P.js";import{L as S}from"./loading-button-B_LaGOAp.js";import{a as V,D as h,L as a,R as y,f as _,E as g,G as x,I as f,C as k}from"./ui-components-B24mpb8o.js";import{c as F}from"./course-durations-B0f021Xm.js";import{D as A}from"./layout-CZk01yM3.js";import{o as v}from"./inertia-FIn3q7f1.js";import{usePage as E,useForm as G}from"@inertiajs/react";import"lucide-react";import"react";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";import"./main-Cv60h411.js";import"./theme-colors-CLpwvDr4.js";import"./appearance-zLWEcDPI.js";import"./language-79bZLpyc.js";import"./notification-BBQVVMqD.js";import"date-fns";import"./app-logo-CAnM-q9p.js";import"./route-D0xh7FtZ.js";import"./use-lang-Cw_jKJYs.js";const R=()=>{const{props:l}=E(),{translate:b}=l,{dashboard:m,input:c,button:N}=b,{tab:C,prices:d,expiries:u,course:o}=l,{data:t,setData:p,post:D,errors:s,processing:I}=G({tab:C,pricing_type:o.pricing_type||"",price:o.price||"",discount:!!o.discount||!1,discount_price:o.discount_price||"",expiry_type:o.expiry_type||"",expiry_duration:o.expiry_duration||""});return r(V,{className:"container p-4 sm:p-6",children:i("form",{onSubmit:e=>{e.preventDefault(),D(route("courses.update",{id:o.id}))},className:"space-y-4",children:[i(h,{collapsible:!0,type:"single",value:t.pricing_type,children:[i("div",{children:[i(a,{children:[c.pricing_type," *"]}),r(y,{defaultValue:t.pricing_type,className:"flex items-center space-x-4 pt-2 pb-1",onValueChange:e=>p("pricing_type",e),children:d.map(e=>i("div",{className:"flex items-center space-x-2",children:[r(_,{className:"cursor-pointer",id:e,value:e}),r(a,{htmlFor:e,className:"capitalize",children:e})]},e))}),r(n,{message:s.pricing_type})]}),r(g,{value:d[1],className:"border-none",children:i(x,{className:"space-y-4 p-0.5",children:[i("div",{className:"pt-3",children:[i(a,{children:[m.price," *"]}),r(f,{type:"number",name:"price",value:t.price,onChange:e=>v(e,p),placeholder:c.course_price_placeholder}),r(n,{message:s.price})]}),i("div",{className:"space-y-2",children:[i("div",{className:"flex items-center space-x-2",children:[r(k,{id:"discount",name:"discount",checked:t.discount,onCheckedChange:e=>{p("discount",e)}}),r(a,{htmlFor:"discount",children:m.check_course_discount})]}),t.discount&&i("div",{children:[r(f,{type:"number",name:"discount_price",value:t.discount_price,onChange:e=>v(e,p),placeholder:c.discount_price_placeholder}),r(n,{message:s.discount_price})]})]})]})})]}),i(h,{collapsible:!0,type:"single",value:t.expiry_type,children:[i("div",{children:[r(a,{children:"Expiry period type"}),r(y,{defaultValue:t.expiry_type,className:"flex items-center space-x-4 pt-2 pb-1",onValueChange:e=>p("expiry_type",e),children:u.map(e=>i("div",{className:"flex items-center space-x-2",children:[r(_,{className:"cursor-pointer",id:e,value:e}),r(a,{htmlFor:e,className:"capitalize",children:e.replace("_"," ")})]},e))}),r(n,{message:s.expiry_type})]}),r(g,{value:u[1],className:"border-none",children:r(x,{className:"space-y-4 p-0.5",children:i("div",{className:"pt-3",children:[r(a,{children:c.expiry_duration}),r(L,{defaultValue:t.expiry_duration,data:F,placeholder:c.expiry_duration_placeholder||"Select duration",onSelect:e=>p("expiry_duration",e.value)}),r(n,{message:s.expiry_duration})]})})})]}),r("div",{className:"mt-8",children:r(S,{loading:I,children:N.save_changes})})]})})};R.layout=l=>r(A,{children:l});export{R as default};
