1import{W as S,j as e}from"./app-DFjPOwTz.js";import{C as U}from"./CreatableSelectOption-e6Iv32jc.js";import{I as m}from"./InputError-MfPSwZXX.js";import{I as n}from"./InputLabel-BD8FeuH8.js";import{P as $}from"./PrimaryButton-B0fP8jvQ.js";import{R as q}from"./RichTextEditor-DOx1tx8y.js";import{S as j}from"./Select-DpBz3HkK.js";import{T as p}from"./TextInput-CGxVzl_u.js";import{U as b}from"./UploadFileWithView-DvG3R2Wo.js";import{D}from"./DashboardLayout-kK3eZNrS.js";import{i as f}from"./browser-image-compression-BgY3rL5_.js";/* empty css */import"./app-D6f95T_z.js";import"./focus-management-DG1WxZzv.js";import"./open-closed-DoRl12Fz.js";import"./Flash-CrZ7aDmO.js";import"./chevron-down-Bce8KpRJ.js";import"./createLucideIcon-BlBiv9RD.js";import"./portal-DOEr1rtq.js";import"./transition-BbKFv9jN.js";import"./Spining-D3bHaqKG.js";import"./Dropdown-C0vfHjDI.js";import"./index-Chjiymov.js";import"./list-check-BCJRkjTy.js";import"./ticket-CkoB1f47.js";import"./index-DvhcyMEn.js";import"./dialog-D_jxgcOB.js";import"./hidden-7KTzMPDq.js";import"./close-provider-DmmUoFq6.js";import"./x-h486VVFG.js";import"./menu-CXZKXxsz.js";function ue({auth:v,app_year:N,aws_url:y,categories:C,auction_brands:u,auctionItem:s}){var h;const{data:r,setData:t,post:F,processing:P,errors:i}=S({_method:"PUT",category:s.category_id,brand:((h=s.brand)==null?void 0:h.brand)??"",product_name:s.name,manufacture:s.manufacture,price:s.price,thumbnail:null,description:s.description,status:s.status,images:[]}),T=(a,o)=>{t(a,o)},w=a=>({id:a.id,label:a.brand,value:a.brand}),g=async(a,o=!1)=>{const c=a.target.files;if(!c||c.length===0){alert("No files selected");return}const x={maxSizeMB:1,maxWidthOrHeight:1080,useWebWorker:!0};if(o){const d=[];try{for(let l=0;l<c.length;l++){const k=c[l],E=await f(k,x);d.push(E)}t({...r,[a.target.name]:d})}catch(l){alert(`Error during image compression: ${l}`)}}else{const d=c[0];try{const l=await f(d,x);t({...r,[a.target.name]:l})}catch(l){alert(`Error during image compression: ${l}`)}}},_=a=>{a.preventDefault(),F(route("dashboard.admin.auction.update",s.id))};return e.jsx(D,{user:v.user,title:"Create new Auction Item",children:e.jsxs("div",{className:"grid grid-cols-12 gap-2 md:gap-4",children:[e.jsx("div",{className:"col-span-12",children:e.jsxs("h1",{className:"text-2xl font-black md:text-3xl lg:text-4xl",children:["Edit Auction Item ",s.name]})}),e.jsx("div",{className:"col-span-12 rounded bg-iims-gradient py-0.5"}),e.jsxs("form",{onSubmit:_,className:"col-span-12 grid grid-cols-12 gap-2 md:gap-4",children:[e.jsx("div",{className:"col-span-12 flex justify-end gap-2",children:e.jsx($,{disabled:P,children:"Submit"})}),e.jsxs("div",{className:"col-span-12 grid grid-cols-12 gap-2 md:col-span-6 md:gap-4",children:[e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"category",value:"Category Item"}),e.jsx(j,{id:"category",name:"category",value:r.category,className:"mt-1",onChange:a=>t("category",Number(a.target.value)),required:!0,children:C.map((a,o)=>e.jsx("option",{value:a.id,children:a.name},o))}),e.jsx(m,{message:i.category})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"brand",value:"Brand"}),e.jsx(U,{defaultValue:r.brand?w(u.find(a=>a.brand===r.brand)):null,dataOptions:u.map(a=>({id:a.id,label:a.brand,value:a.brand})),handleChange:a=>t("brand",a==null?void 0:a.value),endPoint:route("handle-component.add-brand-auction")}),e.jsx(m,{message:i.brand})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"product_name",value:"Product Name"}),e.jsx(p,{id:"product_name",name:"product_name",value:r.product_name,className:"mt-1 block w-full",placeholder:"Product Name",onChange:a=>t("product_name",a.target.value),required:!0}),e.jsx(m,{message:i.product_name})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"manufacture",value:"Manufacture"}),e.jsx(p,{id:"manufacture",name:"manufacture",type:"number",min:0,value:r.manufacture,className:"mt-1 block w-full",placeholder:"Year Manufacture",onChange:a=>t("manufacture",Number(a.target.value)),required:!0}),e.jsx(m,{message:i.manufacture})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"price",value:"Price"}),e.jsx(p,{id:"price",name:"price",type:"number",min:0,value:r.price,className:"mt-1 block w-full",placeholder:"Price",onChange:a=>t("price",Number(a.target.value)),required:!0}),e.jsx(m,{message:i.price})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"thumbnail",value:"Thumbn
1ail"}),e.jsx(b,{id:"thumbnail",name:"thumbnail",labelText:"Upload Thumbnail max 1024kb",withCurrent:`${y}/${N}/auction/${s.id}/thumbnail/${s.thumbnail}`,handleChange:a=>g(a,!1),accept:"image/png, image/jpg, image/jpeg"}),e.jsx(m,{message:i.thumbnail})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"description",value:"Description (Optional)"}),e.jsx(q,{name:"description",value:r.description,handleChange:T}),e.jsx(m,{message:i.description,className:"mt-2"})]}),e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"status",value:"Status"}),e.jsxs(j,{id:"status",name:"status",value:r.status,onChange:a=>t("status",a.target.value),required:!0,children:[e.jsx("option",{value:"Published",children:"Published"}),e.jsx("option",{value:"Archived",children:"Archived"})]}),e.jsx(m,{message:i.status,className:"mt-1"})]})]}),e.jsx("div",{className:"col-span-12 grid grid-cols-12 gap-2 md:col-span-6 md:gap-4",children:e.jsxs("div",{className:"col-span-12",children:[e.jsx(n,{htmlFor:"images",value:"Images"}),e.jsx(b,{id:"images",name:"images",labelText:"Upload Images max 1024kb each",handleChange:a=>g(a,!0),accept:"image/png, image/jpg, image/jpeg",multiple:!0}),e.jsx(m,{message:i.images})]})})]})]})})}export{ue 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.