Bläddra i källkod

upload combo and file list

master
Alex Cheung 2 år sedan
förälder
incheckning
87636871bd
18 ändrade filer med 80 tillägg och 65 borttagningar
  1. +1
    -1
      src/components/FileList.js
  2. +1
    -1
      src/pages/OrganizationSearchPage/OrganizationTable.js
  3. +3
    -3
      src/pages/authentication/AuthWrapperCustom.js
  4. +6
    -11
      src/pages/authentication/BusRegister.js
  5. +4
    -4
      src/pages/authentication/Register.js
  6. +2
    -2
      src/pages/authentication/auth-forms/BusCustomFormWizard.js
  7. +45
    -31
      src/pages/authentication/auth-forms/CustomFormWizard.js
  8. +1
    -1
      src/pages/authentication/auth-forms/UploadFileTable.js
  9. +1
    -1
      src/pages/extra-pages/LoadingComponent.js
  10. +1
    -1
      src/pages/pnspsUserDetailPage/UserAuthTable.js
  11. +1
    -1
      src/pages/pnspsUserDetailPage/UserGroupTable.js
  12. +1
    -1
      src/pages/pnspsUserGroupDetailPage/GroupAuthTable.js
  13. +1
    -0
      src/pages/pnspsUserGroupDetailPage/UserAddCard.js
  14. +1
    -1
      src/pages/pnspsUserGroupSearchPage/UserGroupTable.js
  15. +1
    -1
      src/pages/pnspsUserSearchPage/UserTable.js
  16. +1
    -1
      src/pages/pnspsUserSearchPage_Individual/UserTable_Individual.js
  17. +1
    -1
      src/pages/pnspsUserSearchPage_Organization/UserTable_Organization.js
  18. +8
    -3
      src/utils/ComboData.js

+ 1
- 1
src/components/FileList.js Visa fil

@@ -149,7 +149,7 @@ export default function FileList({refType, refId, allowDelete, sx}) {
},
}}
pageSizeOptions={[5, 10]}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 1
- 1
src/pages/OrganizationSearchPage/OrganizationTable.js Visa fil

@@ -86,7 +86,7 @@ export default function OrganizationTable({recordList}) {
},
}}
pageSizeOptions={[5, 10]}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 3
- 3
src/pages/authentication/AuthWrapperCustom.js Visa fil

@@ -14,7 +14,7 @@ import AuthBackground from 'assets/images/auth/AuthBackground';
// ==============================|| AUTHENTICATION - WRAPPER ||============================== //

const AuthWrapperCustom = ({ children }) => (
<Box sx={{ minHeight: '80vh' }}>
<Box sx={{ minHeight: '60vh' }}>
<AuthBackground />
<Grid
container
@@ -22,7 +22,7 @@ const AuthWrapperCustom = ({ children }) => (
justifyContent="center"
alignItems="flex-start"
sx={{
minHeight: '80vh'
minHeight: '60vh'
}}
>
{/* <Grid item xs={12} sx={{ ml: 3, mt: 3 }}>
@@ -35,7 +35,7 @@ const AuthWrapperCustom = ({ children }) => (
container
justifyContent="center"
alignItems="flex-start"
sx={{ minHeight: { xs: 'calc(80vh - 134px)', md: 'calc(80vh - 112px)' }}}
sx={{ minHeight: { xs: 'calc(60vh - 134px)', md: 'calc(60vh - 112px)' }}}
>
<Grid item>
<AuthCard>{children}</AuthCard>


+ 6
- 11
src/pages/authentication/BusRegister.js Visa fil

@@ -74,23 +74,17 @@
steps.findIndex((step, i) => !(i in completed))
: activeStep + 1;
setActiveStep(newActiveStep);
console.log(newActiveStep)
scrollToTop();
};

const handleBack = () => {
scrollToTop();
setActiveStep((prevActiveStep) => prevActiveStep - 1);
};

// const handleStep = (step) => () => {
// setActiveStep(step);
// };

// const handleComplete = () => {
// const newCompleted = completed;
// newCompleted[activeStep] = true;
// setCompleted(newCompleted);
// handleNext();
// };
const scrollToTop = () => {
window.scrollTo(0,0);
};

const handleReset = () => {
setActiveStep(0);
@@ -173,6 +167,7 @@
</Button>
):
(
// <Button disabled={updateValid} variant="outlined" onClick={handleNext} sx={{ mr: 1 }}>
<Button disabled={!updateValid} variant="outlined" onClick={handleNext} sx={{ mr: 1 }}>
繼續
</Button>


+ 4
- 4
src/pages/authentication/Register.js Visa fil

@@ -75,7 +75,6 @@
};

const handleNext = () => {
scrollToTop()
const newActiveStep =
isLastStep() && !allStepsCompleted()
? // It's the last step, but not all steps have been completed,
@@ -83,16 +82,16 @@
steps.findIndex((step, i) => !(i in completed))
: activeStep + 1;
setActiveStep(newActiveStep);
// console.log(newActiveStep)
scrollToTop();
};

const handleBack = () => {
scrollToTop()
scrollToTop();
setActiveStep((prevActiveStep) => prevActiveStep - 1);
};

const scrollToTop = () => {
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
window.scrollTo(0,0);
};

const handleReset = () => {
@@ -176,6 +175,7 @@
</Button>
):
(
// <Button disabled={updateValid} variant="outlined" onClick={handleNext} sx={{ mr: 1 }}>
<Button disabled={!updateValid} variant="outlined" onClick={handleNext} sx={{ mr: 1 }}>
繼續
</Button>


+ 2
- 2
src/pages/authentication/auth-forms/BusCustomFormWizard.js Visa fil

@@ -722,7 +722,7 @@ const BusCustomFormWizard = (props) => {
</Grid>
<Grid item xs={12} md={12}>
<Stack spacing={1}>
<InputLabel htmlFor="enName-signup">英文姓名
<InputLabel htmlFor="enName-signup">姓名
<span style={{color: '#f10000'}}>*</span>
</InputLabel>
<OutlinedInput
@@ -731,7 +731,7 @@ const BusCustomFormWizard = (props) => {
value={formik.values.enName}
name="enName"
onChange={formik.handleChange}
placeholder="與你的身份證明文件相同"
placeholder=""
fullWidth
error={Boolean(formik.touched.enName && formik.errors.enName)}
onBlur={formik.handleBlur}


+ 45
- 31
src/pages/authentication/auth-forms/CustomFormWizard.js Visa fil

@@ -76,7 +76,7 @@ const CustomFormWizard = (props) => {
const [termsAndConNotAccept, setTermsAndConNotAccept] = useState(false);
const [isValid, setisValid] = useState(false);
const [isLoading, setLoding] = useState(true);
const idDocTypeComboList = ComboData.idDocType;
const address4ComboList = ComboData.district;
const address5ComboList = ComboData.country;
@@ -135,22 +135,43 @@ const CustomFormWizard = (props) => {
};

const handleFileUpload = (event)=>{
let list = new DataTransfer();
let currentFileList = fileListData;
const uploadFileList = event.target.files;
const saveFileList = [];
var currentIndex = 0;

if (!fileList.length==null){
currentIndex = fileList.length;
if (currentFileList.length!=null){
currentIndex = currentFileList.length;
for (let i = 0; i < currentIndex; i++){
const file = currentFileList[i]
list.items.add(file);
saveFileList.push(file);
}
}

for (let i = 0; i < uploadFileList.length; i++){
const file = event.target.files[i]
file.id = currentIndex+i+1
saveFileList.push(file)
let isDuplicate = false;
// Check if the file name already exists in saveFileList
for (let j = 0; j < saveFileList.length; j++) {
if (saveFileList[j].name === file.name) {
isDuplicate = true;
break;
}
}

if (!isDuplicate) {
file.id = currentIndex+i
saveFileList.push(file)
list.items.add(file);
}
}
let myFileList = list.files;

setFileListData(saveFileList)
setFileList(uploadFileList);
setFileList(myFileList);
};

useEffect(() => {
@@ -311,7 +332,7 @@ const CustomFormWizard = (props) => {
submit: null,
fax:'',
faxCountryCode:'852',
idDocType:selectedIdDocType
idDocType:''
}),
validationSchema:yup.object().shape({
username: yup.string().min(6,'用戶名稱最少6位').required('請輸入用戶名稱'),
@@ -536,13 +557,18 @@ const CustomFormWizard = (props) => {
<Autocomplete
disablePortal
id="idDocType"
value={selectedIdDocType}
// value={selectedIdDocType}
options={idDocTypeComboList}
getOptionLabel={(idDocTypeComboList) => idDocTypeComboList.label}
onBlur={formik.handleBlur}
onChange={(event, newValue) => {
setSelectedIdDocType(newValue);
if (newValue!="HKID"){
formik.setFieldValue("checkDigit","")
// console.log(newValue)
if (newValue!=null){
setSelectedIdDocType(newValue.type);
if (newValue.type!="HKID"){
formik.setFieldValue("checkDigit","")
}

}
}}
sx={{"& .MuiInputBase-root": { height: "41px" },"#idDocType":{padding: "0px 0px 0px 0px"}, "& .MuiAutocomplete-endAdornment": { top: "auto" },}}
@@ -1068,8 +1094,8 @@ const CustomFormWizard = (props) => {
</FormGroup>
{/* Preview Form */}
<FormGroup id={"previewForm"} sx={{ display: props.step === 1 ? "" : "none"}}>
<Grid container spacing={2}>
<Grid item xs={12}>
<Grid container spacing={3}>
<Grid item xs={12} md={12}>
<Stack direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
<div style={{borderBottom: "3px solid #1A4399", width:"100%", margin_right: "15px"}}>
<Typography display="inline" variant="h3" sx={{ color: '#1A4399'}}>成為新的個人用戶</Typography>
@@ -1081,10 +1107,10 @@ const CustomFormWizard = (props) => {
</Typography> */}
</Stack>
</Grid>
<Grid item xs={12}>
<Grid container spacing={1}>
<Grid item xs={12} md={12}>
<Grid container spacing={2}>
<Grid item xs={12} >
<Stack spacing={1} direction="row">
<Stack spacing={2} direction="row">
<Typography>
用戶登入名稱:
</Typography>
@@ -1217,19 +1243,7 @@ const CustomFormWizard = (props) => {
</Stack>
</Grid>
:null}
{/* <Grid item xs={12} mt={1} mb={1}>
<Stack spacing={1} direction="column" justifyContent="space-between" alignItems="baseline" sx={{ mb: { xs: -0.5, sm: 0.5 } }}>
<Typography display="inline" variant="h4" sx={{ color: 'primary.primary'}}>身份證明文件</Typography>
<Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>請上傳你的 有效身份證明文件 的數碼檔案,以驗證你的身份。</Typography>
<Typography display="inline" variant="h6" sx={{ fontSize: 12,color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography>
<Stack mt={1} direction="row" justifyContent="flex-start" alignItems="center" spacing={2}>
<Button variant="contained" component="label" sx={{ fontSize: 12,height:'25px'}}>上傳身份證明文件
<input type="file" accept=".csv" hidden />
</Button>
<Typography display="inline" variant="h6" sx={{ fontSize: 12, color: 'primary.primary'}}>如: 香港身份證; 護照; 中國內地身份證等</Typography>
</Stack>
</Stack>
</Grid> */}

</Grid>
</Grid>
</Grid>


+ 1
- 1
src/pages/authentication/auth-forms/UploadFileTable.js Visa fil

@@ -78,7 +78,7 @@ export default function UploadFileTable({recordList}) {
// },
// }}
// pageSizeOptions={[5, 10]}
autoHeight
autoHeight = {true}
/>
</Box>
);


+ 1
- 1
src/pages/extra-pages/LoadingComponent.js Visa fil

@@ -7,7 +7,7 @@ const LoadingComponent = () => {
display="flex"
justifyContent="center"
alignItems="center"
autoHeight="true"
autoHeight={true}
>
<CircularProgress />
</Box>


+ 1
- 1
src/pages/pnspsUserDetailPage/UserAuthTable.js Visa fil

@@ -73,7 +73,7 @@ export default function UserAuthTable({setSelectedRow, userAuth}) {
setSelectedRow(ids);
setCurrentSelectedRow(ids);
}}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 1
- 1
src/pages/pnspsUserDetailPage/UserGroupTable.js Visa fil

@@ -69,7 +69,7 @@ export default function UserGroupTable({setSelectedRow, userGroup}) {
setSelectedRow(ids);
setCurrentSelectedRow(ids);
}}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 1
- 1
src/pages/pnspsUserGroupDetailPage/GroupAuthTable.js Visa fil

@@ -73,7 +73,7 @@ export default function GroupAuthTable({setSelectedRow, userAuth}) {
setSelectedRow(ids);
setCurrentSelectedRow(ids);
}}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 1
- 0
src/pages/pnspsUserGroupDetailPage/UserAddCard.js Visa fil

@@ -100,6 +100,7 @@ const UserAddCard = ({isCollectData, updateGroupMember,userGroupData}) => {
value={selectedUser === null ? null : selectedUser}
options={userComboList}
onChange={(event, newValue) => {
console.log(newValue)
setSelectedUser(newValue);
}}
renderInput={(params) => <TextField {...params} />}


+ 1
- 1
src/pages/pnspsUserGroupSearchPage/UserGroupTable.js Visa fil

@@ -68,7 +68,7 @@ export default function UserGroupTable({recordList}) {
},
}}
pageSizeOptions={[10, 15, 20]}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 1
- 1
src/pages/pnspsUserSearchPage/UserTable.js Visa fil

@@ -140,7 +140,7 @@ export default function UserTable({recordList}) {
},
}}
pageSizeOptions={[5, 10]}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 1
- 1
src/pages/pnspsUserSearchPage_Individual/UserTable_Individual.js Visa fil

@@ -145,7 +145,7 @@ export default function UserTable_Individual({recordList}) {
},
}}
pageSizeOptions={[5, 10]}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 1
- 1
src/pages/pnspsUserSearchPage_Organization/UserTable_Organization.js Visa fil

@@ -145,7 +145,7 @@ export default function UserTable_Organization({recordList}) {
},
}}
pageSizeOptions={[5, 10]}
autoHeight
autoHeight = {true}
/>
</div>
);


+ 8
- 3
src/utils/ComboData.js Visa fil

@@ -1,7 +1,12 @@

export const idDocType = ["passport","HKID","CNID","BR","otherCert"];
export const idDocType = [
{label:"護照", type:"passport"},
{label:"香港身份證", type:"HKID"},
{label:"內地身份證", type:"CNID"},
{label:"專業執業證書", type:"otherCert"}
];
export const district = ["北區","長洲區","大埔區","大嶼山區","東區","觀塘區","黃大仙區","九龍城區","葵青區","南區","南丫島區",
"坪洲區","荃灣區","沙田區","深水埗區","屯門區","灣仔區","西貢區","油尖旺區","元朗區","中西區"];
export const country = ["中國香港","中國","中國澳門"];

export const accountFilter = [{display:"Active", value:"active"},{display:"Locked", value:"locked"},{display:"Not verified", value:"notVerified"}];
export const accountFilter = [{id:1,label:"Active", key:"active"},{id:2,label:"Locked", key:"locked"},{id:3,label:"Not verified", key:"notVerified"}];

Laddar…
Avbryt
Spara