Merge pull request #27 from SDSRV-IDP/fix/report-time

Use GMT+8 for report date
This commit is contained in:
Đỗ Xuân Tân 2024-02-07 12:35:57 +07:00 committed by GitHub Enterprise
commit efdfbf7295
5 changed files with 27 additions and 13 deletions

View File

@ -1,12 +1,16 @@
{
"Are you sure you want to leave without saving?": "Are you sure you want to leave without saving?",
"Back": "Back",
"Back to Dashboard": "Back to Dashboard",
"Create New Report": "Create New Report",
"Dashboard": "Dashboard",
"Date": "Date",
"Download": "Download",
"Download Report": "Download Report",
"Duration": "Duration",
"Email format is not correct": "Email format is not correct",
"English": "English",
"Go to Reports": "Go to Reports",
"Inference": "Inference",
"Language": "Language",
"Login": "Login",
@ -23,7 +27,7 @@
"Please enter a valid domain": "Please enter a valid domain",
"Please specify a password": "Please specify a password",
"Please specify a username": "Please specify a username",
"Report {0}...": "Report {0}...",
"Report Details": "Report Details",
"Reports": "Reports",
"Retry": "Retry",
"Service temporarily unavailable.": "Service temporarily unavailable.",
@ -35,6 +39,7 @@
"This field must not have more than {MAX_EMAIL_LENGTH} characters": "This field must not have more than {MAX_EMAIL_LENGTH} characters",
"This field must not have more than {MAX_STRING_LENGTH} characters": "This field must not have more than {MAX_STRING_LENGTH} characters",
"This field must not have more than {MAX_USERNAME_LENGTH} characters": "This field must not have more than {MAX_USERNAME_LENGTH} characters",
"Upload files to process. The requests here will not be used in accuracy or payment calculations.": "Upload files to process. The requests here will not be used in accuracy or payment calculations.",
"User log in successfully": "User log in successfully",
"Username": "Username",
"Username must not have more than {MAX_USERNAME_LENGTH} characters": "Username must not have more than {MAX_USERNAME_LENGTH} characters",

View File

@ -1,12 +1,16 @@
{
"Are you sure you want to leave without saving?": "Bạn có chắc chắn muốn rời đi mà không lưu lại không?",
"Back": "",
"Back to Dashboard": "",
"Create New Report": "",
"Dashboard": "",
"Date": "",
"Download": "",
"Download Report": "",
"Duration": "",
"Email format is not correct": "Định dạng email không hợp lệ",
"English": "Tiếng Anh",
"Go to Reports": "",
"Inference": "",
"Language": "Ngôn ngữ",
"Login": "Đăng nhập",
@ -23,7 +27,7 @@
"Please enter a valid domain": "Vui lòng nhập một tên miền hợp lệ",
"Please specify a password": "Vui lòng nhập một mật khẩu",
"Please specify a username": "Vui lòng nhập một tên tài khoản",
"Report {0}...": "",
"Report Details": "",
"Reports": "",
"Retry": "Thử lại",
"Service temporarily unavailable.": "Dịch vụ máy chủ hiện tại không sẵn sàng.",
@ -35,6 +39,7 @@
"This field must not have more than {MAX_EMAIL_LENGTH} characters": "Độ dài chuỗi không được vượt quá {MAX_EMAIL_LENGTH} kí tự",
"This field must not have more than {MAX_STRING_LENGTH} characters": "Độ dài chuỗi không được vượt quá {MAX_STRING_LENGTH} kí tự",
"This field must not have more than {MAX_USERNAME_LENGTH} characters": "Độ dài chuỗi không được vượt quá {MAX_USERNAME_LENGTH} kí tự",
"Upload files to process. The requests here will not be used in accuracy or payment calculations.": "",
"User log in successfully": "Đăng nhập thành công",
"Username": "Tên tài khoản",
"Username must not have more than {MAX_USERNAME_LENGTH} characters": "Tên tài khoản không được chứa nhiều hơn {MAX_USERNAME_LENGTH} kí tự",

View File

@ -27,8 +27,8 @@ const ReportsPage = () => {
.then((values) => {
makeReportMutation
.mutateAsync({
end_date: values.dateRange[1].format('YYYY-MM-DDTHH:mm:ssZ'),
start_date: values.dateRange[0].format('YYYY-MM-DDTHH:mm:ssZ'),
end_date: values.dateRange[1].format('YYYY-MM-DD'),
start_date: values.dateRange[0].format('YYYY-MM-DD'),
subsidiary: values.subsidiary,
})
.then((data) => {
@ -77,16 +77,23 @@ const ReportsPage = () => {
}}
onCancel={handleCancel}
>
<Form form={form}>
<Form form={form}
style={{
marginTop: 30,
}}
>
<Form.Item
name='dateRange'
label={t`Date`}
label={t`Date (GMT+8)`}
rules={[
{
required: true,
message: 'Please select a date range',
},
]}
style={{
marginBottom: 10,
}}
>
<DatePicker.RangePicker />
</Form.Item>

View File

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

View File

@ -1,5 +1,4 @@
export const formatPercent = (value: number) => {
console.log(value)
if (value === 0) {
return '-';
}