@@ -58,7 +58,7 @@ const OrganizationCard = ({ userData, loadDataFun, id, setEditModeFun }) => { | |||||
faxNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).nullable(), | faxNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).nullable(), | ||||
brExpiryDate: yup.string().min(8).required(displayErrorMsg('請輸入商業登記證有效日期')), | brExpiryDate: yup.string().min(8).required(displayErrorMsg('請輸入商業登記證有效日期')), | ||||
brNo: yup.string().required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(displayErrorMsg(`請輸入有效商業登記證號碼`)), function (value) { | brNo: yup.string().required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(displayErrorMsg(`請輸入有效商業登記證號碼`)), function (value) { | ||||
var brNo_pattern = /[0-9]{8}-[0-9]{3}-(0[1-9]|1[012])-[0-9]{2}-[0-9A-Z]{1}/ | |||||
var brNo_pattern = /[0-9]{8}/ | |||||
if (value !== undefined) { | if (value !== undefined) { | ||||
if (value.match(brNo_pattern)) { | if (value.match(brNo_pattern)) { | ||||
return true | return true | ||||
@@ -55,10 +55,10 @@ const OrganizationCard_loadFromUser = ({ userData, userId }) => { | |||||
phoneNumber: yup.string().min(8, displayErrorMsg('請輸入有效聯絡電話')).required(displayErrorMsg('請輸入聯絡電話')), | phoneNumber: yup.string().min(8, displayErrorMsg('請輸入有效聯絡電話')).required(displayErrorMsg('請輸入聯絡電話')), | ||||
faxNumber: yup.string().min(8).nullable(), | faxNumber: yup.string().min(8).nullable(), | ||||
brExpiryDate: yup.string().min(8).required(displayErrorMsg('請輸入商業登記證有效日期')), | brExpiryDate: yup.string().min(8).required(displayErrorMsg('請輸入商業登記證有效日期')), | ||||
brNo: yup.string().required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(displayErrorMsg(`請輸入有效商業登記證號碼 (e.g. 12341234-123-12-12-1)`)), function (value) { | |||||
var brNo_pattern = /[0-9]{8}-[0-9]{3}-(0[1-9]|1[012])-[0-9]{2}-[0-9A-Z]{1}/ | |||||
brNo: yup.string().max(8).required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(displayErrorMsg(`請輸入有效商業登記證號碼 (e.g. 12341234)`)), function (value) { | |||||
var brNo_pattern = /[0-9]{8}/ | |||||
if (value !== undefined) { | if (value !== undefined) { | ||||
if (value.match(brNo_pattern)) { | |||||
if (value.size==8 && value.match(brNo_pattern)) { | |||||
return true | return true | ||||
} else { | } else { | ||||
return false | return false | ||||
@@ -4,23 +4,24 @@ import { | |||||
CardContent, | CardContent, | ||||
Grid, TextField, | Grid, TextField, | ||||
Typography, | Typography, | ||||
Checkbox, FormControlLabel, | |||||
Autocomplete, | |||||
} from '@mui/material'; | } from '@mui/material'; | ||||
import MainCard from "../../../components/MainCard"; | |||||
import MainCard from "components/MainCard"; | |||||
import { useForm } from "react-hook-form"; | import { useForm } from "react-hook-form"; | ||||
import { useState } from "react"; | import { useState } from "react"; | ||||
import * as React from "react"; | import * as React from "react"; | ||||
import * as UrlUtils from "../../../utils/ApiPathConst"; | |||||
import * as HttpUtils from "../../../utils/HttpUtils"; | |||||
import * as UrlUtils from "utils/ApiPathConst"; | |||||
import * as HttpUtils from "utils/HttpUtils"; | |||||
import * as ComboData from "utils/ComboData"; | |||||
// ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
const OrganizationSearchForm = ({ applySearch }) => { | const OrganizationSearchForm = ({ applySearch }) => { | ||||
const [type, setType] = useState([]); | const [type, setType] = useState([]); | ||||
const [creditorSelected, setCreditorSelected] = React.useState({ key: 0, labelCht: '全部', label: 'All', type: 'all' }); | |||||
const { reset, register, handleSubmit } = useForm() | const { reset, register, handleSubmit } = useForm() | ||||
const onSubmit = (data) => { | const onSubmit = (data) => { | ||||
@@ -34,8 +35,12 @@ const OrganizationSearchForm = ({ applySearch }) => { | |||||
brNo: data.brNo, | brNo: data.brNo, | ||||
enCompanyName: data.enCompanyName, | enCompanyName: data.enCompanyName, | ||||
chCompanyName: data.chCompanyName, | chCompanyName: data.chCompanyName, | ||||
searchCreditor: data.searchCreditor | |||||
}; | }; | ||||
if(creditorSelected.type == 'true'){ | |||||
temp["creditor"] = true; | |||||
}else if(creditorSelected.type == 'false'){ | |||||
temp["creditor"] = false; | |||||
} | |||||
applySearch(temp); | applySearch(temp); | ||||
}; | }; | ||||
@@ -102,12 +107,26 @@ const OrganizationSearchForm = ({ applySearch }) => { | |||||
</Grid> | </Grid> | ||||
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3}}> | <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3}}> | ||||
<FormControlLabel | |||||
{...register("searchCreditor")} | |||||
control={<Checkbox/>} | |||||
label="Search Creditor Only" | |||||
id="searchCreditor" | |||||
/> | |||||
<Autocomplete | |||||
{...register("searchCreditor")} | |||||
id="searchCreditor" | |||||
size="small" | |||||
options={ComboData.CreditorStatus} | |||||
value={creditorSelected} | |||||
onChange={(event, newValue) => { | |||||
setCreditorSelected(newValue); | |||||
}} | |||||
getOptionLabel={(option) => option.label} | |||||
renderInput={(params) => ( | |||||
<TextField | |||||
{...params} | |||||
label="Status" | |||||
InputLabelProps={{ | |||||
shrink: true | |||||
}} | |||||
/> | |||||
)} | |||||
/> | |||||
</Grid> | </Grid> | ||||
</Grid> | </Grid> | ||||
@@ -148,7 +148,8 @@ const ApplicationDetailCard = ( | |||||
onClick={() => { checkExprityDate(true) }} | onClick={() => { checkExprityDate(true) }} | ||||
disabled={currentApplicationDetailData.status == "rejected" | disabled={currentApplicationDetailData.status == "rejected" | ||||
|| currentApplicationDetailData.status == "cancelled" | || currentApplicationDetailData.status == "cancelled" | ||||
|| currentApplicationDetailData.status == "paid"} | |||||
|| currentApplicationDetailData.status == "paid" | |||||
|| currentApplicationDetailData.creditor} | |||||
sx={{ | sx={{ | ||||
textTransform: 'capitalize', | textTransform: 'capitalize', | ||||
alignItems: 'end' | alignItems: 'end' | ||||
@@ -59,8 +59,8 @@ const UserInformationCard_Organization = ({ userData, loadDataFun, orgData }) => | |||||
phoneNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).required(displayErrorMsg('請輸入聯絡電話')), | phoneNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).required(displayErrorMsg('請輸入聯絡電話')), | ||||
faxNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).nullable(), | faxNumber: yup.string().min(8, displayErrorMsg('請輸入8位數字')).nullable(), | ||||
brExpiryDate: yup.string().min(8, displayErrorMsg('請輸入商業登記證有效日期')), | brExpiryDate: yup.string().min(8, displayErrorMsg('請輸入商業登記證有效日期')), | ||||
brNo: yup.string().required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(`請輸入有效商業登記證號碼 (e.g. 12341234-123-12-12-1)`), function (value) { | |||||
var brNo_pattern = /[0-9]{8}-[0-9]{3}-(0[1-9]|1[012])-[0-9]{2}-[0-9A-Z]{1}/ | |||||
brNo: yup.string().max(8).required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(`請輸入有效商業登記證號碼 (e.g. 12341234)`), function (value) { | |||||
var brNo_pattern = /[0-9]{8}/ | |||||
if (value !== undefined) { | if (value !== undefined) { | ||||
if (value.match(brNo_pattern)) { | if (value.match(brNo_pattern)) { | ||||
return true | return true | ||||
@@ -526,8 +526,9 @@ const BusCustomFormWizard = (props) => { | |||||
phone: yup.string().min(8, displayErrorMsg('請輸入最少8位數字')).required(displayErrorMsg('請輸入聯絡電話')), | phone: yup.string().min(8, displayErrorMsg('請輸入最少8位數字')).required(displayErrorMsg('請輸入聯絡電話')), | ||||
fax: yup.string().min(8, displayErrorMsg('請輸入最少8位數字')), | fax: yup.string().min(8, displayErrorMsg('請輸入最少8位數字')), | ||||
brExpiryDate: yup.date().min(new Date().toISOString().split("T")[0], displayErrorMsg('請輸入商業登記證有效日期')).max("2099-12-31", displayErrorMsg('請輸入商業登記證有效日期')).required(displayErrorMsg('請輸入商業登記證有效日期')), | brExpiryDate: yup.date().min(new Date().toISOString().split("T")[0], displayErrorMsg('請輸入商業登記證有效日期')).max("2099-12-31", displayErrorMsg('請輸入商業登記證有效日期')).required(displayErrorMsg('請輸入商業登記證有效日期')), | ||||
brNo: yup.string().required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(`請輸入有效商業登記證號碼 (e.g. 12341234-123-12-12-1)`), function (value) { | |||||
var brNo_pattern = /[0-9]{8}-[0-9]{3}-(0[1-9]|1[012])-[0-9]{2}-[0-9A-Z]{1}/ | |||||
brNo: yup.string().max(8).required(displayErrorMsg('請輸入商業登記證號碼')).test('checkBrNoFormat', displayErrorMsg(`請輸入有效商業登記證號碼 (e.g. 12341234)`), function (value) { | |||||
// var brNo_pattern = /[0-9]{8}-[0-9]{3}-(0[1-9]|1[012])-[0-9]{2}-[0-9A-Z]{1}/ | |||||
var brNo_pattern = /[0-9]{8}/ | |||||
if (value !== undefined) { | if (value !== undefined) { | ||||
if (value.match(brNo_pattern)) { | if (value.match(brNo_pattern)) { | ||||
return true | return true | ||||
@@ -834,7 +835,7 @@ const BusCustomFormWizard = (props) => { | |||||
<Stack spacing={1}> | <Stack spacing={1}> | ||||
<InputLabel htmlFor="brNo-signup" sx={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}> | <InputLabel htmlFor="brNo-signup" sx={{ whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}> | ||||
<Typography variant="pnspsFormHeader"> | <Typography variant="pnspsFormHeader"> | ||||
商業登記證號碼 (e.g. 12341234-123-12-12-1) | |||||
商業登記證號碼 (e.g. 12341234) | |||||
<span style={{ color: '#f10000' }}>*</span> | <span style={{ color: '#f10000' }}>*</span> | ||||
</Typography> | </Typography> | ||||
</InputLabel> | </InputLabel> | ||||
@@ -86,4 +86,10 @@ export const denmandNoteStatus = [ | |||||
{ key: 2, labelCht: '待支付', label:'To be Paid', type: 'to be paid' }, | { key: 2, labelCht: '待支付', label:'To be Paid', type: 'to be paid' }, | ||||
{ key: 3, labelCht: '已付費', label:'Paid', type: 'paid' }, | { key: 3, labelCht: '已付費', label:'Paid', type: 'paid' }, | ||||
]; | |||||
export const CreditorStatus = [ | |||||
{ key: 0, labelCht: '全部', label: 'All', type: 'all' }, | |||||
{ key: 1, labelCht: '債權人', label:'Creditor', type: 'true' }, | |||||
{ key: 2, labelCht: '非債權人', label:'No-Creditor', type: 'false' }, | |||||
]; | ]; |