diff --git a/app/lib/actions/billActions.ts b/app/lib/actions/billActions.ts
index f2d3617..05ad9aa 100644
--- a/app/lib/actions/billActions.ts
+++ b/app/lib/actions/billActions.ts
@@ -146,7 +146,6 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
const billPaid = formData.get('billPaid') === 'on';
const billedTo = (formData.get('billedTo') as BilledTo) ?? BilledTo.Tenant;
- // const barcodeImage = formData.get('barcodeImage')?.valueOf() as string; // LEGACY FIELD - not used anymore
const hub3aText = formData.get('hub3aText')?.valueOf() as string;
// update the bill in the mongodb
@@ -165,7 +164,6 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
"bills.$[elem].attachment": billAttachment,
"bills.$[elem].notes": billNotes,
"bills.$[elem].payedAmount": payedAmount,
- // "bills.$[elem].barcodeImage": barcodeImage, // LEGACY FIELD - not used anymore
"bills.$[elem].hub3aText": hub3aText,
}: {
@@ -174,7 +172,6 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
"bills.$[elem].billedTo": billedTo,
"bills.$[elem].notes": billNotes,
"bills.$[elem].payedAmount": payedAmount,
- // "bills.$[elem].barcodeImage": barcodeImage, // LEGACY FIELD - not used anymore
"bills.$[elem].hub3aText": hub3aText,
};
@@ -201,7 +198,6 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
attachment: billAttachment,
notes: billNotes,
payedAmount,
- // barcodeImage, // LEGACY FIELD - not used anymore
hub3aText,
};
@@ -266,7 +262,6 @@ export const updateOrAddBill = withUser(async (user:AuthenticatedUser, locationI
attachment: null, // No attachment for subsequent months
notes: billNotes,
payedAmount: null,
- // barcodeImage: undefined, // LEGACY FIELD - not used anymore
hub3aText: undefined,
}
}
diff --git a/app/lib/actions/locationActions.ts b/app/lib/actions/locationActions.ts
index 61831af..3994865 100644
--- a/app/lib/actions/locationActions.ts
+++ b/app/lib/actions/locationActions.ts
@@ -432,7 +432,7 @@ export const fetchAllLocations = withUser(async (user:AuthenticatedUser, year:nu
"seenByTenant": 1,
// "bills.attachment": 0,
// "bills.notes": 0,
- // "bills.barcodeImage": 1,
+ // "bills.hub3aText": 1,
},
},
{
diff --git a/app/lib/actions/monthActions.ts b/app/lib/actions/monthActions.ts
index b8fc6b4..8e4157d 100644
--- a/app/lib/actions/monthActions.ts
+++ b/app/lib/actions/monthActions.ts
@@ -53,7 +53,7 @@ export const addMonth = withUser(async (user:AuthenticatedUser, { year, month }:
attachment: null,
notes: null,
payedAmount: null,
- barcodeImage: undefined,
+ hub3aText: undefined,
} as Bill
})
} as BillingLocation);
diff --git a/app/lib/actions/printActions.ts b/app/lib/actions/printActions.ts
index 60fdfbc..a44d3c4 100644
--- a/app/lib/actions/printActions.ts
+++ b/app/lib/actions/printActions.ts
@@ -9,7 +9,12 @@ import { unstable_noStore as noStore } from 'next/cache';
export interface PrintBarcodeData {
locationName: string;
billName: string;
- barcodeImage: string;
+ /**
+ * LEGACY SUPPORT ... untill all bills have been migrated
+ * @deprecated Use `hub3aText` instead.
+ */
+ barcodeImage?: string;
+ hub3aText?: string;
payedAmount?: number | null;
}
@@ -42,11 +47,15 @@ export const fetchBarcodeDataForPrint = withUser(async (user: AuthenticatedUser,
for (const location of locations) {
for (const bill of location.bills) {
// Only include bills that have barcode images
- if (bill.barcodeImage && bill.barcodeImage.trim() !== "") {
+ if ( ( bill.hub3aText && bill.hub3aText.trim() !== "") ||
+ // LEGACY SUPPORT ... untill all bills have been migrated
+ (bill.barcodeImage && bill.barcodeImage.trim() !== "")
+ ) {
printData.push({
locationName: location.name,
billName: bill.name,
- barcodeImage: bill.barcodeImage,
+ barcodeImage: bill.barcodeImage, // LEGACY SUPPORT ... untill all bills have been migrated
+ hub3aText: bill.hub3aText,
payedAmount: bill.payedAmount
});
}
diff --git a/app/lib/pdf/barcodeDecoder.ts b/app/lib/pdf/barcodeDecoder.ts
index 595f303..68c20ce 100644
--- a/app/lib/pdf/barcodeDecoder.ts
+++ b/app/lib/pdf/barcodeDecoder.ts
@@ -206,7 +206,6 @@ const pdf2canvas = async function (pdfFile:File): Promise
-
);
}
\ No newline at end of file
diff --git a/app/ui/PrintPreview.tsx b/app/ui/PrintPreview.tsx
index 79109e5..923b09d 100644
--- a/app/ui/PrintPreview.tsx
+++ b/app/ui/PrintPreview.tsx
@@ -1,6 +1,7 @@
'use client';
import { PrintBarcodeData } from '../lib/actions/printActions';
+import { Pdf417Barcode } from './Pdf417Barcode';
export interface PrintPreviewProps {
data: PrintBarcodeData[];
@@ -141,12 +142,21 @@ export const PrintPreview: React.FC
diff --git a/app/ui/ViewBillCard.tsx b/app/ui/ViewBillCard.tsx
index 5b85c81..6bace88 100644
--- a/app/ui/ViewBillCard.tsx
+++ b/app/ui/ViewBillCard.tsx
@@ -2,20 +2,11 @@
import { DocumentIcon, CheckCircleIcon, XCircleIcon } from "@heroicons/react/24/outline";
import { Bill, BillingLocation } from "../lib/db-types";
-import React, { FC } from "react";
-import { updateOrAddBill } from "../lib/actions/billActions";
+import { FC } from "react";
import Link from "next/link";
import { formatYearMonth } from "../lib/format";
-import { useLocale, useTranslations } from "next-intl";
-
-// Next.js does not encode an utf-8 file name correctly when sending a form with a file attachment
-// This is a workaround for that
-const updateOrAddBillMiddleware = (locationId: string, billId:string|undefined, billYear:number|undefined, billMonth:number|undefined, prevState:any, formData: FormData) => {
- // URL encode the file name of the attachment so it is correctly sent to the server
- const billAttachment = formData.get('billAttachment') as File;
- formData.set('billAttachment', billAttachment, encodeURIComponent(billAttachment.name));
- return updateOrAddBill(locationId, billId, billYear, billMonth, prevState, formData);
-}
+import { useTranslations } from "next-intl";
+import { Pdf417Barcode } from "./Pdf417Barcode";
export interface ViewBillCardProps {
location: BillingLocation,
@@ -25,11 +16,9 @@ export interface ViewBillCardProps {
export const ViewBillCard:FC
+ {
+ item.hub3aText ?
+
: null
+ )
+ }
+
{t.rich('barcode-disclaimer', { br: () =>
})}
{t.rich('barcode-disclaimer', { br: () =>
})}
{t.rich('barcode-disclaimer', { br: () =>
})}