This commit is contained in:
2024-07-26 16:37:27 +05:30
parent 9b83e090c0
commit bcf7cb7050
5 changed files with 24 additions and 12 deletions

View File

@@ -475,6 +475,7 @@ const FormField = ({
textAlign={arabic || type === "number" ? "right" : align ? align : "left"}
_placeholder={{ fontSize: "sm" }}
min={type === "date" ? today : undefined}
maxLength={maxLength}
// defaultValue={type === "date" && "2023-07-26" : undefined}
// value={"2023-07-26"}

View File

@@ -17,10 +17,12 @@ import CustomAlertDialog from "../../../Components/CustomAlertDialog";
// ======================= [validation] =========================
export const addInvestmentType = yup.object().shape({
investmentTypeName: yup.string().required("Investment name is required"),
note: yup.string(),
investmentTypeNameArabic: yup.string().required("Investment name is required"),
noteArabic: yup.string(),
investmentTypeName: yup.string()
.required('Investment type is required')
.max(50, 'Investment name cannot be more than 50 characters'),
note: yup.string().notRequired(),
investmentTypeNameArabic: yup.string().required(),
noteArabic: yup.string().notRequired(),
});
// ==================== [debounce] ========================
@@ -35,9 +37,6 @@ export function debounce(func, delay) {
const AddInvestmentType = () => {
const navigate = useNavigate();
const toast = useToast();
const params = useParams();
@@ -69,6 +68,8 @@ const AddInvestmentType = () => {
const {data: investmentTypeByIdData,error,isLoading,} = useGetInvestmentTypeByIdQuery(id, { skip: !id });
// ========================== [useEffect] ================================
useEffect(() => {
@@ -168,6 +169,7 @@ const AddInvestmentType = () => {
type: "text",
isRequired: true,
section: "Add Details",
maxLength:50
},
{
label: "Investment Type (Arabic) ",
@@ -177,6 +179,7 @@ const AddInvestmentType = () => {
isRequired: true,
section: "Add Details",
arabic: true,
maxLength:255
},
{
label: "Description (English)",
@@ -185,6 +188,7 @@ const AddInvestmentType = () => {
type: "textarea",
// isRequired: true,
section: "Add Details",
maxLength:255
},
{
label: "Description (Arabic)",
@@ -194,6 +198,7 @@ const AddInvestmentType = () => {
// isRequired: true,
arabic: true,
section: "Add Details",
maxLength:255
},
];

View File

@@ -60,6 +60,7 @@ const EditInvestmentType = () => {
type: "text",
isRequired: true,
section: "Personal Details",
maxLength:50
},
{
label: "Investment Name (Arabic)",
@@ -74,15 +75,16 @@ const EditInvestmentType = () => {
label: "Description",
value: foundObject.description,
name: "description",
type: "text",
type: "textarea",
isRequired: true,
section: "Personal Details",
maxLength:255
},
{
label: "Description Arabic",
value: foundObject.descriptionArabic,
name: "descriptionArabic",
type: "text",
type: "textarea",
isRequired: true,
arabic: true,
section: "Personal Details",

View File

@@ -162,6 +162,7 @@ const AddSponser = () => {
type: "text",
isRequired: true,
section: "Add Details",
maxLength:50
},
{
label: "Sponser name (Arabic)",
@@ -172,6 +173,7 @@ const AddSponser = () => {
section: "Add Details",
arabic: true,
right: true,
maxLength:255
},
{
label: "Email address",
@@ -193,6 +195,7 @@ const AddSponser = () => {
type: "text",
isRequired: true,
section: "Add Details",
maxLength:50
},
{
label: "Sponser name (Arabic)",
@@ -202,6 +205,7 @@ const AddSponser = () => {
isRequired: true,
section: "Add Details",
arabic: true,
maxLength:255
},
{
label: "Email adress",

View File

@@ -8,7 +8,7 @@ const baseUrl = api?.defaults.baseURL;
export const investmentType = createApi({
reducerPath: "investmentType",
baseQuery: fetchBaseQuery({ baseUrl }),
tagTypes: ["getInvestmentType"],
tagTypes: ["getInvestmentType", "getInvestmentTypeID"],
endpoints: (builder) => ({
// ========[Get All]=========
@@ -23,7 +23,7 @@ export const investmentType = createApi({
getInvestmentTypeById: builder.query({
query: (id) => `/investmentType/admin/${id}`,
invalidatesTags: ["getInvestmentType"],
providesTags: ["getInvestmentTypeID"],
}),
// ========[Create Investment]========
@@ -45,7 +45,7 @@ export const investmentType = createApi({
method: "PATCH",
body: data,
}),
invalidatesTags: ["getInvestmentType"],
invalidatesTags: ["getInvestmentTypeID", "getInvestmentType"],
}),
// ========[Delete Investment]=======