Skip to content

Commit d5a1c14

Browse files
Merge pull request #66 from REACT-DEVELOPER-IBROKHIM/fix/ac-issues
fix:ac issues with style and signature single use
2 parents da1c090 + 889bbba commit d5a1c14

File tree

10 files changed

+90
-54
lines changed

10 files changed

+90
-54
lines changed

client/src/api/upload/index.js

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { resolve } from "../../helpers/resolve-response";
2-
import axios from "@api";
32

43
export async function uploadSignature(id, type, file) {
5-
console.log("id", id);
6-
console.log("type", type);
7-
console.log("file", file.get("file"));
84
const authResponse = await resolve(
95
fetch(
106
"https://lionfish-app-3v9xf.ondigitalocean.app/api/upload/signature?id=" +

client/src/assets/images/flag.png

13.7 KB
Loading

client/src/components/documents/adr/back/AdrCertificateBack.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ const AdrCertificateBack = ({ type }) => {
1111
ДЕЙСТВИТЕЛЬНОВОТНОШЕНИИ ВЕЩЕСТВКЛАССА(ОВ) ИЛИ№ООН
1212
</p>
1313
<div className="font-bold">
14-
<div className="flex justify-between items-center mt-[50px]">
14+
<div className="flex justify-between items-center mt-[50px]">
1515
<div className="w-[50%] h-[100px] text-[60px] flex items-end justify-center">
1616
9. In tank
1717
</div>
1818
<div className="w-[50%] h-[100px] text-[60px] flex items-end justify-center">
1919
10. Other than in tank
2020
</div>
2121
</div>
22-
<div className="border-t-8 border-black w-full h-[700px] flex font-black text-[50px] text-left">
22+
<div className="border-t-8 border-black w-full h-[630px] flex font-black text-[50px] text-left">
2323
<div className="w-[50%] h-full border-r-[3px] border-black px-[100px] flex flex-col gap-[10px] pt-[50px]">
2424
<p>2</p>
2525
<p>3</p>

client/src/components/documents/adr/front/AdrCertificate.jsx

+21-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import QRCode from "react-qr-code";
2+
import flag from "@assets/images/flag.png";
23

34
const AdrCertificateFront = ({ document, type }) => {
45
const { name, surname, to, birthDate, id, signature } = document;
@@ -16,32 +17,44 @@ const AdrCertificateFront = ({ document, type }) => {
1617
UZ
1718
</div>
1819
<p className="text-[50px] font-bold ml-[-200px]">1.Nr. {id}</p>
19-
<div className="bg-blue-500 text-white text-[50px] py-[25px] px-[40px] flex items-center justify-center rounded-ee-[30px] rounded-ss-[30px]">
20-
NT2022
20+
<div>
21+
{Number(id) > 891 && (
22+
<img src={flag} alt="NT2022" className="w-[200px]" />
23+
)}
24+
{Number(id) <= 891 && (
25+
<div className="bg-blue-500 text-white text-[50px] py-[25px] px-[40px] flex items-center justify-center rounded-ee-[30px] rounded-ss-[30px]">
26+
NT2022
27+
</div>
28+
)}
2129
</div>
2230
</div>
23-
<div className="h-[600px] flex justify-between items-center mt-[30px] gap-[30px]">
31+
<div className="h-[570px] flex items-center mt-[60px] gap-[30px]">
2432
<div className="h-full aspect-[3/4] bg-white border-[2px] border-black"></div>
25-
<div className="h-full bg-blue font-bold text-left text-[50px] flex flex-col gap-[20px] flex-1">
33+
<div className="h-full bg-blue font-bold text-left text-[50px] flex flex-col gap-[20px]">
2634
<p>2.{name}</p>
2735
<p>3.{surname}</p>
2836
<p>4.{birthDate}</p>
2937
<p>5.REPUBLIC OF UZBEKISTAN</p>
3038
<p>6.NAMANGANTRANS 2022</p>
3139
<p>Until (date) {to}</p>
32-
<div className="w-[400px] h-[130px] bg-white border-[2px] border-black">
40+
<div className="w-[300px] h-[100px] bg-white border-[2px] border-black">
3341
<img
3442
width={"100%"}
3543
height={"80%"}
3644
src={signature}
3745
alt=""
38-
className="scale-75"
46+
className="scale-[0.7]"
3947
/>
4048
</div>
4149
</div>
42-
<div className="h-full flex items-end justify-start">
50+
<div className="h-full flex flex-col items-end justify-end">
51+
{Number(id) > 891 && (
52+
<div className="bg-blue-500 text-white text-[35px] py-[25px] px-[40px] flex items-center justify-center rounded-ee-[30px] rounded-ss-[30px] mb-[40px]">
53+
NT2022
54+
</div>
55+
)}
4356
<QRCode
44-
className="mb-[30px]"
57+
className="mb-[20px]"
4558
value={`https://www.xalqarologistika.uz/check-certificates/${id}`}
4659
/>
4760
</div>

client/src/components/documents/driver/bottom/DriverCertificateBottom.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const DriverCertificateBottom = ({ document, type }) => {
77

88
return (
99
type !== "search" && (
10-
<div className="w-[2480px] h-[3508px] bg-[#fff8eb] p-[30px]">
10+
<div className="w-[2480px] h-[3508px] bg-[#fff8eb] p-[50px]">
1111
<div className="w-full h-full border-[12px] border-indigo-500">
1212
<div className="w-[100%] h-[100%] px-[60px] flex">
1313
<div className="w-[20%] h-full relative">
@@ -85,7 +85,7 @@ const DriverCertificateBottom = ({ document, type }) => {
8585
Регистрационный номер:{"№" + id}
8686
</p>
8787
</div>
88-
<div className="text-[50px] mt-[530px]">
88+
<div className="text-[50px] mt-[510px]">
8989
<span className="font-bold">
9090
{summarizeName(name, surname, middlename)}
9191
</span>{" "}

client/src/components/documents/driver/mini/bottom/index.jsx

+12-10
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ const MiniCertificateBottom = ({ document, type, certType }) => {
1818
</p>
1919
)}
2020
<p className="text-[45px] mt-[50px] font-bold">MO №{id}</p>
21-
<p className="text-[45px] border-b-[1px] border-black mt-[40px] uppercase w-full">
21+
<p className="text-[45px] border-b-[1px] font-semibold border-black mt-[40px] uppercase w-full">
2222
{summarizeName(
2323
name,
2424
surname,
2525
certType === "adr" ? "" : middlename,
2626
)}
2727
</p>
28-
<p className="text-[45px] border-b-[1px] border-black mt-[60px] uppercase w-full">
28+
<p className="text-[45px] border-b-[1px] border-black font-semibold mt-[60px] uppercase w-full">
2929
{certType === "adr" ? "АДР" : "36 часов"}
3030
</p>
3131
<p className="text-[40px] mt-[10px]">
@@ -49,10 +49,10 @@ const MiniCertificateBottom = ({ document, type, certType }) => {
4949
</div>
5050
</div>
5151
<div className="w-[60%]">
52-
<p className="text-[45px] mt-[70px]">
52+
<p className="text-[40px] mt-[70px] font-semibold">
5353
OOO "NAMANGANTRANS 2022"
5454
</p>
55-
<p className="text-[35px] border-b-[1px] border-black mt-[50px] font-bold w-full">
55+
<p className="text-[35px] border-b-[1px] border-black mt-[100px] font-bold w-full">
5656
выдан: {from}
5757
</p>
5858
<p className="text-[35px] border-b-[1px] border-black mt-[50px] font-bold w-full">
@@ -70,34 +70,36 @@ const MiniCertificateBottom = ({ document, type, certType }) => {
7070
The implementation of international automobile transportation
7171
</p>
7272
<p className="text-[45px] mt-[50px] font-bold">MO №{id}</p>
73-
<p className="text-[45px] border-b-[1px] border-black mt-[40px] uppercase w-full">
73+
<p className="text-[45px] border-b-[1px] font-semibold border-black mt-[40px] uppercase w-full">
7474
{summarizeName(
7575
name,
7676
surname,
7777
certType === "adr" ? "" : middlename,
7878
)}
7979
</p>
80-
<p className="text-[45px] border-b-[1px] border-black mt-[60px] uppercase w-full">
80+
<p className="text-[45px] border-b-[1px] border-black mt-[60px] font-semibold uppercase w-full">
8181
{certType === "adr" ? "ADR" : "36 hours"}
8282
</p>
8383
<p className="text-[40px] mt-[10px]">
8484
This certificate that he completed training course on special
8585
program
8686
</p>
87-
<p className="text-[40px] mt-[30px] italic">
87+
<p className="text-[40px] mt-[105px] italic">
8888
{certType === "adr"
8989
? "Certificate of Professional Competence in the Transport of Dangerous Goods by Road (ADR)"
90-
: " Organization and implementation of international automobile transportation"}
90+
: "Organization and implementation of international automobile transportation"}
9191
</p>
92-
<div className="w-full my-[125px]">
92+
<div
93+
className={`w-full ${certType !== "adr" ? "mt-[125px]" : "mt-[160px]"}`}
94+
>
9395
<p className="text-[35px] border-b-[1px] border-black mt-[50px] font-bold w-full">
9496
issued: {from}
9597
</p>
9698
<p className="text-[35px] border-b-[1px] border-black mt-[50px] font-bold w-full">
9799
valid: {to}
98100
</p>
99101
</div>
100-
<p className="text-[50px] mt-[30px]">
102+
<p className="text-[50px] mt-[130px]">
101103
Director: OOO "NAMANGANTRANS 2022" B.Muhidinov
102104
</p>
103105
</div>

client/src/components/documents/driver/top/DriverCertificateTop.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const DriverCertificateTop = ({ document }) => {
66
const { id, name, surname, middlename, from, to } = document;
77

88
return (
9-
<div className="w-[2480px] h-[3508px] bg-[#fff8eb] p-[30px]">
9+
<div className="w-[2480px] h-[3508px] bg-[#fff8eb] p-[50px]">
1010
<div className="w-full h-full border-[12px] border-indigo-500">
1111
<div className="w-[100%] h-[100%] px-[60px] flex">
1212
<div className="w-[20%] h-full relative">
@@ -79,7 +79,7 @@ const DriverCertificateTop = ({ document }) => {
7979
Qayd raqami:{"№" + id}
8080
</p>
8181
</div>
82-
<div className="text-[50px] mt-[560px]">
82+
<div className="text-[50px] mt-[540px]">
8383
<span className="font-bold">
8484
{summarizeName(name, surname, middlename)}
8585
</span>

client/src/routes/admin/Admin.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const Admin = () => {
5656
<Header className="px-4 bg-white shadow-xl flex items-center text-xl font-semibold">
5757
{pathname === "/admin" ? t("services.create") : t("services.manage")}
5858
</Header>
59-
<Content className="p-4">
59+
<Content className="flex flex-col p-4">
6060
<Outlet />
6161
</Content>
6262
</Layout>

client/src/routes/signature-upload/index.jsx

+48-23
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
1-
import React, { useRef, useState } from "react";
1+
import React, { useEffect, useRef, useState } from "react";
22
import { useNavigate, useParams } from "react-router-dom";
33
import SignatureCanvas from "react-signature-canvas";
4-
import { Button, message, Spin } from "antd";
4+
import { Button, message, Spin, Typography } from "antd";
55
import { uploadSignatureThunk } from "@thunks/upload-thunk";
6-
import { useDispatch } from "react-redux";
6+
import { useDispatch, useSelector } from "react-redux";
7+
import { getSingleDocument, getSingleDocumentLoading } from "@/redux/selectors";
8+
import { fetchSingleDocumentThunk } from "@/redux/thunks/single-document-thunk";
9+
import { removeCurrentDocument } from "@/redux/slices/single-document";
10+
11+
const { Title } = Typography;
712

813
const SignatureUpload = () => {
14+
const document = useSelector(getSingleDocument);
15+
const documentLoading = useSelector(getSingleDocumentLoading);
916
const [loading, setLoading] = useState(false);
1017
const dispatch = useDispatch();
1118
const signatureRef = useRef(null);
1219
const { id } = useParams();
1320
const navigate = useNavigate();
1421

22+
useEffect(() => {
23+
if (id) {
24+
dispatch(
25+
fetchSingleDocumentThunk({
26+
endpoint: id?.split("-")[0],
27+
id: id?.split("-")[1],
28+
}),
29+
);
30+
}
31+
}, [id]);
32+
1533
const handleSave = () => {
1634
const signature = signatureRef.current
1735
.getTrimmedCanvas()
@@ -42,6 +60,7 @@ const SignatureUpload = () => {
4260
},
4361
}),
4462
);
63+
dispatch(removeCurrentDocument());
4564
};
4665

4766
const handleReset = () => {
@@ -50,28 +69,34 @@ const SignatureUpload = () => {
5069

5170
return (
5271
<div className="max-w-[500px] mx-auto h-screen flex flex-col gap-[20px] justify-center items-center">
53-
{loading ? (
54-
<Spin />
72+
{document?.signature ? (
73+
<Title level={4}>Sizning imzongiz mavjud</Title>
5574
) : (
5675
<>
57-
{" "}
58-
<SignatureCanvas
59-
ref={signatureRef}
60-
penColor="black"
61-
canvasProps={{
62-
width: 500,
63-
height: 200,
64-
className: "border-2 border-black",
65-
}}
66-
/>
67-
<div className="flex gap-4">
68-
<Button type="primary" disabled={loading} onClick={handleSave}>
69-
Saqlash
70-
</Button>
71-
<Button type="default" disabled={loading} onClick={handleReset}>
72-
Qaytadan chizish
73-
</Button>
74-
</div>
76+
{loading || documentLoading ? (
77+
<Spin />
78+
) : (
79+
<>
80+
{" "}
81+
<SignatureCanvas
82+
ref={signatureRef}
83+
penColor="black"
84+
canvasProps={{
85+
width: 500,
86+
height: 200,
87+
className: "border-2 border-black",
88+
}}
89+
/>
90+
<div className="flex gap-4">
91+
<Button type="primary" disabled={loading} onClick={handleSave}>
92+
Saqlash
93+
</Button>
94+
<Button type="default" disabled={loading} onClick={handleReset}>
95+
Qaytadan chizish
96+
</Button>
97+
</div>
98+
</>
99+
)}
75100
</>
76101
)}
77102
</div>

client/src/routes/sub-routes/status/index.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ const { Search } = Input;
55

66
const Status = () => {
77
return (
8-
<div className="flex flex-col">
8+
<div className="flex flex-1 flex-col">
99
<nav className="bg-white flex items-center shadow-3xl mb-4 p-2 px-8">
1010
<Search placeholder="Search certificates" enterButton />
1111
</nav>
12-
<section className="p-4 bg-white shadow-3xl">
12+
<section className="p-4 bg-white shadow-3xl flex-1">
1313
<Outlet />
1414
</section>
1515
</div>

0 commit comments

Comments
 (0)