Compare commits
11 Commits
amalia/28-
...
amalia/01-
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d72c365da | |||
| 589068703d | |||
| 7c713cc6e0 | |||
| d3c63fbcdd | |||
| ea29785a34 | |||
| e7ef09e9aa | |||
| 5898655fac | |||
| 4394219f2a | |||
| 6d035e1f7f | |||
| eb039c7528 | |||
| 42bf1589b4 |
1
app.json
1
app.json
@@ -42,6 +42,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expo-font",
|
"expo-font",
|
||||||
|
"expo-image-picker",
|
||||||
"expo-web-browser",
|
"expo-web-browser",
|
||||||
[
|
[
|
||||||
"@react-native-firebase/app",
|
"@react-native-firebase/app",
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import HeaderRightProjectList from "@/components/project/headerProjectList";
|
|||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
import ToastCustom from "@/components/toastCustom";
|
import ToastCustom from "@/components/toastCustom";
|
||||||
import { Headers } from "@/constants/Headers";
|
import { Headers } from "@/constants/Headers";
|
||||||
import Styles from "@/constants/Styles";
|
|
||||||
import { apiReadOneNotification } from "@/lib/api";
|
import { apiReadOneNotification } from "@/lib/api";
|
||||||
import { pushToPage } from "@/lib/pushToPage";
|
import { pushToPage } from "@/lib/pushToPage";
|
||||||
import store from "@/lib/store";
|
import store from "@/lib/store";
|
||||||
@@ -18,9 +17,7 @@ import firebase from '@react-native-firebase/app';
|
|||||||
import { Redirect, router, Stack } from "expo-router";
|
import { Redirect, router, Stack } from "expo-router";
|
||||||
import { StatusBar } from 'expo-status-bar';
|
import { StatusBar } from 'expo-status-bar';
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { View } from "react-native";
|
|
||||||
import { Easing, Notifier } from 'react-native-notifier';
|
import { Easing, Notifier } from 'react-native-notifier';
|
||||||
import Toast from "react-native-toast-message";
|
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
|
|
||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { apiGetAnnouncementOne } from "@/lib/api";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { Entypo, MaterialIcons } from "@expo/vector-icons";
|
import { Entypo, MaterialIcons } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
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 { Dimensions, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import RenderHTML from 'react-native-render-html';
|
import RenderHTML from 'react-native-render-html';
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
@@ -51,6 +51,11 @@ export default function DetailAnnouncement() {
|
|||||||
handleLoad(true)
|
handleLoad(true)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
function hasHtmlTags(text: string) {
|
||||||
|
const htmlRegex = /<[a-z][\s\S]*>/i;
|
||||||
|
return htmlRegex.test(text);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -84,10 +89,15 @@ export default function DetailAnnouncement() {
|
|||||||
<Text style={[Styles.textDefaultSemiBold]}>{data?.title}</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>{data?.title}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mt10]}>
|
<View style={[Styles.mt10]}>
|
||||||
<RenderHTML
|
{
|
||||||
contentWidth={contentWidth}
|
hasHtmlTags(data?.desc) ?
|
||||||
source={{ html: data?.desc }}
|
<RenderHTML
|
||||||
/>
|
contentWidth={contentWidth}
|
||||||
|
source={{ html: data?.desc }}
|
||||||
|
/>
|
||||||
|
:
|
||||||
|
<Text>{data?.desc}</Text>
|
||||||
|
}
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ButtonSelect from "@/components/buttonSelect";
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { setUpdateAnnouncement } from "@/lib/announcementUpdate";
|
import { setUpdateAnnouncement } from "@/lib/announcementUpdate";
|
||||||
import { apiCreateAnnouncement } from "@/lib/api";
|
import { apiCreateAnnouncement } from "@/lib/api";
|
||||||
@@ -10,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { Entypo } from "@expo/vector-icons";
|
import { Entypo } from "@expo/vector-icons";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, StyleSheet, Text, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, StyleSheet, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CreateAnnouncement() {
|
export default function CreateAnnouncement() {
|
||||||
@@ -70,7 +72,7 @@ export default function CreateAnnouncement() {
|
|||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateAnnouncement(!update))
|
dispatch(setUpdateAnnouncement(!update))
|
||||||
ToastAndroid.show("Berhasil menambahkan data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -97,7 +99,7 @@ export default function CreateAnnouncement() {
|
|||||||
category="create"
|
category="create"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
divisionMember.length == 0
|
divisionMember.length == 0
|
||||||
? ToastAndroid.show("Anda belum memilih divisi", ToastAndroid.SHORT)
|
? Toast.show({ type: 'small', text1: "Anda belum memilih divisi", })
|
||||||
: handleCreate();
|
: handleCreate();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { Entypo } from "@expo/vector-icons";
|
import { Entypo } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|
||||||
@@ -114,7 +115,7 @@ export default function EditAnnouncement() {
|
|||||||
}, id);
|
}, id);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateAnnouncement(!update))
|
dispatch(setUpdateAnnouncement(!update))
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -141,7 +142,7 @@ export default function EditAnnouncement() {
|
|||||||
category="update"
|
category="update"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
dataMember.length == 0
|
dataMember.length == 0
|
||||||
? ToastAndroid.show("Anda belum memilih divisi", ToastAndroid.SHORT)
|
? Toast.show({ type: 'small', text1: "Anda belum memilih divisi", })
|
||||||
: handleEdit();
|
: handleEdit();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditBanner, apiGetBanner, apiGetBannerOne } from "@/lib/api";
|
import { apiEditBanner, apiGetBanner, apiGetBannerOne } from "@/lib/api";
|
||||||
import { setEntities } from "@/lib/bannerSlice";
|
import { setEntities } from "@/lib/bannerSlice";
|
||||||
@@ -14,10 +15,9 @@ import {
|
|||||||
Pressable,
|
Pressable,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
export default function EditBanner() {
|
export default function EditBanner() {
|
||||||
@@ -34,7 +34,7 @@ export default function EditBanner() {
|
|||||||
const pickImageAsync = async () => {
|
const pickImageAsync = async () => {
|
||||||
let result = await ImagePicker.launchImageLibraryAsync({
|
let result = await ImagePicker.launchImageLibraryAsync({
|
||||||
mediaTypes: ["images"],
|
mediaTypes: ["images"],
|
||||||
allowsEditing: true,
|
allowsEditing: false,
|
||||||
quality: 1,
|
quality: 1,
|
||||||
aspect: [1535, 450],
|
aspect: [1535, 450],
|
||||||
});
|
});
|
||||||
@@ -94,17 +94,17 @@ export default function EditBanner() {
|
|||||||
|
|
||||||
const updatedEntity = await apiEditBanner(fd, id)
|
const updatedEntity = await apiEditBanner(fd, id)
|
||||||
if (updatedEntity.success) {
|
if (updatedEntity.success) {
|
||||||
ToastAndroid.show("Berhasil mengupdate data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
apiGetBanner({ user: hasil }).then((data) =>
|
apiGetBanner({ user: hasil }).then((data) =>
|
||||||
dispatch(setEntities(data.data))
|
dispatch(setEntities(data.data))
|
||||||
);
|
);
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show('Gagal mengupdate data', ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show('Gagal mengupdate data', ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateBanner, apiGetBanner } from "@/lib/api";
|
import { apiCreateBanner, apiGetBanner } from "@/lib/api";
|
||||||
import { setEntities } from "@/lib/bannerSlice";
|
import { setEntities } from "@/lib/bannerSlice";
|
||||||
@@ -14,10 +15,9 @@ import {
|
|||||||
Pressable,
|
Pressable,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
export default function CreateBanner() {
|
export default function CreateBanner() {
|
||||||
@@ -33,7 +33,7 @@ export default function CreateBanner() {
|
|||||||
const pickImageAsync = async () => {
|
const pickImageAsync = async () => {
|
||||||
let result = await ImagePicker.launchImageLibraryAsync({
|
let result = await ImagePicker.launchImageLibraryAsync({
|
||||||
mediaTypes: ["images"],
|
mediaTypes: ["images"],
|
||||||
allowsEditing: true,
|
allowsEditing: false,
|
||||||
quality: 1,
|
quality: 1,
|
||||||
aspect: [1535, 450],
|
aspect: [1535, 450],
|
||||||
});
|
});
|
||||||
@@ -76,13 +76,13 @@ export default function CreateBanner() {
|
|||||||
|
|
||||||
const createdEntity = await apiCreateBanner(fd);
|
const createdEntity = await apiCreateBanner(fd);
|
||||||
if (createdEntity.success) {
|
if (createdEntity.success) {
|
||||||
ToastAndroid.show("Berhasil menambahkan data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
apiGetBanner({ user: hasil }).then((data) =>
|
apiGetBanner({ user: hasil }).then((data) =>
|
||||||
dispatch(setEntities(data.data))
|
dispatch(setEntities(data.data))
|
||||||
);
|
);
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show('Gagal menambahkan data', ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,15 @@ import { startActivityAsync } from 'expo-intent-launcher'
|
|||||||
import { router, Stack } from "expo-router"
|
import { router, Stack } from "expo-router"
|
||||||
import * as Sharing from 'expo-sharing'
|
import * as Sharing from 'expo-sharing'
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { Alert, Image, Platform, RefreshControl, SafeAreaView, ScrollView, ToastAndroid, View } from "react-native"
|
import { Alert, Image, Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native"
|
||||||
import * as mime from 'react-native-mime-types'
|
import * as mime from 'react-native-mime-types'
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
title: string
|
||||||
extension: string
|
extension: string
|
||||||
image: string
|
image: string
|
||||||
}
|
}
|
||||||
@@ -42,16 +43,16 @@ export default function BannerList() {
|
|||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const deletedEntity = await apiDeleteBanner({ user: hasil }, dataId);
|
const deletedEntity = await apiDeleteBanner({ user: hasil }, dataId);
|
||||||
if (deletedEntity.success) {
|
if (deletedEntity.success) {
|
||||||
ToastAndroid.show("Berhasil menghapus data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||||
apiGetBanner({ user: hasil }).then((data) =>
|
apiGetBanner({ user: hasil }).then((data) =>
|
||||||
dispatch(setEntities(data.data))
|
dispatch(setEntities(data.data))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show('Gagal menghapus data', ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Gagal menghapus data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
}
|
}
|
||||||
@@ -71,7 +72,7 @@ export default function BannerList() {
|
|||||||
setModal(false)
|
setModal(false)
|
||||||
setLoadingOpen(true)
|
setLoadingOpen(true)
|
||||||
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + selectFile?.image;
|
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + selectFile?.image;
|
||||||
const fileName = selectFile?.name + '.' + selectFile?.extension;
|
const fileName = selectFile?.title + '.' + selectFile?.extension;
|
||||||
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||||
const mimeType = mime.lookup(fileName)
|
const mimeType = mime.lookup(fileName)
|
||||||
|
|
||||||
@@ -80,7 +81,6 @@ export default function BannerList() {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
if (Platform.OS == 'android') {
|
if (Platform.OS == 'android') {
|
||||||
// open with android intent
|
|
||||||
await startActivityAsync(
|
await startActivityAsync(
|
||||||
'android.intent.action.VIEW',
|
'android.intent.action.VIEW',
|
||||||
{
|
{
|
||||||
@@ -89,9 +89,6 @@ export default function BannerList() {
|
|||||||
type: mimeType as string,
|
type: mimeType as string,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// or
|
|
||||||
// Sharing.shareAsync(localPath);
|
|
||||||
|
|
||||||
} else if (Platform.OS == 'ios') {
|
} else if (Platform.OS == 'ios') {
|
||||||
Sharing.shareAsync(localPath);
|
Sharing.shareAsync(localPath);
|
||||||
}
|
}
|
||||||
@@ -115,13 +112,14 @@ export default function BannerList() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
style={[Styles.h100]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
{entities.map((index: any, key: number) => (
|
{entities.map((index: any, key: number) => (
|
||||||
@@ -145,7 +143,7 @@ export default function BannerList() {
|
|||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { InputForm } from "@/components/inputForm";
|
|||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
import SkeletonContent from "@/components/skeletonContent";
|
import SkeletonContent from "@/components/skeletonContent";
|
||||||
|
import Text from '@/components/Text';
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDiscussionGeneralOne, apiSendDiscussionGeneralCommentar } from "@/lib/api";
|
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 { firebase } from '@react-native-firebase/database';
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, ScrollView, View } from "react-native";
|
import { KeyboardAvoidingView, Platform, Pressable, ScrollView, View } from "react-native";
|
||||||
import Text from '@/components/Text';
|
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -195,30 +195,34 @@ export default function DetailDiscussionGeneral() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<View style={[
|
<KeyboardAvoidingView
|
||||||
Styles.contentItemCenter,
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
Styles.absolute0,
|
keyboardVerticalOffset={110}
|
||||||
Styles.w100,
|
>
|
||||||
{ backgroundColor: "#f4f4f4" },
|
<View style={[
|
||||||
]}>
|
Styles.contentItemCenter,
|
||||||
<InputForm
|
Styles.w100,
|
||||||
disable={(data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin")))}
|
{ backgroundColor: "#f4f4f4" },
|
||||||
type="default"
|
]}>
|
||||||
round
|
<InputForm
|
||||||
placeholder="Kirim Komentar"
|
disable={(data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin")))}
|
||||||
bg="white"
|
type="default"
|
||||||
onChange={setKomentar}
|
round
|
||||||
value={komentar}
|
placeholder="Kirim Komentar"
|
||||||
itemRight={
|
bg="white"
|
||||||
<Pressable onPress={() => {
|
onChange={setKomentar}
|
||||||
(komentar != '' && data?.status === 1 && data?.isActive && (memberDiscussion || (entityUser.role != "user" && entityUser.role != "coadmin")))
|
value={komentar}
|
||||||
&& handleKomentar()
|
itemRight={
|
||||||
}}>
|
<Pressable onPress={() => {
|
||||||
<MaterialIcons name="send" size={25} style={(komentar == '' || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? Styles.cGray : Styles.cDefault} />
|
(komentar != '' && data?.status === 1 && data?.isActive && (memberDiscussion || (entityUser.role != "user" && entityUser.role != "coadmin")))
|
||||||
</Pressable>
|
&& handleKomentar()
|
||||||
}
|
}}>
|
||||||
/>
|
<MaterialIcons name="send" size={25} style={(komentar == '' || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? Styles.cGray : Styles.cDefault} />
|
||||||
</View>
|
</Pressable>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</KeyboardAvoidingView>
|
||||||
</View >
|
</View >
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -72,7 +73,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberDiscussionGeneral({ id: id, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberDiscussionGeneral({ id: id, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan anggota', })
|
||||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||||
router.back()
|
router.back()
|
||||||
}
|
}
|
||||||
@@ -113,7 +114,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
<ImageWithLabel
|
<ImageWithLabel
|
||||||
key={index}
|
key={index}
|
||||||
label={item.name}
|
label={item.name}
|
||||||
src={item.img}
|
src={`https://wibu-storage.wibudev.com/api/files/${item.img}`}
|
||||||
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import { setMemberChoose } from "@/lib/memberChoose";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|
||||||
@@ -83,6 +84,9 @@ export default function CreateDiscussionGeneral() {
|
|||||||
checkForm();
|
checkForm();
|
||||||
}, [error, dataForm]);
|
}, [error, dataForm]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
dispatch(setMemberChoose([]))
|
||||||
|
}, [])
|
||||||
|
|
||||||
function handleBack() {
|
function handleBack() {
|
||||||
dispatch(setMemberChoose([]))
|
dispatch(setMemberChoose([]))
|
||||||
@@ -98,11 +102,14 @@ export default function CreateDiscussionGeneral() {
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setMemberChoose([]))
|
dispatch(setMemberChoose([]))
|
||||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
router.back()
|
router.back()
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,10 +130,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
disable={disableBtn}
|
disable={disableBtn}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
entitiesMember.length == 0
|
entitiesMember.length == 0
|
||||||
? ToastAndroid.show(
|
? Toast.show({ type: 'small', text1: 'Anda belum memilih anggota', })
|
||||||
"Anda belum memilih anggota",
|
|
||||||
ToastAndroid.SHORT
|
|
||||||
)
|
|
||||||
: handleCreate()
|
: handleCreate()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -170,6 +174,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
error={error.desc}
|
error={error.desc}
|
||||||
errorText="Diskusi tidak boleh kosong"
|
errorText="Diskusi tidak boleh kosong"
|
||||||
onChange={(val) => { validationForm("desc", val) }}
|
onChange={(val) => { validationForm("desc", val) }}
|
||||||
|
multiline
|
||||||
/>
|
/>
|
||||||
<ButtonSelect
|
<ButtonSelect
|
||||||
value="Pilih Anggota"
|
value="Pilih Anggota"
|
||||||
@@ -179,12 +184,9 @@ export default function CreateDiscussionGeneral() {
|
|||||||
setSelect(true);
|
setSelect(true);
|
||||||
setValSelect("member");
|
setValSelect("member");
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(
|
Toast.show({ type: 'small', text1: 'Pilih Lembaga Desa terlebih dahulu', })
|
||||||
"Pilih Lembaga Desa terlebih dahulu",
|
|
||||||
ToastAndroid.SHORT
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
validationForm('group', userLogin.idGroup, userLogin.group);
|
validationForm('group', userLogin.idGroup, userLogin.group);
|
||||||
setValChoose(userLogin.idGroup)
|
setValChoose(userLogin.idGroup)
|
||||||
setSelect(true);
|
setSelect(true);
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateDiscussionGeneralDetail } from "@/lib/discussionGeneralDetail"
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function EditDiscussionGeneral() {
|
export default function EditDiscussionGeneral() {
|
||||||
@@ -83,7 +84,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
const response = await apiEditDiscussionGeneral({ user: hasil, title: dataForm.title, desc: dataForm.desc }, id);
|
const response = await apiEditDiscussionGeneral({ user: hasil, title: dataForm.title, desc: dataForm.desc }, id);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -134,6 +135,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
value={dataForm.desc}
|
value={dataForm.desc}
|
||||||
errorText="Diskusi tidak boleh kosong"
|
errorText="Diskusi tidak boleh kosong"
|
||||||
onChange={(val) => validationForm("desc", val)}
|
onChange={(val) => validationForm("desc", val)}
|
||||||
|
multiline
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonTab from "@/components/buttonTab";
|
|||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import SkeletonContent from "@/components/skeletonContent";
|
import SkeletonContent from "@/components/skeletonContent";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDiscussionGeneral } from "@/lib/api";
|
import { apiGetDiscussionGeneral } from "@/lib/api";
|
||||||
@@ -10,7 +11,7 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign, Feather, Ionicons, MaterialIcons } from "@expo/vector-icons";
|
import { AntDesign, Feather, Ionicons, MaterialIcons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { RefreshControl, Text, View, VirtualizedList } from "react-native";
|
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -59,7 +60,7 @@ export default function MemberDiscussionDetail() {
|
|||||||
try {
|
try {
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
await apiDeleteMemberDiscussionGeneral({ user: hasil, idUser: chooseUser.idUser }, id)
|
await apiDeleteMemberDiscussionGeneral({ user: hasil, idUser: chooseUser.idUser }, id)
|
||||||
ToastAndroid.show("Berhasil mengeluarkan anggota dari diskusi", ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengeluarkan anggota dari diskusi', })
|
||||||
handleLoad(false)
|
handleLoad(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import ImageWithLabel from "@/components/imageWithLabel";
|
import ImageWithLabel from "@/components/imageWithLabel";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiAddMemberCalendar, apiGetCalendarOne, apiGetDivisionMember } from "@/lib/api";
|
import { apiAddMemberCalendar, apiGetCalendarOne, apiGetDivisionMember } from "@/lib/api";
|
||||||
import { setUpdateCalendar } from "@/lib/calendarUpdate";
|
import { setUpdateCalendar } from "@/lib/calendarUpdate";
|
||||||
@@ -10,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -79,15 +81,15 @@ export default function AddMemberCalendarEvent() {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberCalendar({ id: idCalendar, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberCalendar({ id: idCalendar, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan anggota', })
|
||||||
dispatch(setUpdateCalendar({ ...update, member: !update.member }))
|
dispatch(setUpdateCalendar({ ...update, member: !update.member }))
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { Stack, router, useLocalSearchParams } from "expo-router"
|
import { Stack, router, useLocalSearchParams } from "expo-router"
|
||||||
import moment from "moment"
|
import moment from "moment"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native"
|
import { SafeAreaView, ScrollView, View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
|
|
||||||
export default function EditEventCalendar() {
|
export default function EditEventCalendar() {
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
@@ -53,7 +54,7 @@ export default function EditEventCalendar() {
|
|||||||
setChoose({ val: response.data.repeatEventTyper, label: valueTypeEventRepeat.find((item) => item.id == response.data.repeatEventTyper)?.name || "" })
|
setChoose({ val: response.data.repeatEventTyper, label: valueTypeEventRepeat.find((item) => item.id == response.data.repeatEventTyper)?.name || "" })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show('Gagal mendapatkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal mendapatkan data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,13 +144,13 @@ export default function EditEventCalendar() {
|
|||||||
const response = await apiUpdateCalendar({ data: { ...data, user: hasil }, id: idCalendar })
|
const response = await apiUpdateCalendar({ data: { ...data, user: hasil }, id: idCalendar })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
router.replace(`/division/${id}/calendar/`)
|
router.replace(`/division/${id}/calendar/`)
|
||||||
ToastAndroid.show('Berhasil mengubah acara', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah acara', })
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal mengubah acara', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal mengubah acara', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import DrawerBottom from "@/components/drawerBottom"
|
|||||||
import ImageUser from "@/components/imageNew"
|
import ImageUser from "@/components/imageNew"
|
||||||
import MenuItemRow from "@/components/menuItemRow"
|
import MenuItemRow from "@/components/menuItemRow"
|
||||||
import Skeleton from "@/components/skeleton"
|
import Skeleton from "@/components/skeleton"
|
||||||
|
import Text from "@/components/Text"
|
||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiDeleteCalendarMember, apiGetCalendarOne, apiGetDivisionOneFeature } from "@/lib/api"
|
import { apiDeleteCalendarMember, apiGetCalendarOne, apiGetDivisionOneFeature } from "@/lib/api"
|
||||||
import { setUpdateCalendar } from "@/lib/calendarUpdate"
|
import { setUpdateCalendar } from "@/lib/calendarUpdate"
|
||||||
@@ -13,7 +14,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router"
|
import { router, Stack, useLocalSearchParams } from "expo-router"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { SafeAreaView, ScrollView, Text, ToastAndroid, 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"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -51,7 +53,7 @@ export default function DetailEventCalendar() {
|
|||||||
const entityUser = useSelector((state: any) => state.user);
|
const entityUser = useSelector((state: any) => state.user);
|
||||||
const [isMemberDivision, setIsMemberDivision] = useState(false);
|
const [isMemberDivision, setIsMemberDivision] = useState(false);
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const arrSkeleton = Array.from({ length: 5 })
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
async function handleCheckMember() {
|
async function handleCheckMember() {
|
||||||
try {
|
try {
|
||||||
@@ -68,9 +70,9 @@ export default function DetailEventCalendar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad(loading:boolean) {
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(loading)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiGetCalendarOne({
|
const response = await apiGetCalendarOne({
|
||||||
user: hasil,
|
user: hasil,
|
||||||
@@ -104,7 +106,7 @@ export default function DetailEventCalendar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleLoad();
|
handleLoad(true);
|
||||||
handleCheckMember()
|
handleCheckMember()
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -122,18 +124,25 @@ export default function DetailEventCalendar() {
|
|||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateCalendar({ ...update, member: !update.member }));
|
dispatch(setUpdateCalendar({ ...update, member: !update.member }));
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
|
||||||
} else {
|
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
|
||||||
}
|
}
|
||||||
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setModalMember(false)
|
setModalMember(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const handleRefresh = async () => {
|
||||||
|
setRefreshing(true)
|
||||||
|
handleLoad(false)
|
||||||
|
handleLoadMember()
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
|
setRefreshing(false)
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -144,7 +153,15 @@ export default function DetailEventCalendar() {
|
|||||||
headerRight: () => (entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision ? <></> : <HeaderRightCalendarDetail id={String(data?.idCalendar)} idReminder={String(detail)} />
|
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.p15]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.mb15]}>
|
<View style={[Styles.wrapPaper, Styles.mb15]}>
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import ImageWithLabel from "@/components/imageWithLabel";
|
import ImageWithLabel from "@/components/imageWithLabel";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateCalendar, apiGetDivisionMember } from "@/lib/api";
|
import { apiCreateCalendar, apiGetDivisionMember } from "@/lib/api";
|
||||||
import { setFormCreateCalendar } from "@/lib/calendarCreate";
|
import { setFormCreateCalendar } from "@/lib/calendarCreate";
|
||||||
@@ -11,7 +12,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -59,7 +61,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateCalendar({ data: { ...update, user: hasil, idDivision: id, member: selectMember } })
|
const response = await apiCreateCalendar({ data: { ...update, user: hasil, idDivision: id, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil membuat acara', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil membuat acara', })
|
||||||
dispatch(setFormCreateCalendar({
|
dispatch(setFormCreateCalendar({
|
||||||
title: "",
|
title: "",
|
||||||
desc: "",
|
desc: "",
|
||||||
@@ -74,11 +76,11 @@ export default function CreateCalendarAddMember() {
|
|||||||
dispatch(setUpdateCalendar({ ...updateRefresh, data: !updateRefresh.data }));
|
dispatch(setUpdateCalendar({ ...updateRefresh, data: !updateRefresh.data }));
|
||||||
router.replace(`/division/${id}/calendar`)
|
router.replace(`/division/${id}/calendar`)
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal membuat acara', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal membuat acara', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +133,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal]}
|
||||||
onPress={() => {onChoose(item.idUser, item.name, item.img) }}
|
onPress={() => { onChoose(item.idUser, item.name, item.img) }}
|
||||||
>
|
>
|
||||||
<View style={[Styles.rowItemsCenter, Styles.w70]}>
|
<View style={[Styles.rowItemsCenter, Styles.w70]}>
|
||||||
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { stringToDateTime } from "@/lib/fun_stringToDate";
|
|||||||
import { Stack, router, useLocalSearchParams } from "expo-router";
|
import { Stack, router, useLocalSearchParams } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
View
|
View
|
||||||
@@ -141,94 +143,99 @@ export default function CalendarDivisionCreate() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<InputForm
|
keyboardVerticalOffset={110}
|
||||||
label="Nama Acara"
|
>
|
||||||
type="default"
|
<ScrollView>
|
||||||
placeholder="Nama Acara"
|
<View style={[Styles.p15]}>
|
||||||
required
|
<InputForm
|
||||||
bg="white"
|
label="Nama Acara"
|
||||||
value={data.title}
|
type="default"
|
||||||
onChange={(val) => validationForm("title", val)}
|
placeholder="Nama Acara"
|
||||||
error={error.title}
|
required
|
||||||
errorText="Nama acara tidak boleh kosong"
|
bg="white"
|
||||||
/>
|
value={data.title}
|
||||||
<InputDate
|
onChange={(val) => validationForm("title", val)}
|
||||||
onChange={(val) => validationForm("dateStart", val)}
|
error={error.title}
|
||||||
mode="date"
|
errorText="Nama acara tidak boleh kosong"
|
||||||
value={data.dateStart}
|
/>
|
||||||
label="Tanggal Acara"
|
<InputDate
|
||||||
required
|
onChange={(val) => validationForm("dateStart", val)}
|
||||||
error={error.dateStart}
|
mode="date"
|
||||||
errorText="Tanggal acara tidak boleh kosong"
|
value={data.dateStart}
|
||||||
placeholder="Pilih Tanggal Acara"
|
label="Tanggal Acara"
|
||||||
/>
|
required
|
||||||
<View style={[Styles.rowSpaceBetween, Styles.mv10]}>
|
error={error.dateStart}
|
||||||
<View style={[{ width: "48%" }]}>
|
errorText="Tanggal acara tidak boleh kosong"
|
||||||
<InputDate
|
placeholder="Pilih Tanggal Acara"
|
||||||
onChange={(val) => validationForm("timeStart", val)}
|
/>
|
||||||
mode="time"
|
<View style={[Styles.rowSpaceBetween, Styles.mv10]}>
|
||||||
value={data.timeStart}
|
<View style={[{ width: "48%" }]}>
|
||||||
label="Waktu Awal"
|
<InputDate
|
||||||
required
|
onChange={(val) => validationForm("timeStart", val)}
|
||||||
error={error.timeStart}
|
mode="time"
|
||||||
errorText="Waktu awal tidak valid"
|
value={data.timeStart}
|
||||||
placeholder="--:--"
|
label="Waktu Awal"
|
||||||
/>
|
required
|
||||||
</View>
|
error={error.timeStart}
|
||||||
<View style={[{ width: "48%" }]}>
|
errorText="Waktu awal tidak valid"
|
||||||
<InputDate
|
placeholder="--:--"
|
||||||
onChange={(val) => validationForm("timeEnd", val)}
|
/>
|
||||||
mode="time"
|
</View>
|
||||||
value={data.timeEnd}
|
<View style={[{ width: "48%" }]}>
|
||||||
label="Waktu Akhir"
|
<InputDate
|
||||||
required
|
onChange={(val) => validationForm("timeEnd", val)}
|
||||||
error={error.timeEnd}
|
mode="time"
|
||||||
errorText="Waktu akhir tidak valid"
|
value={data.timeEnd}
|
||||||
placeholder="--:--"
|
label="Waktu Akhir"
|
||||||
/>
|
required
|
||||||
|
error={error.timeEnd}
|
||||||
|
errorText="Waktu akhir tidak valid"
|
||||||
|
placeholder="--:--"
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
<InputForm
|
||||||
|
label="Link Meet"
|
||||||
|
type="default"
|
||||||
|
placeholder="Link Meet"
|
||||||
|
bg="white"
|
||||||
|
value={data.linkMeet}
|
||||||
|
onChange={(val) => validationForm("linkMeet", val)}
|
||||||
|
/>
|
||||||
|
<SelectForm
|
||||||
|
bg="white"
|
||||||
|
label="Ulangi Acara"
|
||||||
|
placeholder="Ulangi Acara"
|
||||||
|
value={choose.label}
|
||||||
|
required
|
||||||
|
onPress={() => { setSelect(true) }}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Jumlah Pengulangan"
|
||||||
|
type="numeric"
|
||||||
|
placeholder="Jumlah Pengulangan"
|
||||||
|
required
|
||||||
|
bg="white"
|
||||||
|
value={String(data.repeatValue)}
|
||||||
|
onChange={(val) => validationForm("repeatValue", val)}
|
||||||
|
error={error.repeatValue}
|
||||||
|
errorText="Jumlah pengulangan tidak valid"
|
||||||
|
disable={choose.val == "once"}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Deskripsi"
|
||||||
|
type="default"
|
||||||
|
placeholder="Deskripsi"
|
||||||
|
bg="white"
|
||||||
|
value={data.desc}
|
||||||
|
onChange={(val) => validationForm("desc", val)}
|
||||||
|
multiline
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
</ScrollView>
|
||||||
label="Link Meet"
|
</KeyboardAvoidingView>
|
||||||
type="default"
|
|
||||||
placeholder="Link Meet"
|
|
||||||
bg="white"
|
|
||||||
value={data.linkMeet}
|
|
||||||
onChange={(val) => validationForm("linkMeet", val)}
|
|
||||||
/>
|
|
||||||
<SelectForm
|
|
||||||
bg="white"
|
|
||||||
label="Ulangi Acara"
|
|
||||||
placeholder="Ulangi Acara"
|
|
||||||
value={choose.label}
|
|
||||||
required
|
|
||||||
onPress={() => { setSelect(true) }}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Jumlah Pengulangan"
|
|
||||||
type="numeric"
|
|
||||||
placeholder="Jumlah Pengulangan"
|
|
||||||
required
|
|
||||||
bg="white"
|
|
||||||
value={String(data.repeatValue)}
|
|
||||||
onChange={(val) => validationForm("repeatValue", val)}
|
|
||||||
error={error.repeatValue}
|
|
||||||
errorText="Jumlah pengulangan tidak valid"
|
|
||||||
disable={choose.val == "once"}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Deskripsi"
|
|
||||||
type="default"
|
|
||||||
placeholder="Deskripsi"
|
|
||||||
bg="white"
|
|
||||||
value={data.desc}
|
|
||||||
onChange={(val) => validationForm("desc", val)}
|
|
||||||
multiline
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<ModalSelect
|
<ModalSelect
|
||||||
category={"type-event-repeat"}
|
category={"type-event-repeat"}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetCalendarHistory } from "@/lib/api";
|
import { apiGetCalendarHistory } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { FlatList, Text, View, VirtualizedList } from "react-native";
|
import { FlatList, View, VirtualizedList } from "react-native";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
dateStart: Date
|
dateStart: Date
|
||||||
|
|||||||
@@ -1,19 +1,20 @@
|
|||||||
import 'intl';
|
|
||||||
import 'intl/locale-data/jsonp/id';
|
|
||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import HeaderRightCalendarList from "@/components/calendar/headerCalendarList";
|
import HeaderRightCalendarList from "@/components/calendar/headerCalendarList";
|
||||||
import ItemDateCalendar from "@/components/calendar/itemDateCalendar";
|
import ItemDateCalendar from "@/components/calendar/itemDateCalendar";
|
||||||
import EventItem from "@/components/eventItem";
|
import EventItem from "@/components/eventItem";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetCalendarByDateDivision, apiGetIndicatorCalendar } from "@/lib/api";
|
import { apiGetCalendarByDateDivision, apiGetIndicatorCalendar } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { Feather } from "@expo/vector-icons";
|
import { Feather } from "@expo/vector-icons";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
|
import 'intl';
|
||||||
|
import 'intl/locale-data/jsonp/id';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, RefreshControl, SafeAreaView, ScrollView, Text, View } from "react-native";
|
import { Pressable, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import Datepicker, {
|
import Datepicker, {
|
||||||
CalendarComponents,
|
CalendarComponents,
|
||||||
CalendarDay
|
CalendarDay
|
||||||
@@ -143,7 +144,9 @@ export default function CalendarDivision() {
|
|||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
/>
|
/>
|
||||||
}>
|
}
|
||||||
|
style={[Styles.h100]}
|
||||||
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
<Datepicker
|
<Datepicker
|
||||||
@@ -154,6 +157,13 @@ export default function CalendarDivision() {
|
|||||||
onChange={({ date }) => setSelected(date)}
|
onChange={({ date }) => setSelected(date)}
|
||||||
styles={{
|
styles={{
|
||||||
selected: Styles.selectedDate,
|
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>
|
</View>
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateDiscussion } from "@/lib/discussionUpdate";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function DiscussionDivisionEdit() {
|
export default function DiscussionDivisionEdit() {
|
||||||
@@ -43,7 +44,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
id: detail,
|
id: detail,
|
||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { InputForm } from "@/components/inputForm";
|
|||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
import SkeletonContent from "@/components/skeletonContent";
|
import SkeletonContent from "@/components/skeletonContent";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import {
|
import {
|
||||||
apiGetDiscussionOne,
|
apiGetDiscussionOne,
|
||||||
@@ -17,7 +18,7 @@ import { Ionicons, MaterialIcons } from "@expo/vector-icons";
|
|||||||
import { firebase } from "@react-native-firebase/database";
|
import { firebase } from "@react-native-firebase/database";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, ScrollView, Text, View } from "react-native";
|
import { KeyboardAvoidingView, Platform, Pressable, RefreshControl, ScrollView, View } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -57,6 +58,7 @@ export default function DiscussionDetail() {
|
|||||||
const [loadingKomentar, setLoadingKomentar] = useState(true)
|
const [loadingKomentar, setLoadingKomentar] = useState(true)
|
||||||
const arrSkeleton = Array.from({ length: 3 })
|
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 reference = firebase.app().database('https://mobile-darmasaba-default-rtdb.asia-southeast1.firebasedatabase.app').ref(`/discussion-division/${detail}`);
|
||||||
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -164,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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -188,7 +199,14 @@ export default function DiscussionDetail() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<ScrollView>
|
<ScrollView
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={refreshing}
|
||||||
|
onRefresh={handleRefresh}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
@@ -226,9 +244,7 @@ export default function DiscussionDetail() {
|
|||||||
color="grey"
|
color="grey"
|
||||||
style={Styles.mr05}
|
style={Styles.mr05}
|
||||||
/>
|
/>
|
||||||
<Text
|
<Text style={[Styles.textInformation, Styles.cGray, Styles.mb05]} >
|
||||||
style={[Styles.textInformation, Styles.cGray, Styles.mb05]}
|
|
||||||
>
|
|
||||||
{dataComment.length} Komentar
|
{dataComment.length} Komentar
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -265,63 +281,68 @@ export default function DiscussionDetail() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<View
|
<KeyboardAvoidingView
|
||||||
style={[
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
Styles.contentItemCenter,
|
keyboardVerticalOffset={110}
|
||||||
Styles.absolute0,
|
|
||||||
Styles.w100,
|
|
||||||
{ backgroundColor: "#f4f4f4" },
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<InputForm
|
<View
|
||||||
disable={
|
style={[
|
||||||
data?.status == 2 ||
|
Styles.contentItemCenter,
|
||||||
data?.isActive == false ||
|
Styles.w100,
|
||||||
((entityUser.role == "user" || entityUser.role == "coadmin") &&
|
{ backgroundColor: "#f4f4f4" },
|
||||||
!isMemberDivision)
|
]}
|
||||||
}
|
>
|
||||||
bg="white"
|
<InputForm
|
||||||
type="default"
|
disable={
|
||||||
round
|
data?.status == 2 ||
|
||||||
placeholder="Kirim Komentar"
|
data?.isActive == false ||
|
||||||
onChange={setKomentar}
|
((entityUser.role == "user" || entityUser.role == "coadmin") &&
|
||||||
value={komentar}
|
!isMemberDivision)
|
||||||
itemRight={
|
}
|
||||||
<Pressable
|
bg="white"
|
||||||
onPress={() => {
|
type="default"
|
||||||
komentar != "" &&
|
round
|
||||||
!loadingSend &&
|
placeholder="Kirim Komentar"
|
||||||
data?.status != 2 &&
|
onChange={setKomentar}
|
||||||
data?.isActive &&
|
value={komentar}
|
||||||
(((entityUser.role == "user" ||
|
itemRight={
|
||||||
entityUser.role == "coadmin") &&
|
<Pressable
|
||||||
isMemberDivision) ||
|
onPress={() => {
|
||||||
entityUser.role == "admin" ||
|
komentar != "" &&
|
||||||
entityUser.role == "supadmin" ||
|
!loadingSend &&
|
||||||
entityUser.role == "developer" ||
|
data?.status != 2 &&
|
||||||
entityUser.role == "cosupadmin") &&
|
data?.isActive &&
|
||||||
handleKomentar();
|
(((entityUser.role == "user" ||
|
||||||
}}
|
|
||||||
>
|
|
||||||
<MaterialIcons
|
|
||||||
name="send"
|
|
||||||
size={25}
|
|
||||||
style={
|
|
||||||
komentar == "" ||
|
|
||||||
loadingSend ||
|
|
||||||
data?.status == 2 ||
|
|
||||||
data?.isActive == false ||
|
|
||||||
((entityUser.role == "user" ||
|
|
||||||
entityUser.role == "coadmin") &&
|
entityUser.role == "coadmin") &&
|
||||||
!isMemberDivision)
|
isMemberDivision) ||
|
||||||
? Styles.cGray
|
entityUser.role == "admin" ||
|
||||||
: Styles.cDefault
|
entityUser.role == "supadmin" ||
|
||||||
}
|
entityUser.role == "developer" ||
|
||||||
/>
|
entityUser.role == "cosupadmin") &&
|
||||||
</Pressable>
|
handleKomentar();
|
||||||
}
|
}}
|
||||||
/>
|
>
|
||||||
</View>
|
<MaterialIcons
|
||||||
|
name="send"
|
||||||
|
size={25}
|
||||||
|
style={
|
||||||
|
komentar == "" ||
|
||||||
|
loadingSend ||
|
||||||
|
data?.status == 2 ||
|
||||||
|
data?.isActive == false ||
|
||||||
|
((entityUser.role == "user" ||
|
||||||
|
entityUser.role == "coadmin") &&
|
||||||
|
!isMemberDivision)
|
||||||
|
? Styles.cGray
|
||||||
|
: Styles.cDefault
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Pressable>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</KeyboardAvoidingView>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateDiscussion } from "@/lib/discussionUpdate"
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router"
|
import { router, Stack, useLocalSearchParams } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native"
|
import { SafeAreaView, ScrollView, View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
|
|
||||||
export default function CreateDiscussionDivision() {
|
export default function CreateDiscussionDivision() {
|
||||||
@@ -22,15 +23,15 @@ export default function CreateDiscussionDivision() {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateDiscussion({ data: { user: hasil, desc, idDivision: id } })
|
const response = await apiCreateDiscussion({ data: { user: hasil, desc, idDivision: id } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import ImageUser from "@/components/imageNew";
|
|||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import SkeletonContent from "@/components/skeletonContent";
|
import SkeletonContent from "@/components/skeletonContent";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDiscussion } from "@/lib/api";
|
import { apiGetDiscussion } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign, Feather, Ionicons } from "@expo/vector-icons";
|
import { AntDesign, Feather, Ionicons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { RefreshControl, Text, View, VirtualizedList } from "react-native";
|
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ import {
|
|||||||
RefreshControl,
|
RefreshControl,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
ToastAndroid,
|
View
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import * as mime from 'react-native-mime-types';
|
import * as mime from 'react-native-mime-types';
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -110,10 +110,6 @@ export default function DocumentDivision() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
handleLoad(true);
|
|
||||||
}, [path, update]);
|
|
||||||
|
|
||||||
const handleCheckboxChange = (index: number) => {
|
const handleCheckboxChange = (index: number) => {
|
||||||
setDariSelectAll(false);
|
setDariSelectAll(false);
|
||||||
if (selectedFiles.some((i: any) => i.id == data[index].id)) {
|
if (selectedFiles.some((i: any) => i.id == data[index].id)) {
|
||||||
@@ -207,15 +203,15 @@ export default function DocumentDivision() {
|
|||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiDocumentRename({ user: hasil, ...bodyRename });
|
const response = await apiDocumentRename({ user: hasil, ...bodyRename });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil mengubah nama", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah nama', })
|
||||||
dispatch(setUpdateDokumen(!update));
|
dispatch(setUpdateDokumen(!update));
|
||||||
handleBatal();
|
handleBatal();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setRename(false);
|
setRename(false);
|
||||||
}
|
}
|
||||||
@@ -229,20 +225,21 @@ export default function DocumentDivision() {
|
|||||||
data: selectedFiles,
|
data: selectedFiles,
|
||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil menghapus", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus', })
|
||||||
dispatch(setUpdateDokumen(!update));
|
dispatch(setUpdateDokumen(!update));
|
||||||
handleBatal();
|
handleBatal();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleBatal();
|
handleBatal();
|
||||||
|
handleLoad(false)
|
||||||
}, [update]);
|
}, [update]);
|
||||||
|
|
||||||
async function handleShare(selectedDivision: any[]) {
|
async function handleShare(selectedDivision: any[]) {
|
||||||
@@ -254,15 +251,15 @@ export default function DocumentDivision() {
|
|||||||
dataItem: selectedFiles,
|
dataItem: selectedFiles,
|
||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil membagikan item", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil membagikan item', })
|
||||||
dispatch(setUpdateDokumen(!update));
|
dispatch(setUpdateDokumen(!update));
|
||||||
handleBatal();
|
handleBatal();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setShare(false);
|
setShare(false);
|
||||||
}
|
}
|
||||||
@@ -270,7 +267,7 @@ export default function DocumentDivision() {
|
|||||||
|
|
||||||
|
|
||||||
const openFile = (item: Props) => {
|
const openFile = (item: Props) => {
|
||||||
setLoadingOpen(true)
|
if (Platform.OS == 'android') setLoadingOpen(true)
|
||||||
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
|
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
|
||||||
const fileName = item.name + '.' + item.extension;
|
const fileName = item.name + '.' + item.extension;
|
||||||
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||||
@@ -278,9 +275,9 @@ export default function DocumentDivision() {
|
|||||||
|
|
||||||
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
||||||
const contentURL = await FileSystem.getContentUriAsync(uri);
|
const contentURL = await FileSystem.getContentUriAsync(uri);
|
||||||
|
setLoadingOpen(false)
|
||||||
try {
|
try {
|
||||||
if (Platform.OS == 'android') {
|
if (Platform.OS == 'android') {
|
||||||
// open with android intent
|
|
||||||
await startActivityAsync(
|
await startActivityAsync(
|
||||||
'android.intent.action.VIEW',
|
'android.intent.action.VIEW',
|
||||||
{
|
{
|
||||||
@@ -289,16 +286,13 @@ export default function DocumentDivision() {
|
|||||||
type: mimeType as string,
|
type: mimeType as string,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// or
|
|
||||||
// Sharing.shareAsync(localPath);
|
|
||||||
|
|
||||||
} else if (Platform.OS == 'ios') {
|
} else if (Platform.OS == 'ios') {
|
||||||
Sharing.shareAsync(localPath);
|
Sharing.shareAsync(localPath);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingOpen(false)
|
if (Platform.OS == 'android') setLoadingOpen(false)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -310,6 +304,10 @@ export default function DocumentDivision() {
|
|||||||
setRefreshing(false)
|
setRefreshing(false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleLoad(true);
|
||||||
|
}, [path]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -351,7 +349,7 @@ export default function DocumentDivision() {
|
|||||||
/>
|
/>
|
||||||
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
style={{ height: "100%" }}
|
style={[Styles.h100]}
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
@@ -375,7 +373,7 @@ export default function DocumentDivision() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.id != "home" && (
|
{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>
|
<Text> {item.name} </Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
@@ -538,13 +536,11 @@ export default function DocumentDivision() {
|
|||||||
<DrawerBottom
|
<DrawerBottom
|
||||||
animation="slide"
|
animation="slide"
|
||||||
isVisible={modalMore}
|
isVisible={modalMore}
|
||||||
setVisible={setModalMore}
|
setVisible={() => { setModalMore(false) }}
|
||||||
title=""
|
title=""
|
||||||
>
|
>
|
||||||
<ModalMore
|
<ModalMore
|
||||||
onClose={() => {
|
onClose={() => { setModalMore(false); }}
|
||||||
setModalMore(false);
|
|
||||||
}}
|
|
||||||
data={selectedFiles}
|
data={selectedFiles}
|
||||||
share={shareSelected}
|
share={shareSelected}
|
||||||
/>
|
/>
|
||||||
@@ -553,10 +549,8 @@ export default function DocumentDivision() {
|
|||||||
<ModalFloat
|
<ModalFloat
|
||||||
title="Ganti Nama"
|
title="Ganti Nama"
|
||||||
isVisible={isRename}
|
isVisible={isRename}
|
||||||
setVisible={setRename}
|
setVisible={() => { setRename(false) }}
|
||||||
onSubmit={() => {
|
onSubmit={() => { handleRename() }}
|
||||||
handleRename();
|
|
||||||
}}
|
|
||||||
disableSubmit={bodyRename.name == ""}
|
disableSubmit={bodyRename.name == ""}
|
||||||
>
|
>
|
||||||
<View>
|
<View>
|
||||||
@@ -576,7 +570,7 @@ export default function DocumentDivision() {
|
|||||||
title="Bagikan"
|
title="Bagikan"
|
||||||
category="share-division"
|
category="share-division"
|
||||||
open={isShare}
|
open={isShare}
|
||||||
close={setShare}
|
close={() => { setShare(false) }}
|
||||||
onSelect={(value) => {
|
onSelect={(value) => {
|
||||||
handleShare(value)
|
handleShare(value)
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ButtonSelect from "@/components/buttonSelect";
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiAddFileTask, apiCheckFileTask } from "@/lib/api";
|
import { apiAddFileTask, apiCheckFileTask } from "@/lib/api";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
@@ -16,10 +17,9 @@ import {
|
|||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function TaskDivisionAddFile() {
|
export default function TaskDivisionAddFile() {
|
||||||
@@ -36,16 +36,18 @@ export default function TaskDivisionAddFile() {
|
|||||||
const pickDocumentAsync = async () => {
|
const pickDocumentAsync = async () => {
|
||||||
let result = await DocumentPicker.getDocumentAsync({
|
let result = await DocumentPicker.getDocumentAsync({
|
||||||
type: ["*/*"],
|
type: ["*/*"],
|
||||||
multiple: false,
|
multiple: true,
|
||||||
});
|
});
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
if (result.assets?.[0].uri) {
|
for (let i = 0; i < result.assets?.length; i++) {
|
||||||
const check = await handleCheckFile(result.assets?.[0]);
|
if (result.assets?.[i].uri) {
|
||||||
if (check) {
|
const check = await handleCheckFile(result.assets?.[i]);
|
||||||
setFileForm([...fileForm, result.assets?.[0]]);
|
if (check) {
|
||||||
setListFile([...listFile, result.assets?.[0].name]);
|
setFileForm((prev) => [...prev, result.assets?.[i]]);
|
||||||
} else {
|
setListFile((prev) => [...prev, result.assets?.[i].name]);
|
||||||
ToastAndroid.show("File sudah ada", ToastAndroid.SHORT);
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: 'File sudah ada', })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,15 +110,15 @@ export default function TaskDivisionAddFile() {
|
|||||||
|
|
||||||
const response = await apiAddFileTask({ data: fd, id: detail });
|
const response = await apiAddFileTask({ data: fd, id: detail });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil menambahkan file", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan file', })
|
||||||
dispatch(setUpdateTask({ ...update, file: !update.file }));
|
dispatch(setUpdateTask({ ...update, file: !update.file }));
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import ImageWithLabel from "@/components/imageWithLabel";
|
import ImageWithLabel from "@/components/imageWithLabel";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiAddMemberTask, apiGetDivisionMember, apiGetTaskOne } from "@/lib/api";
|
import { apiAddMemberTask, apiGetDivisionMember, apiGetTaskOne } from "@/lib/api";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
@@ -10,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -73,15 +75,15 @@ export default function AddMemberTask() {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberTask({ id: detail, data: { user: hasil, member: selectMember, idDivision: id } })
|
const response = await apiAddMemberTask({ id: detail, data: { user: hasil, member: selectMember, idDivision: id } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan anggota', })
|
||||||
dispatch(setUpdateTask({ ...update, member: !update.member }))
|
dispatch(setUpdateTask({ ...update, member: !update.member }))
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan anggota', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateTaskTugas } from "@/lib/api";
|
import { apiCreateTaskTugas } from "@/lib/api";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
@@ -9,12 +10,11 @@ import dayjs from "dayjs";
|
|||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
SafeAreaView,
|
KeyboardAvoidingView, Platform, SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
import DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
@@ -86,14 +86,14 @@ export default function TaskDivisionAddTask() {
|
|||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateTask({ ...update, task: !update.task, progress: !update.progress }));
|
dispatch(setUpdateTask({ ...update, task: !update.task, progress: !update.progress }));
|
||||||
ToastAndroid.show("Berhasil menambah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menambah data', })
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Gagal menambah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Gagal menambah data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,59 +121,65 @@ export default function TaskDivisionAddTask() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
keyboardVerticalOffset={110}
|
||||||
<DateTimePicker
|
>
|
||||||
mode="range"
|
<ScrollView>
|
||||||
startDate={range.startDate}
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
endDate={range.endDate}
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
onChange={(param) => setRange(param)}
|
<DateTimePicker
|
||||||
styles={{
|
mode="range"
|
||||||
selected: Styles.selectedDate,
|
startDate={range.startDate}
|
||||||
selected_label: Styles.cWhite,
|
endDate={range.endDate}
|
||||||
range_fill: Styles.selectRangeDate,
|
onChange={(param) => setRange(param)}
|
||||||
|
styles={{
|
||||||
|
selected: Styles.selectedDate,
|
||||||
|
selected_label: Styles.cWhite,
|
||||||
|
range_fill: Styles.selectRangeDate,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={[Styles.mv10]}>
|
||||||
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
<InputForm
|
||||||
|
label="Judul Tugas"
|
||||||
|
type="default"
|
||||||
|
placeholder="Judul Tugas"
|
||||||
|
required
|
||||||
|
bg="white"
|
||||||
|
value={title}
|
||||||
|
error={error.title}
|
||||||
|
errorText="Judul tidak boleh kosong"
|
||||||
|
onChange={(e) => {
|
||||||
|
onValidation("title", e)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv10]}>
|
</ScrollView>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
</KeyboardAvoidingView>
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
{
|
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
<InputForm
|
|
||||||
label="Judul Tugas"
|
|
||||||
type="default"
|
|
||||||
placeholder="Judul Tugas"
|
|
||||||
required
|
|
||||||
bg="white"
|
|
||||||
value={title}
|
|
||||||
error={error.title}
|
|
||||||
errorText="Judul tidak boleh kosong"
|
|
||||||
onChange={(e) => {
|
|
||||||
onValidation("title", e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateTask } from "@/lib/taskUpdate";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function TaskDivisionCancel() {
|
export default function TaskDivisionCancel() {
|
||||||
@@ -52,14 +53,14 @@ export default function TaskDivisionCancel() {
|
|||||||
);
|
);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateTask({ ...update, data: !update.data }));
|
dispatch(setUpdateTask({ ...update, data: !update.data }));
|
||||||
ToastAndroid.show("Berhasil membatalkan kegiatan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil membatalkan kegiatan', })
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Gagal membatalkan kegiatan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Gagal membatalkan kegiatan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateTask } from "@/lib/taskUpdate";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function TaskDivisionEdit() {
|
export default function TaskDivisionEdit() {
|
||||||
@@ -41,7 +42,7 @@ export default function TaskDivisionEdit() {
|
|||||||
setJudul(val);
|
setJudul(val);
|
||||||
if (val == "" || val == "null") {
|
if (val == "" || val == "null") {
|
||||||
setError(true);
|
setError(true);
|
||||||
}else{
|
} else {
|
||||||
setError(false);
|
setError(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,14 +71,14 @@ export default function TaskDivisionEdit() {
|
|||||||
);
|
);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateTask({ ...update, data: !update.data }));
|
dispatch(setUpdateTask({ ...update, data: !update.data }));
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { apiGetTaskOne } from "@/lib/api";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
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";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -29,6 +29,7 @@ export default function DetailTaskDivision() {
|
|||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [progress, setProgress] = useState(0)
|
const [progress, setProgress] = useState(0)
|
||||||
const update = useSelector((state: any) => state.taskUpdate)
|
const update = useSelector((state: any) => state.taskUpdate)
|
||||||
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
async function handleLoad(cat: 'data' | 'progress') {
|
async function handleLoad(cat: 'data' | 'progress') {
|
||||||
@@ -56,6 +57,14 @@ export default function DetailTaskDivision() {
|
|||||||
handleLoad('progress')
|
handleLoad('progress')
|
||||||
}, [update.progress])
|
}, [update.progress])
|
||||||
|
|
||||||
|
const handleRefresh = async () => {
|
||||||
|
setRefreshing(true)
|
||||||
|
await handleLoad('data')
|
||||||
|
await handleLoad('progress')
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
|
setRefreshing(false)
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -66,15 +75,22 @@ export default function DetailTaskDivision() {
|
|||||||
headerRight: () => <HeaderRightTaskDetail id={detail} division={id} status={data?.status} />,
|
headerRight: () => <HeaderRightTaskDetail id={detail} division={id} status={data?.status} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView
|
||||||
|
refreshControl={
|
||||||
|
<RefreshControl
|
||||||
|
refreshing={refreshing}
|
||||||
|
onRefresh={handleRefresh}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
{
|
{
|
||||||
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
||||||
}
|
}
|
||||||
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
||||||
<SectionTanggalTugasTask />
|
<SectionTanggalTugasTask refreshing={refreshing}/>
|
||||||
<SectionFileTask />
|
<SectionFileTask refreshing={refreshing}/>
|
||||||
<SectionMemberTask />
|
<SectionMemberTask refreshing={refreshing}/>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { InputForm } from "@/components/inputForm";
|
|||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalSelect from "@/components/modalSelect";
|
import ModalSelect from "@/components/modalSelect";
|
||||||
import SectionListAddTask from "@/components/project/sectionListAddTask";
|
import SectionListAddTask from "@/components/project/sectionListAddTask";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateTask } from "@/lib/api";
|
import { apiCreateTask } from "@/lib/api";
|
||||||
import { setMemberChoose } from "@/lib/memberChoose";
|
import { setMemberChoose } from "@/lib/memberChoose";
|
||||||
@@ -18,7 +19,8 @@ import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
|||||||
import * as DocumentPicker from "expo-document-picker";
|
import * as DocumentPicker from "expo-document-picker";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|
||||||
@@ -50,11 +52,13 @@ export default function CreateTaskDivision() {
|
|||||||
const pickDocumentAsync = async () => {
|
const pickDocumentAsync = async () => {
|
||||||
let result = await DocumentPicker.getDocumentAsync({
|
let result = await DocumentPicker.getDocumentAsync({
|
||||||
type: ["*/*"],
|
type: ["*/*"],
|
||||||
multiple: false
|
multiple: true
|
||||||
});
|
});
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
if (result.assets[0].uri) {
|
for (let i = 0; i < result.assets?.length; i++) {
|
||||||
setFileForm([...fileForm, result.assets[0]])
|
if (result.assets[i].uri) {
|
||||||
|
setFileForm((prev) => [...prev, result.assets[i]])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -91,10 +95,10 @@ export default function CreateTaskDivision() {
|
|||||||
const response = await apiCreateTask(fd)
|
const response = await apiCreateTask(fd)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateTask({ ...update, data: !update.data }))
|
dispatch(setUpdateTask({ ...update, data: !update.data }))
|
||||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
handleBack()
|
handleBack()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import ImageWithLabel from "@/components/imageWithLabel";
|
import ImageWithLabel from "@/components/imageWithLabel";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDivisionMember } from "@/lib/api";
|
import { apiGetDivisionMember } from "@/lib/api";
|
||||||
import { setMemberChoose } from "@/lib/memberChoose";
|
import { setMemberChoose } from "@/lib/memberChoose";
|
||||||
@@ -10,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -56,7 +58,7 @@ export default function AddMemberCreateTask() {
|
|||||||
router.back()
|
router.back()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan anggota', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { setTaskCreate } from "@/lib/taskCreate";
|
import { setTaskCreate } from "@/lib/taskCreate";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
|
||||||
View
|
View
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import DateTimePicker, {
|
import DateTimePicker, {
|
||||||
@@ -97,59 +99,64 @@ export default function CreateTaskAddTugas() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
keyboardVerticalOffset={110}
|
||||||
<DateTimePicker
|
>
|
||||||
mode="range"
|
<ScrollView>
|
||||||
startDate={range.startDate}
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
endDate={range.endDate}
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
onChange={(param) => setRange(param)}
|
<DateTimePicker
|
||||||
styles={{
|
mode="range"
|
||||||
selected: Styles.selectedDate,
|
startDate={range.startDate}
|
||||||
selected_label: Styles.cWhite,
|
endDate={range.endDate}
|
||||||
range_fill: Styles.selectRangeDate,
|
onChange={(param) => setRange(param)}
|
||||||
|
styles={{
|
||||||
|
selected: Styles.selectedDate,
|
||||||
|
selected_label: Styles.cWhite,
|
||||||
|
range_fill: Styles.selectRangeDate,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={[Styles.mv10]}>
|
||||||
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
<InputForm
|
||||||
|
label="Judul Tugas"
|
||||||
|
type="default"
|
||||||
|
placeholder="Judul Tugas"
|
||||||
|
required
|
||||||
|
bg="white"
|
||||||
|
value={title}
|
||||||
|
error={error.title}
|
||||||
|
errorText="Judul tidak boleh kosong"
|
||||||
|
onChange={(e) => {
|
||||||
|
onValidation("title", e)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv10]}>
|
</ScrollView>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
</KeyboardAvoidingView>
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
{
|
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
<InputForm
|
|
||||||
label="Judul Tugas"
|
|
||||||
type="default"
|
|
||||||
placeholder="Judul Tugas"
|
|
||||||
required
|
|
||||||
bg="white"
|
|
||||||
value={title}
|
|
||||||
error={error.title}
|
|
||||||
errorText="Judul tidak boleh kosong"
|
|
||||||
onChange={(e) => {
|
|
||||||
onValidation("title", e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import PaperGridContent from "@/components/paperGridContent";
|
|||||||
import ProgressBar from "@/components/progressBar";
|
import ProgressBar from "@/components/progressBar";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetTask } from "@/lib/api";
|
import { apiGetTask } from "@/lib/api";
|
||||||
@@ -17,7 +18,7 @@ import {
|
|||||||
} from "@expo/vector-icons";
|
} from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, RefreshControl, ScrollView, Text, View, VirtualizedList } from "react-native";
|
import { Pressable, RefreshControl, ScrollView, View, VirtualizedList } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -192,7 +193,7 @@ export default function ListTask() {
|
|||||||
:
|
:
|
||||||
data.length > 0 ? (
|
data.length > 0 ? (
|
||||||
isList ? (
|
isList ? (
|
||||||
<View>
|
<View style={[Styles.h100]}>
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={data}
|
data={data}
|
||||||
getItemCount={() => data.length}
|
getItemCount={() => data.length}
|
||||||
@@ -240,7 +241,7 @@ export default function ListTask() {
|
|||||||
))} */}
|
))} */}
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View>
|
<View style={[Styles.h100]}>
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={data}
|
data={data}
|
||||||
getItemCount={() => data.length}
|
getItemCount={() => data.length}
|
||||||
@@ -257,7 +258,7 @@ export default function ListTask() {
|
|||||||
>
|
>
|
||||||
<ProgressBar category="list" value={item.progress} />
|
<ProgressBar category="list" value={item.progress} />
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<Text></Text>
|
<Text> </Text>
|
||||||
<LabelStatus
|
<LabelStatus
|
||||||
size="default"
|
size="default"
|
||||||
category={
|
category={
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditTaskTugas, apiGetTaskTugas } from "@/lib/api";
|
import { apiEditTaskTugas, apiGetTaskTugas } from "@/lib/api";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
@@ -9,12 +10,13 @@ import dayjs from "dayjs";
|
|||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
import DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
@@ -39,9 +41,9 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const from = range.startDate
|
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() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -75,14 +77,14 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
const response = await apiEditTaskTugas({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
const response = await apiEditTaskTugas({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateTask({ ...update, task: !update.task }))
|
dispatch(setUpdateTask({ ...update, task: !update.task }))
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Gagal mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,67 +143,71 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
keyboardVerticalOffset={110}
|
||||||
{!loading && (
|
>
|
||||||
<DateTimePicker
|
<ScrollView>
|
||||||
mode="range"
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
startDate={range.startDate}
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
endDate={range.endDate}
|
{!loading && (
|
||||||
onChange={(param) => setRange(param)}
|
<DateTimePicker
|
||||||
month={month}
|
mode="range"
|
||||||
year={year}
|
startDate={range.startDate}
|
||||||
styles={{
|
endDate={range.endDate}
|
||||||
selected: Styles.selectedDate,
|
onChange={(param) => setRange(param)}
|
||||||
selected_label: Styles.cWhite,
|
month={month}
|
||||||
range_fill: Styles.selectRangeDate,
|
year={year}
|
||||||
}}
|
styles={{
|
||||||
/>
|
selected: Styles.selectedDate,
|
||||||
)}
|
selected_label: Styles.cWhite,
|
||||||
</View>
|
range_fill: Styles.selectRangeDate,
|
||||||
<View style={[Styles.mv10]}>
|
}}
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
/>
|
||||||
<View style={[{ width: "48%" }]}>
|
)}
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
{(error.endDate || error.startDate) && (
|
<View style={[Styles.mv10]}>
|
||||||
<Text
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
style={[Styles.textInformation, Styles.cError, Styles.mt05]}
|
<View style={[{ width: "48%" }]}>
|
||||||
>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal tidak boleh kosong
|
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{(error.endDate || error.startDate) && (
|
||||||
|
<Text style={[Styles.textInformation, Styles.cError, Styles.mt05]} >
|
||||||
|
Tanggal tidak boleh kosong
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
<InputForm
|
||||||
|
label="Judul Tugas"
|
||||||
|
type="default"
|
||||||
|
placeholder="Judul Tugas"
|
||||||
|
required
|
||||||
|
bg="white"
|
||||||
|
value={title}
|
||||||
|
error={error.title}
|
||||||
|
errorText="Judul tidak boleh kosong"
|
||||||
|
onChange={(e) => {
|
||||||
|
onValidation("title", e)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
</ScrollView>
|
||||||
label="Judul Tugas"
|
</KeyboardAvoidingView>
|
||||||
type="default"
|
|
||||||
placeholder="Judul Tugas"
|
|
||||||
required
|
|
||||||
bg="white"
|
|
||||||
value={title}
|
|
||||||
error={error.title}
|
|
||||||
errorText="Judul tidak boleh kosong"
|
|
||||||
onChange={(e) => {
|
|
||||||
onValidation("title", e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import ImageWithLabel from "@/components/imageWithLabel";
|
import ImageWithLabel from "@/components/imageWithLabel";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiAddMemberDivision, apiGetDivisionOneDetail, apiGetUser } from "@/lib/api";
|
import { apiAddMemberDivision, apiGetDivisionOneDetail, apiGetUser } from "@/lib/api";
|
||||||
import { setUpdateDivision } from "@/lib/divisionUpdate";
|
import { setUpdateDivision } from "@/lib/divisionUpdate";
|
||||||
@@ -10,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -74,14 +76,14 @@ export default function AddMemberDivision() {
|
|||||||
const response = await apiAddMemberDivision({ id: id, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberDivision({ id: id, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateDivision(!update))
|
dispatch(setUpdateDivision(!update))
|
||||||
ToastAndroid.show('Berhasil menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan anggota', })
|
||||||
router.replace(`/division/${id}/info`)
|
router.replace(`/division/${id}/info`)
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan anggota', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +119,7 @@ export default function AddMemberDivision() {
|
|||||||
<ImageWithLabel
|
<ImageWithLabel
|
||||||
key={index}
|
key={index}
|
||||||
label={item.name}
|
label={item.name}
|
||||||
src={item.img}
|
src={`https://wibu-storage.wibudev.com/api/files/${item.img}`}
|
||||||
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateDivision } from "@/lib/divisionUpdate";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function EditDivision() {
|
export default function EditDivision() {
|
||||||
@@ -46,14 +47,14 @@ export default function EditDivision() {
|
|||||||
const response = await apiEditDivision({ user: hasil, name: data.name, desc: data.desc }, id)
|
const response = await apiEditDivision({ user: hasil, name: data.name, desc: data.desc }, id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateDivision(!update))
|
dispatch(setUpdateDivision(!update))
|
||||||
ToastAndroid.show('Berhasil mengubah data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { Feather, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
import { Feather, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router"
|
import { router, Stack, useLocalSearchParams } from "expo-router"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native"
|
import { Pressable, SafeAreaView, ScrollView, Text, View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useSelector } from "react-redux"
|
import { useSelector } from "react-redux"
|
||||||
|
|
||||||
type PropsDetail = {
|
type PropsDetail = {
|
||||||
@@ -66,13 +67,13 @@ export default function InformationDivision() {
|
|||||||
const response = await apiDeleteMemberDivision({ user: hasil, id: dataMemberChoose.id }, id)
|
const response = await apiDeleteMemberDivision({ user: hasil, id: dataMemberChoose.id }, id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setRefresh(!refresh)
|
setRefresh(!refresh)
|
||||||
ToastAndroid.show('Berhasil mengeluarkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengeluarkan anggota', })
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
}
|
}
|
||||||
@@ -84,13 +85,13 @@ export default function InformationDivision() {
|
|||||||
const response = await apiUpdateStatusAdminDivision({ user: hasil, id: dataMemberChoose.id, isAdmin: dataMemberChoose.isAdmin }, id)
|
const response = await apiUpdateStatusAdminDivision({ user: hasil, id: dataMemberChoose.id, isAdmin: dataMemberChoose.isAdmin }, id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
setRefresh(!refresh)
|
setRefresh(!refresh)
|
||||||
ToastAndroid.show(dataMemberChoose.isAdmin ? 'Berhasil memberhentikan admin' : 'Berhasil menjadi admin', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: dataMemberChoose.isAdmin ? 'Berhasil memberhentikan admin' : 'Berhasil menjadi admin', })
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
}
|
}
|
||||||
@@ -133,11 +134,11 @@ export default function InformationDivision() {
|
|||||||
headerRight: () => <HeaderRightDivisionInfo id={id} active={dataDetail?.isActive} />,
|
headerRight: () => <HeaderRightDivisionInfo id={id} active={dataDetail?.isActive} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15]}>
|
||||||
{
|
{
|
||||||
dataDetail?.isActive == false && (
|
dataDetail?.isActive == false && (
|
||||||
<SectionCancel title={'Divisi dinonaktifkan'} />
|
<SectionCancel title={'Divisi nonaktif'} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router"
|
import { router, Stack, useLocalSearchParams } from "expo-router"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native"
|
import { SafeAreaView, ScrollView, View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
|
|
||||||
export default function ReportDivision() {
|
export default function ReportDivision() {
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
@@ -31,7 +32,7 @@ export default function ReportDivision() {
|
|||||||
dateEnd: false,
|
dateEnd: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
function validationForm( cat: "date" | "dateEnd", val: string) {
|
function validationForm(cat: "date" | "dateEnd", val: string) {
|
||||||
if (cat == "date") {
|
if (cat == "date") {
|
||||||
setData({ ...data, date: val, dateEnd: "" });
|
setData({ ...data, date: val, dateEnd: "" });
|
||||||
if (val == "" || val == "null") {
|
if (val == "" || val == "null") {
|
||||||
@@ -89,7 +90,7 @@ export default function ReportDivision() {
|
|||||||
})
|
})
|
||||||
setShowReport(true);
|
setShowReport(true);
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateDivision } from "@/lib/api";
|
import { apiCreateDivision } from "@/lib/api";
|
||||||
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
||||||
@@ -9,7 +10,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -50,16 +52,16 @@ export default function CreateDivisionAddAdmin() {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateDivision({ ...update, user: hasil })
|
const response = await apiCreateDivision({ ...update, user: hasil })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil membuat divisi', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil membuat divisi', })
|
||||||
dispatch(setFormCreateDivision({ admin: [], member: [], data: { idGroup: '', name: '', desc: '' } }))
|
dispatch(setFormCreateDivision({ admin: [], member: [], data: { idGroup: '', name: '', desc: '' } }))
|
||||||
dispatch(setUpdateDivision(!updateDivision))
|
dispatch(setUpdateDivision(!updateDivision))
|
||||||
router.replace(`/division/`)
|
router.replace(`/division/`)
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal membuat divisi', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal membuat divisi', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ import ButtonNextHeader from "@/components/buttonNextHeader";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import ImageWithLabel from "@/components/imageWithLabel";
|
import ImageWithLabel from "@/components/imageWithLabel";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetUser } from "@/lib/api";
|
import { apiGetUser } from "@/lib/api";
|
||||||
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
||||||
import { setUpdateDivision } from "@/lib/divisionUpdate";
|
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import InputSearch from "@/components/inputSearch";
|
|||||||
import PaperGridContent from "@/components/paperGridContent";
|
import PaperGridContent from "@/components/paperGridContent";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDivision } from "@/lib/api";
|
import { apiGetDivision } from "@/lib/api";
|
||||||
@@ -18,7 +19,6 @@ import {
|
|||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, RefreshControl, View, VirtualizedList } from "react-native";
|
import { Pressable, RefreshControl, View, VirtualizedList } from "react-native";
|
||||||
import Text from "@/components/Text";
|
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -218,7 +218,7 @@ export default function ListDivision() {
|
|||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
isList ? (
|
isList ? (
|
||||||
<View style={[Styles.mb50]}>
|
<View style={[Styles.h100]}>
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={data}
|
data={data}
|
||||||
style={[{ paddingBottom: 100 }]}
|
style={[{ paddingBottom: 100 }]}
|
||||||
@@ -253,7 +253,7 @@ export default function ListDivision() {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View>
|
<View style={[Styles.h100]}>
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={data}
|
data={data}
|
||||||
style={[{ paddingBottom: 100 }]}
|
style={[{ paddingBottom: 100 }]}
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function Report() {
|
export default function Report() {
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
@@ -107,7 +108,7 @@ export default function Report() {
|
|||||||
})
|
})
|
||||||
setShowReport(true);
|
setShowReport(true);
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalSelect from "@/components/modalSelect";
|
import ModalSelect from "@/components/modalSelect";
|
||||||
import SelectForm from "@/components/selectForm";
|
import SelectForm from "@/components/selectForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditProfile, apiGetProfile } from "@/lib/api";
|
import { apiEditProfile, apiGetProfile } from "@/lib/api";
|
||||||
import { setEntities } from "@/lib/entitiesSlice";
|
import { setEntities } from "@/lib/entitiesSlice";
|
||||||
@@ -15,10 +16,9 @@ import {
|
|||||||
Pressable,
|
Pressable,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -170,15 +170,15 @@ export default function EditProfile() {
|
|||||||
const response = await apiEditProfile(fd)
|
const response = await apiEditProfile(fd)
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
await handleLoad()
|
await handleLoad()
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ export default function EditProfile() {
|
|||||||
const pickImageAsync = async () => {
|
const pickImageAsync = async () => {
|
||||||
let result = await ImagePicker.launchImageLibraryAsync({
|
let result = await ImagePicker.launchImageLibraryAsync({
|
||||||
mediaTypes: ["images"],
|
mediaTypes: ["images"],
|
||||||
allowsEditing: true,
|
allowsEditing: false,
|
||||||
quality: 1,
|
quality: 1,
|
||||||
aspect: [1, 1],
|
aspect: [1, 1],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { InputForm } from "@/components/inputForm";
|
|||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiDeleteGroup, apiEditGroup, apiGetGroup } from "@/lib/api";
|
import { apiDeleteGroup, apiEditGroup, apiGetGroup } from "@/lib/api";
|
||||||
@@ -14,7 +15,8 @@ import { setUpdateGroup } from "@/lib/groupSlice";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { RefreshControl, SafeAreaView, ScrollView, Text, ToastAndroid, 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";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -60,7 +62,7 @@ export default function Index() {
|
|||||||
} finally {
|
} finally {
|
||||||
setVisibleEdit(false)
|
setVisibleEdit(false)
|
||||||
setModal(false)
|
setModal(false)
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -74,7 +76,7 @@ export default function Index() {
|
|||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,32 +112,33 @@ export default function Index() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<ScrollView
|
<View style={[Styles.p15]}>
|
||||||
refreshControl={
|
<View style={[Styles.wrapBtnTab]}>
|
||||||
<RefreshControl
|
<ButtonTab
|
||||||
refreshing={refreshing}
|
active={status == "false" ? "false" : "true"}
|
||||||
onRefresh={handleRefresh}
|
value="true"
|
||||||
/>
|
onPress={() => { setStatus("true") }}
|
||||||
}
|
label="Aktif"
|
||||||
>
|
icon={<Feather name="check-circle" color={status == "true" ? 'white' : 'black'} size={20} />}
|
||||||
<View style={[Styles.p15]}>
|
n={2} />
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<ButtonTab
|
||||||
<ButtonTab
|
active={status == "false" ? "false" : "true"}
|
||||||
active={status == "false" ? "false" : "true"}
|
value="false"
|
||||||
value="true"
|
onPress={() => { setStatus("false") }}
|
||||||
onPress={() => { setStatus("true") }}
|
label="Tidak Aktif"
|
||||||
label="Aktif"
|
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : 'black'} size={20} />}
|
||||||
icon={<Feather name="check-circle" color={status == "true" ? 'white' : 'black'} size={20} />}
|
n={2} />
|
||||||
n={2} />
|
</View>
|
||||||
<ButtonTab
|
<InputSearch onChange={setSearch} />
|
||||||
active={status == "false" ? "false" : "true"}
|
<ScrollView
|
||||||
value="false"
|
refreshControl={
|
||||||
onPress={() => { setStatus("false") }}
|
<RefreshControl
|
||||||
label="Tidak Aktif"
|
refreshing={refreshing}
|
||||||
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : 'black'} size={20} />}
|
onRefresh={handleRefresh}
|
||||||
n={2} />
|
/>
|
||||||
</View>
|
}
|
||||||
<InputSearch onChange={setSearch} />
|
style={[Styles.h100]}
|
||||||
|
>
|
||||||
<View>
|
<View>
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -171,10 +174,10 @@ export default function Index() {
|
|||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</ScrollView>
|
||||||
</ScrollView>
|
</View>
|
||||||
|
|
||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title={titleChoose}>
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title={titleChoose}>
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="toggle-switch-off-outline" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="toggle-switch-off-outline" color="black" size={25} />}
|
||||||
@@ -193,13 +196,15 @@ export default function Index() {
|
|||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
setVisibleEdit(true)
|
setTimeout(() => {
|
||||||
|
setVisibleEdit(true)
|
||||||
|
}, 600);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
<DrawerBottom animation="none" height={30} isVisible={isVisibleEdit} setVisible={setVisibleEdit} title="Edit Lembaga Desa">
|
<DrawerBottom animation="none" keyboard height={30} isVisible={isVisibleEdit} setVisible={() => setVisibleEdit(false)} title="Edit Lembaga Desa">
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<View>
|
<View>
|
||||||
<InputForm type="default" placeholder="Nama Lembaga Desa" required label="Lembaga Desa" value={titleChoose} onChange={setTitleChoose} />
|
<InputForm type="default" placeholder="Nama Lembaga Desa" required label="Lembaga Desa" value={titleChoose} onChange={setTitleChoose} />
|
||||||
|
|||||||
@@ -7,19 +7,23 @@ import EventHome from "@/components/home/eventHome";
|
|||||||
import FiturHome from "@/components/home/fiturHome";
|
import FiturHome from "@/components/home/fiturHome";
|
||||||
import { HeaderRightHome } from "@/components/home/headerRightHome";
|
import { HeaderRightHome } from "@/components/home/headerRightHome";
|
||||||
import ProjectHome from "@/components/home/projectHome";
|
import ProjectHome from "@/components/home/projectHome";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetProfile } from "@/lib/api";
|
import { apiGetProfile } from "@/lib/api";
|
||||||
import { setEntities } from "@/lib/entitiesSlice";
|
import { setEntities } from "@/lib/entitiesSlice";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { Stack } from "expo-router";
|
import { Stack } from "expo-router";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { SafeAreaView, ScrollView, View } from "react-native";
|
import { Platform, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const entities = useSelector((state: any) => state.entities)
|
const entities = useSelector((state: any) => state.entities)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleUserLogin()
|
handleUserLogin()
|
||||||
@@ -35,15 +39,18 @@ export default function Home() {
|
|||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
title: 'Home',
|
title: 'Home',
|
||||||
headerLeft: () => <></>,
|
|
||||||
headerTitle: entities.village,
|
headerTitle: entities.village,
|
||||||
headerRight: () => <HeaderRightHome />,
|
header: () => (
|
||||||
headerTitleAlign: 'left',
|
<View style={[Styles.rowItemsCenter, Styles.ph20, Platform.OS === 'ios' ? Styles.pb07 : Styles.pb13, { backgroundColor: '#19345E', paddingTop: Platform.OS === 'ios' ? insets.top : 10 }]}>
|
||||||
|
<Text style={Styles.textHeaderHome}>{entities.village}</Text>
|
||||||
|
<HeaderRightHome />
|
||||||
|
</View>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<CaraouselHome />
|
<CaraouselHome />
|
||||||
<View style={[Styles.ph15]}>
|
<View style={[Styles.ph15, Styles.mb100]}>
|
||||||
<FiturHome />
|
<FiturHome />
|
||||||
<ProjectHome />
|
<ProjectHome />
|
||||||
<DivisionHome />
|
<DivisionHome />
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ import ImageUser from "@/components/imageNew";
|
|||||||
import ItemDetailMember from "@/components/itemDetailMember";
|
import ItemDetailMember from "@/components/itemDetailMember";
|
||||||
import HeaderRightMemberDetail from "@/components/member/headerMemberDetail";
|
import HeaderRightMemberDetail from "@/components/member/headerMemberDetail";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { valueRoleUser } from "@/constants/RoleUser";
|
import { valueRoleUser } from "@/constants/RoleUser";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetProfile } from "@/lib/api";
|
import { apiGetProfile } from "@/lib/api";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, Text, View } from "react-native";
|
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -33,10 +34,11 @@ export default function MemberDetail() {
|
|||||||
const [isEdit, setEdit] = useState(true)
|
const [isEdit, setEdit] = useState(true)
|
||||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad(loading: boolean) {
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
setLoading(loading)
|
||||||
const response = await apiGetProfile({ id: id })
|
const response = await apiGetProfile({ id: id })
|
||||||
setData(response.data)
|
setData(response.data)
|
||||||
setEdit(valueRoleUser.filter((v) => v.login == entityUser.role)[0]?.data.some((i: any) => i.id == response.data.idUserRole))
|
setEdit(valueRoleUser.filter((v) => v.login == entityUser.role)[0]?.data.some((i: any) => i.id == response.data.idUserRole))
|
||||||
@@ -49,9 +51,17 @@ export default function MemberDetail() {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleLoad()
|
handleLoad(true)
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
const handleRefresh = async () => {
|
||||||
|
setRefreshing(true)
|
||||||
|
handleLoad(false)
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
|
setRefreshing(false)
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
@@ -63,48 +73,54 @@ export default function MemberDetail() {
|
|||||||
headerShadowVisible: false
|
headerShadowVisible: false
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView
|
||||||
<View style={{ flexDirection: 'column' }}>
|
style={[Styles.h100]}
|
||||||
<View style={[Styles.wrapHeadViewMember]}>
|
refreshControl={
|
||||||
{
|
<RefreshControl
|
||||||
loading ?
|
refreshing={refreshing}
|
||||||
<>
|
onRefresh={handleRefresh}
|
||||||
<Skeleton width={100} height={100} borderRadius={100} />
|
/>
|
||||||
<Skeleton width={200} height={10} borderRadius={5} />
|
}
|
||||||
<Skeleton width={150} height={10} borderRadius={5} />
|
>
|
||||||
</>
|
<View style={[Styles.wrapHeadViewMember,]}>
|
||||||
:
|
{
|
||||||
<>
|
loading ?
|
||||||
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${data?.img}`} size="lg" />
|
<>
|
||||||
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10]}>{data?.name}</Text>
|
<Skeleton width={100} height={100} borderRadius={100} />
|
||||||
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{data?.role}</Text>
|
<Skeleton width={200} height={10} borderRadius={5} />
|
||||||
</>
|
<Skeleton width={150} height={10} borderRadius={5} />
|
||||||
|
</>
|
||||||
|
:
|
||||||
|
<>
|
||||||
|
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${data?.img}`} size="lg" />
|
||||||
|
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10]}>{data?.name}</Text>
|
||||||
|
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{data?.role}</Text>
|
||||||
|
</>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
</View>
|
||||||
|
<View style={[Styles.p15]}>
|
||||||
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
|
<Text style={[Styles.textDefaultSemiBold]}>Informasi</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.p15]}>
|
{
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
loading ?
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>Informasi</Text>
|
arrSkeleton.map((item, index) => {
|
||||||
</View>
|
return (
|
||||||
{
|
<Skeleton key={index} width={100} widthType="percent" height={25} borderRadius={5} />
|
||||||
loading ?
|
)
|
||||||
arrSkeleton.map((item, index) => {
|
})
|
||||||
return (
|
:
|
||||||
<Skeleton key={index} width={100} widthType="percent" height={25} borderRadius={5} />
|
<>
|
||||||
)
|
<ItemDetailMember category="nik" value={data?.nik} />
|
||||||
})
|
<ItemDetailMember category="group" value={data?.group} />
|
||||||
:
|
<ItemDetailMember category="position" value={data?.position} />
|
||||||
<>
|
<ItemDetailMember category="phone" value={`+62${data?.phone}`} />
|
||||||
<ItemDetailMember category="nik" value={data?.nik} />
|
<ItemDetailMember category="email" value={data?.email} />
|
||||||
<ItemDetailMember category="group" value={data?.group} />
|
<ItemDetailMember category="gender" value={data?.gender == "F" ? "Perempuan" : "Laki-Laki"} />
|
||||||
<ItemDetailMember category="position" value={data?.position} />
|
</>
|
||||||
<ItemDetailMember category="phone" value={`+62${data?.phone}`} />
|
}
|
||||||
<ItemDetailMember category="email" value={data?.email} />
|
|
||||||
<ItemDetailMember category="gender" value={data?.gender == "F" ? "Perempuan" : "Laki-Laki"} />
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalSelect from "@/components/modalSelect";
|
import ModalSelect from "@/components/modalSelect";
|
||||||
import SelectForm from "@/components/selectForm";
|
import SelectForm from "@/components/selectForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateUser } from "@/lib/api";
|
import { apiCreateUser } from "@/lib/api";
|
||||||
@@ -14,13 +15,14 @@ import { router, Stack } from "expo-router";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Image,
|
Image,
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
Pressable,
|
Pressable,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CreateMember() {
|
export default function CreateMember() {
|
||||||
@@ -34,6 +36,7 @@ export default function CreateMember() {
|
|||||||
const [chooseGender, setChooseGender] = useState({ val: "", label: "" });
|
const [chooseGender, setChooseGender] = useState({ val: "", label: "" });
|
||||||
const [selectedImage, setSelectedImage] = useState<string | undefined>(undefined);
|
const [selectedImage, setSelectedImage] = useState<string | undefined>(undefined);
|
||||||
const entityUser = useSelector((state: any) => state.user);
|
const entityUser = useSelector((state: any) => state.user);
|
||||||
|
const entities = useSelector((state: any) => state.entities)
|
||||||
const [isSelect, setSelect] = useState(false);
|
const [isSelect, setSelect] = useState(false);
|
||||||
const [disableBtn, setDisableBtn] = useState(true)
|
const [disableBtn, setDisableBtn] = useState(true)
|
||||||
const [valChoose, setValChoose] = useState("")
|
const [valChoose, setValChoose] = useState("")
|
||||||
@@ -140,6 +143,12 @@ export default function CreateMember() {
|
|||||||
checkForm()
|
checkForm()
|
||||||
}, [error, dataForm])
|
}, [error, dataForm])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(entityUser.role !="supadmin" && entityUser.role != "developer"){
|
||||||
|
validationForm("group", entities.idGroup, entities.group)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
@@ -160,13 +169,13 @@ export default function CreateMember() {
|
|||||||
fd.append("file", "undefined")
|
fd.append("file", "undefined")
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await apiCreateUser(fd)
|
const response = await apiCreateUser({data: fd})
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
dispatch(setUpdateMember(!update))
|
dispatch(setUpdateMember(!update))
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -177,7 +186,7 @@ export default function CreateMember() {
|
|||||||
const pickImageAsync = async () => {
|
const pickImageAsync = async () => {
|
||||||
let result = await ImagePicker.launchImageLibraryAsync({
|
let result = await ImagePicker.launchImageLibraryAsync({
|
||||||
mediaTypes: ["images"],
|
mediaTypes: ["images"],
|
||||||
allowsEditing: true,
|
allowsEditing: false,
|
||||||
quality: 1,
|
quality: 1,
|
||||||
aspect: [1, 1],
|
aspect: [1, 1],
|
||||||
});
|
});
|
||||||
@@ -213,132 +222,139 @@ export default function CreateMember() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
style={[Styles.h100]}
|
||||||
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
{selectedImage != undefined ? (
|
keyboardVerticalOffset={110}
|
||||||
<Pressable onPress={pickImageAsync}>
|
>
|
||||||
<Image src={selectedImage} style={[Styles.userProfileBig]} />
|
<ScrollView>
|
||||||
</Pressable>
|
<View style={[Styles.p15]}>
|
||||||
) : (
|
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
||||||
<Pressable
|
{selectedImage != undefined ? (
|
||||||
onPress={pickImageAsync}
|
<Pressable onPress={pickImageAsync}>
|
||||||
style={[Styles.iconContent, ColorsStatus.gray]}
|
<Image src={selectedImage} style={[Styles.userProfileBig]} />
|
||||||
>
|
</Pressable>
|
||||||
<MaterialCommunityIcons
|
) : (
|
||||||
name="account-tie"
|
<Pressable
|
||||||
size={100}
|
onPress={pickImageAsync}
|
||||||
color={"gray"}
|
style={[Styles.iconContent, ColorsStatus.gray]}
|
||||||
|
>
|
||||||
|
<MaterialCommunityIcons
|
||||||
|
name="account-tie"
|
||||||
|
size={100}
|
||||||
|
color={"gray"}
|
||||||
|
/>
|
||||||
|
</Pressable>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
{(entityUser.role == "supadmin" ||
|
||||||
|
entityUser.role == "developer") && (
|
||||||
|
<SelectForm
|
||||||
|
label="Lembaga Desa"
|
||||||
|
placeholder="Pilih Lembaga Desa"
|
||||||
|
value={chooseGroup.label}
|
||||||
|
required
|
||||||
|
onPress={() => {
|
||||||
|
setValChoose(chooseGroup.val);
|
||||||
|
setValSelect("group");
|
||||||
|
setSelect(true);
|
||||||
|
}}
|
||||||
|
error={error.group}
|
||||||
|
errorText="Lembaga Desa tidak boleh kosong"
|
||||||
/>
|
/>
|
||||||
</Pressable>
|
)}
|
||||||
)}
|
<SelectForm
|
||||||
|
label="Jabatan"
|
||||||
|
placeholder="Pilih Jabatan"
|
||||||
|
value={choosePosition.label}
|
||||||
|
required
|
||||||
|
onPress={() => {
|
||||||
|
setValChoose(choosePosition.val);
|
||||||
|
setValSelect("position");
|
||||||
|
setSelect(true);
|
||||||
|
}}
|
||||||
|
error={error.position}
|
||||||
|
errorText="Jabatan tidak boleh kosong"
|
||||||
|
/>
|
||||||
|
<SelectForm
|
||||||
|
label="User Role"
|
||||||
|
placeholder="Pilih Role"
|
||||||
|
value={chooseRole.label}
|
||||||
|
required
|
||||||
|
onPress={() => {
|
||||||
|
setValChoose(chooseRole.val);
|
||||||
|
setValSelect("role");
|
||||||
|
setSelect(true);
|
||||||
|
}}
|
||||||
|
error={error.role}
|
||||||
|
errorText="Role tidak boleh kosong"
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="NIK"
|
||||||
|
type="numeric"
|
||||||
|
placeholder="NIK"
|
||||||
|
required
|
||||||
|
error={error.nik}
|
||||||
|
errorText="NIK Harus 16 Karakter"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("nik", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Nama"
|
||||||
|
type="default"
|
||||||
|
placeholder="Nama"
|
||||||
|
required
|
||||||
|
error={error.name}
|
||||||
|
errorText="Nama tidak boleh kosong"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("name", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Email"
|
||||||
|
type="default"
|
||||||
|
placeholder="Email"
|
||||||
|
required
|
||||||
|
error={error.email}
|
||||||
|
errorText="Email tidak valid"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("email", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Nomor Telepon"
|
||||||
|
type="numeric"
|
||||||
|
placeholder="8XX-XXX-XXX"
|
||||||
|
required
|
||||||
|
itemLeft={<Text>+62</Text>}
|
||||||
|
error={error.phone}
|
||||||
|
errorText="Nomor Telepon tidak valid"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("phone", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<SelectForm
|
||||||
|
label="Jenis Kelamin"
|
||||||
|
placeholder="Pilih Jenis Kelamin"
|
||||||
|
value={chooseGender.label}
|
||||||
|
required
|
||||||
|
onPress={() => {
|
||||||
|
setValChoose(chooseGender.val);
|
||||||
|
setValSelect("gender");
|
||||||
|
setSelect(true);
|
||||||
|
}}
|
||||||
|
error={error.gender}
|
||||||
|
errorText="Jenis Kelamin tidak boleh kosong"
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
{(entityUser.role == "supadmin" ||
|
</ScrollView>
|
||||||
entityUser.role == "developer") && (
|
</KeyboardAvoidingView>
|
||||||
<SelectForm
|
|
||||||
label="Lembaga Desa"
|
|
||||||
placeholder="Pilih Lembaga Desa"
|
|
||||||
value={chooseGroup.label}
|
|
||||||
required
|
|
||||||
onPress={() => {
|
|
||||||
setValChoose(chooseGroup.val);
|
|
||||||
setValSelect("group");
|
|
||||||
setSelect(true);
|
|
||||||
}}
|
|
||||||
error={error.group}
|
|
||||||
errorText="Lembaga Desa tidak boleh kosong"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<SelectForm
|
|
||||||
label="Jabatan"
|
|
||||||
placeholder="Pilih Jabatan"
|
|
||||||
value={choosePosition.label}
|
|
||||||
required
|
|
||||||
onPress={() => {
|
|
||||||
setValChoose(choosePosition.val);
|
|
||||||
setValSelect("position");
|
|
||||||
setSelect(true);
|
|
||||||
}}
|
|
||||||
error={error.position}
|
|
||||||
errorText="Jabatan tidak boleh kosong"
|
|
||||||
/>
|
|
||||||
<SelectForm
|
|
||||||
label="User Role"
|
|
||||||
placeholder="Pilih Role"
|
|
||||||
value={chooseRole.label}
|
|
||||||
required
|
|
||||||
onPress={() => {
|
|
||||||
setValChoose(chooseRole.val);
|
|
||||||
setValSelect("role");
|
|
||||||
setSelect(true);
|
|
||||||
}}
|
|
||||||
error={error.role}
|
|
||||||
errorText="Role tidak boleh kosong"
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="NIK"
|
|
||||||
type="numeric"
|
|
||||||
placeholder="NIK"
|
|
||||||
required
|
|
||||||
error={error.nik}
|
|
||||||
errorText="NIK Harus 16 Karakter"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("nik", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Nama"
|
|
||||||
type="default"
|
|
||||||
placeholder="Nama"
|
|
||||||
required
|
|
||||||
error={error.name}
|
|
||||||
errorText="Nama tidak boleh kosong"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("name", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Email"
|
|
||||||
type="default"
|
|
||||||
placeholder="Email"
|
|
||||||
required
|
|
||||||
error={error.email}
|
|
||||||
errorText="Email tidak valid"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("email", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Nomor Telepon"
|
|
||||||
type="numeric"
|
|
||||||
placeholder="8XX-XXX-XXX"
|
|
||||||
required
|
|
||||||
itemLeft={<Text>+62</Text>}
|
|
||||||
error={error.phone}
|
|
||||||
errorText="Nomor Telepon tidak valid"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("phone", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SelectForm
|
|
||||||
label="Jenis Kelamin"
|
|
||||||
placeholder="Pilih Jenis Kelamin"
|
|
||||||
value={chooseGender.label}
|
|
||||||
required
|
|
||||||
onPress={() => {
|
|
||||||
setValChoose(chooseGender.val);
|
|
||||||
setValSelect("gender");
|
|
||||||
setSelect(true);
|
|
||||||
}}
|
|
||||||
error={error.gender}
|
|
||||||
errorText="Jenis Kelamin tidak boleh kosong"
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<ModalSelect
|
<ModalSelect
|
||||||
category={valSelect}
|
category={valSelect}
|
||||||
close={setSelect}
|
close={() => { setSelect(false) }}
|
||||||
onSelect={(value) => {
|
onSelect={(value) => {
|
||||||
validationForm(valSelect, value.val, value.label);
|
validationForm(valSelect, value.val, value.label);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalSelect from "@/components/modalSelect";
|
import ModalSelect from "@/components/modalSelect";
|
||||||
import SelectForm from "@/components/selectForm";
|
import SelectForm from "@/components/selectForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditUser, apiGetProfile } from "@/lib/api";
|
import { apiEditUser, apiGetProfile } from "@/lib/api";
|
||||||
import { setUpdateMember } from "@/lib/memberSlice";
|
import { setUpdateMember } from "@/lib/memberSlice";
|
||||||
@@ -12,13 +13,14 @@ import { router, Stack, useLocalSearchParams } from "expo-router";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
Image,
|
Image,
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
Pressable,
|
Pressable,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -193,15 +195,15 @@ export default function EditMember() {
|
|||||||
const response = await apiEditUser(fd, id)
|
const response = await apiEditUser(fd, id)
|
||||||
|
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
dispatch(setUpdateMember(!update))
|
dispatch(setUpdateMember(!update))
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Gagal mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +212,7 @@ export default function EditMember() {
|
|||||||
const pickImageAsync = async () => {
|
const pickImageAsync = async () => {
|
||||||
let result = await ImagePicker.launchImageLibraryAsync({
|
let result = await ImagePicker.launchImageLibraryAsync({
|
||||||
mediaTypes: ["images"],
|
mediaTypes: ["images"],
|
||||||
allowsEditing: true,
|
allowsEditing: false,
|
||||||
quality: 1,
|
quality: 1,
|
||||||
aspect: [1, 1],
|
aspect: [1, 1],
|
||||||
});
|
});
|
||||||
@@ -249,131 +251,138 @@ export default function EditMember() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<KeyboardAvoidingView
|
||||||
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
style={[Styles.h100]}
|
||||||
{
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
errorImg ?
|
keyboardVerticalOffset={110}
|
||||||
<Pressable onPress={pickImageAsync}>
|
>
|
||||||
{
|
<ScrollView>
|
||||||
<Image
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
source={errorImg ? require("../../../../assets/images/user.jpg") : { uri: `https://wibu-storage.wibudev.com/api/files/${data?.img}` }}
|
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
||||||
style={[Styles.userProfileBig]}
|
{
|
||||||
onError={() => { setErrorImg(true) }}
|
errorImg ?
|
||||||
/>
|
|
||||||
}
|
|
||||||
</Pressable>
|
|
||||||
:
|
|
||||||
selectedImage != undefined ? (
|
|
||||||
<Pressable onPress={pickImageAsync}>
|
<Pressable onPress={pickImageAsync}>
|
||||||
<Image
|
{
|
||||||
src={
|
<Image
|
||||||
typeof selectedImage === "string"
|
source={errorImg ? require("../../../../assets/images/user.jpg") : { uri: `https://wibu-storage.wibudev.com/api/files/${data?.img}` }}
|
||||||
? selectedImage
|
style={[Styles.userProfileBig]}
|
||||||
: selectedImage.uri
|
onError={() => { setErrorImg(true) }}
|
||||||
}
|
/>
|
||||||
style={[Styles.userProfileBig]}
|
}
|
||||||
onError={() => { setErrorImg(true) }}
|
|
||||||
/>
|
|
||||||
</Pressable>
|
</Pressable>
|
||||||
) : (
|
:
|
||||||
<Image
|
selectedImage != undefined ? (
|
||||||
source={require("../../../../assets/images/user.jpg")}
|
<Pressable onPress={pickImageAsync}>
|
||||||
style={[Styles.userProfileBig]}
|
<Image
|
||||||
/>
|
src={
|
||||||
)
|
typeof selectedImage === "string"
|
||||||
}
|
? selectedImage
|
||||||
|
: selectedImage.uri
|
||||||
|
}
|
||||||
|
style={[Styles.userProfileBig]}
|
||||||
|
onError={() => { setErrorImg(true) }}
|
||||||
|
/>
|
||||||
|
</Pressable>
|
||||||
|
) : (
|
||||||
|
<Image
|
||||||
|
source={require("../../../../assets/images/user.jpg")}
|
||||||
|
style={[Styles.userProfileBig]}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
<SelectForm
|
||||||
|
label="Jabatan"
|
||||||
|
placeholder="Pilih Jabatan"
|
||||||
|
value={choosePosition.label}
|
||||||
|
required
|
||||||
|
onPress={() => {
|
||||||
|
setValChoose(choosePosition.val);
|
||||||
|
setValSelect("position");
|
||||||
|
setSelect(true);
|
||||||
|
}}
|
||||||
|
error={error.position}
|
||||||
|
errorText="Jabatan tidak boleh kosong"
|
||||||
|
/>
|
||||||
|
<SelectForm
|
||||||
|
label="User Role"
|
||||||
|
placeholder="Pilih Role"
|
||||||
|
value={chooseRole.label}
|
||||||
|
required
|
||||||
|
onPress={() => {
|
||||||
|
setValChoose(chooseRole.val);
|
||||||
|
setValSelect("role");
|
||||||
|
setSelect(true);
|
||||||
|
}}
|
||||||
|
error={error.role}
|
||||||
|
errorText="Role tidak boleh kosong"
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="NIK"
|
||||||
|
type="numeric"
|
||||||
|
placeholder="NIK"
|
||||||
|
required
|
||||||
|
value={data?.nik}
|
||||||
|
error={error.nik}
|
||||||
|
errorText="NIK Harus 16 Karakter"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("nik", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Nama"
|
||||||
|
type="default"
|
||||||
|
placeholder="Nama"
|
||||||
|
required
|
||||||
|
value={data?.name}
|
||||||
|
error={error.name}
|
||||||
|
errorText="Nama tidak boleh kosong"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("name", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Email"
|
||||||
|
type="default"
|
||||||
|
placeholder="Email"
|
||||||
|
required
|
||||||
|
value={data?.email}
|
||||||
|
error={error.email}
|
||||||
|
errorText="Email tidak valid"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("email", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputForm
|
||||||
|
label="Nomor Telepon"
|
||||||
|
type="numeric"
|
||||||
|
placeholder="8XX-XXX-XXX"
|
||||||
|
required
|
||||||
|
itemLeft={<Text>+62</Text>}
|
||||||
|
value={data?.phone}
|
||||||
|
error={error.phone}
|
||||||
|
errorText="Nomor Telepon tidak valid"
|
||||||
|
onChange={val => {
|
||||||
|
validationForm("phone", val)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<SelectForm
|
||||||
|
label="Jenis Kelamin"
|
||||||
|
placeholder="Pilih Jenis Kelamin"
|
||||||
|
value={chooseGender.label}
|
||||||
|
required
|
||||||
|
onPress={() => {
|
||||||
|
setValChoose(chooseGender.val);
|
||||||
|
setValSelect("gender");
|
||||||
|
setSelect(true);
|
||||||
|
}}
|
||||||
|
error={error.gender}
|
||||||
|
errorText="Jenis Kelamin tidak boleh kosong"
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
<SelectForm
|
</ScrollView>
|
||||||
label="Jabatan"
|
</KeyboardAvoidingView>
|
||||||
placeholder="Pilih Jabatan"
|
|
||||||
value={choosePosition.label}
|
|
||||||
required
|
|
||||||
onPress={() => {
|
|
||||||
setValChoose(choosePosition.val);
|
|
||||||
setValSelect("position");
|
|
||||||
setSelect(true);
|
|
||||||
}}
|
|
||||||
error={error.position}
|
|
||||||
errorText="Jabatan tidak boleh kosong"
|
|
||||||
/>
|
|
||||||
<SelectForm
|
|
||||||
label="User Role"
|
|
||||||
placeholder="Pilih Role"
|
|
||||||
value={chooseRole.label}
|
|
||||||
required
|
|
||||||
onPress={() => {
|
|
||||||
setValChoose(chooseRole.val);
|
|
||||||
setValSelect("role");
|
|
||||||
setSelect(true);
|
|
||||||
}}
|
|
||||||
error={error.role}
|
|
||||||
errorText="Role tidak boleh kosong"
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="NIK"
|
|
||||||
type="numeric"
|
|
||||||
placeholder="NIK"
|
|
||||||
required
|
|
||||||
value={data?.nik}
|
|
||||||
error={error.nik}
|
|
||||||
errorText="NIK Harus 16 Karakter"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("nik", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Nama"
|
|
||||||
type="default"
|
|
||||||
placeholder="Nama"
|
|
||||||
required
|
|
||||||
value={data?.name}
|
|
||||||
error={error.name}
|
|
||||||
errorText="Nama tidak boleh kosong"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("name", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Email"
|
|
||||||
type="default"
|
|
||||||
placeholder="Email"
|
|
||||||
required
|
|
||||||
value={data?.email}
|
|
||||||
error={error.email}
|
|
||||||
errorText="Email tidak valid"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("email", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<InputForm
|
|
||||||
label="Nomor Telepon"
|
|
||||||
type="numeric"
|
|
||||||
placeholder="8XX-XXX-XXX"
|
|
||||||
required
|
|
||||||
itemLeft={<Text>+62</Text>}
|
|
||||||
value={data?.phone}
|
|
||||||
error={error.phone}
|
|
||||||
errorText="Nomor Telepon tidak valid"
|
|
||||||
onChange={val => {
|
|
||||||
validationForm("phone", val)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<SelectForm
|
|
||||||
label="Jenis Kelamin"
|
|
||||||
placeholder="Pilih Jenis Kelamin"
|
|
||||||
value={chooseGender.label}
|
|
||||||
required
|
|
||||||
onPress={() => {
|
|
||||||
setValChoose(chooseGender.val);
|
|
||||||
setValSelect("gender");
|
|
||||||
setSelect(true);
|
|
||||||
}}
|
|
||||||
error={error.gender}
|
|
||||||
errorText="Jenis Kelamin tidak boleh kosong"
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<ModalSelect
|
<ModalSelect
|
||||||
category={valSelect}
|
category={valSelect}
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ import ButtonTab from "@/components/buttonTab";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetUser } from "@/lib/api";
|
import { apiGetUser } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign, Feather } from "@expo/vector-icons";
|
import { AntDesign, Feather } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { RefreshControl, Text, View, VirtualizedList } from "react-native";
|
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetNotification, apiReadOneNotification } from "@/lib/api";
|
import { apiGetNotification, apiReadOneNotification } from "@/lib/api";
|
||||||
@@ -8,7 +9,7 @@ import { pushToPage } from "@/lib/pushToPage";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { Feather } from "@expo/vector-icons";
|
import { Feather } from "@expo/vector-icons";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, Text, View, VirtualizedList } from "react-native";
|
import { SafeAreaView, View, VirtualizedList } from "react-native";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { InputForm } from "@/components/inputForm";
|
|||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiDeletePosition, apiEditPosition, apiGetPosition } from "@/lib/api";
|
import { apiDeletePosition, apiEditPosition, apiGetPosition } from "@/lib/api";
|
||||||
@@ -15,7 +16,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { RefreshControl, SafeAreaView, ScrollView, Text, ToastAndroid, 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";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -85,7 +87,7 @@ export default function Index() {
|
|||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +102,7 @@ export default function Index() {
|
|||||||
} finally {
|
} finally {
|
||||||
setVisibleEdit(false)
|
setVisibleEdit(false)
|
||||||
setModal(false)
|
setModal(false)
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -129,36 +131,38 @@ export default function Index() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<ScrollView refreshControl={
|
<View style={[Styles.p15]}>
|
||||||
<RefreshControl
|
<View style={[Styles.wrapBtnTab]}>
|
||||||
refreshing={refreshing}
|
<ButtonTab
|
||||||
onRefresh={handleRefresh}
|
active={status == "false" ? "false" : "true"}
|
||||||
/>
|
value="true"
|
||||||
}>
|
onPress={() => { setStatus("true") }}
|
||||||
<View style={[Styles.p15]}>
|
label="Aktif"
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
icon={<Feather name="check-circle" color={status == "true" ? 'white' : 'black'} size={20} />}
|
||||||
<ButtonTab
|
n={2} />
|
||||||
active={status == "false" ? "false" : "true"}
|
<ButtonTab
|
||||||
value="true"
|
active={status == "false" ? "false" : "true"}
|
||||||
onPress={() => { setStatus("true") }}
|
value="false"
|
||||||
label="Aktif"
|
onPress={() => { setStatus("false") }}
|
||||||
icon={<Feather name="check-circle" color={status == "true" ? 'white' : 'black'} size={20} />}
|
label="Tidak Aktif"
|
||||||
n={2} />
|
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : 'black'} size={20} />}
|
||||||
<ButtonTab
|
n={2} />
|
||||||
active={status == "false" ? "false" : "true"}
|
</View>
|
||||||
value="false"
|
<InputSearch onChange={setSearch} />
|
||||||
onPress={() => { setStatus("false") }}
|
{
|
||||||
label="Tidak Aktif"
|
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||||
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : 'black'} size={20} />}
|
<View style={[Styles.mv05]}>
|
||||||
n={2} />
|
<Text>Filter : {nameGroup}</Text>
|
||||||
</View>
|
</View>
|
||||||
<InputSearch onChange={setSearch} />
|
}
|
||||||
{
|
<ScrollView
|
||||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
style={[Styles.h100]}
|
||||||
<View style={[Styles.mv05]}>
|
refreshControl={
|
||||||
<Text>Filter : {nameGroup}</Text>
|
<RefreshControl
|
||||||
</View>
|
refreshing={refreshing}
|
||||||
}
|
onRefresh={handleRefresh}
|
||||||
|
/>
|
||||||
|
}>
|
||||||
<View>
|
<View>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
@@ -189,10 +193,10 @@ export default function Index() {
|
|||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</ScrollView>
|
||||||
</ScrollView>
|
</View>
|
||||||
|
|
||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title={chooseData.name}>
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title={chooseData.name}>
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="toggle-switch-off-outline" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="toggle-switch-off-outline" color="black" size={25} />}
|
||||||
@@ -211,14 +215,16 @@ export default function Index() {
|
|||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
setVisibleEdit(true)
|
setTimeout(() => {
|
||||||
|
setVisibleEdit(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
|
||||||
<DrawerBottom animation="none" height={30} backdropPressable={false} isVisible={isVisibleEdit} setVisible={setVisibleEdit} 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 style={{ justifyContent: 'space-between', flex: 1 }}>
|
||||||
<View>
|
<View>
|
||||||
<InputForm
|
<InputForm
|
||||||
|
|||||||
@@ -2,12 +2,13 @@ import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import { ButtonHeader } from "@/components/buttonHeader";
|
import { ButtonHeader } from "@/components/buttonHeader";
|
||||||
import ItemDetailMember from "@/components/itemDetailMember";
|
import ItemDetailMember from "@/components/itemDetailMember";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Image, SafeAreaView, ScrollView, Text, View } from "react-native";
|
import { Image, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
|||||||
import * as DocumentPicker from "expo-document-picker"
|
import * as DocumentPicker from "expo-document-picker"
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router"
|
import { router, Stack, useLocalSearchParams } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ActivityIndicator, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native"
|
import { ActivityIndicator, SafeAreaView, ScrollView, Text, View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
|
|
||||||
export default function ProjectAddFile() {
|
export default function ProjectAddFile() {
|
||||||
@@ -29,16 +30,19 @@ export default function ProjectAddFile() {
|
|||||||
const pickDocumentAsync = async () => {
|
const pickDocumentAsync = async () => {
|
||||||
let result = await DocumentPicker.getDocumentAsync({
|
let result = await DocumentPicker.getDocumentAsync({
|
||||||
type: ["*/*"],
|
type: ["*/*"],
|
||||||
multiple: false
|
multiple: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
if (result.assets?.[0].uri) {
|
for (let i = 0; i < result.assets?.length; i++) {
|
||||||
const check = await handleCheckFile(result.assets?.[0])
|
if (result.assets?.[i].uri) {
|
||||||
if (check) {
|
const check = await handleCheckFile(result.assets?.[i])
|
||||||
setFileForm([...fileForm, result.assets?.[0]])
|
if (check) {
|
||||||
setListFile([...listFile, result.assets?.[0].name])
|
setFileForm((prev) => [...prev, result.assets?.[i]])
|
||||||
} else {
|
setListFile((prev) => [...prev, result.assets?.[i].name])
|
||||||
ToastAndroid.show('File sudah ada', ToastAndroid.SHORT)
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: 'File yg telah terupload tidak bisa diupload ulang', })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,15 +107,15 @@ export default function ProjectAddFile() {
|
|||||||
|
|
||||||
const response = await apiAddFileProject({ data: fd, id: id })
|
const response = await apiAddFileProject({ data: fd, id: id })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menambahkan file', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan file', })
|
||||||
dispatch(setUpdateProject({ ...update, file: !update.file }))
|
dispatch(setUpdateProject({ ...update, file: !update.file }))
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
|||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import ImageWithLabel from "@/components/imageWithLabel";
|
import ImageWithLabel from "@/components/imageWithLabel";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiAddMemberProject, apiGetProjectOne, apiGetUser } from "@/lib/api";
|
import { apiAddMemberProject, apiGetProjectOne, apiGetUser } from "@/lib/api";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
@@ -10,7 +11,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, SafeAreaView, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -74,7 +76,7 @@ export default function AddMemberProject() {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberProject({ id: id, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberProject({ id: id, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menambahkan anggota', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan anggota', })
|
||||||
dispatch(setUpdateProject({ ...update, member: !update.member }))
|
dispatch(setUpdateProject({ ...update, member: !update.member }))
|
||||||
router.back()
|
router.back()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateProjectTask } from "@/lib/api";
|
import { apiCreateProjectTask } from "@/lib/api";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
@@ -9,12 +10,13 @@ import dayjs from "dayjs";
|
|||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import DateTimePicker, {
|
import DateTimePicker, {
|
||||||
DateType
|
DateType
|
||||||
} from "react-native-ui-datepicker";
|
} from "react-native-ui-datepicker";
|
||||||
@@ -71,7 +73,7 @@ export default function ProjectAddTask() {
|
|||||||
const response = await apiCreateProjectTask({ data: { name: title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id });
|
const response = await apiCreateProjectTask({ data: { name: title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
||||||
ToastAndroid.show("Berhasil menambah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menambah data', })
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -101,59 +103,64 @@ export default function ProjectAddTask() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
keyboardVerticalOffset={110}
|
||||||
<DateTimePicker
|
>
|
||||||
mode="range"
|
<ScrollView>
|
||||||
startDate={range.startDate}
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
endDate={range.endDate}
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
onChange={(param) => setRange(param)}
|
<DateTimePicker
|
||||||
styles={{
|
mode="range"
|
||||||
selected: Styles.selectedDate,
|
startDate={range.startDate}
|
||||||
selected_label: Styles.cWhite,
|
endDate={range.endDate}
|
||||||
range_fill: Styles.selectRangeDate,
|
onChange={(param) => setRange(param)}
|
||||||
|
styles={{
|
||||||
|
selected: Styles.selectedDate,
|
||||||
|
selected_label: Styles.cWhite,
|
||||||
|
range_fill: Styles.selectRangeDate,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={[Styles.mv10]}>
|
||||||
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
<InputForm
|
||||||
|
label="Judul Tugas"
|
||||||
|
type="default"
|
||||||
|
placeholder="Judul Tugas"
|
||||||
|
required
|
||||||
|
bg="white"
|
||||||
|
value={title}
|
||||||
|
error={error.title}
|
||||||
|
errorText="Judul tidak boleh kosong"
|
||||||
|
onChange={(e) => {
|
||||||
|
onValidation("title", e)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv10]}>
|
</ScrollView>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
</KeyboardAvoidingView>
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
{
|
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
<InputForm
|
|
||||||
label="Judul Tugas"
|
|
||||||
type="default"
|
|
||||||
placeholder="Judul Tugas"
|
|
||||||
required
|
|
||||||
bg="white"
|
|
||||||
value={title}
|
|
||||||
error={error.title}
|
|
||||||
errorText="Judul tidak boleh kosong"
|
|
||||||
onChange={(e) => {
|
|
||||||
onValidation("title", e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateProject } from "@/lib/projectUpdate";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function ProjectCancel() {
|
export default function ProjectCancel() {
|
||||||
@@ -24,7 +25,7 @@ export default function ProjectCancel() {
|
|||||||
setReason(val)
|
setReason(val)
|
||||||
if (val == "" || val == "null") {
|
if (val == "" || val == "null") {
|
||||||
setError(true)
|
setError(true)
|
||||||
}else{
|
} else {
|
||||||
setError(false)
|
setError(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,7 +51,7 @@ export default function ProjectCancel() {
|
|||||||
}, id);
|
}, id);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
||||||
ToastAndroid.show("Berhasil membatalkan kegiatan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil membatalkan kegiatan', })
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { setUpdateProject } from "@/lib/projectUpdate";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, ToastAndroid, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function EditProject() {
|
export default function EditProject() {
|
||||||
@@ -65,7 +66,7 @@ export default function EditProject() {
|
|||||||
}, id);
|
}, id);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { apiGetProjectOne } from "@/lib/api";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
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";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ export default function DetailProject() {
|
|||||||
const update = useSelector((state: any) => state.projectUpdate)
|
const update = useSelector((state: any) => state.projectUpdate)
|
||||||
const [isMember, setIsMember] = useState(false)
|
const [isMember, setIsMember] = useState(false)
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
async function handleLoad(cat: 'data' | 'progress') {
|
async function handleLoad(cat: 'data' | 'progress') {
|
||||||
try {
|
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 (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<Stack.Screen
|
<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} />,
|
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]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
{
|
{
|
||||||
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
|
||||||
}
|
}
|
||||||
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
|
||||||
<SectionTanggalTugasProject status={data?.status} member={isMember} />
|
<SectionTanggalTugasProject status={data?.status} member={isMember} refreshing={refreshing}/>
|
||||||
<SectionFile status={data?.status} member={isMember} />
|
<SectionFile status={data?.status} member={isMember} refreshing={refreshing} />
|
||||||
<SectionMember status={data?.status} />
|
<SectionMember status={data?.status} refreshing={refreshing} />
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import MenuItemRow from "@/components/menuItemRow";
|
|||||||
import ModalSelect from "@/components/modalSelect";
|
import ModalSelect from "@/components/modalSelect";
|
||||||
import SectionListAddTask from "@/components/project/sectionListAddTask";
|
import SectionListAddTask from "@/components/project/sectionListAddTask";
|
||||||
import SelectForm from "@/components/selectForm";
|
import SelectForm from "@/components/selectForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiCreateProject } from "@/lib/api";
|
import { apiCreateProject } from "@/lib/api";
|
||||||
import { setMemberChoose } from "@/lib/memberChoose";
|
import { setMemberChoose } from "@/lib/memberChoose";
|
||||||
@@ -22,10 +23,9 @@ import { useEffect, useState } from "react";
|
|||||||
import {
|
import {
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
View
|
||||||
ToastAndroid,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CreateProject() {
|
export default function CreateProject() {
|
||||||
@@ -120,10 +120,10 @@ export default function CreateProject() {
|
|||||||
const response = await apiCreateProject(fd)
|
const response = await apiCreateProject(fd)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
||||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
handleBack()
|
handleBack()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -146,11 +146,13 @@ export default function CreateProject() {
|
|||||||
const pickDocumentAsync = async () => {
|
const pickDocumentAsync = async () => {
|
||||||
let result = await DocumentPicker.getDocumentAsync({
|
let result = await DocumentPicker.getDocumentAsync({
|
||||||
type: ["*/*"],
|
type: ["*/*"],
|
||||||
multiple: false
|
multiple: true
|
||||||
});
|
});
|
||||||
if (!result.canceled) {
|
if (!result.canceled) {
|
||||||
if (result.assets[0].uri) {
|
for (let i = 0; i < result.assets?.length; i++) {
|
||||||
setFileForm([...fileForm, result.assets[0]])
|
if (result.assets[i].uri) {
|
||||||
|
setFileForm((prev) => [...prev, result.assets[i]])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -235,10 +237,7 @@ export default function CreateProject() {
|
|||||||
setSelect(true);
|
setSelect(true);
|
||||||
setValSelect("member");
|
setValSelect("member");
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(
|
Toast.show({ type: 'small', text1: "Pilih Lembaga Desa terlebih dahulu", })
|
||||||
"Pilih Lembaga Desa terlebih dahulu",
|
|
||||||
ToastAndroid.SHORT
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
validationForm('group', userLogin.idGroup, userLogin.group);
|
validationForm('group', userLogin.idGroup, userLogin.group);
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { setTaskCreate } from "@/lib/taskCreate";
|
import { setTaskCreate } from "@/lib/taskCreate";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
KeyboardAvoidingView,
|
||||||
|
Platform,
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
Text,
|
|
||||||
View
|
View
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import DateTimePicker, {
|
import DateTimePicker, {
|
||||||
@@ -97,59 +99,64 @@ export default function CreateProjectAddTask() {
|
|||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
keyboardVerticalOffset={110}
|
||||||
<DateTimePicker
|
>
|
||||||
mode="range"
|
<ScrollView>
|
||||||
startDate={range.startDate}
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
endDate={range.endDate}
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
onChange={(param) => setRange(param)}
|
<DateTimePicker
|
||||||
styles={{
|
mode="range"
|
||||||
selected: Styles.selectedDate,
|
startDate={range.startDate}
|
||||||
selected_label: Styles.cWhite,
|
endDate={range.endDate}
|
||||||
range_fill: Styles.selectRangeDate,
|
onChange={(param) => setRange(param)}
|
||||||
|
styles={{
|
||||||
|
selected: Styles.selectedDate,
|
||||||
|
selected_label: Styles.cWhite,
|
||||||
|
range_fill: Styles.selectRangeDate,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={[Styles.mv10]}>
|
||||||
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={[{ width: "48%" }]}>
|
||||||
|
<Text style={[Styles.mb05]}>
|
||||||
|
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
||||||
|
</Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
<InputForm
|
||||||
|
label="Judul Tugas"
|
||||||
|
type="default"
|
||||||
|
placeholder="Judul Tugas"
|
||||||
|
required
|
||||||
|
bg="white"
|
||||||
|
value={title}
|
||||||
|
error={error.title}
|
||||||
|
errorText="Judul tidak boleh kosong"
|
||||||
|
onChange={(e) => {
|
||||||
|
onValidation("title", e)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv10]}>
|
</ScrollView>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
</KeyboardAvoidingView>
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={[{ width: "48%" }]}>
|
|
||||||
<Text style={[Styles.mb05]}>
|
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
|
||||||
</Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
{
|
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
|
||||||
}
|
|
||||||
</View>
|
|
||||||
<InputForm
|
|
||||||
label="Judul Tugas"
|
|
||||||
type="default"
|
|
||||||
placeholder="Judul Tugas"
|
|
||||||
required
|
|
||||||
bg="white"
|
|
||||||
value={title}
|
|
||||||
error={error.title}
|
|
||||||
errorText="Judul tidak boleh kosong"
|
|
||||||
onChange={(e) => {
|
|
||||||
onValidation("title", e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import PaperGridContent from "@/components/paperGridContent";
|
|||||||
import ProgressBar from "@/components/progressBar";
|
import ProgressBar from "@/components/progressBar";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetProject } from "@/lib/api";
|
import { apiGetProject } from "@/lib/api";
|
||||||
@@ -17,7 +18,7 @@ import {
|
|||||||
} from "@expo/vector-icons";
|
} from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, RefreshControl, ScrollView, Text, View, VirtualizedList } from "react-native";
|
import { Pressable, RefreshControl, ScrollView, View, VirtualizedList } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -219,7 +220,7 @@ export default function ListProject() {
|
|||||||
data.length > 0
|
data.length > 0
|
||||||
?
|
?
|
||||||
isList ? (
|
isList ? (
|
||||||
<View>
|
<View style={[Styles.h100]}>
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={data}
|
data={data}
|
||||||
getItemCount={() => data.length}
|
getItemCount={() => data.length}
|
||||||
@@ -279,7 +280,7 @@ export default function ListProject() {
|
|||||||
} */}
|
} */}
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
<View>
|
<View style={[Styles.h100]}>
|
||||||
<VirtualizedList
|
<VirtualizedList
|
||||||
data={data}
|
data={data}
|
||||||
getItemCount={() => data.length}
|
getItemCount={() => data.length}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditProjectTask, apiGetProjectTask } from "@/lib/api";
|
import { apiEditProjectTask, apiGetProjectTask } from "@/lib/api";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
@@ -8,7 +9,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, Text, ToastAndroid, 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 DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ export default function UpdateProjectTask() {
|
|||||||
const response = await apiEditProjectTask({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
const response = await apiEditProjectTask({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -108,67 +110,72 @@ export default function UpdateProjectTask() {
|
|||||||
headerRight: () => <ButtonSaveHeader
|
headerRight: () => <ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => {handleEdit()}}
|
onPress={() => { handleEdit() }}
|
||||||
/>
|
/>
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<KeyboardAvoidingView
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
keyboardVerticalOffset={110}
|
||||||
{
|
>
|
||||||
!loading
|
<ScrollView>
|
||||||
&&
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<DateTimePicker
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
mode="range"
|
{
|
||||||
startDate={range.startDate}
|
!loading
|
||||||
endDate={range.endDate}
|
&&
|
||||||
onChange={(param) => setRange(param)}
|
<DateTimePicker
|
||||||
// styles={defaultStyles}
|
mode="range"
|
||||||
month={month}
|
startDate={range.startDate}
|
||||||
year={year}
|
endDate={range.endDate}
|
||||||
styles={{
|
onChange={(param) => setRange(param)}
|
||||||
selected: Styles.selectedDate,
|
// styles={defaultStyles}
|
||||||
selected_label: Styles.cWhite,
|
month={month}
|
||||||
range_fill: Styles.selectRangeDate,
|
year={year}
|
||||||
}}
|
styles={{
|
||||||
/>
|
selected: Styles.selectedDate,
|
||||||
}
|
selected_label: Styles.cWhite,
|
||||||
|
range_fill: Styles.selectRangeDate,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
</View>
|
|
||||||
<View style={[Styles.mv10]}>
|
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
|
||||||
<View style={[{ width: '48%' }]}>
|
|
||||||
<Text style={[Styles.mb05]}>Tanggal Mulai <Text style={Styles.cError}>*</Text></Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: 'center' }}>{from}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
<View style={[{ width: '48%' }]}>
|
|
||||||
<Text style={[Styles.mb05]}>Tanggal Berakhir <Text style={Styles.cError}>*</Text></Text>
|
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
|
||||||
<Text style={{ textAlign: 'center' }}>{to}</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
{
|
<View style={[Styles.mv10]}>
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
}
|
<View style={[{ width: '48%' }]}>
|
||||||
|
<Text style={[Styles.mb05]}>Tanggal Mulai <Text style={Styles.cError}>*</Text></Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: 'center' }}>{from}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
<View style={[{ width: '48%' }]}>
|
||||||
|
<Text style={[Styles.mb05]}>Tanggal Berakhir <Text style={Styles.cError}>*</Text></Text>
|
||||||
|
<View style={[Styles.wrapPaper, Styles.p10]}>
|
||||||
|
<Text style={{ textAlign: 'center' }}>{to}</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
<InputForm
|
||||||
|
label="Judul Tugas"
|
||||||
|
type="default"
|
||||||
|
placeholder="Judul Tugas"
|
||||||
|
required
|
||||||
|
bg="white"
|
||||||
|
value={title}
|
||||||
|
error={error.title}
|
||||||
|
errorText="Judul tidak boleh kosong"
|
||||||
|
onChange={(e) => {
|
||||||
|
onValidation("title", e)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
</ScrollView>
|
||||||
label="Judul Tugas"
|
</KeyboardAvoidingView>
|
||||||
type="default"
|
|
||||||
placeholder="Judul Tugas"
|
|
||||||
required
|
|
||||||
bg="white"
|
|
||||||
value={title}
|
|
||||||
error={error.title}
|
|
||||||
errorText="Judul tidak boleh kosong"
|
|
||||||
onChange={(e) => {
|
|
||||||
onValidation("title", e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</ScrollView>
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
|
import Text from '@/components/Text';
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetSearch } from "@/lib/api";
|
import { apiGetSearch } from "@/lib/api";
|
||||||
@@ -8,8 +9,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { AntDesign, MaterialIcons } from "@expo/vector-icons";
|
import { AntDesign, MaterialIcons } from "@expo/vector-icons";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { FlatList, Image, SafeAreaView, ToastAndroid, View } from "react-native";
|
import { FlatList, Image, SafeAreaView, View } from "react-native";
|
||||||
import Text from '@/components/Text';
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
type PropsUser = {
|
type PropsUser = {
|
||||||
id: string
|
id: string
|
||||||
@@ -49,7 +50,7 @@ export default function Search() {
|
|||||||
setDataDivisi(hasil.data.division)
|
setDataDivisi(hasil.data.division)
|
||||||
setDataProject(hasil.data.project)
|
setDataProject(hasil.data.project)
|
||||||
} else {
|
} else {
|
||||||
return ToastAndroid.show(hasil.message, ToastAndroid.SHORT)
|
return Toast.show({ type: 'small', text1: hasil.message, })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setDataUser([])
|
setDataUser([])
|
||||||
@@ -58,7 +59,7 @@ export default function Search() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
return ToastAndroid.show('Gagal melakukan pencarian', ToastAndroid.SHORT)
|
return Toast.show({ type: 'small', text1: 'Gagal melakukan pencarian', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import AlertKonfirmasi from "../alertKonfirmasi"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -29,7 +30,7 @@ export default function HeaderRightAnnouncementDetail({ id }: Props) {
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateAnnouncement(!update))
|
dispatch(setUpdateAnnouncement(!update))
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
ToastAndroid.show('Berhasil menghapus data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||||
router.back()
|
router.back()
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default function HeaderRightBannerList() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
<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}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default function BorderBottomItem({ title, subtitle, icon, desc, onPress,
|
|||||||
{icon}
|
{icon}
|
||||||
<View style={[Styles.rowSpaceBetween, width ? { width: lebar } : { width: '88%' }]}>
|
<View style={[Styles.rowSpaceBetween, width ? { width: lebar } : { width: '88%' }]}>
|
||||||
<View style={[Styles.ml10, rightTopInfo ? { width: lebar } : { width: '90%' },]}>
|
<View style={[Styles.ml10, rightTopInfo ? { width: lebar } : { width: '90%' },]}>
|
||||||
<Text style={[titleWeight == 'normal' ? Styles.textDefault : Styles.textDefaultSemiBold]} numberOfLines={1} ellipsizeMode='tail'>{title}</Text>
|
<Text style={[titleWeight == 'normal' ? Styles.textDefault : Styles.textDefaultSemiBold, { color: textColorFix }]} numberOfLines={1} ellipsizeMode='tail'>{title}</Text>
|
||||||
{
|
{
|
||||||
subtitle &&
|
subtitle &&
|
||||||
typeof subtitle == "string"
|
typeof subtitle == "string"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function ButtonTab({ active, value, onPress, label, n, icon }: Pr
|
|||||||
return (
|
return (
|
||||||
<TouchableOpacity style={[Styles.btnTab, (active == value) && ColorsStatus.orange, { width: n == 2 ? '50%' : 'auto' }]} onPress={() => { onPress() }}>
|
<TouchableOpacity style={[Styles.btnTab, (active == value) && ColorsStatus.orange, { width: n == 2 ? '50%' : 'auto' }]} onPress={() => { onPress() }}>
|
||||||
{icon}
|
{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>
|
</TouchableOpacity>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
import { Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import AlertKonfirmasi from "../alertKonfirmasi"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -29,14 +30,14 @@ export default function HeaderRightCalendarDetail({ id, idReminder }: Props) {
|
|||||||
const response = await apiDeleteCalendar({ user: hasil }, String(id));
|
const response = await apiDeleteCalendar({ user: hasil }, String(id));
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateCalendar({ ...update, data: !update.data }));
|
dispatch(setUpdateCalendar({ ...update, data: !update.data }));
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { Text, View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
text: string;
|
text: string;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { Text, View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
dateStart: Date
|
dateStart: Date
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
import { MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import AlertKonfirmasi from "../alertKonfirmasi"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -29,15 +30,15 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiOpenCloseDiscussion({ status: Number(status), user: hasil }, String(id))
|
const response = await apiOpenCloseDiscussion({ status: Number(status), user: hasil }, String(id))
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil mengubah data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
dispatch(setUpdateDiscussion({ ...update, data: !update.data }))
|
dispatch(setUpdateDiscussion({ ...update, data: !update.data }))
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
@@ -48,15 +49,15 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiArchiveDiscussion({ user: hasil, active: !isActive }, String(id))
|
const response = await apiArchiveDiscussion({ user: hasil, active: !isActive }, String(id))
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil mengubah data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
dispatch(setUpdateDiscussion({ ...update, data: !update.data }))
|
dispatch(setUpdateDiscussion({ ...update, data: !update.data }))
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
import { MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import AlertKonfirmasi from "../alertKonfirmasi"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -30,7 +31,7 @@ export default function HeaderRightDiscussionGeneralDetail({ id, active, status
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiUpdateStatusDiscussionGeneral({ id: id, data: { status: status, user: hasil } })
|
const response = await apiUpdateStatusDiscussionGeneral({ id: id, data: { status: status, user: hasil } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||||
}
|
}
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
@@ -43,7 +44,7 @@ export default function HeaderRightDiscussionGeneralDetail({ id, active, status
|
|||||||
try {
|
try {
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiDeleteDiscussionGeneral({ active: !active, user: hasil }, id)
|
const response = await apiDeleteDiscussionGeneral({ active: !active, user: hasil }, id)
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ export default function HeaderDiscussionGeneral() {
|
|||||||
title="Filter"
|
title="Filter"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
setFilter(true)
|
setTimeout(() => {
|
||||||
|
setFilter(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import AlertKonfirmasi from "../alertKonfirmasi"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -29,13 +30,13 @@ export default function HeaderRightDivisionInfo({ id, active }: Props) {
|
|||||||
const response = await apiUpdateStatusDivision({ data: { user: hasil, isActive: Boolean(active) }, id: String(id) })
|
const response = await apiUpdateStatusDivision({ data: { user: hasil, isActive: Boolean(active) }, id: String(id) })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateDivision(!update))
|
dispatch(setUpdateDivision(!update))
|
||||||
ToastAndroid.show('Berhasil mengubah status', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah status', })
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ export default function HeaderRightDivisionList() {
|
|||||||
title="Filter"
|
title="Filter"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
setFilter(true)
|
setTimeout(() => {
|
||||||
|
setFilter(true)
|
||||||
|
}, 600);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { Dimensions, Text, View } from "react-native";
|
import { Dimensions, View } from "react-native";
|
||||||
import { BarChart } from "react-native-gifted-charts";
|
import { BarChart } from "react-native-gifted-charts";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
export default function ReportChartDocument({ data }: { data: { label: string; value: number; }[] }) {
|
export default function ReportChartDocument({ data }: { data: { label: string; value: number; }[] }) {
|
||||||
const maxValue = Math.max(...data.map(i => i.value))
|
const maxValue = Math.max(...data.map(i => i.value))
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { Dimensions, Text, View } from "react-native";
|
import { Dimensions, View } from "react-native";
|
||||||
import { BarChart } from "react-native-gifted-charts";
|
import { BarChart } from "react-native-gifted-charts";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
export default function ReportChartEvent({ data }: { data: { label: string; value: number; }[] }) {
|
export default function ReportChartEvent({ data }: { data: { label: string; value: number; }[] }) {
|
||||||
const width = Dimensions.get("window").width;
|
const width = Dimensions.get("window").width;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { Text, View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { PieChart } from "react-native-gifted-charts";
|
import { PieChart } from "react-native-gifted-charts";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
export default function ReportChartProgress({ data }: { data: { color: string; text: string; value: number; }[] }) {
|
export default function ReportChartProgress({ data }: { data: { color: string; text: string; value: number; }[] }) {
|
||||||
const pieData = [
|
const pieData = [
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import { MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
|||||||
import * as DocumentPicker from "expo-document-picker";
|
import * as DocumentPicker from "expo-document-picker";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { ToastAndroid, View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader";
|
import ButtonMenuHeader from "../buttonMenuHeader";
|
||||||
import DrawerBottom from "../drawerBottom";
|
import DrawerBottom from "../drawerBottom";
|
||||||
@@ -22,20 +23,21 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
|||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.dokumenUpdate)
|
const update = useSelector((state: any) => state.dokumenUpdate)
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleCreateFolder() {
|
async function handleCreateFolder() {
|
||||||
try {
|
try {
|
||||||
const hasil = await decryptToken(String(token?.current))
|
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) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil membuat folder baru", ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil membuat folder baru', })
|
||||||
dispatch(setUpdateDokumen(!update))
|
dispatch(setUpdateDokumen(!update))
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setNewFolder(false)
|
setNewFolder(false)
|
||||||
}
|
}
|
||||||
@@ -55,6 +57,7 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
|||||||
|
|
||||||
async function handleUploadFile(file: any) {
|
async function handleUploadFile(file: any) {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
fd.append("file", {
|
fd.append("file", {
|
||||||
@@ -74,16 +77,17 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
|||||||
|
|
||||||
const response = await apiUploadFileDocument({ data: fd })
|
const response = await apiUploadFileDocument({ data: fd })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil mengunggah file", ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengunggah file', })
|
||||||
dispatch(setUpdateDokumen(!update))
|
dispatch(setUpdateDokumen(!update))
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +102,7 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
|||||||
<DrawerBottom
|
<DrawerBottom
|
||||||
animation="slide"
|
animation="slide"
|
||||||
isVisible={isVisible}
|
isVisible={isVisible}
|
||||||
setVisible={setVisible}
|
setVisible={() => { setVisible(false) }}
|
||||||
title="Menu"
|
title="Menu"
|
||||||
>
|
>
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
@@ -110,10 +114,12 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
|||||||
size={25}
|
size={25}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
title="Tambah Dokumen"
|
title="Tambah Folder"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
setNewFolder(true);
|
setTimeout(() => {
|
||||||
|
setNewFolder(true);
|
||||||
|
}, 600);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -127,11 +133,9 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
|||||||
<ModalFloat
|
<ModalFloat
|
||||||
title="Buat Folder Baru"
|
title="Buat Folder Baru"
|
||||||
isVisible={newFolder}
|
isVisible={newFolder}
|
||||||
setVisible={setNewFolder}
|
setVisible={() => { setNewFolder(false) }}
|
||||||
disableSubmit={name == ""}
|
disableSubmit={name == ""}
|
||||||
onSubmit={() => {
|
onSubmit={() => { handleCreateFolder() }}
|
||||||
handleCreateFolder()
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<View>
|
<View>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -139,9 +143,7 @@ export default function HeaderRightDocument({ path }: { path: string }) {
|
|||||||
placeholder="Nama Folder"
|
placeholder="Nama Folder"
|
||||||
required
|
required
|
||||||
label="Nama Folder"
|
label="Nama Folder"
|
||||||
onChange={(value: string) => {
|
onChange={(value: string) => { setName(value) }}
|
||||||
setName(value);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</ModalFloat>
|
</ModalFloat>
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ import { ColorsStatus } from "@/constants/ColorsStatus";
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Pressable, ScrollView, Text, ToastAndroid, View } from "react-native";
|
import { Pressable, ScrollView, View } from "react-native";
|
||||||
import { useSharedValue } from "react-native-reanimated";
|
import { useSharedValue } from "react-native-reanimated";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi";
|
import AlertKonfirmasi from "../alertKonfirmasi";
|
||||||
import DrawerBottom from "../drawerBottom";
|
import DrawerBottom from "../drawerBottom";
|
||||||
import { InputForm } from "../inputForm";
|
import { InputForm } from "../inputForm";
|
||||||
@@ -13,6 +14,7 @@ import MenuItemRow from "../menuItemRow";
|
|||||||
import ModalFloat from "../modalFloat";
|
import ModalFloat from "../modalFloat";
|
||||||
import ModalSelectMultiple from "../modalSelectMultiple";
|
import ModalSelectMultiple from "../modalSelectMultiple";
|
||||||
import ModalSalinMove from "./modalSalinMove";
|
import ModalSalinMove from "./modalSalinMove";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -60,7 +62,7 @@ export default function MenuBottomSelectDocument({ onDone }: Props) {
|
|||||||
|
|
||||||
onPress: () => {
|
onPress: () => {
|
||||||
onDone()
|
onDone()
|
||||||
ToastAndroid.show('Berhasil menghapus data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
@@ -94,7 +96,7 @@ export default function MenuBottomSelectDocument({ onDone }: Props) {
|
|||||||
<ModalFloat title="Ganti Nama Dokumen" isVisible={isRename} setVisible={setRename}
|
<ModalFloat title="Ganti Nama Dokumen" isVisible={isRename} setVisible={setRename}
|
||||||
onSubmit={() => {
|
onSubmit={() => {
|
||||||
onDone()
|
onDone()
|
||||||
ToastAndroid.show('Berhasil mengganti nama dokumen', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengganti nama dokumen', })
|
||||||
}}>
|
}}>
|
||||||
<View>
|
<View>
|
||||||
<InputForm type="default" placeholder="Nama File" required label="Nama File" />
|
<InputForm type="default" placeholder="Nama File" required label="Nama File" />
|
||||||
@@ -204,7 +206,7 @@ export default function MenuBottomSelectDocument({ onDone }: Props) {
|
|||||||
|
|
||||||
<ModalSelectMultiple choose="dinas" title="Bagikan" category="share-division" open={isShare} close={setShare}
|
<ModalSelectMultiple choose="dinas" title="Bagikan" category="share-division" open={isShare} close={setShare}
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
ToastAndroid.show('Success', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Success', })
|
||||||
setShare(false)
|
setShare(false)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ import { apiGetDocumentInformasi } from "@/lib/api";
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Pressable, ScrollView, Text, View } from "react-native";
|
import { ActivityIndicator, Pressable, ScrollView, View } from "react-native";
|
||||||
import { useSharedValue } from "react-native-reanimated";
|
import { useSharedValue } from "react-native-reanimated";
|
||||||
import ItemAccordion from "../itemAccordion";
|
import ItemAccordion from "../itemAccordion";
|
||||||
import ItemDetailMember from "../itemDetailMember";
|
import ItemDetailMember from "../itemDetailMember";
|
||||||
|
import ModalLoading from "../modalLoading";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
category: string,
|
category: string,
|
||||||
@@ -28,9 +30,11 @@ export default function ModalInformasi({ data }: { data: any }) {
|
|||||||
const [dataInformasi, setDataInformasi] = useState<Props>()
|
const [dataInformasi, setDataInformasi] = useState<Props>()
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const [dataShare, setDataShare] = useState<PropsShare[]>([])
|
const [dataShare, setDataShare] = useState<PropsShare[]>([])
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
|
||||||
async function handleInformasi() {
|
async function handleInformasi() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiGetDocumentInformasi({ user: hasil, item: data.id, cat: 'lainnya' })
|
const response = await apiGetDocumentInformasi({ user: hasil, item: data.id, cat: 'lainnya' })
|
||||||
setDataInformasi(response.data)
|
setDataInformasi(response.data)
|
||||||
@@ -39,6 +43,8 @@ export default function ModalInformasi({ data }: { data: any }) {
|
|||||||
setDataShare(responseShare.data)
|
setDataShare(responseShare.data)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,39 +64,47 @@ export default function ModalInformasi({ data }: { data: any }) {
|
|||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View>
|
{
|
||||||
<ItemDetailMember category="dokumen" value={dataInformasi?.category == 'FOLDER' ? dataInformasi?.name : `${dataInformasi?.name}.${dataInformasi?.extension}`} border />
|
loading ? (
|
||||||
<ItemDetailMember category="type" value={dataInformasi?.category} border />
|
<View>
|
||||||
<ItemDetailMember category="location" value={dataInformasi?.path} border />
|
<ActivityIndicator size="large" />
|
||||||
<ItemDetailMember category="owner" value={dataInformasi?.division} border />
|
|
||||||
<ItemDetailMember category="calendar" value={dataInformasi?.createdAt} border />
|
|
||||||
<Pressable style={[Styles.rowSpaceBetween, Styles.rowItemsCenter, Styles.wrapItemBorderBottom]} onPress={() => { open.value = !open.value; }}>
|
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
|
||||||
<MaterialCommunityIcons name="share-variant-outline" size={22} color="black" style={[Styles.mr10]} />
|
|
||||||
<Text style={[Styles.textDefault]}>Telah dibagikan ke divisi</Text>
|
|
||||||
</View>
|
</View>
|
||||||
<MaterialCommunityIcons name="chevron-down" size={22} color="black" />
|
) : (
|
||||||
</Pressable>
|
<View>
|
||||||
<ItemAccordion isExpanded={open} viewKey="Accordion" duration={500}>
|
<ItemDetailMember category="dokumen" value={dataInformasi?.category == 'FOLDER' ? dataInformasi?.name : `${dataInformasi?.name}.${dataInformasi?.extension}`} border />
|
||||||
<ScrollView style={[Styles.w100, { height: 200 }]} >
|
<ItemDetailMember category="type" value={dataInformasi?.category} border />
|
||||||
{
|
<ItemDetailMember category="location" value={dataInformasi?.path} border />
|
||||||
dataShare.length > 0 ? (
|
<ItemDetailMember category="owner" value={dataInformasi?.division} border />
|
||||||
dataShare.map((item, index) => (
|
<ItemDetailMember category="calendar" value={dataInformasi?.createdAt} border />
|
||||||
<View key={index} style={[Styles.rowOnly, Styles.ml10, Styles.mt02]}>
|
<Pressable style={[Styles.rowSpaceBetween, Styles.rowItemsCenter, Styles.wrapItemBorderBottom]} onPress={() => { open.value = !open.value; }}>
|
||||||
<MaterialCommunityIcons name="account-group-outline" size={22} color="black" style={[Styles.mr10]} />
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<Text style={[Styles.textDefault]}>{item.name}</Text>
|
<MaterialCommunityIcons name="share-variant-outline" size={22} color="black" style={[Styles.mr10]} />
|
||||||
</View>
|
<Text style={[Styles.textDefault]}>Telah dibagikan ke divisi</Text>
|
||||||
))
|
</View>
|
||||||
)
|
<MaterialCommunityIcons name="chevron-down" size={22} color="black" />
|
||||||
: (
|
</Pressable>
|
||||||
<View style={[Styles.ml10, Styles.mt02]}>
|
<ItemAccordion isExpanded={open} viewKey="Accordion" duration={500}>
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<ScrollView style={[Styles.w100, { height: 200 }]} >
|
||||||
</View>
|
{
|
||||||
)
|
dataShare.length > 0 ? (
|
||||||
}
|
dataShare.map((item, index) => (
|
||||||
</ScrollView>
|
<View key={index} style={[Styles.rowOnly, Styles.ml10, Styles.mt02]}>
|
||||||
</ItemAccordion>
|
<MaterialCommunityIcons name="account-group-outline" size={22} color="black" style={[Styles.mr10]} />
|
||||||
</View>
|
<Text style={[Styles.textDefault]}>{item.name}</Text>
|
||||||
|
</View>
|
||||||
|
))
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
<View style={[Styles.ml10, Styles.mt02]}>
|
||||||
|
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</ScrollView>
|
||||||
|
</ItemAccordion>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { ToastAndroid, View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import DrawerBottom from "../drawerBottom";
|
import DrawerBottom from "../drawerBottom";
|
||||||
import MenuItemRow from "../menuItemRow";
|
import MenuItemRow from "../menuItemRow";
|
||||||
@@ -63,14 +64,14 @@ export default function ModalMore({
|
|||||||
path,
|
path,
|
||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil memindahkan file", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil memindahkan file', });
|
||||||
dispatch(setUpdateDokumen(!update));
|
dispatch(setUpdateDokumen(!update));
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', });
|
||||||
} finally {
|
} finally {
|
||||||
setIsCut(false);
|
setIsCut(false);
|
||||||
onClose();
|
onClose();
|
||||||
@@ -87,14 +88,14 @@ export default function ModalMore({
|
|||||||
idDivision: id
|
idDivision: id
|
||||||
});
|
});
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil menyalin file", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menyalin file', });
|
||||||
dispatch(setUpdateDokumen(!update));
|
dispatch(setUpdateDokumen(!update));
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: response.message, });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show("Terjadi kesalahan", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', });
|
||||||
} finally {
|
} finally {
|
||||||
setIsCopy(false);
|
setIsCopy(false);
|
||||||
onClose();
|
onClose();
|
||||||
@@ -154,7 +155,7 @@ export default function ModalMore({
|
|||||||
<DrawerBottom
|
<DrawerBottom
|
||||||
animation="slide"
|
animation="slide"
|
||||||
isVisible={isInformasi}
|
isVisible={isInformasi}
|
||||||
setVisible={setInformasi}
|
setVisible={() => setInformasi(false)}
|
||||||
title="Informasi Dokumen"
|
title="Informasi Dokumen"
|
||||||
height={80}
|
height={80}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { AntDesign, Ionicons } from "@expo/vector-icons"
|
import { AntDesign, Ionicons } from "@expo/vector-icons"
|
||||||
import { useLocalSearchParams } from "expo-router"
|
import { useLocalSearchParams } from "expo-router"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { Pressable, Text, View } from "react-native"
|
import { Pressable, View } from "react-native"
|
||||||
import BorderBottomItem from "../borderBottomItem"
|
import BorderBottomItem from "../borderBottomItem"
|
||||||
import DrawerBottom from "../drawerBottom"
|
import DrawerBottom from "../drawerBottom"
|
||||||
|
import Text from "../Text"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
open: boolean
|
open: boolean
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { MaterialIcons } from "@expo/vector-icons";
|
import { MaterialIcons } from "@expo/vector-icons";
|
||||||
import { Pressable, View } from "react-native";
|
import { Dimensions, KeyboardAvoidingView, Platform, Pressable, View } from "react-native";
|
||||||
import Text from "./Text";
|
|
||||||
import Modal from 'react-native-modal';
|
import Modal from 'react-native-modal';
|
||||||
|
import Text from "./Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isVisible: boolean
|
isVisible: boolean
|
||||||
@@ -12,28 +12,15 @@ type Props = {
|
|||||||
animation?: 'slide' | 'none' | 'fade'
|
animation?: 'slide' | 'none' | 'fade'
|
||||||
height?: number
|
height?: number
|
||||||
backdropPressable?: boolean
|
backdropPressable?: boolean
|
||||||
|
keyboard?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function DrawerBottom({ isVisible, setVisible, title, children, animation, height, backdropPressable = true }: Props) {
|
export default function DrawerBottom({ isVisible, setVisible, title, children, animation, height, backdropPressable = true, keyboard = false }: Props) {
|
||||||
return (
|
const tinggiScreen = Dimensions.get("window").height;
|
||||||
// <Modal
|
const tinggiInput = height != undefined ? height : 25
|
||||||
// animationType={animation}
|
const tinggiFix = tinggiScreen * tinggiInput / 100;
|
||||||
// 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>
|
|
||||||
|
|
||||||
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
animationIn={"slideInUp"}
|
animationIn={"slideInUp"}
|
||||||
animationOut={"slideOutDown"}
|
animationOut={"slideOutDown"}
|
||||||
@@ -49,17 +36,37 @@ export default function DrawerBottom({ isVisible, setVisible, title, children, a
|
|||||||
backdropTransitionOutTiming={500}
|
backdropTransitionOutTiming={500}
|
||||||
useNativeDriverForBackdrop={true}
|
useNativeDriverForBackdrop={true}
|
||||||
>
|
>
|
||||||
<View style={[Styles.modalContentNew, height != undefined ? { height: `${height}%` } : { height: '25%' }]}>
|
{
|
||||||
<View style={[Styles.titleContainerNew]}>
|
keyboard ?
|
||||||
<Text style={Styles.textDefault}>{title}</Text>
|
<KeyboardAvoidingView
|
||||||
<Pressable onPress={() => setVisible(false)}>
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
<MaterialIcons name="close" color="black" size={22} />
|
keyboardVerticalOffset={0}
|
||||||
</Pressable>
|
>
|
||||||
</View>
|
<View style={[Styles.modalContentNew, { height: tinggiFix }]}>
|
||||||
<View style={Styles.contentContainer}>
|
<View style={[Styles.titleContainerNew]}>
|
||||||
{children}
|
<Text style={Styles.textDefault}>{title}</Text>
|
||||||
</View>
|
<Pressable onPress={() => setVisible(false)}>
|
||||||
</View>
|
<MaterialIcons name="close" color="black" size={22} />
|
||||||
|
</Pressable>
|
||||||
|
</View>
|
||||||
|
<View style={Styles.contentContainer}>
|
||||||
|
{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>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,8 @@ import { setUpdateGroup } from "@/lib/groupSlice"
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
import { AntDesign } from "@expo/vector-icons"
|
import { AntDesign } from "@expo/vector-icons"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import { ButtonForm } from "../buttonForm"
|
import { ButtonForm } from "../buttonForm"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -33,7 +34,7 @@ export default function HeaderRightGroupList() {
|
|||||||
} finally {
|
} finally {
|
||||||
setVisibleTambah(false)
|
setVisibleTambah(false)
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ export default function HeaderRightGroupList() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
<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}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
||||||
@@ -69,7 +70,7 @@ export default function HeaderRightGroupList() {
|
|||||||
() => {
|
() => {
|
||||||
setVisibleTambah(true)
|
setVisibleTambah(true)
|
||||||
},
|
},
|
||||||
100,
|
600,
|
||||||
);
|
);
|
||||||
|
|
||||||
}}
|
}}
|
||||||
@@ -77,7 +78,7 @@ export default function HeaderRightGroupList() {
|
|||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
<DrawerBottom animation="none" height={30} isVisible={isVisibleTambah} setVisible={setVisibleTambah} title="Tambah Lembaga Desa">
|
<DrawerBottom animation="none" keyboard height={30} isVisible={isVisibleTambah} setVisible={() => setVisibleTambah(false)} title="Tambah Lembaga Desa">
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<View>
|
<View>
|
||||||
<InputForm
|
<InputForm
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import { stringToDate } from "@/lib/fun_stringToDate";
|
|||||||
import DateTimePicker from "@react-native-community/datetimepicker";
|
import DateTimePicker from "@react-native-community/datetimepicker";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Pressable, Text, View } from "react-native";
|
import { Pressable, View } from "react-native";
|
||||||
|
import Text from "./Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
label?: string;
|
label?: string;
|
||||||
@@ -26,7 +27,7 @@ type Props = {
|
|||||||
export function InputDate({ label, value, placeholder, onChange, info, disable, error, errorText, required, mode, round, width, }: Props) {
|
export function InputDate({ label, value, placeholder, onChange, info, disable, error, errorText, required, mode, round, width, }: Props) {
|
||||||
const [modal, setModal] = useState(false);
|
const [modal, setModal] = useState(false);
|
||||||
|
|
||||||
const onChangeDate = ({ type }: { type: string }, selectedDate: any) => {
|
const onChangeDate = (type: string, selectedDate: any) => {
|
||||||
if (type === "set") {
|
if (type === "set") {
|
||||||
if (mode == "date") {
|
if (mode == "date") {
|
||||||
onChange(dayjs(selectedDate).format("DD-MM-YYYY"))
|
onChange(dayjs(selectedDate).format("DD-MM-YYYY"))
|
||||||
@@ -59,10 +60,10 @@ export function InputDate({ label, value, placeholder, onChange, info, disable,
|
|||||||
{
|
{
|
||||||
modal && (
|
modal && (
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
value={value ? stringToDate(value) : new Date()}
|
value={new Date()}
|
||||||
mode={mode}
|
mode={mode}
|
||||||
display="default"
|
display="default"
|
||||||
onChange={onChangeDate}
|
onChange={(event, date) => { onChangeDate(event.type, date) }}
|
||||||
onTouchCancel={() => setModal(false)}
|
onTouchCancel={() => setModal(false)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiDeleteUser } from "@/lib/api"
|
import { apiDeleteUser } from "@/lib/api"
|
||||||
|
import { setUpdateMember } from "@/lib/memberSlice"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import AlertKonfirmasi from "../alertKonfirmasi"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
import DrawerBottom from "../drawerBottom"
|
import DrawerBottom from "../drawerBottom"
|
||||||
import MenuItemRow from "../menuItemRow"
|
import MenuItemRow from "../menuItemRow"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
|
||||||
import { setUpdateMember } from "@/lib/memberSlice"
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
active: any,
|
active: any,
|
||||||
@@ -28,10 +29,10 @@ export default function HeaderRightMemberDetail({ active, id }: Props) {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiDeleteUser({ user: hasil, isActive: active }, id)
|
const response = await apiDeleteUser({ user: hasil, isActive: active }, id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil mengupdate data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||||
dispatch(setUpdateMember(!update))
|
dispatch(setUpdateMember(!update))
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export default function HeaderMemberList() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
<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}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
||||||
@@ -34,7 +34,9 @@ export default function HeaderMemberList() {
|
|||||||
title="Filter"
|
title="Filter"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
setFilter(true)
|
setTimeout(() => {
|
||||||
|
setFilter(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ export default function ModalSelect({ open, close, title, category, idParent, on
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
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' &&
|
category == 'member' &&
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ import { apiGetDivisionGroup, apiGetDocumentInformasi, apiGetListDivisionByIdDiv
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
import { AntDesign } from "@expo/vector-icons"
|
import { AntDesign } from "@expo/vector-icons"
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import { Pressable, ScrollView, ToastAndroid, View } from "react-native"
|
import { Pressable, ScrollView, View } from "react-native"
|
||||||
import Text from "./Text";
|
import Toast from "react-native-toast-message"
|
||||||
|
import Text from "./Text"
|
||||||
import { ButtonForm } from "./buttonForm"
|
import { ButtonForm } from "./buttonForm"
|
||||||
import DrawerBottom from "./drawerBottom"
|
import DrawerBottom from "./drawerBottom"
|
||||||
|
|
||||||
@@ -104,7 +105,7 @@ export default function ModalSelectMultiple({ open, close, title, category, choo
|
|||||||
delete newChecked[groupId];
|
delete newChecked[groupId];
|
||||||
} else {
|
} else {
|
||||||
if (data.find((item: { id: string }) => item.id === groupId)?.Division?.length == 0) {
|
if (data.find((item: { id: string }) => item.id === groupId)?.Division?.length == 0) {
|
||||||
return ToastAndroid.show('Tidak ada divisi', ToastAndroid.SHORT)
|
return Toast.show({ type: 'small', text1: 'Tidak ada divisi', })
|
||||||
}
|
}
|
||||||
newChecked[groupId] = data.find((item: { id: string }) => item.id === groupId)?.Division.map((item: { id: any }) => item.id) || [];
|
newChecked[groupId] = data.find((item: { id: string }) => item.id === groupId)?.Division.map((item: { id: any }) => item.id) || [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import { setUpdatePosition } from "@/lib/positionSlice"
|
|||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
import { AntDesign } from "@expo/vector-icons"
|
import { AntDesign } from "@expo/vector-icons"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import { ButtonForm } from "../buttonForm"
|
import { ButtonForm } from "../buttonForm"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -85,7 +86,7 @@ export default function HeaderRightPositionList() {
|
|||||||
} finally {
|
} finally {
|
||||||
setVisibleTambah(false)
|
setVisibleTambah(false)
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -101,7 +102,9 @@ export default function HeaderRightPositionList() {
|
|||||||
title="Tambah Jabatan"
|
title="Tambah Jabatan"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
setVisibleTambah(true)
|
setTimeout(() => {
|
||||||
|
setVisibleTambah(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{
|
{
|
||||||
@@ -111,14 +114,16 @@ export default function HeaderRightPositionList() {
|
|||||||
title="Filter"
|
title="Filter"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
setFilter(true)
|
setTimeout(() => {
|
||||||
|
setFilter(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
<DrawerBottom animation="slide" height={45} isVisible={isVisibleTambah} setVisible={setVisibleTambah} 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 style={{ flex: 1, justifyContent: 'space-between' }}>
|
||||||
<View>
|
<View>
|
||||||
{
|
{
|
||||||
@@ -130,7 +135,9 @@ export default function HeaderRightPositionList() {
|
|||||||
required
|
required
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisibleTambah(false)
|
setVisibleTambah(false)
|
||||||
setSelect(true)
|
setTimeout(() => {
|
||||||
|
setSelect(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
error={error.idGroup}
|
error={error.idGroup}
|
||||||
errorText="Lembaga Desa harus diisi"
|
errorText="Lembaga Desa harus diisi"
|
||||||
@@ -165,7 +172,9 @@ export default function HeaderRightPositionList() {
|
|||||||
validationForm(value.val, 'idGroup')
|
validationForm(value.val, 'idGroup')
|
||||||
setChoose(value)
|
setChoose(value)
|
||||||
setSelect(false)
|
setSelect(false)
|
||||||
setVisibleTambah(true)
|
setTimeout(() => {
|
||||||
|
setVisibleTambah(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
title="Lembaga Desa"
|
title="Lembaga Desa"
|
||||||
open={isSelect}
|
open={isSelect}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider"
|
|||||||
import { AntDesign, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
import { AntDesign, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { ToastAndroid, View } from "react-native"
|
import { View } from "react-native"
|
||||||
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import AlertKonfirmasi from "../alertKonfirmasi"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
@@ -30,10 +31,10 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
|
|||||||
const response = await apiDeleteProject({ user: hasil }, String(id))
|
const response = await apiDeleteProject({ user: hasil }, String(id))
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
||||||
ToastAndroid.show('Berhasil menghapus kegiatan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus kegiatan', })
|
||||||
router.back()
|
router.back()
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show('Gagal menghapus kegiatan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Gagal menghapus kegiatan', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ export default function HeaderRightProjectList() {
|
|||||||
title="Filter"
|
title="Filter"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
setFilter(true)
|
setTimeout(() => {
|
||||||
|
setFilter(true)
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ import { startActivityAsync } from 'expo-intent-launcher';
|
|||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import * as Sharing from 'expo-sharing';
|
import * as Sharing from 'expo-sharing';
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Alert, Platform, Text, ToastAndroid, View } from "react-native";
|
import { Alert, Platform, View } from "react-native";
|
||||||
import * as mime from 'react-native-mime-types';
|
import * as mime from 'react-native-mime-types';
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi";
|
import AlertKonfirmasi from "../alertKonfirmasi";
|
||||||
import BorderBottomItem from "../borderBottomItem";
|
import BorderBottomItem from "../borderBottomItem";
|
||||||
@@ -17,6 +18,7 @@ import DrawerBottom from "../drawerBottom";
|
|||||||
import MenuItemRow from "../menuItemRow";
|
import MenuItemRow from "../menuItemRow";
|
||||||
import ModalLoading from "../modalLoading";
|
import ModalLoading from "../modalLoading";
|
||||||
import Skeleton from "../skeleton";
|
import Skeleton from "../skeleton";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -26,7 +28,7 @@ type Props = {
|
|||||||
idStorage: string
|
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 entityUser = useSelector((state: any) => state.user)
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
@@ -60,6 +62,11 @@ export default function SectionFile({ status, member }: { status: number | undef
|
|||||||
handleLoad(false);
|
handleLoad(false);
|
||||||
}, [update.file]);
|
}, [update.file]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (refreshing)
|
||||||
|
handleLoad(false);
|
||||||
|
}, [refreshing]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleLoad(true);
|
handleLoad(true);
|
||||||
@@ -70,14 +77,14 @@ export default function SectionFile({ status, member }: { status: number | undef
|
|||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiDeleteFileProject({ user: hasil }, String(selectFile?.id));
|
const response = await apiDeleteFileProject({ user: hasil }, String(selectFile?.id));
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show('Berhasil menghapus file', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus file', })
|
||||||
dispatch(setUpdateProject({ ...update, file: !update.file }))
|
dispatch(setUpdateProject({ ...update, file: !update.file }))
|
||||||
} else {
|
} else {
|
||||||
ToastAndroid.show(response.message, ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
ToastAndroid.show('Terjadi kesalahan', ToastAndroid.SHORT)
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
} finally {
|
} finally {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import Styles from "@/constants/Styles";
|
|||||||
import { deleteTaskCreate } from "@/lib/taskCreate";
|
import { deleteTaskCreate } from "@/lib/taskCreate";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { Key, useState } from "react";
|
import { Key, useState } from "react";
|
||||||
import { Text, View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import DrawerBottom from "../drawerBottom";
|
import DrawerBottom from "../drawerBottom";
|
||||||
import ItemSectionTanggalTugas from "../itemSectionTanggalTugas";
|
import ItemSectionTanggalTugas from "../itemSectionTanggalTugas";
|
||||||
import MenuItemRow from "../menuItemRow";
|
import MenuItemRow from "../menuItemRow";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
export default function SectionListAddTask() {
|
export default function SectionListAddTask() {
|
||||||
const taskCreate = useSelector((state: any) => state.taskCreate)
|
const taskCreate = useSelector((state: any) => state.taskCreate)
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Text, ToastAndroid, View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi";
|
import AlertKonfirmasi from "../alertKonfirmasi";
|
||||||
import BorderBottomItem from "../borderBottomItem";
|
import BorderBottomItem from "../borderBottomItem";
|
||||||
@@ -13,6 +14,7 @@ import DrawerBottom from "../drawerBottom";
|
|||||||
import ImageUser from "../imageNew";
|
import ImageUser from "../imageNew";
|
||||||
import MenuItemRow from "../menuItemRow";
|
import MenuItemRow from "../menuItemRow";
|
||||||
import SkeletonTwoItem from "../skeletonTwoItem";
|
import SkeletonTwoItem from "../skeletonTwoItem";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -23,7 +25,7 @@ type Props = {
|
|||||||
position: string;
|
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 dispatch = useDispatch()
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const update = useSelector((state: any) => state.projectUpdate)
|
const update = useSelector((state: any) => state.projectUpdate)
|
||||||
@@ -60,6 +62,11 @@ export default function SectionMember({ status }: { status: number | undefined }
|
|||||||
handleLoad(false);
|
handleLoad(false);
|
||||||
}, [update.member]);
|
}, [update.member]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (refreshing)
|
||||||
|
handleLoad(false);
|
||||||
|
}, [refreshing]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleLoad(true);
|
handleLoad(true);
|
||||||
}, []);
|
}, []);
|
||||||
@@ -72,8 +79,8 @@ export default function SectionMember({ status }: { status: number | undefined }
|
|||||||
idUser: memberChoose.id,
|
idUser: memberChoose.id,
|
||||||
}, id)
|
}, id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
ToastAndroid.show("Berhasil menghapus anggota", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus anggota', })
|
||||||
dispatch(setUpdateProject({ ...update, member: !update.progress }))
|
dispatch(setUpdateProject({ ...update, member: !update.member }))
|
||||||
setModal(false);
|
setModal(false);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
|||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { router, useLocalSearchParams } from "expo-router";
|
import { router, useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Text, ToastAndroid, View } from "react-native";
|
import { View } from "react-native";
|
||||||
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi";
|
import AlertKonfirmasi from "../alertKonfirmasi";
|
||||||
import DrawerBottom from "../drawerBottom";
|
import DrawerBottom from "../drawerBottom";
|
||||||
@@ -13,6 +14,7 @@ import ItemSectionTanggalTugas from "../itemSectionTanggalTugas";
|
|||||||
import MenuItemRow from "../menuItemRow";
|
import MenuItemRow from "../menuItemRow";
|
||||||
import ModalSelect from "../modalSelect";
|
import ModalSelect from "../modalSelect";
|
||||||
import SkeletonTask from "../skeletonTask";
|
import SkeletonTask from "../skeletonTask";
|
||||||
|
import Text from "../Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -24,7 +26,7 @@ type Props = {
|
|||||||
createdAt: string;
|
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 entityUser = useSelector((state: any) => state.user)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.projectUpdate)
|
const update = useSelector((state: any) => state.projectUpdate)
|
||||||
@@ -61,6 +63,11 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
|||||||
handleLoad(false);
|
handleLoad(false);
|
||||||
}, [update.task]);
|
}, [update.task]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (refreshing)
|
||||||
|
handleLoad(false);
|
||||||
|
}, [refreshing]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleLoad(true);
|
handleLoad(true);
|
||||||
}, []);
|
}, []);
|
||||||
@@ -77,7 +84,7 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
||||||
setSelect(false);
|
setSelect(false);
|
||||||
ToastAndroid.show("Berhasil mengubah data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -94,7 +101,7 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
dispatch(setUpdateProject({ ...update, progress: !update.progress, task: !update.task }))
|
||||||
setModal(false);
|
setModal(false);
|
||||||
ToastAndroid.show("Berhasil menghapus data", ToastAndroid.SHORT);
|
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@@ -161,7 +168,9 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
|||||||
title="Update Status"
|
title="Update Status"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false);
|
setModal(false);
|
||||||
setSelect(true);
|
setTimeout(() => {
|
||||||
|
setSelect(true);
|
||||||
|
}, 600)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
@@ -196,7 +205,7 @@ export default function SectionTanggalTugasProject({ status, member }: { status:
|
|||||||
|
|
||||||
<ModalSelect
|
<ModalSelect
|
||||||
category="status-task"
|
category="status-task"
|
||||||
close={setSelect}
|
close={() => { setSelect(false) }}
|
||||||
onSelect={(value) => {
|
onSelect={(value) => {
|
||||||
handleUpdate(Number(value.val))
|
handleUpdate(Number(value.val))
|
||||||
}}
|
}}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user