import{u,j as a,H as m}from"./app-BQEFzdw6.js";import{A as p}from"./AppLayout-kozc03ce.js";import{P as h}from"./PageHeader-Bj1OQnqr.js";import{F as i}from"./FormField-HY4WrCzQ.js";import"./useThemeColor-qPCpc713.js";const x=["design","execution","procurement","accounts","hr","it","sales","administration"];function f({employee:n}){var c;const{data:r,setData:s,put:o,processing:l,errors:t}=u({name:n.name,phone:n.phone,email:n.email??"",nid:n.nid??"",department:n.department??"design",designation:n.designation,join_date:((c=n.join_date)==null?void 0:c.substring(0,10))??"",basic_salary:n.basic_salary??"",bank_account:n.bank_account??"",bank_name:n.bank_name??"",address:n.address??"",emergency_contact:n.emergency_contact??"",is_active:n.is_active});function d(e){e.preventDefault(),o(route("hr.employees.update",n.id))}return a.jsxs(p,{children:[a.jsx(m,{title:`Edit ${n.name}`}),a.jsx(h,{title:`Edit: ${n.name}`,back:route("hr.employees.show",n.id)}),a.jsx("div",{className:"p-4 sm:p-6 max-w-3xl",children:a.jsxs("form",{onSubmit:d,className:"card p-6 space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[a.jsx(i,{label:"Full Name",error:t.name,required:!0,children:a.jsx("input",{className:"form-input",value:r.name,onChange:e=>s("name",e.target.value)})}),a.jsx(i,{label:"Phone",error:t.phone,required:!0,children:a.jsx("input",{className:"form-input",value:r.phone,onChange:e=>s("phone",e.target.value)})}),a.jsx(i,{label:"Email",error:t.email,children:a.jsx("input",{type:"email",className:"form-input",value:r.email,onChange:e=>s("email",e.target.value)})}),a.jsx(i,{label:"NID Number",error:t.nid,children:a.jsx("input",{className:"form-input",value:r.nid,onChange:e=>s("nid",e.target.value)})}),a.jsx(i,{label:"Department",error:t.department,children:a.jsx("select",{className:"form-input",value:r.department,onChange:e=>s("department",e.target.value),children:x.map(e=>a.jsx("option",{value:e,children:e},e))})}),a.jsx(i,{label:"Designation",error:t.designation,required:!0,children:a.jsx("input",{className:"form-input",value:r.designation,onChange:e=>s("designation",e.target.value)})}),a.jsx(i,{label:"Join Date",error:t.join_date,children:a.jsx("input",{type:"date",className:"form-input",value:r.join_date,onChange:e=>s("join_date",e.target.value)})}),a.jsx(i,{label:"Basic Salary (৳)",error:t.basic_salary,children:a.jsx("input",{type:"number",className:"form-input",value:r.basic_salary,onChange:e=>s("basic_salary",e.target.value)})}),a.jsx(i,{label:"Bank Name",error:t.bank_name,children:a.jsx("input",{className:"form-input",value:r.bank_name,onChange:e=>s("bank_name",e.target.value)})}),a.jsx(i,{label:"Bank Account",error:t.bank_account,children:a.jsx("input",{className:"form-input",value:r.bank_account,onChange:e=>s("bank_account",e.target.value)})})]}),a.jsx(i,{label:"Address",error:t.address,children:a.jsx("textarea",{className:"form-input",rows:2,value:r.address,onChange:e=>s("address",e.target.value)})}),a.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[a.jsx("input",{type:"checkbox",checked:r.is_active,onChange:e=>s("is_active",e.target.checked),className:"rounded"}),"Active"]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{type:"submit",disabled:l,className:"btn btn-primary",children:l?"Saving…":"Update Employee"}),a.jsx("a",{href:route("hr.employees.show",n.id),className:"btn",children:"Cancel"})]})]})})]})}export{f as default};
