import{u as c,j as e,H as m,L as u}from"./app-CAqQVdqj.js";import{A as x}from"./AuthenticatedLayout-CQEcc2iz.js";function f({shop:a,owners:d}){const{data:r,setData:l,put:n,processing:o,errors:s}=c({owner_id:a.owner_id||"",shop_number:a.shop_number||"",description:a.description||"",location:a.location||"",area_sqft:a.area_sqft||"",default_rent:a.default_rent||""}),i=t=>{t.preventDefault(),n(route("shops.update",a.id))};return e.jsxs(x,{header:e.jsx("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:"Edit Shop"}),children:[e.jsx(m,{title:"Edit Shop"}),e.jsx("div",{className:"py-12",children:e.jsx("div",{className:"mx-auto max-w-2xl sm:px-6 lg:px-8",children:e.jsx("div",{className:"overflow-hidden bg-white shadow-sm sm:rounded-lg",children:e.jsx("div",{className:"p-6 text-gray-900",children:e.jsxs("form",{onSubmit:i,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:["Owner ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("select",{value:r.owner_id,onChange:t=>l("owner_id",t.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",children:[e.jsx("option",{value:"",children:"Select Owner"}),d.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),s.owner_id&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:s.owner_id})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:["Shop Number ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:r.shop_number,onChange:t=>l("shop_number",t.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),s.shop_number&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:s.shop_number})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Description"}),e.jsx("textarea",{value:r.description,onChange:t=>l("description",t.target.value),rows:3,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),s.description&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:s.description})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Location"}),e.jsx("input",{type:"text",value:r.location,onChange:t=>l("location",t.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),s.location&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:s.location})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Area (sq ft)"}),e.jsx("input",{type:"number",value:r.area_sqft,onChange:t=>l("area_sqft",t.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),s.area_sqft&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:s.area_sqft})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:["Default Rent (PKR) ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"number",value:r.default_rent,onChange:t=>l("default_rent",t.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),s.default_rent&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:s.default_rent})]}),e.jsxs("div",{className:"flex items-center justify-end gap-4",children:[e.jsx(u,{href:route("shops.index"),className:"text-sm text-gray-600 hover:text-gray-900",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:o,className:"inline-flex items-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:opacity-50",children:"Update Shop"})]})]})})})})})]})}export{f as default};
