Skip to content

Commit

Permalink
Merge pull request #18 from R-Mielamud/dev
Browse files Browse the repository at this point in the history
Added created at preview and export
  • Loading branch information
R-Mielamud authored Jan 24, 2021
2 parents 3b80f68 + bc4b1a0 commit 1ff0f70
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions frontend/src/constants/CSVHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export const CSVHeaders = {
"requisites.delivery_name",
"requisites.post_service",
],
MESSENGER_BILL: ["user.phone", "user.messenger", "amount", "comment"],
MESSENGER_ORDER: ["user.phone", "user.messenger", "books"],
MESSENGER_BILL: ["user.phone", "user.messenger", "amount", "comment", "created_at"],
MESSENGER_ORDER: ["user.phone", "user.messenger", "books", "created_at"],
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CSVHeaders } from "../../../constants/CSVHeaders";
import { FileNames } from "../../../constants/FileNames";
import RootState from "../../../typings/rootState";
import StdSearch, { getStdFilter } from "../StdSearch";
// import moment from "moment";

const BillsTable: React.FC = () => {
const { t } = useTranslation();
Expand All @@ -29,6 +30,7 @@ const BillsTable: React.FC = () => {
});

const displayBills: WebApi.BotEntity.Bill[] = messengerBills.filter(filterBills);
// {moment(bill.created_at).format("MMMM Do YYYY, h:mm a")}

return (
<Tab.Pane>
Expand All @@ -52,7 +54,8 @@ const BillsTable: React.FC = () => {
<Table.Header>
<Table.Row>
<Table.HeaderCell width={2}>{t("phone")}</Table.HeaderCell>
<Table.HeaderCell width={2}>{t("messenger")}</Table.HeaderCell>
<Table.HeaderCell width={1}>{t("messenger")}</Table.HeaderCell>
<Table.HeaderCell width={2}>{t("creation_date")}</Table.HeaderCell>
<Table.HeaderCell width={6}>{t("amount")}</Table.HeaderCell>
<Table.HeaderCell width={7}>{t("comment")}</Table.HeaderCell>
</Table.Row>
Expand All @@ -62,6 +65,7 @@ const BillsTable: React.FC = () => {
<Table.Row key={bill.id}>
<Table.Cell>{bill.user.phone}</Table.Cell>
<Table.Cell>{bill.user.messenger}</Table.Cell>
<Table.Cell>{bill.created_at}</Table.Cell>
<Table.Cell>{bill.amount}</Table.Cell>
<Table.Cell>{bill.comment}</Table.Cell>
</Table.Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ const OrdersTable: React.FC = () => {
<Table.Header>
<Table.Row>
<Table.HeaderCell width={2}>{t("phone")}</Table.HeaderCell>
<Table.HeaderCell width={2}>{t("messenger")}</Table.HeaderCell>
<Table.HeaderCell width={13}>{t("books")}</Table.HeaderCell>
<Table.HeaderCell width={1}>{t("messenger")}</Table.HeaderCell>
<Table.HeaderCell width={2}>{t("creation_date")}</Table.HeaderCell>
<Table.HeaderCell>{t("books")}</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{displayOrders.map((order) => (
<Table.Row key={order.id}>
<Table.Cell>{order.user.phone}</Table.Cell>
<Table.Cell>{order.user.messenger}</Table.Cell>
<Table.Cell>{order.created_at}</Table.Cell>
<Table.Cell>
<div className={styles.booksCell}>
{order.books.map((book, i) => (
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/containers/ChatbotAdminPage/UsersTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const UsersTable: React.FC = () => {
<Table celled>
<Table.Header>
<Table.Row>
<Table.HeaderCell>{t("phone")}</Table.HeaderCell>
<Table.HeaderCell>{t("messenger")}</Table.HeaderCell>
<Table.HeaderCell width={2}>{t("phone")}</Table.HeaderCell>
<Table.HeaderCell width={1}>{t("messenger")}</Table.HeaderCell>
<Table.HeaderCell>{t("delivery_contacts")}</Table.HeaderCell>
<Table.HeaderCell>{t("post_service")}</Table.HeaderCell>
<Table.HeaderCell>{t("delivery_address")}</Table.HeaderCell>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ export const en = {
orders: "Orders",
books: "Products",
download_table: "Download сurrent table as CSV",
creation_date: "Creation date",
};
1 change: 1 addition & 0 deletions frontend/src/translations/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ export const ru = {
orders: "Заказы",
books: "Товары",
download_table: "Скачать отображаемую таблицу в формате CSV",
creation_date: "Дата создания",
};
1 change: 1 addition & 0 deletions frontend/src/translations/ua.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ export const ua = {
orders: "Замовлення",
books: "Товари",
download_table: "Завантажити таблицю у форматі CSV",
creation_date: "Дата створення",
};
2 changes: 2 additions & 0 deletions frontend/src/typings/webapi.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ namespace WebApi.BotEntity {
amount: string;
comment: string;
user: MinimalUser;
created_at: string;
}

interface Order extends Identified {
books: string[];
user: MinimalUser;
created_at: string;
}
}

Expand Down

0 comments on commit 1ff0f70

Please sign in to comment.