diff --git a/src/langs/fa.json b/src/langs/fa.json
index 88cc3ec..357a82f 100644
--- a/src/langs/fa.json
+++ b/src/langs/fa.json
@@ -891,7 +891,8 @@
"established_year": "سال تاسیس",
"subscription_id": "شناسه اشتراک",
"subscription_start_date": "تاریخ شروع اشتراک",
- "subscription_end_date": "تاریخ پایان اشتراک"
+ "subscription_end_date": "تاریخ پایان اشتراک",
+ "days_remaining": "چند روز مانده"
},
"cancel": "لغو"
}
diff --git a/src/pages/dmenu/restaurant/List.tsx b/src/pages/dmenu/restaurant/List.tsx
index 02ab7b8..58cc77f 100644
--- a/src/pages/dmenu/restaurant/List.tsx
+++ b/src/pages/dmenu/restaurant/List.tsx
@@ -46,6 +46,20 @@ const RestaurantsList: FC = () => {
}
}
+ const calculateDaysRemaining = (endDate: string): string => {
+ const end = moment(endDate)
+ const now = moment()
+ const diff = end.diff(now, 'days')
+ if (diff < 0) {
+ return 'منقضی شده'
+ }
+ return `${diff} روز`
+ }
+
+ const formatJalaliDate = (date: string): string => {
+ return moment(date).format('jYYYY-jMM-jDD')
+ }
+
return (
@@ -65,10 +79,12 @@ const RestaurantsList: FC = () => {
|
|
|
- |
+ |
|
|
- |
+ |
+ |
+ |
|
@@ -92,7 +108,7 @@ const RestaurantsList: FC = () => {
)}
-
|
+
|
|
{
|
- {moment(item.createdAt).format('jYYYY-jMM-jDD HH:mm')}
+ {formatJalaliDate(item.subscriptionStartDate)}
+
+ |
+
+
+ {formatJalaliDate(item.subscriptionEndDate)}
+
+ |
+
+
+ {calculateDaysRemaining(item.subscriptionEndDate)}
|
diff --git a/src/pages/dmenu/types/Types.ts b/src/pages/dmenu/types/Types.ts
index 71861ec..0376164 100644
--- a/src/pages/dmenu/types/Types.ts
+++ b/src/pages/dmenu/types/Types.ts
@@ -84,7 +84,7 @@ export type RestaurantType = {
longitude: number | null;
serviceArea: string | null;
isActive: boolean;
- establishedYear: number | null;
+ establishedYear: number;
phone: string;
instagram: string | null;
telegram: string | null;
@@ -117,8 +117,10 @@ export type RestaurantsData = {
restaurants: RestaurantType[];
};
-export interface RestaurantsResponse extends IResponse {
+export interface RestaurantsResponse {
statusCode: number;
+ success: boolean;
+ data: RestaurantsData;
}
export interface RestaurantResponse extends IResponse {
|