Compare commits
7 Commits
amalia/29-
...
amalia/01-
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d72c365da | |||
| 589068703d | |||
| 7c713cc6e0 | |||
| d3c63fbcdd | |||
| ea29785a34 | |||
| e7ef09e9aa | |||
| 5898655fac |
1
app.json
1
app.json
@@ -42,6 +42,7 @@
|
||||
}
|
||||
],
|
||||
"expo-font",
|
||||
"expo-image-picker",
|
||||
"expo-web-browser",
|
||||
[
|
||||
"@react-native-firebase/app",
|
||||
|
||||
@@ -7,7 +7,7 @@ import { apiGetAnnouncementOne } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { Entypo, MaterialIcons } from "@expo/vector-icons";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Dimensions, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import RenderHTML from 'react-native-render-html';
|
||||
import { useSelector } from "react-redux";
|
||||
@@ -51,6 +51,11 @@ export default function DetailAnnouncement() {
|
||||
handleLoad(true)
|
||||
}, [])
|
||||
|
||||
function hasHtmlTags(text: string) {
|
||||
const htmlRegex = /<[a-z][\s\S]*>/i;
|
||||
return htmlRegex.test(text);
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<Stack.Screen
|
||||
@@ -84,10 +89,15 @@ export default function DetailAnnouncement() {
|
||||
<Text style={[Styles.textDefaultSemiBold]}>{data?.title}</Text>
|
||||
</View>
|
||||
<View style={[Styles.mt10]}>
|
||||
{
|
||||
hasHtmlTags(data?.desc) ?
|
||||
<RenderHTML
|
||||
contentWidth={contentWidth}
|
||||
source={{ html: data?.desc }}
|
||||
/>
|
||||
:
|
||||
<Text>{data?.desc}</Text>
|
||||
}
|
||||
</View>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function EditBanner() {
|
||||
const pickImageAsync = async () => {
|
||||
let result = await ImagePicker.launchImageLibraryAsync({
|
||||
mediaTypes: ["images"],
|
||||
allowsEditing: true,
|
||||
allowsEditing: false,
|
||||
quality: 1,
|
||||
aspect: [1535, 450],
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function CreateBanner() {
|
||||
const pickImageAsync = async () => {
|
||||
let result = await ImagePicker.launchImageLibraryAsync({
|
||||
mediaTypes: ["images"],
|
||||
allowsEditing: true,
|
||||
allowsEditing: false,
|
||||
quality: 1,
|
||||
aspect: [1535, 450],
|
||||
});
|
||||
|
||||
@@ -119,7 +119,7 @@ export default function BannerList() {
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
style={[{height:'100%'}]}
|
||||
style={[Styles.h100]}
|
||||
>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{entities.map((index: any, key: number) => (
|
||||
|
||||
@@ -6,6 +6,7 @@ import { InputForm } from "@/components/inputForm";
|
||||
import LabelStatus from "@/components/labelStatus";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
import SkeletonContent from "@/components/skeletonContent";
|
||||
import Text from '@/components/Text';
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDiscussionGeneralOne, apiSendDiscussionGeneralCommentar } from "@/lib/api";
|
||||
@@ -14,8 +15,7 @@ import { Ionicons, MaterialIcons } from "@expo/vector-icons";
|
||||
import { firebase } from '@react-native-firebase/database';
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Pressable, ScrollView, View } from "react-native";
|
||||
import Text from '@/components/Text';
|
||||
import { KeyboardAvoidingView, Platform, Pressable, ScrollView, View } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
type Props = {
|
||||
@@ -195,9 +195,12 @@ export default function DetailDiscussionGeneral() {
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<View style={[
|
||||
Styles.contentItemCenter,
|
||||
Styles.absolute0,
|
||||
Styles.w100,
|
||||
{ backgroundColor: "#f4f4f4" },
|
||||
]}>
|
||||
@@ -219,6 +222,7 @@ export default function DetailDiscussionGeneral() {
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</KeyboardAvoidingView>
|
||||
</View >
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -114,7 +114,7 @@ export default function AddMemberDiscussionDetail() {
|
||||
<ImageWithLabel
|
||||
key={index}
|
||||
label={item.name}
|
||||
src={item.img}
|
||||
src={`https://wibu-storage.wibudev.com/api/files/${item.img}`}
|
||||
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
||||
/>
|
||||
))
|
||||
|
||||
@@ -84,6 +84,9 @@ export default function CreateDiscussionGeneral() {
|
||||
checkForm();
|
||||
}, [error, dataForm]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(setMemberChoose([]))
|
||||
}, [])
|
||||
|
||||
function handleBack() {
|
||||
dispatch(setMemberChoose([]))
|
||||
@@ -101,9 +104,12 @@ export default function CreateDiscussionGeneral() {
|
||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||
router.back()
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +174,7 @@ export default function CreateDiscussionGeneral() {
|
||||
error={error.desc}
|
||||
errorText="Diskusi tidak boleh kosong"
|
||||
onChange={(val) => { validationForm("desc", val) }}
|
||||
multiline
|
||||
/>
|
||||
<ButtonSelect
|
||||
value="Pilih Anggota"
|
||||
|
||||
@@ -135,6 +135,7 @@ export default function EditDiscussionGeneral() {
|
||||
value={dataForm.desc}
|
||||
errorText="Diskusi tidak boleh kosong"
|
||||
onChange={(val) => validationForm("desc", val)}
|
||||
multiline
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
@@ -6,6 +6,7 @@ import DrawerBottom from "@/components/drawerBottom"
|
||||
import ImageUser from "@/components/imageNew"
|
||||
import MenuItemRow from "@/components/menuItemRow"
|
||||
import Skeleton from "@/components/skeleton"
|
||||
import Text from "@/components/Text"
|
||||
import Styles from "@/constants/Styles"
|
||||
import { apiDeleteCalendarMember, apiGetCalendarOne, apiGetDivisionOneFeature } from "@/lib/api"
|
||||
import { setUpdateCalendar } from "@/lib/calendarUpdate"
|
||||
@@ -13,7 +14,7 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
||||
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router"
|
||||
import { useEffect, useState } from "react"
|
||||
import { SafeAreaView, ScrollView, Text, View } from "react-native"
|
||||
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native"
|
||||
import Toast from "react-native-toast-message"
|
||||
import { useDispatch, useSelector } from "react-redux"
|
||||
|
||||
@@ -52,7 +53,7 @@ export default function DetailEventCalendar() {
|
||||
const entityUser = useSelector((state: any) => state.user);
|
||||
const [isMemberDivision, setIsMemberDivision] = useState(false);
|
||||
const [loading, setLoading] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 5 })
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
async function handleCheckMember() {
|
||||
try {
|
||||
@@ -69,9 +70,9 @@ export default function DetailEventCalendar() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLoad() {
|
||||
async function handleLoad(loading:boolean) {
|
||||
try {
|
||||
setLoading(true)
|
||||
setLoading(loading)
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetCalendarOne({
|
||||
user: hasil,
|
||||
@@ -105,7 +106,7 @@ export default function DetailEventCalendar() {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad();
|
||||
handleLoad(true);
|
||||
handleCheckMember()
|
||||
}, []);
|
||||
|
||||
@@ -133,6 +134,15 @@ export default function DetailEventCalendar() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false)
|
||||
handleLoadMember()
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<Stack.Screen
|
||||
@@ -143,7 +153,15 @@ export default function DetailEventCalendar() {
|
||||
headerRight: () => (entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision ? <></> : <HeaderRightCalendarDetail id={String(data?.idCalendar)} idReminder={String(detail)} />
|
||||
}}
|
||||
/>
|
||||
<ScrollView>
|
||||
<ScrollView
|
||||
style={[Styles.h100]}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.wrapPaper, Styles.mb15]}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
|
||||
@@ -10,6 +10,8 @@ import { stringToDateTime } from "@/lib/fun_stringToDate";
|
||||
import { Stack, router, useLocalSearchParams } from "expo-router";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View
|
||||
@@ -141,8 +143,12 @@ export default function CalendarDivisionCreate() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.p15]}>
|
||||
<InputForm
|
||||
label="Nama Acara"
|
||||
type="default"
|
||||
@@ -229,6 +235,7 @@ export default function CalendarDivisionCreate() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
|
||||
<ModalSelect
|
||||
category={"type-event-repeat"}
|
||||
|
||||
@@ -144,7 +144,9 @@ export default function CalendarDivision() {
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}>
|
||||
}
|
||||
style={[Styles.h100]}
|
||||
>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||
<Datepicker
|
||||
@@ -155,6 +157,13 @@ export default function CalendarDivision() {
|
||||
onChange={({ date }) => setSelected(date)}
|
||||
styles={{
|
||||
selected: Styles.selectedDate,
|
||||
month_label: Styles.cBlack,
|
||||
month_selector_label: Styles.cBlack,
|
||||
year_label: Styles.cBlack,
|
||||
year_selector_label: Styles.cBlack,
|
||||
day_label: Styles.cBlack,
|
||||
time_label: Styles.cBlack,
|
||||
weekday_label: Styles.cBlack,
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Ionicons, MaterialIcons } from "@expo/vector-icons";
|
||||
import { firebase } from "@react-native-firebase/database";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Pressable, ScrollView, View } from "react-native";
|
||||
import { KeyboardAvoidingView, Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
type Props = {
|
||||
@@ -58,6 +58,7 @@ export default function DiscussionDetail() {
|
||||
const [loadingKomentar, setLoadingKomentar] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 3 })
|
||||
const reference = firebase.app().database('https://mobile-darmasaba-default-rtdb.asia-southeast1.firebasedatabase.app').ref(`/discussion-division/${detail}`);
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
@@ -165,6 +166,15 @@ export default function DiscussionDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false)
|
||||
handleLoadComment(false)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Stack.Screen
|
||||
@@ -189,7 +199,14 @@ export default function DiscussionDetail() {
|
||||
}}
|
||||
/>
|
||||
<View style={{ flex: 1 }}>
|
||||
<ScrollView>
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{
|
||||
loading ?
|
||||
@@ -264,10 +281,13 @@ export default function DiscussionDetail() {
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<View
|
||||
style={[
|
||||
Styles.contentItemCenter,
|
||||
Styles.absolute0,
|
||||
Styles.w100,
|
||||
{ backgroundColor: "#f4f4f4" },
|
||||
]}
|
||||
@@ -321,6 +341,8 @@ export default function DiscussionDetail() {
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</KeyboardAvoidingView>
|
||||
|
||||
</View>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -110,10 +110,6 @@ export default function DocumentDivision() {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, [path, update]);
|
||||
|
||||
const handleCheckboxChange = (index: number) => {
|
||||
setDariSelectAll(false);
|
||||
if (selectedFiles.some((i: any) => i.id == data[index].id)) {
|
||||
@@ -243,6 +239,7 @@ export default function DocumentDivision() {
|
||||
|
||||
useEffect(() => {
|
||||
handleBatal();
|
||||
handleLoad(false)
|
||||
}, [update]);
|
||||
|
||||
async function handleShare(selectedDivision: any[]) {
|
||||
@@ -270,7 +267,7 @@ export default function DocumentDivision() {
|
||||
|
||||
|
||||
const openFile = (item: Props) => {
|
||||
setLoadingOpen(true)
|
||||
if (Platform.OS == 'android') setLoadingOpen(true)
|
||||
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
|
||||
const fileName = item.name + '.' + item.extension;
|
||||
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||
@@ -278,9 +275,9 @@ export default function DocumentDivision() {
|
||||
|
||||
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
||||
const contentURL = await FileSystem.getContentUriAsync(uri);
|
||||
setLoadingOpen(false)
|
||||
try {
|
||||
if (Platform.OS == 'android') {
|
||||
// open with android intent
|
||||
await startActivityAsync(
|
||||
'android.intent.action.VIEW',
|
||||
{
|
||||
@@ -289,16 +286,13 @@ export default function DocumentDivision() {
|
||||
type: mimeType as string,
|
||||
}
|
||||
);
|
||||
// or
|
||||
// Sharing.shareAsync(localPath);
|
||||
|
||||
} else if (Platform.OS == 'ios') {
|
||||
Sharing.shareAsync(localPath);
|
||||
}
|
||||
} catch (error) {
|
||||
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
||||
} finally {
|
||||
setLoadingOpen(false)
|
||||
if (Platform.OS == 'android') setLoadingOpen(false)
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -310,6 +304,10 @@ export default function DocumentDivision() {
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, [path]);
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<Stack.Screen
|
||||
@@ -351,7 +349,7 @@ export default function DocumentDivision() {
|
||||
/>
|
||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||
<ScrollView
|
||||
style={{ height: "100%" }}
|
||||
style={[Styles.h100]}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
@@ -375,7 +373,7 @@ export default function DocumentDivision() {
|
||||
}}
|
||||
>
|
||||
{item.id != "home" && (
|
||||
<AntDesign name="right" style={[Styles.mh05, Styles.mt02]} />
|
||||
<AntDesign name="right" style={[Styles.mh05, Styles.mt02]} color="black" />
|
||||
)}
|
||||
<Text> {item.name} </Text>
|
||||
</Pressable>
|
||||
@@ -538,13 +536,11 @@ export default function DocumentDivision() {
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={modalMore}
|
||||
setVisible={setModalMore}
|
||||
setVisible={() => { setModalMore(false) }}
|
||||
title=""
|
||||
>
|
||||
<ModalMore
|
||||
onClose={() => {
|
||||
setModalMore(false);
|
||||
}}
|
||||
onClose={() => { setModalMore(false); }}
|
||||
data={selectedFiles}
|
||||
share={shareSelected}
|
||||
/>
|
||||
@@ -553,10 +549,8 @@ export default function DocumentDivision() {
|
||||
<ModalFloat
|
||||
title="Ganti Nama"
|
||||
isVisible={isRename}
|
||||
setVisible={setRename}
|
||||
onSubmit={() => {
|
||||
handleRename();
|
||||
}}
|
||||
setVisible={() => { setRename(false) }}
|
||||
onSubmit={() => { handleRename() }}
|
||||
disableSubmit={bodyRename.name == ""}
|
||||
>
|
||||
<View>
|
||||
@@ -576,7 +570,7 @@ export default function DocumentDivision() {
|
||||
title="Bagikan"
|
||||
category="share-division"
|
||||
open={isShare}
|
||||
close={setShare}
|
||||
close={() => { setShare(false) }}
|
||||
onSelect={(value) => {
|
||||
handleShare(value)
|
||||
}}
|
||||
|
||||
@@ -36,19 +36,21 @@ export default function TaskDivisionAddFile() {
|
||||
const pickDocumentAsync = async () => {
|
||||
let result = await DocumentPicker.getDocumentAsync({
|
||||
type: ["*/*"],
|
||||
multiple: false,
|
||||
multiple: true,
|
||||
});
|
||||
if (!result.canceled) {
|
||||
if (result.assets?.[0].uri) {
|
||||
const check = await handleCheckFile(result.assets?.[0]);
|
||||
for (let i = 0; i < result.assets?.length; i++) {
|
||||
if (result.assets?.[i].uri) {
|
||||
const check = await handleCheckFile(result.assets?.[i]);
|
||||
if (check) {
|
||||
setFileForm([...fileForm, result.assets?.[0]]);
|
||||
setListFile([...listFile, result.assets?.[0].name]);
|
||||
setFileForm((prev) => [...prev, result.assets?.[i]]);
|
||||
setListFile((prev) => [...prev, result.assets?.[i].name]);
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'File sudah ada', })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function deleteFile(index: number) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import dayjs from "dayjs";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
SafeAreaView,
|
||||
KeyboardAvoidingView, Platform, SafeAreaView,
|
||||
ScrollView,
|
||||
View
|
||||
} from "react-native";
|
||||
@@ -121,6 +121,10 @@ export default function TaskDivisionAddTask() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||
@@ -174,6 +178,8 @@ export default function TaskDivisionAddTask() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { apiGetTaskOne } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
type Props = {
|
||||
@@ -29,6 +29,7 @@ export default function DetailTaskDivision() {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [progress, setProgress] = useState(0)
|
||||
const update = useSelector((state: any) => state.taskUpdate)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
|
||||
async function handleLoad(cat: 'data' | 'progress') {
|
||||
@@ -56,6 +57,14 @@ export default function DetailTaskDivision() {
|
||||
handleLoad('progress')
|
||||
}, [update.progress])
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
await handleLoad('data')
|
||||
await handleLoad('progress')
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<Stack.Screen
|
||||
@@ -66,15 +75,22 @@ export default function DetailTaskDivision() {
|
||||
headerRight: () => <HeaderRightTaskDetail id={detail} division={id} status={data?.status} />,
|
||||
}}
|
||||
/>
|
||||
<ScrollView>
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{
|
||||
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
||||
}
|
||||
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
||||
<SectionTanggalTugasTask />
|
||||
<SectionFileTask />
|
||||
<SectionMemberTask />
|
||||
<SectionTanggalTugasTask refreshing={refreshing}/>
|
||||
<SectionFileTask refreshing={refreshing}/>
|
||||
<SectionMemberTask refreshing={refreshing}/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
|
||||
@@ -52,11 +52,13 @@ export default function CreateTaskDivision() {
|
||||
const pickDocumentAsync = async () => {
|
||||
let result = await DocumentPicker.getDocumentAsync({
|
||||
type: ["*/*"],
|
||||
multiple: false
|
||||
multiple: true
|
||||
});
|
||||
if (!result.canceled) {
|
||||
if (result.assets[0].uri) {
|
||||
setFileForm([...fileForm, result.assets[0]])
|
||||
for (let i = 0; i < result.assets?.length; i++) {
|
||||
if (result.assets[i].uri) {
|
||||
setFileForm((prev) => [...prev, result.assets[i]])
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,6 +8,8 @@ import dayjs from "dayjs";
|
||||
import { router, Stack } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View
|
||||
@@ -97,6 +99,10 @@ export default function CreateTaskAddTugas() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||
@@ -150,6 +156,7 @@ export default function CreateTaskAddTugas() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export default function ListTask() {
|
||||
:
|
||||
data.length > 0 ? (
|
||||
isList ? (
|
||||
<View>
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
@@ -241,7 +241,7 @@ export default function ListTask() {
|
||||
))} */}
|
||||
</View>
|
||||
) : (
|
||||
<View>
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
|
||||
@@ -10,6 +10,8 @@ import dayjs from "dayjs";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View
|
||||
@@ -39,9 +41,9 @@ export default function UpdateProjectTaskDivision() {
|
||||
});
|
||||
|
||||
const from = range.startDate
|
||||
? dayjs(range.startDate).format("MMM DD, YYYY")
|
||||
? dayjs(range.startDate).format("DD-MM-YYYY")
|
||||
: "";
|
||||
const to = range.endDate ? dayjs(range.endDate).format("MMM DD, YYYY") : "";
|
||||
const to = range.endDate ? dayjs(range.endDate).format("DD-MM-YYYY") : "";
|
||||
|
||||
async function handleLoad() {
|
||||
try {
|
||||
@@ -141,6 +143,10 @@ export default function UpdateProjectTaskDivision() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||
@@ -200,6 +206,8 @@ export default function UpdateProjectTaskDivision() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ export default function AddMemberDivision() {
|
||||
<ImageWithLabel
|
||||
key={index}
|
||||
label={item.name}
|
||||
src={item.img}
|
||||
src={`https://wibu-storage.wibudev.com/api/files/${item.img}`}
|
||||
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
||||
/>
|
||||
))
|
||||
|
||||
@@ -134,11 +134,11 @@ export default function InformationDivision() {
|
||||
headerRight: () => <HeaderRightDivisionInfo id={id} active={dataDetail?.isActive} />,
|
||||
}}
|
||||
/>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<ScrollView style={[Styles.h100]}>
|
||||
<View style={[Styles.p15]}>
|
||||
{
|
||||
dataDetail?.isActive == false && (
|
||||
<SectionCancel title={'Divisi dinonaktifkan'} />
|
||||
<SectionCancel title={'Divisi nonaktif'} />
|
||||
)
|
||||
}
|
||||
<View style={[Styles.mb15]}>
|
||||
|
||||
@@ -4,6 +4,7 @@ import InputSearch from "@/components/inputSearch";
|
||||
import PaperGridContent from "@/components/paperGridContent";
|
||||
import Skeleton from "@/components/skeleton";
|
||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||
import Text from "@/components/Text";
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDivision } from "@/lib/api";
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Pressable, RefreshControl, View, VirtualizedList } from "react-native";
|
||||
import Text from "@/components/Text";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
type Props = {
|
||||
@@ -218,7 +218,7 @@ export default function ListDivision() {
|
||||
</View>
|
||||
) : (
|
||||
isList ? (
|
||||
<View style={[Styles.mb50]}>
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
style={[{ paddingBottom: 100 }]}
|
||||
@@ -253,7 +253,7 @@ export default function ListDivision() {
|
||||
/>
|
||||
</View>
|
||||
) : (
|
||||
<View>
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
style={[{ paddingBottom: 100 }]}
|
||||
|
||||
@@ -187,7 +187,7 @@ export default function EditProfile() {
|
||||
const pickImageAsync = async () => {
|
||||
let result = await ImagePicker.launchImageLibraryAsync({
|
||||
mediaTypes: ["images"],
|
||||
allowsEditing: true,
|
||||
allowsEditing: false,
|
||||
quality: 1,
|
||||
aspect: [1, 1],
|
||||
});
|
||||
|
||||
@@ -112,14 +112,6 @@ export default function Index() {
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.wrapBtnTab]}>
|
||||
<ButtonTab
|
||||
@@ -138,6 +130,15 @@ export default function Index() {
|
||||
n={2} />
|
||||
</View>
|
||||
<InputSearch onChange={setSearch} />
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
style={[Styles.h100]}
|
||||
>
|
||||
<View>
|
||||
{
|
||||
|
||||
@@ -173,8 +174,8 @@ export default function Index() {
|
||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title={titleChoose}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
@@ -203,7 +204,7 @@ export default function Index() {
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<DrawerBottom animation="none" height={30} isVisible={isVisibleEdit} setVisible={() => setVisibleEdit(false)} title="Edit Lembaga Desa">
|
||||
<DrawerBottom animation="none" keyboard height={30} isVisible={isVisibleEdit} setVisible={() => setVisibleEdit(false)} title="Edit Lembaga Desa">
|
||||
<View style={{ flex: 1 }}>
|
||||
<View>
|
||||
<InputForm type="default" placeholder="Nama Lembaga Desa" required label="Lembaga Desa" value={titleChoose} onChange={setTitleChoose} />
|
||||
|
||||
@@ -9,7 +9,7 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetProfile } from "@/lib/api";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
type Props = {
|
||||
@@ -34,10 +34,11 @@ export default function MemberDetail() {
|
||||
const [isEdit, setEdit] = useState(true)
|
||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
async function handleLoad() {
|
||||
async function handleLoad(loading: boolean) {
|
||||
try {
|
||||
setLoading(true)
|
||||
setLoading(loading)
|
||||
const response = await apiGetProfile({ id: id })
|
||||
setData(response.data)
|
||||
setEdit(valueRoleUser.filter((v) => v.login == entityUser.role)[0]?.data.some((i: any) => i.id == response.data.idUserRole))
|
||||
@@ -50,9 +51,17 @@ export default function MemberDetail() {
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad()
|
||||
handleLoad(true)
|
||||
}, []);
|
||||
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
handleLoad(false)
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<Stack.Screen
|
||||
@@ -64,9 +73,16 @@ export default function MemberDetail() {
|
||||
headerShadowVisible: false
|
||||
}}
|
||||
/>
|
||||
<ScrollView>
|
||||
<View style={{ flexDirection: 'column' }}>
|
||||
<View style={[Styles.wrapHeadViewMember]}>
|
||||
<ScrollView
|
||||
style={[Styles.h100]}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<View style={[Styles.wrapHeadViewMember,]}>
|
||||
{
|
||||
loading ?
|
||||
<>
|
||||
@@ -106,7 +122,6 @@ export default function MemberDetail() {
|
||||
}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
)
|
||||
|
||||
@@ -15,6 +15,8 @@ import { router, Stack } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
Image,
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
Pressable,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
@@ -34,6 +36,7 @@ export default function CreateMember() {
|
||||
const [chooseGender, setChooseGender] = useState({ val: "", label: "" });
|
||||
const [selectedImage, setSelectedImage] = useState<string | undefined>(undefined);
|
||||
const entityUser = useSelector((state: any) => state.user);
|
||||
const entities = useSelector((state: any) => state.entities)
|
||||
const [isSelect, setSelect] = useState(false);
|
||||
const [disableBtn, setDisableBtn] = useState(true)
|
||||
const [valChoose, setValChoose] = useState("")
|
||||
@@ -140,6 +143,12 @@ export default function CreateMember() {
|
||||
checkForm()
|
||||
}, [error, dataForm])
|
||||
|
||||
useEffect(() => {
|
||||
if(entityUser.role !="supadmin" && entityUser.role != "developer"){
|
||||
validationForm("group", entities.idGroup, entities.group)
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
async function handleCreate() {
|
||||
try {
|
||||
@@ -160,7 +169,7 @@ export default function CreateMember() {
|
||||
fd.append("file", "undefined")
|
||||
}
|
||||
|
||||
const response = await apiCreateUser(fd)
|
||||
const response = await apiCreateUser({data: fd})
|
||||
if (response.success) {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||
dispatch(setUpdateMember(!update))
|
||||
@@ -177,7 +186,7 @@ export default function CreateMember() {
|
||||
const pickImageAsync = async () => {
|
||||
let result = await ImagePicker.launchImageLibraryAsync({
|
||||
mediaTypes: ["images"],
|
||||
allowsEditing: true,
|
||||
allowsEditing: false,
|
||||
quality: 1,
|
||||
aspect: [1, 1],
|
||||
});
|
||||
@@ -213,8 +222,13 @@ export default function CreateMember() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
style={[Styles.h100]}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
||||
{selectedImage != undefined ? (
|
||||
<Pressable onPress={pickImageAsync}>
|
||||
@@ -335,10 +349,12 @@ export default function CreateMember() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
|
||||
|
||||
<ModalSelect
|
||||
category={valSelect}
|
||||
close={setSelect}
|
||||
close={() => { setSelect(false) }}
|
||||
onSelect={(value) => {
|
||||
validationForm(valSelect, value.val, value.label);
|
||||
}}
|
||||
|
||||
@@ -13,6 +13,8 @@ import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
Image,
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
Pressable,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
@@ -210,7 +212,7 @@ export default function EditMember() {
|
||||
const pickImageAsync = async () => {
|
||||
let result = await ImagePicker.launchImageLibraryAsync({
|
||||
mediaTypes: ["images"],
|
||||
allowsEditing: true,
|
||||
allowsEditing: false,
|
||||
quality: 1,
|
||||
aspect: [1, 1],
|
||||
});
|
||||
@@ -249,6 +251,12 @@ export default function EditMember() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
|
||||
<KeyboardAvoidingView
|
||||
style={[Styles.h100]}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
||||
@@ -374,6 +382,7 @@ export default function EditMember() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
|
||||
<ModalSelect
|
||||
category={valSelect}
|
||||
|
||||
@@ -131,14 +131,6 @@ export default function Index() {
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<ScrollView
|
||||
style={{ height: '100%' }}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}>
|
||||
<View style={[Styles.p15]}>
|
||||
<View style={[Styles.wrapBtnTab]}>
|
||||
<ButtonTab
|
||||
@@ -163,6 +155,14 @@ export default function Index() {
|
||||
<Text>Filter : {nameGroup}</Text>
|
||||
</View>
|
||||
}
|
||||
<ScrollView
|
||||
style={[Styles.h100]}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}>
|
||||
<View>
|
||||
{
|
||||
loading ?
|
||||
@@ -193,8 +193,8 @@ export default function Index() {
|
||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
|
||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title={chooseData.name}>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
@@ -224,7 +224,7 @@ export default function Index() {
|
||||
</DrawerBottom>
|
||||
|
||||
|
||||
<DrawerBottom animation="none" height={30} backdropPressable={false} isVisible={isVisibleEdit} setVisible={() => setVisibleEdit(false)} title="Edit Jabatan">
|
||||
<DrawerBottom animation="none" keyboard height={30} backdropPressable={false} isVisible={isVisibleEdit} setVisible={() => setVisibleEdit(false)} title="Edit Jabatan">
|
||||
<View style={{ justifyContent: 'space-between', flex: 1 }}>
|
||||
<View>
|
||||
<InputForm
|
||||
|
||||
@@ -30,16 +30,19 @@ export default function ProjectAddFile() {
|
||||
const pickDocumentAsync = async () => {
|
||||
let result = await DocumentPicker.getDocumentAsync({
|
||||
type: ["*/*"],
|
||||
multiple: false
|
||||
multiple: true
|
||||
});
|
||||
|
||||
if (!result.canceled) {
|
||||
if (result.assets?.[0].uri) {
|
||||
const check = await handleCheckFile(result.assets?.[0])
|
||||
for (let i = 0; i < result.assets?.length; i++) {
|
||||
if (result.assets?.[i].uri) {
|
||||
const check = await handleCheckFile(result.assets?.[i])
|
||||
if (check) {
|
||||
setFileForm([...fileForm, result.assets?.[0]])
|
||||
setListFile([...listFile, result.assets?.[0].name])
|
||||
setFileForm((prev) => [...prev, result.assets?.[i]])
|
||||
setListFile((prev) => [...prev, result.assets?.[i].name])
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'File sudah ada', })
|
||||
Toast.show({ type: 'small', text1: 'File yg telah terupload tidak bisa diupload ulang', })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import dayjs from "dayjs";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View
|
||||
@@ -101,6 +103,10 @@ export default function ProjectAddTask() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||
@@ -154,6 +160,7 @@ export default function ProjectAddTask() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { apiGetProjectOne } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ export default function DetailProject() {
|
||||
const update = useSelector((state: any) => state.projectUpdate)
|
||||
const [isMember, setIsMember] = useState(false)
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const [refreshing, setRefreshing] = useState(false)
|
||||
|
||||
async function handleLoad(cat: 'data' | 'progress') {
|
||||
try {
|
||||
@@ -79,6 +80,14 @@ export default function DetailProject() {
|
||||
}, [])
|
||||
|
||||
|
||||
const handleRefresh = async () => {
|
||||
setRefreshing(true)
|
||||
await handleLoad('data')
|
||||
await handleLoad('progress')
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
setRefreshing(false)
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<Stack.Screen
|
||||
@@ -89,15 +98,22 @@ export default function DetailProject() {
|
||||
headerRight: () => (entityUser.role == "user" || entityUser.role == "coadmin") && !isMember ? null : <HeaderRightProjectDetail id={id} status={data?.status} />,
|
||||
}}
|
||||
/>
|
||||
<ScrollView>
|
||||
<ScrollView
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
{
|
||||
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
||||
}
|
||||
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
||||
<SectionTanggalTugasProject status={data?.status} member={isMember} />
|
||||
<SectionFile status={data?.status} member={isMember} />
|
||||
<SectionMember status={data?.status} />
|
||||
<SectionTanggalTugasProject status={data?.status} member={isMember} refreshing={refreshing}/>
|
||||
<SectionFile status={data?.status} member={isMember} refreshing={refreshing} />
|
||||
<SectionMember status={data?.status} refreshing={refreshing} />
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
|
||||
@@ -146,11 +146,13 @@ export default function CreateProject() {
|
||||
const pickDocumentAsync = async () => {
|
||||
let result = await DocumentPicker.getDocumentAsync({
|
||||
type: ["*/*"],
|
||||
multiple: false
|
||||
multiple: true
|
||||
});
|
||||
if (!result.canceled) {
|
||||
if (result.assets[0].uri) {
|
||||
setFileForm([...fileForm, result.assets[0]])
|
||||
for (let i = 0; i < result.assets?.length; i++) {
|
||||
if (result.assets[i].uri) {
|
||||
setFileForm((prev) => [...prev, result.assets[i]])
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8,6 +8,8 @@ import dayjs from "dayjs";
|
||||
import { router, Stack } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
View
|
||||
@@ -97,6 +99,10 @@ export default function CreateProjectAddTask() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||
@@ -150,6 +156,7 @@ export default function CreateProjectAddTask() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ export default function ListProject() {
|
||||
data.length > 0
|
||||
?
|
||||
isList ? (
|
||||
<View>
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
@@ -280,7 +280,7 @@ export default function ListProject() {
|
||||
} */}
|
||||
</View>
|
||||
) : (
|
||||
<View>
|
||||
<View style={[Styles.h100]}>
|
||||
<VirtualizedList
|
||||
data={data}
|
||||
getItemCount={() => data.length}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import dayjs from "dayjs";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||
import { KeyboardAvoidingView, Platform, SafeAreaView, ScrollView, View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
import DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
@@ -114,6 +114,10 @@ export default function UpdateProjectTask() {
|
||||
/>
|
||||
}}
|
||||
/>
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={110}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||
@@ -171,6 +175,7 @@ export default function UpdateProjectTask() {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</KeyboardAvoidingView>
|
||||
</SafeAreaView>
|
||||
)
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export default function ButtonTab({ active, value, onPress, label, n, icon }: Pr
|
||||
return (
|
||||
<TouchableOpacity style={[Styles.btnTab, (active == value) && ColorsStatus.orange, { width: n == 2 ? '50%' : 'auto' }]} onPress={() => { onPress() }}>
|
||||
{icon}
|
||||
<Text style={[Styles.textMediumSemiBold, Styles.ml10, { color: active == value ? 'white' : 'black' }]}>{label}</Text>
|
||||
<Text numberOfLines={1} style={[Styles.textMediumSemiBold, Styles.ml10, { color: active == value ? 'white' : 'black' }]}>{label}</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
@@ -34,7 +34,9 @@ export default function HeaderDiscussionGeneral() {
|
||||
title="Filter"
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setTimeout(() => {
|
||||
setFilter(true)
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ export default function HeaderRightDivisionList() {
|
||||
title="Filter"
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setTimeout(() => {
|
||||
setFilter(true)
|
||||
}, 600);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -23,11 +23,12 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const dispatch = useDispatch()
|
||||
const update = useSelector((state: any) => state.dokumenUpdate)
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
async function handleCreateFolder() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiCreateFolderDocument({ user: hasil, name, path, idDivision: id })
|
||||
const response = await apiCreateFolderDocument({ data: { user: hasil, name, path, idDivision: id } })
|
||||
if (response.success) {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil membuat folder baru', })
|
||||
dispatch(setUpdateDokumen(!update))
|
||||
@@ -56,6 +57,7 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
||||
|
||||
async function handleUploadFile(file: any) {
|
||||
try {
|
||||
setLoading(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const fd = new FormData()
|
||||
fd.append("file", {
|
||||
@@ -85,6 +87,7 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +102,7 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={isVisible}
|
||||
setVisible={setVisible}
|
||||
setVisible={() => { setVisible(false) }}
|
||||
title="Menu"
|
||||
>
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
@@ -111,10 +114,12 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
||||
size={25}
|
||||
/>
|
||||
}
|
||||
title="Tambah Dokumen"
|
||||
title="Tambah Folder"
|
||||
onPress={() => {
|
||||
setVisible(false);
|
||||
setTimeout(() => {
|
||||
setNewFolder(true);
|
||||
}, 600);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -128,11 +133,9 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
||||
<ModalFloat
|
||||
title="Buat Folder Baru"
|
||||
isVisible={newFolder}
|
||||
setVisible={setNewFolder}
|
||||
setVisible={() => { setNewFolder(false) }}
|
||||
disableSubmit={name == ""}
|
||||
onSubmit={() => {
|
||||
handleCreateFolder()
|
||||
}}
|
||||
onSubmit={() => { handleCreateFolder() }}
|
||||
>
|
||||
<View>
|
||||
<InputForm
|
||||
@@ -140,9 +143,7 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
||||
placeholder="Nama Folder"
|
||||
required
|
||||
label="Nama Folder"
|
||||
onChange={(value: string) => {
|
||||
setName(value);
|
||||
}}
|
||||
onChange={(value: string) => { setName(value) }}
|
||||
/>
|
||||
</View>
|
||||
</ModalFloat>
|
||||
|
||||
@@ -3,10 +3,11 @@ import { apiGetDocumentInformasi } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Pressable, ScrollView, View } from "react-native";
|
||||
import { ActivityIndicator, Pressable, ScrollView, View } from "react-native";
|
||||
import { useSharedValue } from "react-native-reanimated";
|
||||
import ItemAccordion from "../itemAccordion";
|
||||
import ItemDetailMember from "../itemDetailMember";
|
||||
import ModalLoading from "../modalLoading";
|
||||
import Text from "../Text";
|
||||
|
||||
type Props = {
|
||||
@@ -29,9 +30,11 @@ export default function ModalInformasi({ data }: { data: any }) {
|
||||
const [dataInformasi, setDataInformasi] = useState<Props>()
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const [dataShare, setDataShare] = useState<PropsShare[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
async function handleInformasi() {
|
||||
try {
|
||||
setLoading(true)
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDocumentInformasi({ user: hasil, item: data.id, cat: 'lainnya' })
|
||||
setDataInformasi(response.data)
|
||||
@@ -40,6 +43,8 @@ export default function ModalInformasi({ data }: { data: any }) {
|
||||
setDataShare(responseShare.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +64,12 @@ export default function ModalInformasi({ data }: { data: any }) {
|
||||
}
|
||||
</View>
|
||||
|
||||
{
|
||||
loading ? (
|
||||
<View>
|
||||
<ActivityIndicator size="large" />
|
||||
</View>
|
||||
) : (
|
||||
<View>
|
||||
<ItemDetailMember category="dokumen" value={dataInformasi?.category == 'FOLDER' ? dataInformasi?.name : `${dataInformasi?.name}.${dataInformasi?.extension}`} border />
|
||||
<ItemDetailMember category="type" value={dataInformasi?.category} border />
|
||||
@@ -92,6 +103,8 @@ export default function ModalInformasi({ data }: { data: any }) {
|
||||
</ScrollView>
|
||||
</ItemAccordion>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -155,7 +155,7 @@ export default function ModalMore({
|
||||
<DrawerBottom
|
||||
animation="slide"
|
||||
isVisible={isInformasi}
|
||||
setVisible={setInformasi}
|
||||
setVisible={() => setInformasi(false)}
|
||||
title="Informasi Dokumen"
|
||||
height={80}
|
||||
>
|
||||
|
||||
@@ -4,9 +4,10 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
||||
import { AntDesign, Ionicons } from "@expo/vector-icons"
|
||||
import { useLocalSearchParams } from "expo-router"
|
||||
import { useEffect, useState } from "react"
|
||||
import { Pressable, Text, View } from "react-native"
|
||||
import { Pressable, View } from "react-native"
|
||||
import BorderBottomItem from "../borderBottomItem"
|
||||
import DrawerBottom from "../drawerBottom"
|
||||
import Text from "../Text"
|
||||
|
||||
type Props = {
|
||||
open: boolean
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { MaterialIcons } from "@expo/vector-icons";
|
||||
import { Pressable, View } from "react-native";
|
||||
import Text from "./Text";
|
||||
import { Dimensions, KeyboardAvoidingView, Platform, Pressable, View } from "react-native";
|
||||
import Modal from 'react-native-modal';
|
||||
import Text from "./Text";
|
||||
|
||||
type Props = {
|
||||
isVisible: boolean
|
||||
@@ -12,28 +12,15 @@ type Props = {
|
||||
animation?: 'slide' | 'none' | 'fade'
|
||||
height?: number
|
||||
backdropPressable?: boolean
|
||||
keyboard?: boolean
|
||||
}
|
||||
|
||||
export default function DrawerBottom({ isVisible, setVisible, title, children, animation, height, backdropPressable = true }: Props) {
|
||||
return (
|
||||
// <Modal
|
||||
// animationType={animation}
|
||||
// transparent={true} visible={isVisible}>
|
||||
// <View style={[Styles.modalBgTransparant]}>
|
||||
// <View style={[Styles.modalContent, height != undefined && { height: `${height}%` }]}>
|
||||
// <View style={Styles.titleContainer}>
|
||||
// <Text style={Styles.textDefault}>{title}</Text>
|
||||
// <Pressable onPress={() => setVisible(false)}>
|
||||
// <MaterialIcons name="close" color="black" size={22} />
|
||||
// </Pressable>
|
||||
// </View>
|
||||
// <View style={Styles.contentContainer}>
|
||||
// {children}
|
||||
// </View>
|
||||
// </View>
|
||||
// </View>
|
||||
// </Modal>
|
||||
export default function DrawerBottom({ isVisible, setVisible, title, children, animation, height, backdropPressable = true, keyboard = false }: Props) {
|
||||
const tinggiScreen = Dimensions.get("window").height;
|
||||
const tinggiInput = height != undefined ? height : 25
|
||||
const tinggiFix = tinggiScreen * tinggiInput / 100;
|
||||
|
||||
return (
|
||||
<Modal
|
||||
animationIn={"slideInUp"}
|
||||
animationOut={"slideOutDown"}
|
||||
@@ -49,7 +36,13 @@ export default function DrawerBottom({ isVisible, setVisible, title, children, a
|
||||
backdropTransitionOutTiming={500}
|
||||
useNativeDriverForBackdrop={true}
|
||||
>
|
||||
<View style={[Styles.modalContentNew, height != undefined ? { height: `${height}%` } : { height: '25%' }]}>
|
||||
{
|
||||
keyboard ?
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
keyboardVerticalOffset={0}
|
||||
>
|
||||
<View style={[Styles.modalContentNew, { height: tinggiFix }]}>
|
||||
<View style={[Styles.titleContainerNew]}>
|
||||
<Text style={Styles.textDefault}>{title}</Text>
|
||||
<Pressable onPress={() => setVisible(false)}>
|
||||
@@ -60,6 +53,20 @@ export default function DrawerBottom({ isVisible, setVisible, title, children, a
|
||||
{children}
|
||||
</View>
|
||||
</View>
|
||||
</KeyboardAvoidingView>
|
||||
:
|
||||
<View style={[Styles.modalContentNew, { height: tinggiFix }]}>
|
||||
<View style={[Styles.titleContainerNew]}>
|
||||
<Text style={Styles.textDefault}>{title}</Text>
|
||||
<Pressable onPress={() => setVisible(false)}>
|
||||
<MaterialIcons name="close" color="black" size={22} />
|
||||
</Pressable>
|
||||
</View>
|
||||
<View style={Styles.contentContainer}>
|
||||
{children}
|
||||
</View>
|
||||
</View>
|
||||
}
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export default function HeaderRightGroupList() {
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<DrawerBottom animation="none" height={30} isVisible={isVisibleTambah} setVisible={() => setVisibleTambah(false)} title="Tambah Lembaga Desa">
|
||||
<DrawerBottom animation="none" keyboard height={30} isVisible={isVisibleTambah} setVisible={() => setVisibleTambah(false)} title="Tambah Lembaga Desa">
|
||||
<View style={{ flex: 1 }}>
|
||||
<View>
|
||||
<InputForm
|
||||
|
||||
@@ -27,7 +27,7 @@ type Props = {
|
||||
export function InputDate({ label, value, placeholder, onChange, info, disable, error, errorText, required, mode, round, width, }: Props) {
|
||||
const [modal, setModal] = useState(false);
|
||||
|
||||
const onChangeDate = ({ type }: { type: string }, selectedDate: any) => {
|
||||
const onChangeDate = (type: string, selectedDate: any) => {
|
||||
if (type === "set") {
|
||||
if (mode == "date") {
|
||||
onChange(dayjs(selectedDate).format("DD-MM-YYYY"))
|
||||
@@ -60,10 +60,10 @@ export function InputDate({ label, value, placeholder, onChange, info, disable,
|
||||
{
|
||||
modal && (
|
||||
<DateTimePicker
|
||||
value={value ? stringToDate(value) : new Date()}
|
||||
value={new Date()}
|
||||
mode={mode}
|
||||
display="default"
|
||||
onChange={onChangeDate}
|
||||
onChange={(event, date) => { onChangeDate(event.type, date) }}
|
||||
onTouchCancel={() => setModal(false)}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function HeaderMemberList() {
|
||||
return (
|
||||
<>
|
||||
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
|
||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={() => setVisible(false)} title="Menu">
|
||||
<View style={Styles.rowItemsCenter}>
|
||||
<MenuItemRow
|
||||
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
||||
@@ -34,7 +34,9 @@ export default function HeaderMemberList() {
|
||||
title="Filter"
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setTimeout(() => {
|
||||
setFilter(true)
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ export default function ModalSelect({ open, close, title, category, idParent, on
|
||||
}
|
||||
|
||||
return (
|
||||
<DrawerBottom animation="none" isVisible={open} setVisible={close} title={title} height={(category == 'gender' || category == 'status-task') ? 25 : category == 'member' ? 100 : 75}>
|
||||
<DrawerBottom animation="none" isVisible={open} setVisible={close} title={title} height={(category == 'gender' || category == 'status-task') ? 25 : category == 'member' ? 90 : 75}>
|
||||
{
|
||||
category == 'member' &&
|
||||
<>
|
||||
|
||||
@@ -123,7 +123,7 @@ export default function HeaderRightPositionList() {
|
||||
</View>
|
||||
</DrawerBottom>
|
||||
|
||||
<DrawerBottom animation="slide" height={45} isVisible={isVisibleTambah} setVisible={() => setVisibleTambah(false)} title="Tambah Jabatan">
|
||||
<DrawerBottom animation="slide" height={45} keyboard isVisible={isVisibleTambah} setVisible={() => setVisibleTambah(false)} title="Tambah Jabatan">
|
||||
<View style={{ flex: 1, justifyContent: 'space-between' }}>
|
||||
<View>
|
||||
{
|
||||
|
||||
@@ -37,7 +37,9 @@ export default function HeaderRightProjectList() {
|
||||
title="Filter"
|
||||
onPress={() => {
|
||||
setVisible(false)
|
||||
setTimeout(() => {
|
||||
setFilter(true)
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ type Props = {
|
||||
idStorage: string
|
||||
}
|
||||
|
||||
export default function SectionFile({ status, member }: { status: number | undefined, member: boolean }) {
|
||||
export default function SectionFile({ status, member, refreshing }: { status: number | undefined, member: boolean, refreshing?: boolean }) {
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const [isModal, setModal] = useState(false)
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
@@ -62,6 +62,11 @@ export default function SectionFile({ status, member }: { status: number | undef
|
||||
handleLoad(false);
|
||||
}, [update.file]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
|
||||
@@ -25,7 +25,7 @@ type Props = {
|
||||
position: string;
|
||||
};
|
||||
|
||||
export default function SectionMember({ status }: { status: number | undefined }) {
|
||||
export default function SectionMember({ status, refreshing }: { status: number | undefined, refreshing?: boolean }) {
|
||||
const dispatch = useDispatch()
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const update = useSelector((state: any) => state.projectUpdate)
|
||||
@@ -62,6 +62,11 @@ export default function SectionMember({ status }: { status: number | undefined }
|
||||
handleLoad(false);
|
||||
}, [update.member]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, []);
|
||||
@@ -75,7 +80,7 @@ export default function SectionMember({ status }: { status: number | undefined }
|
||||
}, id)
|
||||
if (response.success) {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus anggota', })
|
||||
dispatch(setUpdateProject({ ...update, member: !update.progress }))
|
||||
dispatch(setUpdateProject({ ...update, member: !update.member }))
|
||||
setModal(false);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@@ -26,7 +26,7 @@ type Props = {
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
export default function SectionTanggalTugasProject({ status, member }: { status: number | undefined, member: boolean }) {
|
||||
export default function SectionTanggalTugasProject({ status, member, refreshing }: { status: number | undefined, member: boolean, refreshing?: boolean }) {
|
||||
const entityUser = useSelector((state: any) => state.user)
|
||||
const dispatch = useDispatch()
|
||||
const update = useSelector((state: any) => state.projectUpdate)
|
||||
@@ -63,6 +63,11 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
||||
handleLoad(false);
|
||||
}, [update.task]);
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true);
|
||||
}, []);
|
||||
@@ -163,7 +168,9 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
||||
title="Update Status"
|
||||
onPress={() => {
|
||||
setModal(false);
|
||||
setTimeout(() => {
|
||||
setSelect(true);
|
||||
}, 600)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
@@ -198,7 +205,7 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
||||
|
||||
<ModalSelect
|
||||
category="status-task"
|
||||
close={setSelect}
|
||||
close={() => { setSelect(false) }}
|
||||
onSelect={(value) => {
|
||||
handleUpdate(Number(value.val))
|
||||
}}
|
||||
|
||||
@@ -27,7 +27,7 @@ type Props = {
|
||||
idStorage: string
|
||||
}
|
||||
|
||||
export default function SectionFileTask() {
|
||||
export default function SectionFileTask({refreshing}: {refreshing: boolean}) {
|
||||
const [isModal, setModal] = useState(false)
|
||||
const { token, decryptToken } = useAuthSession()
|
||||
const { detail } = useLocalSearchParams<{ detail: string }>()
|
||||
@@ -56,6 +56,11 @@ export default function SectionFileTask() {
|
||||
handleLoad(false)
|
||||
}, [update.file])
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true)
|
||||
}, [])
|
||||
|
||||
@@ -25,7 +25,7 @@ type Props = {
|
||||
position: string;
|
||||
};
|
||||
|
||||
export default function SectionMemberTask() {
|
||||
export default function SectionMemberTask({ refreshing }: { refreshing: boolean }) {
|
||||
const [isModal, setModal] = useState(false);
|
||||
const { token, decryptToken } = useAuthSession();
|
||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||
@@ -64,6 +64,10 @@ export default function SectionMemberTask() {
|
||||
handleLoad(true);
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
async function handleDeleteMember() {
|
||||
try {
|
||||
|
||||
@@ -25,7 +25,7 @@ type Props = {
|
||||
dateEnd: string;
|
||||
}
|
||||
|
||||
export default function SectionTanggalTugasTask() {
|
||||
export default function SectionTanggalTugasTask({refreshing}: {refreshing: boolean}) {
|
||||
const dispatch = useDispatch()
|
||||
const update = useSelector((state: any) => state.taskUpdate)
|
||||
const [isModal, setModal] = useState(false)
|
||||
@@ -79,6 +79,11 @@ export default function SectionTanggalTugasTask() {
|
||||
handleLoad(false)
|
||||
}, [update.task])
|
||||
|
||||
useEffect(() => {
|
||||
if (refreshing)
|
||||
handleLoad(false);
|
||||
}, [refreshing]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
handleLoad(true)
|
||||
@@ -153,7 +158,9 @@ export default function SectionTanggalTugasTask() {
|
||||
title="Update Status"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
setTimeout(() => {
|
||||
setSelect(true)
|
||||
}, 600);
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
@@ -185,10 +192,8 @@ export default function SectionTanggalTugasTask() {
|
||||
|
||||
<ModalSelect
|
||||
category="status-task"
|
||||
close={setSelect}
|
||||
onSelect={(value) => {
|
||||
handleUpdate(Number(value.val))
|
||||
}}
|
||||
close={() => setSelect(false)}
|
||||
onSelect={(value) => { handleUpdate(Number(value.val)) }}
|
||||
title="Status"
|
||||
open={isSelect}
|
||||
valChoose={String(tugas.status)}
|
||||
|
||||
@@ -188,6 +188,9 @@ const Styles = StyleSheet.create({
|
||||
round10: {
|
||||
borderRadius: 10
|
||||
},
|
||||
h100: {
|
||||
height: '100%'
|
||||
},
|
||||
w100: {
|
||||
width: '100%'
|
||||
},
|
||||
|
||||
20
lib/api.ts
20
lib/api.ts
@@ -2,8 +2,8 @@ import axios from 'axios';
|
||||
|
||||
const api = axios.create({
|
||||
// baseURL: 'http://10.0.2.2:3000/api',
|
||||
baseURL: 'https://stg-darmasaba.wibudev.com/api',
|
||||
// baseURL: 'http://192.168.1.135:3000/api',
|
||||
// baseURL: 'https://stg-darmasaba.wibudev.com/api',
|
||||
baseURL: 'http://192.168.1.89:3000/api',
|
||||
});
|
||||
|
||||
export const apiCheckPhoneLogin = async (body: { phone: string }) => {
|
||||
@@ -150,7 +150,7 @@ export const apiGetUser = async ({ user, active, search, group, page }: { user:
|
||||
};
|
||||
|
||||
|
||||
export const apiCreateUser = async (data: FormData) => {
|
||||
export const apiCreateUser = async ({data}: {data: FormData}) => {
|
||||
const response = await api.post('/mobile/user', data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
@@ -219,7 +219,7 @@ export const apiEditDiscussionGeneral = async (data: { user: string, title: stri
|
||||
};
|
||||
|
||||
export const apiCreateDiscussionGeneral = async ({ data }: { data: { idGroup: string, title: string, desc: string, user: string, member: [] } }) => {
|
||||
const response = await api.post(`/mobile/discussion-general/`, data)
|
||||
const response = await api.post(`/mobile/discussion-general`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -604,7 +604,7 @@ export const apiGetDocumentInformasi = async ({ user, item, cat }: { user: strin
|
||||
};
|
||||
|
||||
export const apiDocumentRename = async (data: { name: string, user: string, id: string, path: string, idDivision: string, extension: string }) => {
|
||||
const response = await api.put(`/mobile/document/`, data)
|
||||
const response = await api.put(`/mobile/document`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -613,8 +613,8 @@ export const apiDocumentDelete = async (data: { user: string, data: any[] }) =>
|
||||
return response.data
|
||||
};
|
||||
|
||||
export const apiCreateFolderDocument = async (data: { name: string, path: string, idDivision: string, user: string }) => {
|
||||
const response = await api.post(`/mobile/document/`, data)
|
||||
export const apiCreateFolderDocument = async ({ data }: { data: { name: string, path: string, idDivision: string, user: string } }) => {
|
||||
const response = await api.post(`/mobile/document`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -646,12 +646,12 @@ export const apiShareDocument = async (data: { dataDivision: any[], dataItem: an
|
||||
};
|
||||
|
||||
export const apiRegisteredToken = async (data: { user: string, token: string }) => {
|
||||
const response = await api.post(`/mobile/auth-token/`, data)
|
||||
const response = await api.post(`/mobile/auth-token`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiUnregisteredToken = async (data: { user: string, token: string }) => {
|
||||
const response = await api.put(`/mobile/auth-token/`, data)
|
||||
const response = await api.put(`/mobile/auth-token`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -661,6 +661,6 @@ export const apiGetNotification = async ({ user, page }: { user: string, page?:
|
||||
};
|
||||
|
||||
export const apiReadOneNotification = async (data: { user: string, id: string }) => {
|
||||
const response = await api.put(`/mobile/home/notification/`, data)
|
||||
const response = await api.put(`/mobile/home/notification`, data)
|
||||
return response.data;
|
||||
};
|
||||
Reference in New Issue
Block a user