- Enhanced `nss-fasteners-pb-import.json` to compute `selling_price` as `cost_price * (1 + 80%)` and included `markup` in the records. - Updated `nss-fasteners-pb-transform.ts` to allow configurable CSV and output file names via environment variables, improving flexibility for different product runs. - Added support for uploading photos in the repair detail page, including validation for file types and sizes, and implemented a dialog for creating customer quotes linked to repairs. - Introduced a new `customer_quote` field in the `Repair` type to link generated quotes back to their respective repairs. These changes streamline the pricing process and enhance the user experience in managing repairs and quotes.
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import "./_env";
|
|
import { getAdminPocketBase } from "../src/lib/server/pocketbase-admin";
|
|
|
|
async function main() {
|
|
const pb = await getAdminPocketBase();
|
|
const total = await pb.collection("stock_items").getList(1, 1, { filter: "" });
|
|
const nss = await pb.collection("stock_items").getList(1, 5, {
|
|
filter: 'location = "NSS Fasteners price list - hex nut DIN934 (Grade 8 + A2)"',
|
|
});
|
|
const active = await pb.collection("stock_items").getList(1, 1, {
|
|
filter: 'supplier = "6xuu7a0pmmubtqd" && is_active = true',
|
|
});
|
|
|
|
console.log("Total stock_items in PB: " + total.totalItems);
|
|
console.log("NSS-imported rows: " + nss.totalItems);
|
|
console.log("NSS supplier active count: " + active.totalItems);
|
|
console.log("\nSample imported row:");
|
|
const sample = nss.items[0];
|
|
console.log(
|
|
JSON.stringify(
|
|
{
|
|
sku: sample.sku,
|
|
name: sample.name,
|
|
description: sample.description,
|
|
cost_price: sample.cost_price,
|
|
selling_price: sample.selling_price,
|
|
markup: sample.markup,
|
|
unit: sample.unit,
|
|
location: sample.location,
|
|
supplier: sample.supplier,
|
|
category: sample.category,
|
|
is_active: sample.is_active,
|
|
cost_history_len: Array.isArray(sample.cost_history)
|
|
? sample.cost_history.length
|
|
: 0,
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
);
|
|
}
|
|
|
|
main().catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
});
|