setVisible(true)}>
+
setVisible(true)}
+ >
{association.authlevel || t("general.labels.na")}
)}
diff --git a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx
index e5cbd67ee..6f61fccf0 100644
--- a/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx
+++ b/client/src/components/time-ticket-modal/time-ticket-modal.component.jsx
@@ -82,9 +82,10 @@ export function TimeTicketModalComponent({
label={t("timetickets.fields.ro_number")}
rules={[
{
- required:
- !form.getFieldValue("cost_center") ===
- "timetickets.labels.shift",
+ required: !(
+ form.getFieldValue("cost_center") ===
+ "timetickets.labels.shift"
+ ),
//message: t("general.validation.required"),
},
]}
diff --git a/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx b/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx
index 3438d2f28..9fbe45ed7 100644
--- a/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx
+++ b/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx
@@ -1,16 +1,41 @@
import React, { useState } from "react";
-import { Button, Form, notification, PageHeader } from "antd";
+import { Button, Form, notification, PageHeader, Popconfirm } from "antd";
import { useMutation } from "@apollo/client";
import VehicleDetailFormComponent from "./vehicle-detail-form.component";
import { useTranslation } from "react-i18next";
import moment from "moment";
-import { UPDATE_VEHICLE } from "../../graphql/vehicles.queries";
+import { DELETE_VEHICLE, UPDATE_VEHICLE } from "../../graphql/vehicles.queries";
+import { useHistory } from "react-router-dom";
function VehicleDetailFormContainer({ vehicle, refetch }) {
const { t } = useTranslation();
const [updateVehicle] = useMutation(UPDATE_VEHICLE);
+ const [deleteVehicle] = useMutation(DELETE_VEHICLE);
const [form] = Form.useForm();
const [loading, setLoading] = useState(false);
+ const history = useHistory();
+
+ const handleDelete = async () => {
+ setLoading(true);
+ const result = await deleteVehicle({
+ variables: { id: vehicle.id },
+ });
+ console.log(result);
+ if (result.errors) {
+ notification["error"]({
+ message: t("vehicles.errors.deleting", {
+ error: JSON.stringify(result.errors),
+ }),
+ });
+ setLoading(false);
+ } else {
+ notification["success"]({
+ message: t("vehicles.successes.delete"),
+ });
+ setLoading(false);
+ history.push(`/manage/vehicles`);
+ }
+ };
const handleFinish = async (values) => {
setLoading(true);
@@ -40,15 +65,29 @@ function VehicleDetailFormContainer({ vehicle, refetch }) {
<>
+
+ ,
- }
+ ,
+ ]}
/>