Skip to content

Commit 3ede503

Browse files
Merge pull request #70 from REACT-DEVELOPER-IBROKHIM/feat/add-new-driver-certificate
Feat/add new driver certificate
2 parents ba8fea0 + 1d793a3 commit 3ede503

File tree

30 files changed

+598
-75
lines changed

30 files changed

+598
-75
lines changed

Diff for: client/src/api/upload/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import axios from "@api";
44
export async function uploadSignature(id, type, file) {
55
const authResponse = await resolve(
66
fetch(
7-
"https://lionfish-app-3v9xf.ondigitalocean.app/api/upload/signature?id=" +
7+
`${import.meta.env.VITE_API_URL}upload/signature?id=` +
88
id +
99
"&type=" +
1010
type,

Diff for: client/src/assets/images/silk-back.jpg

573 KB
Loading

Diff for: client/src/assets/images/silk-road.jpg

684 KB
Loading

Diff for: client/src/assets/images/wave.jpg

128 KB
Loading

Diff for: client/src/components/documents/adr/index.jsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@ import MiniCertificate from "../driver/mini";
77
const AdrCertificate = forwardRef(({ document, type }, ref) => {
88
return (
99
<div ref={ref}>
10-
<AdrCertificateFront type={type} document={document} ref={ref} />
10+
<AdrCertificateFront type={type} document={document} />
1111
<AdrCertificateBack type={type} tank={document?.tank} />
12-
<MiniCertificate
13-
document={document}
14-
type={type}
15-
certType="adr"
16-
ref={ref}
17-
/>
12+
<MiniCertificate document={document} type={type} certType="adr" />
1813
</div>
1914
);
2015
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import React from "react";
2+
import QRCode from "react-qr-code";
3+
4+
const DriverCardBack = ({ document }) => {
5+
const { to, id } = document;
6+
7+
return (
8+
<div className={`w-[2480px] h-[3498px] flex justify-center mt-[10px]`}>
9+
<div className="w-[1600px] h-[1000px] border-[6px] border-gray-400 mt-[10px] rounded-[50px] bg-silkBack bg-cover bg-no-repeat text-center px-[30px]">
10+
<p className="text-[45px] mt-[20px]">DRIVER QUALIFICATION CARD</p>
11+
<div className="flex justify-between p-[30px]">
12+
<div>
13+
<div className="text-[45px] text-left mt-[30px] flex flex-col gap-[15px]">
14+
<p>1.Номер сертификата</p>
15+
<p>2.Имя</p>
16+
<p>3.Фамилия</p>
17+
<p>4.Дата рождения</p>
18+
<p>5.Oтчество</p>
19+
<p>7.Категории транспортных средств</p>
20+
<p>8.Страна выдачи</p>
21+
<p>9.Организация-эмитент</p>
22+
</div>
23+
<QRCode
24+
className="mb-[20px] mt-[30px]"
25+
value={`https://www.xalqarologistika.uz/check-certificates/${id}`}
26+
/>
27+
</div>
28+
<div className="text-[45px]">
29+
<table className="border-2 border-black">
30+
<tr>
31+
<th className="px-[30px] border-2 border-black">
32+
Category <br /> Категории
33+
</th>
34+
<th className="px-[30px] border-2 border-black">
35+
Until <br /> До
36+
</th>
37+
</tr>
38+
<tr>
39+
<td className="px-[30px] border-2 border-black">C1</td>
40+
<td className="px-[30px] border-2 border-black"></td>
41+
</tr>
42+
<tr>
43+
<td className="px-[30px] border-2 border-black">C</td>
44+
<td className="px-[30px] border-2 border-black">{to}</td>
45+
</tr>
46+
<tr>
47+
<td className="px-[30px] border-2 border-black">D1</td>
48+
<td className="px-[30px] border-2 border-black"></td>
49+
</tr>
50+
<tr>
51+
<td className="px-[30px] border-2 border-black">D</td>
52+
<td className="px-[30px] border-2 border-black"></td>
53+
</tr>
54+
<tr>
55+
<td className="px-[30px] border-2 border-black">C1E</td>
56+
<td className="px-[30px] border-2 border-black"></td>
57+
</tr>
58+
<tr>
59+
<td className="px-[30px] border-2 border-black">CE</td>
60+
<td className="px-[30px] border-2 border-black">{to}</td>
61+
</tr>
62+
<tr>
63+
<td className="px-[30px] border-2 border-black">D1E</td>
64+
<td className="px-[30px] border-2 border-black"></td>
65+
</tr>
66+
<tr>
67+
<td className="px-[30px] border-2 border-black">DE</td>
68+
<td className="px-[30px] border-2 border-black"></td>
69+
</tr>
70+
</table>
71+
</div>
72+
</div>
73+
</div>
74+
</div>
75+
);
76+
};
77+
78+
export default DriverCardBack;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React from "react";
2+
import flag from "@assets/images/flag.png";
3+
4+
const DriverCardFront = ({ document }) => {
5+
const { name, surname, to, birthDate, id, signature, driverLicenceNumber } =
6+
document;
7+
console.log(document);
8+
return (
9+
<div className={`w-[2480px] h-[3508px] flex justify-center mt-[10px]`}>
10+
<div className="w-[1600px] h-[1000px] border-[6px] border-gray-400 mt-[10px] rounded-[50px] bg-silk bg-cover bg-no-repeat text-center px-[30px]">
11+
<p className="text-[48px] font-bold mt-[30px]">
12+
CERTIFICATE OF PROFESSIONAL COMPETENCE OF THE DRIVER
13+
</p>
14+
<p className="text-[45px] mt-[20px]">DRIVER QUALIFICATION CARD</p>
15+
<div className="flex justify-between items-center mt-[50px] px-[60px]">
16+
<div className="text-[60px] py-[15px] px-[40px] border-[6px] border-black rounded-[100%]">
17+
UZ
18+
</div>
19+
<p className="text-[50px] font-bold ml-[-200px]">1.Nr. {id}</p>
20+
<img src={flag} alt="NT2022" className="w-[200px]" />
21+
</div>
22+
<div className="h-[570px] flex items-center mt-[60px] gap-[40px]">
23+
<div className="h-full aspect-[3/4] bg-white border-[2px] border-black"></div>
24+
<div className="h-full bg-blue font-bold text-left text-[43px] flex flex-col flex-1 gap-[10px]">
25+
<p>2.{name}</p>
26+
<p>3.{surname}</p>
27+
<p>4.{birthDate}</p>
28+
<p>5.{driverLicenceNumber}</p>
29+
<p>7.C/CE</p>
30+
<p>8.REPUBLIC OF UZBEKISTAN</p>
31+
<p>9.NAMANGANTRANS 2022</p>
32+
<p>Until (date) {to}</p>
33+
<div className="w-[300px] h-[100px] bg-white border-[2px] border-black">
34+
<img
35+
width={"100%"}
36+
height={"80%"}
37+
src={signature}
38+
alt=""
39+
className="scale-[0.7]"
40+
/>
41+
</div>
42+
</div>
43+
<div className="h-full flex flex-col items-end justify-end">
44+
<div className="bg-blue-500 text-white text-[35px] py-[20px] px-[40px] flex items-center justify-center rounded-ee-[30px] rounded-ss-[30px] mb-[500px] mr-[55px]">
45+
NT2022
46+
</div>
47+
</div>
48+
</div>
49+
</div>
50+
</div>
51+
);
52+
};
53+
54+
export default DriverCardFront;
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { forwardRef } from "react";
2+
import DriverCardFront from "./card/front";
3+
import DriverCardBack from "./card/back";
4+
5+
const DriverCertificateCard = forwardRef(({ document, type }, ref) => {
6+
return (
7+
<div ref={ref}>
8+
<DriverCardFront document={document} type={type} />
9+
<DriverCardBack document={document} type={type} />
10+
</div>
11+
);
12+
});
13+
14+
export default DriverCertificateCard;

Diff for: client/src/components/documents/driver/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import MiniCertificate from "./mini";
55
const DriverCertificate = forwardRef(({ document, type }, ref) => {
66
return (
77
<div ref={ref}>
8-
<DriverCertificateTop document={document} type={type} ref={ref} />
9-
<DriverCertificateBottom document={document} type={type} ref={ref} />
10-
<MiniCertificate document={document} type={type} ref={ref} />
8+
<DriverCertificateTop document={document} type={type} />
9+
<DriverCertificateBottom document={document} type={type} />
10+
<MiniCertificate document={document} type={type} />
1111
</div>
1212
);
1313
});

Diff for: client/src/components/table/index.jsx

+15-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import Edit from "@routes/sub-routes/edit";
1818
import { deleteDocumentThunk } from "@thunks/documents-thunks";
1919
import { updateUI } from "@helpers/update-ui";
2020
import { useNavigate } from "react-router-dom";
21+
import DriverCertificateCard from "../documents/driver-card";
2122

2223
const DocumentsTable = ({ data, loading, type }) => {
2324
const [editingDocumentId, setEditingDocumentId] = useState(null);
@@ -80,6 +81,12 @@ const DocumentsTable = ({ data, loading, type }) => {
8081
key: "birthDate",
8182
width: "10%",
8283
},
84+
{
85+
title: "Haydovchilik guvohnomasi raqami",
86+
dataIndex: "driverLicenceNumber",
87+
key: "driverLicenceNumber",
88+
width: "10%",
89+
},
8390
{
8491
title: "Berilgan sana",
8592
dataIndex: "from",
@@ -175,11 +182,17 @@ const DocumentsTable = ({ data, loading, type }) => {
175182
<div className="hidden w-0 h-0">
176183
{document && (
177184
<>
178-
{SIMILAR_DOCUMENT_TYPES.DRIVER.includes(type) ? (
185+
{SIMILAR_DOCUMENT_TYPES.DRIVER.includes(type) && (
179186
<DriverCertificate document={document} ref={printFrame} />
180-
) : (
187+
)}
188+
189+
{SIMILAR_DOCUMENT_TYPES.ADR.includes(type) && (
181190
<AdrCertificate document={document} ref={printFrame} />
182191
)}
192+
193+
{SIMILAR_DOCUMENT_TYPES.DRIVER_CARD.includes(type) && (
194+
<DriverCertificateCard document={document} ref={printFrame} />
195+
)}
183196
</>
184197
)}
185198
</div>

Diff for: client/src/constants/document/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const DOCUMENT_TYPES = {
22
DRIVER: "driver",
3+
DRIVER_CARD: "drivercard",
34
MANAGER: "manager",
45
ADR: "adr",
56
ADR_TANK: "adr_tank",
@@ -8,9 +9,14 @@ export const DOCUMENT_TYPES = {
89
export const SIMILAR_DOCUMENT_TYPES = {
910
DRIVER: ["driver", "manager"],
1011
ADR: ["adr", "adr-tank"],
12+
DRIVER_CARD: ["drivercard"],
1113
};
1214

1315
export const DOCUMENT_TYPES_LIST = [
16+
{
17+
key: "drivercard",
18+
label: "Haydovchi sertifikat (kartochka)",
19+
},
1420
{
1521
key: "driver",
1622
label: "Haydovchi sertifikat",

Diff for: client/src/helpers/update-ui.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77

88
export const updateUI = (type) => {
99
switch (type) {
10+
case "drivercard":
11+
return fetchDriverDocumentsThunk({ endpoint: type });
1012
case "driver":
1113
return fetchDriverDocumentsThunk({ endpoint: type });
1214
case "adr":

Diff for: client/src/routes/index.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ const index = () => {
2222
<Route path="admin" element={<Private />}>
2323
<Route index path="" element={<Create />} />
2424
<Route path="manage-certificate" element={<ManageCertificates />}>
25-
<Route index path="" element={<Certificates />} />
25+
<Route path="driver" element={<Certificates />} />
2626
<Route path="adr" element={<Adr />} />
2727
<Route path="manager" element={<Manager />} />
2828
<Route path="adr-tank" element={<AdrTank />} />
29+
<Route path="drivercard" element={<Certificates />} />
2930
</Route>
3031
<Route path="status" element={<Status />}>
3132
<Route path=":id" element={<Details />} />

Diff for: client/src/routes/search/Search.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import DriverCertificate from "@/components/documents/driver";
1212
import AdrCertificate from "@/components/documents/adr";
1313
import { Watermark } from "antd";
1414
import { checkCertificateStatus } from "@/helpers/check-certificate-status";
15+
import DriverCertificateCard from "@/components/documents/driver-card";
1516

1617
const Search = () => {
1718
const [isCertificateValid, setIsCertificateValid] = useState(null);
@@ -46,7 +47,10 @@ const Search = () => {
4647
<div
4748
className={`w-full h-full absolute top-0 left-0 z-10 ${!isCertificateValid ? "backdrop-blur-[20px]" : ""}`}
4849
></div>
49-
{document.id?.startsWith("D") || document.id?.startsWith("M") ? (
50+
{document.id?.startsWith("DC") ? (
51+
<DriverCertificateCard document={document} type={"search"} />
52+
) : document.id?.startsWith("D") ||
53+
document.id?.startsWith("M") ? (
5054
<DriverCertificate document={document} type={"search"} />
5155
) : (
5256
<AdrCertificate document={document} type={"search"} />

Diff for: client/src/routes/sub-routes/create/Create.jsx

+11-10
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,17 @@ import {
1010
SaveOutlined,
1111
} from "@ant-design/icons";
1212
import { useEffect, useState } from "react";
13-
import { convertToValueLabel } from "@/helpers/formItems";
14-
import { DOCUMENT_TYPES_LIST } from "@/constants/document";
13+
import { convertToValueLabel } from "@helpers/formItems";
14+
import { DOCUMENT_TYPES_LIST } from "@constants/document";
1515
import CreateForm from "./form";
1616
import { useDispatch, useSelector } from "react-redux";
17-
import {
18-
getDocumentId,
19-
getDocumentsLoading,
20-
} from "@/redux/selectors/documents";
21-
import { fetchDocumentIdThunk } from "@/redux/thunks/documents-thunks";
17+
import { getDocumentId, getDocumentsLoading } from "@selectors/documents";
18+
import { fetchDocumentIdThunk } from "@thunks/documents-thunks";
2219
import SaveAndCheck from "./save-and-check";
2320
import {
2421
getDataFromLocalStorage,
2522
setDataToLocalStorage,
26-
} from "@/helpers/localStorageActions";
23+
} from "@helpers/localStorageActions";
2724

2825
const { Title } = Typography;
2926

@@ -92,7 +89,7 @@ const Create = () => {
9289
<Select
9390
value={documentType}
9491
onChange={(value) => setDocumentType(value)}
95-
className="w-[200px]"
92+
className="w-[300px]"
9693
defaultValue={DOCUMENT_TYPES_LIST[0].key}
9794
options={convertToValueLabel(DOCUMENT_TYPES_LIST, "key", "label")}
9895
/>{" "}
@@ -115,7 +112,11 @@ const Create = () => {
115112

116113
<div className="flex flex-1 flex-col">
117114
{current === 0 && (
118-
<CreateForm document={document} setDocument={setDocument} />
115+
<CreateForm
116+
document={document}
117+
documentType={documentType}
118+
setDocument={setDocument}
119+
/>
119120
)}
120121
{current === 1 && (
121122
<SaveAndCheck

0 commit comments

Comments
 (0)