Compare commits
No commits in common. "a190f8c301a2806fce681aaf058140ce5b7bfd25" and "d10cf03f989e25b82316f1a79af7482d139e629f" have entirely different histories.
a190f8c301
...
d10cf03f98
|
|
@ -35,7 +35,7 @@ export default function AdminUserManagement() {
|
|||
|
||||
<div className="w-full flex flex-col lg:flex-row justify-center items-center gap-6 ">
|
||||
<div className="w-full lg:w-3/5 h-11 bg-white rounded-[5px] block">
|
||||
{/* <Search Cancel={} mode="admin" /> */}
|
||||
<Search mode="admin" />
|
||||
</div>
|
||||
|
||||
<div className="w-full lg:w-2/5 flex flex-row justify-between items-center gap-2 ">
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ export default function ComplainsDetails({
|
|||
</AlertDialog>
|
||||
{getComplaintMutation.data && !getComplaintMutation.isPending ? (
|
||||
<>
|
||||
{/* <button
|
||||
<button
|
||||
onClick={() =>
|
||||
router.push("/UserPanel/ControllerDashboard/Complaints")
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ export default function ComplainsDetails({
|
|||
<ArrowRight />
|
||||
</span>
|
||||
<p>بازگشت</p>
|
||||
</button> */}
|
||||
</button>
|
||||
|
||||
<div className="flex items-start w-full gap-2 mt-2 max-lg:flex-col">
|
||||
{/* 1 */}
|
||||
|
|
@ -277,7 +277,7 @@ export default function ComplainsDetails({
|
|||
</div>
|
||||
{/* 2 */}
|
||||
<div className="flex flex-col self-stretch w-full gap-2 rounded-lg lg:w-2/3 ">
|
||||
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col md:flex-row gap-2 items-center justify-center">
|
||||
<div className=" bg-[#E9E9E9] rounded-md py-4 px-10 flex flex-col md:flex-row gap-2 items-center justify-center lg:sticky top-28">
|
||||
{data.user == null ? (
|
||||
<>
|
||||
<div className="relative flex flex-col w-full p-5 mt-2 border border-gray-400 rounded-md gap-y-1">
|
||||
|
|
|
|||
|
|
@ -5,14 +5,12 @@ import { MdKeyboardArrowRight, MdKeyboardArrowLeft } from "react-icons/md";
|
|||
import { twMerge } from "tailwind-merge";
|
||||
|
||||
export default function Pagination({
|
||||
TotalPages,
|
||||
currentPage,
|
||||
PageSize,
|
||||
Page,
|
||||
countPage,
|
||||
length,
|
||||
}: {
|
||||
TotalPages?: any;
|
||||
currentPage?: any;
|
||||
PageSize?: number;
|
||||
Page?: any;
|
||||
|
|
@ -32,15 +30,11 @@ export default function Pagination({
|
|||
onPageChange={handlePageClick}
|
||||
pageRangeDisplayed={3}
|
||||
forcePage={currentPage}
|
||||
pageCount={
|
||||
TotalPages
|
||||
? TotalPages
|
||||
: Math.ceil(countPage / (PageSize ? PageSize : 5))
|
||||
}
|
||||
pageCount={Math.ceil(countPage / (PageSize ? PageSize : 5))}
|
||||
previousLabel={<MdKeyboardArrowRight className="w-5 h-5 " />}
|
||||
pageClassName=" w-10 h-10 grid place-content-center rounded-lg !text-blue shadow-md"
|
||||
className={twMerge(
|
||||
" flex flex-wrap gap-3 text-sm md:text-base w-full rounded-md p-2 pb-3 bg-white/30 backdrop-blur-lg justify-center fixed text-blue mt-5 left-0 right-0 bottom-0"
|
||||
" flex flex-wrap gap-3 text-sm md:text-base w-full rounded-md p-1 bg-white/30 backdrop-blur-lg justify-center text-blue mt-5 absolute left-0 right-0 bottom-6"
|
||||
)}
|
||||
activeClassName=" bg-blue text-blue shadow-md shadow-main"
|
||||
activeLinkClassName=" text-white w-full p-1 h-full"
|
||||
|
|
|
|||
|
|
@ -1,50 +1,26 @@
|
|||
"use client";
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Input } from "./ui/input";
|
||||
import { Label } from "./ui/label";
|
||||
import { Button } from "./ui/button";
|
||||
import { CiSearch } from "react-icons/ci";
|
||||
import { X, XCircle } from "lucide-react";
|
||||
|
||||
export default function Search({
|
||||
mode,
|
||||
value,
|
||||
action,
|
||||
Cancel,
|
||||
changeValue,
|
||||
}: {
|
||||
mode?: string;
|
||||
value?: any;
|
||||
action?: (any: any) => any;
|
||||
Cancel: (any: any) => any;
|
||||
changeValue?: (any: any) => any;
|
||||
changeValue?: (any: any) => any ;
|
||||
}) {
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const [cancel, setCancel] = useState<boolean>(false);
|
||||
const handleSubmit = (e: any) => {
|
||||
console.log(222);
|
||||
e.preventDefault();
|
||||
setCancel(true);
|
||||
};
|
||||
|
||||
const cancelSearch = (e: any) => {
|
||||
e.preventDefault();
|
||||
setCancel(false);
|
||||
if (changeValue !== undefined) {
|
||||
console.log(444);
|
||||
changeValue("");
|
||||
}
|
||||
Cancel(true);
|
||||
};
|
||||
console.log(value);
|
||||
return (
|
||||
<form
|
||||
onSubmit={handleSubmit}
|
||||
className="relative flex items-center w-full bg-gray-300 lg:w-1/5 rounded-xl"
|
||||
>
|
||||
<div className="relative flex items-center w-full bg-gray-300 lg:w-1/5 rounded-xl">
|
||||
<Input
|
||||
// type="search"
|
||||
ref={inputRef}
|
||||
id="default-search"
|
||||
className={`mb-0 h-8 bg-[#E9E9E9] border-none focus-visible:none rounded-lg
|
||||
block w-full min-w-[13rem] text-xs md:text-sm text-black
|
||||
|
|
@ -58,28 +34,15 @@ export default function Search({
|
|||
value={value}
|
||||
onChange={(e) => {
|
||||
if (changeValue) {
|
||||
setCancel(false);
|
||||
changeValue(e.target.value);
|
||||
}
|
||||
}}
|
||||
placeholder="جستجو..."
|
||||
required
|
||||
/>
|
||||
{cancel ? (
|
||||
<button
|
||||
onClick={cancelSearch}
|
||||
type="button"
|
||||
className="absolute left-3"
|
||||
>
|
||||
<X className=" text-gray-600 h-5 w-5" />
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={action} className="absolute left-3">
|
||||
<CiSearch className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
{/* <button onClick={action} className="absolute left-3">
|
||||
<button onClick={action} className="absolute left-3">
|
||||
<CiSearch />
|
||||
</button> */}
|
||||
</form>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ export default function TabController() {
|
|||
const [totalCount, setTotalCount] = useState<any>(0);
|
||||
const [currentPage, setCurrentPage] = useState<any>(0);
|
||||
const [pageSize, setPageSize] = useState<any>(0);
|
||||
const [totalPages, setTotalPages] = useState<any>(0);
|
||||
const [cancel, setCancel] = useState<boolean>(false);
|
||||
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const [psblState, setPsblState] = useState(0);
|
||||
|
|
@ -61,23 +59,15 @@ export default function TabController() {
|
|||
});
|
||||
|
||||
const handelSearch = (event: any) => {
|
||||
setPage(1);
|
||||
refetch();
|
||||
};
|
||||
useEffect(() => {
|
||||
if (cancel) {
|
||||
refetch();
|
||||
}
|
||||
}, [cancel]);
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
const headersData = JSON.parse(data.headers["x-pagination"]);
|
||||
setTotalCount(headersData.TotalCount);
|
||||
setTotalPages(headersData.TotalPages);
|
||||
setCurrentPage(headersData.CurrentPage);
|
||||
setPageSize(headersData.PageSize);
|
||||
setCancel(false);
|
||||
}
|
||||
}, [data]);
|
||||
useEffect(() => {
|
||||
|
|
@ -87,13 +77,20 @@ export default function TabController() {
|
|||
setPsblState(Number(activeTab));
|
||||
}
|
||||
}, []);
|
||||
console.log(currentPage);
|
||||
|
||||
const isZero = totalCount === 0;
|
||||
|
||||
return (
|
||||
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-16 pt-9 mx-auto">
|
||||
<Tabs value={String(selectedTab)} className="" dir="rtl">
|
||||
<div className="flex flex-col-reverse items-center justify-between w-full gap-4 mb-5 lg:flex-row lg:gap-2">
|
||||
<p className="my-2 text-xs font-bold 3xl:ml-6 sm:text-sm">
|
||||
لیست شکایت ها
|
||||
</p>
|
||||
<Tabs
|
||||
value={String(selectedTab)}
|
||||
className=""
|
||||
dir="rtl"
|
||||
>
|
||||
<div className="flex flex-col-reverse items-center justify-between w-full gap-4 mb-10 lg:flex-row lg:gap-2">
|
||||
{/* Tab Title */}
|
||||
<TabsList className="flex w-full gap-1 h-a max-lg:flex-wrap max lg:w-4/5 md:gap-4 lg:gap-1 p-1">
|
||||
{/* <p className="text-xs font-bold 3xl:ml-6 sm:text-sm max-xl:hidden">
|
||||
|
|
@ -111,9 +108,9 @@ export default function TabController() {
|
|||
setPsblState(item.value);
|
||||
setSelectedTab(String(item.value));
|
||||
localStorage.setItem("ActiveTab", String(item.value));
|
||||
|
||||
refetch();
|
||||
setSearch("");
|
||||
setPage(1);
|
||||
setPage(0);
|
||||
}}
|
||||
>
|
||||
<div className="relative w-full ">
|
||||
|
|
@ -130,7 +127,6 @@ export default function TabController() {
|
|||
changeValue={(data: any) => setSearch(data)}
|
||||
mode="controller"
|
||||
action={handelSearch}
|
||||
Cancel={() => setCancel(true)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
@ -140,8 +136,8 @@ export default function TabController() {
|
|||
{data ? (
|
||||
<TableController
|
||||
data={data?.data}
|
||||
currentPage={currentPage}
|
||||
pageSize={pageSize}
|
||||
currentPage ={currentPage}
|
||||
pageSize ={pageSize}
|
||||
/>
|
||||
) : (
|
||||
<div className="flex flex-col gap-3">
|
||||
|
|
@ -154,8 +150,6 @@ export default function TabController() {
|
|||
|
||||
{!isZero ? (
|
||||
<Pagination
|
||||
TotalPages={totalPages}
|
||||
currentPage={currentPage - 1}
|
||||
countPage={totalCount}
|
||||
Page={(num: number) => setPage(num + 1)}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export default function TableController({
|
|||
|
||||
return (
|
||||
<div>
|
||||
<Table className="border-[1px] border-solid border-muted rounded-md w-full min-w-[40rem] overflow-y-auto scrollbar-thumb-gray-600 scrollbar-track-gray-100 scrollbar-thin mb-20">
|
||||
<Table className="border-[1px] border-solid border-muted rounded-md w-full min-w-[40rem] overflow-y-auto scrollbar-thumb-gray-600 scrollbar-track-gray-100 scrollbar-thin">
|
||||
{/* <TableCaption>A list of your recent invoices.</TableCaption> */}
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
|
|
@ -110,7 +110,7 @@ export default function TableController({
|
|||
</TableRow>
|
||||
);
|
||||
})}
|
||||
{/* {data.length != 0 &&
|
||||
{data.length != 0 &&
|
||||
[...Array(5 - data.length)].map(() => {
|
||||
return (
|
||||
<TableRow
|
||||
|
|
@ -118,7 +118,7 @@ export default function TableController({
|
|||
className="border border-t-0 border-b-0"
|
||||
/>
|
||||
);
|
||||
})} */}
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|||
className={cn(
|
||||
`flex w-full rounded-md border border-input px-3 py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50
|
||||
text-black text-opacity-50 text-xs font-normal bg-slate-200 mb-3
|
||||
h-10 transition-all
|
||||
3xl:h-9 h-10 transition-all
|
||||
hover:bg-slate-300 hover:cursor-pointer focus:cursor-auto
|
||||
focus:outline-4 focus:outline-slate-300 focus:bg-slate-200
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.9",
|
||||
"version": "0.2.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sootzani",
|
||||
"version": "0.2.9",
|
||||
"version": "0.2.7",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.3.2",
|
||||
"@radix-ui/react-alert-dialog": "^1.0.5",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "sootzani",
|
||||
"version": "0.2.9",
|
||||
"version": "0.2.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export async function getComplaintsList({
|
|||
states = 0,
|
||||
TrackingNumber,
|
||||
PageNumber = 1,
|
||||
PageSize = 10,
|
||||
PageSize = 5,
|
||||
}: {
|
||||
states: number;
|
||||
TrackingNumber?: string;
|
||||
|
|
|
|||
Loading…
Reference in New Issue