From 1f4e1fa8744a3a049afe4fcdeee8d46289faf87d Mon Sep 17 00:00:00 2001 From: dx-tan <dx.tan@samsung.com> Date: Thu, 7 Mar 2024 09:12:44 +0700 Subject: [PATCH] Fix: #60 FE --- cope2n-fe/src/models/report.ts | 1 + cope2n-fe/src/pages/reports/index.tsx | 26 ++++++++++++++++++++++++++ cope2n-fe/src/request/report.ts | 3 ++- docker-compose-dev.yml | 16 ++++++++-------- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/cope2n-fe/src/models/report.ts b/cope2n-fe/src/models/report.ts index 23db378..58b8af2 100644 --- a/cope2n-fe/src/models/report.ts +++ b/cope2n-fe/src/models/report.ts @@ -65,6 +65,7 @@ export interface MakeReportParams { start_date: string; end_date: string; subsidiary: string; + report_type: string; } export type CustomUseMutationOptions< diff --git a/cope2n-fe/src/pages/reports/index.tsx b/cope2n-fe/src/pages/reports/index.tsx index ee53149..8418cd9 100644 --- a/cope2n-fe/src/pages/reports/index.tsx +++ b/cope2n-fe/src/pages/reports/index.tsx @@ -10,6 +10,7 @@ import { useState } from 'react'; export interface ReportFormValues { dateRange: [Dayjs, Dayjs]; subsidiary: string; + reportType: string; } const ReportsPage = () => { @@ -30,6 +31,7 @@ const ReportsPage = () => { end_date: values.dateRange[1].format('YYYY-MM-DD'), start_date: values.dateRange[0].format('YYYY-MM-DD'), subsidiary: values.subsidiary, + report_type: values.reportType, }) .then((data) => { if (!!data && data?.report_id) { @@ -51,6 +53,8 @@ const ReportsPage = () => { setIsModalOpen(false); }; + form.setFieldsValue({reportType: "accuracy"}) + return ( <> <SbtPageHeader @@ -122,6 +126,28 @@ const ReportsPage = () => { ]} /> </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> </Modal> </> diff --git a/cope2n-fe/src/request/report.ts b/cope2n-fe/src/request/report.ts index 2c1f55a..1b58042 100644 --- a/cope2n-fe/src/request/report.ts +++ b/cope2n-fe/src/request/report.ts @@ -32,12 +32,13 @@ export async function getReportDetailList(params: ReportDetailListParams) { } export async function makeReport(params: MakeReportParams) { - const { end_date, start_date, subsidiary } = params; + const { end_date, start_date, subsidiary, report_type } = params; try { const response = await API.post<MakeReportResponse>(`/ctel/make_report/`, { start_date: start_date, end_date: end_date, subsidiary: subsidiary, + report_type: report_type, }); return response.data; } catch (error) { diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 3426a9d..ffb2d60 100755 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -89,12 +89,12 @@ services: depends_on: db-sbt: condition: service_started - # command: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input && - # python manage.py makemigrations && - # python manage.py migrate && - # python manage.py compilemessages && - # 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: sh -c "chmod -R 777 /app; sleep 5; python manage.py collectstatic --no-input && + python manage.py makemigrations && + python manage.py migrate && + python manage.py compilemessages && + 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" minio: image: minio/minio @@ -179,8 +179,8 @@ services: - ./cope2n-api:/app working_dir: /app - # command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5" - command: bash -c "tail -f > /dev/null" + command: sh -c "celery -A fwd_api.celery_worker.worker worker -l INFO -c 5" + # command: bash -c "tail -f > /dev/null" # Back-end persistent db-sbt: