fixed bugs
This commit is contained in:
23
src/core/components/PersianTextField.jsx
Normal file
23
src/core/components/PersianTextField.jsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import usePersianInput from "@/lib/hooks/usePersianInput";
|
||||
import { TextField } from "@mui/material";
|
||||
import { useRef } from "react";
|
||||
|
||||
const PersianTextField = (props) => {
|
||||
const { fieldOnChange, ...rest } = props;
|
||||
const inputRef = useRef(null);
|
||||
|
||||
const handleChange = (value) => {
|
||||
fieldOnChange(value);
|
||||
}
|
||||
|
||||
usePersianInput(inputRef, handleChange);
|
||||
|
||||
return (
|
||||
<TextField
|
||||
ref={inputRef}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default PersianTextField
|
||||
@@ -4,6 +4,8 @@ function SelectBox({
|
||||
name,
|
||||
value,
|
||||
onChange,
|
||||
isDependency = false,
|
||||
dependencyLabel = '',
|
||||
onBlur,
|
||||
selectors,
|
||||
label,
|
||||
@@ -28,10 +30,12 @@ function SelectBox({
|
||||
}}
|
||||
onBlur={onBlur}
|
||||
>
|
||||
{isLoading ? (
|
||||
<MenuItem sx={{ color: "primary.main" }}>درحال دریافت اطلاعات...</MenuItem>
|
||||
{isDependency ? (
|
||||
<MenuItem value={'dependency'} sx={{ color: "primary.main" }}>{dependencyLabel}</MenuItem>
|
||||
) : isLoading ? (
|
||||
<MenuItem value={'loading'} sx={{ color: "primary.main" }}>درحال دریافت اطلاعات...</MenuItem>
|
||||
) : errorEcured ? (
|
||||
<MenuItem sx={{ color: "secondary.main" }}>خطا در دریافت اطلاعات!!!</MenuItem>
|
||||
<MenuItem value={'error'} sx={{ color: "secondary.main" }}>خطا در دریافت اطلاعات!!!</MenuItem>
|
||||
) : (
|
||||
selectors.map((selector) => {
|
||||
return (
|
||||
|
||||
20
src/core/utils/nationalCodeValidation.js
Normal file
20
src/core/utils/nationalCodeValidation.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function validateNationalCode(code) {
|
||||
const invalidCodes = ["1111111111", "2222222222", "3333333333", "4444444444", "5555555555", "6666666666", "7777777777", "8888888888", "9999999999"];
|
||||
if (invalidCodes.includes(code)) return false;
|
||||
|
||||
const L = code.length;
|
||||
if (L < 8 || parseInt(code, 10) === 0) return false;
|
||||
|
||||
code = code.padStart(10, '0');
|
||||
if (parseInt(code.substr(3, 6), 10) === 0) return false;
|
||||
|
||||
const c = parseInt(code.charAt(9), 10);
|
||||
let s = 0;
|
||||
for (let i = 0; i < 9; i++) {
|
||||
s += parseInt(code.charAt(i), 10) * (10 - i);
|
||||
}
|
||||
s = s % 11;
|
||||
return (s < 2 && c === s) || (s >= 2 && c === (11 - s));
|
||||
}
|
||||
|
||||
export default validateNationalCode;
|
||||
@@ -97,8 +97,10 @@ export const SEND_SMS_AGAIN = api + "/api/v3/receipts/send_sms_again";
|
||||
export const EXPORT_DAMAGES_OPERATOR_LIST = api + "/api/v3/receipts/excel_report";
|
||||
export const GET_DAMAGE_ITEM_DETAILS = api + "/api/v3/receipts";
|
||||
export const UPDATE_DAMAGE_ITEM = api + "/api/v3/receipts";
|
||||
export const GET_INSURANCE_PAGE = api + "/api/v3/receipts/generate_insurance_letter";
|
||||
export const GET_POLICERAH_PAGE = api + "/api/v3/receipts/generate_police_document";
|
||||
export const GET_INSURANCE = api + "/api/v3/receipts/generate_insurance_letter";
|
||||
export const GET_INSURANCE_PAGE = api + "/v2/receipt/send-to-insurance";
|
||||
export const GET_POLICERAH = api + "/api/v3/receipts/generate_insurance_letter";
|
||||
export const GET_POLICERAH_PAGE = api + "/v2/receipt/document-release";
|
||||
|
||||
// recept report
|
||||
export const GET_COUNTRY_RECEIPT_REPORT = api + "/api/v3/receipt_reports/country_report";
|
||||
|
||||
Reference in New Issue
Block a user