mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-01 23:13:21 +00:00
Merge branch 'feature/columns-slideover' into feature/filter-slideover
This commit is contained in:
commit
3239aa3e9d
2 changed files with 59 additions and 64 deletions
|
|
@ -34,14 +34,22 @@ test.describe("Invoice Processing columns drawer (AP-45)", () => {
|
|||
await page.goto("/");
|
||||
await page.getByTestId("columns-toggle").click();
|
||||
const drawer = page.getByTestId("columns-drawer");
|
||||
const vendorBox = drawer.getByTestId("columns-visible-vendor").locator('input[type="checkbox"]');
|
||||
const vendorBox = drawer
|
||||
.getByTestId("columns-visible-vendor")
|
||||
.locator('input[type="checkbox"]');
|
||||
await expect(vendorBox).toBeDisabled();
|
||||
await vendorBox.evaluate((el: HTMLInputElement) => {
|
||||
el.disabled = false;
|
||||
el.click();
|
||||
});
|
||||
await expect(
|
||||
page.getByTestId("grid-pending").locator('.MuiDataGrid-columnHeader[data-field="vendor"]'),
|
||||
page
|
||||
.getByTestId("grid-pending")
|
||||
.locator('.MuiDataGrid-columnHeader[data-field="vendorName"]'),
|
||||
).toBeVisible();
|
||||
await page.getByTestId("tab-ready").click();
|
||||
await expect(
|
||||
page.getByTestId("grid-ready").locator('.MuiDataGrid-columnHeader[data-field="vendorName"]'),
|
||||
).toBeVisible();
|
||||
|
||||
const search = drawer.getByTestId("columns-hidden-search");
|
||||
|
|
|
|||
|
|
@ -168,29 +168,27 @@ function withRefreshedCatalogFields(invoice: MockInvoice): MockInvoice {
|
|||
}
|
||||
|
||||
function enrichInvoice(core: MockInvoiceCore, index: number): MockInvoice {
|
||||
return withRefreshedCatalogFields(
|
||||
{
|
||||
...core,
|
||||
hasBolt: index % 3 === 0,
|
||||
hasBell: index % 2 === 0,
|
||||
hasEye: true,
|
||||
actionLabel: actionLabelForStatus(core.status),
|
||||
lastUpdate: "",
|
||||
lastUpdateMessage: "",
|
||||
lastUpdateActorName: "",
|
||||
lastUpdateAt: "",
|
||||
invoiceDate: invoiceDateBeforeDue(core.dueDate, index),
|
||||
processingBegan: core.activity[0]?.createdAt?.slice(0, 10) ?? core.dueDate,
|
||||
tagging: index % 2 === 0 ? "Ops" : "",
|
||||
fs: index % 2 === 0 ? "synced" : "",
|
||||
description: core.memo,
|
||||
invoiceType: "Standard",
|
||||
location: "Ronkonkoma",
|
||||
paymentAccount: paymentAccountFor(core.paymentMethod),
|
||||
relatedInvoice: null,
|
||||
rowCount: core.lines.length,
|
||||
},
|
||||
);
|
||||
return withRefreshedCatalogFields({
|
||||
...core,
|
||||
hasBolt: index % 3 === 0,
|
||||
hasBell: index % 2 === 0,
|
||||
hasEye: true,
|
||||
actionLabel: actionLabelForStatus(core.status),
|
||||
lastUpdate: "",
|
||||
lastUpdateMessage: "",
|
||||
lastUpdateActorName: "",
|
||||
lastUpdateAt: "",
|
||||
invoiceDate: invoiceDateBeforeDue(core.dueDate, index),
|
||||
processingBegan: core.activity[0]?.createdAt?.slice(0, 10) ?? core.dueDate,
|
||||
tagging: index % 2 === 0 ? "Ops" : "",
|
||||
fs: index % 2 === 0 ? "synced" : "",
|
||||
description: core.memo,
|
||||
invoiceType: "Standard",
|
||||
location: "Ronkonkoma",
|
||||
paymentAccount: paymentAccountFor(core.paymentMethod),
|
||||
relatedInvoice: null,
|
||||
rowCount: core.lines.length,
|
||||
});
|
||||
}
|
||||
|
||||
function cloneInvoice(invoice: MockInvoice): MockInvoice {
|
||||
|
|
@ -580,22 +578,20 @@ export function updateMockInvoicePayDate(id: string, payDate: string | null): Mo
|
|||
const current = invoiceStore[index];
|
||||
return replaceInvoice(
|
||||
index,
|
||||
withRefreshedCatalogFields(
|
||||
{
|
||||
...current,
|
||||
payDate,
|
||||
activity: [
|
||||
...current.activity,
|
||||
{
|
||||
id: `activity-pay-date-${Date.now()}`,
|
||||
actorUserId: "user-1",
|
||||
actorName: "System",
|
||||
message: "Pay date updated",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
withRefreshedCatalogFields({
|
||||
...current,
|
||||
payDate,
|
||||
activity: [
|
||||
...current.activity,
|
||||
{
|
||||
id: `activity-pay-date-${Date.now()}`,
|
||||
actorUserId: "user-1",
|
||||
actorName: "System",
|
||||
message: "Pay date updated",
|
||||
createdAt: new Date().toISOString(),
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -605,10 +601,7 @@ export function updateMockInvoiceHeader(id: string, patch: MockInvoiceHeaderPatc
|
|||
throw new Error(`Mock invoice not found: ${id}`);
|
||||
}
|
||||
|
||||
return replaceInvoice(
|
||||
index,
|
||||
withRefreshedCatalogFields({ ...invoiceStore[index], ...patch }),
|
||||
);
|
||||
return replaceInvoice(index, withRefreshedCatalogFields({ ...invoiceStore[index], ...patch }));
|
||||
}
|
||||
|
||||
export function updateMockInvoiceLines(id: string, lines: MockInvoiceLine[]): MockInvoice {
|
||||
|
|
@ -619,12 +612,10 @@ export function updateMockInvoiceLines(id: string, lines: MockInvoiceLine[]): Mo
|
|||
|
||||
return replaceInvoice(
|
||||
index,
|
||||
withRefreshedCatalogFields(
|
||||
{
|
||||
...invoiceStore[index],
|
||||
lines: lines.map((line) => ({ ...line })),
|
||||
},
|
||||
),
|
||||
withRefreshedCatalogFields({
|
||||
...invoiceStore[index],
|
||||
lines: lines.map((line) => ({ ...line })),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -651,12 +642,10 @@ export function addMockInvoiceComment(
|
|||
|
||||
return replaceInvoice(
|
||||
index,
|
||||
withRefreshedCatalogFields(
|
||||
{
|
||||
...current,
|
||||
comments: [...current.comments, nextComment],
|
||||
},
|
||||
),
|
||||
withRefreshedCatalogFields({
|
||||
...current,
|
||||
comments: [...current.comments, nextComment],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -684,13 +673,11 @@ export function transitionMockInvoiceStatus(
|
|||
|
||||
const updated = replaceInvoice(
|
||||
index,
|
||||
withRefreshedCatalogFields(
|
||||
{
|
||||
...current,
|
||||
status,
|
||||
activity: [...current.activity, nextActivity],
|
||||
},
|
||||
),
|
||||
withRefreshedCatalogFields({
|
||||
...current,
|
||||
status,
|
||||
activity: [...current.activity, nextActivity],
|
||||
}),
|
||||
);
|
||||
|
||||
if (status === "approved" || status === "rejected") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue