get api
This commit is contained in:
@@ -18,7 +18,7 @@ const FirstComponent = () => {
|
|||||||
<Typography>{t("Dashboard.go_to_add_request_loan")}</Typography>
|
<Typography>{t("Dashboard.go_to_add_request_loan")}</Typography>
|
||||||
<Button
|
<Button
|
||||||
component={NextLinkComposed}
|
component={NextLinkComposed}
|
||||||
to={{ pathname: "/dashboard/navgan/past-add-request-loan" }}
|
to={{ pathname: "/dashboard/navgan/add-request-loan" }}
|
||||||
variant={"contained"}
|
variant={"contained"}
|
||||||
size={"large"}
|
size={"large"}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
|||||||
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations()
|
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations()
|
||||||
const {activityType, isLoadingActivityType, errorActivityType} = useActivityType()
|
const {activityType, isLoadingActivityType, errorActivityType} = useActivityType()
|
||||||
const {priorityLists, isLoadingPriorityLists, errorPriorityLists} = usePriorityLists()
|
const {priorityLists, isLoadingPriorityLists, errorPriorityLists} = usePriorityLists()
|
||||||
|
const {projectTitle, isLoadingProjectTitle, errorProjectTitle} = useProjectTitle()
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
person_type: "legal",
|
person_type: "legal",
|
||||||
@@ -133,17 +134,17 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let _data = {
|
let _data = {
|
||||||
is_legal_person: values.person_type === 'legal' ? 1 : 0,
|
is_legal_person: 1 ,
|
||||||
telephone_number: values.company_tel_number,
|
telephone_number: values.company_tel_number,
|
||||||
register_number: values.register_number,
|
register_number: values.register_number,
|
||||||
national_code: values.boss_national_code,
|
national_id: values.boss_national_code,
|
||||||
vehicle_type: values.vehicle_type,
|
vehicle_type: values.vehicle_type,
|
||||||
company_name: values.company_name,
|
company_name: values.company_name,
|
||||||
province_id: values.province_id,
|
province_id: values.province_id,
|
||||||
father_name: values.father_name,
|
|
||||||
first_name: values.first_name,
|
|
||||||
last_name: values.last_name,
|
|
||||||
city_id: values.city_id,
|
city_id: values.city_id,
|
||||||
|
father_name: values.boss_father_name,
|
||||||
|
first_name: values.boss_first_name,
|
||||||
|
last_name: values.boss_last_name,
|
||||||
navgan_id: values.navgan_id,
|
navgan_id: values.navgan_id,
|
||||||
postal_code: values.postal_code,
|
postal_code: values.postal_code,
|
||||||
navgan_type: values.navgan_type,
|
navgan_type: values.navgan_type,
|
||||||
@@ -177,27 +178,27 @@ const LegalPersonForm = ({setFinishLoanRequest}) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Grid container spacing={2} sx={{p: 2}}>
|
<Grid container spacing={2} sx={{p: 2}}>
|
||||||
{/*<Grid item xs={12} sm={4}>*/}
|
<Grid item xs={12} sm={4}>
|
||||||
{/* <SelectBox*/}
|
<SelectBox
|
||||||
{/* name="project_title"*/}
|
name="project_title"
|
||||||
{/* label={t("LoanRequest.text_field_project_title")}*/}
|
label={t("LoanRequest.text_field_project_title")}
|
||||||
{/* size="small"*/}
|
size="small"
|
||||||
{/* selectType="project_title"*/}
|
selectType="project_title"
|
||||||
{/* isLoading={isLoadingProjectTitle}*/}
|
isLoading={isLoadingProjectTitle}
|
||||||
{/* errorEcured={errorProjectTitle}*/}
|
errorEcured={errorProjectTitle}
|
||||||
{/* selectors={projectTitle}*/}
|
selectors={projectTitle}
|
||||||
{/* schema={{value: 'value', name: 'name'}}*/}
|
schema={{value: 'value', name: 'name'}}
|
||||||
{/* select={formik.values.project_title}*/}
|
select={formik.values.project_title}
|
||||||
{/* value={formik.values.project_title}*/}
|
value={formik.values.project_title}
|
||||||
{/* handleChange={(event) => {*/}
|
handleChange={(event) => {
|
||||||
{/* formik.setFieldValue('project_title', event.target.value)*/}
|
formik.setFieldValue('project_title', event.target.value)
|
||||||
{/* }}*/}
|
}}
|
||||||
{/* setFieldTouched={formik.setFieldTouched}*/}
|
setFieldTouched={formik.setFieldTouched}
|
||||||
{/* error={formik.touched.project_title && Boolean(formik.errors.project_title)}*/}
|
error={formik.touched.project_title && Boolean(formik.errors.project_title)}
|
||||||
{/* helperText={formik.touched.project_title && formik.errors.project_title}*/}
|
helperText={formik.touched.project_title && formik.errors.project_title}
|
||||||
{/* onBlur={formik.handleBlur("project_title")}*/}
|
onBlur={formik.handleBlur("project_title")}
|
||||||
{/* />*/}
|
/>
|
||||||
{/*</Grid>*/}
|
</Grid>
|
||||||
<Grid item xs={12} sm={4}>
|
<Grid item xs={12} sm={4}>
|
||||||
<SelectBox
|
<SelectBox
|
||||||
name="activity_type"
|
name="activity_type"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import UseEducations from "@/lib/app/hooks/useEducations";
|
|||||||
import useOccupations from "@/lib/app/hooks/useOccupations";
|
import useOccupations from "@/lib/app/hooks/useOccupations";
|
||||||
import useActivityType from "@/lib/app/hooks/useActivityType";
|
import useActivityType from "@/lib/app/hooks/useActivityType";
|
||||||
import usePriorityLists from "@/lib/app/hooks/usePriorityLists";
|
import usePriorityLists from "@/lib/app/hooks/usePriorityLists";
|
||||||
|
import useProjectTitle from "@/lib/app/hooks/useProjectTitle";
|
||||||
|
|
||||||
const RealPersonForm = ({setFinishLoanRequest}) => {
|
const RealPersonForm = ({setFinishLoanRequest}) => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
@@ -25,6 +26,7 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
|||||||
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations()
|
const {occupationsList, isLoadingOccupationsList, errorOccupationsList} = useOccupations()
|
||||||
const {activityType, isLoadingActivityType, errorActivityType} = useActivityType()
|
const {activityType, isLoadingActivityType, errorActivityType} = useActivityType()
|
||||||
const {priorityLists, isLoadingPriorityLists, errorPriorityLists} = usePriorityLists()
|
const {priorityLists, isLoadingPriorityLists, errorPriorityLists} = usePriorityLists()
|
||||||
|
const {projectTitle, isLoadingProjectTitle, errorProjectTitle} = useProjectTitle()
|
||||||
const requestServer = useRequest()
|
const requestServer = useRequest()
|
||||||
const {getUser, changeUser} = useUser()
|
const {getUser, changeUser} = useUser()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@@ -129,18 +131,23 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
|||||||
let _data = {
|
let _data = {
|
||||||
is_legal_person: 0,
|
is_legal_person: 0,
|
||||||
telephone_number: values.telephone_number,
|
telephone_number: values.telephone_number,
|
||||||
national_code: values.national_code,
|
national_id: values.national_code,
|
||||||
vehicle_type: values.vehicle_type,
|
vehicle_type: values.vehicle_type,
|
||||||
province_id: values.province_id,
|
province_id: values.province_id,
|
||||||
|
city_id: values.city_id,
|
||||||
father_name: values.father_name,
|
father_name: values.father_name,
|
||||||
first_name: values.first_name,
|
first_name: values.first_name,
|
||||||
last_name: values.last_name,
|
last_name: values.last_name,
|
||||||
city_id: values.city_id,
|
|
||||||
navgan_id: values.navgan_id,
|
navgan_id: values.navgan_id,
|
||||||
postal_code: values.postal_code,
|
postal_code: values.postal_code,
|
||||||
navgan_type: values.navgan_type,
|
navgan_type: values.navgan_type,
|
||||||
gender: values.gender,
|
gender: values.gender,
|
||||||
address: values.address,
|
address: values.address,
|
||||||
|
education_id: values.education_id,
|
||||||
|
occupation_id: values.occupation_id,
|
||||||
|
activity_type: values.activity_type,
|
||||||
|
project_title: values.project_title,
|
||||||
|
priority_list: values.priority_list,
|
||||||
birthday: values.birthday.locale('en').format("YYYY-MM-DD"), ..._national_card, ..._national_number
|
birthday: values.birthday.locale('en').format("YYYY-MM-DD"), ..._national_card, ..._national_number
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,27 +171,27 @@ const RealPersonForm = ({setFinishLoanRequest}) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Grid container spacing={2} sx={{p: 2}}>
|
<Grid container spacing={2} sx={{p: 2}}>
|
||||||
{/*<Grid item xs={12} sm={4}>*/}
|
<Grid item xs={12} sm={4}>
|
||||||
{/* <SelectBox*/}
|
<SelectBox
|
||||||
{/* name="project_title"*/}
|
name="project_title"
|
||||||
{/* label={t("LoanRequest.text_field_project_title")}*/}
|
label={t("LoanRequest.text_field_project_title")}
|
||||||
{/* size="small"*/}
|
size="small"
|
||||||
{/* selectType="project_title"*/}
|
selectType="project_title"
|
||||||
{/* isLoading={isLoadingProjectTitle}*/}
|
isLoading={isLoadingProjectTitle}
|
||||||
{/* errorEcured={errorProjectTitle}*/}
|
errorEcured={errorProjectTitle}
|
||||||
{/* selectors={projectTitle}*/}
|
selectors={projectTitle}
|
||||||
{/* schema={{value: 'value', name: 'name'}}*/}
|
schema={{value: 'value', name: 'name'}}
|
||||||
{/* select={formik.values.project_title}*/}
|
select={formik.values.project_title}
|
||||||
{/* value={formik.values.project_title}*/}
|
value={formik.values.project_title}
|
||||||
{/* handleChange={(event) => {*/}
|
handleChange={(event) => {
|
||||||
{/* formik.setFieldValue('project_title', event.target.value)*/}
|
formik.setFieldValue('project_title', event.target.value)
|
||||||
{/* }}*/}
|
}}
|
||||||
{/* setFieldTouched={formik.setFieldTouched}*/}
|
setFieldTouched={formik.setFieldTouched}
|
||||||
{/* error={formik.touched.project_title && Boolean(formik.errors.project_title)}*/}
|
error={formik.touched.project_title && Boolean(formik.errors.project_title)}
|
||||||
{/* helperText={formik.touched.project_title && formik.errors.project_title}*/}
|
helperText={formik.touched.project_title && formik.errors.project_title}
|
||||||
{/* onBlur={formik.handleBlur("project_title")}*/}
|
onBlur={formik.handleBlur("project_title")}
|
||||||
{/* />*/}
|
/>
|
||||||
{/*</Grid>*/}
|
</Grid>
|
||||||
<Grid item xs={12} sm={4}>
|
<Grid item xs={12} sm={4}>
|
||||||
<SelectBox
|
<SelectBox
|
||||||
name="activity_type"
|
name="activity_type"
|
||||||
|
|||||||
@@ -11,10 +11,9 @@ const useProjectTitle = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsLoadingProjectTitle(true)
|
setIsLoadingProjectTitle(true)
|
||||||
requestServer(GET_PROJECT_TITLE, 'get', {auth: true, notification: false}).then(({data}) => {
|
requestServer(GET_PROJECT_TITLE, 'get', {auth: true, notification: false}).then(({data}) => {
|
||||||
console.log(data)
|
|
||||||
const formattedData = data.data.map((projectTitle, index) => ({
|
const formattedData = data.data.map((projectTitle, index) => ({
|
||||||
id: index,
|
id: index,
|
||||||
name: projectTitle.name,
|
name: projectTitle.title,
|
||||||
value: projectTitle.id,
|
value: projectTitle.id,
|
||||||
}));
|
}));
|
||||||
setIsLoadingProjectTitle(false)
|
setIsLoadingProjectTitle(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user