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