feat(localization): Add en/vi language
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { updateTripState } from '@/services/controller/TripController';
|
||||
import { useModel } from '@umijs/max';
|
||||
import { useIntl, useModel } from '@umijs/max';
|
||||
import { Button, message, Popconfirm } from 'antd';
|
||||
import React from 'react';
|
||||
import CancelTrip from './CancelTrip';
|
||||
@@ -14,15 +14,20 @@ const TripCancleOrFinishedButton: React.FC<TripCancleOrFinishedButtonProps> = ({
|
||||
onCallBack,
|
||||
}) => {
|
||||
const { getApi } = useModel('getTrip');
|
||||
const intl = useIntl();
|
||||
const handleClickButton = async (state: number, note?: string) => {
|
||||
try {
|
||||
const resp = await updateTripState({ status: state, note: note || '' });
|
||||
message.success('Cập nhật trạng thái thành công');
|
||||
await updateTripState({ status: state, note: note || '' });
|
||||
message.success(
|
||||
intl.formatMessage({ id: 'trip.finishButton.updateSuccess' }),
|
||||
);
|
||||
getApi();
|
||||
onCallBack?.(true);
|
||||
} catch (error) {
|
||||
console.error('Error updating trip status:', error);
|
||||
message.error('Cập nhật trạng thái thất bại');
|
||||
message.error(
|
||||
intl.formatMessage({ id: 'trip.finishButton.updateError' }),
|
||||
);
|
||||
onCallBack?.(false);
|
||||
}
|
||||
};
|
||||
@@ -37,14 +42,22 @@ const TripCancleOrFinishedButton: React.FC<TripCancleOrFinishedButtonProps> = ({
|
||||
}}
|
||||
/>
|
||||
<Popconfirm
|
||||
title="Thông báo"
|
||||
description="Bạn chắc chắn muốn kết thúc chuyến đi?"
|
||||
title={intl.formatMessage({
|
||||
id: 'trip.finishButton.confirmTitle',
|
||||
})}
|
||||
description={intl.formatMessage({
|
||||
id: 'trip.finishButton.confirmMessage',
|
||||
})}
|
||||
onConfirm={async () => handleClickButton(4)}
|
||||
okText="Chắc chắn"
|
||||
cancelText="Không"
|
||||
okText={intl.formatMessage({
|
||||
id: 'trip.finishButton.confirmYes',
|
||||
})}
|
||||
cancelText={intl.formatMessage({
|
||||
id: 'trip.finishButton.confirmNo',
|
||||
})}
|
||||
>
|
||||
<Button color="orange" variant="solid">
|
||||
Kết thúc
|
||||
{intl.formatMessage({ id: 'trip.finishButton.end' })}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user