瀏覽代碼

Merge branch 'master' of https://git.2fi-solutions.com/alex/PNSPS-frontend-MaterialUI

# Conflicts:
#	src/pages/DemandNote/Search_Public/SearchForm.js
master
Alex Cheung 1 年之前
父節點
當前提交
255fe682fc
共有 4 個檔案被更改,包括 80 行新增68 行删除
  1. +63
    -65
      src/pages/DemandNote/Search_Public/SearchForm.js
  2. +10
    -2
      src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js
  3. +6
    -0
      src/pages/User/DetailsPage_Organization/index.js
  4. +1
    -1
      src/utils/statusUtils/Base.js

+ 63
- 65
src/pages/DemandNote/Search_Public/SearchForm.js 查看文件

@@ -12,37 +12,37 @@ import * as React from "react";
import * as ComboData from "utils/ComboData";
import * as DateUtils from "utils/DateUtils";
import * as FormatUtils from "utils/FormatUtils";
import {FormattedMessage, useIntl} from "react-intl";
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst";
import {ThemeProvider} from "@emotion/react";
import { FormattedMessage, useIntl } from "react-intl";
import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst";
import { ThemeProvider } from "@emotion/react";
import { makeStyles } from '@mui/styles';

// ==============================|| DASHBOARD - DEFAULT ||============================== //
const useStyles = makeStyles(() => ({
root: {
position: "relative"
position: "relative"
},
display: {
position: "absolute",
top: 2,
left: 12,
bottom: 2,
background: "white",
pointerEvents: "none",
right: 50,
display: "flex",
alignItems: "center"
position: "absolute",
top: 2,
left: 12,
bottom: 2,
background: "white",
pointerEvents: "none",
right: 50,
display: "flex",
alignItems: "center"
},
}));
}));

const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
}) => {

const intl = useIntl();
const { locale } = intl;
const [type, setType] = React.useState([]);
const [issueSelected, setIssueSelected] = React.useState({ key: 0, i18nLabel: 'all', labelCht: '全部', label: 'All', type: 'all' });
const [issueSelected, setIssueSelected] = React.useState({ key: 0, i18nLabel: 'all', labelCht: '全部', label: 'All', type: 'all' });
const [issueCombo, setIssueCombo] = React.useState([]);
const [selectedStatus, setSelectedStatus] = React.useState(ComboData.denmandNoteStatus_Public[0]);

@@ -53,58 +53,58 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData

React.useEffect(() => {
console.log(minDate)
if (minDate != searchCriteria.dateFrom){
if (minDate != searchCriteria.dateFrom) {
setFromDateValue(minDate);
}
}, [minDate]);
React.useEffect(() => {
console.log(maxDate)
if (maxDate != searchCriteria.dateTo){
if (maxDate != searchCriteria.dateTo) {
setToDateValue(maxDate);
}
}, [maxDate]);

function FormDateInputComponent({inputRef, ...props }) {
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}
/>
<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 }) {
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}
/>
<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}
/>
</>
);
}
@@ -119,7 +119,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
typeArray.push(type[i].label);
}

if( fromDateValue!="dd / mm / yyyy"&&toDateValue!="dd / mm / yyyy"){
if (fromDateValue != "dd / mm / yyyy" && toDateValue != "dd / mm / yyyy") {
sentDateFrom = DateUtils.dateValue(fromDateValue)
sentDateTo = DateUtils.dateValue(toDateValue)
}
@@ -188,7 +188,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
<CardContent sx={{ px: 2.5, pt: 3 }}>
<Grid item justifyContent="space-between" alignItems="center" >
<Typography variant="pnspsFormHeader">
<FormattedMessage id="searchForm"/>
<FormattedMessage id="searchForm" />
</Typography>
</Grid>
</CardContent>
@@ -212,7 +212,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
}}
renderInput={(params) => (
<TextField {...params}
label={intl.formatMessage({id: 'gazetteCount'})}
label={intl.formatMessage({ id: 'gazetteCount' })}
InputLabelProps={{
shrink: true
}}
@@ -224,9 +224,9 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
<TextField
fullWidth
{...register("appNo")}
{...register("appNo")}
id='appNo'
label={intl.formatMessage({id: 'applicationId'})}
label={intl.formatMessage({ id: 'applicationId' })}
defaultValue={searchCriteria.appNo}
InputLabelProps={{
shrink: true
@@ -239,7 +239,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
fullWidth
{...register("dnNo")}
id='dnNo'
label={intl.formatMessage({id: 'paymentRecordId'})}
label={intl.formatMessage({ id: 'paymentRecordId' })}
defaultValue={searchCriteria.dnNo}
InputLabelProps={{
shrink: true
@@ -253,12 +253,11 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
{...register("dateFrom")}
id="dateFrom"
type="date"
label={intl.formatMessage({id: 'sendDateFrom'})}
label={intl.formatMessage({ id: 'sendDateFrom' })}
defaultValue={searchCriteria.dateFrom}
// InputProps={{ inputProps: { max: maxDate } }}
InputProps={{
inputComponent: FormDateInputComponent,
inputProps: { max: maxDate }
}}
onChange={(newValue) => {
setMinDate(newValue.target.value);
@@ -276,16 +275,15 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
shrink: true
}}
{...register("dateTo")}
InputProps={{
InputProps={{
inputComponent: ToDateInputComponent,
inputProps: { min: minDate }
}}
onChange={(newValue) => {
setMaxDate(newValue.target.value);
}}
id="dateTo"
type="date"
label={intl.formatMessage({id: 'sendDateTo'})}
label={intl.formatMessage({ id: 'sendDateTo' })}
defaultValue={searchCriteria.dateTo}
/>
</Grid>
@@ -297,8 +295,8 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
id="status"
size="small"
options={ComboData.denmandNoteStatus_Public}
getOptionLabel={(option) => option?.i18nLabel? intl.formatMessage({ id: option.i18nLabel }) : ""}
inputValue={selectedStatus?.i18nLabel? intl.formatMessage({ id: selectedStatus.i18nLabel }) : ""}
getOptionLabel={(option) => option?.i18nLabel ? intl.formatMessage({ id: option.i18nLabel }) : ""}
inputValue={selectedStatus?.i18nLabel ? intl.formatMessage({ id: selectedStatus.i18nLabel }) : ""}
value={selectedStatus}
onChange={(event, newValue) => {
if (newValue !== null) {
@@ -308,7 +306,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
renderInput={(params) => (
<TextField
{...params}
label={intl.formatMessage({id: 'status'})}
label={intl.formatMessage({ id: 'status' })}
/>
)}
InputLabelProps={{
@@ -324,13 +322,13 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData
{/*last row*/}
<Grid container maxWidth justifyContent="flex-end">
<ThemeProvider theme={PNSPS_BUTTON_THEME}>
<Grid item sx={{mr: 3, mb: 3}}>
<Grid item sx={{ mr: 3, mb: 3 }}>
<Button
color="cancel"
variant="contained"
onClick={resetForm}
>
<FormattedMessage id="reset"/>
<FormattedMessage id="reset" />
</Button>
</Grid>



+ 10
- 2
src/pages/User/DetailsPage_Organization/UserInformationCard_Organization.js 查看文件

@@ -98,7 +98,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>
contactPerson: values.contactPerson,
// enCompanyName: values.enCompanyName,
// chCompanyName: values.chCompanyName,
orgId: values.orgId,
orgId: values.orgId?.id,
// brNo: values.brNo,
// brExpiryDate: values.brExpiryDate,
preferLocale: values.preferLocale.type
@@ -303,6 +303,14 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>

<Grid item lg={4}>
{FieldUtils.getComboField({
label: "Organisation:",
valueName: "orgId",
getOptionLabel: (option) => option.brNo? option.brNo : "",
dataList: orgData,
disabled: (!editMode),
form: formik
})}
{/* {FieldUtils.getComboField({
label: "Organisation:",
valueName: "orgId",
disabled: (!editMode),
@@ -343,7 +351,7 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) =>
formik.setFieldValue("orgId", newValue.id);
},
form: formik
})}
})} */}
</Grid>

<Grid item lg={4}>


+ 6
- 0
src/pages/User/DetailsPage_Organization/index.js 查看文件

@@ -90,6 +90,12 @@ const UserMaintainPage_Organization = () => {
loadData();
}
}, []);

useEffect(() => {
if (orgData.length > 0 && userData["orgId"] != null){
userData["orgId"] = getObjectByType(orgData, "id", userData["orgId"]);
}
}, [orgData, userData]);
useEffect(() => {
// console.log(userData);


+ 1
- 1
src/utils/statusUtils/Base.js 查看文件

@@ -2,7 +2,7 @@ import { Typography } from "@mui/material"

export function getStatusTag({ color = "#000", textColor = "#FFF", text = "" }) {
return (
<div style={{ borderRadius: "25px", "background": color, "color": textColor, "padding": "5px 10px 5px 10px", margin: "6px 4px 6px 4px" }}>
<div style={{ borderRadius: "25px", "background": color, "color": textColor, "padding": "5px 10px 5px 10px", margin: "6px 0px 6px 0px" }}>
<Typography variant="h6">
{text}
</Typography>


Loading…
取消
儲存