????
Current Path : C:/inetpub/vhost/hotrochinhsach.nextform.vn/www/assets/ |
Current File : C:/inetpub/vhost/hotrochinhsach.nextform.vn/www/assets/InfoNew-9ddcc709.js |
import{r as a,T as i,t as B,v as H,m as K,l as k,h as D,F as R,j as e,L as c}from"./index-3ac6b886.js";import{i as P,F as I}from"./DropdownList-92e339e1.js";import{B as x}from"./Button-d32d698a.js";import{F as r}from"./FontAwesome4-4d1c8e97.js";import{h as $}from"./DefaultHeader-267e02eb.js";import"./DataSelect-21292454.js";import"./useTheme-cc71593c.js";import"./classCallCheck-22a738c0.js";import"./withStyles-be05542d.js";import"./possibleConstructorReturn-b2959138.js";import"./DialogCustomize-f58e33cd.js";import"./capitalize-2c2e3657.js";import"./Transition-41b94a89.js";import"./OdataUtils-69f581ff.js";import"./Button-9ef33eb6.js";import"./Modal-834c96f4.js";import"./utils-1da25c48.js";import"./Fade-c1d8e31e.js";import"./function-c7c2f09a.js";import"./TextArea-5c5d2643.js";import"./InputNumber-e0e8281b.js";import"./Input-a404c875.js";import"./Required-a585e744.js";import"./InputTime-6c25e67a.js";import"./SelectCustom-a3812854.js";import"./Dropdown-fd6014de.js";import"./SelectPanelMulti-30b66e05.js";import"./TransitionGroup-a6d13137.js";import"./Collapse-9244e6b2.js";import"./Row-ef702d16.js";import"./DataTable-4f7de56a.js";import"./Nav-7adab22f.js";import"./react-alert-template-basic-cff12200.js";import"./Notify-52ad6082.js";import"./Badge-69f10678.js";import"./Popper-c3a92014.js";import"./_commonjs-dynamic-modules-302442b1.js";import"./Empty-c1579b18.js";import"./const-0478bc07.js";/* empty css */const Fe=()=>{var b,E,w,S,y,A,F;const[s,u]=a.useState({Email:(b=i)==null?void 0:b.Email,TenHienThi:(E=i)==null?void 0:E.TenHienThi}),[d,f]=a.useState(""),[l,g]=a.useState(),[j,T]=a.useState(),h=a.useContext(B),v=a.useMemo(()=>h.getApiAvt,[h]);let m=null;j?m=j:h.urlAvt?m="api"+h.urlAvt:m="";const L=t=>{try{let n=new FileReader;n.onloadend=()=>{T(n.result)},n.readAsDataURL(t)}catch{_()}},_=()=>{g(null),T(null)},N=a.useCallback(()=>{var t;if(l){let n=new FormData;n.append("MaTaiKhoan",(t=i)==null?void 0:t.MaTaiKhoan),n.append("HinhAnh",l),H("QuanLyTaiKhoan/ChinhSuaHinhAnh","POST",n).then(o=>{K("Cập nhật ảnh đại diện thành công","Thông báo"),v()}).catch(o=>k("Đã xảy ra lỗi","Thông báo"))}},[l,v]),M=t=>{const[n]=t.target.files;g(n),L(n)};a.useEffect(()=>{l&&N()},[l,N]);const p=a.useCallback(()=>{D(`SYS_ThietBi?$filter=FCM_Token eq '${R}'`,"GET",null,!0).then(t=>{t.value.length>0?f(t.value[0]):f("Chưa xác định")})},[]);a.useEffect(()=>{p()},[p]);const C=()=>{var n,o;let t=new FormData;(n=i)!=null&&n.MaTaiKhoan&&(t.append("MaTaiKhoan",(o=i)==null?void 0:o.MaTaiKhoan),t.append("TenHienThi",s.TenHienThi||null),t.append("Email",s.Email||null),t.append("TinhTrangHoatDong",!0),H("QuanLyTaiKhoan/ChinhSuaThongTin","POST",t).then(O=>{K("Cập nhật thông tin thành công","Thông báo"),localStorage.setItem("info",JSON.stringify({...i,...s})),window.location.reload()}).catch(O=>k("Đã xảy ra lỗi","Thông báo")),d&&D(`SYS_ThietBi(guid'${d.Id}')`,"PATCH",JSON.stringify({Name:d})).then(()=>{p()}))};return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"form-info-new",children:[e.jsxs("div",{className:"header-form-info-new form-item-info-new",children:[e.jsx("div",{className:"d-flex justify-content-center",children:e.jsxs("div",{className:"outline-img-avt",children:[e.jsx("img",{className:"img-avt",src:m||"../../assets/profile-w.jpg",alt:""}),e.jsx("div",{className:"btn-fake-change-img",children:"Đổi ảnh"}),e.jsx("input",{type:"file",className:"input-avt",onChange:M})]})}),e.jsxs("div",{className:"me-auto",style:{maxWidth:"40rem"},children:[e.jsx("h2",{children:(w=i)==null?void 0:w.TenDonVi}),e.jsx("p",{className:"mb-0",children:(S=i)==null?void 0:S.MaTaiKhoan}),e.jsx("p",{className:"mb-0",children:((y=i)==null?void 0:y.Email)==="null"||!((A=i)!=null&&A.Email)?"":(F=i)==null?void 0:F.Email})]}),!P&&e.jsxs("div",{className:"d-flex ms-auto gap-3",children:[e.jsxs(c,{tag:c,to:"/tai-khoan",className:"btn",children:[e.jsx(r,{fa:"share-alt"}),e.jsx("span",{children:"Danh sách tài khoản"})]}),e.jsxs(c,{tag:c,to:"/don-vi-truc-thuoc",className:"btn",children:[e.jsx(r,{fa:"dashcube"}),e.jsx("span",{children:"Đơn vị trực thuộc"})]})]})]}),e.jsxs("div",{className:"form-item-info-new",children:[e.jsxs("div",{className:"d-flex screen-phone-custom justify-content-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"fw-bold",children:"Cập nhật thông tin"}),e.jsx("p",{className:"text-secondary",children:"Bạn có thể cập nhật các thông tin cơ bản của tài khoản"})]}),e.jsx("div",{className:"d-flex",children:e.jsxs(x,{onClick:C,className:"btn-save hidden-phone",children:[e.jsx(r,{fa:"gg"}),"Lưu thông tin"]})})]}),e.jsxs("div",{className:"body-form-info-new screen-phone-custom",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Tên hiển thị"}),e.jsx(I,{data:{type:"textbox",title:"Tên hiển thị",hidden_label:!0},value:s==null?void 0:s.TenHienThi,onChange:(t,n)=>u(o=>({...o,TenHienThi:n})),inline:!1})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Email"}),e.jsx(I,{data:{type:"textbox",title:"Email",hidden_label:!0},value:s==null?void 0:s.Email,onChange:(t,n)=>u(o=>({...o,Email:n})),inline:!1})]})]}),e.jsxs("div",{className:"d-flex mt-5 gap-3 justify-content-center",children:[e.jsxs(x,{onClick:$,className:"btn-dang-xuat",children:[e.jsx(r,{fa:"expeditedssl"}),"Đăng Xuất"]}),e.jsxs(x,{onClick:C,className:"show-phone btn-save",children:[e.jsx(r,{fa:"gg"}),"Lưu thông tin"]})]})]})]})})};export{Fe as default};