import{W as f,a,j as e,y as b}from"./BulkImageUpload-DGPbX05r.js";import{U as C}from"./User-DMCQU0ZG.js";import{U as w}from"./UserMenu-BCHgG7Y0.js";import y from"./Path-BGQq4Hlj.js";import{I}from"./Input-CR3dcIBA.js";import{C as S}from"./index.module-C5uvrDNy.js";import"./sweetalert2.all-CGGHY7K6.js";import"./bootstrap.esm-e_F80uXB.js";const W=c=>{const{data:U,setData:t,post:d,processing:n,errors:r,reset:P,clearErrors:k}=f({image:""}),[i,z]=a.useState(c.image),[p,h]=a.useState({x:0,y:0}),[l,m]=a.useState(1),[x,j]=a.useState([]),u=a.useCallback((s,o)=>{j(o)},[]),v=s=>{t(s.target.name,s.target.files[0])},g=s=>{s.preventDefault(),d(route("upload-profile-image"),{preserveState:o=>Object.keys(o.props.errors).length})},N=()=>{let s={crop:x};b.post(route("crop-profile-image",s))};return e.jsxs(C,{children:[e.jsx(y,{title:"User Profile"}),e.jsx("div",{className:"container-fluid user-container",children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-md-3",children:e.jsx(w,{user:c.auth.user})}),e.jsx("div",{className:"col-md-9",children:e.jsx("div",{className:"row",children:e.jsx("div",{className:"col-md-10 mx-auto",children:e.jsxs("div",{className:"card shadow mb-5",children:[e.jsx("div",{className:"card-header p-3",children:e.jsx("h4",{className:"fs-6 mb-0",children:" Change Profile Image"})}),e.jsx("div",{className:"card-body ",children:e.jsx("div",{className:"profile-pic row",children:e.jsxs("div",{className:"col-md-10 mx-auto",children:[e.jsx("form",{onSubmit:g,children:e.jsxs("div",{className:"row mb-3 mt-2",children:[e.jsxs("div",{className:"col-md-8",children:[e.jsx(I,{type:"file",name:"image",className:`mb-0 ${r.image&&"inerror"}`,handleChange:v}),r.image&&e.jsx("div",{className:"smart-valid",children:r.image})]}),e.jsx("div",{className:"col-md-4",children:e.jsx("button",{disabled:n,className:"btn w-100 btn-primary",children:"Upload Image"})})]})}),e.jsx("div",{className:"col-md-8 mx-auto",children:i!="/storage/business/default.png"&&e.jsx("div",{className:"row",children:e.jsx("div",{className:"com-md-5 crope-cover",children:e.jsx("div",{className:"crop-container",children:e.jsx(S,{image:i,crop:p,zoom:l,onCropChange:h,cropSize:{width:250,height:250},onCropComplete:u,onZoomChange:m})})})})}),e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-md-8 mt-3 ",children:e.jsx("div",{className:"controls",children:e.jsx("input",{type:"range",value:l,min:1,max:3,step:.1,"aria-labelledby":"Zoom",onChange:s=>{m(s.target.value)},className:"zoom-range"})})}),e.jsx("div",{className:"col-md-4 mt-3 ",children:e.jsx("button",{onClick:N,className:"btn w-100 btn-primary",children:"Save and Continue"})})]})]})})})]})})})})]})})})]})};export{W as default};
