import{u as i,j as e,H as c,L as n}from"./app-CAqQVdqj.js";import{A as x}from"./AuthenticatedLayout-CQEcc2iz.js";function b({tenant:a}){const{data:r,setData:l,post:d,processing:m,errors:t}=i({_method:"PUT",name:a.name||"",father_name:a.father_name||"",cnic:a.cnic||"",phone:a.phone||"",email:a.email||"",address:a.address||"",photo:null}),o=s=>{s.preventDefault(),d(route("tenants.update",a.id),{forceFormData:!0})};return e.jsxs(x,{header:e.jsx("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:"Edit Tenant"}),children:[e.jsx(c,{title:"Edit Tenant"}),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:o,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:["Name ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:r.name,onChange:s=>l("name",s.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),t.name&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:t.name})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Father Name"}),e.jsx("input",{type:"text",value:r.father_name,onChange:s=>l("father_name",s.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),t.father_name&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:t.father_name})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"CNIC"}),e.jsx("input",{type:"text",value:r.cnic,onChange:s=>l("cnic",s.target.value),placeholder:"00000-0000000-0",className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),t.cnic&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:t.cnic})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:["Phone ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:r.phone,onChange:s=>l("phone",s.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),t.phone&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:t.phone})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Email"}),e.jsx("input",{type:"email",value:r.email,onChange:s=>l("email",s.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),t.email&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:t.email})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Address"}),e.jsx("textarea",{value:r.address,onChange:s=>l("address",s.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"}),t.address&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:t.address})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Photo"}),a.photo&&e.jsx("div",{className:"mt-1 mb-2",children:e.jsx("img",{src:`/storage/${a.photo}`,alt:a.name,className:"h-20 w-20 rounded-full object-cover"})}),e.jsx("input",{type:"file",accept:"image/*",onChange:s=>l("photo",s.target.files[0]),className:"mt-1 block w-full text-sm text-gray-500 file:mr-4 file:rounded-md file:border-0 file:bg-blue-50 file:px-4 file:py-2 file:text-sm file:font-medium file:text-blue-700 hover:file:bg-blue-100"}),t.photo&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:t.photo})]}),e.jsxs("div",{className:"flex items-center justify-end gap-4",children:[e.jsx(n,{href:route("tenants.index"),className:"text-sm text-gray-600 hover:text-gray-900",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:m,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 Tenant"})]})]})})})})})]})}export{b as default};
