[dyad] wrote 3 file(s)
This commit is contained in:
parent
2763a357f0
commit
afbbf899fe
2 changed files with 7 additions and 5 deletions
|
|
@ -9,8 +9,9 @@ onRecordAfterCreateSuccess((e) => {
|
|||
|
||||
const record = e.record;
|
||||
|
||||
// Read approver email from environment variable, fallback to placeholder if not set
|
||||
const approverEmail = $os.getenv("APPROVER_EMAIL") || "approver@example.com";
|
||||
// Read approver email from settings, fallback to environment variable or default
|
||||
const settings = $app.settings();
|
||||
const approverEmail = settings.approverEmail || $os.getenv("APPROVER_EMAIL") || "approver@example.com";
|
||||
|
||||
// Prepare order details for email
|
||||
const supplierName = record.get("supplierName");
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import {
|
|||
} from "@/components/ui/dropdown-menu"
|
||||
import { jsPDF } from "jspdf"
|
||||
import { ReceiveStockDialog } from "./ReceiveStockDialog"
|
||||
import pb from "@/lib/pocketbase" // Import PocketBase client
|
||||
import pb from "@/lib/pocketbase"
|
||||
|
||||
export type PurchaseOrder = {
|
||||
id: string
|
||||
|
|
@ -31,7 +31,7 @@ export type PurchaseOrder = {
|
|||
orderDate: string
|
||||
status: string
|
||||
itemCount: number
|
||||
items: Array<{ stockItemId: string; itemName: string; quantity: number }>
|
||||
items: Array<{ stockItemId: string; itemName: string; quantity: number; sku: string }> // Added sku here
|
||||
quantities: number[]
|
||||
}
|
||||
|
||||
|
|
@ -89,6 +89,7 @@ export function PurchaseOrderDataTable<TData, TValue>({
|
|||
let y = 70
|
||||
order.items.forEach((item, index) => {
|
||||
doc.text(`${index + 1}. ${item.itemName} - Qty: ${item.quantity}`, 14, y)
|
||||
doc.text(item.sku, 70, y); // Accessing sku directly
|
||||
y += 10
|
||||
})
|
||||
|
||||
|
|
@ -192,7 +193,7 @@ export function PurchaseOrderDataTable<TData, TValue>({
|
|||
))}
|
||||
</thead>
|
||||
<tbody>
|
||||
{table.getRowModel().rows.length ? (
|
||||
{table.getRowModel().rows?.length ? (
|
||||
table.getRowModel().rows.map(row => {
|
||||
const order = row.original as PurchaseOrder
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue