|
|
@@ -24,6 +24,7 @@ import ContentPasteSearchIcon from '@mui/icons-material/ContentPasteSearch'; |
|
|
|
import CheckCircleOutline from '@mui/icons-material/CheckCircleOutline'; |
|
|
|
import HighlightOff from '@mui/icons-material/HighlightOff'; |
|
|
|
// import {useNavigate} from "react-router-dom"; |
|
|
|
import * as DateUtils from "utils/DateUtils"; |
|
|
|
|
|
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
|
const ClientDetailCard = ( |
|
|
@@ -35,6 +36,9 @@ const ClientDetailCard = ( |
|
|
|
) => { |
|
|
|
// const params = useParams(); |
|
|
|
const [currentApplicationDetailData, setCurrentApplicationDetailData] = useState({}); |
|
|
|
const [orgDetailData, setOrgDetailData] = useState({}); |
|
|
|
const [brExpiryDate,setBrExpiryDate] = useState(""); |
|
|
|
const [brNo,setBrNo] = useState(""); |
|
|
|
const [onReady, setOnReady] = useState(false); |
|
|
|
const [companyName, setCompanyName] = useState({ enCompanyName: "", chCompanyName: "" }); |
|
|
|
const { register, |
|
|
@@ -46,6 +50,7 @@ const ClientDetailCard = ( |
|
|
|
//if user data from parent are not null |
|
|
|
if (Object.keys(applicationDetailData).length > 0 && applicationDetailData !== undefined) { |
|
|
|
setCurrentApplicationDetailData(applicationDetailData.userData); |
|
|
|
setOrgDetailData(applicationDetailData.orgDetail.data); |
|
|
|
if (!applicationDetailData.companyName1 == null) { |
|
|
|
setCompanyName(applicationDetailData.companyName); |
|
|
|
} else { |
|
|
@@ -62,9 +67,39 @@ const ClientDetailCard = ( |
|
|
|
//if state data are ready and assign to different field |
|
|
|
// console.log(currentApplicationDetailData) |
|
|
|
if (Object.keys(currentApplicationDetailData).length > 0) { |
|
|
|
setOnReady(true); |
|
|
|
if(currentApplicationDetailData.orgId>0 && currentApplicationDetailData.orgId !=undefined && currentApplicationDetailData.orgId!=null){ |
|
|
|
if (Object.keys(orgDetailData).length > 0) { |
|
|
|
setBrExpiryDate(DateUtils.dateStr(orgDetailData.brExpiryDate)); |
|
|
|
setBrNo(orgDetailData.brNo); |
|
|
|
setOnReady(true); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
setBrExpiryDate(DateUtils.dateStr(currentApplicationDetailData.brExpiryDate)); |
|
|
|
setBrNo(currentApplicationDetailData.brNo); |
|
|
|
setOnReady(true); |
|
|
|
} |
|
|
|
} |
|
|
|
}, [currentApplicationDetailData]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (brNo != undefined && brNo.length > 0) { |
|
|
|
console.log(brExpiryDate) |
|
|
|
var currentDate = new Date(); // Current date |
|
|
|
var targetDate = new Date(brExpiryDate); // Target date |
|
|
|
|
|
|
|
if (targetDate < currentDate) { |
|
|
|
alert("The BR is expired.") |
|
|
|
} else { |
|
|
|
var timeDiff = Math.abs(currentDate.getTime()-targetDate.getTime()); |
|
|
|
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); |
|
|
|
console.log(diffDays) |
|
|
|
if (diffDays <= 7&&diffDays > 0){ |
|
|
|
alert("The BR is expiring.") |
|
|
|
} |
|
|
|
} |
|
|
|
setOnReady(true); |
|
|
|
} |
|
|
|
}, [brNo]); |
|
|
|
|
|
|
|
const handleViewClick = () => () => { |
|
|
|
console.log(currentApplicationDetailData) |
|
|
@@ -244,6 +279,56 @@ const ClientDetailCard = ( |
|
|
|
</FormControl> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
<Grid container direction="column" justifyContent="flex-start" |
|
|
|
alignItems="flex-start"> |
|
|
|
<Grid item xs={12} md={12} lg={12} mb={1} |
|
|
|
sx={{ display: 'flex', alignItems: 'center' }}> |
|
|
|
<FormLabel><Typography variant="h5">BR No:</Typography></FormLabel> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={12} lg={12} mb={1} sx={{ width: '100%' }} > |
|
|
|
<FormControl variant="outlined" sx={{ width: '100%' }} disabled > |
|
|
|
<OutlinedInput |
|
|
|
size="small" |
|
|
|
{...register("brNo", |
|
|
|
{ |
|
|
|
value: brNo, |
|
|
|
})} |
|
|
|
id='brNo' |
|
|
|
sx={{ |
|
|
|
"& .MuiInputBase-input.Mui-disabled": { |
|
|
|
WebkitTextFillColor: "#000000", |
|
|
|
background: "#f8f8f8", |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</FormControl> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
<Grid container direction="column" justifyContent="flex-start" |
|
|
|
alignItems="flex-start"> |
|
|
|
<Grid item xs={12} md={12} lg={12} mb={1} |
|
|
|
sx={{ display: 'flex', alignItems: 'center' }}> |
|
|
|
<FormLabel><Typography variant="h5">BR Expiry Date:</Typography></FormLabel> |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12} md={12} lg={12} mb={1} sx={{ width: '100%' }} > |
|
|
|
<FormControl variant="outlined" sx={{ width: '100%' }} disabled > |
|
|
|
<OutlinedInput |
|
|
|
size="small" |
|
|
|
{...register("brExpiryDate", |
|
|
|
{ |
|
|
|
value: brExpiryDate, |
|
|
|
})} |
|
|
|
id='brExpiryDate' |
|
|
|
sx={{ |
|
|
|
"& .MuiInputBase-input.Mui-disabled": { |
|
|
|
WebkitTextFillColor: "#000000", |
|
|
|
background: "#f8f8f8", |
|
|
|
}, |
|
|
|
}} |
|
|
|
/> |
|
|
|
</FormControl> |
|
|
|
</Grid> |
|
|
|
</Grid> |
|
|
|
<Grid container direction="column" justifyContent="flex-start" |
|
|
|
alignItems="flex-start"> |
|
|
|
<Grid item xs={12} md={12} lg={12} mb={1} |
|
|
|