diff --git a/hotel-management/src/constants/variables.ts b/hotel-management/src/constants/variables.ts
index 7cad09f..6287950 100644
--- a/hotel-management/src/constants/variables.ts
+++ b/hotel-management/src/constants/variables.ts
@@ -55,10 +55,6 @@ const ROOM_PAGE = {
value: 'name',
label: 'Sort by name',
},
- {
- value: 'amount',
- label: 'Sort by amount',
- },
{
value: 'price',
label: 'Sort by price',
diff --git a/hotel-management/src/globals/types.ts b/hotel-management/src/globals/types.ts
index f37e935..e12704c 100644
--- a/hotel-management/src/globals/types.ts
+++ b/hotel-management/src/globals/types.ts
@@ -10,7 +10,6 @@ type TUser = {
type TRoom = {
id: number;
name: string;
- amount: number;
price: number;
discount: number;
description: string;
diff --git a/hotel-management/src/pages/Room/Form.tsx b/hotel-management/src/pages/Room/Form.tsx
index de4a1e1..f82c5ef 100644
--- a/hotel-management/src/pages/Room/Form.tsx
+++ b/hotel-management/src/pages/Room/Form.tsx
@@ -83,7 +83,6 @@ const RoomForm = ({
const {
idValue,
nameValue,
- amountValue,
priceValue,
discountValue,
statusValue,
@@ -100,10 +99,6 @@ const RoomForm = ({
value: nameValue || '',
error: ''
},
- amount: {
- value: amountValue || '',
- error: ''
- },
price: {
value: priceValue || '',
error: ''
@@ -128,10 +123,6 @@ const RoomForm = ({
validatorFunc: isValidString,
prop: 'name'
}),
- amount: addValidator({
- validatorFunc: isValidNumber,
- prop: 'amount',
- }),
price: addValidator({
validatorFunc: isValidNumber,
prop: 'price',
@@ -157,7 +148,6 @@ const RoomForm = ({
const data: TRoom = {
id: +state.id!,
name: '' + state.name,
- amount: +state.amount!,
discount: +state.discount!,
price: +state.price!,
status: !!state.status,
@@ -170,7 +160,7 @@ const RoomForm = ({
const response = await sendRequest(
ROOM_PATH,
JSON.stringify(data),
- 'POST'
+ 'POST',
);
if (response.statusCode === STATUS_CODE.CREATE) {
@@ -185,7 +175,7 @@ const RoomForm = ({
const response = await sendRequest(
ROOM_PATH + `/${room!.id}`,
JSON.stringify(data),
- 'PUT'
+ 'PUT',
);
if (response.statusCode == STATUS_CODE.OK) {
@@ -229,8 +219,7 @@ const RoomForm = ({
// prettier-ignore
const {
id,
- name,
- amount,
+ name,
price,
discount,
status,
@@ -269,24 +258,6 @@ const RoomForm = ({
onChange={handleOnChange}
/>
-
-
-
-
-
{id}
{name}
- {amount}
{price}
{discount}
{statusText}
@@ -163,11 +162,10 @@ const RoomTable = ({
{rooms.length ? (
-
+
Id
Name
- Amount
Price
Discount
Status
diff --git a/hotel-management/src/pages/User/Form.tsx b/hotel-management/src/pages/User/Form.tsx
index e3ac761..06329ce 100644
--- a/hotel-management/src/pages/User/Form.tsx
+++ b/hotel-management/src/pages/User/Form.tsx
@@ -39,7 +39,7 @@ import {
errorMsg,
} from '../../constants/messages.ts';
import { USER_PATH } from '../../constants/path.ts';
-import Select, { ISelectOptions } from '../../components/Select/index.tsx';
+import Select, { ISelectOptions } from '../../components/Select';
import { useFetch } from '../../hooks/useFetch.ts';
const FormBtn = styled(Button)`
@@ -163,7 +163,7 @@ const UserForm = ({
// Submit form
const onSubmitForm = async (state: TKeyValue) => {
// Convert to user type
- const data: TUser = {
+ const user: TUser = {
id: +state.id!,
name: '' + state.name,
identifiedCode: '' + state.identifiedCode,
@@ -177,8 +177,8 @@ const UserForm = ({
// Add request
const response = await sendRequest(
USER_PATH,
- JSON.stringify(data),
- 'POST'
+ JSON.stringify(user),
+ 'POST',
);
if (response.statusCode === STATUS_CODE.CREATE) {
@@ -187,13 +187,15 @@ const UserForm = ({
throw new Error(errorMsg(response.statusCode, response.msg));
}
+ // TODO Update status when user create
+
onResetForm();
} else {
// Edit request
const response = await sendRequest(
USER_PATH + `/${user!.id}`,
JSON.stringify(data),
- 'PUT'
+ 'PUT',
);
if (response.statusCode == STATUS_CODE.OK) {