diff --git a/app/[locale]/home/account/page.tsx b/app/[locale]/home/account/page.tsx
index 257f59c..d1371d7 100644
--- a/app/[locale]/home/account/page.tsx
+++ b/app/[locale]/home/account/page.tsx
@@ -17,7 +17,7 @@ const Page: FC = async () => {
{t('title')}
-
{t('goto-home-button-label')}
+
{t('goto-home-button-label')}
{t('goto-settings-button-label')}
diff --git a/app/[locale]/share/location/[id]/LocationViewPage.tsx b/app/[locale]/share/location/[id]/LocationViewPage.tsx
index a962b5d..aacae50 100644
--- a/app/[locale]/share/location/[id]/LocationViewPage.tsx
+++ b/app/[locale]/share/location/[id]/LocationViewPage.tsx
@@ -1,5 +1,5 @@
import { ViewLocationCard } from '@/app/ui/ViewLocationCard';
-import { fetchLocationById, setSeenByTenant } from '@/app/lib/actions/locationActions';
+import { fetchLocationById, setSeenByTenantAt } from '@/app/lib/actions/locationActions';
import { getUserSettingsByUserId } from '@/app/lib/actions/userSettingsActions';
import { notFound } from 'next/navigation';
import { myAuth } from '@/app/lib/auth';
@@ -20,7 +20,7 @@ export default async function LocationViewPage({ locationId }: { locationId:stri
// If the page is not visited by the owner, mark it as seen by tenant
if (!isOwner) {
- await setSeenByTenant(locationId);
+ await setSeenByTenantAt(locationId);
}
return (
);
diff --git a/app/lib/actions/locationActions.ts b/app/lib/actions/locationActions.ts
index cbe0e17..7be5986 100644
--- a/app/lib/actions/locationActions.ts
+++ b/app/lib/actions/locationActions.ts
@@ -428,7 +428,7 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
"yearMonth.year": 1,
"yearMonth.month": 1,
"bills": 1,
- "seenByTenant": 1,
+ "seenByTenantAt": 1,
// "bills.attachment": 0,
// "bills.notes": 0,
// "bills.hub3aText": 1,
@@ -555,7 +555,7 @@ export const deleteLocationById = withUser(async (user:AuthenticatedUser, locati
})
/**
- * Sets the `seenByTenant` flag to true for a specific location.
+ * Sets the `seenByTenantAt` flag to true for a specific location.
*
* This function marks a location as viewed by the tenant. It first checks if the flag
* is already set to true to avoid unnecessary database updates.
@@ -564,17 +564,17 @@ export const deleteLocationById = withUser(async (user:AuthenticatedUser, locati
* @returns {Promise
}
*
* @example
- * await setSeenByTenant("507f1f77bcf86cd799439011");
+ * await setseenByTenantAt("507f1f77bcf86cd799439011");
*/
-export const setSeenByTenant = async (locationID: string): Promise => {
+export const setSeenByTenantAt = async (locationID: string): Promise => {
const dbClient = await getDbClient();
- // First check if the location exists and if seenByTenant is already true
+ // First check if the location exists and if seenByTenantAt is already true
const location = await dbClient.collection("lokacije")
.findOne({ _id: locationID });
- // If location doesn't exist or seenByTenant is already true, no update needed
- if (!location || location.seenByTenant === true) {
+ // If location doesn't exist or seenByTenantAt is already true, no update needed
+ if (!location || location.seenByTenantAt) {
return;
}
@@ -582,7 +582,7 @@ export const setSeenByTenant = async (locationID: string): Promise => {
await dbClient.collection("lokacije")
.updateOne(
{ _id: locationID },
- { $set: { seenByTenant: true } }
+ { $set: { seenByTenantAt: new Date() } }
);
}
diff --git a/app/lib/actions/monthActions.ts b/app/lib/actions/monthActions.ts
index d33d929..ead6e66 100644
--- a/app/lib/actions/monthActions.ts
+++ b/app/lib/actions/monthActions.ts
@@ -40,7 +40,7 @@ export const addMonth = withUser(async (user:AuthenticatedUser, { year, month }:
// copy all the properties from the previous location
...prevLocation,
// clear properties specific to the month
- seenByTenant: undefined,
+ seenByTenantAt: undefined,
utilBillsProofOfPaymentUploadedAt: undefined,
utilBillsProofOfPaymentAttachment: undefined,
// assign a new ID
diff --git a/app/lib/db-types.ts b/app/lib/db-types.ts
index 330c832..a61f0a9 100644
--- a/app/lib/db-types.ts
+++ b/app/lib/db-types.ts
@@ -74,7 +74,7 @@ export interface BillingLocation {
/** (optional) monthly rent amount in cents */
rentAmount?: number | null;
/** (optional) whether the location has been seen by tenant */
- seenByTenant?: boolean | null;
+ seenByTenantAt?: Date | null;
/** (optional) utility bills proof of payment attachment */
utilBillsProofOfPaymentAttachment?: BillAttachment|null;
/** (optional) date when utility bills proof of payment was uploaded */
diff --git a/app/ui/LocationCard.tsx b/app/ui/LocationCard.tsx
index a434b35..95654a8 100644
--- a/app/ui/LocationCard.tsx
+++ b/app/ui/LocationCard.tsx
@@ -9,6 +9,7 @@ import { formatCurrency } from "../lib/formatStrings";
import Link from "next/link";
import { useLocale, useTranslations } from "next-intl";
import { toast } from "react-toastify";
+import { get } from "http";
export interface LocationCardProps {
location: BillingLocation;
@@ -21,7 +22,7 @@ export const LocationCard: FC = ({ location, currency }) => {
name,
yearMonth,
bills,
- seenByTenant,
+ seenByTenantAt,
// NOTE: only the fileName is projected from the DB to reduce data transfer
utilBillsProofOfPaymentUploadedAt
} = location;
@@ -63,37 +64,47 @@ export const LocationCard: FC = ({ location, currency }) => {
- {monthlyExpense > 0 || seenByTenant || utilBillsProofOfPaymentUploadedAt ?
- <>
-