+
{view}
diff --git a/src/app/[lng]/contracts/[id]/page.tsx b/src/app/[lng]/contracts/[id]/page.tsx
index 7fcec61..c0a478b 100644
--- a/src/app/[lng]/contracts/[id]/page.tsx
+++ b/src/app/[lng]/contracts/[id]/page.tsx
@@ -50,7 +50,7 @@ export default async function Page({ params: { lng, id: recordId } }: any) {
let d = new Date(expiry_date).getTime();
let now = new Date().getTime();
- const monthCount = Math.round((d - now) / 1000 / 60 / 60 / 24 / 30);
+ const monthCount = Math.round(Math.abs(d - now) / 1000 / 60 / 60 / 24 / 30);
return monthly_rental * monthCount + processing_fee;
};
const gym_typeCaption = (v: any) => {
@@ -94,12 +94,16 @@ export default async function Page({ params: { lng, id: recordId } }: any) {
diff --git a/src/app/[lng]/contracts/[id]/update/page.tsx b/src/app/[lng]/contracts/[id]/update/page.tsx
index 921ccff..424e1d4 100644
--- a/src/app/[lng]/contracts/[id]/update/page.tsx
+++ b/src/app/[lng]/contracts/[id]/update/page.tsx
@@ -133,7 +133,7 @@ export default function Page({ params: { lng, id: recordId } }: any) {
if (d) {
let now = new Date().getTime();
- const monthCount = Math.round((d - now) / 1000 / 60 / 60 / 24 / 30);
+ const monthCount = Math.round(Math.abs(d - now) / 1000 / 60 / 60 / 24 / 30);
const v = monthly_rental * monthCount + processing_fee;
setPrice(v);
}
diff --git a/src/app/[lng]/contracts/page.tsx b/src/app/[lng]/contracts/page.tsx
index bc1f19a..30fbbdd 100644
--- a/src/app/[lng]/contracts/page.tsx
+++ b/src/app/[lng]/contracts/page.tsx
@@ -1,12 +1,8 @@
-// 'use client';
import React from 'react';
-// import { useState, useEffect } from 'react';
import { ContractBox } from '../components/ContractBox';
import SearchBox from '../components/SearchBox';
import loadingGif from '../../../../public/loading.gif';
import { getContracts } from '../../apis/api';
-import selections from '../../../../public/selections.json';
-import zipCode from '../../../../public/twZipCode.json';
import Link from 'next/link';
import Image from 'next/image';
import { Contract } from '../../type/type';
@@ -19,7 +15,6 @@ const Contract = async ({ params: { lng }, searchParams }: any) => {
const { t } = await useTranslation(lng, 'contracts');
const currentPage = Number(searchParams.page) || 1;
const defaultPageSize = 10;
- // TODO: expiry_date is a key feature, should be set as order
const { results: contracts, count: recordCount }: { results: Contract[]; count: number } =
await getContracts({
@@ -27,26 +22,6 @@ const Contract = async ({ params: { lng }, searchParams }: any) => {
county: searchParams?.county,
q: searchParams?.q,
});
- const selection = {
- zipCode,
- gym_types: selections[0].list,
- };
- // useEffect(() => {
- // let ret: any[] = [];
- // let selectedDistricts = selection.zipCode.find((item: any) => item.name === filter.county);
-
- // if (selectedDistricts) {
- // ret = selectedDistricts.districts;
- // }
- // setDistricts(ret);
- // }, [filter.county, selection.zipCode]);
-
- // function handleFilterChange(event: any) {
- // setFilter({ ...filter, [event.target.name]: event.target.value });
- // }
- // function handleSorterChange(event: any) {
- // setOrdering({ ...ordering, [event.target.name]: event.target.value });
- // }
return (
diff --git a/src/app/[lng]/setting/new-contract/page.tsx b/src/app/[lng]/setting/new-contract/page.tsx
index 995af0c..8c6b333 100644
--- a/src/app/[lng]/setting/new-contract/page.tsx
+++ b/src/app/[lng]/setting/new-contract/page.tsx
@@ -124,7 +124,7 @@ export default function Page({ params: { lng, id: recordId } }: any) {
if (d) {
let now = new Date().getTime();
- const monthCount = Math.round((d - now) / 1000 / 60 / 60 / 24 / 30);
+ const monthCount = Math.round(Math.abs(d - now) / 1000 / 60 / 60 / 24 / 30);
const v = monthly_rental * monthCount + processing_fee;
setPrice(v);
}
diff --git a/src/app/i18n/locales/en/contracts.json b/src/app/i18n/locales/en/contracts.json
index c9b9069..cbd33c0 100644
--- a/src/app/i18n/locales/en/contracts.json
+++ b/src/app/i18n/locales/en/contracts.json
@@ -17,7 +17,7 @@
"soldOut": "Sold Out",
"updateDate": "Update Date",
"creator": "Creator",
- "monthly": "per month",
+ "Monthly": "Monthly",
"all": "All",
"month": "Month",
"expired": "Expired",
diff --git a/src/app/i18n/locales/zh/contracts.json b/src/app/i18n/locales/zh/contracts.json
index de823fd..f1260d1 100644
--- a/src/app/i18n/locales/zh/contracts.json
+++ b/src/app/i18n/locales/zh/contracts.json
@@ -17,7 +17,7 @@
"soldOut": "已售出",
"updateDate": "更新日期",
"creator": "刊登會員",
- "monthly": "/月",
+ "Monthly": "/月",
"all": "全部區域",
"month": "月",
"expired": "過期",