feat: add query condition
This commit is contained in:
parent
3f7d5dad92
commit
1f16e05c01
@ -118,7 +118,7 @@ export const BillList: React.FC<BillListProps> = (props) => {
|
||||
title: t('bill.title_year'),
|
||||
dataIndex: 'intake_year',
|
||||
width: 120,
|
||||
render: (_, record) => (<div>{record.intake_year}/{record.intake_semester}</div>)
|
||||
render: (_, record) => (<div>{record.intake_year}/{String(record.intake_semester).length == 1 ? '0':''}{record.intake_semester}</div>)
|
||||
},
|
||||
// {
|
||||
// title: t('bill.title_semester'),
|
||||
@ -134,6 +134,15 @@ export const BillList: React.FC<BillListProps> = (props) => {
|
||||
{record.details.map((it, idx) => (<div key={idx}>{it.bill_type}: <MoneyFormat money={it.amount}/></div>))}
|
||||
</div>),
|
||||
},
|
||||
{
|
||||
title: t('bill.title_bill_type_confirm'),
|
||||
dataIndex: '_detail',
|
||||
ellipsis: {showTitle: true},
|
||||
width: 220,
|
||||
render: (_, record) => (<div style={{fontSize: 13, lineHeight: 1.2}}>
|
||||
{record.details.filter(s=>s.confirm_status == 'CONFIRMED').map((it) => (<div key={it.id}>{it.confirm_type}: <MoneyFormat money={it.amount}/></div>))}
|
||||
</div>),
|
||||
},
|
||||
{
|
||||
title: t('bill.title_amount'),
|
||||
dataIndex: 'amount',
|
||||
@ -169,10 +178,12 @@ export const BillList: React.FC<BillListProps> = (props) => {
|
||||
width: 130,
|
||||
render: (_, {payment_method, payment_channel}) => (payment_channel?(
|
||||
<div>
|
||||
{payment_channel}<br/>
|
||||
<Typography.Text type={'quaternary'} size={'small'} style={{position: "absolute"}}>
|
||||
({payment_method})
|
||||
</Typography.Text>
|
||||
{payment_channel}
|
||||
{payment_method && payment_method.length > 0 && <div>
|
||||
<Typography.Text type={'quaternary'} size={'small'} style={{position: "absolute"}}>
|
||||
({payment_method})
|
||||
</Typography.Text>
|
||||
</div>}
|
||||
</div>
|
||||
):'N/A'),
|
||||
},
|
||||
|
@ -15,6 +15,7 @@ type SearchFormProps = {
|
||||
type SearchFormFields = {
|
||||
dateRange?: Date[];
|
||||
student_number?: string;
|
||||
merchant_ref?: string;
|
||||
id?: string;
|
||||
application_number?: string;
|
||||
bill_number?: string;
|
||||
@ -34,6 +35,9 @@ const SearchForm: React.FC<SearchFormProps> = (props) => {
|
||||
if (value.id) {
|
||||
params.id = value.id;
|
||||
}
|
||||
if (value.merchant_ref) {
|
||||
params.merchant_ref = value.merchant_ref;
|
||||
}
|
||||
if (value.student_number) {
|
||||
params.student_number = value.student_number;
|
||||
}
|
||||
@ -86,32 +90,27 @@ const SearchForm: React.FC<SearchFormProps> = (props) => {
|
||||
{props.searchHeader}
|
||||
<div className="bill-search-form">
|
||||
<Form<SearchFormFields> onSubmit={formSubmit}>
|
||||
<Row type={'flex'} gutter={20}>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Row type={'flex'} gutter={16}>
|
||||
<Col xxl={3} xl={6} md={8}>
|
||||
<Form.Input showClear field='id' label="ID" trigger='blur' placeholder={t('base.please_enter')}/>
|
||||
</Col>
|
||||
<Col xxl={3} xl={6} md={8}>
|
||||
<Form.Input showClear field='merchant_ref' label="Merchant Ref" trigger='blur' placeholder={t('base.please_enter')}/>
|
||||
</Col>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Form.DatePicker showClear type={'dateRange'} field="dateRange" label={t('bill.bill_date')}
|
||||
style={{width: '100%'}}>
|
||||
</Form.DatePicker>
|
||||
</Col>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Col xxl={4} xl={6} md={8}>
|
||||
<Form.Input showClear field='student_number' label={t('base.student_number')} trigger='blur'
|
||||
placeholder={t('base.please_enter')}/>
|
||||
</Col>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Col xxl={4} xl={6} md={8}>
|
||||
<Form.Input showClear field='application_number' label={t('base.bill_number')} trigger='blur'
|
||||
placeholder={t('base.please_enter')}/>
|
||||
</Col>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Form.Select showClear field="payment_channel" label={t('bill.title_pay_channel')}
|
||||
placeholder={t('base.please_select')} style={{width: '100%'}}>
|
||||
<Form.Select.Option value="FLYWIRE">FLYWIRE</Form.Select.Option>
|
||||
<Form.Select.Option value="CBP">CBP</Form.Select.Option>
|
||||
<Form.Select.Option value="PPS">PPS</Form.Select.Option>
|
||||
</Form.Select>
|
||||
</Col>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Col xxl={4} xl={6} md={8}>
|
||||
<Form.Select showClear field="sort_by" label={t('bill.title_pay_sort')}
|
||||
placeholder={t('base.please_select')} style={{width: '100%'}}>
|
||||
<Form.Select.Option value="id desc">ID {t('bill.sort_desc')}</Form.Select.Option>
|
||||
@ -127,6 +126,22 @@ const SearchForm: React.FC<SearchFormProps> = (props) => {
|
||||
<Form.Select.Option value="create_at asc">{t('bill.title_create_at')} {t('bill.sort_asc')}</Form.Select.Option>
|
||||
</Form.Select>
|
||||
</Col>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Form.Select showClear field="payment_channel" label={t('bill.title_pay_channel')}
|
||||
placeholder={t('base.please_select')} style={{width: '100%'}}>
|
||||
<Form.Select.Option value="FLYWIRE">FLYWIRE</Form.Select.Option>
|
||||
<Form.Select.Option value="CBP">CBP</Form.Select.Option>
|
||||
<Form.Select.Option value="PPS">PPS</Form.Select.Option>
|
||||
</Form.Select>
|
||||
</Col>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Form.Select showClear field="bill_type" label={t('bill.title_bill_type')}
|
||||
placeholder={t('base.please_select')} style={{width: '100%'}}>
|
||||
<Form.Select.Option value="FLYWIRE">FLYWIRE</Form.Select.Option>
|
||||
<Form.Select.Option value="CBP">CBP</Form.Select.Option>
|
||||
<Form.Select.Option value="PPS">PPS</Form.Select.Option>
|
||||
</Form.Select>
|
||||
</Col>
|
||||
{props.showApply && <>
|
||||
<Col xxl={6} xl={6} md={8}>
|
||||
<Form.Select showClear field="bill_status" label={t('bill.pay_status')}
|
||||
|
@ -51,6 +51,8 @@
|
||||
"title_bill_detail": "Bill Detail",
|
||||
"title_bill_list": "Bill List",
|
||||
"title_bill_status": "Bill Status",
|
||||
"title_bill_type": "Bill Type",
|
||||
"title_bill_type_confirm": "Confirm Bill Type",
|
||||
"title_create_at": "Input Date",
|
||||
"title_department": "Department",
|
||||
"title_operate": "Operation",
|
||||
|
@ -51,6 +51,8 @@
|
||||
"title_bill_detail": "账单详情",
|
||||
"title_bill_list": "账单列表",
|
||||
"title_bill_status": "账单状态",
|
||||
"title_bill_type": "账单类型",
|
||||
"title_bill_type_confirm": "确认账单",
|
||||
"title_create_at": "创建时间",
|
||||
"title_department": "学系",
|
||||
"title_operate": "操作",
|
||||
|
@ -51,6 +51,8 @@
|
||||
"title_bill_detail": "帳單詳情",
|
||||
"title_bill_list": "帳單清單",
|
||||
"title_bill_status": "帳單狀態",
|
||||
"title_bill_type": "帳單類型",
|
||||
"title_bill_type_confirm": "確認帳單",
|
||||
"title_create_at": "創建時間",
|
||||
"title_department": "學系",
|
||||
"title_operate": "操作",
|
||||
|
@ -63,6 +63,13 @@ const ExternalCreate = () => {
|
||||
if (!params.details || params.details.length == 0) {
|
||||
return setState({error: 'params error: require detail',loading: false})
|
||||
}
|
||||
let tempAmount = 0;
|
||||
params.details.forEach((d:BillDetail) => {
|
||||
tempAmount += Number(d.amount)
|
||||
})
|
||||
if(tempAmount != Number(params.amount)){
|
||||
return setState({error: 'params error: amount not equal to detail amount',loading: false})
|
||||
}
|
||||
createBill(params)
|
||||
return;
|
||||
}
|
||||
|
@ -26,16 +26,18 @@ export function GeneratePdf(bill: BillModel) {
|
||||
doc.text('ACKNOWLEDGEMENT RECEIPT', 100, 20, {});
|
||||
|
||||
doc.setFont('Helvetica', 'normal', 'normal');
|
||||
drawItem(doc, {title: 'Student Name:', content: bill.student_english_name || bill.student_chinese_name}, 40)
|
||||
drawItem(doc, {title: 'Student Name:', content: bill.student_english_name || bill.student_chinese_name || 'N/A'}, 40)
|
||||
drawItem(doc, {title: 'Reference Number:', content: `${bill.id}`}, 40, "right")
|
||||
drawItem(doc, {title: 'Student Number:', content: `${bill.student_number || bill.application_number}`}, 48)
|
||||
drawItem(doc, {title: `${bill.student_number?"Student":"Bill"} Number:`, content: `${bill.student_number || bill.application_number}`}, 48)
|
||||
drawItem(doc, {title: 'Print Date:', content: dayjs().format('YYYY-MM-DD')}, 48, "right")
|
||||
|
||||
drawItem(doc, {
|
||||
title: 'Programme:',
|
||||
content: bill.programme_english_name
|
||||
content: bill.programme_english_name || 'N/A'
|
||||
}, 56)
|
||||
drawItem(doc, {title: 'Mode of Study:', content: bill.attendance_mode == 'FT' ? 'FULL-TIME': bill.attendance_mode}, bill.programme_english_name.length > 70?70:64)
|
||||
if(bill.programme_english_name && bill.programme_english_name.length > 0){
|
||||
drawItem(doc, {title: 'Mode of Study:', content: bill.attendance_mode == 'FT' ? 'FULL-TIME': bill.attendance_mode}, bill.programme_english_name.length > 70?70:64)
|
||||
}
|
||||
// draw table
|
||||
autoTable(doc, {
|
||||
startY: 80,
|
||||
@ -61,7 +63,7 @@ export function GeneratePdf(bill: BillModel) {
|
||||
`#${it.id}`,
|
||||
dayjs(bill.paid_at).format('YYYY-MM-DD'),
|
||||
it.bill_type,
|
||||
`${bill.payment_channel}` + (bill.payment_channel != bill.payment_method ? `(${bill.payment_method})` : ''),
|
||||
`${bill.payment_channel}` + (bill.payment_method && bill.payment_channel != bill.payment_method ? `(${bill.payment_method})` : ''),
|
||||
`${it.amount}`
|
||||
];
|
||||
})),
|
||||
|
6
src/types/bill.d.ts
vendored
6
src/types/bill.d.ts
vendored
@ -14,6 +14,7 @@ declare type BillDetail = {
|
||||
id: number;
|
||||
bill_type: string;
|
||||
confirm_status: ConfirmStatus;
|
||||
confirm_type: string;
|
||||
amount: decimal;
|
||||
}
|
||||
/**
|
||||
@ -25,6 +26,8 @@ declare type BillQueryParam = {
|
||||
status:string;
|
||||
apply_status:string;
|
||||
id:string|number;
|
||||
merchant_ref:string;
|
||||
bill_type:string;
|
||||
student_number:string;
|
||||
application_number:string;
|
||||
payment_channel:string;
|
||||
@ -93,7 +96,8 @@ declare type AsiaPayModel = {
|
||||
}
|
||||
|
||||
type ExternalCreateParamsType = {
|
||||
[key: string]: string | null | BillDetail[];
|
||||
details: BillDetail[];
|
||||
[key: string]: string | null;
|
||||
}
|
||||
|
||||
type BillUpdateParams = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user