Compare commits
3 Commits
9d84fc38f3
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6580761cdd | ||
|
|
19d86d619b | ||
|
|
cbbe2f83e2 |
@@ -8,7 +8,6 @@ import {
|
|||||||
Banknote,
|
Banknote,
|
||||||
Calendar,
|
Calendar,
|
||||||
FileText,
|
FileText,
|
||||||
List,
|
|
||||||
Loader2,
|
Loader2,
|
||||||
MapPinCheck,
|
MapPinCheck,
|
||||||
MapPinHouse,
|
MapPinHouse,
|
||||||
@@ -46,14 +45,14 @@ const navItems: NavItem[] = [
|
|||||||
description: "Hujjatlar",
|
description: "Hujjatlar",
|
||||||
featured: true,
|
featured: true,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
id: "tour_plan",
|
// id: "tour_plan",
|
||||||
title: "Tur plan",
|
// title: "Tur plan",
|
||||||
link: "/tour-plan",
|
// link: "/tour-plan",
|
||||||
icon: <List className="w-6 h-6" />,
|
// icon: <List className="w-6 h-6" />,
|
||||||
description: "Rejalar",
|
// description: "Rejalar",
|
||||||
featured: true,
|
// featured: true,
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
export interface CreatePharmacyReq {
|
export interface CreatePharmacyReq {
|
||||||
name: string;
|
name: string;
|
||||||
inn: string;
|
inn?: string;
|
||||||
owner_phone: string;
|
owner_phone: string;
|
||||||
responsible_phone: string;
|
responsible_phone?: string;
|
||||||
district_id: number;
|
district_id: number;
|
||||||
place_id: number;
|
place_id: number;
|
||||||
longitude: number;
|
longitude: number;
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ export const objectForm = z.object({
|
|||||||
}),
|
}),
|
||||||
latitude: z.number({ error: "Majburiy maydon" }),
|
latitude: z.number({ error: "Majburiy maydon" }),
|
||||||
longitude: z.number({ error: "Majburiy maydon" }),
|
longitude: z.number({ error: "Majburiy maydon" }),
|
||||||
inn: z.string().min(1, { message: "Majburiy maydon" }),
|
inn: z.string().optional(),
|
||||||
phoneDirector: z.string().min(17, { message: "Majburiy maydon" }),
|
phoneDirector: z.string().min(17, { message: "Majburiy maydon" }),
|
||||||
phonePharmacy: z.string().min(17, { message: "Majburiy maydon" }),
|
phonePharmacy: z.string().optional(),
|
||||||
nearbyCoords: z
|
nearbyCoords: z
|
||||||
.array(
|
.array(
|
||||||
z.object({
|
z.object({
|
||||||
|
|||||||
@@ -218,13 +218,15 @@ const CreatePharmacy = () => {
|
|||||||
latitude: values.latitude,
|
latitude: values.latitude,
|
||||||
longitude: values.longitude,
|
longitude: values.longitude,
|
||||||
},
|
},
|
||||||
inn: values.inn,
|
...(values.inn && { inn: values.inn }),
|
||||||
latitude: values.latitude,
|
latitude: values.latitude,
|
||||||
longitude: values.longitude,
|
longitude: values.longitude,
|
||||||
name: values.name,
|
name: values.name,
|
||||||
owner_phone: onlyNumber(values.phoneDirector),
|
owner_phone: onlyNumber(values.phoneDirector),
|
||||||
place_id: Number(values.streets),
|
place_id: Number(values.streets),
|
||||||
responsible_phone: onlyNumber(values.phonePharmacy),
|
...(values.phonePharmacy && {
|
||||||
|
responsible_phone: onlyNumber(values.phonePharmacy),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export interface CreatePlansReq {
|
export interface CreatePlansReq {
|
||||||
title: string;
|
title?: string;
|
||||||
description: string;
|
description: string;
|
||||||
date: string; // "2025-12-05";
|
date: string; // "2025-12-05";
|
||||||
doctor_id: number | null;
|
doctor_id: number | null;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
export const plansForm = z.object({
|
export const plansForm = z.object({
|
||||||
title: z.string().min(1, { error: "Majburiy maydon" }),
|
title: z.string().optional(),
|
||||||
description: z.string().min(1, { error: "Majburiy maydon" }),
|
description: z.string().min(1, { error: "Majburiy maydon" }),
|
||||||
date: z.string().optional(),
|
date: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export function PlanDetailsDialog({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Title */}
|
{/* Title */}
|
||||||
<div className="space-y-1">
|
{/* <div className="space-y-1">
|
||||||
<p className="text-sm text-muted-foreground">Sarlavha</p>
|
<p className="text-sm text-muted-foreground">Sarlavha</p>
|
||||||
<p
|
<p
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@@ -121,14 +121,14 @@ export function PlanDetailsDialog({
|
|||||||
>
|
>
|
||||||
{task.title}
|
{task.title}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
{/* Description */}
|
{/* Description */}
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<p className="text-sm text-muted-foreground">Tavsifi</p>
|
<p className="text-sm text-muted-foreground">Tavsifi</p>
|
||||||
<p
|
<p
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"text-base leading-relaxed",
|
"text-lg font-semibold",
|
||||||
task.comment ? "text-green-500" : "text-foreground",
|
task.comment ? "text-green-500" : "text-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import z from "zod";
|
|||||||
import { plans_api } from "../lib/api";
|
import { plans_api } from "../lib/api";
|
||||||
|
|
||||||
const plansForm = z.object({
|
const plansForm = z.object({
|
||||||
title: z.string().min(1, "Sarlavha kiritish majburiy"),
|
title: z.string().optional(),
|
||||||
description: z.string().min(1, "Tavsif kiritish majburiy"),
|
description: z.string().min(1, "Tavsif kiritish majburiy"),
|
||||||
date: z.string().optional(),
|
date: z.string().optional(),
|
||||||
});
|
});
|
||||||
@@ -71,7 +71,7 @@ export const AddPlans = ({
|
|||||||
const form = useForm<z.infer<typeof plansForm>>({
|
const form = useForm<z.infer<typeof plansForm>>({
|
||||||
resolver: zodResolver(plansForm),
|
resolver: zodResolver(plansForm),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
title: "",
|
// title: "",
|
||||||
description: "",
|
description: "",
|
||||||
date: formatDate.format(new Date(), "YYYY-MM-DD"),
|
date: formatDate.format(new Date(), "YYYY-MM-DD"),
|
||||||
},
|
},
|
||||||
@@ -166,7 +166,7 @@ export const AddPlans = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (taskEdit) {
|
if (taskEdit) {
|
||||||
form.setValue("title", taskEdit.title);
|
// form.setValue("title", taskEdit.title);
|
||||||
form.setValue("description", taskEdit.description);
|
form.setValue("description", taskEdit.description);
|
||||||
form.setValue("date", taskEdit.date);
|
form.setValue("date", taskEdit.date);
|
||||||
}
|
}
|
||||||
@@ -195,6 +195,9 @@ export const AddPlans = ({
|
|||||||
if (taskEdit) {
|
if (taskEdit) {
|
||||||
edit({
|
edit({
|
||||||
body: {
|
body: {
|
||||||
|
...(values.title && {
|
||||||
|
title: values.title,
|
||||||
|
}),
|
||||||
date: values.date ? formatDate.format(values.date, "YYYY-MM-DD") : "",
|
date: values.date ? formatDate.format(values.date, "YYYY-MM-DD") : "",
|
||||||
description: values.description,
|
description: values.description,
|
||||||
doctor_id: doctorId ? doctorId.id : null,
|
doctor_id: doctorId ? doctorId.id : null,
|
||||||
@@ -221,12 +224,14 @@ export const AddPlans = ({
|
|||||||
: pharmId
|
: pharmId
|
||||||
? pharmId.longitude
|
? pharmId.longitude
|
||||||
: 63.123,
|
: 63.123,
|
||||||
title: values.title,
|
|
||||||
},
|
},
|
||||||
id: taskEdit.id,
|
id: taskEdit.id,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
added({
|
added({
|
||||||
|
...(values.title && {
|
||||||
|
title: values.title,
|
||||||
|
}),
|
||||||
date: values.date ? formatDate.format(values.date, "YYYY-MM-DD") : "",
|
date: values.date ? formatDate.format(values.date, "YYYY-MM-DD") : "",
|
||||||
description: values.description,
|
description: values.description,
|
||||||
doctor_id: doctorId ? doctorId.id : null,
|
doctor_id: doctorId ? doctorId.id : null,
|
||||||
@@ -253,7 +258,6 @@ export const AddPlans = ({
|
|||||||
: pharmId
|
: pharmId
|
||||||
? pharmId.longitude
|
? pharmId.longitude
|
||||||
: 63.123,
|
: 63.123,
|
||||||
title: values.title,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,6 +385,7 @@ export const AddPlans = ({
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="description"
|
name="description"
|
||||||
|
|||||||
@@ -203,24 +203,22 @@ export default function Plans() {
|
|||||||
>
|
>
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-3">
|
||||||
<div className="flex-1 flex flex-col">
|
<div className="flex-1 flex flex-col">
|
||||||
<h3
|
{/* <h3
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"font-semibold wrap-break-word",
|
"font-semibold wrap-break-word",
|
||||||
item.comment ? "text-green-500" : "text-foreground",
|
item.comment ? "text-green-500" : "text-foreground",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{item.title}
|
{item.title}
|
||||||
</h3>
|
</h3> */}
|
||||||
<p
|
<h3
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"text-sm wrap-break-word",
|
"font-semibold wrap-break-word",
|
||||||
item.comment
|
item.comment ? "text-green-500" : "text-foreground",
|
||||||
? "text-green-500"
|
|
||||||
: "text-muted-foreground",
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{item.description}
|
{item.description}
|
||||||
</p>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -33,4 +33,9 @@ export const order_api = {
|
|||||||
const res = await httpClient.patch(`${ORDER}${id}/update/`, body);
|
const res = await httpClient.patch(`${ORDER}${id}/update/`, body);
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async download_pdf(id: number) {
|
||||||
|
const res = await httpClient.get(`${ORDER}${id}/send_pdf/`);
|
||||||
|
return res;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ import { formatPrice } from "@/shared/lib/formatPrice";
|
|||||||
import { Button } from "@/shared/ui/button";
|
import { Button } from "@/shared/ui/button";
|
||||||
import { DashboardLayout } from "@/widgets/dashboard-layout/ui";
|
import { DashboardLayout } from "@/widgets/dashboard-layout/ui";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { Building2, User } from "lucide-react";
|
import { Building2, Loader2, User } from "lucide-react";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
|
||||||
export function DetailViewPage() {
|
export function DetailViewPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
const [pdfId, setPdfId] = useState<number | null>(null);
|
||||||
|
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
queryKey: ["order_list"],
|
queryKey: ["order_list"],
|
||||||
@@ -27,9 +30,32 @@ export function DetailViewPage() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: pdf,
|
||||||
|
isLoading,
|
||||||
|
isError,
|
||||||
|
error,
|
||||||
|
} = useQuery({
|
||||||
|
queryKey: ["download_pdf", pdfId],
|
||||||
|
queryFn: () => order_api.download_pdf(Number(pdfId!)),
|
||||||
|
enabled: !!pdfId,
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isError) {
|
||||||
|
toast.error(error.message || "Faylni yuklab olishda xatolik yuz berdi", {
|
||||||
|
richColors: true,
|
||||||
|
position: "top-center",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [isError]);
|
||||||
|
|
||||||
const item = data && data.find((h) => h.id === Number(id));
|
const item = data && data.find((h) => h.id === Number(id));
|
||||||
|
|
||||||
const handleDownloadPDF = async () => {};
|
const handleDownloadPDF = (id: number) => {
|
||||||
|
setPdfId(id);
|
||||||
|
console.log(pdf);
|
||||||
|
};
|
||||||
|
|
||||||
if (!item) return <div>{"Ma'lumot topilmadi"}</div>;
|
if (!item) return <div>{"Ma'lumot topilmadi"}</div>;
|
||||||
|
|
||||||
@@ -160,11 +186,11 @@ export function DetailViewPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleDownloadPDF}
|
onClick={() => handleDownloadPDF(item.id)}
|
||||||
className="w-full h-14 mt-5 text-md bg-green-600 hover:bg-green-700 text-white"
|
className="w-full h-14 mt-5 text-md bg-green-600 hover:bg-green-700 text-white"
|
||||||
size="lg"
|
size="lg"
|
||||||
>
|
>
|
||||||
Yuklab olish
|
{isLoading ? <Loader2 className="animate-spin" /> : "Yuklab olish"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</DashboardLayout>
|
</DashboardLayout>
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export function SpecificationPage() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const [selectedPharmacy, setSelectedPharmacy] = useState(
|
const [selectedPharmacy, setSelectedPharmacy] = useState(
|
||||||
data ? data[0].id : "",
|
data && data.length > 0 ? data[0].id : "",
|
||||||
);
|
);
|
||||||
|
|
||||||
// const [selectedPharm, setSelectedPharm] = useState(
|
// const [selectedPharm, setSelectedPharm] = useState(
|
||||||
@@ -104,7 +104,7 @@ export function SpecificationPage() {
|
|||||||
if (product) {
|
if (product) {
|
||||||
setMedicines(product?.map((m) => ({ ...m, quantity: 0 })));
|
setMedicines(product?.map((m) => ({ ...m, quantity: 0 })));
|
||||||
}
|
}
|
||||||
if (data) {
|
if (data && data.length > 0) {
|
||||||
setSelectedPharmacy(data[0].id);
|
setSelectedPharmacy(data[0].id);
|
||||||
}
|
}
|
||||||
// if (pharmacy) {
|
// if (pharmacy) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default defineConfig({
|
|||||||
port: 5174,
|
port: 5174,
|
||||||
host: true, // barcha hostlarga ruxsat
|
host: true, // barcha hostlarga ruxsat
|
||||||
allowedHosts: [
|
allowedHosts: [
|
||||||
"hampshire-blake-womens-ref.trycloudflare.com", // ngrok host qo'shildi
|
"spin-ronald-officers-reasonably.trycloudflare.com", // ngrok host qo'shildi
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user