|
@@ -14,8 +14,25 @@ import * as FormatUtils from "utils/FormatUtils"; |
|
|
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; |
|
|
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; |
|
|
import {ThemeProvider} from "@emotion/react"; |
|
|
import {ThemeProvider} from "@emotion/react"; |
|
|
import { useIntl } from "react-intl"; |
|
|
import { useIntl } from "react-intl"; |
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
|
|
|
|
|
|
import { makeStyles } from '@mui/styles'; |
|
|
|
|
|
|
|
|
|
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
|
|
|
const useStyles = makeStyles(() => ({ |
|
|
|
|
|
root: { |
|
|
|
|
|
position: "relative" |
|
|
|
|
|
}, |
|
|
|
|
|
display: { |
|
|
|
|
|
position: "absolute", |
|
|
|
|
|
top: 2, |
|
|
|
|
|
left: 12, |
|
|
|
|
|
bottom: 2, |
|
|
|
|
|
background: "white", |
|
|
|
|
|
pointerEvents: "none", |
|
|
|
|
|
right: 50, |
|
|
|
|
|
display: "flex", |
|
|
|
|
|
alignItems: "center" |
|
|
|
|
|
}, |
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issueComboData |
|
|
const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issueComboData |
|
|
}) => { |
|
|
}) => { |
|
@@ -29,12 +46,120 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue |
|
|
|
|
|
|
|
|
const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); |
|
|
const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); |
|
|
const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); |
|
|
const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); |
|
|
|
|
|
|
|
|
|
|
|
const [fromDateValue, setFromDateValue] = React.useState("dd / mm / yyyy"); |
|
|
|
|
|
const [toDateValue, setToDateValue] = React.useState("dd / mm / yyyy"); |
|
|
|
|
|
|
|
|
const [minDueDate, setMinDueDate] = React.useState(searchCriteria.dueDateFrom); |
|
|
const [minDueDate, setMinDueDate] = React.useState(searchCriteria.dueDateFrom); |
|
|
const [maxDueDate, setMaxDueDate] = React.useState(searchCriteria.dueDateTo); |
|
|
const [maxDueDate, setMaxDueDate] = React.useState(searchCriteria.dueDateTo); |
|
|
|
|
|
const [fromDueDateValue, setFromDueDateValue] = React.useState("dd / mm / yyyy"); |
|
|
|
|
|
const [toDueDateValue, setToDueDateValue] = React.useState("dd / mm / yyyy"); |
|
|
|
|
|
|
|
|
const intl = useIntl(); |
|
|
const intl = useIntl(); |
|
|
const { locale } = intl; |
|
|
const { locale } = intl; |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
|
setFromDateValue(minDate); |
|
|
|
|
|
}, [minDate]); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
|
setToDateValue(maxDate); |
|
|
|
|
|
}, [maxDate]); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
|
setFromDueDateValue(minDueDate); |
|
|
|
|
|
}, [minDueDate]); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
|
setToDueDateValue(maxDueDate); |
|
|
|
|
|
}, [maxDueDate]); |
|
|
|
|
|
|
|
|
|
|
|
function FormDateInputComponent({ inputRef, ...props }) { |
|
|
|
|
|
const classes = useStyles(); |
|
|
|
|
|
return ( |
|
|
|
|
|
<> |
|
|
|
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(fromDateValue) == "Invalid Date" ? |
|
|
|
|
|
fromDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(fromDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={fromDateValue} |
|
|
|
|
|
max={maxDate} |
|
|
|
|
|
/> |
|
|
|
|
|
</> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function ToDateInputComponent({ inputRef, ...props }) { |
|
|
|
|
|
const classes = useStyles(); |
|
|
|
|
|
return ( |
|
|
|
|
|
<> |
|
|
|
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(toDateValue) == "Invalid Date" ? |
|
|
|
|
|
toDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(toDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={toDateValue} |
|
|
|
|
|
min={minDate} |
|
|
|
|
|
/> |
|
|
|
|
|
</> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function FormDueDateInputComponent({ inputRef, ...props }) { |
|
|
|
|
|
const classes = useStyles(); |
|
|
|
|
|
return ( |
|
|
|
|
|
<> |
|
|
|
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(fromDueDateValue) == "Invalid Date" ? |
|
|
|
|
|
fromDueDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(fromDueDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={fromDueDateValue} |
|
|
|
|
|
max={maxDueDate} |
|
|
|
|
|
/> |
|
|
|
|
|
</> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function ToDueDateInputComponent({ inputRef, ...props }) { |
|
|
|
|
|
const classes = useStyles(); |
|
|
|
|
|
return ( |
|
|
|
|
|
<> |
|
|
|
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(toDueDateValue) == "Invalid Date" ? |
|
|
|
|
|
toDueDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(toDueDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={toDueDateValue} |
|
|
|
|
|
min={minDueDate} |
|
|
|
|
|
/> |
|
|
|
|
|
</> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { reset, register, handleSubmit } = useForm() |
|
|
const { reset, register, handleSubmit } = useForm() |
|
@@ -167,16 +292,21 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue |
|
|
{...register("orgId")} |
|
|
{...register("orgId")} |
|
|
disablePortal |
|
|
disablePortal |
|
|
id="orgId" |
|
|
id="orgId" |
|
|
size="small" |
|
|
|
|
|
options={orgCombo} |
|
|
options={orgCombo} |
|
|
|
|
|
size="small" |
|
|
value={orgSelected} |
|
|
value={orgSelected} |
|
|
inputValue={(orgSelected?.label) ? orgSelected?.label : ""} |
|
|
|
|
|
|
|
|
getOptionLabel={(option) => option.name? option.name : ""} |
|
|
|
|
|
inputValue={orgSelected ? orgSelected.name : ""} |
|
|
onChange={(event, newValue) => { |
|
|
onChange={(event, newValue) => { |
|
|
|
|
|
if (newValue !== null) { |
|
|
setOrgSelected(newValue); |
|
|
setOrgSelected(newValue); |
|
|
|
|
|
}else{ |
|
|
|
|
|
setOrgSelected({}); |
|
|
|
|
|
} |
|
|
}} |
|
|
}} |
|
|
renderInput={(params) => ( |
|
|
renderInput={(params) => ( |
|
|
<TextField {...params} |
|
|
<TextField {...params} |
|
|
label="BR No./ Organisation" |
|
|
|
|
|
|
|
|
label="Organisation" |
|
|
InputLabelProps={{ |
|
|
InputLabelProps={{ |
|
|
shrink: true |
|
|
shrink: true |
|
|
}} |
|
|
}} |
|
@@ -209,11 +339,13 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue |
|
|
{...register("dateFrom")} |
|
|
{...register("dateFrom")} |
|
|
id="dateFrom" |
|
|
id="dateFrom" |
|
|
type="date" |
|
|
type="date" |
|
|
label={"Issue Date(From)"} |
|
|
|
|
|
|
|
|
label={"Issue Date (From)"} |
|
|
defaultValue={searchCriteria.dateFrom} |
|
|
defaultValue={searchCriteria.dateFrom} |
|
|
InputProps={{ inputProps: { max: maxDate } }} |
|
|
|
|
|
|
|
|
InputProps={{ |
|
|
|
|
|
inputComponent: FormDateInputComponent, |
|
|
|
|
|
}} |
|
|
onChange={(newValue) => { |
|
|
onChange={(newValue) => { |
|
|
setMinDate(DateUtils.dateValue(newValue)); |
|
|
|
|
|
|
|
|
setMinDate(newValue.target.value); |
|
|
}} |
|
|
}} |
|
|
InputLabelProps={{ |
|
|
InputLabelProps={{ |
|
|
shrink: true |
|
|
shrink: true |
|
@@ -228,9 +360,11 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue |
|
|
shrink: true |
|
|
shrink: true |
|
|
}} |
|
|
}} |
|
|
{...register("dateTo")} |
|
|
{...register("dateTo")} |
|
|
InputProps={{ inputProps: { min: minDate } }} |
|
|
|
|
|
|
|
|
InputProps={{ |
|
|
|
|
|
inputComponent: ToDateInputComponent, |
|
|
|
|
|
}} |
|
|
onChange={(newValue) => { |
|
|
onChange={(newValue) => { |
|
|
setMaxDate(DateUtils.dateValue(newValue)); |
|
|
|
|
|
|
|
|
setMaxDate(newValue.target.value); |
|
|
}} |
|
|
}} |
|
|
id="dateTo" |
|
|
id="dateTo" |
|
|
type="date" |
|
|
type="date" |
|
@@ -251,9 +385,11 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue |
|
|
type="date" |
|
|
type="date" |
|
|
label={"Due Date (From)"} |
|
|
label={"Due Date (From)"} |
|
|
defaultValue={searchCriteria.dueDateFrom} |
|
|
defaultValue={searchCriteria.dueDateFrom} |
|
|
InputProps={{ inputProps: { max: maxDueDate } }} |
|
|
|
|
|
|
|
|
InputProps={{ |
|
|
|
|
|
inputComponent: FormDueDateInputComponent, |
|
|
|
|
|
}} |
|
|
onChange={(newValue) => { |
|
|
onChange={(newValue) => { |
|
|
setMinDueDate(DateUtils.dateValue(newValue)); |
|
|
|
|
|
|
|
|
setMinDueDate(newValue.target.value); |
|
|
}} |
|
|
}} |
|
|
InputLabelProps={{ |
|
|
InputLabelProps={{ |
|
|
shrink: true |
|
|
shrink: true |
|
@@ -269,9 +405,11 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue |
|
|
shrink: true |
|
|
shrink: true |
|
|
}} |
|
|
}} |
|
|
{...register("dueDateTo")} |
|
|
{...register("dueDateTo")} |
|
|
InputProps={{ inputProps: { min: minDueDate } }} |
|
|
|
|
|
|
|
|
InputProps={{ |
|
|
|
|
|
inputComponent: ToDueDateInputComponent, |
|
|
|
|
|
}} |
|
|
onChange={(newValue) => { |
|
|
onChange={(newValue) => { |
|
|
setMaxDueDate(DateUtils.dateValue(newValue)); |
|
|
|
|
|
|
|
|
setMaxDueDate(newValue.target.value); |
|
|
}} |
|
|
}} |
|
|
id="dueDateTo" |
|
|
id="dueDateTo" |
|
|
type="date" |
|
|
type="date" |
|
|