upd: user
Deskripsi: - tambah input select jabatan pada edit profile - tambah loading pada input select jabatan halaman edit profile - tambah loading pada input select jabatan halaman edit member No Issues
This commit is contained in:
@@ -30,6 +30,7 @@ export default function EditMember({ id }: { id: string }) {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const roleLogin = useHookstate(globalRole)
|
||||
const tema = useHookstate(TEMA)
|
||||
const [loadingPosition, setLoadingPosition] = useState(true)
|
||||
const [touched, setTouched] = useState({
|
||||
nik: false,
|
||||
name: false,
|
||||
@@ -83,6 +84,7 @@ export default function EditMember({ id }: { id: string }) {
|
||||
|
||||
async function getAllPosition(val: any) {
|
||||
try {
|
||||
setLoadingPosition(true)
|
||||
const res = await funGetAllPosition(
|
||||
"?active=true" + "&group=" + `${val}`
|
||||
);
|
||||
@@ -90,6 +92,8 @@ export default function EditMember({ id }: { id: string }) {
|
||||
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoadingPosition(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,19 +237,14 @@ export default function EditMember({ id }: { id: string }) {
|
||||
</Indicator>
|
||||
}
|
||||
{loading ?
|
||||
<>
|
||||
<Skeleton height={40} mt={20} radius={30} />
|
||||
<Skeleton height={40} mt={10} radius={30} />
|
||||
<Skeleton height={40} mt={10} radius={30} />
|
||||
<Skeleton height={40} mt={10} radius={30} />
|
||||
<Skeleton height={40} mt={10} radius={30} />
|
||||
<Skeleton height={40} mt={10} radius={30} />
|
||||
<Skeleton height={40} mt={10} radius={30} />
|
||||
</>
|
||||
[...Array(6)].map((_, index) => (
|
||||
<Skeleton key={index} height={40} mt={20} radius={30} />
|
||||
))
|
||||
:
|
||||
<>
|
||||
<Select
|
||||
placeholder="Pilih Jabatan" label="Jabatan" w={"100%"} size="md" required withAsterisk radius={30}
|
||||
placeholder={loadingPosition ? "Loading.. " : "Pilih Jabatan"}
|
||||
label="Jabatan" w={"100%"} size="md" required withAsterisk radius={30}
|
||||
styles={{
|
||||
input: {
|
||||
color: tema.get().utama,
|
||||
|
||||
@@ -10,6 +10,7 @@ import { HiMagnifyingGlass } from "react-icons/hi2"
|
||||
import { useWibuRealtime } from "wibu-realtime"
|
||||
import { funGetAllmember } from "../lib/api_member"
|
||||
import { IListMember } from "../lib/type_member"
|
||||
import { funGetUserByCookies } from "@/module/auth"
|
||||
|
||||
|
||||
export default function TabListMember() {
|
||||
@@ -32,16 +33,18 @@ export default function TabListMember() {
|
||||
project: "sdm"
|
||||
})
|
||||
const [isRefresh, setRefresh] = useState(false)
|
||||
const [userLogin, setUserLogin] = useState<any>('')
|
||||
|
||||
|
||||
async function getAllUser(loading: boolean) {
|
||||
try {
|
||||
if (loading)
|
||||
setLoading(true)
|
||||
setLoading(loading)
|
||||
const res = await funGetAllmember('?active=' + status + '&group=' + group + '&search=' + searchQuery + '&page=' + isPage)
|
||||
const user = await funGetUserByCookies()
|
||||
if (res.success) {
|
||||
setNameGroup(res.filter.name)
|
||||
setIdGroup(res.filter.id)
|
||||
setUserLogin(user.id)
|
||||
if (isPage == 1) {
|
||||
setDataMember(res.data)
|
||||
} else {
|
||||
@@ -148,9 +151,7 @@ export default function TabListMember() {
|
||||
dataMember.map((v, i) => {
|
||||
return (
|
||||
<Box my={10} key={i}>
|
||||
<Box onClick={() => {
|
||||
router.push(`/member/${v.id}`)
|
||||
}}>
|
||||
<Box onClick={() => { userLogin == v.id ? router.push(`/profile`) : router.push(`/member/${v.id}`) }}>
|
||||
<Grid p={5} align="center">
|
||||
<Grid.Col
|
||||
span={{
|
||||
|
||||
Reference in New Issue
Block a user