Merge pull request #71 from SDSRV-IDP/dev/20240308

Fix: #60 FE
This commit is contained in:
Nguyen Viet Anh 2024-03-07 10:39:55 +07:00 committed by GitHub Enterprise
commit b10d10edcb
4 changed files with 37 additions and 9 deletions

View File

@ -65,6 +65,7 @@ export interface MakeReportParams {
start_date: string; start_date: string;
end_date: string; end_date: string;
subsidiary: string; subsidiary: string;
report_type: string;
} }
export type CustomUseMutationOptions< export type CustomUseMutationOptions<

View File

@ -10,6 +10,7 @@ import { useState } from 'react';
export interface ReportFormValues { export interface ReportFormValues {
dateRange: [Dayjs, Dayjs]; dateRange: [Dayjs, Dayjs];
subsidiary: string; subsidiary: string;
reportType: string;
} }
const ReportsPage = () => { const ReportsPage = () => {
@ -30,6 +31,7 @@ const ReportsPage = () => {
end_date: values.dateRange[1].format('YYYY-MM-DD'), end_date: values.dateRange[1].format('YYYY-MM-DD'),
start_date: values.dateRange[0].format('YYYY-MM-DD'), start_date: values.dateRange[0].format('YYYY-MM-DD'),
subsidiary: values.subsidiary, subsidiary: values.subsidiary,
report_type: values.reportType,
}) })
.then((data) => { .then((data) => {
if (!!data && data?.report_id) { if (!!data && data?.report_id) {
@ -51,6 +53,8 @@ const ReportsPage = () => {
setIsModalOpen(false); setIsModalOpen(false);
}; };
form.setFieldsValue({reportType: "accuracy"})
return ( return (
<> <>
<SbtPageHeader <SbtPageHeader
@ -122,6 +126,28 @@ const ReportsPage = () => {
]} ]}
/> />
</Form.Item> </Form.Item>
<Form.Item
name='reportType'
label={t`Report Type`}
rules={[
{
required: true,
message: 'Please select a type',
},
]}
>
<Select
placeholder='Select a report type'
style={{ width: 200 }}
options={[
{ value: 'billing', label: 'billing' },
{ value: 'accuracy', label: 'accuracy' },
]}
// defaultValue='accuracy'
/>
</Form.Item>
</Form> </Form>
</Modal> </Modal>
</> </>

View File

@ -32,12 +32,13 @@ export async function getReportDetailList(params: ReportDetailListParams) {
} }
export async function makeReport(params: MakeReportParams) { export async function makeReport(params: MakeReportParams) {
const { end_date, start_date, subsidiary } = params; const { end_date, start_date, subsidiary, report_type } = params;
try { try {
const response = await API.post<MakeReportResponse>(`/ctel/make_report/`, { const response = await API.post<MakeReportResponse>(`/ctel/make_report/`, {
start_date: start_date, start_date: start_date,
end_date: end_date, end_date: end_date,
subsidiary: subsidiary, subsidiary: subsidiary,
report_type: report_type,
}); });
return response.data; return response.data;
} catch (error) { } catch (error) {

View File

@ -89,12 +89,12 @@ services:
depends_on: depends_on:
db-sbt: db-sbt:
condition: service_started condition: service_started
# command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input && command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input &&
# python manage.py makemigrations && python manage.py makemigrations &&
# python manage.py migrate && python manage.py migrate &&
# python manage.py compilemessages && python manage.py compilemessages &&
# gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod gunicorn fwd.asgi:application -k uvicorn.workers.UvicornWorker --timeout 300 -b 0.0.0.0:9000" # pre-makemigrations on prod
command: bash -c "tail -f > /dev/null" # command: bash -c "tail -f > /dev/null"
minio: minio:
image: minio/minio image: minio/minio
@ -179,8 +179,8 @@ services:
- ./cope2n-api:/app - ./cope2n-api:/app
working_dir: /app working_dir: /app
# command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5" command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5"
command: bash -c "tail -f > /dev/null" # command: bash -c "tail -f > /dev/null"
# Back-end persistent # Back-end persistent
db-sbt: db-sbt: