Merge branch 'manage-active-job-delivery-date' of WrenchBoard/Users-Wrench into master
This commit is contained in:
@@ -1,19 +1,18 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
import InputCom from "../Helpers/Inputs/InputCom";
|
import InputCom from "../Helpers/Inputs/InputCom";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { tableReload } from "../../store/TableReloads";
|
import { tableReload } from "../../store/TableReloads";
|
||||||
import { Field, Form, Formik } from "formik";
|
import { Field, Form, Formik } from "formik";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
country: Yup.string()
|
currency: Yup.string()
|
||||||
.min(1, "Minimum 3 characters")
|
.min(1, "Minimum 3 characters")
|
||||||
.max(25, "Maximum 25 characters")
|
.max(25, "Maximum 25 characters")
|
||||||
.required("Country is required"),
|
.required("Country is required"),
|
||||||
price: Yup.number()
|
price: Yup.string()
|
||||||
.typeError("Invalid number")
|
.typeError("Invalid number")
|
||||||
.min(1, "Price must be greater than 0")
|
.min(1, "Price must be greater than 0")
|
||||||
.test("no-e", "Invalid number", (value) => {
|
.test("no-e", "Invalid number", (value) => {
|
||||||
@@ -44,11 +43,9 @@ const validationSchema = Yup.object().shape({
|
|||||||
|
|
||||||
function AddJob({ popUpHandler, categories }) {
|
function AddJob({ popUpHandler, categories }) {
|
||||||
const ApiCall = new usersService();
|
const ApiCall = new usersService();
|
||||||
|
|
||||||
let dispatch = useDispatch();
|
let dispatch = useDispatch();
|
||||||
|
|
||||||
let { userDetails } = useSelector((state) => state.userDetails);
|
|
||||||
|
|
||||||
const [numberValue, setNumberValue] = useState("");
|
|
||||||
let [currency, setCurrency] = useState({
|
let [currency, setCurrency] = useState({
|
||||||
loading: true,
|
loading: true,
|
||||||
status: false,
|
status: false,
|
||||||
@@ -412,3 +409,10 @@ const publicArray = [
|
|||||||
{ duration: 21, name: "3 weeks" },
|
{ duration: 21, name: "3 weeks" },
|
||||||
{ duration: 28, name: "4 weeks" },
|
{ duration: 28, name: "4 weeks" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// .test("no-e", "Invalid number", (value) => {
|
||||||
|
// if (value && /\d+e/.test(value)) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// })
|
||||||
|
|||||||
@@ -9,6 +9,40 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { tableReload } from "../../store/TableReloads";
|
import { tableReload } from "../../store/TableReloads";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
|
const validationSchema = Yup.object().shape({
|
||||||
|
currency: Yup.string()
|
||||||
|
.min(1, "Minimum 3 characters")
|
||||||
|
.max(25, "Maximum 25 characters")
|
||||||
|
.required("Country is required"),
|
||||||
|
price: Yup.string()
|
||||||
|
.typeError("Invalid number")
|
||||||
|
.min(1, "Price must be greater than 0")
|
||||||
|
.test("no-e", "Invalid number", (value) => {
|
||||||
|
if (value && /\d+e/.test(value)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.required("Price is required"),
|
||||||
|
title: Yup.string()
|
||||||
|
.min(3, "Minimum 3 characters")
|
||||||
|
.max(100, "Maximum 25 characters")
|
||||||
|
.required("Title is required"),
|
||||||
|
description: Yup.string()
|
||||||
|
.min(3, "Minimum 3 characters")
|
||||||
|
.max(250, "Maximum 250 characters")
|
||||||
|
.required("Description is required"),
|
||||||
|
job_detail: Yup.string()
|
||||||
|
.min(3, "Minimum 3 characters")
|
||||||
|
.max(250, "Maximum 250 characters")
|
||||||
|
.required("Details is required"),
|
||||||
|
timeline_days: Yup.number()
|
||||||
|
.typeError("you must specify a number")
|
||||||
|
.min(1, "Price must be greater than 0")
|
||||||
|
.required("Timeline is required"),
|
||||||
|
category: Yup.array().min(1, "Select at least one checkbox"),
|
||||||
|
});
|
||||||
|
|
||||||
const EditJobPopOut = ({
|
const EditJobPopOut = ({
|
||||||
details,
|
details,
|
||||||
onClose,
|
onClose,
|
||||||
@@ -24,33 +58,6 @@ const EditJobPopOut = ({
|
|||||||
message: "",
|
message: "",
|
||||||
}); // Holds state when submit button is pressed
|
}); // Holds state when submit button is pressed
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
|
||||||
country: Yup.string()
|
|
||||||
.min(1, "Minimum 3 characters")
|
|
||||||
.max(25, "Maximum 25 characters")
|
|
||||||
.required("Country is required"),
|
|
||||||
price: Yup.number()
|
|
||||||
.typeError("you must specify a number")
|
|
||||||
.min(1, "Price must be greater than 0")
|
|
||||||
.required("Price is required"),
|
|
||||||
title: Yup.string()
|
|
||||||
.min(3, "Minimum 3 characters")
|
|
||||||
.max(100, "Maximum 25 characters")
|
|
||||||
.required("Title is required"),
|
|
||||||
description: Yup.string()
|
|
||||||
.min(3, "Minimum 3 characters")
|
|
||||||
.max(250, "Maximum 250 characters")
|
|
||||||
.required("Description is required"),
|
|
||||||
job_detail: Yup.string()
|
|
||||||
.min(3, "Minimum 3 characters")
|
|
||||||
.max(250, "Maximum 250 characters")
|
|
||||||
.required("Details is required"),
|
|
||||||
timeline_days: Yup.number()
|
|
||||||
.typeError("you must specify a number")
|
|
||||||
.min(1, "Price must be greater than 0")
|
|
||||||
.required("Price is required"),
|
|
||||||
});
|
|
||||||
|
|
||||||
let initialValues = {
|
let initialValues = {
|
||||||
// initial values for formik
|
// initial values for formik
|
||||||
currency: details.currency,
|
currency: details.currency,
|
||||||
@@ -74,7 +81,7 @@ const EditJobPopOut = ({
|
|||||||
job_uid: details.job_uid,
|
job_uid: details.job_uid,
|
||||||
...values,
|
...values,
|
||||||
};
|
};
|
||||||
delete reqData?.currency;
|
|
||||||
try {
|
try {
|
||||||
let res = await jobApi.jobManagerUpdateJob(reqData);
|
let res = await jobApi.jobManagerUpdateJob(reqData);
|
||||||
let { data } = await res;
|
let { data } = await res;
|
||||||
@@ -93,7 +100,6 @@ const EditJobPopOut = ({
|
|||||||
[jobApi, navigate, onClose, details]
|
[jobApi, navigate, onClose, details]
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(details)
|
|
||||||
return (
|
return (
|
||||||
<ModalCom action={onClose} situation={situation} className="edit-popup">
|
<ModalCom action={onClose} situation={situation} className="edit-popup">
|
||||||
<div className="logout-modal-wrapper lg:w-[600px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
|
<div className="logout-modal-wrapper lg:w-[600px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
|
||||||
|
|||||||
Reference in New Issue
Block a user