update
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import DialogTransition from "@/core/components/DialogTransition";
|
||||
import { Close } from "@mui/icons-material";
|
||||
import { Dialog, DialogTitle, IconButton } from "@mui/material";
|
||||
import CreateForm from "./Form";
|
||||
import CreateOrUpdateForm from "../../Forms/CreateOrUpdate";
|
||||
|
||||
const InquiryPrivacyFencingCreate = ({ open, handleClose, mutate }) => {
|
||||
|
||||
@@ -24,7 +24,7 @@ const InquiryPrivacyFencingCreate = ({ open, handleClose, mutate }) => {
|
||||
>
|
||||
<Close />
|
||||
</IconButton>
|
||||
<CreateForm handleClose={handleClose} mutate={mutate} />
|
||||
<CreateOrUpdateForm handleClose={handleClose} mutate={mutate} />
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
@@ -66,9 +66,9 @@ const initValues = {
|
||||
ronevesht: '',
|
||||
}
|
||||
|
||||
const CreateForm = ({ handleClose, mutate }) => {
|
||||
const CreateOrUpdateForm = ({ handleClose, mutate, defaultValues }) => {
|
||||
const request = useRequest()
|
||||
const { control, watch, register, handleSubmit, setValue, formState: { isSubmitting } } = useForm({ defaultValues: initValues });
|
||||
const { control, watch, register, handleSubmit, setValue, formState: { isSubmitting } } = useForm({ defaultValues: defaultValues || initValues });
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
const formData = new FormData()
|
||||
@@ -567,4 +567,4 @@ const CreateForm = ({ handleClose, mutate }) => {
|
||||
</LocalizationProvider >
|
||||
);
|
||||
};
|
||||
export default CreateForm;
|
||||
export default CreateOrUpdateForm;
|
||||
@@ -0,0 +1,32 @@
|
||||
import { useRef } from "react";
|
||||
import { Marker, useMapEvents } from "react-leaflet";
|
||||
|
||||
const prefix = process.env.NODE_ENV === "production" ? "/v3" : "";
|
||||
|
||||
const locationMarker = L.icon({
|
||||
iconUrl: prefix + "/images/locationMarker.png",
|
||||
iconSize: [50, 50],
|
||||
iconAnchor: [25, 50],
|
||||
});
|
||||
|
||||
const MarkerLocation = ({ setValue }) => {
|
||||
const location = useRef();
|
||||
const map = useMapEvents({
|
||||
move: (e) => {
|
||||
const latlon = e.target.getCenter()
|
||||
location.current?.setLatLng(latlon);
|
||||
setValue('lat', latlon.lat)
|
||||
setValue('lon', latlon.lng)
|
||||
},
|
||||
zoom: (e) => {
|
||||
const latlon = e.target.getCenter()
|
||||
location.current?.setLatLng(latlon);
|
||||
setValue('lat', latlon.lat)
|
||||
setValue('lon', latlon.lng)
|
||||
},
|
||||
});
|
||||
return (
|
||||
<Marker ref={location} icon={locationMarker} position={map.getCenter()} key="location" />
|
||||
)
|
||||
}
|
||||
export default MarkerLocation
|
||||
@@ -1,8 +1,7 @@
|
||||
import MapLoading from "@/core/components/MapLayer/Loading";
|
||||
import MarkerLocation from "@/core/components/MapLayer/MarkerLocation";
|
||||
import { Paper, Stack } from "@mui/material";
|
||||
import { useFormikContext } from "formik";
|
||||
import dynamic from "next/dynamic";
|
||||
import MarkerLocation from "./MarkerLocation";
|
||||
|
||||
const MapLayer = dynamic(() => import("@/core/components/MapLayer"), {
|
||||
loading: () => <MapLoading />,
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Button } from "@mui/material";
|
||||
import AddCircleIcon from "@mui/icons-material/AddCircle";
|
||||
import { useState } from "react";
|
||||
import InquiryPrivacyFencingCreate from "@/components/dashboard/inquiryPrivacyFencing/Create";
|
||||
import InquiryPrivacyFencingCreate from "./Actions/Create";
|
||||
|
||||
const Toolbar = ({ mutate }) => {
|
||||
const [open, setOpen] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user