From f2516b9fb82798cf33db3997b195a41c39f456ce Mon Sep 17 00:00:00 2001 From: mahdi andalib Date: Tue, 15 Feb 2022 20:00:07 +0330 Subject: [PATCH] added and updated --- src/components/ReactTable4/BasicTable.js | 2 +- src/components/ReactTable4/ColumnFilter.js | 27 ++++---- src/components/ReactTable4/MOCK_DATA.json | 74 +++++++--------------- src/components/ReactTable4/columns.js | 13 ++-- 4 files changed, 43 insertions(+), 73 deletions(-) diff --git a/src/components/ReactTable4/BasicTable.js b/src/components/ReactTable4/BasicTable.js index fd7e2de..97f8efd 100644 --- a/src/components/ReactTable4/BasicTable.js +++ b/src/components/ReactTable4/BasicTable.js @@ -11,7 +11,6 @@ import { useRowSelect, useColumnOrder, useExpanded, - useResizeColumns, } from "react-table"; import { COLUMNS } from "./columns"; @@ -239,6 +238,7 @@ const BasicTable = ({ settingsIcon }) => { : " 🔼" : ""} + {/*
{column.canFilter ? column.render("Filter") : null}
*/} ))} diff --git a/src/components/ReactTable4/ColumnFilter.js b/src/components/ReactTable4/ColumnFilter.js index f70108e..6226fa2 100644 --- a/src/components/ReactTable4/ColumnFilter.js +++ b/src/components/ReactTable4/ColumnFilter.js @@ -1,19 +1,14 @@ -import React from 'react'; +import React from "react"; export const ColumnFilter = ({ column }) => { - - const { filterValue, setFilter } = column - - return ( - - - - Search: {''} - - setFilter(e.target.value)} /> - - - - ); + const { filterValue, setFilter } = column; + + return ( + + setFilter(e.target.value)} + /> + + ); }; diff --git a/src/components/ReactTable4/MOCK_DATA.json b/src/components/ReactTable4/MOCK_DATA.json index f04f38b..2b89ea5 100644 --- a/src/components/ReactTable4/MOCK_DATA.json +++ b/src/components/ReactTable4/MOCK_DATA.json @@ -1,6 +1,6 @@ [ { - "name": "mahdi", + "name": "سامسونگ موبایل مدل 1", "order-date": "1399/09/27", "order-price": 25, "order-number": "09120023100", @@ -10,73 +10,43 @@ "history": "مهدی" }, { - "name": "مهدی", - "order-date": "1399/09/27", - "order-price": 27, - "order-number": "09120023100", - "user-job": "مهندس ساختمان", - "order-status": 1, - "order-level": 1, - "history": "mahdimahdi" - }, - { - "name": "mahdi", - "order-date": "1399/09/27", - "order-price": 25, + "name": "ایفون جدید 13", + "order-date": "1305/09/27", + "order-price": 22, "order-number": "09120023100", "user-job": "مهندس ساختمان", - "order-status": 1, - "order-level": 1, + "order-status": 2, + "order-level": 2, "history": "مهدی" }, { - "name": "مهدی", + "name": "مک بوک پرو", "order-date": "1399/09/27", - "order-price": 27, - "order-number": "09120023100", - "user-job": "مهندس ساختمان", - "order-status": 1, - "order-level": 1, - "history": "mahdimahdi" - }, - { - "name": "mahdi", - "order-date": "1399/09/27", - "order-price": 25, + "order-price": 75, "order-number": "09120023100", "user-job": "مهندس ساختمان", - "order-status": 1, - "order-level": 1, + "order-status": 3, + "order-level": 3, "history": "مهدی" }, { - "name": "مهدی", - "order-date": "1399/09/27", - "order-price": 27, - "order-number": "09120023100", - "user-job": "مهندس ساختمان", - "order-status": 1, - "order-level": 1, - "history": "mahdimahdi" - }, - { - "name": "mahdi", - "order-date": "1399/09/27", - "order-price": 25, + "name": "تبلت", + "order-date": "1305/09/27", + "order-price": 44, "order-number": "09120023100", "user-job": "مهندس ساختمان", - "order-status": 1, - "order-level": 1, + "order-status": 4, + "order-level": 4, "history": "مهدی" }, { - "name": "مهدی", - "order-date": "1399/09/27", - "order-price": 27, + "name": "کتاب جدید", + "order-date": "1305/09/27", + "order-price": 13, "order-number": "09120023100", - "user-job": "مهندس ساختمان", - "order-status": 1, - "order-level": 1, - "history": "mahdimahdi" + "user-job": "طناز", + "order-status": 5, + "order-level": 5, + "history": "مهدی" } ] diff --git a/src/components/ReactTable4/columns.js b/src/components/ReactTable4/columns.js index 795480e..ef200b4 100644 --- a/src/components/ReactTable4/columns.js +++ b/src/components/ReactTable4/columns.js @@ -2,7 +2,7 @@ import { format } from "date-fns"; import Table, { SelectColumnFilter } from "./BasicTable"; // new -import { ColumnFilter } from "./ColumnFilter"; +import { ColumnFilter } from "./ColumnFilter.js"; import { OrderStatus } from "./OrderStatus"; import { OrderLevel } from "./OrderLevel"; @@ -15,11 +15,13 @@ export const COLUMNS = [ Footer: "نام و نام خانوادگی", accessor: "name", disableSortBy: true, + Filter: false, }, { Header: "تاریخ سفارش", Footer: "تاریخ سفارش", accessor: "order-date", + Filter: false, Cell: ({ value }) => { return format(new Date(value), "dd/MM/yyyy"); }, @@ -28,22 +30,25 @@ export const COLUMNS = [ Header: "مبلغ سفارش", Footer: "مبلغ سفارش", accessor: "order-price", - Filter: ColumnFilter, + Filter: false, }, { Header: "شماره سفارش", Footer: "شماره سفارش", accessor: "order-number", + Filter: false, }, { Header: "شغل کاربر", Footer: "شغل کاربر", accessor: "user-job", + Filter: false, }, { Header: "وضعیت سفارش", Footer: "وضعیت سفارش", accessor: "order-status", + Filter: false, Cell: OrderStatus, }, { @@ -51,13 +56,13 @@ export const COLUMNS = [ Footer: "سطح اهمیت", accessor: "order-level", Cell: OrderLevel, - // Filter: SelectColumnFilter, - // new + Filter: SelectColumnFilter, }, { Header: EditButtons, Footer: "ویرایش", accessor: "edit", + Filter: false, Cell: Buttons, disableSortBy: true, },