@mamrp/components 1.7.54 → 1.7.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/index.d.mts +0 -0
- package/dist/charts/index.d.ts +0 -0
- package/dist/charts/index.js +0 -0
- package/dist/charts/index.js.map +0 -0
- package/dist/charts/index.mjs +0 -0
- package/dist/charts/index.mjs.map +0 -0
- package/dist/date-pickers/index.d.mts +0 -0
- package/dist/date-pickers/index.d.ts +0 -0
- package/dist/date-pickers/index.js +0 -0
- package/dist/date-pickers/index.js.map +0 -0
- package/dist/date-pickers/index.mjs +0 -0
- package/dist/date-pickers/index.mjs.map +0 -0
- package/dist/index.d.mts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +410 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +421 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pagination/index.d.mts +0 -0
- package/dist/pagination/index.d.ts +0 -0
- package/dist/pagination/index.js +0 -0
- package/dist/pagination/index.js.map +0 -0
- package/dist/pagination/index.mjs +0 -0
- package/dist/pagination/index.mjs.map +0 -0
- package/dist/selectors/index.d.mts +0 -0
- package/dist/selectors/index.d.ts +0 -0
- package/dist/selectors/index.js +0 -0
- package/dist/selectors/index.js.map +1 -1
- package/dist/selectors/index.mjs +0 -0
- package/dist/selectors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/charts/index.d.mts
CHANGED
|
File without changes
|
package/dist/charts/index.d.ts
CHANGED
|
File without changes
|
package/dist/charts/index.js
CHANGED
|
File without changes
|
package/dist/charts/index.js.map
CHANGED
|
File without changes
|
package/dist/charts/index.mjs
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { MRT_ColumnDef, MRT_PaginationState, MRT_ColumnFiltersState, MRT_Sorting
|
|
|
2
2
|
export { MRT_ColumnDef } from 'material-react-table';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { ReactNode, CSSProperties, Dispatch, SetStateAction } from 'react';
|
|
5
|
-
import { Control, FieldValues, Path, FieldErrors, UseFormSetValue } from 'react-hook-form';
|
|
5
|
+
import { Control, FieldValues, Path, FieldErrors, UseFormSetValue, FieldPath } from 'react-hook-form';
|
|
6
6
|
import { DialogProps, PaperProps, SxProps, Theme } from '@mui/material';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import { Moment } from 'moment-jalaali';
|
|
@@ -732,4 +732,28 @@ type UploadImageProps<T extends FieldValues> = {
|
|
|
732
732
|
};
|
|
733
733
|
declare const UploadImage: <T extends FieldValues>({ placeholder, name, selectedImage, setSelectedImage, control, errors, setValue, height, allowGallery, imageFit, disableCamera, }: UploadImageProps<T>) => React__default.JSX.Element;
|
|
734
734
|
|
|
735
|
-
|
|
735
|
+
interface SubCustomerFormFields {
|
|
736
|
+
fullName: string;
|
|
737
|
+
phoneNumber: string;
|
|
738
|
+
address: string;
|
|
739
|
+
cityId: number;
|
|
740
|
+
customerType: number;
|
|
741
|
+
remittanceDiscrepancyTolerancePercent: number | null;
|
|
742
|
+
lat: number | null;
|
|
743
|
+
long: number | null;
|
|
744
|
+
}
|
|
745
|
+
interface MapPickerProps {
|
|
746
|
+
control: Control<SubCustomerFormFields>;
|
|
747
|
+
nameLat: FieldPath<SubCustomerFormFields>;
|
|
748
|
+
nameLong: FieldPath<SubCustomerFormFields>;
|
|
749
|
+
nameAddress?: FieldPath<SubCustomerFormFields>;
|
|
750
|
+
isLoading?: boolean;
|
|
751
|
+
defaultLat?: number;
|
|
752
|
+
defaultLng?: number;
|
|
753
|
+
defaultZoom?: number;
|
|
754
|
+
minZoom?: number;
|
|
755
|
+
maxZoom?: number;
|
|
756
|
+
}
|
|
757
|
+
declare function MapLocationPicker({ control, nameLat, nameLong, nameAddress, isLoading, defaultLat, defaultLng, defaultZoom, minZoom, maxZoom, }: MapPickerProps): React$1.JSX.Element;
|
|
758
|
+
|
|
759
|
+
export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MRT_ColumnDef, MRT_PaginationState, MRT_ColumnFiltersState, MRT_Sorting
|
|
|
2
2
|
export { MRT_ColumnDef } from 'material-react-table';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { ReactNode, CSSProperties, Dispatch, SetStateAction } from 'react';
|
|
5
|
-
import { Control, FieldValues, Path, FieldErrors, UseFormSetValue } from 'react-hook-form';
|
|
5
|
+
import { Control, FieldValues, Path, FieldErrors, UseFormSetValue, FieldPath } from 'react-hook-form';
|
|
6
6
|
import { DialogProps, PaperProps, SxProps, Theme } from '@mui/material';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
8
8
|
import { Moment } from 'moment-jalaali';
|
|
@@ -732,4 +732,28 @@ type UploadImageProps<T extends FieldValues> = {
|
|
|
732
732
|
};
|
|
733
733
|
declare const UploadImage: <T extends FieldValues>({ placeholder, name, selectedImage, setSelectedImage, control, errors, setValue, height, allowGallery, imageFit, disableCamera, }: UploadImageProps<T>) => React__default.JSX.Element;
|
|
734
734
|
|
|
735
|
-
|
|
735
|
+
interface SubCustomerFormFields {
|
|
736
|
+
fullName: string;
|
|
737
|
+
phoneNumber: string;
|
|
738
|
+
address: string;
|
|
739
|
+
cityId: number;
|
|
740
|
+
customerType: number;
|
|
741
|
+
remittanceDiscrepancyTolerancePercent: number | null;
|
|
742
|
+
lat: number | null;
|
|
743
|
+
long: number | null;
|
|
744
|
+
}
|
|
745
|
+
interface MapPickerProps {
|
|
746
|
+
control: Control<SubCustomerFormFields>;
|
|
747
|
+
nameLat: FieldPath<SubCustomerFormFields>;
|
|
748
|
+
nameLong: FieldPath<SubCustomerFormFields>;
|
|
749
|
+
nameAddress?: FieldPath<SubCustomerFormFields>;
|
|
750
|
+
isLoading?: boolean;
|
|
751
|
+
defaultLat?: number;
|
|
752
|
+
defaultLng?: number;
|
|
753
|
+
defaultZoom?: number;
|
|
754
|
+
minZoom?: number;
|
|
755
|
+
maxZoom?: number;
|
|
756
|
+
}
|
|
757
|
+
declare function MapLocationPicker({ control, nameLat, nameLong, nameAddress, isLoading, defaultLat, defaultLng, defaultZoom, minZoom, maxZoom, }: MapPickerProps): React$1.JSX.Element;
|
|
758
|
+
|
|
759
|
+
export { Page as Accordion, AdvancedSearchButton, ConfirmationDialog$1 as ConfirmationDialog, ConnectToBasculeButton, CustomCheckbox, CustomDateTimePicker, CustomDialog, type CustomDialogProps, CustomTimePicker, DataTable, DateFilter, DateFilterRange, DateMonthPicker, JalaliDatePicker$2 as DatePicker, JalaliDatePicker$1 as DateTimePicker, JalaliDateTimeRangePicker as DateTimeRangePicker, DraggablePaper, UploadImage$1 as EnhancedUploadImage, FormInputNumber, FormInputText, HorizontalStepper, imgViewer as ImgViewer, LicensePlate, MapLocationPicker, JalaliDatePicker as MobileDateTimePicker, ConfirmationDialog as Modal, NestedSelect as NestedSelectort, NoResult, PaginationList, type PaletteColor, PatternTextField, RadioButton, SearchLicensePlate, MultipleSelectChip as Selector, SkeletonCard, SonarSpinner, SwitchButton, Table, UploadImage };
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ __export(src_exports, {
|
|
|
52
52
|
HorizontalStepper: () => HorizontalStepper,
|
|
53
53
|
ImgViewer: () => imgViewer,
|
|
54
54
|
LicensePlate: () => LicensePlate,
|
|
55
|
+
MapLocationPicker: () => MapLocationPicker,
|
|
55
56
|
MobileDateTimePicker: () => mobile_date_time_picker_default,
|
|
56
57
|
Modal: () => ConfirmationDialog2,
|
|
57
58
|
NestedSelectort: () => selector_default,
|
|
@@ -6118,6 +6119,414 @@ var UploadImage2 = ({
|
|
|
6118
6119
|
);
|
|
6119
6120
|
};
|
|
6120
6121
|
var upload_image_default = UploadImage2;
|
|
6122
|
+
|
|
6123
|
+
// src/map-location-picker/index.tsx
|
|
6124
|
+
var import_material34 = require("@mui/material");
|
|
6125
|
+
var import_md13 = require("react-icons/md");
|
|
6126
|
+
var import_react33 = require("react");
|
|
6127
|
+
var import_react_hot_toast2 = __toESM(require("react-hot-toast"));
|
|
6128
|
+
var import_react_hook_form18 = require("react-hook-form");
|
|
6129
|
+
function MapLocationPicker({
|
|
6130
|
+
control,
|
|
6131
|
+
nameLat,
|
|
6132
|
+
nameLong,
|
|
6133
|
+
nameAddress,
|
|
6134
|
+
isLoading = false,
|
|
6135
|
+
defaultLat = 36.557153,
|
|
6136
|
+
defaultLng = 52.679547,
|
|
6137
|
+
defaultZoom = 16,
|
|
6138
|
+
minZoom = 10,
|
|
6139
|
+
maxZoom = 19
|
|
6140
|
+
}) {
|
|
6141
|
+
const theme3 = (0, import_material34.useTheme)();
|
|
6142
|
+
const isDarkMode = theme3.palette.mode === "dark";
|
|
6143
|
+
const { field: latField, fieldState: latState } = (0, import_react_hook_form18.useController)({
|
|
6144
|
+
name: nameLat,
|
|
6145
|
+
control
|
|
6146
|
+
});
|
|
6147
|
+
const { field: longField, fieldState: longState } = (0, import_react_hook_form18.useController)({
|
|
6148
|
+
name: nameLong,
|
|
6149
|
+
control
|
|
6150
|
+
});
|
|
6151
|
+
const addressController = nameAddress ? (0, import_react_hook_form18.useController)({ name: nameAddress, control }) : null;
|
|
6152
|
+
const error = !!latState.error || !!longState.error;
|
|
6153
|
+
const helperText = latState.error?.message || longState.error?.message || "";
|
|
6154
|
+
const latitude = latField.value;
|
|
6155
|
+
const longitude = longField.value;
|
|
6156
|
+
const handleLocationChange = (lat, lng) => {
|
|
6157
|
+
latField.onChange(lat);
|
|
6158
|
+
longField.onChange(lng);
|
|
6159
|
+
};
|
|
6160
|
+
const handleAddressChange = nameAddress ? (address) => addressController?.field.onChange(address) : void 0;
|
|
6161
|
+
const mapRef = (0, import_react33.useRef)(null);
|
|
6162
|
+
const mapInstanceRef = (0, import_react33.useRef)(null);
|
|
6163
|
+
const markerRef = (0, import_react33.useRef)(null);
|
|
6164
|
+
const [isMapLoading, setIsMapLoading] = (0, import_react33.useState)(true);
|
|
6165
|
+
const [isGeocoding, setIsGeocoding] = (0, import_react33.useState)(false);
|
|
6166
|
+
const [isGeolocating, setIsGeolocating] = (0, import_react33.useState)(false);
|
|
6167
|
+
const [showGpsDialog, setShowGpsDialog] = (0, import_react33.useState)(false);
|
|
6168
|
+
const [gpsErrorType, setGpsErrorType] = (0, import_react33.useState)("other");
|
|
6169
|
+
const [zoom, setZoom] = (0, import_react33.useState)(defaultZoom);
|
|
6170
|
+
const hasExistingLocation = latitude !== null && longitude !== null;
|
|
6171
|
+
const initialLat = hasExistingLocation ? latitude : defaultLat;
|
|
6172
|
+
const initialLng = hasExistingLocation ? longitude : defaultLng;
|
|
6173
|
+
const initialZoom = hasExistingLocation ? 17 : defaultZoom;
|
|
6174
|
+
(0, import_react33.useEffect)(() => {
|
|
6175
|
+
if (!document.getElementById("leaflet-css")) {
|
|
6176
|
+
const link = document.createElement("link");
|
|
6177
|
+
link.id = "leaflet-css";
|
|
6178
|
+
link.rel = "stylesheet";
|
|
6179
|
+
link.href = "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.css";
|
|
6180
|
+
document.head.appendChild(link);
|
|
6181
|
+
}
|
|
6182
|
+
const script = document.createElement("script");
|
|
6183
|
+
script.src = "https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js";
|
|
6184
|
+
script.async = true;
|
|
6185
|
+
script.onload = () => {
|
|
6186
|
+
setIsMapLoading(false);
|
|
6187
|
+
initializeMap();
|
|
6188
|
+
};
|
|
6189
|
+
document.body.appendChild(script);
|
|
6190
|
+
return () => {
|
|
6191
|
+
if (mapInstanceRef.current) {
|
|
6192
|
+
mapInstanceRef.current.remove();
|
|
6193
|
+
mapInstanceRef.current = null;
|
|
6194
|
+
}
|
|
6195
|
+
};
|
|
6196
|
+
}, []);
|
|
6197
|
+
const reverseGeocode = async (lat, lng) => {
|
|
6198
|
+
try {
|
|
6199
|
+
const response = await fetch(
|
|
6200
|
+
`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${lat}&lon=${lng}&accept-language=fa`
|
|
6201
|
+
);
|
|
6202
|
+
if (!response.ok) throw new Error("Failed to fetch address");
|
|
6203
|
+
const data = await response.json();
|
|
6204
|
+
const fullAddress = data.display_name || "";
|
|
6205
|
+
const parts = fullAddress.split(",");
|
|
6206
|
+
return parts.slice(0, 4).map((p) => p.trim()).join("\u060C ");
|
|
6207
|
+
} catch {
|
|
6208
|
+
return "";
|
|
6209
|
+
}
|
|
6210
|
+
};
|
|
6211
|
+
const initializeMap = () => {
|
|
6212
|
+
if (!window.L || !mapRef.current || mapInstanceRef.current) return;
|
|
6213
|
+
const L = window.L;
|
|
6214
|
+
const map = L.map(mapRef.current, {
|
|
6215
|
+
attributionControl: false,
|
|
6216
|
+
minZoom
|
|
6217
|
+
}).setView([initialLat, initialLng], initialZoom);
|
|
6218
|
+
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
6219
|
+
attribution: "\xA9 OpenStreetMap contributors",
|
|
6220
|
+
maxZoom
|
|
6221
|
+
}).addTo(map);
|
|
6222
|
+
map.on("zoomend", () => {
|
|
6223
|
+
setZoom(map.getZoom());
|
|
6224
|
+
});
|
|
6225
|
+
if (hasExistingLocation) {
|
|
6226
|
+
markerRef.current = L.marker([initialLat, initialLng], {
|
|
6227
|
+
draggable: true
|
|
6228
|
+
}).addTo(map);
|
|
6229
|
+
markerRef.current.on("dragend", async (e) => {
|
|
6230
|
+
const { lat, lng } = e.target.getLatLng();
|
|
6231
|
+
handleLocationChange(lat, lng);
|
|
6232
|
+
if (handleAddressChange) {
|
|
6233
|
+
setIsGeocoding(true);
|
|
6234
|
+
const address = await reverseGeocode(lat, lng);
|
|
6235
|
+
handleAddressChange(address);
|
|
6236
|
+
setIsGeocoding(false);
|
|
6237
|
+
}
|
|
6238
|
+
});
|
|
6239
|
+
}
|
|
6240
|
+
map.on("click", async (e) => {
|
|
6241
|
+
const { lat, lng } = e.latlng;
|
|
6242
|
+
if (!markerRef.current) {
|
|
6243
|
+
markerRef.current = L.marker([lat, lng], { draggable: true }).addTo(
|
|
6244
|
+
map
|
|
6245
|
+
);
|
|
6246
|
+
markerRef.current.on("dragend", async (dragEvent) => {
|
|
6247
|
+
const { lat: dragLat, lng: dragLng } = dragEvent.target.getLatLng();
|
|
6248
|
+
handleLocationChange(dragLat, dragLng);
|
|
6249
|
+
if (handleAddressChange) {
|
|
6250
|
+
setIsGeocoding(true);
|
|
6251
|
+
const address = await reverseGeocode(dragLat, dragLng);
|
|
6252
|
+
handleAddressChange(address);
|
|
6253
|
+
setIsGeocoding(false);
|
|
6254
|
+
}
|
|
6255
|
+
});
|
|
6256
|
+
} else {
|
|
6257
|
+
markerRef.current.setLatLng([lat, lng]);
|
|
6258
|
+
}
|
|
6259
|
+
handleLocationChange(lat, lng);
|
|
6260
|
+
if (handleAddressChange) {
|
|
6261
|
+
setIsGeocoding(true);
|
|
6262
|
+
const address = await reverseGeocode(lat, lng);
|
|
6263
|
+
handleAddressChange(address);
|
|
6264
|
+
setIsGeocoding(false);
|
|
6265
|
+
}
|
|
6266
|
+
});
|
|
6267
|
+
mapInstanceRef.current = map;
|
|
6268
|
+
};
|
|
6269
|
+
(0, import_react33.useEffect)(() => {
|
|
6270
|
+
if (!mapInstanceRef.current || !mapRef.current) return;
|
|
6271
|
+
const L = window.L;
|
|
6272
|
+
if (latitude === null || longitude === null) {
|
|
6273
|
+
if (markerRef.current) {
|
|
6274
|
+
markerRef.current.remove();
|
|
6275
|
+
markerRef.current = null;
|
|
6276
|
+
}
|
|
6277
|
+
return;
|
|
6278
|
+
}
|
|
6279
|
+
if (!markerRef.current) {
|
|
6280
|
+
markerRef.current = L.marker([latitude, longitude], {
|
|
6281
|
+
draggable: true
|
|
6282
|
+
}).addTo(mapInstanceRef.current);
|
|
6283
|
+
markerRef.current.on("dragend", async (e) => {
|
|
6284
|
+
const { lat, lng } = e.target.getLatLng();
|
|
6285
|
+
handleLocationChange(lat, lng);
|
|
6286
|
+
if (handleAddressChange) {
|
|
6287
|
+
setIsGeocoding(true);
|
|
6288
|
+
const address = await reverseGeocode(lat, lng);
|
|
6289
|
+
handleAddressChange(address);
|
|
6290
|
+
setIsGeocoding(false);
|
|
6291
|
+
}
|
|
6292
|
+
});
|
|
6293
|
+
} else {
|
|
6294
|
+
markerRef.current.setLatLng([latitude, longitude]);
|
|
6295
|
+
}
|
|
6296
|
+
mapInstanceRef.current.setView([latitude, longitude], zoom, {
|
|
6297
|
+
animate: true
|
|
6298
|
+
});
|
|
6299
|
+
}, [latitude, longitude]);
|
|
6300
|
+
const checkGeolocationSupport = () => {
|
|
6301
|
+
if (!navigator.geolocation) {
|
|
6302
|
+
import_react_hot_toast2.default.error("\u0645\u0631\u0648\u0631\u06AF\u0631 \u0634\u0645\u0627 \u0627\u0632 \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u067E\u0634\u062A\u06CC\u0628\u0627\u0646\u06CC \u0646\u0645\u06CC\u200C\u06A9\u0646\u062F.");
|
|
6303
|
+
return false;
|
|
6304
|
+
}
|
|
6305
|
+
return true;
|
|
6306
|
+
};
|
|
6307
|
+
const handleCurrentLocation = async () => {
|
|
6308
|
+
if (!checkGeolocationSupport() || !mapInstanceRef.current) return;
|
|
6309
|
+
if (navigator.permissions) {
|
|
6310
|
+
try {
|
|
6311
|
+
const permissionStatus = await navigator.permissions.query({
|
|
6312
|
+
name: "geolocation"
|
|
6313
|
+
});
|
|
6314
|
+
if (permissionStatus.state === "denied") {
|
|
6315
|
+
setGpsErrorType("permission");
|
|
6316
|
+
setShowGpsDialog(true);
|
|
6317
|
+
return;
|
|
6318
|
+
}
|
|
6319
|
+
} catch {
|
|
6320
|
+
}
|
|
6321
|
+
}
|
|
6322
|
+
setIsGeolocating(true);
|
|
6323
|
+
const timeoutId = setTimeout(() => {
|
|
6324
|
+
if (isGeolocating) {
|
|
6325
|
+
setIsGeolocating(false);
|
|
6326
|
+
setGpsErrorType("gps_off");
|
|
6327
|
+
setShowGpsDialog(true);
|
|
6328
|
+
}
|
|
6329
|
+
}, 5e3);
|
|
6330
|
+
navigator.geolocation.getCurrentPosition(
|
|
6331
|
+
async (pos) => {
|
|
6332
|
+
clearTimeout(timeoutId);
|
|
6333
|
+
setIsGeolocating(false);
|
|
6334
|
+
const { latitude: lat, longitude: lng } = pos.coords;
|
|
6335
|
+
const map = mapInstanceRef.current;
|
|
6336
|
+
const L = window.L;
|
|
6337
|
+
handleLocationChange(lat, lng);
|
|
6338
|
+
if (!markerRef.current) {
|
|
6339
|
+
markerRef.current = L.marker([lat, lng], { draggable: true }).addTo(
|
|
6340
|
+
map
|
|
6341
|
+
);
|
|
6342
|
+
markerRef.current.on("dragend", async (e) => {
|
|
6343
|
+
const { lat: dragLat, lng: dragLng } = e.target.getLatLng();
|
|
6344
|
+
handleLocationChange(dragLat, dragLng);
|
|
6345
|
+
if (handleAddressChange) {
|
|
6346
|
+
setIsGeocoding(true);
|
|
6347
|
+
const address = await reverseGeocode(dragLat, dragLng);
|
|
6348
|
+
handleAddressChange(address);
|
|
6349
|
+
setIsGeocoding(false);
|
|
6350
|
+
}
|
|
6351
|
+
});
|
|
6352
|
+
} else {
|
|
6353
|
+
markerRef.current.setLatLng([lat, lng]);
|
|
6354
|
+
}
|
|
6355
|
+
map.setView([lat, lng], 17, { animate: true });
|
|
6356
|
+
if (handleAddressChange) {
|
|
6357
|
+
setIsGeocoding(true);
|
|
6358
|
+
const address = await reverseGeocode(lat, lng);
|
|
6359
|
+
handleAddressChange(address);
|
|
6360
|
+
setIsGeocoding(false);
|
|
6361
|
+
}
|
|
6362
|
+
import_react_hot_toast2.default.success("\u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u0628\u0627 \u0645\u0648\u0641\u0642\u06CC\u062A \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F");
|
|
6363
|
+
},
|
|
6364
|
+
(error2) => {
|
|
6365
|
+
clearTimeout(timeoutId);
|
|
6366
|
+
setIsGeolocating(false);
|
|
6367
|
+
switch (error2.code) {
|
|
6368
|
+
case error2.PERMISSION_DENIED:
|
|
6369
|
+
setGpsErrorType("permission");
|
|
6370
|
+
break;
|
|
6371
|
+
case error2.POSITION_UNAVAILABLE:
|
|
6372
|
+
case error2.TIMEOUT:
|
|
6373
|
+
setGpsErrorType("gps_off");
|
|
6374
|
+
break;
|
|
6375
|
+
default:
|
|
6376
|
+
setGpsErrorType("other");
|
|
6377
|
+
break;
|
|
6378
|
+
}
|
|
6379
|
+
setShowGpsDialog(true);
|
|
6380
|
+
},
|
|
6381
|
+
{
|
|
6382
|
+
enableHighAccuracy: true,
|
|
6383
|
+
timeout: 8e3,
|
|
6384
|
+
maximumAge: 0
|
|
6385
|
+
}
|
|
6386
|
+
);
|
|
6387
|
+
};
|
|
6388
|
+
const handleClearLocation = () => {
|
|
6389
|
+
if (markerRef.current) {
|
|
6390
|
+
markerRef.current.remove();
|
|
6391
|
+
markerRef.current = null;
|
|
6392
|
+
}
|
|
6393
|
+
handleLocationChange(null, null);
|
|
6394
|
+
if (handleAddressChange) handleAddressChange("");
|
|
6395
|
+
};
|
|
6396
|
+
const handleGpsDialogClose = () => setShowGpsDialog(false);
|
|
6397
|
+
const handleRetryLocation = () => {
|
|
6398
|
+
setShowGpsDialog(false);
|
|
6399
|
+
setTimeout(handleCurrentLocation, 500);
|
|
6400
|
+
};
|
|
6401
|
+
const handleOpenSettings = () => {
|
|
6402
|
+
setShowGpsDialog(false);
|
|
6403
|
+
(0, import_react_hot_toast2.default)(
|
|
6404
|
+
/* @__PURE__ */ React.createElement("div", { dir: "rtl", style: { textAlign: "right" } }, /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "body2", sx: { mb: 1 } }, "\u0644\u0637\u0641\u0627\u064B \u0645\u0631\u0627\u062D\u0644 \u0632\u06CC\u0631 \u0631\u0627 \u0627\u0646\u062C\u0627\u0645 \u062F\u0647\u06CC\u062F:"), /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "caption", component: "div" }, "\u06F1. \u062A\u0646\u0638\u06CC\u0645\u0627\u062A \u062F\u0633\u062A\u06AF\u0627\u0647"), /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "caption", component: "div" }, "\u06F2. \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC"), /* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "caption", component: "div" }, "\u06F3. \u0641\u0639\u0627\u0644 \u06A9\u0631\u062F\u0646 GPS")),
|
|
6405
|
+
{ duration: 8e3 }
|
|
6406
|
+
);
|
|
6407
|
+
};
|
|
6408
|
+
return /* @__PURE__ */ React.createElement(import_material34.Box, { sx: { width: "100%" } }, /* @__PURE__ */ React.createElement(import_react_hot_toast2.Toaster, { position: "top-center" }), /* @__PURE__ */ React.createElement(import_material34.Dialog, { open: showGpsDialog, onClose: handleGpsDialogClose }, /* @__PURE__ */ React.createElement(import_material34.DialogTitle, null, "\u0645\u0634\u06A9\u0644 \u062F\u0631 \u062F\u0631\u06CC\u0627\u0641\u062A \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC"), /* @__PURE__ */ React.createElement(import_material34.DialogContent, null, gpsErrorType === "permission" ? /* @__PURE__ */ React.createElement(import_material34.Typography, null, "\u062F\u0633\u062A\u0631\u0633\u06CC \u0628\u0647 \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u0631\u062F \u0634\u062F\u0647 \u0627\u0633\u062A.", /* @__PURE__ */ React.createElement("br", null), "\u06F1. \u0631\u0648\u06CC \u0622\u06CC\u06A9\u0648\u0646 \u0642\u0641\u0644 \u062F\u0631 \u0646\u0648\u0627\u0631 \u0622\u062F\u0631\u0633 \u06A9\u0644\u06CC\u06A9 \u06A9\u0646\u06CC\u062F", /* @__PURE__ */ React.createElement("br", null), "\u06F2. \u0645\u0648\u0642\u0639\u06CC\u062A \u0645\u06A9\u0627\u0646\u06CC \u2192 \u0627\u062C\u0627\u0632\u0647 \u062F\u0647\u06CC\u062F") : gpsErrorType === "gps_off" ? /* @__PURE__ */ React.createElement(import_material34.Typography, null, "GPS \u062E\u0627\u0645\u0648\u0634 \u0627\u0633\u062A. \u0644\u0637\u0641\u0627\u064B \u0641\u0639\u0627\u0644 \u06A9\u0646\u06CC\u062F.") : /* @__PURE__ */ React.createElement(import_material34.Typography, null, "\u062E\u0637\u0627\u06CC\u06CC \u0631\u062E \u062F\u0627\u062F\u0647 \u0627\u0633\u062A. \u062F\u0648\u0628\u0627\u0631\u0647 \u062A\u0644\u0627\u0634 \u06A9\u0646\u06CC\u062F.")), /* @__PURE__ */ React.createElement(import_material34.DialogActions, { sx: { pb: 2, pr: 2 } }, /* @__PURE__ */ React.createElement(import_material34.Button, { onClick: handleGpsDialogClose }, "\u0627\u0646\u0635\u0631\u0627\u0641"), gpsErrorType === "permission" ? /* @__PURE__ */ React.createElement(
|
|
6409
|
+
import_material34.Button,
|
|
6410
|
+
{
|
|
6411
|
+
onClick: handleRetryLocation,
|
|
6412
|
+
variant: "contained",
|
|
6413
|
+
color: "primary"
|
|
6414
|
+
},
|
|
6415
|
+
"\u062A\u0644\u0627\u0634 \u0645\u062C\u062F\u062F"
|
|
6416
|
+
) : /* @__PURE__ */ React.createElement(
|
|
6417
|
+
import_material34.Button,
|
|
6418
|
+
{
|
|
6419
|
+
onClick: handleOpenSettings,
|
|
6420
|
+
variant: "contained",
|
|
6421
|
+
color: "primary"
|
|
6422
|
+
},
|
|
6423
|
+
"\u0631\u0627\u0647\u0646\u0645\u0627"
|
|
6424
|
+
))), /* @__PURE__ */ React.createElement(import_material34.Box, { sx: { position: "relative", height: "370px", width: "100%" } }, /* @__PURE__ */ React.createElement(
|
|
6425
|
+
import_material34.Paper,
|
|
6426
|
+
{
|
|
6427
|
+
sx: {
|
|
6428
|
+
height: "100%",
|
|
6429
|
+
position: "relative",
|
|
6430
|
+
overflow: "hidden",
|
|
6431
|
+
borderRadius: 2,
|
|
6432
|
+
border: error ? 2 : 0,
|
|
6433
|
+
borderColor: error ? "error.main" : "transparent"
|
|
6434
|
+
}
|
|
6435
|
+
},
|
|
6436
|
+
(isMapLoading || isGeocoding || isGeolocating || isLoading) && /* @__PURE__ */ React.createElement(
|
|
6437
|
+
import_material34.Box,
|
|
6438
|
+
{
|
|
6439
|
+
sx: {
|
|
6440
|
+
position: "absolute",
|
|
6441
|
+
inset: 0,
|
|
6442
|
+
display: "flex",
|
|
6443
|
+
alignItems: "center",
|
|
6444
|
+
justifyContent: "center",
|
|
6445
|
+
backgroundColor: isDarkMode ? "rgba(18,18,18,0.9)" : "rgba(255,255,255,0.8)",
|
|
6446
|
+
zIndex: 1e3,
|
|
6447
|
+
flexDirection: "column",
|
|
6448
|
+
gap: 1
|
|
6449
|
+
}
|
|
6450
|
+
},
|
|
6451
|
+
/* @__PURE__ */ React.createElement(import_material34.CircularProgress, null),
|
|
6452
|
+
/* @__PURE__ */ React.createElement(import_material34.Typography, null, isMapLoading ? "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0646\u0642\u0634\u0647..." : isLoading ? "\u062F\u0631 \u062D\u0627\u0644 \u0628\u0627\u0631\u06AF\u0630\u0627\u0631\u06CC \u0627\u0637\u0644\u0627\u0639\u0627\u062A \u0645\u0648\u0642\u0639\u06CC\u062A..." : isGeocoding ? "\u062F\u0631 \u062D\u0627\u0644 \u062F\u0631\u06CC\u0627\u0641\u062A \u0622\u062F\u0631\u0633..." : "\u062F\u0631 \u062D\u0627\u0644 \u062F\u0631\u06CC\u0627\u0641\u062A \u0645\u0648\u0642\u0639\u06CC\u062A \u0641\u0639\u0644\u06CC...")
|
|
6453
|
+
),
|
|
6454
|
+
/* @__PURE__ */ React.createElement("div", { ref: mapRef, style: { height: "100%", width: "100%" } }),
|
|
6455
|
+
/* @__PURE__ */ React.createElement(
|
|
6456
|
+
import_material34.Box,
|
|
6457
|
+
{
|
|
6458
|
+
sx: {
|
|
6459
|
+
position: "absolute",
|
|
6460
|
+
bottom: 16,
|
|
6461
|
+
right: 16,
|
|
6462
|
+
display: "flex",
|
|
6463
|
+
flexDirection: "column",
|
|
6464
|
+
gap: 1,
|
|
6465
|
+
zIndex: 1e3
|
|
6466
|
+
}
|
|
6467
|
+
},
|
|
6468
|
+
/* @__PURE__ */ React.createElement(
|
|
6469
|
+
import_material34.IconButton,
|
|
6470
|
+
{
|
|
6471
|
+
onClick: handleCurrentLocation,
|
|
6472
|
+
disabled: isGeolocating,
|
|
6473
|
+
sx: {
|
|
6474
|
+
backgroundColor: isDarkMode ? "#1e1e1e" : "white",
|
|
6475
|
+
boxShadow: 2,
|
|
6476
|
+
"&:hover": {
|
|
6477
|
+
backgroundColor: isDarkMode ? "#2a2a2a" : "#f5f5f5"
|
|
6478
|
+
}
|
|
6479
|
+
},
|
|
6480
|
+
title: "\u0645\u0648\u0642\u0639\u06CC\u062A \u0641\u0639\u0644\u06CC"
|
|
6481
|
+
},
|
|
6482
|
+
/* @__PURE__ */ React.createElement(import_md13.MdMyLocation, null)
|
|
6483
|
+
),
|
|
6484
|
+
hasExistingLocation && /* @__PURE__ */ React.createElement(
|
|
6485
|
+
import_material34.IconButton,
|
|
6486
|
+
{
|
|
6487
|
+
onClick: handleClearLocation,
|
|
6488
|
+
sx: {
|
|
6489
|
+
backgroundColor: isDarkMode ? "#1e1e1e" : "white",
|
|
6490
|
+
color: theme3.palette.error.main,
|
|
6491
|
+
boxShadow: 2,
|
|
6492
|
+
"&:hover": {
|
|
6493
|
+
backgroundColor: isDarkMode ? "#2a2a2a" : "#f5f5f5"
|
|
6494
|
+
}
|
|
6495
|
+
},
|
|
6496
|
+
title: "\u067E\u0627\u06A9 \u06A9\u0631\u062F\u0646 \u0645\u0648\u0642\u0639\u06CC\u062A"
|
|
6497
|
+
},
|
|
6498
|
+
/* @__PURE__ */ React.createElement(import_md13.MdOutlineClear, null)
|
|
6499
|
+
)
|
|
6500
|
+
)
|
|
6501
|
+
)), /* @__PURE__ */ React.createElement(
|
|
6502
|
+
import_material34.Box,
|
|
6503
|
+
{
|
|
6504
|
+
sx: {
|
|
6505
|
+
mt: 1,
|
|
6506
|
+
p: 1.5,
|
|
6507
|
+
backgroundColor: isDarkMode ? "#1e1e1e" : "#f5f5f5",
|
|
6508
|
+
borderRadius: 1,
|
|
6509
|
+
display: "flex",
|
|
6510
|
+
justifyContent: "space-between",
|
|
6511
|
+
alignItems: "center"
|
|
6512
|
+
}
|
|
6513
|
+
},
|
|
6514
|
+
/* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "body2", sx: { fontFamily: "monospace" } }, /* @__PURE__ */ React.createElement("strong", null, "\u0639\u0631\u0636 \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC:"), " ", typeof latitude === "number" ? latitude.toFixed(6) : "\u2014"),
|
|
6515
|
+
/* @__PURE__ */ React.createElement(import_material34.Typography, { variant: "body2", sx: { fontFamily: "monospace" } }, /* @__PURE__ */ React.createElement("strong", null, "\u0637\u0648\u0644 \u062C\u063A\u0631\u0627\u0641\u06CC\u0627\u06CC\u06CC:"), " ", typeof longitude === "number" ? longitude.toFixed(6) : "\u2014")
|
|
6516
|
+
), error && helperText && /* @__PURE__ */ React.createElement(
|
|
6517
|
+
import_material34.Typography,
|
|
6518
|
+
{
|
|
6519
|
+
variant: "caption",
|
|
6520
|
+
sx: {
|
|
6521
|
+
color: "error.main",
|
|
6522
|
+
mt: 0.5,
|
|
6523
|
+
display: "block",
|
|
6524
|
+
px: 1.5
|
|
6525
|
+
}
|
|
6526
|
+
},
|
|
6527
|
+
helperText
|
|
6528
|
+
));
|
|
6529
|
+
}
|
|
6121
6530
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6122
6531
|
0 && (module.exports = {
|
|
6123
6532
|
Accordion,
|
|
@@ -6142,6 +6551,7 @@ var upload_image_default = UploadImage2;
|
|
|
6142
6551
|
HorizontalStepper,
|
|
6143
6552
|
ImgViewer,
|
|
6144
6553
|
LicensePlate,
|
|
6554
|
+
MapLocationPicker,
|
|
6145
6555
|
MobileDateTimePicker,
|
|
6146
6556
|
Modal,
|
|
6147
6557
|
NestedSelectort,
|