1import{u as b,r as N,j as e}from"./app-CZXmoS2b.js";import{A as v}from"./AppHead-3v-wai9g.js";import{L as l,I as n}from"./label-Cfw2zy71.js";import{B as C}from"./button-DKNsD8o4.js";import{I as o}from"./input-xdGltdbk.js";import{S as c,a as p,b as u,c as h,d as m}from"./select-1YKveYkl.js";import{A as S}from"./app-layout-DZz2eUl-.js";import{L as k}from"./loader-circle-CO3TcOsc.js";/* empty css */import"./index-DqvabXEY.js";import"./index-DroZaziI.js";import"./app-sidebar-header-BchwWZ3h.js";import"./index-BBIZTMjr.js";const I=[{title:"Banners",href:"/admin/banners"},{title:"Create banner",href:"/admin/banners/create"}];function U(){const{data:i,setData:s,post:x,processing:r,errors:t}=b({name:"",banner:null,link_href:"",platform:"web",status:1}),[d,f]=N.useState(null),j=a=>{a.preventDefault(),x(route("admin.banners.store"))},g=a=>{a.target.files&&a.target.files[0]&&(f(URL.createObjectURL(a.target.files[0])),s("banner",a.target.files[0]))};return e.jsxs(S,{breadcrumbs:I,children:[e.jsx(v,{title:"Create banner"}),e.jsx("form",{className:"flex flex-col gap-6 p-4",onSubmit:j,children:e.jsxs("div",{className:"grid gap-6",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(l,{htmlFor:"name",children:"Name"}),e.jsx(o,{id:"name",type:"text",required:!0,autoComplete:"name",value:i.name,onChange:a=>s("name",a.target.value),disabled:r,placeholder:"Name"}),e.jsx(n,{message:t.name,className:"mt-2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(l,{htmlFor:"banner",children:"Banner"}),d&&e.jsx("img",{src:d,alt:"banner",className:"h-[200px]"}),e.jsx(o,{id:"banner",type:"file",required:!0,tabIndex:2,onChange:g,disabled:r,className:"cursor-pointer"}),e.jsx(n,{message:t.banner})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(l,{htmlFor:"link_href",children:"Link href"}),e.jsx(o,{id:"link_href",type:"text",required:!0,autoComplete:"link_href",value:i.link_href,onChange:a=>s("link_href",a.target.value),disabled:r,placeholder:"Link href"}),e.jsx(n,{message:t.link_href,className:"mt-2"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(l,{htmlFor:"platform",children:"Platform"}),e.jsxs(c,{onValueChange:a=>s("platform",a),defaultValue:i.platform.toString(),children:[e.jsx(p,{className:"w-full",children:e.jsx(u,{placeholder:"Platform"})}),e.jsxs(h,{children:[e.jsx(m,{value:"web",children:"Web"}),e.jsx(m,{value:"app",children:"App"})]})]}),e.jsx(n,{message:t.platform})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(l,{htmlFor:"status",children:"Status"}),e.jsxs(c,{onValueChange:a=>s("status",Number(a)),defaultValue:i.status.toString(),children:[e.jsx(p,{className:"w-full",children:e.jsx(u,{placeholder:"Status"})}),e.jsxs(h,{children:[e.jsx(m,{value:"1",children:"Active"}),e.jsx(m,{value:"0",children:"Disable"})]})]}),e.jsx(n,{message:t.status})]}),e.jsxs(C,{type:"submit",className:"mt-2 w-full",tabIndex:5,disabled:r,children:[r&&e.jsx(k,{className:"h-4 w-4 animate-spin"}),"Create Banner"]})]})})]})}export{U 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.