From 53b077eb52265ef11c369e944e080524bb0df2d1 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 8 Jan 2024 16:41:23 +0800 Subject: [PATCH] fix bug --- .../SearchPage/OrganizationSearchForm.js | 43 +++++++++++++------ .../Details_Public/ApplicationDetailCard.js | 3 +- src/utils/ComboData.js | 6 +++ 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/pages/Organization/SearchPage/OrganizationSearchForm.js b/src/pages/Organization/SearchPage/OrganizationSearchForm.js index a525710..987e284 100644 --- a/src/pages/Organization/SearchPage/OrganizationSearchForm.js +++ b/src/pages/Organization/SearchPage/OrganizationSearchForm.js @@ -4,23 +4,24 @@ import { CardContent, Grid, TextField, Typography, - Checkbox, FormControlLabel, + Autocomplete, } from '@mui/material'; -import MainCard from "../../../components/MainCard"; +import MainCard from "components/MainCard"; import { useForm } from "react-hook-form"; import { useState } 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 ||============================== // const OrganizationSearchForm = ({ applySearch }) => { const [type, setType] = useState([]); - + const [creditorSelected, setCreditorSelected] = React.useState({ key: 0, labelCht: '全部', label: 'All', type: 'all' }); const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { @@ -34,8 +35,12 @@ const OrganizationSearchForm = ({ applySearch }) => { brNo: data.brNo, enCompanyName: data.enCompanyName, chCompanyName: data.chCompanyName, - searchCreditor: data.searchCreditor }; + if(creditorSelected.type == 'true'){ + temp["creditor"] = true; + }else if(creditorSelected.type == 'false'){ + temp["creditor"] = false; + } applySearch(temp); }; @@ -102,12 +107,26 @@ const OrganizationSearchForm = ({ applySearch }) => { - } - label="Search Creditor Only" - id="searchCreditor" - /> + { + setCreditorSelected(newValue); + }} + getOptionLabel={(option) => option.label} + renderInput={(params) => ( + + )} + /> diff --git a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js index ffe3012..2994b10 100644 --- a/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js +++ b/src/pages/PublicNotice/Details_Public/ApplicationDetailCard.js @@ -148,7 +148,8 @@ const ApplicationDetailCard = ( onClick={() => { checkExprityDate(true) }} disabled={currentApplicationDetailData.status == "rejected" || currentApplicationDetailData.status == "cancelled" - || currentApplicationDetailData.status == "paid"} + || currentApplicationDetailData.status == "paid" + || currentApplicationDetailData.creditor} sx={{ textTransform: 'capitalize', alignItems: 'end' diff --git a/src/utils/ComboData.js b/src/utils/ComboData.js index fd5c65e..8bf4d40 100644 --- a/src/utils/ComboData.js +++ b/src/utils/ComboData.js @@ -86,4 +86,10 @@ export const denmandNoteStatus = [ { key: 2, labelCht: '待支付', label:'To be Paid', type: 'to be 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' }, ]; \ No newline at end of file