소스 검색

update org combo

master
Alex Cheung 1 년 전
부모
커밋
5e5a5fac49
2개의 변경된 파일100개의 추가작업 그리고 11개의 파일을 삭제
  1. +99
    -10
      src/pages/PublicNotice/Search_GLD/SearchForm.js
  2. +1
    -1
      src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js

+ 99
- 10
src/pages/PublicNotice/Search_GLD/SearchForm.js 파일 보기

@@ -14,8 +14,25 @@ import * as FormatUtils from "utils/FormatUtils";
import { ThemeProvider } from "@emotion/react";
import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst";
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 SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, issueComboData
}) => {
@@ -30,6 +47,60 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss

const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom);
const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo);
const [fromDateValue, setFromDateValue] = React.useState("dd / mm / yyyy");
const [toDateValue, setToDateValue] = React.useState("dd / mm / yyyy");

React.useEffect(() => {
setFromDateValue(minDate);
}, [minDate]);

React.useEffect(() => {
setToDateValue(maxDate);
}, [maxDate]);

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}
/>
</>
);
}

const intl = useIntl();
const { locale } = intl;
@@ -39,15 +110,22 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
const onSubmit = (data) => {
data.status = selectedStatus?.type
let typeArray = [];
let sentDateFrom = "";
let sentDateTo = "";

for (let i = 0; i < type.length; i++) {
typeArray.push(type[i].label);
}
if (fromDateValue != "dd / mm / yyyy" && toDateValue != "dd / mm / yyyy") {
sentDateFrom = DateUtils.dateValue(fromDateValue)
sentDateTo = DateUtils.dateValue(toDateValue)
}

const temp = {
appNo: data.appNo,
dateFrom: data.dateFrom,
dateTo: data.dateTo,
dateFrom: sentDateFrom,
dateTo: sentDateTo,
contact: data.contact,
status: (data.status === '' || data.status?.includes("all")) ? "" : data.status,
orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "",
@@ -75,6 +153,8 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
setOrgSelected({});
setIssueSelected({});
setSelectedStatus({key: 0, label: 'All', type: 'all'});
setMinDate(DateUtils.dateValue(new Date().setDate(new Date().getDate()-14)))
setMaxDate(DateUtils.dateValue(new Date()))
reset();
}

@@ -142,9 +222,11 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
type="date"
label={"Submit Date (From)"}
defaultValue={searchCriteria.dateFrom}
InputProps={{ inputProps: { max: maxDate } }}
InputProps={{
inputComponent: FormDateInputComponent,
}}
onChange={(newValue) => {
setMinDate(DateUtils.dateValue(newValue));
setMinDate(newValue.target.value);
}}
InputLabelProps={{
shrink: true
@@ -159,9 +241,11 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
shrink: true
}}
{...register("dateTo")}
InputProps={{ inputProps: { min: minDate } }}
InputProps={{
inputComponent: ToDateInputComponent,
}}
onChange={(newValue) => {
setMaxDate(DateUtils.dateValue(newValue));
setMaxDate(newValue.target.value);
}}
id="dateTo"
type="date"
@@ -256,13 +340,18 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss
options={orgCombo}
size="small"
value={orgSelected}
inputValue={(orgSelected?.label) ? orgSelected?.label : ""}
getOptionLabel={(option) => option.name? option.name : ""}
inputValue={orgSelected ? orgSelected.name : ""}
onChange={(event, newValue) => {
setOrgSelected(newValue);
if (newValue !== null) {
setOrgSelected(newValue);
}else{
setOrgSelected({});
}
}}
renderInput={(params) => (
<TextField {...params}
label="BR No./ Organisation"
label="Organisation"
InputLabelProps={{
shrink: true
}}


+ 1
- 1
src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js 파일 보기

@@ -305,7 +305,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>
{FieldUtils.getComboField({
label: "Organisation:",
valueName: "orgId",
getOptionLabel: (option) => option.brNo? option.brNo : "",
getOptionLabel: (option) => option.enCompanyName?option.enCompanyName:option.chCompanyName? option.chCompanyName : "",
dataList: orgData,
disabled: (!editMode),
form: formik


불러오는 중...
취소
저장