Skip to content

Commit

Permalink
✨(frontend) add created_on date on orders
Browse files Browse the repository at this point in the history
Adding created_on date to orders would allow us to better track payments.
  • Loading branch information
kernicPanel committed Jun 25, 2024
1 parent 0b30426 commit bc16578
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to

- Do not update OpenEdX enrollment if this one is already
up-to-date on the remote lms
-
### Added

- Add `created_on` column to the `Order` list view in the backoffice

## [2.4.0] - 2024-06-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { CustomLink } from "@/components/presentational/link/CustomLink";
import { PATH_ADMIN } from "@/utils/routes/path";
import { commonTranslations } from "@/translations/common/commonTranslations";
import { OrderFilters } from "@/components/templates/orders/filters/OrderFilters";
import { formatShortDate } from "@/utils/dates";

const messages = defineMessages({
id: {
Expand Down Expand Up @@ -40,6 +41,11 @@ const messages = defineMessages({
defaultMessage: "State",
description: "Label for the state header inside the table",
},
createdOn: {
id: "components.templates.orders.list.createdOn",
defaultMessage: "Created on",
description: "Label for the created on header inside the table",
},
});

type Props = DefaultTableProps<OrderListItem>;
Expand Down Expand Up @@ -86,6 +92,12 @@ export function OrdersList(props: Props) {
headerName: intl.formatMessage(messages.state),
flex: 1,
},
{
field: "created_on",
headerName: intl.formatMessage(messages.createdOn),
flex: 1,
valueGetter: (value, row) => formatShortDate(row.created_on),
},
];

return (
Expand Down
9 changes: 9 additions & 0 deletions src/frontend/admin/src/tests/orders/orders.test.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from "@/services/api/models/Organization";
import { ORGANIZATION_OPTIONS_REQUEST_RESULT } from "@/tests/mocks/organizations/organization-mock";
import { closeAllNotification, delay } from "@/components/testing/utils";
import { formatShortDateTest } from "@/tests/utils";

const url = "http://localhost:8071/api/v1.0/admin/orders/";
const catchIdRegex = getUrlCatchIdRegex(url);
Expand Down Expand Up @@ -438,6 +439,9 @@ test.describe("Order list", () => {
await expect(
page.getByRole("columnheader", { name: "State" }),
).toBeVisible();
await expect(
page.getByRole("columnheader", { name: "Created on" }),
).toBeVisible();
});

test("Check all the orders are presents", async ({ page }) => {
Expand All @@ -459,6 +463,11 @@ test.describe("Order list", () => {
await expect(
rowLocator.getByRole("gridcell", { name: order.state }),
).toBeVisible();
await expect(
rowLocator.getByRole("gridcell", {
name: await formatShortDateTest(page, order.created_on),
}),
).toBeVisible();
}),
);
});
Expand Down

0 comments on commit bc16578

Please sign in to comment.