import{u as N,b,j as e}from"./vendor-BKmmeuxg.js";import{C}from"./combobox-Byd5-E0j.js";import{I as n}from"./input-error-LaPr_4wd.js";import{L as S}from"./loading-button-BnTVAMJ7.js";import{A as p,a as l,c as d}from"./accordion-CNBvFN43.js";import{C as E}from"./card-D9_SJYq6.js";import{C as I}from"./checkbox-BBZKtHnN.js";import{I as m}from"./input-DM0goJrn.js";import{L as a}from"./label-HmIcv5Yx.js";import{R as u,a as x}from"./radio-group-C0C2vfl-.js";import{c as V}from"./course-durations-B0f021Xm.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";import"./popover-B4kBsMuI.js";const J=()=>{const{props:h}=N(),{tab:j,exam:r,translate:g}=h,{input:o}=g,{data:i,setData:c,post:y,errors:t,processing:_}=b({tab:j,pricing_type:r.pricing_type||"paid",price:r.price||"",discount:!!r.discount||!1,discount_price:r.discount_price||"",expiry_type:r.expiry_type||"",expiry_duration:r.expiry_duration||""}),f=s=>{s.preventDefault(),y(route("exams.update",{exam:r.id}))},v=["free","paid"];return e.jsx(E,{className:"container p-4 sm:p-6",children:e.jsxs("form",{onSubmit:f,className:"space-y-4",children:[e.jsxs(p,{collapsible:!0,type:"single",value:i.pricing_type,children:[e.jsxs("div",{children:[e.jsx(a,{children:"Pricing Type *"}),e.jsx(u,{defaultValue:i.pricing_type,className:"flex items-center space-x-4 pt-2 pb-1",onValueChange:s=>c("pricing_type",s),children:v.map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(x,{className:"cursor-pointer",id:s,value:s}),e.jsx(a,{htmlFor:s,className:"cursor-pointer capitalize",children:s})]},s))}),e.jsx(n,{message:t.pricing_type})]}),e.jsx(l,{value:"paid",className:"border-none",children:e.jsxs(d,{className:"space-y-4 p-0.5",children:[e.jsxs("div",{className:"pt-3",children:[e.jsx(a,{children:"Price *"}),e.jsx(m,{type:"number",name:"price",value:i.price.toString(),onChange:s=>c("price",s.target.value),placeholder:"Enter your exam price ($0)"}),e.jsx(n,{message:t.price})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(I,{id:"discount",name:"discount",checked:i.discount,onCheckedChange:s=>{c("discount",s===!0)}}),e.jsx(a,{htmlFor:"discount",className:"cursor-pointer",children:"Exam Discount"})]}),i.discount&&e.jsxs("div",{children:[e.jsx(m,{type:"number",name:"discount_price",value:i.discount_price.toString(),onChange:s=>c("discount_price",s.target.value),placeholder:"Enter discount price"}),e.jsx(n,{message:t.discount_price})]})]})]})})]}),e.jsxs(p,{collapsible:!0,type:"single",value:i.expiry_type,children:[e.jsxs("div",{children:[e.jsx(a,{children:"Expiry period type"}),e.jsx(u,{defaultValue:i.expiry_type,className:"flex items-center space-x-4 pt-2 pb-1",onValueChange:s=>c("expiry_type",s),children:["lifetime","limited_time"].map(s=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(x,{className:"cursor-pointer",id:s,value:s}),e.jsx(a,{htmlFor:s,className:"capitalize",children:s.replace("_"," ")})]},s))}),e.jsx(n,{message:t.expiry_type})]}),e.jsx(l,{value:"limited_time",className:"border-none",children:e.jsx(d,{className:"space-y-4 p-0.5",children:e.jsxs("div",{className:"pt-3",children:[e.jsx(a,{children:o.expiry_duration}),e.jsx(C,{defaultValue:i.expiry_duration,data:V,placeholder:o.expiry_duration_placeholder||"Select duration",onSelect:s=>c("expiry_duration",s.value)}),e.jsx(n,{message:t.expiry_duration})]})})})]}),e.jsx("div",{className:"mt-8",children:e.jsx(S,{loading:_,children:"Save Changes"})})]})})};export{J as default};
