Use GMT+8 for report date

This commit is contained in:
Viet Anh Nguyen 2024-02-07 10:37:41 +07:00
parent 10baecb337
commit b5de5d768e
5 changed files with 24 additions and 8 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?", "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", "Back to Dashboard": "Back to Dashboard",
"Create New Report": "Create New Report", "Create New Report": "Create New Report",
"Dashboard": "Dashboard", "Dashboard": "Dashboard",
"Date": "Date", "Date": "Date",
"Download": "Download",
"Download Report": "Download Report", "Download Report": "Download Report",
"Duration": "Duration",
"Email format is not correct": "Email format is not correct", "Email format is not correct": "Email format is not correct",
"English": "English", "English": "English",
"Go to Reports": "Go to Reports",
"Inference": "Inference", "Inference": "Inference",
"Language": "Language", "Language": "Language",
"Login": "Login", "Login": "Login",
@ -23,7 +27,7 @@
"Please enter a valid domain": "Please enter a valid domain", "Please enter a valid domain": "Please enter a valid domain",
"Please specify a password": "Please specify a password", "Please specify a password": "Please specify a password",
"Please specify a username": "Please specify a username", "Please specify a username": "Please specify a username",
"Report {0}...": "Report {0}...", "Report Details": "Report Details",
"Reports": "Reports", "Reports": "Reports",
"Retry": "Retry", "Retry": "Retry",
"Service temporarily unavailable.": "Service temporarily unavailable.", "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_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_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", "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", "User log in successfully": "User log in successfully",
"Username": "Username", "Username": "Username",
"Username must not have more than {MAX_USERNAME_LENGTH} characters": "Username must not have more than {MAX_USERNAME_LENGTH} characters", "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?", "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": "", "Back to Dashboard": "",
"Create New Report": "", "Create New Report": "",
"Dashboard": "", "Dashboard": "",
"Date": "", "Date": "",
"Download": "",
"Download Report": "", "Download Report": "",
"Duration": "",
"Email format is not correct": "Định dạng email không hợp lệ", "Email format is not correct": "Định dạng email không hợp lệ",
"English": "Tiếng Anh", "English": "Tiếng Anh",
"Go to Reports": "",
"Inference": "", "Inference": "",
"Language": "Ngôn ngữ", "Language": "Ngôn ngữ",
"Login": "Đăng nhập", "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 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 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", "Please specify a username": "Vui lòng nhập một tên tài khoản",
"Report {0}...": "", "Report Details": "",
"Reports": "", "Reports": "",
"Retry": "Thử lại", "Retry": "Thử lại",
"Service temporarily unavailable.": "Dịch vụ máy chủ hiện tại không sẵn sàng.", "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_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_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ự", "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", "User log in successfully": "Đăng nhập thành công",
"Username": "Tên tài khoản", "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ự", "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) => { .then((values) => {
makeReportMutation makeReportMutation
.mutateAsync({ .mutateAsync({
end_date: values.dateRange[1].format('YYYY-MM-DDTHH:mm:ssZ'), end_date: values.dateRange[1].format('YYYY-MM-DD'),
start_date: values.dateRange[0].format('YYYY-MM-DDTHH:mm:ssZ'), start_date: values.dateRange[0].format('YYYY-MM-DD'),
subsidiary: values.subsidiary, subsidiary: values.subsidiary,
}) })
.then((data) => { .then((data) => {
@ -77,16 +77,23 @@ const ReportsPage = () => {
}} }}
onCancel={handleCancel} onCancel={handleCancel}
> >
<Form form={form}> <Form form={form}
style={{
marginTop: 30,
}}
>
<Form.Item <Form.Item
name='dateRange' name='dateRange'
label={t`Date`} label={t`Date (GMT+8)`}
rules={[ rules={[
{ {
required: true, required: true,
message: 'Please select a date range', message: 'Please select a date range',
}, },
]} ]}
style={{
marginBottom: 10,
}}
> >
<DatePicker.RangePicker /> <DatePicker.RangePicker />
</Form.Item> </Form.Item>

View File

@ -34,7 +34,7 @@ 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 } = params;
try { try {
const response = await API.get<MakeReportResponse>(`/ctel/make_report/`, { const response = await API.post<MakeReportResponse>(`/ctel/make_report/`, {
params: { params: {
start_date: start_date, start_date: start_date,
end_date: end_date, end_date: end_date,

View File

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