import{q as v,v as f,j as e,$ as k,Y as b}from"./app-CffHYkHW.js";import{A as D}from"./app-layout-D-VS7nVU.js";import{t as N}from"./index-Dw4sHwMN.js";import{C as g,a as C,b as S,c as y,d as L}from"./card-X_CDEGIm.js";import{L as l}from"./label-iPcRrN_N.js";import{I as c}from"./input-Bw4IOOzt.js";import{B as d}from"./button-qhe8lrPU.js";import{S as p,a as x,b as m,c as h,d as n}from"./select-ClrGyhQo.js";import{A as T}from"./arrow-left-DFiSAE9E.js";import{L as A}from"./loader-circle-BRrBaJrT.js";import{S as _}from"./save-D2L_UJE7.js";import"./utils-C8zp8JNC.js";import"./sheet-Bisw0FSz.js";import"./index-C0loMkA3.js";import"./index-Cy5bElus.js";import"./index-DPkgfxsD.js";import"./x-BfabuQJD.js";import"./createLucideIcon-DAR-hy5d.js";import"./index-C9NeyPdJ.js";import"./index-CjqRk3xD.js";import"./truck-DnoS8QCL.js";import"./package-BHw0cifz.js";import"./shopping-bag-AryJS2XX.js";import"./app-logo-icon-D3Jzt_fn.js";import"./bluetooth-context-CLrE8g1i.js";import"./sonner-CPUj7IiR.js";import"./chevron-down-C5A3yn87.js";const J=[{title:"Diskon",href:route("apps.coupons.index")},{title:"Ubah Diskon",href:"#"}];function re(){const{coupon:a}=v().props,{data:t,setData:i,errors:r,processing:o,post:u}=f({code:a.code,value:a.value,is_active:a.is_active=="1"?"active":"non-active",type:a.type,_method:"PUT"}),j=async s=>{s.preventDefault(),u(route("apps.coupons.update",a.id),{onSuccess:()=>{N("Data berhasil disimpan.")}})};return e.jsxs(D,{breadcrumbs:J,children:[e.jsx(k,{title:"Tambah Diskon"}),e.jsx("div",{className:"p-4",children:e.jsx("form",{onSubmit:j,children:e.jsxs(g,{children:[e.jsxs(C,{children:[e.jsx(S,{children:"Tambah Diskon"}),e.jsx(y,{children:"Form ini digunakan untuk menambahkan data diskon"})]}),e.jsx(L,{className:"p-0",children:e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[e.jsxs(l,{children:["Kode Diskon",e.jsx("span",{className:"text-rose-500",children:"*"})]}),e.jsx(c,{placeholder:"Masukan kode diskon",type:"text",value:t.code,onChange:s=>i("code",s.target.value)}),e.jsx("p",{className:"text-red-500 text-xs",children:r.code})]}),e.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[e.jsxs(l,{children:["Jumlah Diskon",e.jsx("span",{className:"text-rose-500",children:"*"})]}),e.jsx(c,{placeholder:"Masukan Jumlah Diskon",type:"text",value:t.value,onChange:s=>i("value",s.target.value)}),e.jsx("p",{className:"text-red-500 text-xs",children:r.value})]}),e.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[e.jsxs(l,{children:["Jenis Diskon",e.jsx("span",{className:"text-rose-500",children:"*"})]}),e.jsxs(p,{value:t.type,onValueChange:s=>i("type",s),children:[e.jsx(x,{children:e.jsx(m,{placeholder:"Pilih Jenis Diskon"})}),e.jsxs(h,{children:[e.jsx(n,{value:"rupiah",children:"Rp"}),e.jsx(n,{value:"percentage",children:"%"})]})]}),e.jsx("p",{className:"text-red-500 text-xs",children:r.type})]}),e.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[e.jsxs(l,{children:["Status Diskon",e.jsx("span",{className:"text-rose-500",children:"*"})]}),e.jsxs(p,{value:t.is_active,onValueChange:s=>i("is_active",s),children:[e.jsx(x,{children:e.jsx(m,{placeholder:"Pilih Status Diskon"})}),e.jsxs(h,{children:[e.jsx(n,{value:"active",children:"Aktif"}),e.jsx(n,{value:"non-active",children:"Tidak"})]})]}),e.jsx("p",{className:"text-red-500 text-xs",children:r.type})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{variant:"destructive",asChild:!0,children:e.jsxs(b,{href:route("apps.coupons.index"),children:[e.jsx(T,{})," Kembali"]})}),e.jsxs(d,{variant:"secondary",type:"submit",disabled:o,children:[o?e.jsx(A,{className:"animate-spin"}):e.jsx(_,{})," Simpan Data"]})]})]})})]})})})]})}export{re as default};
