Skip to content

Feat/added in tank functionality #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions client/src/components/documents/adr/back/AdrCertificateBack.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

const AdrCertificateBack = ({ type }) => {
const AdrCertificateBack = ({ type, tank }) => {
return (
<div
className={`w-[2480px] ${type !== "search" && "h-[3508px]"} flex justify-center`}
Expand All @@ -21,13 +21,17 @@ const AdrCertificateBack = ({ type }) => {
</div>
<div className="border-t-8 border-black w-full h-[630px] flex font-black text-[50px] text-left">
<div className="w-[50%] h-full border-r-[3px] border-black px-[100px] flex flex-col gap-[10px] pt-[50px]">
<p>2</p>
<p>3</p>
<p>4.1, 4.2, 4.3</p>
<p>5.1, 5.2</p>
<p>6.1, 6.2</p>
<p>8</p>
<p>9</p>
{tank && (
<>
<p>2</p>
<p>3</p>
<p>4.1, 4.2, 4.3</p>
<p>5.1, 5.2</p>
<p>6.1, 6.2</p>
<p>8</p>
<p>9</p>
</>
)}
</div>
<div className="w-[50%] h-full border-l-[3px] border-black px-[100px] flex flex-col gap-[10px] pt-[50px]">
<p>2</p>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/documents/adr/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const AdrCertificate = forwardRef(({ document, type }, ref) => {
return (
<div ref={ref}>
<AdrCertificateFront type={type} document={document} ref={ref} />
<AdrCertificateBack type={type} />
<AdrCertificateBack type={type} tank={document?.tank} />
<MiniCertificate
document={document}
type={type}
Expand Down
1 change: 1 addition & 0 deletions client/src/routes/sub-routes/create/Create.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const Create = () => {
birthDate: "",
from: "",
to: "",
tank: false,
},
);

Expand Down
12 changes: 9 additions & 3 deletions client/src/routes/sub-routes/create/form/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Form, Input } from "antd";
import dayjs from "dayjs";
import { DatePicker } from "antd";
import { DatePicker, Checkbox } from "antd";
import { DATE_FORMAT } from "@/constants/document";
import { setDataToLocalStorage } from "@/helpers/localStorageActions";

Expand All @@ -20,8 +20,6 @@ const CreateForm = ({ setDocument, document }) => {
setDataToLocalStorage("document", { ...document, ...values });
};

console.log(document);

return (
<Form
className="p-10"
Expand Down Expand Up @@ -168,6 +166,14 @@ const CreateForm = ({ setDocument, document }) => {
/>
</Item>
</div>
<Checkbox
checked={document.tank}
onChange={(e) =>
handleValuesChange({ ...document, tank: e.target.checked })
}
>
Sisterna
</Checkbox>
</Form>
);
};
Expand Down
10 changes: 9 additions & 1 deletion client/src/routes/sub-routes/edit/form/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Form, Input } from "antd";
import dayjs from "dayjs";
import { DatePicker } from "antd";
import { DatePicker, Checkbox } from "antd";
import { DATE_FORMAT } from "@/constants/document";
import { setDataToLocalStorage } from "@/helpers/localStorageActions";

Expand Down Expand Up @@ -204,6 +204,14 @@ const EditForm = ({ setDocument, document, form }) => {
/>
</Item>
</div>
<Checkbox
checked={document.tank}
onChange={(e) =>
handleValuesChange({ ...document, tank: e.target.checked })
}
>
Sisterna
</Checkbox>
</Form>
);
};
Expand Down
1 change: 0 additions & 1 deletion client/src/routes/sub-routes/edit/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ArrowLeftOutlined,
ArrowRightOutlined,
EditOutlined,
EyeOutlined,
SaveOutlined,
} from "@ant-design/icons";
import EditForm from "./form";
Expand Down
4 changes: 4 additions & 0 deletions server/src/models/AdrCertificates.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const Adr = new mongoose.Schema({
type: Boolean,
default: false,
},
tank: {
type: Boolean,
default: false,
},
})

const model = mongoose.model('Adr', Adr)
Expand Down
1 change: 1 addition & 0 deletions server/src/routes/adrcertificates.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ certificate.post('/', verifyAdmin, async (req, res) => {
birthDate: req.body.birthDate,
from: req.body.from,
to: req.body.to,
tank: req.body.tank,
})
res.status(201).json(newCertificate)
} catch (err) {
Expand Down