ui edit
This commit is contained in:
@@ -69,7 +69,7 @@ export function DataTableDistruct<TData, TValue>({
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={columns.length} className="h-24 text-center">
|
||||
No results.
|
||||
Tuman mavjud emas
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
|
||||
@@ -191,12 +191,8 @@ export default function District() {
|
||||
|
||||
return (
|
||||
<DashboardLayout>
|
||||
<div className="space-y-6">
|
||||
<>
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold text-foreground">Tumanlar</h1>
|
||||
<p className="text-muted-foreground mt-1">Tumanlarni boshqarish</p>
|
||||
</div>
|
||||
<Dialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<AddedButton onClick={() => form.reset({ name: "" })} />
|
||||
@@ -260,7 +256,7 @@ export default function District() {
|
||||
</Dialog>
|
||||
</div>
|
||||
|
||||
<div className="space-y-6 mt-5">
|
||||
<div className="space-y-6">
|
||||
<h1 className="text-3xl font-bold">Tumanlar ro‘yxati</h1>
|
||||
|
||||
{/* Loading state */}
|
||||
@@ -282,7 +278,7 @@ export default function District() {
|
||||
<p className="text-gray-500">Tumanlar mavjud emas</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
||||
<Dialog open={deleteDialog} onOpenChange={setDeleteDialog}>
|
||||
<DialogContent>
|
||||
|
||||
@@ -69,7 +69,7 @@ export function DataTable<TData, TValue>({
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={columns.length} className="h-24 text-center">
|
||||
No results.
|
||||
Shifokor mavjud emas
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
|
||||
@@ -4,16 +4,18 @@ import { useMutation } from "@tanstack/react-query";
|
||||
import type { AxiosError } from "axios";
|
||||
import clsx from "clsx";
|
||||
import {
|
||||
Banknote,
|
||||
Calendar,
|
||||
Clipboard,
|
||||
FileText,
|
||||
HomeIcon,
|
||||
Layers,
|
||||
List,
|
||||
MapPin,
|
||||
Syringe,
|
||||
Loader2,
|
||||
MapPinCheck,
|
||||
MapPinHouse,
|
||||
MapPinned,
|
||||
Pill,
|
||||
User,
|
||||
} from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { toast } from "sonner";
|
||||
|
||||
@@ -31,7 +33,7 @@ const navItems: NavItem[] = [
|
||||
id: "lokatsiya",
|
||||
title: "Lokatsiya jo'natish",
|
||||
link: "/location",
|
||||
icon: <MapPin className="w-8 h-8" />,
|
||||
icon: <MapPinCheck className="w-8 h-8" />,
|
||||
description: "Manzilni jo'natish",
|
||||
featured: true,
|
||||
},
|
||||
@@ -56,12 +58,14 @@ const navItems: NavItem[] = [
|
||||
export default function Home() {
|
||||
const featuredItems = navItems.filter((item) => item.featured);
|
||||
const router = useNavigate();
|
||||
const [locationLoad, setLocationLoad] = useState<boolean>(false);
|
||||
|
||||
const { mutate } = useMutation({
|
||||
mutationFn: (body: SendLocation) => location_api.send_loaction(body),
|
||||
onSuccess: () => {
|
||||
toast.success("Lokatsiya jo'natildi");
|
||||
router("/location");
|
||||
setLocationLoad(false);
|
||||
},
|
||||
onError: (error: AxiosError) => {
|
||||
const data = error.response?.data as { message?: string };
|
||||
@@ -77,6 +81,7 @@ export default function Home() {
|
||||
name: string[];
|
||||
};
|
||||
};
|
||||
setLocationLoad(false);
|
||||
|
||||
const message =
|
||||
Array.isArray(errorName.data?.name) && errorName.data.name.length
|
||||
@@ -92,6 +97,7 @@ export default function Home() {
|
||||
});
|
||||
|
||||
const handleLocationClick = () => {
|
||||
setLocationLoad(true);
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(pos) => {
|
||||
mutate({
|
||||
@@ -125,41 +131,48 @@ export default function Home() {
|
||||
<div className="px-4 sm:px-6 mt-5 lg:px-4 bg-background">
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<p className="text-md font-bold text-black mb-5 uppercase">Asosiy</p>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-5">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
{featuredItems.map((item) => {
|
||||
const isLocation = item.id === "lokatsiya";
|
||||
const specification = item.id === "spetsifikatsiya";
|
||||
const tourPlan = item.id === "tour_plan";
|
||||
|
||||
return (
|
||||
<div
|
||||
key={item.id}
|
||||
onClick={isLocation ? handleLocationClick : undefined}
|
||||
className="group relative px-4 cursor-pointer"
|
||||
className="group relative cursor-pointer flex justify-start"
|
||||
>
|
||||
{!isLocation ? (
|
||||
<Link to={item.link} className="absolute inset-0"></Link>
|
||||
<Link
|
||||
to={item.link}
|
||||
className="absolute inset-0 z-50"
|
||||
></Link>
|
||||
) : null}
|
||||
|
||||
<div
|
||||
className={clsx(
|
||||
"flex items-start gap-6 pb-2 border-b border-border hover:border-primary/30 transition-colors",
|
||||
isLocation && "shadow-sm p-2 rounded-xl scale-[115%]",
|
||||
"flex rounded-xl shadow-sm items-start gap-2 border-b p-2 pb-2 border-border hover:border-primary/30 transition-colors",
|
||||
isLocation
|
||||
? "w-full"
|
||||
: specification
|
||||
? "w-[95%]"
|
||||
: tourPlan && "w-[85%]",
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={clsx(
|
||||
"shrink-0 w-12 h-12 rounded-lg text-primary flex items-center justify-center",
|
||||
isLocation && "bg-primary text-white",
|
||||
"shrink-0 w-12 h-12 rounded-lg flex items-center justify-center bg-primary text-white",
|
||||
)}
|
||||
>
|
||||
{item.icon}
|
||||
{isLocation && locationLoad ? (
|
||||
<Loader2 className="animate-spin" />
|
||||
) : (
|
||||
item.icon
|
||||
)}
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<h3
|
||||
className={clsx(
|
||||
"text-lg font-bold text-foreground",
|
||||
isLocation && "text-primary",
|
||||
)}
|
||||
>
|
||||
<h3 className={clsx("text-lg font-bold text-primary")}>
|
||||
{item.title}
|
||||
</h3>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
@@ -210,7 +223,7 @@ export default function Home() {
|
||||
<Link to={"/district"} className="border border-border rounded-lg">
|
||||
<div className="flex flex-col items-center text-center p-4">
|
||||
<div className="text-primary/60 group-hover:text-primary transition-colors mb-3">
|
||||
<Layers className="w-6 h-6" />
|
||||
<MapPinned className="w-6 h-6" />
|
||||
</div>
|
||||
<h4 className="font-semibold text-foreground text-sm">Tuman</h4>
|
||||
</div>
|
||||
@@ -218,7 +231,7 @@ export default function Home() {
|
||||
<Link to={"/object"} className="border border-border rounded-lg">
|
||||
<div className="flex flex-col items-center text-center p-4">
|
||||
<div className="text-primary/60 group-hover:text-primary transition-colors mb-3">
|
||||
<HomeIcon className="w-6 h-6" />
|
||||
<MapPinHouse className="w-6 h-6" />
|
||||
</div>
|
||||
<h4 className="font-semibold text-foreground text-sm">
|
||||
Obyekt
|
||||
@@ -242,7 +255,7 @@ export default function Home() {
|
||||
<Link to={"/pharmacy"} className="border border-border rounded-lg">
|
||||
<div className="flex flex-col items-center text-center p-4">
|
||||
<div className="text-primary/60 group-hover:text-primary transition-colors mb-3">
|
||||
<Syringe className="w-6 h-6" />
|
||||
<Pill className="w-6 h-6" />
|
||||
</div>
|
||||
<h4 className="font-semibold text-foreground text-sm">
|
||||
Dorixona
|
||||
@@ -257,10 +270,10 @@ export default function Home() {
|
||||
>
|
||||
<div className="flex flex-col items-center text-center p-4">
|
||||
<div className="text-primary/60 group-hover:text-primary transition-colors mb-3">
|
||||
<Clipboard className="w-14 h-14" />
|
||||
<Banknote className="w-14 h-14" />
|
||||
</div>
|
||||
<h4 className="font-semibold text-foreground text-lg">
|
||||
Hisobotlar
|
||||
To'lovlar
|
||||
</h4>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
@@ -346,7 +346,7 @@ const MyLocation: React.FC = () => {
|
||||
colSpan={columns.length}
|
||||
className="h-24 text-center"
|
||||
>
|
||||
No results.
|
||||
Hech qanday lokatsiya jo'natilmagan
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
|
||||
@@ -69,7 +69,7 @@ export function DataTableObject<ObjectAllData, TValue>({
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={columns.length} className="h-24 text-center">
|
||||
No results.
|
||||
Obyekt mavjud emas
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/shared/ui/dialog";
|
||||
import { Skeleton } from "@/shared/ui/skeleton";
|
||||
import { DashboardLayout } from "@/widgets/dashboard-layout/ui/DashboardLayout";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useState } from "react";
|
||||
@@ -80,16 +81,22 @@ const ObjectList = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!isLoading && !isError && objects && objects.length > 0 && (
|
||||
{isLoading ? (
|
||||
<div className="space-y-3">
|
||||
{[1, 2, 3].map((i) => (
|
||||
<Skeleton key={i} className="h-12 w-full rounded-md" />
|
||||
))}
|
||||
</div>
|
||||
) : isError ? (
|
||||
<p className="text-red-500">
|
||||
Tumanlar yuklanmadi. Qayta urinib ko‘ring.
|
||||
</p>
|
||||
) : objects ? (
|
||||
<div className="overflow-x-auto">
|
||||
<DataTableObject columns={columns} data={objects} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!isLoading && !isError && objects && objects.length === 0 && (
|
||||
<div className="flex justify-center items-center h-64">
|
||||
<span className="text-gray-500">Hech qanday obyekt topilmadi.</span>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-gray-500">Tumanlar mavjud emas</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ const PharmacyList = () => {
|
||||
)}
|
||||
|
||||
{!isLoading && !isError && data?.length === 0 && (
|
||||
<div className="flex justify-center items-center py-20">
|
||||
<p className="text-gray-500">Hech qanday dorixona topilmadi</p>
|
||||
<div className="h-[80vh] flex justify-center items-center w-[90%] fixed">
|
||||
<p>Dorixona mavjud emas</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -92,10 +92,10 @@ const PlanTour = () => {
|
||||
<DashboardLayout>
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<h1 className="text-4xl font-bold text-gray-900 mb-2">
|
||||
Oylik hisobotlar
|
||||
Oylik to'lovlar
|
||||
</h1>
|
||||
<p className="text-gray-600">
|
||||
Dorixonalar uchun oylik summalarni boshqaring
|
||||
Dorixonalar uchun oylik to'lovlarni boshqaring
|
||||
</p>
|
||||
|
||||
{isLoading && (
|
||||
@@ -110,40 +110,48 @@ const PlanTour = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Card className="mb-4 border-0 p-0 mt-5">
|
||||
<CardHeader className="bg-blue-500 p-3 text-white">
|
||||
<CardTitle className="flex items-center gap-2 justify-center">
|
||||
<Calendar className="h-5 w-5" />
|
||||
Oy tanlash
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
{!isLoading && !isError && data && data.length === 0 ? (
|
||||
<div className="h-[80vh] flex justify-center items-center w-[90%] fixed">
|
||||
<p>Hech qanday to'lovlar yo'q</p>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<Card className="mb-4 border-0 p-0 mt-5">
|
||||
<CardHeader className="bg-blue-500 p-3 text-white">
|
||||
<CardTitle className="flex items-center gap-2 justify-center">
|
||||
<Calendar className="h-5 w-5" />
|
||||
Oy tanlash
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className="pb-6">
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{availableMonths().map((month) => (
|
||||
<Button
|
||||
key={month}
|
||||
onClick={() => setSelectedMonth(month)}
|
||||
variant={selectedMonth === month ? "default" : "outline"}
|
||||
className={
|
||||
selectedMonth === month
|
||||
? "bg-blue-600 hover:bg-blue-700 text-white"
|
||||
: "hover:bg-blue-50"
|
||||
}
|
||||
>
|
||||
{getMonthName(month)}
|
||||
{month === currentMonthKey && (
|
||||
<span className="ml-2 text-xs bg-green-500 text-white px-2 py-0.5 rounded-full">
|
||||
Joriy
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<CardContent className="pb-6">
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{availableMonths().map((month) => (
|
||||
<Button
|
||||
key={month}
|
||||
onClick={() => setSelectedMonth(month)}
|
||||
variant={selectedMonth === month ? "default" : "outline"}
|
||||
className={
|
||||
selectedMonth === month
|
||||
? "bg-blue-600 hover:bg-blue-700 text-white"
|
||||
: "hover:bg-blue-50"
|
||||
}
|
||||
>
|
||||
{getMonthName(month)}
|
||||
{month === currentMonthKey && (
|
||||
<span className="ml-2 text-xs bg-green-500 text-white px-2 py-0.5 rounded-full">
|
||||
Joriy
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<PlanPrice selectedMonth={selectedMonth} pharmacies={pharmacies} />
|
||||
<PlanPrice selectedMonth={selectedMonth} pharmacies={pharmacies} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</DashboardLayout>
|
||||
);
|
||||
|
||||
@@ -125,9 +125,9 @@ export function HistoryListPage() {
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<p className="text-center text-gray-500 py-10">
|
||||
{"Hozircha ma'lumot yo‘q."}
|
||||
</p>
|
||||
<div className="fixed h-[70vh] flex justify-center items-center w-full">
|
||||
<p className="text-gray-500">{"Hozircha ma'lumot yo‘q."}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,7 +65,7 @@ export function DataTable({ columns, data }: DataTableProps<TourItemData>) {
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell colSpan={columns.length} className="h-24 text-center">
|
||||
No results.
|
||||
Bu oy uchun tur plan mavjud emas
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user