????
Current Path : C:/inetpub/vhost/donthu.nextform.vn/wwwroot/assets/ |
Current File : C:/inetpub/vhost/donthu.nextform.vn/wwwroot/assets/index-DOj4kNop.js |
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{r as reactExports,bV as useFormContext,k as jsxRuntimeExports,P as Paper,am as Grid,x as IconButton,I as Icon,ar as Typography,b6 as Divider,aG as Stack,y as Button,B as Box,bh as CHECK_SUCCESS,bS as InputBase,aB as TextField,s as styled,bK as lodashExports,o as styled$1,cV as DonThuNguoiUyQuyen,q as Paragraph,F as useAuth,cP as TiepDan,cQ as CHECK_REQUEST,bi as CHECK_ERROR,cR as hooks,aq as getCurrentDate,bW as iniAddress,C as Card,bR as Backdrop,aH as CircularProgress,h as useTheme,cB as Popover,bf as Grow,bg as CHECK_CONFIRM}from"./index-y1X-EiI1.js";import{k as useDonThu,E as Enums_LoaiVanBan,a as FormControl,q as FindUser,n as Enums_GioiTinh,m as makeStyles,G as useTiepDan,O as formLanhDao,P as SelectAsync,A as Address,C as CardHeader,s as useDonThuNguoiDungDon,I as useDonThuNguoiUyQuyen,J as Enums_NguoiDungDon,K as formDataNguoiDungDon,L as Enums_PhanTheoSoNguoi,M as Stack$1,v as v4,u as useAsync,F as Form,y as CardActions,e as Tabs,f as Tab,z as SwipeableViews,Q as InputDate,D as DataTable,N as columnsTiepDan}from"./DataTable-BEDH0i35.js";import{T as Tooltip}from"./Tooltip-C0pwvyhl.js";import{u as useOrganization}from"./Organiztion.service-ClfjpKxN.js";import{T as Table,a as TableHead,b as TableRow,c as TableCell,d as TableBody}from"./TableRow-BfZy-RM-.js";import{T as TablePagination}from"./TablePagination-Dnie0nHQ.js";import{L as LoadingButton}from"./LoadingButton-DgqpHLzy.js";import{C as Collapse}from"./Collapse-YEAu7S3-.js";import{B as Breadcrumbs}from"./Breadcrumbs-B7ARQx64.js";import{L as Link}from"./Link-D62DzNC-.js";import"./utils-B_XeHYak.js";import"./DialogTitle-B28XGy8_.js";import"./FormGroup-CEJG6asl.js";import"./ListItemText-BvrfP19N.js";import"./Autocomplete-CpStdzj7.js";import"./Close-DnCuke95.js";import"./Popper-BN0GgV3z.js";import"./usePreviousProps-eNEUPQQG.js";import"./Chip-4iuxTgqW.js";import"./warning-BmqNoLzl.js";import"./Badge-BUU8rl3f.js";import"./Alert-AfWalC00.js";import"./Switch-BlzK9Osj.js";import"./SwitchBase-HB81Uehs.js";import"./Checkbox-B8nePMFP.js";import"./Toolbar-BZCdaOvb.js";import"./AppBar-BrohM22l.js";const formDetailCaNhan={soDinhDanh:{field_name:"donThuNguoiUyQuyen.soDinhDanh",title:"Số định danh",type:"select-creatable",disabled:!0},email:{field_name:"donThuNguoiUyQuyen.email",title:"Email",type:"textbox",rules:{required:"Vui lòng nhập",pattern:{value:/\S+@\S+\.\S+/,message:"Sai định dạng email"}},disabled:!0},hoVaTenDem:{field_name:"donThuNguoiUyQuyen.hoVaTenDem",title:"Họ và tên đệm",type:"textbox",rules:{required:"Vui lòng nhập"},disabled:!0},ten:{field_name:"donThuNguoiUyQuyen.ten",title:"Tên",type:"textbox",rules:{required:"Vui lòng nhập"},disabled:!0},gioiTinh:{field_name:"donThuNguoiUyQuyen.gioiTinh",title:"Giới tính",type:"select-custom",rules:{required:"Vui lòng nhập"},options:Enums_GioiTinh,disabled:!0},noiCapCuThe:{field_name:"donThuNguoiUyQuyen.noiCapCuThe",title:"Nơi cấp cụ thể",type:"textbox",disabled:!0},dienThoai:{field_name:"donThuNguoiUyQuyen.dienThoai",title:"Điện thoại",type:"textbox",disabled:!0},thuongTruCuThe:{field_name:"donThuNguoiUyQuyen.thuongTruCuThe",title:"Địa chỉ",type:"textbox",disabled:!0}},formLuatSu={soThe:{field_name:"luatSu.soThe",title:"Số Thẻ",type:"textbox",rules:{required:"Vui lòng nhập"}},ngayCap:{field_name:"luatSu.ngayCap",title:"Ngày cấp",type:"datetime",rules:{required:"Vui lòng nhập"}},noiCap:{field_name:"luatSu.noiCap",title:"Nơi cấp",type:"textbox",rules:{required:"Vui lòng nhập"}},thongTinGioiThieu:{field_name:"luatSu.thongTinGioiThieu",title:"Thông tin giới thiệu",type:"textbox",rules:{required:"Vui lòng nhập"}},fileId:{field_name:"luatSu.fileId",title:"Tài liệu kèm theo",type:"file",isMulti:!0}},CollapsibleUyQuyen=__name(({})=>{const{getDocument,uploadDocument}=useDonThu(),{watch}=useFormContext();return reactExports.useCallback((name,value)=>{},[]),jsxRuntimeExports.jsxs(Paper,{sx:{width:"100%",overflow:"hidden"},children:[jsxRuntimeExports.jsxs(Grid,{container:!0,xs:12,children:[jsxRuntimeExports.jsx(Tooltip,{title:"Chi tiết ủy quyền",children:jsxRuntimeExports.jsx(IconButton,{size:"small",color:"default",children:jsxRuntimeExports.jsx(Icon,{children:"info"})})}),jsxRuntimeExports.jsx(Typography,{display:"flex",marginBottom:0,alignItems:"center",fontWeight:"bold",fontSize:15,gutterBottom:!0,component:"div",marginRight:1,children:"Chi tiết"}),jsxRuntimeExports.jsx(Divider,{orientation:"vertical",flexItem:!0})]}),jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsxs(Grid,{container:!0,xs:12,children:[jsxRuntimeExports.jsx(FormControl,{data:{type:"hidden",name:"donThuNguoiUyQuyen.thongTinCaNhanId"},name:"donThuNguoiUyQuyen.thongTinCaNhanId"}),Object.entries(formDetailCaNhan).map(([key,value],idx)=>{const dataFiles=key==="fileId"?{getDocument,uploadDocument,loaiVanBan:Enums_LoaiVanBan.LAWYER,typeFolder:"DonThu",fileId:watch("fileId")}:{};return jsxRuntimeExports.jsx(Grid,{item:!0,xs:6,children:jsxRuntimeExports.jsx(FormControl,{data:{...value,name:value.field_name,...dataFiles},rules:value.rules,name:value.field_name,inline:!1})})})]})]})},"CollapsibleUyQuyen"),CollapsibleLuatSu=reactExports.memo(({isLabel})=>{const{getDocument,uploadDocument}=useDonThu(),{watch}=useFormContext();return reactExports.useCallback((name,value)=>{},[]),jsxRuntimeExports.jsxs(Paper,{sx:{width:"100%",overflow:"hidden"},children:[jsxRuntimeExports.jsxs(Grid,{container:!0,xs:12,children:[jsxRuntimeExports.jsx(Tooltip,{title:"Chi tiết ủy quyền",children:jsxRuntimeExports.jsx(IconButton,{size:"small",color:"default",children:jsxRuntimeExports.jsx(Icon,{children:"info"})})}),jsxRuntimeExports.jsx(Typography,{display:"flex",marginBottom:0,alignItems:"center",fontWeight:"bold",fontSize:15,gutterBottom:!0,component:"div",marginRight:1,children:"Chi tiết luật sư"}),jsxRuntimeExports.jsx(Divider,{orientation:"vertical",flexItem:!0})]}),jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Grid,{container:!0,xs:12,children:Object.entries(formLuatSu).map(([key,value],idx)=>{const dataFiles=key==="fileId"?{getDocument,uploadDocument,loaiVanBan:Enums_LoaiVanBan.LAWYER,typeFolder:"DonThu",fileId:watch("fileId")}:{};return jsxRuntimeExports.jsx(Grid,{item:!0,xs:6,children:jsxRuntimeExports.jsx(FormControl,{data:{...value,name:value.field_name,...dataFiles,disabled:isLabel},rules:value.rules,name:value.field_name,inline:!1,...key==="fileId"?{isLabel}:{}})})})})]})}),Delegacy=reactExports.memo(({isLabel,id})=>{const[open,setOpen]=reactExports.useState(!1),{watch,setValue}=useFormContext(),addButton=reactExports.useMemo(()=>!isLabel&&jsxRuntimeExports.jsx(Paper,{sx:{width:"100%"},elevation:3,children:jsxRuntimeExports.jsx(Stack,{color:"blueDark",justifyContent:"center",direction:"row",alignItems:"center",children:jsxRuntimeExports.jsx(Button,{onClick:()=>setOpen(!0),sx:{width:"100%",alignItems:"center"},startIcon:jsxRuntimeExports.jsxs(Icon,{children:[watch("donThuNguoiUyQuyen")?"change_circle":"add_circle"," "]}),children:watch("donThuNguoiUyQuyen.thongTinCaNhanId")?"Thay đổi":"Thêm thông tin người ủy quyền"})})}),[isLabel]);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Grid,{rowGap:1,container:!0,xs:12,children:jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,children:jsxRuntimeExports.jsxs(Grid,{sx:{width:"auto"},container:!0,spacing:1,margin:1,children:[jsxRuntimeExports.jsx(Grid,{item:!0,xs:(watch("donThuNguoiUyQuyen"),2),display:"flex",alignItems:"center",children:jsxRuntimeExports.jsx(Stack,{width:"100%",direction:"row",justifyContent:"space-between",alignItems:"center",children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs(Typography,{width:"auto",variant:"h6",fontSize:"inherit",children:[jsxRuntimeExports.jsx("strong",{style:{color:"darksalmon"},children:"Người được ủy quyền"}),jsxRuntimeExports.jsx("span",{style:{color:"red"},children:"*"})]})})})}),jsxRuntimeExports.jsx(Grid,{item:!0,xs:10,display:"flex",alignItems:"center",children:addButton}),watch("donThuNguoiUyQuyen.thongTinCaNhanId")&&jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,alignItems:"center",children:jsxRuntimeExports.jsx(CollapsibleUyQuyen,{})})]})})}),jsxRuntimeExports.jsx(FindUser,{onClose:()=>{setOpen(!1)},open,fieldParent:"donThuNguoiUyQuyen",onChoose:rowData=>{const uyQuyen={...rowData,thongTinCaNhanId:rowData.id,isLuatSu:watch("donThuNguoiUyQuyen.isLuatSu")};setValue("donThuNguoiUyQuyen",uyQuyen),setValue("donThuNguoiUyQuyen.soDinhDanh",{value:rowData.soDinhDanh,label:rowData.soDinhDanh}),setOpen(!1)}}),jsxRuntimeExports.jsx(FormControl,{data:{field_name:"isLuatSu",name:"isLuatSu",title:"Luật sư",type:"checkbox",labelCol:1,contentCol:10,disabled:isLabel},name:"donThuNguoiUyQuyen.isLuatSu"}),watch("donThuNguoiUyQuyen.isLuatSu")&&jsxRuntimeExports.jsx(Grid,{rowGap:1,container:!0,xs:12,children:jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,children:jsxRuntimeExports.jsx(Grid,{sx:{width:"auto"},container:!0,spacing:1,margin:1,children:jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,children:jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,display:"flex",alignItems:"center",children:jsxRuntimeExports.jsx(CollapsibleLuatSu,{isLabel})})})})})})]})}),useStyles=makeStyles(theme=>({table:{"& .MuiTableCell-root":{border:"1px solid rgba(224, 224, 224, 1)",padding:"12px 7px"}}})),ChooseOrganization=__name(({idTiepDan,isLabel})=>{const{watch,register,setValue}=useFormContext(),[page,setPage]=reactExports.useState(0),[rowsPerPage,setRowsPerPage]=reactExports.useState(10),classes=useStyles();let rows=watch("tiepDan.tiepDanOrganizations")||[];const{getAllOrganization}=useOrganization(),handleChangePage=__name((event,newPage)=>{setPage(newPage)},"handleChangePage"),handleChangeRowsPerPage=__name(event=>{setRowsPerPage(+event.target.value),setPage(0)},"handleChangeRowsPerPage");reactExports.useEffect(()=>{register("tiepDan.tiepDanOrganizations",{value:[]})},[]);const handleAdd=reactExports.useCallback(()=>{const data=[...rows];data.push({organizationId:"",chucVu:"",hoVaTen:""}),setValue("tiepDan.tiepDanOrganizations",data)},[rows]),onChange=reactExports.useCallback((index,name,value)=>{const data=[...rows];data[index][name]=value,setValue("tiepDan.tiepDanOrganizations",data)},[rows]),onDelete=reactExports.useCallback((index,row)=>{const data=[...rows];data.splice(index,1),setValue("tiepDan.tiepDanOrganizations",data)},[rows]);return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsxs(Stack,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Typography,{mr:2,color:"burlywood",children:"Danh sách cơ quan, các đơn vị cùng tham gia tiếp công dân"}),jsxRuntimeExports.jsxs(Paper,{component:"form",sx:{p:"0px 2px",display:"flex",alignItems:"center",width:400,borderRadius:0,position:"relative"},children:[!isLabel&&jsxRuntimeExports.jsx(Stack,{position:"absolute",top:"-2.5rem",children:jsxRuntimeExports.jsx(Typography,{width:"auto",color:"crimson",variant:"h6",fontSize:"small",children:"LƯU Ý: Đối với danh sách (chỉnh sửa) sẽ được cập nhật trực tiếp không cần qua thao tác lưu"})}),jsxRuntimeExports.jsx(InputBase,{size:"small",sx:{ml:1,flex:1},placeholder:"Tìm kiếm",inputProps:{"aria-label":"search google maps"}}),jsxRuntimeExports.jsx(Tooltip,{arrow:!0,placement:"top",title:"Tìm kiếm",children:jsxRuntimeExports.jsx(IconButton,{color:"primary",type:"button",sx:{p:"5px"},"aria-label":"search",children:jsxRuntimeExports.jsx(Icon,{fontSize:"small",children:"search"})})}),!isLabel&&jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{sx:{height:28,m:.5},orientation:"vertical"}),jsxRuntimeExports.jsx(Tooltip,{arrow:!0,placement:"top",title:"Thêm mới",children:jsxRuntimeExports.jsx(IconButton,{onClick:handleAdd,type:"button",color:"success",children:jsxRuntimeExports.jsx(Icon,{fontSize:"small",children:"add"})})})]})]})]}),jsxRuntimeExports.jsxs(Table,{className:classes.table,stickyHeader:!0,"aria-label":"sticky table",children:[jsxRuntimeExports.jsx(TableHead,{children:jsxRuntimeExports.jsxs(TableRow,{sx:{border:"ActiveBorder"},children:[jsxRuntimeExports.jsx(TableCell,{sx:{width:"4rem"},align:"center",children:"STT"}),jsxRuntimeExports.jsx(TableCell,{children:"Đơn vị"}),jsxRuntimeExports.jsx(TableCell,{sx:{width:"20rem"},align:"left",children:"Người đại diện"}),jsxRuntimeExports.jsx(TableCell,{sx:{width:"15rem"},align:"left",children:"Chức vụ"}),!isLabel&&jsxRuntimeExports.jsx(TableCell,{sx:{width:"7rem"},align:"center",children:"Chức năng"})]})}),jsxRuntimeExports.jsx(TableBody,{children:rows.length>0?rows.slice(page*rowsPerPage,page*rowsPerPage+rowsPerPage).map((row,index)=>jsxRuntimeExports.jsxs(TableRow,{hover:!0,role:"checkbox",tabIndex:-1,children:[jsxRuntimeExports.jsx(TableCell,{align:"center",children:index+1}),jsxRuntimeExports.jsx(TableCell,{align:"left",children:jsxRuntimeExports.jsx(SelectAsync,{name:"organizationId"+index,onChange:value=>onChange(index,"organizationId",value),placeholder:"Chọn cơ quan",loadData:getAllOrganization,value:row.organizationId,getOptionLabel:option=>`${option.organName}`,getOptionValue:option=>option.organId,disabled:isLabel})}),jsxRuntimeExports.jsx(TableCell,{align:"left",children:jsxRuntimeExports.jsx(TextField,{disabled:isLabel,InputProps:{sx:{height:"2rem","&.MuiInputBase-root.Mui-disabled":{color:"unset"},"& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:"unset"}}},sx:{width:"-webkit-fill-available"},size:"small",value:row==null?"":row.hoVaTen,onChange:e=>onChange(index,"hoVaTen",e.target.value)})}),jsxRuntimeExports.jsx(TableCell,{align:"center",children:jsxRuntimeExports.jsx(TextField,{disabled:isLabel,InputProps:{sx:{height:"2rem","&.MuiInputBase-root.Mui-disabled":{color:"unset"},"& .MuiInputBase-input.Mui-disabled":{WebkitTextFillColor:"unset"}}},sx:{width:"-webkit-fill-available"},size:"small",value:row==null?"":row.chucVu,onChange:e=>onChange(index,"chucVu",e.target.value)})}),!isLabel&&jsxRuntimeExports.jsxs(TableCell,{align:"center",component:"th",scope:"row",children:[idTiepDan&&jsxRuntimeExports.jsx(Tooltip,{arrow:!0,placement:"top",title:"Lưu",children:jsxRuntimeExports.jsx(IconButton,{children:jsxRuntimeExports.jsx(Icon,{color:"info",children:"save"})})}),jsxRuntimeExports.jsx(Tooltip,{arrow:!0,placement:"top",title:"Xóa",children:jsxRuntimeExports.jsx(IconButton,{onClick:()=>onDelete(index,row),children:jsxRuntimeExports.jsx(Icon,{color:"error",children:"delete"})})})]})]},"row.code"+index)):jsxRuntimeExports.jsx(TableRow,{hover:!0,role:"checkbox",tabIndex:-1,children:jsxRuntimeExports.jsx(TableCell,{colSpan:5,align:"center",children:jsxRuntimeExports.jsx(Typography,{color:"darkgray",children:"Dữ liệu trống"})})})})]}),jsxRuntimeExports.jsx(TablePagination,{rowsPerPageOptions:[10,25,50],labelRowsPerPage:"Số dòng",component:"div",count:rows.length,rowsPerPage,page,onPageChange:handleChangePage,onRowsPerPageChange:handleChangeRowsPerPage})]})},"ChooseOrganization"),LanhDaoForm=reactExports.memo(reactExports.forwardRef(({id},ref)=>{const[isUpdate,setIsUpdate]=reactExports.useState(!1),{getValues}=useFormContext(),{updateReceivingCitizens}=useTiepDan(),{updateLetter}=useDonThu(),{watch}=useFormContext(),handleEdit=reactExports.useCallback(async()=>{try{const{tiepDan,dmNhiemKyId}=getValues(),dataForm={};Object.entries(formLanhDao).forEach(([key,value])=>{dataForm[key]=get(tiepDan,key)}),tiepDan!=null&&tiepDan.id&&await updateReceivingCitizens(tiepDan==null?void 0:tiepDan.id,dataForm),id&&await updateLetter(id,{dmNhiemKyId}),CHECK_SUCCESS("Cập nhật thành công"),setIsUpdate(!1)}catch{}},[id]);return reactExports.useImperativeHandle(ref,()=>({enableEdit:statusEdit=>{setIsUpdate(statusEdit===StatusEdit.EDIT)},handleEdit}),[]),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Grid,{rowGap:1,container:!0,xs:12,children:Object.entries(formLanhDao).map(([key,value],idx,arr)=>{const where=key==="canBoId"?watch("tiepDan.isThuTruongTiep")?[{field:"dmChucVu/isThuTruong",expression:"eq",value:!0}]:[{field:"dmChucVu/isLanhDao",expression:"eq",value:!0}]:void 0;return jsxRuntimeExports.jsx(Grid,{item:!0,xs:value.col,children:jsxRuntimeExports.jsx(FormControl,{data:{...value,name:value.field_name,where},rules:value.rules,name:value.field_name,isLabel:id&&!isUpdate},idx+key)},idx+3+key)})}),jsxRuntimeExports.jsx(Grid,{className:"form_data_grid",item:!0,xs:12,spacing:1,margin:2,children:jsxRuntimeExports.jsx(ChooseOrganization,{isLabel:id&&!isUpdate,idTiepDan:watch("tiepDan.id")})})]})})),formCoQuanGiaiQuyet={coQuanDaGiaiQuyet:{field_name:"donThuCoQuanDaGiaiQuyet.coQuanDaGiaiQuyet",title:"Cơ quan đã giải quyết",type:"textbox",rules:{required:"Vui lòng nhập"},fullLine:!0},ngayBanHanh:{field_name:"donThuCoQuanDaGiaiQuyet.ngayBanHanh",title:"Ngày ban hành",type:"datetime",rules:{required:"Vui lòng nhập"},fullLine:!0},soVanBanDaGiaiQuyet:{field_name:"donThuCoQuanDaGiaiQuyet.soVanBanDaGiaiQuyet",title:"Số văn bản",type:"textbox",rules:{required:"Vui lòng nhập"},fullLine:!0},soVanBanDaGiaiQuyet:{field_name:"donThuCoQuanDaGiaiQuyet.soVanBanDaGiaiQuyet",title:"Số văn bản",type:"textbox",rules:{required:"Vui lòng nhập"},fullLine:!0},fileId:{field_name:"donThuCoQuanDaGiaiQuyet.fileId",title:"Tài liệu kèm theo",type:"file",isMulti:!0}},formDataDonThu={dmPhanTheoNoiDungId:{field_name:"dmPhanTheoNoiDungId",title:"Phân loại đơn",type:"select-async",value_field:"id",value_label:"name",url:"/api/buss/public/DanhMuc/GetPhanTheoNoiDung",fullLine:!0,rules:{required:"Vui lòng nhập"}},dmLoaiDoiTuongId:{field_name:"dmLoaiDoiTuongId",title:"Loại đối tượng",type:"select-async",value_field:"id",value_label:"name",url:"/api/buss/allow/DMLoaiDoiTuongs",fullLine:!0},dmLinhVucId:{field_name:"dmLinhVucId",title:"Lĩnh vực",type:"select-async",value_field:"id",value_label:"name",url:"/api/buss/public/DanhMuc/GetLinhVuc",fullLine:!0},noiDungDon:{field_name:"noiDungDon",title:"Nội dung đơn",type:"textarea",fullLine:!0,rules:{required:"Vui lòng nhập"}},ghiChu:{field_name:"ghiChu",title:"Ghi chú",type:"textarea",fullLine:!0,rules:{required:"Vui lòng nhập"}},noiGhiNhanCuThe:{field_name:"noiGhiNhanCuThe",title:"Địa chỉ",type:"textbox",fullLine:!0},fileId:{field_name:"fileId",title:"Tài liệu kèm theo",type:"file",isMulti:!0}},CollapsibleCoQuanGiaiQuyet=__name(({data,onRemove})=>{const{getDocument,uploadDocument}=useDonThu(),[fileId,setFileId]=reactExports.useState(""),handleChangeNS=reactExports.useCallback((name,value)=>{},[]);return reactExports.useEffect(()=>()=>{setFileId("")},[data]),jsxRuntimeExports.jsxs(Paper,{sx:{width:"100%",overflow:"hidden"},children:[jsxRuntimeExports.jsxs(Grid,{container:!0,xs:12,children:[jsxRuntimeExports.jsx(Tooltip,{title:"Thông tin cơ quan giải quyết",children:jsxRuntimeExports.jsx(IconButton,{size:"small",color:"default",children:jsxRuntimeExports.jsx(Icon,{children:"info"})})}),jsxRuntimeExports.jsx(Typography,{display:"flex",marginBottom:0,alignItems:"center",fontWeight:"bold",fontSize:15,gutterBottom:!0,component:"div",marginRight:1,children:"Chi tiết "}),jsxRuntimeExports.jsx(Divider,{orientation:"vertical",flexItem:!0})]}),jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Grid,{container:!0,xs:12,children:Object.entries(formCoQuanGiaiQuyet).map(([key,value],idx)=>{const dataFiles=key==="fileId"?{getDocument,uploadDocument,loaiVanBan:Enums_LoaiVanBan.ORGAN_RESOLVED,typeFolder:"DonThu",fileId}:{};return jsxRuntimeExports.jsx(Grid,{item:!0,xs:idx<=2?4:6,children:jsxRuntimeExports.jsx(FormControl,{data:{...value,name:value.field_name,...dataFiles},rules:value.rules,name:value.field_name,value:lodashExports.get(data,value.field_name,null),onChange:handleChangeNS,inline:!1,defaultValue:value.defaultValue||lodashExports.get(data,value.field_name,null)})})})})]})},"CollapsibleCoQuanGiaiQuyet"),RootDivider=styled("div")(({theme})=>({width:"100%",...theme.typography.body2,margin:"1rem 1rem 0 1rem",color:theme.palette.text.secondary,"& > :not(style) ~ :not(style)":{marginTop:theme.spacing(2)},"& > .MuiDivider-root:after":{width:"100%"},"& > .MuiDivider-root:before":{width:"100%"}})),DonForm=reactExports.memo(reactExports.forwardRef(({id},ref)=>{const[donThu,setDonThu]=reactExports.useState({}),[isCoQuanGiaiQuyet,setIsCoQuanGiaiQuyet]=reactExports.useState(!1),{uploadDocument,getDocument,updateLetter}=useDonThu(),{watch}=useFormContext(),[isUpdate,setIsUpdate]=reactExports.useState(!1),{getValues}=useFormContext(),handleEdit=reactExports.useCallback(async()=>{try{const tiepDan=getValues(),dataForm={};Object.entries({...formDataDonThu,donThuCoQuanGiaiQuyet:""}).forEach(([key,value])=>{dataForm[key]=lodashExports.get(tiepDan,key)}),delete dataForm.fileId,delete dataForm.ghiChu,id&&await updateLetter(id,dataForm),CHECK_SUCCESS("Cập nhật thành công"),setIsUpdate(!1)}catch{}},[id]);return reactExports.useImperativeHandle(ref,()=>({enableEdit:statusEdit=>{setIsUpdate(statusEdit===StatusEdit.EDIT)},handleEdit}),[]),jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsxs(Grid,{rowGap:0,container:!0,xs:12,children:[Object.entries(formDataDonThu).map(([key,value],idx,arr)=>idx<3?jsxRuntimeExports.jsx(Grid,{item:!0,xs:3,display:value.field_name==="dmLoaiDoiTuongId"&&(!watch("dmPhanTheoNoiDungId")||![1,2].includes(parseInt(watch("dmPhanTheoNoiDungId"))))?"none":"block",children:jsxRuntimeExports.jsx(FormControl,{data:{...value,name:value.field_name,where:value.field_name==="dmLoaiDoiTuongId"?[{field:"dmPhanTheoNoiDungId",expression:"eq",value:watch("dmPhanTheoNoiDungId")}]:null},rules:value.rules,name:value.field_name,isLabel:id&&!isUpdate,hidden:value.field_name==="dmLoaiDoiTuongId"&&(!watch("dmPhanTheoNoiDungId")||![1,2].includes(parseInt(watch("dmPhanTheoNoiDungId"))))},idx+key)},idx+3+key):jsxRuntimeExports.jsx(reactExports.Fragment,{},idx+3+key)),jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,children:jsxRuntimeExports.jsx(FormControl,{data:{...formDataDonThu.noiDungDon,name:formDataDonThu.noiDungDon.field_name},rules:formDataDonThu.noiDungDon.rules,name:formDataDonThu.noiDungDon.field_name,isLabel:id&&!isUpdate})}),jsxRuntimeExports.jsx(RootDivider,{children:jsxRuntimeExports.jsx(Divider,{children:"Nơi ghi nhận vụ việc"})}),jsxRuntimeExports.jsxs(Grid,{container:!0,lg:12,md:12,children:[jsxRuntimeExports.jsx(Address,{inline:!0,value:watch("address"),wrapComponent:Grid,isRequire:!0,customProps:{item:!0,lg:3,md:3,xs:3},isLabel:id&&!isUpdate}),jsxRuntimeExports.jsx(Grid,{item:!0,xs:3,md:3,lg:3,children:jsxRuntimeExports.jsx(FormControl,{data:{...formDataDonThu.noiGhiNhanCuThe,name:formDataDonThu.noiGhiNhanCuThe.field_name},name:formDataDonThu.noiGhiNhanCuThe.field_name,isLabel:id&&!isUpdate})})]}),jsxRuntimeExports.jsx(RootDivider,{children:jsxRuntimeExports.jsx(Divider,{children:"***"})}),jsxRuntimeExports.jsx(Grid,{item:!0,xs:6,children:jsxRuntimeExports.jsx(FormControl,{data:{...formDataDonThu.fileId,name:formDataDonThu.fileId.field_name,getDocument,uploadDocument,loaiVanBan:Enums_LoaiVanBan.ATTACH,typeFolder:"DonThu",fileId:watch("fileId"),notChangeValue:!0},rules:formDataDonThu.fileId,name:formDataDonThu.fileId.field_name,isLabel:id&&!isUpdate})}),jsxRuntimeExports.jsxs(Grid,{item:!0,xs:12,children:[jsxRuntimeExports.jsx(FormControl,{data:{field_name:"donThuCoQuanDaGiaiQuyet.isCoQuanDaGiaiQuyet",title:"Cơ quan đã giải quyết",type:"checkbox",labelCol:2,contentCol:10},name:"donThuCoQuanDaGiaiQuyet.isCoQuanDaGiaiQuyet"}),watch("donThuCoQuanDaGiaiQuyet.isCoQuanDaGiaiQuyet")&&jsxRuntimeExports.jsx(Grid,{container:!0,xs:12,children:jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,children:jsxRuntimeExports.jsx(Grid,{sx:{width:"auto"},container:!0,spacing:1,margin:1,children:jsxRuntimeExports.jsx(Grid,{item:!0,xs:12,children:jsxRuntimeExports.jsx(CollapsibleCoQuanGiaiQuyet,{data:donThu,onRemove:dataRemove=>{setIsCoQuanGiaiQuyet(!1)},isCoQuanGiaiQuyet:!0})})})})})]})]})})})),ExpandMore=styled$1(props=>{const{expand,...other}=props;return jsxRuntimeExports.jsx(IconButton,{...other})})(({theme,expand})=>({transform:expand?"rotate(0deg)":"rotate(180deg)",marginLeft:"auto",transition:theme.transitions.create("transform",{duration:theme.transitions.duration.shortest})})),CardHeaderCustom=styled$1(CardHeader)(({theme})=>({"& .MuiCardHeader-title":{color:"#1976d2",fontSize:"small",fontWeight:"500",padding:0},padding:5})),NguoiDungDonForm=reactExports.memo(reactExports.forwardRef(({id},ref)=>{const[isUpdate,setIsUpdate]=reactExports.useState(!1),{watch,getValues}=useFormContext(),{updateLetter}=useDonThu(),{postUserLetter}=useDonThuNguoiDungDon(),{updateNguoiUyQuyen}=useDonThuNguoiUyQuyen(),handleChangeNS=reactExports.useCallback(async(name,value)=>{if(id)try{console.log(name,value);const nguoiDaiDien={thongTinCaNhanId:value.slice(-1)[0].thongTinCaNhan.id,loai:name==="nguoiDaiDien"?Enums_NguoiDungDon.DUNGDON:Enums_NguoiDungDon.DICUNG,donThuId:id};await postUserLetter(nguoiDaiDien)}catch{}},[id]),handleEdit=reactExports.useCallback(async()=>{try{const dataForm={};Object.entries({...formDataNguoiDungDon,donThuNguoiUyQuyen:"",luatSu:""}).forEach(([key,value])=>{dataForm[key]=lodashExports.get(getValues(),key)});const{donThuNguoiUyQuyen,luatSu,...donThu}=dataForm;console.log(dataForm),delete luatSu.fileId;let nguoiUyQuyen={};donThuNguoiUyQuyen&&(nguoiUyQuyen=new DonThuNguoiUyQuyen({thongTinCaNhanId:donThuNguoiUyQuyen.thongTinCaNhanId,...luatSu,isLuatSu:donThuNguoiUyQuyen.isLuatSu})),delete nguoiUyQuyen.fileId,delete nguoiUyQuyen.donThuId,delete nguoiUyQuyen.id;const donThuSave={phanTheoSoNguoi:donThu.phanTheoSoNguoi,soNguoi:donThu.soNguoi,soNguoiDaiDien:donThu.soNguoiDaiDien};console.log(nguoiUyQuyen,donThuSave),id&&(await updateLetter(id,donThuSave),await updateNguoiUyQuyen(id,nguoiUyQuyen)),setIsUpdate(!1)}catch{}},[id]);reactExports.useImperativeHandle(ref,()=>({enableEdit:statusEdit=>{setIsUpdate(statusEdit==="EDIT")},handleEdit}),[]);const layout=reactExports.useCallback(phanTheoSoNguoi=>{switch(phanTheoSoNguoi){case"0":case"1":return 4;default:return 3}},[]);return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Grid,{rowGap:1,container:!0,xs:12,children:Object.entries(formDataNguoiDungDon).map(([key,value],idx,arr)=>{const formatLayout=layout(watch("phanTheoSoNguoi"));return idx===0||watch("phanTheoSoNguoi")===value.group?jsxRuntimeExports.jsx(Grid,{item:!0,xs:formatLayout,children:jsxRuntimeExports.jsx(FormControl,{data:{...value,name:value.field_name},rules:value.rules,name:value.field_name,isLabel:id&&!isUpdate},idx+key)},idx+3+key):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})})}),jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(FormControl,{data:formDataNguoiDungDon.nguoiDaiDien,name:formDataNguoiDungDon.nguoiDaiDien.field_name,isLabel:id&&!isUpdate,enableSaveSingle:id,onChange:handleChangeNS}),watch("phanTheoSoNguoi")===Enums_PhanTheoSoNguoi[1].value&&jsxRuntimeExports.jsx(FormControl,{data:formDataNguoiDungDon.nguoiDiCung,name:formDataNguoiDungDon.nguoiDiCung.field_name,isLabel:id&&!isUpdate,onChange:handleChangeNS,enableSaveSingle:id}),jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(FormControl,{data:{...formDataNguoiDungDon.uyQuyen,name:"uyQuyen",disabled:id&&!isUpdate},name:"uyQuyen"}),watch("uyQuyen")&&jsxRuntimeExports.jsx(Delegacy,{id,isLabel:!!(id&&!isUpdate)})]})}));var StatusEdit=(StatusEdit2=>(StatusEdit2.EDIT="EDIT",StatusEdit2.SEEN="SEEN",StatusEdit2))(StatusEdit||{});const ExpandForm=reactExports.memo(reactExports.forwardRef(({children,title,id},ref)=>{const[expanded,setExpanded]=reactExports.useState(!0),[status,setStatus]=reactExports.useState("SEEN"),[statusSaveForm,setStatusSaveForm]=reactExports.useState("idle"),refChild=reactExports.useRef();reactExports.useEffect(()=>{id&&setStatus("SEEN")},[id]);const handleExpandClick=reactExports.useCallback(()=>{setExpanded(pre=>!pre)},[]);reactExports.useImperativeHandle(ref,()=>({handleExpandClick}),[handleExpandClick]);const childWithProps=reactExports.isValidElement(children)?reactExports.cloneElement(children,{ref:refChild,id}):children,handleSaveUpdate=reactExports.useCallback(async()=>{try{setStatusSaveForm("pending"),await refChild.current.handleEdit(),setStatus("SEEN"),setStatusSaveForm("success")}catch{}},[]);return jsxRuntimeExports.jsxs(Box,{marginBottom:1,borderRadius:"0.5rem",bgcolor:"white",boxShadow:"0px 5px 5px -3px rgba(0, 0, 0, 0.06), 0px 0px 0px 1px rgba(0, 0, 0, 0.042), 0px 3px 14px 2px rgba(0, 0, 0, 0.036)",children:[jsxRuntimeExports.jsx(CardHeaderCustom,{title:jsxRuntimeExports.jsxs(Stack$1,{direction:"row",justifyContent:"space-between",children:[jsxRuntimeExports.jsxs(Stack$1,{alignItems:"center",direction:"row",justifyContent:"flex-start",children:[jsxRuntimeExports.jsx(ExpandMore,{expand:expanded,onClick:handleExpandClick,"aria-label":"show more",children:jsxRuntimeExports.jsx(Icon,{children:"expand_more"})}),jsxRuntimeExports.jsx(Paragraph,{children:title})]}),id&&jsxRuntimeExports.jsxs(Stack$1,{alignItems:"center",direction:"row",justifyContent:"flex-start",children:[status==="SEEN"&&jsxRuntimeExports.jsx(Button,{size:"small",onClick:()=>{setExpanded(!0),refChild.current.enableEdit("EDIT"),setStatus("EDIT")},variant:"outlined",startIcon:jsxRuntimeExports.jsx(Icon,{children:"edit"}),children:"Chỉnh sửa"}),status==="EDIT"&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:statusSaveForm==="pending"?jsxRuntimeExports.jsx(LoadingButton,{loading:!0,loadingPosition:"start",color:"success",startIcon:jsxRuntimeExports.jsx(Icon,{children:"save"}),variant:"outlined",children:"Lưu"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{variant:"outlined",size:"small",onClick:handleSaveUpdate,startIcon:jsxRuntimeExports.jsx(Icon,{children:"save"}),color:"success",children:"Lưu"}),jsxRuntimeExports.jsx(Button,{variant:"outlined",size:"small",color:"error",onClick:()=>{refChild.current.enableEdit("SEEN"),setStatus("SEEN")},startIcon:jsxRuntimeExports.jsx(Icon,{children:"cancel"}),children:"Hủy"})]})})]})]})}),jsxRuntimeExports.jsx(Collapse,{in:expanded,timeout:"auto",children:childWithProps})]})})),Index$2=__name(({id,onClose})=>{const{postLetter,getLetterById}=useDonThu(),{getBienNhan}=useTiepDan(),refForm=reactExports.useRef(),refExpand=reactExports.useRef(),{user}=useAuth(),getDataById=reactExports.useCallback(async id2=>{try{let{donThuNguoiUyQuyen,tiepDan,donThuNguoiDungDons,phanTheoSoNguoi,soNguoi,soNguoiDaiDien,noiDungDon,noiGhiNhanTinh,noiGhiNhanHuyen,noiGhiNhan,...data}=await getLetterById(id2,{select:["donThuCoQuanDaGiaiQuyet","dmLinhVucId","dmPhanTheoNoiDungId","fileId","dmNhiemKyId","phanTheoSoNguoi","soNguoi","soNguoiDaiDien","noiDungDon","noiGhiNhanCuThe","dmLoaiDoiTuongId"],expand:{noiGhiNhan:{},noiGhiNhanHuyen:{},noiGhiNhanTinh:{},donThuNguoiUyQuyen:{expand:{thongTinCaNhan:{select:["dienThoai","email","gioiTinh","hoVaTenDem","ten","soDinhDanh"]}}},donThuNguoiDungDons:{expand:{thongTinCaNhan:{select:["dienThoai","email","gioiTinh","hoVaTenDem","ten","soDinhDanh"]}},select:"loai"},tiepDan:{expand:{tiepDanOrganizations:{select:["chucVu","hoVaTen","organizationId","organName"]},tiepDanCanBoTiepNhan:{select:["canBoId","isThuTruong"]},tiepDanXuLy:{}}},dmNhiemKy:{select:"name"}}}),defaultVal={DICUNG:[],DUNGDON:[]},groupNguoiDungDon={DICUNG:[],DUNGDON:[]};donThuNguoiDungDons&&(groupNguoiDungDon=donThuNguoiDungDons==null?void 0:donThuNguoiDungDons.reduce((preVal,currentVal)=>{switch(currentVal.loai){case Enums_NguoiDungDon.DUNGDON:preVal.DUNGDON.push(currentVal);break;default:preVal.DICUNG.push(currentVal);break}return preVal},defaultVal));let luatSu={};if(donThuNguoiUyQuyen){const{thongTinCaNhan,...nguoiUyQuyen}=donThuNguoiUyQuyen;if(donThuNguoiUyQuyen={...nguoiUyQuyen,...thongTinCaNhan,soDinhDanh:{value:donThuNguoiUyQuyen.thongTinCaNhan.soDinhDanh,label:donThuNguoiUyQuyen.thongTinCaNhan.soDinhDanh}},donThuNguoiUyQuyen.isLuatSu){const{ngayCap,noiCap,soThe,thongTinGioiThieu}=donThuNguoiUyQuyen;luatSu={ngayCap,noiCap,soThe,thongTinGioiThieu}}}const{tiepDanOrganizations,...tiepDanData}=tiepDan,tiepDanOrganizationsData=tiepDanOrganizations.map(cur=>{const{organizationId,organName,...tiepDanOrganization}=cur;return tiepDanOrganization.organizationId={id:organizationId,organName},tiepDanOrganization}),dataForm={id:id2,coQuanGiaiQuyet:"",dmLinhVucId:data.dmLinhVucId,dmPhanTheoNoiDungId:data.dmPhanTheoNoiDungId,fileId:data.fileId,nguoiDaiDien:groupNguoiDungDon.DUNGDON.map(cur=>({...cur,thongTinCaNhan:{...cur.thongTinCaNhan,soDinhDanh:{value:cur.thongTinCaNhan.soDinhDanh,label:cur.thongTinCaNhan.soDinhDanh+" - "+cur.thongTinCaNhan.hoVaTenDem+" "+cur.thongTinCaNhan.ten}}})),nguoiDiCung:groupNguoiDungDon!=null&&groupNguoiDungDon.DICUNG?groupNguoiDungDon.DICUNG.map(cur=>({...cur,thongTinCaNhan:{...cur.thongTinCaNhan,soDinhDanh:{value:cur.thongTinCaNhan.soDinhDanh,label:cur.thongTinCaNhan.soDinhDanh+" - "+cur.thongTinCaNhan.hoVaTenDem+" "+cur.thongTinCaNhan.ten}}})):[],donThuNguoiUyQuyen,luatSu,noiDungDon,phanTheoSoNguoi,soNguoi,soNguoiDaiDien,tiepDan:{...tiepDanData,tiepDanOrganizations:tiepDanOrganizationsData},dmNhiemKyId:data.dmNhiemKyId,dmLoaiDoiTuongId:data.dmLoaiDoiTuongId,uyQuyen:!!donThuNguoiUyQuyen,province:noiGhiNhanTinh,district:noiGhiNhanHuyen,ward:noiGhiNhan,noiGhiNhanCuThe:data.noiGhiNhanCuThe};return console.log(dataForm),dataForm}catch{}},[]),handleSubmit=reactExports.useCallback(async dataForm=>{var _a,_b;try{let{nguoiDaiDien,nguoiDiCung,donThuNguoiUyQuyen,tiepDan,luatSu,fileId,donThuCoQuanDaGiaiQuyet,province,district,ward,noiGhiNhanCuThe,...donThu}=dataForm;if(id)console.log(dataForm);else{console.log(dataForm);const donThuNguoiDungDons=[];let nguoiUyQuyen;donThuNguoiUyQuyen?(nguoiUyQuyen=new DonThuNguoiUyQuyen({thongTinCaNhanId:donThuNguoiUyQuyen.thongTinCaNhanId,...luatSu,isLuatSu:donThuNguoiUyQuyen.isLuatSu}),delete nguoiUyQuyen.fileId):nguoiUyQuyen=void 0,nguoiDaiDien&&nguoiDaiDien.forEach(u=>donThuNguoiDungDons.push({thongTinCaNhanId:u.thongTinCaNhan.id,loai:Enums_NguoiDungDon.DUNGDON})),nguoiDiCung&&nguoiDiCung.forEach(u=>donThuNguoiDungDons.push({thongTinCaNhanId:u.thongTinCaNhan.id,loai:Enums_NguoiDungDon.DICUNG}));const{dmNhiemKyId,tiepDanOrganizations,...dataTiepDan}=tiepDan,tiepDanOrganizationsSave=tiepDanOrganizations.map((cur,index)=>({...cur,organizationId:cur.organizationId.id}));delete dataTiepDan.isThuTruongTiep,delete donThu.uyQuyen,delete donThu.coQuanGiaiQuyet,delete donThu.fileId;const tiepDanSave=new TiepDan({...dataTiepDan,dmHinhThucTiepDanId:2,tiepDanOrganizations:tiepDanOrganizationsSave});delete donThuCoQuanDaGiaiQuyet.isCoQuanDaGiaiQuyet;const donThuSave={donThuNguoiDungDons,donThuNguoiUyQuyen:nguoiUyQuyen,fileId,tiepDan:tiepDanSave,...donThu,dmNhiemKyId,dmLoaiHinhTiepNhanId:2,thoiGianTiepNhan:(_a=tiepDanSave.tiepDanXuLy)==null?void 0:_a.ngayXuLy,donThuXuLys:[{ngayTiepNhan:(_b=tiepDanSave.tiepDanXuLy)==null?void 0:_b.ngayXuLy,fileId:v4()}],noiGhiNhanTinhCode:province.code,noiGhiNhanHuyenCode:district.code,noiGhiNhanCode:ward.code,noiGhiNhanCuThe},{resultObj}=await postLetter(donThuSave);CHECK_REQUEST("Thông báo","Lưu Thành công! Xuất giấy biên nhận?","Giấy biên nhận",()=>getBienNhan(resultObj.tiepDanId)).then(async()=>{onClose(),console.log("Thành công")}),Promise.resolve(resultObj)}}catch(error){CHECK_ERROR(error)}},[onClose]),{execute:submitForm,status:statusSubmit}=useAsync(handleSubmit),{execute,status}=useAsync(getDataById),getInitData=reactExports.useCallback(()=>{const currentDate=hooks(),iniData={fileId:v4(),phanTheoSoNguoi:"Mot",tiepDan:{ngayTiepDan:getCurrentDate({}).format(),ngayHenTra:getCurrentDate({date:currentDate.clone().add(10,"days")}).format(),fileId:v4(),tiepDanXuLy:{ngayXuLy:getCurrentDate({}).format()}},...iniAddress,district:user.dmHuyen,ward:user.dmXa};return Promise.resolve(iniData)},[]);return jsxRuntimeExports.jsx(Form,{ref:refForm,onSubmit:submitForm,defaultValues:()=>id?execute(id):getInitData(),children:jsxRuntimeExports.jsxs(Card,{sx:{background:"transparent",borderRadius:"0.5rem",boxShadow:"none !important",padding:"0.2rem"},children:[jsxRuntimeExports.jsx(Backdrop,{sx:{color:"#fff",zIndex:theme=>theme.zIndex.drawer+1},open:status==="pending"||statusSubmit==="pending",children:jsxRuntimeExports.jsx(CircularProgress,{color:"inherit"})}),jsxRuntimeExports.jsx(ExpandForm,{id,ref:refExpand,title:"Lãnh đạo tiếp",children:jsxRuntimeExports.jsx(LanhDaoForm,{})}),jsxRuntimeExports.jsx(ExpandForm,{id,ref:refExpand,title:"Người đứng đơn",children:jsxRuntimeExports.jsx(NguoiDungDonForm,{})}),jsxRuntimeExports.jsx(ExpandForm,{id,ref:refExpand,title:"Đơn / Vụ việc",children:jsxRuntimeExports.jsx(DonForm,{})}),jsxRuntimeExports.jsx(ExpandForm,{id,ref:refExpand,title:"Xử lý lượt tiếp công dân"}),jsxRuntimeExports.jsxs(CardActions,{children:[jsxRuntimeExports.jsx(Stack$1,{direction:"row",justifyContent:"end",spacing:2}),jsxRuntimeExports.jsx(Button,{size:"small",color:"error",startIcon:jsxRuntimeExports.jsx(Icon,{children:"cancel"}),onClick:onClose,disabled:!1,children:"Hủy"}),jsxRuntimeExports.jsx(Button,{size:"small",type:"button",onClick:()=>{refForm.current.submit()},variant:"outlined",startIcon:status==="pending"?jsxRuntimeExports.jsx(CircularProgress,{size:20}):jsxRuntimeExports.jsx(Icon,{children:"save"}),disabled:status==="pending",children:"Lưu"})]})]})})},"Index$2"),ReceiveForm=reactExports.memo(Index$2),ReceiveForm$1=Object.assign(ReceiveForm,{ExpandMore,ExpandForm}),CustomTabPanel=__name(props=>{const{children,value,index,...other}=props;return jsxRuntimeExports.jsx("div",{role:"tabpanel",style:{display:value===index?"block":"none"},id:`simple-tabpanel-${index}`,"aria-labelledby":`simple-tab-${index}`,...other,children:jsxRuntimeExports.jsx(Box,{sx:{padding:"2px"},children:jsxRuntimeExports.jsx(Typography,{children})})})},"CustomTabPanel");function a11yProps(index){return{id:`full-width-tab-${index}`,"aria-controls":`full-width-tabpanel-${index}`}}__name(a11yProps,"a11yProps");const ExportGiayHen=__name(({id})=>{const[anchorEl,setAnchorEl]=reactExports.useState(null),[selected,setSelected]=reactExports.useState(getCurrentDate({}).format()),{getGiayHen}=useTiepDan(),{execute,status}=useAsync(getGiayHen),handleClick=__name(event=>{setAnchorEl(event.currentTarget)},"handleClick"),handleClose=__name(()=>{setAnchorEl(null)},"handleClose"),handleExport=reactExports.useCallback(async()=>{try{setAnchorEl(null);const response=await execute({tiepDanId:id,ngayHen:selected});if(response instanceof Blob){const blobUrl=URL.createObjectURL(response),a=document.createElement("a");a.href=blobUrl,a.download="Giấy hẹn",document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(blobUrl)}}catch{}},[id,selected]),open=!!anchorEl,idPop=open?"simple-popover":void 0,inputElement=document.getElementById("ngayHen");if(inputElement){const parentDiv=inputElement.closest(".MuiFormControl-root");parentDiv&&parentDiv.classList.add("hidden")}return jsxRuntimeExports.jsx("div",{children:status==="pending"?jsxRuntimeExports.jsx(LoadingButton,{loading:!0,loadingPosition:"start",color:"success",startIcon:jsxRuntimeExports.jsx(Icon,{children:"save"}),variant:"outlined",children:"Lưu"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{"aria-describedby":idPop,size:"small",variant:"outlined",onClick:handleClick,children:"Xuất giấy hẹn"}),jsxRuntimeExports.jsxs(Popover,{id:idPop,open,anchorEl,onClose:handleClose,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:[jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(InputDate,{inline:!0,enableTime:!0,placeholder:"Chọn ngày hẹn",style:{height:"2rem"},className:"date-time",name:"ngayHen",value:selected,onChange:date=>setSelected(date),minDate:getCurrentDate({}).format()})}),jsxRuntimeExports.jsx(Stack,{direction:"row",justifyContent:"right",margin:"8px 8px 8px 0",marginBottom:1,gap:1,children:jsxRuntimeExports.jsx(Button,{size:"small",type:"button",onClick:handleExport,variant:"outlined",startIcon:jsxRuntimeExports.jsx(Icon,{children:"report"}),children:"Xuất"})})]})]})})},"ExportGiayHen"),Index$1=__name(({tiepDan,onClose})=>{const theme=useTheme(),[value,setValue]=reactExports.useState(0);reactExports.useEffect(()=>{tiepDan&&tiepDan.isTuChoi&&setValue(1)},[]);const handleChange=__name((event,newValue)=>{setValue(newValue)},"handleChange"),handleChangeIndex=__name(index=>{setValue(index)},"handleChangeIndex");return jsxRuntimeExports.jsxs(Box,{sx:{width:"100%"},children:[jsxRuntimeExports.jsxs(Box,{display:"flex",alignItems:"center",justifyContent:"space-between",sx:{borderBottom:1,borderColor:"divider"},children:[jsxRuntimeExports.jsxs(Stack,{gap:1,direction:"row",alignItems:"center",justifyContent:"left",children:[jsxRuntimeExports.jsx(Typography,{variant:"h6",fontWeight:"bold",children:value?"TỪ CHỐI TIẾP CÔNG DÂN":tiepDan!=null&&tiepDan.id?"CHỈNH SỬA THÔNG TIN":"THÊM MỚI"}),jsxRuntimeExports.jsx(Divider,{orientation:"vertical",flexItem:!0}),jsxRuntimeExports.jsx(Typography,{variant:"body1",fontWeight:"bold",children:"Ngày tiếp nhận:"}),jsxRuntimeExports.jsx(Typography,{variant:"body1",fontWeight:"normal",color:"blueviolet",children:hooks((tiepDan==null?void 0:tiepDan.ngayTiepDan)||new Date,"YYYY-MM-DD HH:mm","Asia/Ho_Chi_Minh").format("YYYY-MM-DD HH:mm")}),(tiepDan==null?void 0:tiepDan.id)&&jsxRuntimeExports.jsx(ExportGiayHen,{id:tiepDan.id})]}),jsxRuntimeExports.jsx(Tabs,{style:{minHeight:"40px"},value,onChange:handleChange,"aria-label":"basic tabs example",children:!(tiepDan!=null&&tiepDan.isTuChoi)&&jsxRuntimeExports.jsx(Tab,{iconPosition:"start",icon:jsxRuntimeExports.jsx(Icon,{children:"contact_mail"}),sx:{fontSize:"0.8rem",padding:"6px",minHeight:"auto"},label:"Tiếp công dân",...a11yProps(0)})})]}),jsxRuntimeExports.jsxs(SwipeableViews,{axis:theme.direction==="rtl"?"x-reverse":"x",index:value,onChangeIndex:handleChangeIndex,style:{overflow:"hidden"},children:[jsxRuntimeExports.jsx(CustomTabPanel,{value,index:0,children:jsxRuntimeExports.jsx(ReceiveForm$1,{id:lodashExports.get(tiepDan,"donThus[0].id",""),onClose})}),jsxRuntimeExports.jsx(CustomTabPanel,{value,index:1})]})]})},"Index$1"),UpdateForm=reactExports.memo(Index$1),Index=__name(()=>{const tableRef=reactExports.createRef(),[openConfig,setOpenConfig]=reactExports.useState(null),reloadTable=__name(()=>tableRef.current&&tableRef.current.onQueryChange(),"reloadTable"),{deleteReceivingCitizens}=useTiepDan(),handleDelete=__name(rowData=>{CHECK_CONFIRM("Bạn thật sự muốn xóa đơn tiếp dân này không?","Xoá đơn tiếp dân").then(res=>{res&&res.isConfirmed&&deleteReceivingCitizens(rowData.id).then(result=>{reloadTable(),CHECK_SUCCESS("Xoá thành công")}).catch(err=>CHECK_ERROR("Xoá thất bại !"))})},"handleDelete");return jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Grow,{in:!openConfig,children:jsxRuntimeExports.jsx(Box,{sx:{display:openConfig?"none":"block"},children:jsxRuntimeExports.jsx(DataTable,{isFullTextSearch:!0,tableRef,isAuth:!0,url:"/buss/allow/TiepDans",title:"Tiếp công dân định kỳ",columns:columnsTiepDan,selectType:"withColumns",where:"dmHinhThucTiepDanId eq 2",onAdd:{onClick:(e,rowData)=>{setOpenConfig(rowData)}},onEdit:{onClick:(e,rowData)=>{setOpenConfig(rowData)}},onRowClick:{},onDelete:{onClick:(event,rowData)=>handleDelete(rowData)}})})}),jsxRuntimeExports.jsx(Grow,{in:!!openConfig,children:jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsxs(Stack,{direction:"row",gap:1,justifyContent:"left",alignItems:"center",children:[openConfig&&jsxRuntimeExports.jsx(Button,{size:"small",onClick:()=>setOpenConfig(null),startIcon:jsxRuntimeExports.jsx(Icon,{children:"undo"}),children:"Quay lại"}),jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsxs(Breadcrumbs,{"aria-label":"breadcrumb",children:[jsxRuntimeExports.jsx(Link,{underline:"hover",color:"inherit",href:"",children:"Tiếp công dân"}),jsxRuntimeExports.jsx(Typography,{color:"text.primary",children:openConfig!=null&&openConfig.id?"Sửa":"Thêm mới"})]})]}),openConfig&&jsxRuntimeExports.jsx(UpdateForm,{tiepDan:openConfig,onClose:()=>{reloadTable(),setOpenConfig(null)}})]})})]})},"Index");export{Index as default};