Merge branch 'family-type' of WrenchBoard/Users-Wrench into master
This commit is contained in:
@@ -38,7 +38,7 @@ const validationSchema = Yup.object().shape({
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default function InviteRelative({action, situation, setReloadRelList}) {
|
export default function InviteRelative({action, situation, setReloadRelList, relativeList}) {
|
||||||
|
|
||||||
const api = new usersService()
|
const api = new usersService()
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ export default function InviteRelative({action, situation, setReloadRelList}) {
|
|||||||
|
|
||||||
{/* Type */}
|
{/* Type */}
|
||||||
<div className="md:flex md:space-x-7 items-end mb-6">
|
<div className="md:flex md:space-x-7 items-end mb-6">
|
||||||
<div className="field w-full mb-6 md:mb-0">
|
{/* <div className="field w-full mb-6 md:mb-0">
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-6"
|
fieldClass="px-6"
|
||||||
label="Type"
|
label="Type"
|
||||||
@@ -179,6 +179,52 @@ export default function InviteRelative({action, situation, setReloadRelList}) {
|
|||||||
blurHandler={props.handleBlur}
|
blurHandler={props.handleBlur}
|
||||||
error={(props.errors.family_type && props.touched.family_type) ? props.errors.family_type : '' }
|
error={(props.errors.family_type && props.touched.family_type) ? props.errors.family_type : '' }
|
||||||
/>
|
/>
|
||||||
|
</div> */}
|
||||||
|
<div className="field w-full mb-6 xl:mb-0">
|
||||||
|
<label
|
||||||
|
htmlFor="family_type"
|
||||||
|
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex item-center gap-1"
|
||||||
|
>
|
||||||
|
Family Type
|
||||||
|
{props.errors.family_type && props.touched.family_type && (
|
||||||
|
<span className="text-[12px] text-red-500">
|
||||||
|
{props.errors.family_type}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
id="family_type"
|
||||||
|
name="family_type"
|
||||||
|
value={props.values.family_type}
|
||||||
|
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none border`}
|
||||||
|
onChange={props.handleChange}
|
||||||
|
onBlur={props.handleBlur}
|
||||||
|
>
|
||||||
|
{relativeList?.loading ? (
|
||||||
|
<option className="text-slate-500 text-lg" value="">
|
||||||
|
Loading...
|
||||||
|
</option>
|
||||||
|
) : relativeList?.family_types?.length ? (
|
||||||
|
<>
|
||||||
|
<option className="text-slate-500 text-lg" value="">
|
||||||
|
Select Family Type
|
||||||
|
</option>
|
||||||
|
{relativeList?.family_types?.map((item, index) => (
|
||||||
|
<option
|
||||||
|
key={index}
|
||||||
|
className="text-slate-500 text-lg"
|
||||||
|
value={item?.ty}
|
||||||
|
>
|
||||||
|
{item?.ty}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<option className="text-slate-500 text-lg" value="">
|
||||||
|
No Options Found! Try Again
|
||||||
|
</option>
|
||||||
|
)}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="field w-full flex justify-end">
|
<div className="field w-full flex justify-end">
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ const Relatives = () => {
|
|||||||
|
|
||||||
const [invitePopout, setInvitePopout] = useState(false)
|
const [invitePopout, setInvitePopout] = useState(false)
|
||||||
|
|
||||||
const [relativeList, setRelativeList] = useState({loading: true, data:[]})
|
const [relativeList, setRelativeList] = useState({loading: true, result_list:[], family_types:[]})
|
||||||
|
|
||||||
const showInviteMemberPopout = () => {
|
const showInviteMemberPopout = () => {
|
||||||
setInvitePopout(true)
|
setInvitePopout(true)
|
||||||
@@ -21,14 +21,14 @@ const Relatives = () => {
|
|||||||
const getRelativeList = () => {
|
const getRelativeList = () => {
|
||||||
setRelativeList(prev => ({...prev, loading: true}))
|
setRelativeList(prev => ({...prev, loading: true}))
|
||||||
api.getFamilyRelativeList().then(response => {
|
api.getFamilyRelativeList().then(response => {
|
||||||
let {data:{result_list}} = response
|
let {status, data} = response
|
||||||
if(!result_list || result_list?.length <= 0){
|
if(status != 200 || !data){
|
||||||
setRelativeList({loading:false, data:[]})
|
setRelativeList({loading:false, result_list:[], family_types:[]})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setRelativeList({loading:false, data:result_list})
|
setRelativeList({loading:false, result_list:data?.result_list, family_types:data?.family_types})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
setRelativeList({loading:false, data:[]})
|
setRelativeList({loading:false, result_list:[], family_types:[]})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ const Relatives = () => {
|
|||||||
{relativeList.loading ?
|
{relativeList.loading ?
|
||||||
<LoadingSpinner size='8' height='h-full' />
|
<LoadingSpinner size='8' height='h-full' />
|
||||||
:
|
:
|
||||||
<RelativeTable relativeList={relativeList.data} />
|
<RelativeTable relativeList={relativeList.result_list} />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -58,6 +58,7 @@ const Relatives = () => {
|
|||||||
action={()=>setInvitePopout(false)}
|
action={()=>setInvitePopout(false)}
|
||||||
situation={invitePopout}
|
situation={invitePopout}
|
||||||
setReloadRelList={setReloadRelList}
|
setReloadRelList={setReloadRelList}
|
||||||
|
relativeList={relativeList}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{/* END OF INVITE RELATIVE POPOUT */}
|
{/* END OF INVITE RELATIVE POPOUT */}
|
||||||
|
|||||||
Reference in New Issue
Block a user