Compare commits
17 Commits
v1
...
amalia/20-
| Author | SHA1 | Date | |
|---|---|---|---|
| 3809d382fa | |||
| 86b9fa6396 | |||
| 6770d40b41 | |||
| 77f478b7ca | |||
| 4681f0a0cc | |||
| 31b7cf6a30 | |||
| 64aaafa2be | |||
| 42cb7c8f8e | |||
| 8c63c08bc3 | |||
| 6ca935483a | |||
| 039b26f5aa | |||
| 10212aa5de | |||
| acacf9c125 | |||
| 4df0a44ac9 | |||
| 8012f7f322 | |||
| 064a8ccaad | |||
| d3802ca26c |
86
GEMINI.md
Normal file
86
GEMINI.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# Project Overview: Desa+
|
||||||
|
|
||||||
|
Desa+ is a mobile application built with React Native and Expo, designed to facilitate management and communication within villages/communities. It aims to streamline village administration, inter-community communication, and the management of essential information.
|
||||||
|
|
||||||
|
## Key Features:
|
||||||
|
- Village announcements and information
|
||||||
|
- Community discussion forum
|
||||||
|
- Village activity calendar
|
||||||
|
- Village documentation and archives
|
||||||
|
- Project and task management
|
||||||
|
- Member and organizational structure management
|
||||||
|
- Push notifications for important updates
|
||||||
|
- Verification and authentication features
|
||||||
|
|
||||||
|
## Technologies Used:
|
||||||
|
- **React Native**: Cross-platform mobile development framework.
|
||||||
|
- **Expo**: Platform for React Native application development.
|
||||||
|
- **Firebase**: Backend services including Authentication, Realtime Database, and Cloud Messaging.
|
||||||
|
- **Redux Toolkit**: State management.
|
||||||
|
- **React Navigation**: Application navigation.
|
||||||
|
- **TypeScript**: For type safety.
|
||||||
|
|
||||||
|
## Building and Running:
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
1. **Clone the repository:**
|
||||||
|
```bash
|
||||||
|
git clone <repository-url>
|
||||||
|
cd mobile-darmasaba
|
||||||
|
```
|
||||||
|
2. **Install dependencies:**
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
3. **Configure environment variables:**
|
||||||
|
Create a `.env` file in the root directory and add the following variables:
|
||||||
|
```
|
||||||
|
URL_API=<api-endpoint>
|
||||||
|
URL_OTP=<otp-service-endpoint>
|
||||||
|
URL_STORAGE=<storage-endpoint>
|
||||||
|
URL_FIREBASE_DB=<firebase-database-url>
|
||||||
|
PASS_ENC=<encryption-password>
|
||||||
|
WA_SERVER_TOKEN=<whatsapp-server-token>
|
||||||
|
IOS_GOOGLE_SERVICES_FILE=<path-to-ios-google-services>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running the Application
|
||||||
|
- **Start development server:**
|
||||||
|
```bash
|
||||||
|
npx expo start
|
||||||
|
```
|
||||||
|
- **Run on Android emulator/device:**
|
||||||
|
```bash
|
||||||
|
npm run android
|
||||||
|
```
|
||||||
|
- **Run on iOS simulator/device:**
|
||||||
|
```bash
|
||||||
|
npm run ios
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build Production
|
||||||
|
- **Build Android production package:**
|
||||||
|
```bash
|
||||||
|
npm run build:android
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development Conventions:
|
||||||
|
|
||||||
|
### Project Structure:
|
||||||
|
- `app/`: Main page files.
|
||||||
|
- `components/`: Reusable UI components, categorized by feature (e.g., `announcement/`, `auth/`, `discussion/`).
|
||||||
|
- `assets/`: Images and static assets.
|
||||||
|
- `constants/`: Global constants.
|
||||||
|
- `lib/`: Libraries and utilities.
|
||||||
|
|
||||||
|
### Contribution Guidelines:
|
||||||
|
1. Fork the repository.
|
||||||
|
2. Create a new feature branch (`git checkout -b feature/FeatureName`).
|
||||||
|
3. Commit your changes (`git commit -m 'Add FeatureName feature'`).
|
||||||
|
4. Push to the branch (`git push origin feature/FeatureName`).
|
||||||
|
5. Create a pull request.
|
||||||
|
|
||||||
|
## Platform Support:
|
||||||
|
- ✅ Android
|
||||||
|
- ✅ iOS
|
||||||
|
- ❌ Web (not yet optimized)
|
||||||
@@ -79,6 +79,12 @@ export default {
|
|||||||
URL_FIREBASE_DB: process.env.URL_FIREBASE_DB,
|
URL_FIREBASE_DB: process.env.URL_FIREBASE_DB,
|
||||||
PASS_ENC: process.env.PASS_ENC,
|
PASS_ENC: process.env.PASS_ENC,
|
||||||
WA_SERVER_TOKEN: process.env.WA_SERVER_TOKEN,
|
WA_SERVER_TOKEN: process.env.WA_SERVER_TOKEN,
|
||||||
|
FIREBASE_API_KEY: process.env.FIREBASE_API_KEY,
|
||||||
|
FIREBASE_AUTH_DOMAIN: process.env.FIREBASE_AUTH_DOMAIN,
|
||||||
|
FIREBASE_PROJECT_ID: process.env.FIREBASE_PROJECT_ID,
|
||||||
|
FIREBASE_STORAGE_BUCKET: process.env.FIREBASE_STORAGE_BUCKET,
|
||||||
|
FIREBASE_MESSAGING_SENDER_ID: process.env.FIREBASE_MESSAGING_SENDER_ID,
|
||||||
|
FIREBASE_APP_ID: process.env.FIREBASE_APP_ID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ import { StatusBar } from 'expo-status-bar';
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Easing, Notifier } from 'react-native-notifier';
|
import { Easing, Notifier } from 'react-native-notifier';
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
|
||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
const { token, decryptToken, isLoading } = useAuthSession()
|
const { token, decryptToken, isLoading } = useAuthSession()
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
|
const { colors } = useTheme()
|
||||||
|
|
||||||
async function handleReadNotification(id: string, category: string, idContent: string, title: string) {
|
async function handleReadNotification(id: string, category: string, idContent: string, title: string) {
|
||||||
try {
|
try {
|
||||||
@@ -93,11 +95,10 @@ export default function RootLayout() {
|
|||||||
<Stack screenOptions={{
|
<Stack screenOptions={{
|
||||||
headerShown: true,
|
headerShown: true,
|
||||||
animation: "slide_from_right",
|
animation: "slide_from_right",
|
||||||
|
|
||||||
// ⬇️ PENTING BANGET
|
|
||||||
animationTypeForReplace: "pop",
|
animationTypeForReplace: "pop",
|
||||||
fullScreenGestureEnabled: true,
|
fullScreenGestureEnabled: true,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
|
contentStyle: { backgroundColor: colors.header },
|
||||||
}} >
|
}} >
|
||||||
<Stack.Screen name="home" options={{ title: 'Home' }} />
|
<Stack.Screen name="home" options={{ title: 'Home' }} />
|
||||||
<Stack.Screen name="feature" options={{ title: 'Fitur' }} />
|
<Stack.Screen name="feature" options={{ title: 'Fitur' }} />
|
||||||
@@ -112,6 +113,18 @@ export default function RootLayout() {
|
|||||||
)
|
)
|
||||||
}} />
|
}} />
|
||||||
<Stack.Screen name="profile" options={{ title: 'Profile' }} />
|
<Stack.Screen name="profile" options={{ title: 'Profile' }} />
|
||||||
|
<Stack.Screen name="setting/index" options={{
|
||||||
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
|
title: 'Pengaturan',
|
||||||
|
headerTitleAlign: 'center',
|
||||||
|
// headerRight: () => <HeaderRightProjectList />
|
||||||
|
header: () => (
|
||||||
|
<AppHeader title="Pengaturan"
|
||||||
|
showBack={true}
|
||||||
|
onPressLeft={() => router.back()}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}} />
|
||||||
<Stack.Screen name="member/index" options={{
|
<Stack.Screen name="member/index" options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
title: 'Anggota',
|
title: 'Anggota',
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { isImageFile } from "@/constants/FileExtensions";
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetAnnouncementOne } from "@/lib/api";
|
import { apiGetAnnouncementOne } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Entypo, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
import { Entypo, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||||
import * as FileSystem from 'expo-file-system';
|
import * as FileSystem from 'expo-file-system';
|
||||||
import { startActivityAsync } from 'expo-intent-launcher';
|
import { startActivityAsync } from 'expo-intent-launcher';
|
||||||
@@ -51,6 +52,7 @@ interface ApiResponse {
|
|||||||
export default function DetailAnnouncement() {
|
export default function DetailAnnouncement() {
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [data, setData] = useState<AnnouncementData>({ id: '', title: '', desc: '' })
|
const [data, setData] = useState<AnnouncementData>({ id: '', title: '', desc: '' })
|
||||||
const [dataMember, setDataMember] = useState<Record<string, MemberData[]>>({})
|
const [dataMember, setDataMember] = useState<Record<string, MemberData[]>>({})
|
||||||
const [dataFile, setDataFile] = useState<FileData[]>([])
|
const [dataFile, setDataFile] = useState<FileData[]>([])
|
||||||
@@ -175,7 +177,7 @@ export default function DetailAnnouncement() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -193,22 +195,23 @@ export default function DetailAnnouncement() {
|
|||||||
/>
|
/>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={() => handleRefresh()}
|
onRefresh={() => handleRefresh()}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15, Styles.mb50]}>
|
<View style={[Styles.p15, Styles.mb50]}>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, Styles.borderAll, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<View>
|
<View>
|
||||||
<View style={[Styles.rowOnly]}>
|
<View style={[Styles.rowOnly]}>
|
||||||
<Skeleton width={30} height={30} borderRadius={10} />
|
<Skeleton width={30} height={30} borderRadius={10} />
|
||||||
<View style={[{ flex: 1 }, Styles.ph05]}>
|
<View style={[Styles.flex1, Styles.ph05]}>
|
||||||
<Skeleton width={100} widthType="percent" height={30} borderRadius={10} />
|
<Skeleton width={100} widthType="percent" height={30} borderRadius={10} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
@@ -218,8 +221,8 @@ export default function DetailAnnouncement() {
|
|||||||
</View>
|
</View>
|
||||||
:
|
:
|
||||||
<>
|
<>
|
||||||
<View style={[Styles.rowItemsCenter, { alignItems: 'flex-start' }]}>
|
<View style={[Styles.rowOnly, Styles.alignStart]}>
|
||||||
<MaterialIcons name="campaign" size={25} color="black" style={[Styles.mr05]} />
|
<MaterialIcons name="campaign" size={25} color={colors.text} style={[Styles.mr05]} />
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.w90, Styles.mt02]}>{data?.title}</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.w90, Styles.mt02]}>{data?.title}</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mt10]}>
|
<View style={[Styles.mt10]}>
|
||||||
@@ -228,7 +231,7 @@ export default function DetailAnnouncement() {
|
|||||||
<RenderHTML
|
<RenderHTML
|
||||||
contentWidth={contentWidth}
|
contentWidth={contentWidth}
|
||||||
source={{ html: data?.desc }}
|
source={{ html: data?.desc }}
|
||||||
baseStyle={{ color: 'black' }}
|
baseStyle={{ color: colors.text }}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text>{data?.desc}</Text>
|
<Text>{data?.desc}</Text>
|
||||||
@@ -240,7 +243,7 @@ export default function DetailAnnouncement() {
|
|||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
dataFile.length > 0 && (
|
dataFile.length > 0 && (
|
||||||
<View style={[Styles.wrapPaper, Styles.mt10]}>
|
<View style={[Styles.wrapPaper, Styles.borderAll, Styles.mt10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<View style={[Styles.mb05]}>
|
<View style={[Styles.mb05]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -251,7 +254,7 @@ export default function DetailAnnouncement() {
|
|||||||
icon={<MaterialCommunityIcons
|
icon={<MaterialCommunityIcons
|
||||||
name={isImageFile(item.extension) ? "file-image-outline" : "file-document-outline"}
|
name={isImageFile(item.extension) ? "file-image-outline" : "file-document-outline"}
|
||||||
size={25}
|
size={25}
|
||||||
color="black"
|
color={colors.text}
|
||||||
/>}
|
/>}
|
||||||
title={item.name + '.' + item.extension}
|
title={item.name + '.' + item.extension}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
@@ -265,7 +268,7 @@ export default function DetailAnnouncement() {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<View style={[Styles.wrapPaper, Styles.mt10]}>
|
<View style={[Styles.wrapPaper, Styles.borderAll, Styles.mt10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
arrSkeleton.map((item, index) => {
|
arrSkeleton.map((item, index) => {
|
||||||
@@ -286,7 +289,7 @@ export default function DetailAnnouncement() {
|
|||||||
dataMember[v].map((item: any, x: any) => {
|
dataMember[v].map((item: any, x: any) => {
|
||||||
return (
|
return (
|
||||||
<View key={x} style={[Styles.rowItemsCenter, Styles.w90]}>
|
<View key={x} style={[Styles.rowItemsCenter, Styles.w90]}>
|
||||||
<Entypo name="dot-single" size={24} color="black" />
|
<Entypo name="dot-single" size={24} color={colors.text} />
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{item.division}</Text>
|
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{item.division}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
@@ -315,7 +318,7 @@ export default function DetailAnnouncement() {
|
|||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel="Close image viewer"
|
accessibilityLabel="Close image viewer"
|
||||||
>
|
>
|
||||||
<Text style={{ color: 'white', fontSize: 26 }}>✕</Text>
|
<Text style={[Styles.textWhite, Styles.font26]}>✕</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
|
|
||||||
{/* MENU */}
|
{/* MENU */}
|
||||||
@@ -325,17 +328,17 @@ export default function DetailAnnouncement() {
|
|||||||
accessibilityLabel="Download or share image"
|
accessibilityLabel="Download or share image"
|
||||||
disabled={loadingOpen}
|
disabled={loadingOpen}
|
||||||
>
|
>
|
||||||
<Text style={{ color: loadingOpen ? 'gray' : 'white', fontSize: 22 }}>⋯</Text>
|
<Text style={[{ color: loadingOpen ? 'gray' : 'white' }, Styles.font26]}>⋯</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
FooterComponent={({ imageIndex }) => (
|
FooterComponent={({ imageIndex }) => (
|
||||||
<View style={{
|
<View style={[
|
||||||
paddingBottom: 20,
|
Styles.pb20,
|
||||||
paddingHorizontal: 16,
|
Styles.ph16,
|
||||||
alignItems: 'center',
|
Styles.alignCenter,
|
||||||
}}>
|
]}>
|
||||||
<Text style={{ color: 'white', fontSize: 16 }}>{chooseFile?.name}.{chooseFile?.extension}</Text>
|
<Text style={[Styles.textWhite, Styles.font16]}>{chooseFile?.name}.{chooseFile?.extension}</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4,7 +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 { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import LoadingOverlay from "@/components/loadingOverlay";
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -12,11 +12,12 @@ 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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Entypo, Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Entypo, Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import * as DocumentPicker from "expo-document-picker";
|
import * as DocumentPicker from "expo-document-picker";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, StyleSheet, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ export default function CreateAnnouncement() {
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.announcementUpdate)
|
const update = useSelector((state: any) => state.announcementUpdate)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [disableBtn, setDisableBtn] = useState(true);
|
const [disableBtn, setDisableBtn] = useState(true);
|
||||||
const [modalDivisi, setModalDivisi] = useState(false);
|
const [modalDivisi, setModalDivisi] = useState(false);
|
||||||
const [divisionMember, setDivisionMember] = useState<any>([])
|
const [divisionMember, setDivisionMember] = useState<any>([])
|
||||||
@@ -129,7 +131,7 @@ export default function CreateAnnouncement() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -158,24 +160,24 @@ export default function CreateAnnouncement() {
|
|||||||
showBack={true}
|
showBack={true}
|
||||||
onPressLeft={() => router.back()}
|
onPressLeft={() => router.back()}
|
||||||
right={
|
right={
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn || divisionMember.length == 0 || loading ? true : false}
|
disable={disableBtn || divisionMember.length == 0 || loading ? true : false}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
divisionMember.length == 0
|
divisionMember.length == 0
|
||||||
? Toast.show({ type: 'small', text1: "Anda belum memilih divisi", })
|
? Toast.show({ type: 'small', text1: "Anda belum memilih divisi", })
|
||||||
: handleCreate();
|
: handleCreate();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<LoadingOverlay visible={loading} />
|
{loading && <LoadingCenter />}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -184,6 +186,7 @@ export default function CreateAnnouncement() {
|
|||||||
placeholder="Judul Pengumuman"
|
placeholder="Judul Pengumuman"
|
||||||
required
|
required
|
||||||
error={error.title}
|
error={error.title}
|
||||||
|
bg={colors.card}
|
||||||
errorText="Judul harus diisi"
|
errorText="Judul harus diisi"
|
||||||
onChange={(val) => validationForm("title", val)}
|
onChange={(val) => validationForm("title", val)}
|
||||||
/>
|
/>
|
||||||
@@ -193,6 +196,7 @@ export default function CreateAnnouncement() {
|
|||||||
placeholder="Deskripsi Pengumuman"
|
placeholder="Deskripsi Pengumuman"
|
||||||
required
|
required
|
||||||
error={error.desc}
|
error={error.desc}
|
||||||
|
bg={colors.card}
|
||||||
errorText="Pengumuman harus diisi"
|
errorText="Pengumuman harus diisi"
|
||||||
onChange={(val) => validationForm("desc", val)}
|
onChange={(val) => validationForm("desc", val)}
|
||||||
multiline
|
multiline
|
||||||
@@ -201,21 +205,27 @@ export default function CreateAnnouncement() {
|
|||||||
{
|
{
|
||||||
fileForm.length > 0
|
fileForm.length > 0
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
<>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
{
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
fileForm.map((item, index) => (
|
<Text style={[Styles.textDefault]}>{fileForm.length} file</Text>
|
||||||
<BorderBottomItem
|
</View>
|
||||||
key={index}
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
||||||
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
{
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
fileForm.map((item, index) => (
|
||||||
title={item.name}
|
<BorderBottomItem
|
||||||
titleWeight="normal"
|
key={index}
|
||||||
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
borderType={fileForm.length - 1 == index ? "none" : "bottom"}
|
||||||
/>
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
))
|
title={item.name}
|
||||||
}
|
bgColor="transparent"
|
||||||
</View>
|
titleWeight="normal"
|
||||||
|
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ButtonSelect
|
<ButtonSelect
|
||||||
@@ -228,25 +238,30 @@ export default function CreateAnnouncement() {
|
|||||||
{
|
{
|
||||||
divisionMember.length > 0
|
divisionMember.length > 0
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10]}>
|
<>
|
||||||
{
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
divisionMember.map((item: { name: any; Division: any }, index: any) => {
|
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
|
||||||
return (
|
</View>
|
||||||
<View key={index}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>{item.name}</Text>
|
{
|
||||||
{
|
divisionMember.map((item: { name: any; Division: any }, index: any) => {
|
||||||
item.Division.map((division: any, i: any) => (
|
return (
|
||||||
<View key={i} style={[Styles.rowItemsCenter, Styles.w90]}>
|
<View key={index}>
|
||||||
<Entypo name="dot-single" size={24} color="black" />
|
<Text style={[Styles.textDefaultSemiBold]}>{item.name}</Text>
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{division.name}</Text>
|
{
|
||||||
</View>
|
item.Division.map((division: any, i: any) => (
|
||||||
))
|
<View key={i} style={[Styles.rowItemsCenter, Styles.w90]}>
|
||||||
}
|
<Entypo name="dot-single" size={24} color={colors.text} />
|
||||||
</View>
|
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{division.name}</Text>
|
||||||
)
|
</View>
|
||||||
})
|
))
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -266,7 +281,7 @@ export default function CreateAnnouncement() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile) }}
|
||||||
/>
|
/>
|
||||||
@@ -276,15 +291,4 @@ export default function CreateAnnouncement() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
container: {
|
|
||||||
padding: 20,
|
|
||||||
},
|
|
||||||
textArea: {
|
|
||||||
height: 100, // Or use flex-based sizing
|
|
||||||
borderColor: 'gray',
|
|
||||||
borderWidth: 1,
|
|
||||||
padding: 10,
|
|
||||||
textAlignVertical: 'top', // Important for Android to align text at the top
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -4,7 +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 { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import LoadingOverlay from "@/components/loadingOverlay";
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
||||||
import Text from '@/components/Text';
|
import Text from '@/components/Text';
|
||||||
@@ -12,6 +12,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { setUpdateAnnouncement } from "@/lib/announcementUpdate";
|
import { setUpdateAnnouncement } from "@/lib/announcementUpdate";
|
||||||
import { apiEditAnnouncement, apiGetAnnouncementOne } from "@/lib/api";
|
import { apiEditAnnouncement, apiGetAnnouncementOne } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Entypo, Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Entypo, 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";
|
||||||
@@ -35,6 +36,7 @@ export default function EditAnnouncement() {
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.announcementUpdate)
|
const update = useSelector((state: any) => state.announcementUpdate)
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
|
const { colors } = useTheme();
|
||||||
const [modalDivisi, setModalDivisi] = useState(false);
|
const [modalDivisi, setModalDivisi] = useState(false);
|
||||||
const [disableBtn, setDisableBtn] = useState(true);
|
const [disableBtn, setDisableBtn] = useState(true);
|
||||||
const [dataMember, setDataMember] = useState<any>([]);
|
const [dataMember, setDataMember] = useState<any>([]);
|
||||||
@@ -180,7 +182,7 @@ export default function EditAnnouncement() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -223,10 +225,10 @@ export default function EditAnnouncement() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<LoadingOverlay visible={loading} />
|
{loading && <LoadingCenter />}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -235,6 +237,7 @@ export default function EditAnnouncement() {
|
|||||||
placeholder="Judul Pengumuman"
|
placeholder="Judul Pengumuman"
|
||||||
required
|
required
|
||||||
error={error.title}
|
error={error.title}
|
||||||
|
bg={colors.card}
|
||||||
errorText="Judul harus diisi"
|
errorText="Judul harus diisi"
|
||||||
onChange={(val) => validationForm("title", val)}
|
onChange={(val) => validationForm("title", val)}
|
||||||
value={dataForm.title}
|
value={dataForm.title}
|
||||||
@@ -245,6 +248,7 @@ export default function EditAnnouncement() {
|
|||||||
placeholder="Deskripsi Pengumuman"
|
placeholder="Deskripsi Pengumuman"
|
||||||
required
|
required
|
||||||
error={error.desc}
|
error={error.desc}
|
||||||
|
bg={colors.card}
|
||||||
errorText="Pengumuman harus diisi"
|
errorText="Pengumuman harus diisi"
|
||||||
onChange={(val) => validationForm("desc", val)}
|
onChange={(val) => validationForm("desc", val)}
|
||||||
value={dataForm.desc}
|
value={dataForm.desc}
|
||||||
@@ -254,33 +258,40 @@ export default function EditAnnouncement() {
|
|||||||
{
|
{
|
||||||
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
<>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
{
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
dataFile.filter((val) => !val.delete).map((item, index) => (
|
<Text style={[Styles.textDefault]}>{fileForm.length + dataFile.filter((val) => !val.delete).length} file</Text>
|
||||||
<BorderBottomItem
|
</View>
|
||||||
key={index}
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
||||||
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
{
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
dataFile.filter((val) => !val.delete).map((item, index) => (
|
||||||
title={item.name + '.' + item.extension}
|
<BorderBottomItem
|
||||||
titleWeight="normal"
|
key={index}
|
||||||
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
borderType={dataFile.filter((val) => !val.delete).length - 1 == index && fileForm.length == 0 ? "none" : "bottom"}
|
||||||
/>
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
))
|
title={item.name + '.' + item.extension}
|
||||||
}
|
titleWeight="normal"
|
||||||
{
|
bgColor="transparent"
|
||||||
fileForm.map((item, index) => (
|
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
||||||
<BorderBottomItem
|
/>
|
||||||
key={index}
|
))
|
||||||
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
}
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
{
|
||||||
title={item.name}
|
fileForm.map((item, index) => (
|
||||||
titleWeight="normal"
|
<BorderBottomItem
|
||||||
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
key={index}
|
||||||
/>
|
borderType={fileForm.length - 1 == index ? "none" : "bottom"}
|
||||||
))
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
}
|
title={item.name}
|
||||||
</View>
|
titleWeight="normal"
|
||||||
|
bgColor="transparent"
|
||||||
|
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
<ButtonSelect
|
<ButtonSelect
|
||||||
value="Pilih divisi penerima pengumuman"
|
value="Pilih divisi penerima pengumuman"
|
||||||
@@ -291,25 +302,30 @@ export default function EditAnnouncement() {
|
|||||||
{
|
{
|
||||||
dataMember.length > 0
|
dataMember.length > 0
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10]}>
|
<>
|
||||||
{
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
dataMember.map((item: { name: any; Division: any }, index: any) => {
|
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
|
||||||
return (
|
</View>
|
||||||
<View key={index}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>{item.name}</Text>
|
{
|
||||||
{
|
dataMember.map((item: { name: any; Division: any }, index: any) => {
|
||||||
item.Division.map((division: any, i: any) => (
|
return (
|
||||||
<View key={i} style={[Styles.rowItemsCenter, Styles.w90]}>
|
<View key={index}>
|
||||||
<Entypo name="dot-single" size={24} color="black" />
|
<Text style={[Styles.textDefaultSemiBold]}>{item.name}</Text>
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{division.name}</Text>
|
{
|
||||||
</View>
|
item.Division.map((division: any, i: any) => (
|
||||||
))
|
<View key={i} style={[Styles.rowItemsCenter, Styles.w90]}>
|
||||||
}
|
<Entypo name="dot-single" size={24} color={colors.text} />
|
||||||
</View>
|
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode='tail'>{division.name}</Text>
|
||||||
)
|
</View>
|
||||||
})
|
))
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -330,7 +346,7 @@ export default function EditAnnouncement() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile.id, indexDelFile.cat) }}
|
onPress={() => { deleteFile(indexDelFile.id, indexDelFile.cat) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { ColorsStatus } from "@/constants/ColorsStatus";
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetAnnouncement } from "@/lib/api";
|
import { apiGetAnnouncement } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { MaterialIcons } from "@expo/vector-icons";
|
import { MaterialIcons } from "@expo/vector-icons";
|
||||||
import { router } from "expo-router";
|
import { router } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
@@ -22,6 +23,7 @@ type Props = {
|
|||||||
|
|
||||||
export default function Announcement() {
|
export default function Announcement() {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const update = useSelector((state: any) => state.announcementUpdate)
|
const update = useSelector((state: any) => state.announcementUpdate)
|
||||||
@@ -83,11 +85,11 @@ export default function Announcement() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
<InputSearch onChange={setSearch} />
|
<InputSearch onChange={setSearch} />
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }, Styles.mt05]}>
|
<View style={[Styles.flex2, Styles.mt05]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
arrSkeleton.map((item, index) => {
|
arrSkeleton.map((item, index) => {
|
||||||
@@ -108,10 +110,11 @@ export default function Announcement() {
|
|||||||
key={index}
|
key={index}
|
||||||
onPress={() => { router.push(`/announcement/${item.id}`) }}
|
onPress={() => { router.push(`/announcement/${item.id}`) }}
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
|
bgColor="transparent"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
|
// <View style={[Styles.iconContent]}>
|
||||||
<MaterialIcons name="campaign" size={25} color={'#384288'} />
|
<MaterialIcons name="campaign" size={25} color={colors.text} />
|
||||||
</View>
|
// </View>
|
||||||
}
|
}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
desc={item.desc.replace(/<[^>]*>?/gm, '').replace(/\r?\n|\r/g, ' ')}
|
desc={item.desc.replace(/<[^>]*>?/gm, '').replace(/\r?\n|\r/g, ' ')}
|
||||||
@@ -127,11 +130,12 @@ export default function Announcement() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada pengumuman</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada pengumuman</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Entypo } from "@expo/vector-icons";
|
import { Entypo } from "@expo/vector-icons";
|
||||||
import * as ImagePicker from "expo-image-picker";
|
import * as ImagePicker from "expo-image-picker";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
@@ -24,6 +26,7 @@ import { useDispatch } from "react-redux";
|
|||||||
export default function EditBanner() {
|
export default function EditBanner() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { decryptToken, token } = useAuthSession();
|
const { decryptToken, token } = useAuthSession();
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const [selectedImage, setSelectedImage] = useState<
|
const [selectedImage, setSelectedImage] = useState<
|
||||||
string | undefined | { uri: string }
|
string | undefined | { uri: string }
|
||||||
@@ -112,7 +115,7 @@ export default function EditBanner() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -143,7 +146,8 @@ export default function EditBanner() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
{loading && <LoadingCenter />}
|
||||||
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
{selectedImage != undefined ? (
|
{selectedImage != undefined ? (
|
||||||
@@ -154,7 +158,7 @@ export default function EditBanner() {
|
|||||||
? selectedImage
|
? selectedImage
|
||||||
: selectedImage.uri
|
: selectedImage.uri
|
||||||
}
|
}
|
||||||
style={{ resizeMode: "contain", width: "100%", height: 100 }}
|
style={[Styles.resizeContain, Styles.w100, { height: 100 }]}
|
||||||
/>
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
) : (
|
) : (
|
||||||
@@ -163,7 +167,7 @@ export default function EditBanner() {
|
|||||||
style={[Styles.wrapPaper, Styles.contentItemCenter]}
|
style={[Styles.wrapPaper, Styles.contentItemCenter]}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{ justifyContent: "center", alignItems: "center" }}
|
style={[Styles.contentItemCenter]}
|
||||||
>
|
>
|
||||||
<Entypo name="image" size={50} color={"#aeaeae"} />
|
<Entypo name="image" size={50} color={"#aeaeae"} />
|
||||||
<Text style={[Styles.textInformation, Styles.mt05]}>
|
<Text style={[Styles.textInformation, Styles.mt05]}>
|
||||||
@@ -179,7 +183,7 @@ export default function EditBanner() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul"
|
placeholder="Judul"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={title}
|
value={title}
|
||||||
error={error}
|
error={error}
|
||||||
onChange={onValidate}
|
onChange={onValidate}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
import Text from "@/components/Text";
|
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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Entypo } from "@expo/vector-icons";
|
import { Entypo } from "@expo/vector-icons";
|
||||||
import * as ImagePicker from "expo-image-picker";
|
import * as ImagePicker from "expo-image-picker";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
@@ -22,6 +24,7 @@ import { useDispatch } from "react-redux";
|
|||||||
|
|
||||||
export default function CreateBanner() {
|
export default function CreateBanner() {
|
||||||
const { decryptToken, token } = useAuthSession();
|
const { decryptToken, token } = useAuthSession();
|
||||||
|
const { colors } = useTheme();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [selectedImage, setSelectedImage] = useState<string | undefined>(
|
const [selectedImage, setSelectedImage] = useState<string | undefined>(
|
||||||
undefined
|
undefined
|
||||||
@@ -94,27 +97,11 @@ export default function CreateBanner() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
|
||||||
// <ButtonBackHeader
|
|
||||||
// onPress={() => {
|
|
||||||
// router.back();
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
headerTitle: "Tambah Banner",
|
headerTitle: "Tambah Banner",
|
||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
// headerRight: () => (
|
|
||||||
// <ButtonSaveHeader
|
|
||||||
// disable={title == "" || selectedImage == undefined || error || loading ? true : false}
|
|
||||||
// category="create"
|
|
||||||
// onPress={() => {
|
|
||||||
// handleCreateEntity();
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
header: () => (
|
header: () => (
|
||||||
<AppHeader
|
<AppHeader
|
||||||
title="Fitur"
|
title="Fitur"
|
||||||
@@ -133,26 +120,27 @@ export default function CreateBanner() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
{loading && <LoadingCenter />}
|
||||||
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
{selectedImage != undefined ? (
|
{selectedImage != undefined ? (
|
||||||
<Pressable onPress={pickImageAsync}>
|
<Pressable onPress={pickImageAsync}>
|
||||||
<Image
|
<Image
|
||||||
src={selectedImage}
|
src={selectedImage}
|
||||||
style={{ resizeMode: "contain", width: "100%", height: 100 }}
|
style={[Styles.resizeContain, Styles.w100, { height: 100 }]}
|
||||||
/>
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
) : (
|
) : (
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={pickImageAsync}
|
onPress={pickImageAsync}
|
||||||
style={[Styles.wrapPaper, Styles.contentItemCenter]}
|
style={[Styles.wrapPaper, Styles.contentItemCenter, Styles.borderAll, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{ justifyContent: "center", alignItems: "center" }}
|
style={[Styles.contentItemCenter]}
|
||||||
>
|
>
|
||||||
<Entypo name="image" size={50} color={"#aeaeae"} />
|
<Entypo name="image" size={50} color={colors.dimmed} />
|
||||||
<Text style={[Styles.textInformation, Styles.mt05]}>
|
<Text style={[Styles.textInformation, Styles.mt05, { color: colors.dimmed }]}>
|
||||||
Mohon unggah gambar dalam resolusi 1650 x 720 pixel untuk
|
Mohon unggah gambar dalam resolusi 1650 x 720 pixel untuk
|
||||||
memastikan
|
memastikan
|
||||||
</Text>
|
</Text>
|
||||||
@@ -165,7 +153,7 @@ export default function CreateBanner() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul"
|
placeholder="Judul"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
onChange={onValidate}
|
onChange={onValidate}
|
||||||
error={error}
|
error={error}
|
||||||
errorText="Judul harus diisi"
|
errorText="Judul harus diisi"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi"
|
|
||||||
import AppHeader from "@/components/AppHeader"
|
import AppHeader from "@/components/AppHeader"
|
||||||
import HeaderRightBannerList from "@/components/banner/headerBannerList"
|
import HeaderRightBannerList from "@/components/banner/headerBannerList"
|
||||||
import BorderBottomItem from "@/components/borderBottomItem"
|
import BorderBottomItem from "@/components/borderBottomItem"
|
||||||
import DrawerBottom from "@/components/drawerBottom"
|
import DrawerBottom from "@/components/drawerBottom"
|
||||||
import MenuItemRow from "@/components/menuItemRow"
|
import MenuItemRow from "@/components/menuItemRow"
|
||||||
|
import ModalConfirmation from "@/components/ModalConfirmation"
|
||||||
import ModalLoading from "@/components/modalLoading"
|
import ModalLoading from "@/components/modalLoading"
|
||||||
import Text from "@/components/Text"
|
import Text from "@/components/Text"
|
||||||
import { ConstEnv } from "@/constants/ConstEnv"
|
import { ConstEnv } from "@/constants/ConstEnv"
|
||||||
@@ -11,6 +11,7 @@ import Styles from "@/constants/Styles"
|
|||||||
import { apiDeleteBanner, apiGetBanner } from "@/lib/api"
|
import { apiDeleteBanner, apiGetBanner } from "@/lib/api"
|
||||||
import { setEntities } from "@/lib/bannerSlice"
|
import { setEntities } from "@/lib/bannerSlice"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
||||||
import * as FileSystem from 'expo-file-system'
|
import * as FileSystem from 'expo-file-system'
|
||||||
import { startActivityAsync } from 'expo-intent-launcher'
|
import { startActivityAsync } from 'expo-intent-launcher'
|
||||||
@@ -32,6 +33,7 @@ type Props = {
|
|||||||
|
|
||||||
export default function BannerList() {
|
export default function BannerList() {
|
||||||
const { decryptToken, token } = useAuthSession()
|
const { decryptToken, token } = useAuthSession()
|
||||||
|
const { colors } = useTheme()
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
const entities = useSelector((state: any) => state.banner)
|
const entities = useSelector((state: any) => state.banner)
|
||||||
const [dataId, setDataId] = useState('')
|
const [dataId, setDataId] = useState('')
|
||||||
@@ -40,6 +42,7 @@ export default function BannerList() {
|
|||||||
const [refreshing, setRefreshing] = useState(false)
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||||
const [viewImg, setViewImg] = useState(false)
|
const [viewImg, setViewImg] = useState(false)
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
|
|
||||||
const handleDeleteEntity = async () => {
|
const handleDeleteEntity = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -105,7 +108,7 @@ export default function BannerList() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -130,9 +133,10 @@ export default function BannerList() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
entities.length > 0
|
entities.length > 0
|
||||||
@@ -154,13 +158,12 @@ export default function BannerList() {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
title={index.title}
|
title={index.title}
|
||||||
width={65}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
:
|
:
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter]}>Tidak ada data</Text>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +173,7 @@ export default function BannerList() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} 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={colors.text} size={25} />}
|
||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
@@ -178,7 +181,7 @@ export default function BannerList() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="file-eye" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="file-eye" color={colors.text} size={25} />}
|
||||||
title="Lihat"
|
title="Lihat"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
@@ -189,15 +192,13 @@ export default function BannerList() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
AlertKonfirmasi({
|
setTimeout(() => {
|
||||||
title: 'Konfirmasi',
|
setShowDeleteModal(true)
|
||||||
desc: 'Apakah anda yakin ingin menghapus data?',
|
}, 600)
|
||||||
onPress: () => { handleDeleteEntity() }
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -210,6 +211,19 @@ export default function BannerList() {
|
|||||||
onRequestClose={() => setViewImg(false)}
|
onRequestClose={() => setViewImg(false)}
|
||||||
doubleTapToZoomEnabled
|
doubleTapToZoomEnabled
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah anda yakin ingin menghapus data?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDeleteEntity()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Hapus"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
|
||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
import BorderBottomItem2 from "@/components/borderBottomItem2";
|
import BorderBottomItem2 from "@/components/borderBottomItem2";
|
||||||
@@ -8,16 +7,17 @@ import ImageUser from "@/components/imageNew";
|
|||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
|
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
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 Text from '@/components/Text';
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
|
||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
import { regexOnlySpacesOrEnter } from "@/constants/OnlySpaceOrEnter";
|
import { regexOnlySpacesOrEnter } from "@/constants/OnlySpaceOrEnter";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiDeleteDiscussionGeneralCommentar, apiGetDiscussionGeneralOne, apiSendDiscussionGeneralCommentar, apiUpdateDiscussionGeneralCommentar } from "@/lib/api";
|
import { apiDeleteDiscussionGeneralCommentar, apiGetDiscussionGeneralOne, apiSendDiscussionGeneralCommentar, apiUpdateDiscussionGeneralCommentar } from "@/lib/api";
|
||||||
import { getDB } from "@/lib/firebaseDatabase";
|
import { getDB } from "@/lib/firebaseDatabase";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
import { Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||||
import { ref } from '@react-native-firebase/database';
|
import { ref } from '@react-native-firebase/database';
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
@@ -56,6 +56,7 @@ type PropsFile = {
|
|||||||
|
|
||||||
export default function DetailDiscussionGeneral() {
|
export default function DetailDiscussionGeneral() {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const entities = useSelector((state: any) => state.entities)
|
const entities = useSelector((state: any) => state.entities)
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
@@ -79,6 +80,7 @@ export default function DetailDiscussionGeneral() {
|
|||||||
comment: ''
|
comment: ''
|
||||||
})
|
})
|
||||||
const [viewEdit, setViewEdit] = useState(false)
|
const [viewEdit, setViewEdit] = useState(false)
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onValueChange = reference.on('value', snapshot => {
|
const onValueChange = reference.on('value', snapshot => {
|
||||||
@@ -237,14 +239,15 @@ export default function DetailDiscussionGeneral() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={() => handleRefresh()}
|
onRefresh={() => handleRefresh()}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -256,10 +259,11 @@ export default function DetailDiscussionGeneral() {
|
|||||||
<BorderBottomItem2
|
<BorderBottomItem2
|
||||||
dataFile={fileDiscussion}
|
dataFile={fileDiscussion}
|
||||||
descEllipsize={false}
|
descEllipsize={false}
|
||||||
borderType="bottom"
|
borderType="all"
|
||||||
|
bgColor="white"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
|
<View style={[Styles.iconContent]}>
|
||||||
<MaterialIcons name="chat" size={25} color={'#384288'} />
|
<MaterialIcons name="chat" size={25} color={'black'} />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
title={data?.title}
|
title={data?.title}
|
||||||
@@ -273,18 +277,18 @@ export default function DetailDiscussionGeneral() {
|
|||||||
desc={data?.desc}
|
desc={data?.desc}
|
||||||
leftBottomInfo={
|
leftBottomInfo={
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<Ionicons name="chatbox-ellipses-outline" size={18} color="grey" style={Styles.mr05} />
|
<Ionicons name="chatbox-ellipses-outline" size={18} color={colors.dimmed} style={Styles.mr05} />
|
||||||
<Text style={[Styles.textInformation, Styles.cGray, Styles.mb05]}>{dataKomentar.length} Komentar</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>{dataKomentar.length} Komentar</Text>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
rightBottomInfo={
|
rightBottomInfo={
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<Text style={[Styles.textInformation, Styles.cGray, Styles.mb05]}>{data?.createdAt}</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>{data?.createdAt}</Text>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loadingKomentar ?
|
loadingKomentar ?
|
||||||
arrSkeleton.map((item: any, i: number) => {
|
arrSkeleton.map((item: any, i: number) => {
|
||||||
@@ -297,7 +301,7 @@ export default function DetailDiscussionGeneral() {
|
|||||||
return (
|
return (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={i}
|
key={i}
|
||||||
borderType="bottom"
|
borderType="all"
|
||||||
colorPress
|
colorPress
|
||||||
icon={
|
icon={
|
||||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||||
@@ -307,6 +311,7 @@ export default function DetailDiscussionGeneral() {
|
|||||||
desc={item.comment}
|
desc={item.comment}
|
||||||
rightBottomInfo={item.isEdited ? "Edited" : ""}
|
rightBottomInfo={item.isEdited ? "Edited" : ""}
|
||||||
descEllipsize={detailMore.includes(item.id) ? false : true}
|
descEllipsize={detailMore.includes(item.id) ? false : true}
|
||||||
|
bgColor="white"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setDetailMore((prev: any) => {
|
setDetailMore((prev: any) => {
|
||||||
if (prev.includes(item.id)) {
|
if (prev.includes(item.id)) {
|
||||||
@@ -333,7 +338,7 @@ export default function DetailDiscussionGeneral() {
|
|||||||
<View style={[
|
<View style={[
|
||||||
Styles.contentItemCenter,
|
Styles.contentItemCenter,
|
||||||
Styles.w100,
|
Styles.w100,
|
||||||
{ backgroundColor: "#f4f4f4" },
|
{ backgroundColor: colors.background },
|
||||||
viewEdit && Styles.borderTop
|
viewEdit && Styles.borderTop
|
||||||
]}>
|
]}>
|
||||||
{
|
{
|
||||||
@@ -341,11 +346,11 @@ export default function DetailDiscussionGeneral() {
|
|||||||
<>
|
<>
|
||||||
<View style={[Styles.w90, Styles.rowSpaceBetween, Styles.pv05]}>
|
<View style={[Styles.w90, Styles.rowSpaceBetween, Styles.pv05]}>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<Feather name="edit-3" color="black" size={22} style={[Styles.mh05]} />
|
<Feather name="edit-3" color={colors.text} size={22} style={[Styles.mh05]} />
|
||||||
<Text style={[Styles.textMediumSemiBold]}>Edit Komentar</Text>
|
<Text style={[Styles.textMediumSemiBold]}>Edit Komentar</Text>
|
||||||
</View>
|
</View>
|
||||||
<Pressable onPress={() => handleViewEditKomentar()}>
|
<Pressable onPress={() => handleViewEditKomentar()}>
|
||||||
<MaterialIcons name="close" color="black" size={22} />
|
<MaterialIcons name="close" color={colors.text} size={22} />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -353,7 +358,6 @@ export default function DetailDiscussionGeneral() {
|
|||||||
type="default"
|
type="default"
|
||||||
round
|
round
|
||||||
placeholder="Kirim Komentar"
|
placeholder="Kirim Komentar"
|
||||||
bg="white"
|
|
||||||
onChange={(val: string) => setSelectKomentar({ ...selectKomentar, comment: val })}
|
onChange={(val: string) => setSelectKomentar({ ...selectKomentar, comment: val })}
|
||||||
value={selectKomentar.comment}
|
value={selectKomentar.comment}
|
||||||
multiline
|
multiline
|
||||||
@@ -367,7 +371,7 @@ export default function DetailDiscussionGeneral() {
|
|||||||
Platform.OS == 'android' && Styles.mb12,
|
Platform.OS == 'android' && Styles.mb12,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || selectKomentar.comment == '' || regexOnlySpacesOrEnter.test(selectKomentar.comment) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? Styles.cGray : Styles.cDefault} />
|
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || selectKomentar.comment == '' || regexOnlySpacesOrEnter.test(selectKomentar.comment) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? { color: colors.dimmed } : { color: colors.tint }} />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -380,7 +384,6 @@ export default function DetailDiscussionGeneral() {
|
|||||||
type="default"
|
type="default"
|
||||||
round
|
round
|
||||||
placeholder="Kirim Komentar"
|
placeholder="Kirim Komentar"
|
||||||
bg="white"
|
|
||||||
onChange={setKomentar}
|
onChange={setKomentar}
|
||||||
value={komentar}
|
value={komentar}
|
||||||
multiline
|
multiline
|
||||||
@@ -394,13 +397,13 @@ export default function DetailDiscussionGeneral() {
|
|||||||
Platform.OS == 'android' && Styles.mb12,
|
Platform.OS == 'android' && Styles.mb12,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || komentar == '' || regexOnlySpacesOrEnter.test(komentar) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? Styles.cGray : Styles.cDefault} />
|
<MaterialIcons name="send" size={25} style={(loadingSendKomentar || komentar == '' || regexOnlySpacesOrEnter.test(komentar) || data?.status === 2 || !data?.isActive || (!memberDiscussion && (entityUser.role == "user" || entityUser.role == "coadmin"))) ? { color: colors.dimmed } : { color: colors.tint }} />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<View style={[Styles.pv20, { alignItems: 'center' }]}>
|
<View style={[Styles.pv20, Styles.itemsCenter]}>
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>
|
||||||
{
|
{
|
||||||
data?.status == 2 ? "Diskusi telah ditutup" : data?.isActive == false ? "Diskusi telah diarsipkan" : "Hanya anggota diskusi yang dapat memberikan komentar"
|
data?.status == 2 ? "Diskusi telah ditutup" : data?.isActive == false ? "Diskusi telah diarsipkan" : "Hanya anggota diskusi yang dapat memberikan komentar"
|
||||||
}
|
}
|
||||||
@@ -415,25 +418,35 @@ export default function DetailDiscussionGeneral() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Komentar">
|
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Komentar">
|
||||||
<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={colors.text} size={25} />}
|
||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => { handleViewEditKomentar() }}
|
onPress={() => { handleViewEditKomentar() }}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialIcons name="delete" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
AlertKonfirmasi({
|
setVisible(false)
|
||||||
title: 'Konfirmasi',
|
setTimeout(() => {
|
||||||
desc: 'Apakah anda yakin ingin menghapus komentar?',
|
setShowDeleteModal(true)
|
||||||
onPress: () => {
|
}, 600)
|
||||||
handleDeleteKomentar()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah anda yakin ingin menghapus komentar?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDeleteKomentar()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Hapus"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiAddMemberDiscussionGeneral, apiGetDiscussionGeneralOne, apiGetUser } from "@/lib/api";
|
import { apiAddMemberDiscussionGeneral, apiGetDiscussionGeneralOne, apiGetUser } from "@/lib/api";
|
||||||
import { setUpdateDiscussionGeneralDetail } from "@/lib/discussionGeneralDetail";
|
import { setUpdateDiscussionGeneralDetail } from "@/lib/discussionGeneralDetail";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -26,6 +27,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [dataOld, setDataOld] = useState<Props[]>([])
|
const [dataOld, setDataOld] = useState<Props[]>([])
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
@@ -92,7 +94,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -125,7 +127,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<InputSearch onChange={setSearch} value={search} />
|
<InputSearch onChange={setSearch} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -147,7 +149,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -160,7 +162,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal, { borderColor: colors.icon + '20' }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
!found && onChoose(item.id, item.name, item.img)
|
!found && onChoose(item.id, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
@@ -170,22 +172,22 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]}>{item.name}</Text>
|
<Text style={[Styles.textDefault]}>{item.name}</Text>
|
||||||
{
|
{
|
||||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
found && <Text style={[Styles.textInformation, { color: colors.dimmed }]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import ButtonSelect from "@/components/buttonSelect";
|
|||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import LoadingOverlay from "@/components/loadingOverlay";
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import ModalSelect from "@/components/modalSelect";
|
import ModalSelect from "@/components/modalSelect";
|
||||||
import SelectForm from "@/components/selectForm";
|
import SelectForm from "@/components/selectForm";
|
||||||
@@ -16,6 +16,7 @@ import { apiCreateDiscussionGeneral } from "@/lib/api";
|
|||||||
import { setUpdateDiscussionGeneralDetail } from "@/lib/discussionGeneralDetail";
|
import { setUpdateDiscussionGeneralDetail } from "@/lib/discussionGeneralDetail";
|
||||||
import { setMemberChoose } from "@/lib/memberChoose";
|
import { setMemberChoose } from "@/lib/memberChoose";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import * as DocumentPicker from "expo-document-picker";
|
import * as DocumentPicker from "expo-document-picker";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
@@ -27,6 +28,7 @@ import { useDispatch, useSelector } from "react-redux";
|
|||||||
|
|
||||||
export default function CreateDiscussionGeneral() {
|
export default function CreateDiscussionGeneral() {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const entityUser = useSelector((state: any) => state.user);
|
const entityUser = useSelector((state: any) => state.user);
|
||||||
const userLogin = useSelector((state: any) => state.entities)
|
const userLogin = useSelector((state: any) => state.entities)
|
||||||
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
||||||
@@ -163,7 +165,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -204,8 +206,8 @@ export default function CreateDiscussionGeneral() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<LoadingOverlay visible={loading} />
|
{loading && <LoadingCenter />}
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
{
|
{
|
||||||
(entityUser.role == "supadmin" ||
|
(entityUser.role == "supadmin" ||
|
||||||
@@ -215,6 +217,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
placeholder="Pilih Lembaga Desa"
|
placeholder="Pilih Lembaga Desa"
|
||||||
value={chooseGroup.label}
|
value={chooseGroup.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(chooseGroup.val);
|
setValChoose(chooseGroup.val);
|
||||||
setValSelect("group");
|
setValSelect("group");
|
||||||
@@ -231,6 +234,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
placeholder="Judul"
|
placeholder="Judul"
|
||||||
required
|
required
|
||||||
error={error.title}
|
error={error.title}
|
||||||
|
bg={colors.card}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
onChange={(val) => { validationForm("title", val) }}
|
onChange={(val) => { validationForm("title", val) }}
|
||||||
/>
|
/>
|
||||||
@@ -240,6 +244,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
placeholder="Hal yang didiskusikan"
|
placeholder="Hal yang didiskusikan"
|
||||||
required
|
required
|
||||||
error={error.desc}
|
error={error.desc}
|
||||||
|
bg={colors.card}
|
||||||
errorText="Diskusi tidak boleh kosong"
|
errorText="Diskusi tidak boleh kosong"
|
||||||
onChange={(val) => { validationForm("desc", val) }}
|
onChange={(val) => { validationForm("desc", val) }}
|
||||||
multiline
|
multiline
|
||||||
@@ -248,21 +253,27 @@ export default function CreateDiscussionGeneral() {
|
|||||||
{
|
{
|
||||||
fileForm.length > 0
|
fileForm.length > 0
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
<>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
{
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
fileForm.map((item, index) => (
|
<Text style={[Styles.textDefault]}>{fileForm.length} file</Text>
|
||||||
<BorderBottomItem
|
</View>
|
||||||
key={index}
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
||||||
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
{
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
fileForm.map((item, index) => (
|
||||||
title={item.name}
|
<BorderBottomItem
|
||||||
titleWeight="normal"
|
key={index}
|
||||||
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
borderType={fileForm.length - 1 == index ? "none" : "bottom"}
|
||||||
/>
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
))
|
title={item.name}
|
||||||
}
|
bgColor="transparent"
|
||||||
</View>
|
titleWeight="normal"
|
||||||
|
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
<ButtonSelect
|
<ButtonSelect
|
||||||
value="Pilih Anggota"
|
value="Pilih Anggota"
|
||||||
@@ -287,21 +298,22 @@ export default function CreateDiscussionGeneral() {
|
|||||||
entitiesMember.length > 0 &&
|
entitiesMember.length > 0 &&
|
||||||
<View>
|
<View>
|
||||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
<Text>Anggota</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>Anggota</Text>
|
||||||
<Text>Total {entitiesMember.length} Anggota</Text>
|
<Text style={[Styles.textDefault]}>{entitiesMember.length} Anggota</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
entitiesMember.map((item: { img: any; name: any; }, index: any) => {
|
entitiesMember.map((item: { img: any; name: any; }, index: any) => {
|
||||||
return (
|
return (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType="bottom"
|
borderType={entitiesMember.length - 1 == index ? "none" : "bottom"}
|
||||||
icon={
|
icon={
|
||||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="sm" />
|
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||||
}
|
}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
|
bgColor="transparent"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@@ -327,7 +339,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ 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 { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import LoadingOverlay from "@/components/loadingOverlay";
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditDiscussionGeneral, apiGetDiscussionGeneralOne } from "@/lib/api";
|
import { apiEditDiscussionGeneral, apiGetDiscussionGeneralOne } from "@/lib/api";
|
||||||
import { setUpdateDiscussionGeneralDetail } from "@/lib/discussionGeneralDetail";
|
import { setUpdateDiscussionGeneralDetail } from "@/lib/discussionGeneralDetail";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
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";
|
||||||
@@ -21,6 +22,7 @@ import { useDispatch, useSelector } from "react-redux";
|
|||||||
|
|
||||||
export default function EditDiscussionGeneral() {
|
export default function EditDiscussionGeneral() {
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const [disableBtn, setDisableBtn] = useState(false)
|
const [disableBtn, setDisableBtn] = useState(false)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
@@ -162,7 +164,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -197,14 +199,15 @@ export default function EditDiscussionGeneral() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<LoadingOverlay visible={loading} />
|
{loading && <LoadingCenter />}
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul"
|
label="Judul"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul"
|
placeholder="Judul"
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
value={dataForm.title}
|
value={dataForm.title}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
@@ -215,6 +218,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Hal yang didiskusikan"
|
placeholder="Hal yang didiskusikan"
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
error={error.desc}
|
error={error.desc}
|
||||||
value={dataForm.desc}
|
value={dataForm.desc}
|
||||||
errorText="Diskusi tidak boleh kosong"
|
errorText="Diskusi tidak boleh kosong"
|
||||||
@@ -225,33 +229,40 @@ export default function EditDiscussionGeneral() {
|
|||||||
{
|
{
|
||||||
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
<>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||||
{
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
dataFile.filter((val) => !val.delete).map((item, index) => (
|
<Text style={[Styles.textDefault]}>{fileForm.length + dataFile.filter((val) => !val.delete).length} file</Text>
|
||||||
<BorderBottomItem
|
</View>
|
||||||
key={index}
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.icon + '20' }]}>
|
||||||
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
{
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
dataFile.filter((val) => !val.delete).map((item, index) => (
|
||||||
title={item.name + '.' + item.extension}
|
<BorderBottomItem
|
||||||
titleWeight="normal"
|
key={index}
|
||||||
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
borderType={dataFile.filter((val) => !val.delete).length - 1 == index && fileForm.length == 0 ? "none" : "bottom"}
|
||||||
/>
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
))
|
title={item.name + '.' + item.extension}
|
||||||
}
|
titleWeight="normal"
|
||||||
{
|
bgColor="transparent"
|
||||||
fileForm.map((item, index) => (
|
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
||||||
<BorderBottomItem
|
/>
|
||||||
key={index}
|
))
|
||||||
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
}
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
{
|
||||||
title={item.name}
|
fileForm.map((item, index) => (
|
||||||
titleWeight="normal"
|
<BorderBottomItem
|
||||||
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
key={index}
|
||||||
/>
|
borderType={fileForm.length - 1 == index ? "none" : "bottom"}
|
||||||
))
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
}
|
title={item.name}
|
||||||
</View>
|
titleWeight="normal"
|
||||||
|
bgColor="transparent"
|
||||||
|
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -259,7 +270,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile.id, indexDelFile.cat) }}
|
onPress={() => { deleteFile(indexDelFile.id, indexDelFile.cat) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ 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 Text from "@/components/Text";
|
||||||
|
import WrapTab from "@/components/wrapTab";
|
||||||
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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -27,6 +29,7 @@ type Props = {
|
|||||||
export default function Discussion() {
|
export default function Discussion() {
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const [nameGroup, setNameGroup] = useState('')
|
const [nameGroup, setNameGroup] = useState('')
|
||||||
@@ -96,26 +99,26 @@ export default function Discussion() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
{
|
{
|
||||||
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="true"
|
value="true"
|
||||||
onPress={() => { setStatus("true") }}
|
onPress={() => { setStatus("true") }}
|
||||||
label="Aktif"
|
label="Aktif"
|
||||||
icon={<Feather name="check-circle" color={status == "false" ? 'black' : 'white'} size={20} />}
|
icon={<Feather name="check-circle" color={status == "false" ? colors.dimmed : 'white'} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="false"
|
value="false"
|
||||||
onPress={() => { setStatus("false") }}
|
onPress={() => { setStatus("false") }}
|
||||||
label="Arsip"
|
label="Arsip"
|
||||||
icon={<AntDesign name="closecircleo" color={status == "true" ? 'black' : 'white'} size={20} />}
|
icon={<AntDesign name="closecircleo" color={status == "true" ? colors.dimmed : 'white'} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
</View>
|
</WrapTab>
|
||||||
}
|
}
|
||||||
|
|
||||||
<InputSearch onChange={setSearch} />
|
<InputSearch onChange={setSearch} />
|
||||||
@@ -127,7 +130,7 @@ export default function Discussion() {
|
|||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }, Styles.mt05]}>
|
<View style={[Styles.flex2, Styles.mt05]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
arrSkeleton.map((item: any, i: number) => {
|
arrSkeleton.map((item: any, i: number) => {
|
||||||
@@ -145,13 +148,14 @@ export default function Discussion() {
|
|||||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||||
return (
|
return (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
|
bgColor="transparent"
|
||||||
key={index}
|
key={index}
|
||||||
onPress={() => { router.push(`/discussion/${item.id}`) }}
|
onPress={() => { router.push(`/discussion/${item.id}`) }}
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
|
// <View style={[Styles.iconContent]}>
|
||||||
<MaterialIcons name="chat" size={25} color={'#384288'} />
|
<MaterialIcons name="chat" size={25} color={colors.text} />
|
||||||
</View>
|
// </View>
|
||||||
}
|
}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
subtitle={
|
subtitle={
|
||||||
@@ -161,8 +165,8 @@ export default function Discussion() {
|
|||||||
desc={item.desc.replace(/<[^>]*>?/gm, ' ').replace(/\r?\n|\r/g, ' ')}
|
desc={item.desc.replace(/<[^>]*>?/gm, ' ').replace(/\r?\n|\r/g, ' ')}
|
||||||
leftBottomInfo={
|
leftBottomInfo={
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<Ionicons name="chatbox-ellipses-outline" size={18} color="grey" style={Styles.mr05} />
|
<Ionicons name="chatbox-ellipses-outline" size={18} color={colors.dimmed} style={Styles.mr05} />
|
||||||
<Text style={[Styles.textInformation, Styles.cGray, Styles.mb05]}>Diskusikan</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>Diskusikan</Text>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
rightBottomInfo={`${item.total_komentar} Komentar`}
|
rightBottomInfo={`${item.total_komentar} Komentar`}
|
||||||
@@ -178,11 +182,12 @@ export default function Discussion() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
|
||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
import DrawerBottom from "@/components/drawerBottom";
|
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 ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
import Text from '@/components/Text';
|
import Text from '@/components/Text';
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
@@ -11,6 +11,7 @@ import { ConstEnv } from "@/constants/ConstEnv";
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiDeleteMemberDiscussionGeneral, apiGetDiscussionGeneralOne } from "@/lib/api";
|
import { apiDeleteMemberDiscussionGeneral, apiGetDiscussionGeneralOne } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -26,6 +27,7 @@ type Props = {
|
|||||||
|
|
||||||
export default function MemberDiscussionDetail() {
|
export default function MemberDiscussionDetail() {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
@@ -34,6 +36,8 @@ export default function MemberDiscussionDetail() {
|
|||||||
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
const arrSkeleton = Array.from({ length: 5 }, (_, index) => index)
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
async function handleLoad(loading: boolean) {
|
async function handleLoad(loading: boolean) {
|
||||||
try {
|
try {
|
||||||
@@ -71,7 +75,7 @@ export default function MemberDiscussionDetail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -86,10 +90,10 @@ export default function MemberDiscussionDetail() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView style={[Styles.h100, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<Text style={[Styles.textDefault, Styles.mv05]}>{data.length} Anggota</Text>
|
<Text style={[Styles.textDefault, Styles.mv05]}>{data.length} Anggota</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.mb100]}>
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
@@ -135,7 +139,7 @@ export default function MemberDiscussionDetail() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title={chooseUser.name}>
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title={chooseUser.name}>
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="account-eye" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="account-eye" color={colors.text} size={25} />}
|
||||||
title="Lihat Profil"
|
title="Lihat Profil"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
@@ -145,24 +149,32 @@ export default function MemberDiscussionDetail() {
|
|||||||
{
|
{
|
||||||
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
entityUser.role != "user" && entityUser.role != "coadmin" &&
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="account-remove" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="account-remove" color={colors.text} size={25} />}
|
||||||
title="Keluarkan"
|
title="Keluarkan"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
AlertKonfirmasi({
|
setTimeout(() => {
|
||||||
title: 'Konfirmasi',
|
setShowDeleteModal(true)
|
||||||
desc: 'Apakah Anda yakin ingin mengeluarkan anggota?',
|
}, 600)
|
||||||
onPress: () => {
|
|
||||||
handleDeleteUser()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah anda yakin ingin mengeluarkan anggota?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDeleteUser()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Hapus"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,7 @@ 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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -23,6 +24,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddMemberCalendarEvent() {
|
export default function AddMemberCalendarEvent() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.calendarUpdate)
|
const update = useSelector((state: any) => state.calendarUpdate)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -100,7 +102,7 @@ export default function AddMemberCalendarEvent() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -154,7 +156,7 @@ export default function AddMemberCalendarEvent() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -167,7 +169,7 @@ export default function AddMemberCalendarEvent() {
|
|||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal, {borderColor: colors.icon + '20'}]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
!found && onChoose(item.idUser, item.name, item.img)
|
!found && onChoose(item.idUser, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
@@ -177,12 +179,12 @@ export default function AddMemberCalendarEvent() {
|
|||||||
<View style={[Styles.ml10, { width: '80%' }]}>
|
<View style={[Styles.ml10, { width: '80%' }]}>
|
||||||
<Text numberOfLines={1} ellipsizeMode="tail" style={[Styles.textDefault]}>{item.name}</Text>
|
<Text numberOfLines={1} ellipsizeMode="tail" style={[Styles.textDefault]}>{item.name}</Text>
|
||||||
{
|
{
|
||||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
found && <Text style={[Styles.textInformation, { color: colors.dimmed }]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { valueTypeEventRepeat } from "@/constants/TypeEventRepeat"
|
|||||||
import { apiGetCalendarOne, apiUpdateCalendar } from "@/lib/api"
|
import { apiGetCalendarOne, apiUpdateCalendar } from "@/lib/api"
|
||||||
import { stringToDateTime } from "@/lib/fun_stringToDate"
|
import { stringToDateTime } from "@/lib/fun_stringToDate"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useHeaderHeight } from "@react-navigation/elements"
|
import { useHeaderHeight } from "@react-navigation/elements"
|
||||||
import { Stack, router, useLocalSearchParams } from "expo-router"
|
import { Stack, router, useLocalSearchParams } from "expo-router"
|
||||||
import moment from "moment"
|
import moment from "moment"
|
||||||
@@ -17,6 +18,7 @@ import { KeyboardAvoidingView, Platform, SafeAreaView, ScrollView, View } from "
|
|||||||
import Toast from "react-native-toast-message"
|
import Toast from "react-native-toast-message"
|
||||||
|
|
||||||
export default function EditEventCalendar() {
|
export default function EditEventCalendar() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [choose, setChoose] = useState({ val: "", label: "" })
|
const [choose, setChoose] = useState({ val: "", label: "" })
|
||||||
const [isSelect, setSelect] = useState(false)
|
const [isSelect, setSelect] = useState(false)
|
||||||
@@ -162,7 +164,7 @@ export default function EditEventCalendar() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -205,7 +207,7 @@ export default function EditEventCalendar() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Nama Acara"
|
placeholder="Nama Acara"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={data.title}
|
value={data.title}
|
||||||
onChange={(val) => validationForm("title", val)}
|
onChange={(val) => validationForm("title", val)}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
@@ -251,12 +253,12 @@ export default function EditEventCalendar() {
|
|||||||
label="Link Meet"
|
label="Link Meet"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Link Meet"
|
placeholder="Link Meet"
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={data.linkMeet}
|
value={data.linkMeet}
|
||||||
onChange={(val) => validationForm("linkMeet", val)}
|
onChange={(val) => validationForm("linkMeet", val)}
|
||||||
/>
|
/>
|
||||||
<SelectForm
|
<SelectForm
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
label="Ulangi Acara"
|
label="Ulangi Acara"
|
||||||
placeholder="Ulangi Acara"
|
placeholder="Ulangi Acara"
|
||||||
value={choose.label}
|
value={choose.label}
|
||||||
@@ -268,7 +270,7 @@ export default function EditEventCalendar() {
|
|||||||
type="numeric"
|
type="numeric"
|
||||||
placeholder="Jumlah Pengulangan"
|
placeholder="Jumlah Pengulangan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={String(data.repeatValue)}
|
value={String(data.repeatValue)}
|
||||||
onChange={(val) => validationForm("repeatValue", val)}
|
onChange={(val) => validationForm("repeatValue", val)}
|
||||||
error={error.repeatValue}
|
error={error.repeatValue}
|
||||||
@@ -279,7 +281,7 @@ export default function EditEventCalendar() {
|
|||||||
label="Deskripsi"
|
label="Deskripsi"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Deskripsi"
|
placeholder="Deskripsi"
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={data.desc}
|
value={data.desc}
|
||||||
onChange={(val) => validationForm("desc", val)}
|
onChange={(val) => validationForm("desc", val)}
|
||||||
multiline
|
multiline
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi"
|
import ModalConfirmation from "@/components/ModalConfirmation"
|
||||||
import AppHeader from "@/components/AppHeader"
|
import AppHeader from "@/components/AppHeader"
|
||||||
import BorderBottomItem from "@/components/borderBottomItem"
|
import BorderBottomItem from "@/components/borderBottomItem"
|
||||||
import ButtonBackHeader from "@/components/buttonBackHeader"
|
import ButtonBackHeader from "@/components/buttonBackHeader"
|
||||||
@@ -13,6 +13,7 @@ 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"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
import { MaterialCommunityIcons } from "@expo/vector-icons"
|
||||||
import Clipboard from "@react-native-clipboard/clipboard"
|
import Clipboard from "@react-native-clipboard/clipboard"
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router"
|
import { router, Stack, useLocalSearchParams } from "expo-router"
|
||||||
@@ -45,6 +46,7 @@ type PropsMember = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DetailEventCalendar() {
|
export default function DetailEventCalendar() {
|
||||||
|
const { colors } = useTheme()
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>();
|
||||||
const [data, setData] = useState<Props>()
|
const [data, setData] = useState<Props>()
|
||||||
const [member, setMember] = useState<PropsMember[]>([])
|
const [member, setMember] = useState<PropsMember[]>([])
|
||||||
@@ -55,6 +57,7 @@ export default function DetailEventCalendar() {
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
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 [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [refreshing, setRefreshing] = useState(false)
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
@@ -152,14 +155,14 @@ export default function DetailEventCalendar() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
headerTitle: 'Detail Acara',
|
headerTitle: 'Detail Acara',
|
||||||
headerTitleAlign: 'center',
|
headerTitleAlign: 'center',
|
||||||
// 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)} />
|
||||||
header:()=>(
|
header: () => (
|
||||||
<AppHeader
|
<AppHeader
|
||||||
title="Detail Acara"
|
title="Detail Acara"
|
||||||
showBack={true}
|
showBack={true}
|
||||||
@@ -177,13 +180,14 @@ export default function DetailEventCalendar() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.mb15]}>
|
<View style={[Styles.wrapPaper, Styles.mb15, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
<View style={[Styles.rowItemsCenter, { alignItems: 'flex-start' }]}>
|
<View style={[Styles.rowItemsCenter, { alignItems: 'flex-start' }]}>
|
||||||
<MaterialCommunityIcons name="calendar-text" size={30} color="black" style={Styles.mr10} />
|
<MaterialCommunityIcons name="calendar-text" size={30} color={colors.text} style={Styles.mr10} />
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
||||||
@@ -192,7 +196,7 @@ export default function DetailEventCalendar() {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
||||||
<MaterialCommunityIcons name="calendar-month-outline" size={30} color="black" style={Styles.mr10} />
|
<MaterialCommunityIcons name="calendar-month-outline" size={30} color={colors.text} style={Styles.mr10} />
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
||||||
@@ -201,7 +205,7 @@ export default function DetailEventCalendar() {
|
|||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
||||||
<MaterialCommunityIcons name="clock-outline" size={30} color="black" style={Styles.mr10} />
|
<MaterialCommunityIcons name="clock-outline" size={30} color={colors.text} style={Styles.mr10} />
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
||||||
@@ -210,7 +214,7 @@ export default function DetailEventCalendar() {
|
|||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
||||||
<MaterialCommunityIcons name="repeat" size={30} color="black" style={Styles.mr10} />
|
<MaterialCommunityIcons name="repeat" size={30} color={colors.text} style={Styles.mr10} />
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
||||||
@@ -228,7 +232,7 @@ export default function DetailEventCalendar() {
|
|||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
|
||||||
<MaterialCommunityIcons name="link-variant" size={30} color="black" style={Styles.mr10} />
|
<MaterialCommunityIcons name="link-variant" size={30} color={colors.text} style={Styles.mr10} />
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
||||||
@@ -241,7 +245,7 @@ export default function DetailEventCalendar() {
|
|||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowItemsCenter, Styles.mt10, { alignItems: 'flex-start' }]}>
|
<View style={[Styles.rowItemsCenter, Styles.mt10, { alignItems: 'flex-start' }]}>
|
||||||
<MaterialCommunityIcons name="card-text-outline" size={30} color="black" style={Styles.mr10} />
|
<MaterialCommunityIcons name="card-text-outline" size={30} color={colors.text} style={Styles.mr10} />
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
<Skeleton width={80} height={10} borderRadius={10} widthType="percent" />
|
||||||
@@ -257,7 +261,7 @@ export default function DetailEventCalendar() {
|
|||||||
<Text style={[Styles.textDefault]}>Total {member.length} Anggota</Text>
|
<Text style={[Styles.textDefault]}>Total {member.length} Anggota</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
member.map((item, index) => (
|
member.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
@@ -286,7 +290,7 @@ export default function DetailEventCalendar() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModalMember} setVisible={setModalMember} title={memberChoose.name}>
|
<DrawerBottom animation="slide" isVisible={isModalMember} setVisible={setModalMember} title={memberChoose.name}>
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="account-eye" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="account-eye" color={colors.text} size={25} />}
|
||||||
title="Lihat Profil"
|
title="Lihat Profil"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModalMember(false)
|
setModalMember(false)
|
||||||
@@ -295,22 +299,30 @@ export default function DetailEventCalendar() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="account-remove" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="account-remove" color={colors.text} size={25} />}
|
||||||
title="Keluarkan"
|
title="Keluarkan"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModalMember(false)
|
setModalMember(false)
|
||||||
AlertKonfirmasi({
|
setTimeout(() => {
|
||||||
title: 'Konfirmasi',
|
setShowDeleteModal(true)
|
||||||
desc: 'Apakah Anda yakin ingin mengeluarkan anggota?',
|
}, 600)
|
||||||
onPress: () => {
|
|
||||||
handleDeleteUser()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah Anda yakin ingin mengeluarkan anggota?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDeleteUser()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Keluar"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ import { apiCreateCalendar, apiGetDivisionMember } from "@/lib/api";
|
|||||||
import { setFormCreateCalendar } from "@/lib/calendarCreate";
|
import { setFormCreateCalendar } from "@/lib/calendarCreate";
|
||||||
import { setUpdateCalendar } from "@/lib/calendarUpdate";
|
import { setUpdateCalendar } from "@/lib/calendarUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -24,6 +25,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function CreateCalendarAddMember() {
|
export default function CreateCalendarAddMember() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
@@ -90,7 +92,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -141,7 +143,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -154,7 +156,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal, { borderColor: colors.icon + '20' }]}
|
||||||
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]}>
|
||||||
@@ -164,7 +166,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { setFormCreateCalendar } from "@/lib/calendarCreate";
|
import { setFormCreateCalendar } from "@/lib/calendarCreate";
|
||||||
import { stringToDateTime } from "@/lib/fun_stringToDate";
|
import { stringToDateTime } from "@/lib/fun_stringToDate";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Stack, router, useLocalSearchParams } from "expo-router";
|
import { Stack, router, useLocalSearchParams } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {
|
import {
|
||||||
@@ -21,6 +22,7 @@ import {
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CalendarDivisionCreate() {
|
export default function CalendarDivisionCreate() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [choose, setChoose] = useState({ val: "", label: "" })
|
const [choose, setChoose] = useState({ val: "", label: "" })
|
||||||
const [isSelect, setSelect] = useState(false)
|
const [isSelect, setSelect] = useState(false)
|
||||||
@@ -126,7 +128,7 @@ export default function CalendarDivisionCreate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -144,7 +146,7 @@ export default function CalendarDivisionCreate() {
|
|||||||
// disable={Object.values(error).some((val) => val == true) || data.title == "" || data.dateStart == "" || data.timeStart == "" || data.timeEnd == "" || data.repeatEventType == ""}
|
// disable={Object.values(error).some((val) => val == true) || data.title == "" || data.dateStart == "" || data.timeStart == "" || data.timeEnd == "" || data.repeatEventType == ""}
|
||||||
// />
|
// />
|
||||||
// ),
|
// ),
|
||||||
header:()=>(
|
header: () => (
|
||||||
<AppHeader
|
<AppHeader
|
||||||
title="Tambah Acara"
|
title="Tambah Acara"
|
||||||
showBack={true}
|
showBack={true}
|
||||||
@@ -173,7 +175,7 @@ export default function CalendarDivisionCreate() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Nama Acara"
|
placeholder="Nama Acara"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={data.title}
|
value={data.title}
|
||||||
onChange={(val) => validationForm("title", val)}
|
onChange={(val) => validationForm("title", val)}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
@@ -219,12 +221,12 @@ export default function CalendarDivisionCreate() {
|
|||||||
label="Link Meet"
|
label="Link Meet"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Link Meet"
|
placeholder="Link Meet"
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={data.linkMeet}
|
value={data.linkMeet}
|
||||||
onChange={(val) => validationForm("linkMeet", val)}
|
onChange={(val) => validationForm("linkMeet", val)}
|
||||||
/>
|
/>
|
||||||
<SelectForm
|
<SelectForm
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
label="Ulangi Acara"
|
label="Ulangi Acara"
|
||||||
placeholder="Ulangi Acara"
|
placeholder="Ulangi Acara"
|
||||||
value={choose.label}
|
value={choose.label}
|
||||||
@@ -236,7 +238,7 @@ export default function CalendarDivisionCreate() {
|
|||||||
type="numeric"
|
type="numeric"
|
||||||
placeholder="Jumlah Pengulangan"
|
placeholder="Jumlah Pengulangan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={String(data.repeatValue)}
|
value={String(data.repeatValue)}
|
||||||
onChange={(val) => validationForm("repeatValue", val)}
|
onChange={(val) => validationForm("repeatValue", val)}
|
||||||
error={error.repeatValue}
|
error={error.repeatValue}
|
||||||
@@ -247,7 +249,7 @@ export default function CalendarDivisionCreate() {
|
|||||||
label="Deskripsi"
|
label="Deskripsi"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Deskripsi"
|
placeholder="Deskripsi"
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={data.desc}
|
value={data.desc}
|
||||||
onChange={(val) => validationForm("desc", val)}
|
onChange={(val) => validationForm("desc", val)}
|
||||||
multiline
|
multiline
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
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 Text from "@/components/Text";
|
||||||
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 { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { FlatList, View, VirtualizedList } from "react-native";
|
import { FlatList, View, VirtualizedList } from "react-native";
|
||||||
@@ -15,6 +15,7 @@ type Props = {
|
|||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
export default function CalendarHistory() {
|
export default function CalendarHistory() {
|
||||||
|
const { colors, activeTheme } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
@@ -64,11 +65,11 @@ export default function CalendarHistory() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
<InputSearch onChange={(val) => setSearch(val)} />
|
<InputSearch onChange={(val) => setSearch(val)} />
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2, }]}>
|
<View style={[{ flex: 2 }, Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
arrSkeleton.map((item, index) => (
|
arrSkeleton.map((item, index) => (
|
||||||
@@ -81,7 +82,7 @@ export default function CalendarHistory() {
|
|||||||
getItem={getItem}
|
getItem={getItem}
|
||||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||||
return (
|
return (
|
||||||
<View key={index} style={[{ flexDirection: 'row' }, Styles.mv05, ColorsStatus.lightGreen, Styles.p10, Styles.round10]}>
|
<View key={index} style={[{ flexDirection: 'row' }, Styles.mb05, Styles.borderAll, { backgroundColor: colors.card }, Styles.p10, Styles.round05, { borderColor: colors.icon + '20' }]}>
|
||||||
<View style={[Styles.mr10, Styles.ph05]}>
|
<View style={[Styles.mr10, Styles.ph05]}>
|
||||||
<Text style={[Styles.textSubtitle]}>{String(item.dateStart)}</Text>
|
<Text style={[Styles.textSubtitle]}>{String(item.dateStart)}</Text>
|
||||||
<Text style={[Styles.textDefault, { textAlign: 'center' }]}>{item.year}</Text>
|
<Text style={[Styles.textDefault, { textAlign: 'center' }]}>{item.year}</Text>
|
||||||
@@ -89,7 +90,7 @@ export default function CalendarHistory() {
|
|||||||
<View style={[{ flex: 1 }]}>
|
<View style={[{ flex: 1 }]}>
|
||||||
<FlatList data={item.data}
|
<FlatList data={item.data}
|
||||||
renderItem={({ item, index }: { item: { title: string, timeStart: string, timeEnd: string }, index: number }) => (
|
renderItem={({ item, index }: { item: { title: string, timeStart: string, timeEnd: string }, index: number }) => (
|
||||||
<View key={index} style={[Styles.mb05, Styles.w80]}>
|
<View key={index} style={[Styles.mb05]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]} numberOfLines={1} ellipsizeMode="tail">{item.title}</Text>
|
<Text style={[Styles.textDefaultSemiBold]} numberOfLines={1} ellipsizeMode="tail">{item.title}</Text>
|
||||||
<Text style={[Styles.textDefault]}>{item.timeStart} | {item.timeEnd}</Text>
|
<Text style={[Styles.textDefault]}>{item.timeStart} | {item.timeEnd}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ 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 { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Feather } from "@expo/vector-icons";
|
import { Feather } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import 'intl';
|
import 'intl';
|
||||||
@@ -34,6 +35,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function CalendarDivision() {
|
export default function CalendarDivision() {
|
||||||
|
const { colors, activeTheme } = useTheme();
|
||||||
const [selected, setSelected] = useState<any>(new Date())
|
const [selected, setSelected] = useState<any>(new Date())
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -117,15 +119,15 @@ export default function CalendarDivision() {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
IconNext: <Pressable onPress={() => !loadingBtn ? setMonth(month + 1) : null}>
|
IconNext: <Pressable onPress={() => !loadingBtn ? setMonth(month + 1) : null}>
|
||||||
<Feather name="chevron-right" size={20} color={loadingBtn ? 'gray' : 'black'} />
|
<Feather name="chevron-right" size={20} color={loadingBtn ? 'gray' : colors.text} />
|
||||||
</Pressable>,
|
</Pressable>,
|
||||||
IconPrev: <Pressable onPress={() => !loadingBtn ? setMonth(month - 1) : null}>
|
IconPrev: <Pressable onPress={() => !loadingBtn ? setMonth(month - 1) : null}>
|
||||||
<Feather name="chevron-left" size={20} color={loadingBtn ? 'gray' : 'black'} />
|
<Feather name="chevron-left" size={20} color={loadingBtn ? 'gray' : colors.text} />
|
||||||
</Pressable>,
|
</Pressable>,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -153,12 +155,13 @@ export default function CalendarDivision() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
<Datepicker
|
<Datepicker
|
||||||
components={components}
|
components={components}
|
||||||
mode="single"
|
mode="single"
|
||||||
@@ -167,19 +170,19 @@ export default function CalendarDivision() {
|
|||||||
onMonthChange={(month) => setMonth(month)}
|
onMonthChange={(month) => setMonth(month)}
|
||||||
styles={{
|
styles={{
|
||||||
selected: Styles.selectedDate,
|
selected: Styles.selectedDate,
|
||||||
month_label: Styles.cBlack,
|
month_label: { color: colors.text },
|
||||||
month_selector_label: Styles.cBlack,
|
month_selector_label: { color: colors.text },
|
||||||
year_label: Styles.cBlack,
|
year_label: { color: colors.text },
|
||||||
year_selector_label: Styles.cBlack,
|
year_selector_label: { color: colors.text },
|
||||||
day_label: Styles.cBlack,
|
day_label: { color: colors.text },
|
||||||
time_label: Styles.cBlack,
|
time_label: { color: colors.text },
|
||||||
weekday_label: Styles.cBlack,
|
weekday_label: { color: colors.text },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mb15, Styles.mt15]}>
|
<View style={[Styles.mb15, Styles.mt15]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb05]}>Acara</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.mb05]}>Acara</Text>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<>
|
<>
|
||||||
@@ -202,7 +205,7 @@ export default function CalendarDivision() {
|
|||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada acara</Text>
|
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada acara</Text>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ 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 { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import LoadingOverlay from "@/components/loadingOverlay";
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiEditDiscussion, apiGetDiscussionOne } from "@/lib/api";
|
import { apiEditDiscussion, apiGetDiscussionOne } from "@/lib/api";
|
||||||
import { setUpdateDiscussion } from "@/lib/discussionUpdate";
|
import { setUpdateDiscussion } from "@/lib/discussionUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
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";
|
||||||
@@ -20,6 +21,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [data, setData] = useState("");
|
const [data, setData] = useState("");
|
||||||
@@ -127,7 +129,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -166,7 +168,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<LoadingOverlay visible={loading} />
|
{loading && <LoadingCenter />}
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -177,20 +179,21 @@ export default function DiscussionDivisionEdit() {
|
|||||||
value={data}
|
value={data}
|
||||||
onChange={setData}
|
onChange={setData}
|
||||||
multiline
|
multiline
|
||||||
|
bg={colors.card}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
||||||
{
|
{
|
||||||
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
(fileForm.length > 0 || dataFile.filter((val) => !val.delete).length > 0)
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.background, backgroundColor: colors.card }]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
{
|
{
|
||||||
dataFile.filter((val) => !val.delete).map((item, index) => (
|
dataFile.filter((val) => !val.delete).map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
borderType={(fileForm.length + dataFile.length) > 1 ? "bottom" : "none"}
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
title={item.name + '.' + item.extension}
|
title={item.name + '.' + item.extension}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
onPress={() => { setIndexDelFile({ id: item.id, cat: "oldFile" }); setModalFile(true) }}
|
||||||
@@ -202,7 +205,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
onPress={() => { setIndexDelFile({ id: index, cat: "newFile" }); setModalFile(true) }}
|
||||||
@@ -218,7 +221,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile.id, indexDelFile.cat) }}
|
onPress={() => { deleteFile(indexDelFile.id, indexDelFile.cat) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
|
||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
import BorderBottomItem2 from "@/components/borderBottomItem2";
|
import BorderBottomItem2 from "@/components/borderBottomItem2";
|
||||||
@@ -8,6 +7,7 @@ import ImageUser from "@/components/imageNew";
|
|||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
|
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
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 Text from "@/components/Text";
|
||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
} from "@/lib/api";
|
} from "@/lib/api";
|
||||||
import { getDB } from "@/lib/firebaseDatabase";
|
import { getDB } from "@/lib/firebaseDatabase";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
import { Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||||
import { ref } from "@react-native-firebase/database";
|
import { ref } from "@react-native-firebase/database";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
@@ -64,6 +65,7 @@ type PropsFile = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DiscussionDetail() {
|
export default function DiscussionDetail() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const [data, setData] = useState<Props>();
|
const [data, setData] = useState<Props>();
|
||||||
const [dataComment, setDataComment] = useState<PropsComment[]>([]);
|
const [dataComment, setDataComment] = useState<PropsComment[]>([]);
|
||||||
@@ -90,6 +92,7 @@ export default function DiscussionDetail() {
|
|||||||
comment: ''
|
comment: ''
|
||||||
})
|
})
|
||||||
const [viewEdit, setViewEdit] = useState(false)
|
const [viewEdit, setViewEdit] = useState(false)
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -295,7 +298,7 @@ export default function DiscussionDetail() {
|
|||||||
showBack={true}
|
showBack={true}
|
||||||
onPressLeft={() => router.back()}
|
onPressLeft={() => router.back()}
|
||||||
right={
|
right={
|
||||||
(entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision || isCreator ?
|
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision || isCreator) ?
|
||||||
<HeaderRightDiscussionDetail
|
<HeaderRightDiscussionDetail
|
||||||
id={detail}
|
id={detail}
|
||||||
status={data?.status}
|
status={data?.status}
|
||||||
@@ -306,12 +309,13 @@ export default function DiscussionDetail() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -323,7 +327,8 @@ export default function DiscussionDetail() {
|
|||||||
<BorderBottomItem2
|
<BorderBottomItem2
|
||||||
dataFile={fileDiscussion}
|
dataFile={fileDiscussion}
|
||||||
descEllipsize={false}
|
descEllipsize={false}
|
||||||
borderType="bottom"
|
bgColor="white"
|
||||||
|
borderType="all"
|
||||||
icon={
|
icon={
|
||||||
<ImageUser
|
<ImageUser
|
||||||
src={`${ConstEnv.url_storage}/files/${data?.user_img}`}
|
src={`${ConstEnv.url_storage}/files/${data?.user_img}`}
|
||||||
@@ -352,7 +357,7 @@ export default function DiscussionDetail() {
|
|||||||
color="grey"
|
color="grey"
|
||||||
style={Styles.mr05}
|
style={Styles.mr05}
|
||||||
/>
|
/>
|
||||||
<Text style={[Styles.textInformation, Styles.cGray, Styles.mb05]} >
|
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]} >
|
||||||
{dataComment.length} Komentar
|
{dataComment.length} Komentar
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -360,7 +365,7 @@ export default function DiscussionDetail() {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loadingKomentar ?
|
loadingKomentar ?
|
||||||
arrSkeleton.map((item, index) => (
|
arrSkeleton.map((item, index) => (
|
||||||
@@ -370,7 +375,7 @@ export default function DiscussionDetail() {
|
|||||||
dataComment.map((item, index) => (
|
dataComment.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType="bottom"
|
borderType="all"
|
||||||
colorPress
|
colorPress
|
||||||
icon={
|
icon={
|
||||||
<ImageUser
|
<ImageUser
|
||||||
@@ -383,6 +388,7 @@ export default function DiscussionDetail() {
|
|||||||
desc={item.comment}
|
desc={item.comment}
|
||||||
rightBottomInfo={item.isEdited ? "Edited" : ""}
|
rightBottomInfo={item.isEdited ? "Edited" : ""}
|
||||||
descEllipsize={detailMore.includes(item.id) ? false : true}
|
descEllipsize={detailMore.includes(item.id) ? false : true}
|
||||||
|
bgColor="white"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setDetailMore((prev: any) => {
|
setDetailMore((prev: any) => {
|
||||||
if (prev.includes(item.id)) {
|
if (prev.includes(item.id)) {
|
||||||
@@ -410,7 +416,7 @@ export default function DiscussionDetail() {
|
|||||||
style={[
|
style={[
|
||||||
Styles.contentItemCenter,
|
Styles.contentItemCenter,
|
||||||
Styles.w100,
|
Styles.w100,
|
||||||
{ backgroundColor: "#f4f4f4" },
|
{ backgroundColor: colors.background },
|
||||||
viewEdit && Styles.borderTop
|
viewEdit && Styles.borderTop
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -419,15 +425,15 @@ export default function DiscussionDetail() {
|
|||||||
<>
|
<>
|
||||||
<View style={[Styles.w90, Styles.rowSpaceBetween, Styles.pv05]}>
|
<View style={[Styles.w90, Styles.rowSpaceBetween, Styles.pv05]}>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<Feather name="edit-3" color="black" size={22} style={[Styles.mh05]} />
|
<Feather name="edit-3" color={colors.text} size={22} style={[Styles.mh05]} />
|
||||||
<Text style={[Styles.textMediumSemiBold]}>Edit Komentar</Text>
|
<Text style={[Styles.textMediumSemiBold]}>Edit Komentar</Text>
|
||||||
</View>
|
</View>
|
||||||
<Pressable onPress={() => handleViewEditKomentar()}>
|
<Pressable onPress={() => handleViewEditKomentar()}>
|
||||||
<MaterialIcons name="close" color="black" size={22} />
|
<MaterialIcons name="close" color={colors.text} size={22} />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
type="default"
|
type="default"
|
||||||
round
|
round
|
||||||
multiline
|
multiline
|
||||||
@@ -460,8 +466,8 @@ export default function DiscussionDetail() {
|
|||||||
size={25}
|
size={25}
|
||||||
style={
|
style={
|
||||||
[selectKomentar.comment == "" || regexOnlySpacesOrEnter.test(selectKomentar.comment) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
[selectKomentar.comment == "" || regexOnlySpacesOrEnter.test(selectKomentar.comment) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
||||||
? Styles.cGray
|
? { color: colors.dimmed }
|
||||||
: Styles.cDefault,
|
: { color: colors.tint },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -474,7 +480,6 @@ export default function DiscussionDetail() {
|
|||||||
isMemberDivision)
|
isMemberDivision)
|
||||||
?
|
?
|
||||||
<InputForm
|
<InputForm
|
||||||
bg="white"
|
|
||||||
type="default"
|
type="default"
|
||||||
round
|
round
|
||||||
multiline
|
multiline
|
||||||
@@ -507,8 +512,8 @@ export default function DiscussionDetail() {
|
|||||||
size={25}
|
size={25}
|
||||||
style={
|
style={
|
||||||
[komentar == "" || regexOnlySpacesOrEnter.test(komentar) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
[komentar == "" || regexOnlySpacesOrEnter.test(komentar) || loadingSend || ((entityUser.role == "user" || entityUser.role == "coadmin") && !isMemberDivision)
|
||||||
? Styles.cGray
|
? { color: colors.dimmed }
|
||||||
: Styles.cDefault,
|
: { color: colors.tint }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -517,7 +522,7 @@ export default function DiscussionDetail() {
|
|||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<View style={[Styles.pv20, { alignItems: 'center' }]}>
|
<View style={[Styles.pv20, { alignItems: 'center' }]}>
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>
|
||||||
{
|
{
|
||||||
data?.status == 2 ? "Diskusi telah ditutup" : data?.isActive == false ? "Diskusi telah diarsipkan" : "Hanya anggota divisi yang dapat memberikan komentar"
|
data?.status == 2 ? "Diskusi telah ditutup" : data?.isActive == false ? "Diskusi telah diarsipkan" : "Hanya anggota divisi yang dapat memberikan komentar"
|
||||||
}
|
}
|
||||||
@@ -531,25 +536,35 @@ export default function DiscussionDetail() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Komentar">
|
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Komentar">
|
||||||
<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={colors.text} size={25} />}
|
||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => { handleViewEditKomentar() }}
|
onPress={() => { handleViewEditKomentar() }}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialIcons name="delete" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
AlertKonfirmasi({
|
setVisible(false)
|
||||||
title: 'Konfirmasi',
|
setTimeout(() => {
|
||||||
desc: 'Apakah anda yakin ingin menghapus komentar?',
|
setShowDeleteModal(true)
|
||||||
onPress: () => {
|
}, 600)
|
||||||
handleDeleteKomentar()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah anda yakin ingin menghapus komentar?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDeleteKomentar()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Hapus"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ 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 { InputForm } from "@/components/inputForm"
|
import { InputForm } from "@/components/inputForm"
|
||||||
import LoadingOverlay from "@/components/loadingOverlay"
|
import LoadingCenter from "@/components/loadingCenter"
|
||||||
import MenuItemRow from "@/components/menuItemRow"
|
import MenuItemRow from "@/components/menuItemRow"
|
||||||
import Text from "@/components/Text"
|
import Text from "@/components/Text"
|
||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiCreateDiscussion } from "@/lib/api"
|
import { apiCreateDiscussion } from "@/lib/api"
|
||||||
import { setUpdateDiscussion } from "@/lib/discussionUpdate"
|
import { setUpdateDiscussion } from "@/lib/discussionUpdate"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
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"
|
||||||
@@ -21,6 +22,7 @@ import { useDispatch, useSelector } from "react-redux"
|
|||||||
|
|
||||||
|
|
||||||
export default function CreateDiscussionDivision() {
|
export default function CreateDiscussionDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [desc, setDesc] = useState('')
|
const [desc, setDesc] = useState('')
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -88,7 +90,7 @@ export default function CreateDiscussionDivision() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -117,7 +119,7 @@ export default function CreateDiscussionDivision() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<LoadingOverlay visible={loading} />
|
{loading && <LoadingCenter />}
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -127,19 +129,20 @@ export default function CreateDiscussionDivision() {
|
|||||||
required
|
required
|
||||||
onChange={setDesc}
|
onChange={setDesc}
|
||||||
multiline
|
multiline
|
||||||
|
bg={colors.card}
|
||||||
/>
|
/>
|
||||||
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
||||||
{
|
{
|
||||||
fileForm.length > 0
|
fileForm.length > 0
|
||||||
&&
|
&&
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10, Styles.mb10]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, Styles.mb10, { borderColor: colors.background, backgroundColor: colors.card }]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold]}>File</Text>
|
||||||
{
|
{
|
||||||
fileForm.map((item, index) => (
|
fileForm.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
borderType={fileForm.length > 1 ? "bottom" : "none"}
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
onPress={() => { setIndexDelFile(index); setModalFile(true) }}
|
||||||
@@ -154,7 +157,7 @@ export default function CreateDiscussionDivision() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModalFile} setVisible={setModalFile} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ 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 Text from "@/components/Text";
|
||||||
|
import WrapTab from "@/components/wrapTab";
|
||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDiscussion, apiGetDivisionOneFeature } from "@/lib/api";
|
import { apiGetDiscussion, apiGetDivisionOneFeature } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -30,6 +32,7 @@ type Props = {
|
|||||||
|
|
||||||
|
|
||||||
export default function DiscussionDivision() {
|
export default function DiscussionDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, active } = useLocalSearchParams<{ id: string, active?: string }>()
|
const { id, active } = useLocalSearchParams<{ id: string, active?: string }>()
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -128,26 +131,26 @@ export default function DiscussionDivision() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision) &&
|
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision) &&
|
||||||
<View>
|
<View>
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="true"
|
value="true"
|
||||||
onPress={() => { setStatus("true") }}
|
onPress={() => { setStatus("true") }}
|
||||||
label="Aktif"
|
label="Aktif"
|
||||||
icon={<Feather name="check-circle" color={status == "false" ? 'black' : 'white'} size={20} />}
|
icon={<Feather name="check-circle" color={status == "false" ? colors.dimmed : 'white'} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="false"
|
value="false"
|
||||||
onPress={() => { setStatus("false") }}
|
onPress={() => { setStatus("false") }}
|
||||||
label="Arsip"
|
label="Arsip"
|
||||||
icon={<AntDesign name="closecircleo" color={status == "true" ? 'black' : 'white'} size={20} />}
|
icon={<AntDesign name="closecircleo" color={status == "true" ? colors.dimmed : 'white'} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
</View>
|
</WrapTab>
|
||||||
<InputSearch onChange={setSearch} />
|
<InputSearch onChange={setSearch} />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
@@ -174,7 +177,7 @@ export default function DiscussionDivision() {
|
|||||||
onPress={() => { router.push(`./discussion/${item.id}`) }}
|
onPress={() => { router.push(`./discussion/${item.id}`) }}
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
icon={
|
icon={
|
||||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="sm" />
|
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} size="xs" />
|
||||||
}
|
}
|
||||||
title={item.user_name}
|
title={item.user_name}
|
||||||
subtitle={
|
subtitle={
|
||||||
@@ -184,11 +187,12 @@ export default function DiscussionDivision() {
|
|||||||
desc={item.desc}
|
desc={item.desc}
|
||||||
leftBottomInfo={
|
leftBottomInfo={
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<Ionicons name="chatbox-ellipses-outline" size={18} color="grey" style={Styles.mr05} />
|
<Ionicons name="chatbox-ellipses-outline" size={18} color={colors.dimmed} style={Styles.mr05} />
|
||||||
<Text style={[Styles.textInformation, Styles.cGray, Styles.mb05]}>Diskusikan</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }, Styles.mb05]}>Diskusikan</Text>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
rightBottomInfo={item.total_komentar + ' Komentar'}
|
rightBottomInfo={item.total_komentar + ' Komentar'}
|
||||||
|
bgColor="transparent"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
@@ -200,11 +204,12 @@ export default function DiscussionDivision() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
(<Text style={[Styles.textDefault, Styles.cGray, Styles.mv10, { textAlign: "center" }]}>Tidak ada diskusi</Text>)
|
(<Text style={[Styles.textDefault, Styles.mv10, { textAlign: "center", color: colors.dimmed }]}>Tidak ada diskusi</Text>)
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import { ButtonHeader } from "@/components/buttonHeader";
|
import { ButtonHeader } from "@/components/buttonHeader";
|
||||||
import HeaderRightDocument from "@/components/document/headerDocument";
|
import HeaderRightDocument from "@/components/document/headerDocument";
|
||||||
@@ -12,7 +12,6 @@ import ModalLoading from "@/components/modalLoading";
|
|||||||
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
import ModalSelectMultiple from "@/components/modalSelectMultiple";
|
||||||
import Skeleton from "@/components/skeleton";
|
import Skeleton from "@/components/skeleton";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
|
||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import {
|
import {
|
||||||
@@ -24,6 +23,7 @@ import {
|
|||||||
} from "@/lib/api";
|
} from "@/lib/api";
|
||||||
import { setUpdateDokumen } from "@/lib/dokumenUpdate";
|
import { setUpdateDokumen } from "@/lib/dokumenUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import {
|
import {
|
||||||
AntDesign,
|
AntDesign,
|
||||||
MaterialCommunityIcons,
|
MaterialCommunityIcons,
|
||||||
@@ -66,6 +66,7 @@ type PropsPath = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function DocumentDivision() {
|
export default function DocumentDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const [loadingRename, setLoadingRename] = useState(false)
|
const [loadingRename, setLoadingRename] = useState(false)
|
||||||
const [isShare, setShare] = useState(false)
|
const [isShare, setShare] = useState(false)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -88,6 +89,7 @@ export default function DocumentDivision() {
|
|||||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||||
const [isMemberDivision, setIsMemberDivision] = useState(false)
|
const [isMemberDivision, setIsMemberDivision] = useState(false)
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
const [bodyRename, setBodyRename] = useState({
|
const [bodyRename, setBodyRename] = useState({
|
||||||
id: "",
|
id: "",
|
||||||
name: "",
|
name: "",
|
||||||
@@ -334,7 +336,7 @@ export default function DocumentDivision() {
|
|||||||
}, [path]);
|
}, [path]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={{ flex: 1 }}>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () =>
|
// headerLeft: () =>
|
||||||
@@ -380,7 +382,7 @@ export default function DocumentDivision() {
|
|||||||
showBack={(selectedFiles.length > 0 || dariSelectAll) ? false : true}
|
showBack={(selectedFiles.length > 0 || dariSelectAll) ? false : true}
|
||||||
left={
|
left={
|
||||||
<ButtonHeader
|
<ButtonHeader
|
||||||
item={<MaterialIcons name="close" size={20} color="white" />}
|
item={<MaterialIcons name="close" size={25} color="white" />}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleBatal();
|
handleBatal();
|
||||||
}}
|
}}
|
||||||
@@ -393,7 +395,7 @@ export default function DocumentDivision() {
|
|||||||
selectedFiles.length > 0 || dariSelectAll ? (
|
selectedFiles.length > 0 || dariSelectAll ? (
|
||||||
<ButtonHeader
|
<ButtonHeader
|
||||||
item={
|
item={
|
||||||
<MaterialIcons name="checklist-rtl" size={20} color="white" />
|
<MaterialIcons name="checklist-rtl" size={25} color="white" />
|
||||||
}
|
}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleSelectAll();
|
handleSelectAll();
|
||||||
@@ -413,6 +415,7 @@ export default function DocumentDivision() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}>
|
}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
@@ -427,9 +430,9 @@ export default function DocumentDivision() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.id != "home" && (
|
{item.id != "home" && (
|
||||||
<AntDesign name="right" style={[Styles.mh05, Styles.mt02]} color="black" />
|
<AntDesign name="right" style={[Styles.mh05, Styles.mt02]} color={colors.text} />
|
||||||
)}
|
)}
|
||||||
<Text> {item.name} </Text>
|
<Text style={{ color: colors.text }}> {item.name} </Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -478,14 +481,7 @@ export default function DocumentDivision() {
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
<Text
|
<Text style={[Styles.textDefault, Styles.mt15, { textAlign: "center", color: colors.dimmed }]} >
|
||||||
style={[
|
|
||||||
Styles.textDefault,
|
|
||||||
Styles.cGray,
|
|
||||||
Styles.mt15,
|
|
||||||
{ textAlign: "center" },
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
Tidak ada dokumen
|
Tidak ada dokumen
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@@ -493,7 +489,7 @@ export default function DocumentDivision() {
|
|||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
{(selectedFiles.length > 0 || dariSelectAll) && (
|
{(selectedFiles.length > 0 || dariSelectAll) && (
|
||||||
<View style={[ColorsStatus.primary, Styles.bottomMenuSelectDocument]}>
|
<View style={[Styles.bottomMenuSelectDocument, { backgroundColor: colors.header }]}>
|
||||||
<View style={[Styles.rowItemsCenter, { justifyContent: "center" }]}>
|
<View style={[Styles.rowItemsCenter, { justifyContent: "center" }]}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={
|
icon={
|
||||||
@@ -505,13 +501,7 @@ export default function DocumentDivision() {
|
|||||||
}
|
}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
AlertKonfirmasi({
|
setShowDeleteModal(true)
|
||||||
title: "Konfirmasi",
|
|
||||||
desc: "Apakah anda yakin ingin menghapus dokumen?",
|
|
||||||
onPress: () => {
|
|
||||||
handleDelete();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
column="many"
|
column="many"
|
||||||
color="white"
|
color="white"
|
||||||
@@ -618,6 +608,19 @@ export default function DocumentDivision() {
|
|||||||
value={id}
|
value={id}
|
||||||
item={selectedFiles[0]?.id}
|
item={selectedFiles[0]?.id}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah anda yakin ingin menghapus dokumen?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDelete()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Hapus"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ 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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
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";
|
||||||
@@ -23,6 +24,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const [fileForm, setFileForm] = useState<any[]>([]);
|
const [fileForm, setFileForm] = useState<any[]>([]);
|
||||||
const [listFile, setListFile] = useState<any[]>([]);
|
const [listFile, setListFile] = useState<any[]>([]);
|
||||||
@@ -127,7 +129,7 @@ export default function TaskDivisionAddFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -169,13 +171,13 @@ export default function TaskDivisionAddFile() {
|
|||||||
listFile.length > 0 && (
|
listFile.length > 0 && (
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
listFile.map((item, index) => (
|
listFile.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType="all"
|
borderType="all"
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
title={item}
|
title={item}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||||
@@ -197,7 +199,7 @@ export default function TaskDivisionAddFile() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ 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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -23,6 +24,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddMemberTask() {
|
export default function AddMemberTask() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.projectUpdate)
|
const update = useSelector((state: any) => state.projectUpdate)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -127,7 +129,7 @@ export default function AddMemberTask() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -149,7 +151,7 @@ export default function AddMemberTask() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -162,22 +164,22 @@ export default function AddMemberTask() {
|
|||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal, { borderColor: colors.icon + '20' }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
!found && onChoose(item.idUser, item.name, item.img)
|
!found && onChoose(item.idUser, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={[Styles.rowItemsCenter, Styles.w80]}>
|
<View style={[Styles.rowItemsCenter, Styles.w80,]}>
|
||||||
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} border />
|
<ImageUser src={`${ConstEnv.url_storage}/files/${item.img}`} border />
|
||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
||||||
{
|
{
|
||||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
found && <Text style={[Styles.textInformation, { color: colors.dimmed }]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalAddDetailTugasTask from "@/components/task/modalAddDetailTugasTask";
|
import ModalAddDetailTugasTask from "@/components/task/modalAddDetailTugasTask";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -9,6 +10,7 @@ import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
|||||||
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import 'intl';
|
import 'intl';
|
||||||
@@ -16,7 +18,8 @@ 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 {
|
import {
|
||||||
KeyboardAvoidingView, Platform, Pressable, SafeAreaView,
|
KeyboardAvoidingView, Platform,
|
||||||
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
View
|
View
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
@@ -25,6 +28,7 @@ import DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function TaskDivisionAddTask() {
|
export default function TaskDivisionAddTask() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const update = useSelector((state: any) => state.taskUpdate);
|
const update = useSelector((state: any) => state.taskUpdate);
|
||||||
@@ -138,7 +142,7 @@ export default function TaskDivisionAddTask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -183,7 +187,7 @@ export default function TaskDivisionAddTask() {
|
|||||||
>
|
>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
mode="range"
|
mode="range"
|
||||||
startDate={range.startDate}
|
startDate={range.startDate}
|
||||||
@@ -193,13 +197,13 @@ export default function TaskDivisionAddTask() {
|
|||||||
selected: Styles.selectedDate,
|
selected: Styles.selectedDate,
|
||||||
selected_label: Styles.cWhite,
|
selected_label: Styles.cWhite,
|
||||||
range_fill: Styles.selectRangeDate,
|
range_fill: Styles.selectRangeDate,
|
||||||
month_label: Styles.cBlack,
|
month_label: { color: colors.text },
|
||||||
month_selector_label: Styles.cBlack,
|
month_selector_label: { color: colors.text },
|
||||||
year_label: Styles.cBlack,
|
year_label: { color: colors.text },
|
||||||
year_selector_label: Styles.cBlack,
|
year_selector_label: { color: colors.text },
|
||||||
day_label: Styles.cBlack,
|
day_label: { color: colors.text },
|
||||||
time_label: Styles.cBlack,
|
time_label: { color: colors.text },
|
||||||
weekday_label: Styles.cBlack,
|
weekday_label: { color: colors.text },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -207,38 +211,39 @@ export default function TaskDivisionAddTask() {
|
|||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
Tanggal Mulai <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
Tanggal Berakhir <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, { color: colors.error }, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
}
|
}
|
||||||
<Pressable
|
{/* <Pressable
|
||||||
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
||||||
disabled={dsbButton}
|
disabled={dsbButton}
|
||||||
onPress={() => { setModalDetail(true) }}
|
onPress={() => { setModalDetail(true) }}
|
||||||
>
|
>
|
||||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||||
</Pressable>
|
</Pressable> */}
|
||||||
|
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul Tugas"
|
label="Judul Tugas"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Tugas"
|
placeholder="Judul Tugas"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={title}
|
value={title}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiCancelTask } from "@/lib/api";
|
import { apiCancelTask } from "@/lib/api";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -12,6 +13,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -69,7 +71,7 @@ export default function TaskDivisionCancel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -115,7 +117,7 @@ export default function TaskDivisionCancel() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Alasan Pembatalan"
|
placeholder="Alasan Pembatalan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
error={error}
|
error={error}
|
||||||
errorText="Alasan pembatalan harus diisi"
|
errorText="Alasan pembatalan harus diisi"
|
||||||
onChange={(val) => onValidation(val)}
|
onChange={(val) => onValidation(val)}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiEditTask, apiGetTaskOne } from "@/lib/api";
|
import { apiEditTask, apiGetTaskOne } from "@/lib/api";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -12,6 +13,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [judul, setJudul] = useState("");
|
const [judul, setJudul] = useState("");
|
||||||
@@ -87,7 +89,7 @@ export default function TaskDivisionEdit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -128,7 +130,7 @@ export default function TaskDivisionEdit() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Kegiatan"
|
placeholder="Judul Kegiatan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={judul}
|
value={judul}
|
||||||
onChange={(val) => { onValidation(val) }}
|
onChange={(val) => { onValidation(val) }}
|
||||||
error={error}
|
error={error}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import SectionTanggalTugasTask from "@/components/task/sectionTanggalTugasTask";
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDivisionOneFeature, apiGetTaskOne } from "@/lib/api";
|
import { apiGetDivisionOneFeature, apiGetTaskOne } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -25,6 +26,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DetailTaskDivision() {
|
export default function DetailTaskDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const [data, setData] = useState<Props>()
|
const [data, setData] = useState<Props>()
|
||||||
@@ -97,7 +99,7 @@ export default function DetailTaskDivision() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -125,6 +127,7 @@ export default function DetailTaskDivision() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiGetTaskOne, apiReportTask } from "@/lib/api";
|
import { apiGetTaskOne, apiReportTask } from "@/lib/api";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -12,6 +13,7 @@ import Toast from "react-native-toast-message";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function TaskDivisionReport() {
|
export default function TaskDivisionReport() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [laporan, setLaporan] = useState("");
|
const [laporan, setLaporan] = useState("");
|
||||||
@@ -87,7 +89,7 @@ export default function TaskDivisionReport() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -128,7 +130,7 @@ export default function TaskDivisionReport() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Laporan Kegiatan"
|
placeholder="Laporan Kegiatan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={laporan}
|
value={laporan}
|
||||||
onChange={(val) => { onValidation(val) }}
|
onChange={(val) => { onValidation(val) }}
|
||||||
error={error}
|
error={error}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { setMemberChoose } from "@/lib/memberChoose";
|
|||||||
import { setTaskCreate } from "@/lib/taskCreate";
|
import { setTaskCreate } from "@/lib/taskCreate";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
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";
|
||||||
@@ -26,6 +27,7 @@ import { useDispatch, useSelector } from "react-redux";
|
|||||||
|
|
||||||
|
|
||||||
export default function CreateTaskDivision() {
|
export default function CreateTaskDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -113,7 +115,7 @@ export default function CreateTaskDivision() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -161,6 +163,7 @@ export default function CreateTaskDivision() {
|
|||||||
val == "" || val == "null" ? setError(true) : setError(false);
|
val == "" || val == "null" ? setError(true) : setError(false);
|
||||||
}}
|
}}
|
||||||
error={error}
|
error={error}
|
||||||
|
bg={colors.card}
|
||||||
errorText="Judul Tugas tidak boleh kosong"
|
errorText="Judul Tugas tidak boleh kosong"
|
||||||
/>
|
/>
|
||||||
<ButtonSelect value="Tambah Tanggal & Tugas" onPress={() => { router.push(`/division/${id}/task/create/task`); }} />
|
<ButtonSelect value="Tambah Tanggal & Tugas" onPress={() => { router.push(`/division/${id}/task/create/task`); }} />
|
||||||
@@ -171,13 +174,13 @@ export default function CreateTaskDivision() {
|
|||||||
fileForm.length > 0 && (
|
fileForm.length > 0 && (
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
fileForm.map((item, index) => (
|
fileForm.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType="all"
|
borderType="all"
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||||
@@ -195,7 +198,7 @@ export default function CreateTaskDivision() {
|
|||||||
<Text>Total {entitiesMember.length} Anggota</Text>
|
<Text>Total {entitiesMember.length} Anggota</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{entitiesMember.map(
|
{entitiesMember.map(
|
||||||
(item: { img: any; name: any }, index: any) => {
|
(item: { img: any; name: any }, index: any) => {
|
||||||
return (
|
return (
|
||||||
@@ -223,7 +226,7 @@ export default function CreateTaskDivision() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ 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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -23,6 +24,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddMemberCreateTask() {
|
export default function AddMemberCreateTask() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string, detail: string }>()
|
const { id } = useLocalSearchParams<{ id: string, detail: string }>()
|
||||||
@@ -97,7 +99,7 @@ export default function AddMemberCreateTask() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -119,7 +121,7 @@ export default function AddMemberCreateTask() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -131,7 +133,7 @@ export default function AddMemberCreateTask() {
|
|||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal, { borderColor: colors.icon + '20' }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
onChoose(item.idUser, item.name, item.img)
|
onChoose(item.idUser, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
@@ -143,7 +145,7 @@ export default function AddMemberCreateTask() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.idUser) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalAddDetailTugasTask from "@/components/task/modalAddDetailTugasTask";
|
import ModalAddDetailTugasTask from "@/components/task/modalAddDetailTugasTask";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -7,6 +8,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
||||||
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
||||||
import { setTaskCreate } from "@/lib/taskCreate";
|
import { setTaskCreate } from "@/lib/taskCreate";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import 'intl';
|
import 'intl';
|
||||||
@@ -16,7 +18,6 @@ import { useEffect, useState } from "react";
|
|||||||
import {
|
import {
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
Platform,
|
Platform,
|
||||||
Pressable,
|
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
View
|
View
|
||||||
@@ -27,6 +28,7 @@ import DateTimePicker, {
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CreateTaskAddTugas() {
|
export default function CreateTaskAddTugas() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const headerHeight = useHeaderHeight();
|
const headerHeight = useHeaderHeight();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const [disable, setDisable] = useState(true);
|
const [disable, setDisable] = useState(true);
|
||||||
@@ -118,7 +120,7 @@ export default function CreateTaskAddTugas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -158,7 +160,7 @@ export default function CreateTaskAddTugas() {
|
|||||||
>
|
>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
mode="range"
|
mode="range"
|
||||||
startDate={range.startDate}
|
startDate={range.startDate}
|
||||||
@@ -168,13 +170,13 @@ export default function CreateTaskAddTugas() {
|
|||||||
selected: Styles.selectedDate,
|
selected: Styles.selectedDate,
|
||||||
selected_label: Styles.cWhite,
|
selected_label: Styles.cWhite,
|
||||||
range_fill: Styles.selectRangeDate,
|
range_fill: Styles.selectRangeDate,
|
||||||
month_label: Styles.cBlack,
|
month_label: { color: colors.text },
|
||||||
month_selector_label: Styles.cBlack,
|
month_selector_label: { color: colors.text },
|
||||||
year_label: Styles.cBlack,
|
year_label: { color: colors.text },
|
||||||
year_selector_label: Styles.cBlack,
|
year_selector_label: { color: colors.text },
|
||||||
day_label: Styles.cBlack,
|
day_label: { color: colors.text },
|
||||||
time_label: Styles.cBlack,
|
time_label: { color: colors.text },
|
||||||
weekday_label: Styles.cBlack,
|
weekday_label: { color: colors.text },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@@ -182,38 +184,39 @@ export default function CreateTaskAddTugas() {
|
|||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
Tanggal Mulai <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
Tanggal Berakhir <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, { color: colors.error }, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
}
|
}
|
||||||
<Pressable
|
{/* <Pressable
|
||||||
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
||||||
disabled={dsbButton}
|
disabled={dsbButton}
|
||||||
onPress={() => { setModalDetail(true) }}
|
onPress={() => { setModalDetail(true) }}
|
||||||
>
|
>
|
||||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||||
</Pressable>
|
</Pressable> */}
|
||||||
|
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul Tugas"
|
label="Judul Tugas"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Tugas"
|
placeholder="Judul Tugas"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={title}
|
value={title}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ 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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import {
|
import {
|
||||||
AntDesign,
|
AntDesign,
|
||||||
Ionicons,
|
Ionicons,
|
||||||
@@ -31,6 +32,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function ListTask() {
|
export default function ListTask() {
|
||||||
|
const { colors } = useTheme()
|
||||||
const { id, status, year } = useLocalSearchParams<{ id: string; status: string; year: string }>()
|
const { id, status, year } = useLocalSearchParams<{ id: string; status: string; year: string }>()
|
||||||
const [isList, setList] = useState(false)
|
const [isList, setList] = useState(false)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -110,7 +112,7 @@ export default function ListTask() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
<ScrollView horizontal style={[Styles.mb10]} showsHorizontalScrollIndicator={false}>
|
<ScrollView horizontal style={[Styles.mb10]} showsHorizontalScrollIndicator={false}>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
@@ -121,7 +123,7 @@ export default function ListTask() {
|
|||||||
icon={
|
icon={
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="clock-alert-outline"
|
name="clock-alert-outline"
|
||||||
color={statusFix == "0" ? "white" : "black"}
|
color={statusFix == "0" ? "white" : colors.dimmed}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -135,7 +137,7 @@ export default function ListTask() {
|
|||||||
icon={
|
icon={
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name="progress-check"
|
name="progress-check"
|
||||||
color={statusFix == "1" ? "white" : "black"}
|
color={statusFix == "1" ? "white" : colors.dimmed}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -149,7 +151,7 @@ export default function ListTask() {
|
|||||||
icon={
|
icon={
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="checkmark-done-circle-outline"
|
name="checkmark-done-circle-outline"
|
||||||
color={statusFix == "2" ? "white" : "black"}
|
color={statusFix == "2" ? "white" : colors.dimmed}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -163,7 +165,7 @@ export default function ListTask() {
|
|||||||
icon={
|
icon={
|
||||||
<AntDesign
|
<AntDesign
|
||||||
name="closecircleo"
|
name="closecircleo"
|
||||||
color={statusFix == "3" ? "white" : "black"}
|
color={statusFix == "3" ? "white" : colors.dimmed}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -179,7 +181,7 @@ export default function ListTask() {
|
|||||||
>
|
>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name={isList ? "format-list-bulleted" : "view-grid"}
|
name={isList ? "format-list-bulleted" : "view-grid"}
|
||||||
color={"black"}
|
color={colors.text}
|
||||||
size={30}
|
size={30}
|
||||||
/>
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
@@ -188,7 +190,7 @@ export default function ListTask() {
|
|||||||
<View style={[Styles.mv05]}>
|
<View style={[Styles.mv05]}>
|
||||||
<View style={[Styles.rowOnly]}>
|
<View style={[Styles.rowOnly]}>
|
||||||
<Text style={[Styles.mr05]}>Filter :</Text>
|
<Text style={[Styles.mr05]}>Filter :</Text>
|
||||||
<LabelStatus size="small" category="secondary" text={isYear} style={{ marginRight: 5 }} />
|
<LabelStatus size="small" category="secondary" text={isYear} style={[Styles.mr05]} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }]}>
|
<View style={[{ flex: 2 }]}>
|
||||||
@@ -233,6 +235,7 @@ export default function ListTask() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -274,11 +277,11 @@ export default function ListTask() {
|
|||||||
<LabelStatus
|
<LabelStatus
|
||||||
size="default"
|
size="default"
|
||||||
category={
|
category={
|
||||||
item.status === 0 ? 'primary' :
|
item.status === 0 ? 'secondary' :
|
||||||
item.status === 1 ? 'warning' :
|
item.status === 1 ? 'warning' :
|
||||||
item.status === 2 ? 'success' :
|
item.status === 2 ? 'success' :
|
||||||
item.status === 3 ? 'error' :
|
item.status === 3 ? 'error' :
|
||||||
'primary'
|
'secondary'
|
||||||
}
|
}
|
||||||
text={
|
text={
|
||||||
item.status === 0 ? 'SEGERA' :
|
item.status === 0 ? 'SEGERA' :
|
||||||
@@ -299,6 +302,7 @@ export default function ListTask() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -338,13 +342,13 @@ export default function ListTask() {
|
|||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: "center" },]} >
|
<Text style={[Styles.textDefault, Styles.textCenter]} >
|
||||||
Tidak ada data
|
Tidak ada data
|
||||||
</Text>
|
</Text>
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
</View>
|
</View >
|
||||||
</View>
|
</View >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalAddDetailTugasTask from "@/components/task/modalAddDetailTugasTask";
|
import ModalAddDetailTugasTask from "@/components/task/modalAddDetailTugasTask";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -9,6 +10,7 @@ import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
|||||||
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
||||||
import { setUpdateTask } from "@/lib/taskUpdate";
|
import { setUpdateTask } from "@/lib/taskUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import 'intl';
|
import 'intl';
|
||||||
@@ -18,7 +20,6 @@ import { useEffect, useState } from "react";
|
|||||||
import {
|
import {
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
Platform,
|
Platform,
|
||||||
Pressable,
|
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
View
|
View
|
||||||
@@ -28,6 +29,7 @@ import DateTimePicker, { DateType } from "react-native-ui-datepicker";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function UpdateProjectTaskDivision() {
|
export default function UpdateProjectTaskDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const headerHeight = useHeaderHeight();
|
const headerHeight = useHeaderHeight();
|
||||||
const { detail } = useLocalSearchParams<{ detail: string }>();
|
const { detail } = useLocalSearchParams<{ detail: string }>();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -186,7 +188,7 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
}, [range])
|
}, [range])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -231,7 +233,7 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
>
|
>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{!loading && (
|
{!loading && (
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
mode="range"
|
mode="range"
|
||||||
@@ -244,13 +246,13 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
selected: Styles.selectedDate,
|
selected: Styles.selectedDate,
|
||||||
selected_label: Styles.cWhite,
|
selected_label: Styles.cWhite,
|
||||||
range_fill: Styles.selectRangeDate,
|
range_fill: Styles.selectRangeDate,
|
||||||
month_label: Styles.cBlack,
|
month_label: { color: colors.text },
|
||||||
month_selector_label: Styles.cBlack,
|
month_selector_label: { color: colors.text },
|
||||||
year_label: Styles.cBlack,
|
year_label: { color: colors.text },
|
||||||
year_selector_label: Styles.cBlack,
|
year_selector_label: { color: colors.text },
|
||||||
day_label: Styles.cBlack,
|
day_label: { color: colors.text },
|
||||||
time_label: Styles.cBlack,
|
time_label: { color: colors.text },
|
||||||
weekday_label: Styles.cBlack,
|
weekday_label: { color: colors.text },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -259,40 +261,41 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
Tanggal Mulai <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
<Text style={{ textAlign: "center" }}>{from}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
Tanggal Berakhir <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
<Text style={{ textAlign: "center" }}>{to}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{(error.endDate || error.startDate) && (
|
{(error.endDate || error.startDate) && (
|
||||||
<Text style={[Styles.textInformation, Styles.cError, Styles.mt05]} >
|
<Text style={[Styles.textInformation, { color: colors.error }, Styles.mt05]} >
|
||||||
Tanggal tidak boleh kosong
|
Tanggal tidak boleh kosong
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
<Pressable
|
{/* <Pressable
|
||||||
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
||||||
disabled={dsbButton}
|
disabled={dsbButton}
|
||||||
onPress={() => { setModalDetail(true) }}
|
onPress={() => { setModalDetail(true) }}
|
||||||
>
|
>
|
||||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||||
</Pressable>
|
</Pressable> */}
|
||||||
|
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul Tugas"
|
label="Judul Tugas"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Tugas"
|
placeholder="Judul Tugas"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={title}
|
value={title}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { ConstEnv } from "@/constants/ConstEnv";
|
|||||||
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";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -23,6 +24,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddMemberDivision() {
|
export default function AddMemberDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [dataOld, setDataOld] = useState<Props[]>([])
|
const [dataOld, setDataOld] = useState<Props[]>([])
|
||||||
@@ -130,7 +132,7 @@ export default function AddMemberDivision() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<InputSearch onChange={(val) => handleSearch(val)} value={search} />
|
<InputSearch onChange={(val) => handleSearch(val)} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -152,7 +154,7 @@ export default function AddMemberDivision() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -175,12 +177,12 @@ export default function AddMemberDivision() {
|
|||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode="tail">{item.name}</Text>
|
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode="tail">{item.name}</Text>
|
||||||
{
|
{
|
||||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
found && <Text style={[Styles.textInformation, { color: colors.dimmed }]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiEditDivision, apiGetDivisionOneDetail } from "@/lib/api";
|
import { apiEditDivision, apiGetDivisionOneDetail } from "@/lib/api";
|
||||||
import { setUpdateDivision } from "@/lib/divisionUpdate";
|
import { setUpdateDivision } from "@/lib/divisionUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -12,6 +13,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.divisionUpdate)
|
const update = useSelector((state: any) => state.divisionUpdate)
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
@@ -63,7 +65,7 @@ export default function EditDivision() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -98,7 +100,7 @@ export default function EditDivision() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView style={{ backgroundColor: colors.background }}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Nama Divisi"
|
label="Nama Divisi"
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import CaraouselHome from "@/components/home/carouselHome"
|
|||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiGetDivisionOneDetail } from "@/lib/api"
|
import { apiGetDivisionOneDetail } from "@/lib/api"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
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 { RefreshControl, SafeAreaView, ScrollView, View } from "react-native"
|
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native"
|
||||||
@@ -22,6 +23,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DetailDivisionFitur() {
|
export default function DetailDivisionFitur() {
|
||||||
|
const { colors } = useTheme()
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [data, setData] = useState<Props>()
|
const [data, setData] = useState<Props>()
|
||||||
@@ -54,7 +56,7 @@ export default function DetailDivisionFitur() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -76,6 +78,7 @@ export default function DetailDivisionFitur() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi"
|
import ModalConfirmation from "@/components/ModalConfirmation"
|
||||||
import AppHeader from "@/components/AppHeader"
|
import AppHeader from "@/components/AppHeader"
|
||||||
import BorderBottomItem from "@/components/borderBottomItem"
|
import BorderBottomItem from "@/components/borderBottomItem"
|
||||||
import HeaderRightDivisionInfo from "@/components/division/headerDivisionInfo"
|
import HeaderRightDivisionInfo from "@/components/division/headerDivisionInfo"
|
||||||
@@ -13,6 +13,7 @@ import { ConstEnv } from "@/constants/ConstEnv"
|
|||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiDeleteMemberDivision, apiGetDivisionOneDetail, apiGetDivisionOneFeature, apiUpdateStatusAdminDivision } from "@/lib/api"
|
import { apiDeleteMemberDivision, apiGetDivisionOneDetail, apiGetDivisionOneFeature, apiUpdateStatusAdminDivision } from "@/lib/api"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
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"
|
||||||
@@ -39,6 +40,7 @@ type PropsMember = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function InformationDivision() {
|
export default function InformationDivision() {
|
||||||
|
const { colors } = useTheme()
|
||||||
const [refreshing, setRefreshing] = useState(false)
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
@@ -57,14 +59,13 @@ export default function InformationDivision() {
|
|||||||
name: '',
|
name: '',
|
||||||
isAdmin: false
|
isAdmin: false
|
||||||
})
|
})
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
|
|
||||||
function handleMemberOut() {
|
function handleMemberOut() {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
AlertKonfirmasi({
|
setTimeout(() => {
|
||||||
title: 'Konfirmasi',
|
setShowDeleteModal(true)
|
||||||
desc: 'Apakah anda yakin ingin mengeluarkan anggota?',
|
}, 600)
|
||||||
onPress: () => { memberOut() }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function memberOut() {
|
async function memberOut() {
|
||||||
@@ -161,7 +162,7 @@ export default function InformationDivision() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -185,9 +186,10 @@ export default function InformationDivision() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
{
|
{
|
||||||
@@ -197,7 +199,7 @@ export default function InformationDivision() {
|
|||||||
}
|
}
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.mb05]}>Deskripsi Divisi</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.mb05]}>Deskripsi Divisi</Text>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, { backgroundColor: colors.card, borderWidth: 1, borderColor: colors.icon + '20' }]}>
|
||||||
{loading ?
|
{loading ?
|
||||||
arrSkeleton.map((item, index) => {
|
arrSkeleton.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
@@ -211,7 +213,7 @@ export default function InformationDivision() {
|
|||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
<Text style={[Styles.textDefault, Styles.mv05]}>{dataMember.length} Anggota</Text>
|
<Text style={[Styles.textDefault, Styles.mv05]}>{dataMember.length} Anggota</Text>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, { backgroundColor: colors.card, borderWidth: 1, borderColor: colors.icon + '20' }]}>
|
||||||
{
|
{
|
||||||
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision) &&
|
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision) &&
|
||||||
dataDetail?.isActive && (
|
dataDetail?.isActive && (
|
||||||
@@ -219,8 +221,8 @@ export default function InformationDivision() {
|
|||||||
onPress={() => { router.push(`/division/${id}/add-member`) }}
|
onPress={() => { router.push(`/division/${id}/add-member`) }}
|
||||||
borderType="none"
|
borderType="none"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.gray]}>
|
<View style={[Styles.iconContent]}>
|
||||||
<Feather name="user-plus" size={25} color={'#384288'} />
|
<Feather name="user-plus" size={25} color={'black'} />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
title="Tambah Anggota"
|
title="Tambah Anggota"
|
||||||
@@ -260,8 +262,8 @@ export default function InformationDivision() {
|
|||||||
<View>
|
<View>
|
||||||
<Pressable style={[Styles.wrapItemBorderBottom]} onPress={() => { handleMemberAdmin() }}>
|
<Pressable style={[Styles.wrapItemBorderBottom]} onPress={() => { handleMemberAdmin() }}>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<View style={[Styles.iconContent, ColorsStatus.info]}>
|
<View style={[Styles.iconContent]}>
|
||||||
<MaterialIcons name="verified-user" size={25} color='#19345E' />
|
<MaterialIcons name="verified-user" size={25} color={'black'} />
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowSpaceBetween, { width: '88%' }]}>
|
<View style={[Styles.rowSpaceBetween, { width: '88%' }]}>
|
||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
@@ -274,7 +276,7 @@ export default function InformationDivision() {
|
|||||||
<Pressable style={[Styles.wrapItemBorderBottom]} onPress={() => { handleMemberOut() }}>
|
<Pressable style={[Styles.wrapItemBorderBottom]} onPress={() => { handleMemberOut() }}>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<View style={[Styles.iconContent, ColorsStatus.info]}>
|
<View style={[Styles.iconContent, ColorsStatus.info]}>
|
||||||
<MaterialCommunityIcons name="close-circle" size={25} color='#19345E' />
|
<MaterialCommunityIcons name="close-circle" size={25} color={colors.primary} />
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowSpaceBetween, { width: '88%' }]}>
|
<View style={[Styles.rowSpaceBetween, { width: '88%' }]}>
|
||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
@@ -285,6 +287,19 @@ export default function InformationDivision() {
|
|||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah anda yakin ingin mengeluarkan anggota?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
memberOut()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Keluar"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import { InputDate } from "@/components/inputDate"
|
|||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiGetDivisionReport } from "@/lib/api"
|
import { apiGetDivisionReport } from "@/lib/api"
|
||||||
import { stringToDate } from "@/lib/fun_stringToDate"
|
import { stringToDate } from "@/lib/fun_stringToDate"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
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"
|
||||||
@@ -14,6 +15,7 @@ import { SafeAreaView, ScrollView, View } from "react-native"
|
|||||||
import Toast from "react-native-toast-message"
|
import Toast from "react-native-toast-message"
|
||||||
|
|
||||||
export default function ReportDivision() {
|
export default function ReportDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [showReport, setShowReport] = useState(false);
|
const [showReport, setShowReport] = useState(false);
|
||||||
@@ -104,7 +106,7 @@ export default function ReportDivision() {
|
|||||||
}, [showReport]);
|
}, [showReport]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -119,7 +121,7 @@ export default function ReportDivision() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView style={{ backgroundColor: colors.background }}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<InputDate
|
<InputDate
|
||||||
onChange={(val) => validationForm("date", val)}
|
onChange={(val) => validationForm("date", val)}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonNextHeader from "@/components/buttonNextHeader";
|
import ButtonNextHeader from "@/components/buttonNextHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
@@ -8,6 +8,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiCheckDivisionName } from "@/lib/api";
|
import { apiCheckDivisionName } from "@/lib/api";
|
||||||
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -15,6 +16,7 @@ import Toast from "react-native-toast-message";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CreateDivision() {
|
export default function CreateDivision() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const [isSelect, setSelect] = useState(false)
|
const [isSelect, setSelect] = useState(false)
|
||||||
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" })
|
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" })
|
||||||
@@ -23,6 +25,7 @@ export default function CreateDivision() {
|
|||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const userLogin = useSelector((state: any) => state.entities)
|
const userLogin = useSelector((state: any) => state.entities)
|
||||||
const [loadingBtn, setLoadingBtn] = useState(false)
|
const [loadingBtn, setLoadingBtn] = useState(false)
|
||||||
|
const [showWarningModal, setShowWarningModal] = useState(false)
|
||||||
const [error, setError] = useState({
|
const [error, setError] = useState({
|
||||||
idGroup: false,
|
idGroup: false,
|
||||||
name: false,
|
name: false,
|
||||||
@@ -67,12 +70,7 @@ export default function CreateDivision() {
|
|||||||
const response = await apiCheckDivisionName({ data: { ...dataForm }, user: hasil })
|
const response = await apiCheckDivisionName({ data: { ...dataForm }, user: hasil })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
if (!response.available) {
|
if (!response.available) {
|
||||||
AlertKonfirmasi({
|
setShowWarningModal(true)
|
||||||
title: 'Peringatan',
|
|
||||||
category: 'warning',
|
|
||||||
desc: 'Nama divisi sudah ada. Tidak dapat membuat divisi dengan nama yang sama',
|
|
||||||
onPress: () => { }
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
handleSetData()
|
handleSetData()
|
||||||
}
|
}
|
||||||
@@ -99,7 +97,7 @@ export default function CreateDivision() {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -131,7 +129,7 @@ export default function CreateDivision() {
|
|||||||
/>
|
/>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
{
|
{
|
||||||
@@ -179,6 +177,15 @@ export default function CreateDivision() {
|
|||||||
open={isSelect}
|
open={isSelect}
|
||||||
valChoose={chooseGroup.val}
|
valChoose={chooseGroup.val}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showWarningModal}
|
||||||
|
title="Peringatan"
|
||||||
|
message="Nama divisi sudah ada. Tidak dapat membuat divisi dengan nama yang sama"
|
||||||
|
onConfirm={() => setShowWarningModal(false)}
|
||||||
|
onCancel={() => setShowWarningModal(false)}
|
||||||
|
confirmText="Oke"
|
||||||
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { apiCreateDivision } from "@/lib/api";
|
|||||||
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
||||||
import { setUpdateDivision } from "@/lib/divisionUpdate";
|
import { setUpdateDivision } from "@/lib/divisionUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { StackActions, useNavigation } from "@react-navigation/native";
|
import { StackActions, useNavigation } from "@react-navigation/native";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
@@ -23,6 +24,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function CreateDivisionAddAdmin() {
|
export default function CreateDivisionAddAdmin() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const navigation = useNavigation()
|
const navigation = useNavigation()
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
@@ -104,7 +106,7 @@ export default function CreateDivisionAddAdmin() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
{
|
{
|
||||||
data.length > 0 ?
|
data.length > 0 ?
|
||||||
@@ -123,12 +125,12 @@ export default function CreateDivisionAddAdmin() {
|
|||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode="tail">{item.name}</Text>
|
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode="tail">{item.name}</Text>
|
||||||
{
|
{
|
||||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
found && <Text style={[Styles.textInformation, { color: colors.dimmed }]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i == item.idUser) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i == item.idUser) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { apiGetUser } from "@/lib/api";
|
|||||||
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
import { setFormCreateDivision } from "@/lib/divisionCreate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { Pressable, ScrollView, View } from "react-native";
|
||||||
@@ -22,6 +23,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function CreateDivisionAddMember() {
|
export default function CreateDivisionAddMember() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [dataOld, setDataOld] = useState<Props[]>([])
|
const [dataOld, setDataOld] = useState<Props[]>([])
|
||||||
@@ -84,7 +86,7 @@ export default function CreateDivisionAddMember() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -106,7 +108,7 @@ export default function CreateDivisionAddMember() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
@@ -129,12 +131,12 @@ export default function CreateDivisionAddMember() {
|
|||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode="tail">{item.name}</Text>
|
<Text style={[Styles.textDefault]} numberOfLines={1} ellipsizeMode="tail">{item.name}</Text>
|
||||||
{
|
{
|
||||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
found && <Text style={[Styles.textInformation, { color: colors.dimmed }]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ 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 Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import WrapTab from "@/components/wrapTab";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetDivision } from "@/lib/api";
|
import { apiGetDivision } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import {
|
import {
|
||||||
AntDesign,
|
AntDesign,
|
||||||
Feather,
|
Feather,
|
||||||
Ionicons,
|
Ionicons,
|
||||||
MaterialCommunityIcons,
|
MaterialCommunityIcons
|
||||||
MaterialIcons,
|
|
||||||
} 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";
|
||||||
@@ -38,9 +38,11 @@ export default function ListDivision() {
|
|||||||
const [isList, setList] = useState(false);
|
const [isList, setList] = useState(false);
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [search, setSearch] = useState("")
|
const [search, setSearch] = useState("")
|
||||||
const [nameGroup, setNameGroup] = useState("")
|
const [nameGroup, setNameGroup] = useState("")
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
|
// ... state same ...
|
||||||
const update = useSelector((state: any) => state.divisionUpdate)
|
const update = useSelector((state: any) => state.divisionUpdate)
|
||||||
const arrSkeleton = Array.from({ length: 3 }, (_, index) => index)
|
const arrSkeleton = Array.from({ length: 3 }, (_, index) => index)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
@@ -114,11 +116,11 @@ export default function ListDivision() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
{
|
{
|
||||||
entityUser.role != "user" && entityUser.role != "coadmin" ?
|
entityUser.role != "user" && entityUser.role != "coadmin" ?
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="true"
|
value="true"
|
||||||
@@ -127,7 +129,7 @@ export default function ListDivision() {
|
|||||||
icon={
|
icon={
|
||||||
<Feather
|
<Feather
|
||||||
name="check-circle"
|
name="check-circle"
|
||||||
color={status == "false" ? "black" : "white"}
|
color={status == "false" ? colors.dimmed : "white"}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -141,15 +143,15 @@ export default function ListDivision() {
|
|||||||
icon={
|
icon={
|
||||||
<AntDesign
|
<AntDesign
|
||||||
name="closecircleo"
|
name="closecircleo"
|
||||||
color={status == "true" ? "black" : "white"}
|
color={status == "true" ? colors.dimmed : "white"}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
n={2}
|
n={2}
|
||||||
/>
|
/>
|
||||||
</View>
|
</WrapTab>
|
||||||
:
|
:
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={category == "semua" ? "false" : "true"}
|
active={category == "semua" ? "false" : "true"}
|
||||||
value="true"
|
value="true"
|
||||||
@@ -158,7 +160,7 @@ export default function ListDivision() {
|
|||||||
icon={
|
icon={
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="file-tray-outline"
|
name="file-tray-outline"
|
||||||
color={category == "semua" ? "black" : "white"}
|
color={category == "semua" ? colors.dimmed : "white"}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -172,13 +174,13 @@ export default function ListDivision() {
|
|||||||
icon={
|
icon={
|
||||||
<Ionicons
|
<Ionicons
|
||||||
name="file-tray-stacked-outline"
|
name="file-tray-stacked-outline"
|
||||||
color={category == "semua" ? "white" : "black"}
|
color={category == "semua" ? "white" : colors.dimmed}
|
||||||
size={20}
|
size={20}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
n={2}
|
n={2}
|
||||||
/>
|
/>
|
||||||
</View>
|
</WrapTab>
|
||||||
}
|
}
|
||||||
|
|
||||||
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
|
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
|
||||||
@@ -190,7 +192,7 @@ export default function ListDivision() {
|
|||||||
>
|
>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name={isList ? "format-list-bulleted" : "view-grid"}
|
name={isList ? "format-list-bulleted" : "view-grid"}
|
||||||
color={"black"}
|
color={colors.text}
|
||||||
size={30}
|
size={30}
|
||||||
/>
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
@@ -202,7 +204,7 @@ export default function ListDivision() {
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }, Styles.mt05]}>
|
<View style={[{ flex: 2 }, Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
isList ?
|
isList ?
|
||||||
@@ -216,7 +218,7 @@ export default function ListDivision() {
|
|||||||
:
|
:
|
||||||
data.length == 0 ? (
|
data.length == 0 ? (
|
||||||
<View style={[Styles.mt15]}>
|
<View style={[Styles.mt15]}>
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada data</Text>
|
||||||
</View>
|
</View>
|
||||||
) : (
|
) : (
|
||||||
isList ? (
|
isList ? (
|
||||||
@@ -232,9 +234,10 @@ export default function ListDivision() {
|
|||||||
key={index}
|
key={index}
|
||||||
onPress={() => { router.push(`/division/${item.id}`) }}
|
onPress={() => { router.push(`/division/${item.id}`) }}
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
|
bgColor="transparent"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
|
<View style={[Styles.iconContent]}>
|
||||||
<MaterialIcons name="group" size={25} color={"#384288"} />
|
<Feather name="users" size={25} color={'black'} />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
@@ -250,6 +253,7 @@ export default function ListDivision() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -285,6 +289,7 @@ export default function ListDivision() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiGetDivisionReport } from "@/lib/api";
|
import { apiGetDivisionReport } from "@/lib/api";
|
||||||
import { stringToDate } from "@/lib/fun_stringToDate";
|
import { stringToDate } from "@/lib/fun_stringToDate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -16,6 +17,7 @@ import { SafeAreaView, ScrollView, View } from "react-native";
|
|||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
export default function Report() {
|
export default function Report() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
||||||
const [showReport, setShowReport] = useState(false);
|
const [showReport, setShowReport] = useState(false);
|
||||||
@@ -122,7 +124,7 @@ export default function Report() {
|
|||||||
}, [showReport]);
|
}, [showReport]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -144,11 +146,11 @@ export default function Report() {
|
|||||||
/>
|
/>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15, Styles.mb50]}>
|
<View style={[Styles.p15, Styles.mb50]}>
|
||||||
<SelectForm
|
<SelectForm
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
label="Lembaga Desa"
|
label="Lembaga Desa"
|
||||||
placeholder="Pilih Lembaga Desa"
|
placeholder="Pilih Lembaga Desa"
|
||||||
value={chooseGroup.label}
|
value={chooseGroup.label}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import ButtonBackHeader from "@/components/buttonBackHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
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";
|
||||||
@@ -10,6 +10,7 @@ import { apiEditProfile, apiGetProfile } from "@/lib/api";
|
|||||||
import { setEntities } from "@/lib/entitiesSlice";
|
import { setEntities } from "@/lib/entitiesSlice";
|
||||||
import { validateName } from "@/lib/fun_validateName";
|
import { validateName } from "@/lib/fun_validateName";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useHeaderHeight } from "@react-navigation/elements";
|
import { useHeaderHeight } from "@react-navigation/elements";
|
||||||
import * as ImagePicker from "expo-image-picker";
|
import * as ImagePicker from "expo-image-picker";
|
||||||
@@ -43,9 +44,11 @@ type Props = {
|
|||||||
export default function EditProfile() {
|
export default function EditProfile() {
|
||||||
const headerHeight = useHeaderHeight()
|
const headerHeight = useHeaderHeight()
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
const { colors } = useTheme();
|
||||||
const entities = useSelector((state: any) => state.entities)
|
const entities = useSelector((state: any) => state.entities)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const [errorImg, setErrorImg] = useState(false)
|
const [errorImg, setErrorImg] = useState(false)
|
||||||
|
// ... keeping state same ...
|
||||||
const [selectedImage, setSelectedImage] = useState<string | undefined | { uri: string }>(undefined);
|
const [selectedImage, setSelectedImage] = useState<string | undefined | { uri: string }>(undefined);
|
||||||
const [choosePosition, setChoosePosition] = useState({ val: entities.idPosition, label: entities.position });
|
const [choosePosition, setChoosePosition] = useState({ val: entities.idPosition, label: entities.position });
|
||||||
const [chooseGender, setChooseGender] = useState({ val: entities.gender, label: entities.gender == "F" ? 'Perempuan' : 'Laki-laki' });
|
const [chooseGender, setChooseGender] = useState({ val: entities.gender, label: entities.gender == "F" ? 'Perempuan' : 'Laki-laki' });
|
||||||
@@ -213,27 +216,43 @@ export default function EditProfile() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
headerLeft: () => (
|
// headerLeft: () => (
|
||||||
<ButtonBackHeader
|
// <ButtonBackHeader
|
||||||
onPress={() => {
|
// onPress={() => {
|
||||||
router.back();
|
// router.back();
|
||||||
}}
|
// }}
|
||||||
/>
|
// />
|
||||||
),
|
// ),
|
||||||
headerTitle: "Edit Profile",
|
headerTitle: "Edit Profile",
|
||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
header: () => (
|
||||||
<ButtonSaveHeader
|
<AppHeader
|
||||||
disable={disableBtn || loading ? true : false}
|
title="Edit Profile"
|
||||||
category="update"
|
showBack={true}
|
||||||
onPress={() => {
|
onPressLeft={() => router.back()}
|
||||||
handleEdit()
|
right={
|
||||||
}}
|
<ButtonSaveHeader
|
||||||
|
disable={disableBtn || loading ? true : false}
|
||||||
|
category="update"
|
||||||
|
onPress={() => {
|
||||||
|
handleEdit()
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
),
|
)
|
||||||
|
// headerRight: () => (
|
||||||
|
// <ButtonSaveHeader
|
||||||
|
// disable={disableBtn || loading ? true : false}
|
||||||
|
// category="update"
|
||||||
|
// onPress={() => {
|
||||||
|
// handleEdit()
|
||||||
|
// }}
|
||||||
|
// />
|
||||||
|
// ),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
@@ -243,7 +262,7 @@ export default function EditProfile() {
|
|||||||
>
|
>
|
||||||
<ScrollView showsVerticalScrollIndicator={false}>
|
<ScrollView showsVerticalScrollIndicator={false}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
<View style={[Styles.contentItemCenter]}>
|
||||||
{
|
{
|
||||||
selectedImage != undefined ? (
|
selectedImage != undefined ? (
|
||||||
<Pressable onPress={pickImageAsync}>
|
<Pressable onPress={pickImageAsync}>
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import { ButtonFiturMenu } from "@/components/buttonFiturMenu";
|
import { ButtonFiturMenu } from "@/components/buttonFiturMenu";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { AntDesign, Entypo, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
import { AntDesign, Entypo, Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { SafeAreaView, View } from "react-native";
|
import { SafeAreaView, View } from "react-native";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function Feature() {
|
export default function Feature() {
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
headerTitle: 'Fitur',
|
headerTitle: 'Fitur',
|
||||||
@@ -22,32 +24,26 @@ export default function Feature() {
|
|||||||
/>
|
/>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={[Styles.rowSpaceBetween, Styles.mb15]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mb15]}>
|
||||||
<ButtonFiturMenu icon={<MaterialIcons name="group" size={35} color="black" />} text="Divisi" onPress={() => { router.push('/division?active=true') }} />
|
<ButtonFiturMenu icon={<Feather name="users" size={30} color={colors.icon} />} text="Divisi" onPress={() => { router.push('/division?active=true') }} />
|
||||||
<ButtonFiturMenu icon={<AntDesign name="areachart" size={35} color="black" />} text="Kegiatan" onPress={() => { router.push('/project?status=0') }} />
|
<ButtonFiturMenu icon={<Feather name="bar-chart" size={30} color={colors.icon} />} text="Kegiatan" onPress={() => { router.push('/project?status=0') }} />
|
||||||
<ButtonFiturMenu icon={<MaterialIcons name="campaign" size={35} color="black" />} text="Pengumuman" onPress={() => { router.push('/announcement') }} />
|
<ButtonFiturMenu icon={<Ionicons name="megaphone-outline" size={30} color={colors.icon} />} text="Pengumuman" onPress={() => { router.push('/announcement') }} />
|
||||||
<ButtonFiturMenu icon={<Ionicons name="chatbubbles-sharp" size={35} color="black" />} text="Diskusi" onPress={() => { router.push('/discussion?active=true') }} />
|
<ButtonFiturMenu icon={<Ionicons name="chatbubbles-outline" size={30} color={colors.icon} />} text="Diskusi" onPress={() => { router.push('/discussion?active=true') }} />
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.rowSpaceBetween, Styles.mb15, (entityUser.role == 'cosupadmin' ? Styles.w70 : entityUser.role == 'supadmin' || entityUser.role == 'developer' ? Styles.w100 : Styles.w40)]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mb15, (entityUser.role == 'cosupadmin' ? Styles.w70 : entityUser.role == 'supadmin' || entityUser.role == 'developer' ? Styles.w100 : Styles.w40)]}>
|
||||||
<ButtonFiturMenu icon={<MaterialIcons name="groups" size={35} color="black" />} text="Anggota" onPress={() => { router.push('/member') }} />
|
<ButtonFiturMenu icon={<MaterialCommunityIcons name="account-group-outline" size={30} color={colors.icon} />} text="Anggota" onPress={() => { router.push('/member') }} />
|
||||||
<ButtonFiturMenu icon={<MaterialCommunityIcons name="account-tie" size={35} color="black" />} text="Jabatan" onPress={() => { router.push('/position') }} />
|
<ButtonFiturMenu icon={<MaterialCommunityIcons name="account-tie-outline" size={30} color={colors.icon} />} text="Jabatan" onPress={() => { router.push('/position') }} />
|
||||||
{
|
{
|
||||||
entityUser.role == "cosupadmin" && <ButtonFiturMenu icon={<Entypo name="image-inverted" size={35} color="black" />} text="Banner" onPress={() => { router.push('/banner') }} />
|
entityUser.role == "cosupadmin" && <ButtonFiturMenu icon={<Ionicons name="images-outline" size={30} color={colors.icon} />} text="Banner" onPress={() => { router.push('/banner') }} />
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||||
<>
|
<>
|
||||||
<ButtonFiturMenu icon={<AntDesign name="tags" size={35} color="black" />} text="Lembaga Desa" onPress={() => { router.push('/group') }} />
|
<ButtonFiturMenu icon={<Ionicons name="bookmarks-outline" size={30} color={colors.icon} />} text="Lembaga Desa" onPress={() => { router.push('/group') }} />
|
||||||
{/* <ButtonFiturMenu icon={<Ionicons name="color-palette-sharp" size={35} color="black" />} text="Tema" onPress={() => { }} /> */}
|
{/* <ButtonFiturMenu icon={<Ionicons name="color-palette-sharp" size={30} color={colors.icon} />} text="Tema" onPress={() => { }} /> */}
|
||||||
<ButtonFiturMenu icon={<Entypo name="image-inverted" size={35} color="black" />} text="Banner" onPress={() => { router.push('/banner') }} />
|
<ButtonFiturMenu icon={<Ionicons name="images-outline" size={30} color={colors.icon} />} text="Banner" onPress={() => { router.push('/banner') }} />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
{/* {
|
|
||||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
|
||||||
<View style={[Styles.rowSpaceBetween, Styles.mb15]}>
|
|
||||||
<ButtonFiturMenu icon={<Entypo name="image-inverted" size={35} color="black" />} text="Banner" onPress={() => { router.push('/banner') }} />
|
|
||||||
</View>
|
|
||||||
} */}
|
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
import { ButtonForm } from "@/components/buttonForm";
|
import { ButtonForm } from "@/components/buttonForm";
|
||||||
import ButtonTab from "@/components/buttonTab";
|
import ButtonTab from "@/components/buttonTab";
|
||||||
@@ -8,12 +8,13 @@ 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 Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import WrapTab from "@/components/wrapTab";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiDeleteGroup, apiEditGroup, apiGetGroup } from "@/lib/api";
|
import { apiDeleteGroup, apiEditGroup, apiGetGroup } from "@/lib/api";
|
||||||
import { setUpdateGroup } from "@/lib/groupSlice";
|
import { setUpdateGroup } from "@/lib/groupSlice";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
import { AntDesign, Feather, Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { RefreshControl, View, VirtualizedList } from "react-native";
|
import { RefreshControl, View, VirtualizedList } from "react-native";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
@@ -27,12 +28,14 @@ type Props = {
|
|||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
const [isVisibleEdit, setVisibleEdit] = useState(false)
|
const [isVisibleEdit, setVisibleEdit] = useState(false)
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
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 [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
const [status, setStatus] = useState<'true' | 'false'>('true')
|
const [status, setStatus] = useState<'true' | 'false'>('true')
|
||||||
const [loadingSubmit, setLoadingSubmit] = useState(false)
|
const [loadingSubmit, setLoadingSubmit] = useState(false)
|
||||||
const [idChoose, setIdChoose] = useState('')
|
const [idChoose, setIdChoose] = useState('')
|
||||||
@@ -127,27 +130,27 @@ export default function Index() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.mb10]}>
|
<View style={[Styles.mb10]}>
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="true"
|
value="true"
|
||||||
onPress={() => { setStatus("true") }}
|
onPress={() => { setStatus("true") }}
|
||||||
label="Aktif"
|
label="Aktif"
|
||||||
icon={<Feather name="check-circle" color={status == "true" ? 'white' : 'black'} size={20} />}
|
icon={<Feather name="check-circle" color={status == "true" ? 'white' : colors.dimmed} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="false"
|
value="false"
|
||||||
onPress={() => { setStatus("false") }}
|
onPress={() => { setStatus("false") }}
|
||||||
label="Tidak Aktif"
|
label="Tidak Aktif"
|
||||||
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : 'black'} size={20} />}
|
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : colors.dimmed} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
</View>
|
</WrapTab>
|
||||||
<InputSearch onChange={setSearch} />
|
<InputSearch onChange={setSearch} />
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }, Styles.mt05]}>
|
<View style={[{ flex: 2 }, Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
arrSkeleton.map((item, index) => {
|
arrSkeleton.map((item, index) => {
|
||||||
@@ -173,8 +176,8 @@ export default function Index() {
|
|||||||
}}
|
}}
|
||||||
borderType="all"
|
borderType="all"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
|
<View style={[Styles.iconContent]}>
|
||||||
<MaterialCommunityIcons name="office-building-outline" size={25} color={'#384288'} />
|
<Ionicons name="bookmark-outline" size={25} color={'black'} />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
@@ -187,30 +190,29 @@ export default function Index() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} 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={colors.text} size={25} />}
|
||||||
title={activeChoose ? "Non Aktifkan" : "Aktifkan"}
|
title={activeChoose ? "Non Aktifkan" : "Aktifkan"}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
AlertKonfirmasi({
|
setTimeout(() => {
|
||||||
title: 'Konfirmasi',
|
setShowDeleteModal(true)
|
||||||
desc: activeChoose ? 'Apakah anda yakin ingin menonaktifkan data?' : 'Apakah anda yakin ingin mengaktifkan data?',
|
}, 600)
|
||||||
onPress: () => { handleDelete() }
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="pencil-outline" color={colors.text} size={25} />}
|
||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
@@ -232,6 +234,7 @@ export default function Index() {
|
|||||||
label="Lembaga Desa"
|
label="Lembaga Desa"
|
||||||
value={titleChoose}
|
value={titleChoose}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
|
bg={"transparent"}
|
||||||
errorText="Lembaga Desa tidak boleh kosong & minimal 3 karakter"
|
errorText="Lembaga Desa tidak boleh kosong & minimal 3 karakter"
|
||||||
onChange={(val) => { validationForm(val, 'title') }} />
|
onChange={(val) => { validationForm(val, 'title') }} />
|
||||||
</View>
|
</View>
|
||||||
@@ -240,6 +243,19 @@ export default function Index() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message={activeChoose ? 'Apakah anda yakin ingin menonaktifkan data?' : 'Apakah anda yakin ingin mengaktifkan data?'}
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDelete()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText={activeChoose ? "Nonaktifkan" : "Aktifkan"}
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</View >
|
</View >
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import CaraouselHome from "@/components/home/carouselHome";
|
import CaraouselHome2 from "@/components/home/carouselHome2";
|
||||||
import ChartDokumenHome from "@/components/home/chartDokumenHome";
|
import ChartDokumenHome from "@/components/home/chartDokumenHome";
|
||||||
import ChartProgresHome from "@/components/home/chartProgresHome";
|
import ChartProgresHome from "@/components/home/chartProgresHome";
|
||||||
import DisccussionHome from "@/components/home/discussionHome";
|
import DisccussionHome from "@/components/home/discussionHome";
|
||||||
import DivisionHome from "@/components/home/divisionHome";
|
import DivisionHome from "@/components/home/divisionHome";
|
||||||
import EventHome from "@/components/home/eventHome";
|
import EventHome from "@/components/home/eventHome";
|
||||||
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 Text from "@/components/Text";
|
||||||
@@ -12,9 +11,11 @@ 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 { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
import { LinearGradient } from "expo-linear-gradient";
|
||||||
import { Stack } from "expo-router";
|
import { Stack } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
import { Dimensions, Platform, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ 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, signOut } = useAuthSession()
|
const { token, decryptToken, signOut } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const insets = useSafeAreaInsets()
|
const insets = useSafeAreaInsets()
|
||||||
const [refreshing, setRefreshing] = useState(false)
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
|
||||||
@@ -47,13 +49,13 @@ export default function Home() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
title: 'Home',
|
title: 'Home',
|
||||||
headerTitle: entities.village,
|
headerTitle: entities.village,
|
||||||
header: () => (
|
header: () => (
|
||||||
<View style={[Styles.rowItemsCenter, Styles.ph20, Platform.OS === 'ios' ? Styles.pb07 : Styles.pb13, { backgroundColor: '#19345E', paddingTop: Platform.OS === 'ios' ? insets.top : 10 }]}>
|
<View style={[Styles.rowItemsCenter, Styles.ph20, Platform.OS === 'ios' ? Styles.pb07 : Styles.pb13, { backgroundColor: colors.header, paddingTop: Platform.OS === 'ios' ? insets.top : 10 }]}>
|
||||||
<Text style={Styles.textHeaderHome}>{entities.village}</Text>
|
<Text style={Styles.textHeaderHome}>{entities.village}</Text>
|
||||||
<HeaderRightHome />
|
<HeaderRightHome />
|
||||||
</View>
|
</View>
|
||||||
@@ -65,19 +67,36 @@ export default function Home() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<CaraouselHome refreshing={refreshing}/>
|
<LinearGradient
|
||||||
<View style={[Styles.ph15, Styles.mb100]}>
|
colors={[colors.header, colors.header, colors.header, colors.header, colors.homeGradient]}
|
||||||
<FiturHome />
|
style={[
|
||||||
<ProjectHome refreshing={refreshing}/>
|
Styles.posAbsolute,
|
||||||
<DivisionHome refreshing={refreshing}/>
|
Styles.zIndexMinus1,
|
||||||
<ChartProgresHome refreshing={refreshing}/>
|
{
|
||||||
<ChartDokumenHome refreshing={refreshing}/>
|
width: Dimensions.get('window').width * 1.5,
|
||||||
<EventHome refreshing={refreshing}/>
|
height: Dimensions.get('window').width * 1.5,
|
||||||
<DisccussionHome refreshing={refreshing}/>
|
borderRadius: Dimensions.get('window').width * 0.5,
|
||||||
|
top: -Dimensions.get('window').width * 1, // Positioned to show the bottom part of the circle as an arc
|
||||||
|
left: -Dimensions.get('window').width * 0.25,
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
{/* <CaraouselHome refreshing={refreshing} /> */}
|
||||||
|
<View style={[Styles.ph15]}>
|
||||||
|
<CaraouselHome2 refreshing={refreshing} />
|
||||||
|
{/* <FiturHome /> */}
|
||||||
|
<ProjectHome refreshing={refreshing} />
|
||||||
|
<DivisionHome refreshing={refreshing} />
|
||||||
|
<ChartProgresHome refreshing={refreshing} />
|
||||||
|
<ChartDokumenHome refreshing={refreshing} />
|
||||||
|
<EventHome refreshing={refreshing} />
|
||||||
|
<DisccussionHome refreshing={refreshing} />
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import { ConstEnv } from "@/constants/ConstEnv";
|
|||||||
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 { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
import { LinearGradient } from "expo-linear-gradient";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Pressable, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
import { Pressable, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -33,6 +35,7 @@ type Props = {
|
|||||||
|
|
||||||
export default function MemberDetail() {
|
export default function MemberDetail() {
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
|
const { colors } = useTheme();
|
||||||
const [data, setData] = useState<Props>()
|
const [data, setData] = useState<Props>()
|
||||||
const [errorImg, setErrorImg] = useState(false)
|
const [errorImg, setErrorImg] = useState(false)
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
@@ -74,13 +77,11 @@ export default function MemberDetail() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
|
||||||
headerTitle: 'Anggota',
|
headerTitle: 'Anggota',
|
||||||
headerTitleAlign: 'center',
|
headerTitleAlign: 'center',
|
||||||
// headerRight: () => (entityUser.role != "user") && isEdit ? <HeaderRightMemberDetail active={data?.isActive} id={id} /> : <></>,
|
|
||||||
header: () => (
|
header: () => (
|
||||||
<AppHeader title="Anggota"
|
<AppHeader title="Anggota"
|
||||||
showBack={true}
|
showBack={true}
|
||||||
@@ -93,15 +94,19 @@ export default function MemberDetail() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<View style={[Styles.wrapHeadViewMember]}>
|
<LinearGradient
|
||||||
|
colors={[colors.header, colors.homeGradient]}
|
||||||
|
style={[Styles.wrapHeadViewMember]}
|
||||||
|
>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
<>
|
<>
|
||||||
@@ -114,15 +119,15 @@ export default function MemberDetail() {
|
|||||||
<Pressable onPress={() => setPreview(true)}>
|
<Pressable onPress={() => setPreview(true)}>
|
||||||
<ImageUser src={`${ConstEnv.url_storage}/files/${data?.img}`} size="lg" onError={setErrorImg} />
|
<ImageUser src={`${ConstEnv.url_storage}/files/${data?.img}`} size="lg" onError={setErrorImg} />
|
||||||
</Pressable>
|
</Pressable>
|
||||||
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10, { textAlign: 'center' }]}>{data?.name}</Text>
|
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10, Styles.textCenter]}>{data?.name}</Text>
|
||||||
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{data?.role}</Text>
|
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{data?.role}</Text>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
}
|
}
|
||||||
</View>
|
</LinearGradient>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>Informasi</Text>
|
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Informasi</Text>
|
||||||
<LabelStatus
|
<LabelStatus
|
||||||
size="small"
|
size="small"
|
||||||
category={data?.isActive ? 'success' : 'error'}
|
category={data?.isActive ? 'success' : 'error'}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
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 Text from "@/components/Text";
|
||||||
@@ -10,6 +11,7 @@ import { apiCreateUser } from "@/lib/api";
|
|||||||
import { validateName } from "@/lib/fun_validateName";
|
import { validateName } from "@/lib/fun_validateName";
|
||||||
import { setUpdateMember } from "@/lib/memberSlice";
|
import { setUpdateMember } from "@/lib/memberSlice";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import * as ImagePicker from "expo-image-picker";
|
import * as ImagePicker from "expo-image-picker";
|
||||||
@@ -32,6 +34,7 @@ export default function CreateMember() {
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.memberUpdate)
|
const update = useSelector((state: any) => state.memberUpdate)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [valSelect, setValSelect] = useState<"group" | "position" | "role" | "gender">("group");
|
const [valSelect, setValSelect] = useState<"group" | "position" | "role" | "gender">("group");
|
||||||
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
||||||
const [choosePosition, setChoosePosition] = useState({ val: "", label: "" });
|
const [choosePosition, setChoosePosition] = useState({ val: "", label: "" });
|
||||||
@@ -206,25 +209,11 @@ export default function CreateMember() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
|
||||||
// <ButtonBackHeader
|
|
||||||
// onPress={() => {
|
|
||||||
// router.back();
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
headerTitle: "Tambah Anggota",
|
headerTitle: "Tambah Anggota",
|
||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
// headerRight: () => (
|
|
||||||
// <ButtonSaveHeader
|
|
||||||
// disable={disableBtn || loading}
|
|
||||||
// category="create"
|
|
||||||
// onPress={() => { handleCreate() }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
header: () => (
|
header: () => (
|
||||||
<AppHeader title="Anggota"
|
<AppHeader title="Anggota"
|
||||||
showBack={true}
|
showBack={true}
|
||||||
@@ -240,14 +229,15 @@ export default function CreateMember() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{loading && <LoadingCenter />}
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
keyboardVerticalOffset={headerHeight}
|
keyboardVerticalOffset={headerHeight}
|
||||||
>
|
>
|
||||||
<ScrollView showsVerticalScrollIndicator={false}>
|
<ScrollView showsVerticalScrollIndicator={false}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
<View style={[Styles.contentItemCenter]}>
|
||||||
{selectedImage != undefined ? (
|
{selectedImage != undefined ? (
|
||||||
<Pressable onPress={pickImageAsync}>
|
<Pressable onPress={pickImageAsync}>
|
||||||
<Image src={selectedImage} style={[Styles.userProfileBig]} />
|
<Image src={selectedImage} style={[Styles.userProfileBig]} />
|
||||||
@@ -271,6 +261,7 @@ export default function CreateMember() {
|
|||||||
placeholder="Pilih Lembaga Desa"
|
placeholder="Pilih Lembaga Desa"
|
||||||
value={chooseGroup.label}
|
value={chooseGroup.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(chooseGroup.val);
|
setValChoose(chooseGroup.val);
|
||||||
setValSelect("group");
|
setValSelect("group");
|
||||||
@@ -285,6 +276,7 @@ export default function CreateMember() {
|
|||||||
placeholder="Pilih Jabatan"
|
placeholder="Pilih Jabatan"
|
||||||
value={choosePosition.label}
|
value={choosePosition.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(choosePosition.val);
|
setValChoose(choosePosition.val);
|
||||||
setValSelect("position");
|
setValSelect("position");
|
||||||
@@ -298,6 +290,7 @@ export default function CreateMember() {
|
|||||||
placeholder="Pilih Role"
|
placeholder="Pilih Role"
|
||||||
value={chooseRole.label}
|
value={chooseRole.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(chooseRole.val);
|
setValChoose(chooseRole.val);
|
||||||
setValSelect("role");
|
setValSelect("role");
|
||||||
@@ -311,6 +304,7 @@ export default function CreateMember() {
|
|||||||
type="numeric"
|
type="numeric"
|
||||||
placeholder="NIK"
|
placeholder="NIK"
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
error={error.nik}
|
error={error.nik}
|
||||||
errorText="NIK Harus 16 Karakter"
|
errorText="NIK Harus 16 Karakter"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -322,6 +316,7 @@ export default function CreateMember() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Nama"
|
placeholder="Nama"
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
error={error.name}
|
error={error.name}
|
||||||
errorText="Nama harus 3–50 karakter (huruf, angka, spasi, dan simbol ringan (. , ' _ -))"
|
errorText="Nama harus 3–50 karakter (huruf, angka, spasi, dan simbol ringan (. , ' _ -))"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -333,6 +328,7 @@ export default function CreateMember() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
error={error.email}
|
error={error.email}
|
||||||
errorText="Email tidak valid"
|
errorText="Email tidak valid"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -344,7 +340,8 @@ export default function CreateMember() {
|
|||||||
type="numeric"
|
type="numeric"
|
||||||
placeholder="8XX-XXX-XXX"
|
placeholder="8XX-XXX-XXX"
|
||||||
required
|
required
|
||||||
itemLeft={<Text style={[Platform.OS === 'ios' && Styles.mt02]}>+62</Text>}
|
bg={colors.card}
|
||||||
|
itemLeft={<Text style={[Platform.OS === 'ios' && Styles.mt02, { color: colors.text }]}>+62</Text>}
|
||||||
error={error.phone}
|
error={error.phone}
|
||||||
errorText="Nomor Telepon tidak valid"
|
errorText="Nomor Telepon tidak valid"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -356,6 +353,7 @@ export default function CreateMember() {
|
|||||||
placeholder="Pilih Jenis Kelamin"
|
placeholder="Pilih Jenis Kelamin"
|
||||||
value={chooseGender.label}
|
value={chooseGender.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(chooseGender.val);
|
setValChoose(chooseGender.val);
|
||||||
setValSelect("gender");
|
setValSelect("gender");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
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 Text from "@/components/Text";
|
||||||
@@ -10,6 +11,7 @@ import { apiEditUser, apiGetProfile } from "@/lib/api";
|
|||||||
import { validateName } from "@/lib/fun_validateName";
|
import { validateName } from "@/lib/fun_validateName";
|
||||||
import { setUpdateMember } from "@/lib/memberSlice";
|
import { setUpdateMember } from "@/lib/memberSlice";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import * as ImagePicker from "expo-image-picker";
|
import * as ImagePicker from "expo-image-picker";
|
||||||
@@ -47,6 +49,7 @@ export default function EditMember() {
|
|||||||
const update = useSelector((state: any) => state.memberUpdate)
|
const update = useSelector((state: any) => state.memberUpdate)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
|
const { colors } = useTheme();
|
||||||
const [errorImg, setErrorImg] = useState(false)
|
const [errorImg, setErrorImg] = useState(false)
|
||||||
const [selectedImage, setSelectedImage] = useState<string | undefined | { uri: string }>(undefined);
|
const [selectedImage, setSelectedImage] = useState<string | undefined | { uri: string }>(undefined);
|
||||||
const [choosePosition, setChoosePosition] = useState({ val: "", label: "" });
|
const [choosePosition, setChoosePosition] = useState({ val: "", label: "" });
|
||||||
@@ -236,27 +239,11 @@ export default function EditMember() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
|
||||||
// <ButtonBackHeader
|
|
||||||
// onPress={() => {
|
|
||||||
// router.back();
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
headerTitle: "Edit Anggota",
|
headerTitle: "Edit Anggota",
|
||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
// headerRight: () => (
|
|
||||||
// <ButtonSaveHeader
|
|
||||||
// disable={disableBtn || loading}
|
|
||||||
// category="update"
|
|
||||||
// onPress={() => {
|
|
||||||
// handleEdit()
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
// ),
|
|
||||||
header: () => (
|
header: () => (
|
||||||
<AppHeader
|
<AppHeader
|
||||||
title="Edit Anggota"
|
title="Edit Anggota"
|
||||||
@@ -275,15 +262,15 @@ export default function EditMember() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{loading && <LoadingCenter />}
|
||||||
<KeyboardAvoidingView
|
<KeyboardAvoidingView
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
keyboardVerticalOffset={headerHeight}
|
keyboardVerticalOffset={headerHeight}
|
||||||
>
|
>
|
||||||
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
<ScrollView showsVerticalScrollIndicator={false} style={[Styles.h100]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={{ justifyContent: "center", alignItems: "center" }}>
|
<View style={[Styles.contentItemCenter]}>
|
||||||
{
|
{
|
||||||
errorImg ?
|
errorImg ?
|
||||||
<Pressable onPress={pickImageAsync}>
|
<Pressable onPress={pickImageAsync}>
|
||||||
@@ -325,6 +312,7 @@ export default function EditMember() {
|
|||||||
placeholder="Pilih Jabatan"
|
placeholder="Pilih Jabatan"
|
||||||
value={choosePosition.label}
|
value={choosePosition.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(choosePosition.val);
|
setValChoose(choosePosition.val);
|
||||||
setValSelect("position");
|
setValSelect("position");
|
||||||
@@ -338,6 +326,7 @@ export default function EditMember() {
|
|||||||
placeholder="Pilih Role"
|
placeholder="Pilih Role"
|
||||||
value={chooseRole.label}
|
value={chooseRole.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(chooseRole.val);
|
setValChoose(chooseRole.val);
|
||||||
setValSelect("role");
|
setValSelect("role");
|
||||||
@@ -352,6 +341,7 @@ export default function EditMember() {
|
|||||||
placeholder="NIK"
|
placeholder="NIK"
|
||||||
required
|
required
|
||||||
value={data?.nik}
|
value={data?.nik}
|
||||||
|
bg={colors.card}
|
||||||
error={error.nik}
|
error={error.nik}
|
||||||
errorText="NIK Harus 16 Karakter"
|
errorText="NIK Harus 16 Karakter"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -364,6 +354,7 @@ export default function EditMember() {
|
|||||||
placeholder="Nama"
|
placeholder="Nama"
|
||||||
required
|
required
|
||||||
value={data?.name}
|
value={data?.name}
|
||||||
|
bg={colors.card}
|
||||||
error={error.name}
|
error={error.name}
|
||||||
errorText="Nama harus 3–50 karakter (huruf, angka, spasi, dan simbol ringan (. , ' _ -))"
|
errorText="Nama harus 3–50 karakter (huruf, angka, spasi, dan simbol ringan (. , ' _ -))"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -376,6 +367,7 @@ export default function EditMember() {
|
|||||||
placeholder="Email"
|
placeholder="Email"
|
||||||
required
|
required
|
||||||
value={data?.email}
|
value={data?.email}
|
||||||
|
bg={colors.card}
|
||||||
error={error.email}
|
error={error.email}
|
||||||
errorText="Email tidak valid"
|
errorText="Email tidak valid"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -387,8 +379,9 @@ export default function EditMember() {
|
|||||||
type="numeric"
|
type="numeric"
|
||||||
placeholder="8XX-XXX-XXX"
|
placeholder="8XX-XXX-XXX"
|
||||||
required
|
required
|
||||||
itemLeft={<Text style={[Platform.OS === 'ios' && Styles.mt02]}>+62</Text>}
|
itemLeft={<Text style={[Platform.OS === 'ios' && Styles.mt02, { color: colors.text }]}>+62</Text>}
|
||||||
value={data?.phone}
|
value={data?.phone}
|
||||||
|
bg={colors.card}
|
||||||
error={error.phone}
|
error={error.phone}
|
||||||
errorText="Nomor Telepon tidak valid"
|
errorText="Nomor Telepon tidak valid"
|
||||||
onChange={val => {
|
onChange={val => {
|
||||||
@@ -400,6 +393,7 @@ export default function EditMember() {
|
|||||||
placeholder="Pilih Jenis Kelamin"
|
placeholder="Pilih Jenis Kelamin"
|
||||||
value={chooseGender.label}
|
value={chooseGender.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(chooseGender.val);
|
setValChoose(chooseGender.val);
|
||||||
setValSelect("gender");
|
setValSelect("gender");
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ import InputSearch from "@/components/inputSearch";
|
|||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
|
import WrapTab from "@/components/wrapTab";
|
||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
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 { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -33,6 +35,7 @@ export default function Index() {
|
|||||||
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
|
const { colors } = useTheme();
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const [nameGroup, setNameGroup] = useState('')
|
const [nameGroup, setNameGroup] = useState('')
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
@@ -104,24 +107,24 @@ export default function Index() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="true"
|
value="true"
|
||||||
onPress={() => { setStatus("true") }}
|
onPress={() => { setStatus("true") }}
|
||||||
label="Aktif"
|
label="Aktif"
|
||||||
icon={<Feather name="check-circle" color={status == "false" ? 'black' : 'white'} size={20} />}
|
icon={<Feather name="check-circle" color={status == "false" ? colors.dimmed : 'white'} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="false"
|
value="false"
|
||||||
onPress={() => { setStatus("false") }}
|
onPress={() => { setStatus("false") }}
|
||||||
label="Tidak Aktif"
|
label="Tidak Aktif"
|
||||||
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : 'black'} size={20} />}
|
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : colors.dimmed} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
</View>
|
</WrapTab>
|
||||||
<InputSearch onChange={setSearch} />
|
<InputSearch onChange={setSearch} />
|
||||||
{
|
{
|
||||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||||
@@ -131,7 +134,7 @@ export default function Index() {
|
|||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }, Styles.mt05]}>
|
<View style={[{ flex: 2 }, Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
arrSkeleton.map((item, index) => {
|
arrSkeleton.map((item, index) => {
|
||||||
@@ -168,11 +171,12 @@ export default function Index() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
|
import BorderBottomItemVertical from "@/components/borderBottomItemVertical";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||||
@@ -7,6 +8,7 @@ import { apiGetNotification, apiReadOneNotification } from "@/lib/api";
|
|||||||
import { setUpdateNotification } from "@/lib/notificationSlice";
|
import { setUpdateNotification } from "@/lib/notificationSlice";
|
||||||
import { pushToPage } from "@/lib/pushToPage";
|
import { pushToPage } from "@/lib/pushToPage";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Feather } from "@expo/vector-icons";
|
import { Feather } from "@expo/vector-icons";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { RefreshControl, SafeAreaView, View, VirtualizedList } from "react-native";
|
import { RefreshControl, SafeAreaView, View, VirtualizedList } from "react-native";
|
||||||
@@ -24,6 +26,7 @@ type Props = {
|
|||||||
|
|
||||||
export default function Notification() {
|
export default function Notification() {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const [page, setPage] = useState(1)
|
const [page, setPage] = useState(1)
|
||||||
@@ -97,7 +100,7 @@ export default function Notification() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
@@ -114,21 +117,21 @@ export default function Notification() {
|
|||||||
getItem={getItem}
|
getItem={getItem}
|
||||||
renderItem={({ item, index }: { item: Props, index: number }) => {
|
renderItem={({ item, index }: { item: Props, index: number }) => {
|
||||||
return (
|
return (
|
||||||
<BorderBottomItem
|
<BorderBottomItemVertical
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, item.isRead ? ColorsStatus.secondary : ColorsStatus.primary]}>
|
<View style={[Styles.iconContent, item.isRead && ColorsStatus.secondary]}>
|
||||||
<Feather name="bell" size={25} color="white" />
|
<Feather name="bell" size={25} color="black" />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
rightTopInfo={item.createdAt}
|
rightTopInfo={item.createdAt}
|
||||||
desc={item.desc}
|
desc={item.desc}
|
||||||
textColor={item.isRead ? 'gray' : 'black'}
|
textColor={item.isRead ? 'gray' : colors.text}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleReadNotification(item.id, item.category, item.idContent)
|
handleReadNotification(item.id, item.category, item.idContent)
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
bgColor={'transparent'}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
@@ -140,11 +143,12 @@ export default function Notification() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
|
||||||
import BorderBottomItem from "@/components/borderBottomItem";
|
import BorderBottomItem from "@/components/borderBottomItem";
|
||||||
import { ButtonForm } from "@/components/buttonForm";
|
import { ButtonForm } from "@/components/buttonForm";
|
||||||
import ButtonTab from "@/components/buttonTab";
|
import ButtonTab from "@/components/buttonTab";
|
||||||
@@ -7,13 +6,15 @@ import { InputForm } from "@/components/inputForm";
|
|||||||
import InputSearch from "@/components/inputSearch";
|
import InputSearch from "@/components/inputSearch";
|
||||||
import LabelStatus from "@/components/labelStatus";
|
import LabelStatus from "@/components/labelStatus";
|
||||||
import MenuItemRow from "@/components/menuItemRow";
|
import MenuItemRow from "@/components/menuItemRow";
|
||||||
|
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
import SkeletonTwoItem from "@/components/skeletonTwoItem";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
import WrapTab from "@/components/wrapTab";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiDeletePosition, apiEditPosition, apiGetPosition } from "@/lib/api";
|
import { apiDeletePosition, apiEditPosition, apiGetPosition } from "@/lib/api";
|
||||||
import { setUpdatePosition } from "@/lib/positionSlice";
|
import { setUpdatePosition } from "@/lib/positionSlice";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -33,6 +34,7 @@ export default function Index() {
|
|||||||
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 { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme()
|
||||||
const [status, setStatus] = useState<'true' | 'false'>('true')
|
const [status, setStatus] = useState<'true' | 'false'>('true')
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
const { active, group } = useLocalSearchParams<{ active?: string, group?: string }>()
|
||||||
@@ -47,6 +49,7 @@ export default function Index() {
|
|||||||
name: false,
|
name: false,
|
||||||
});
|
});
|
||||||
const [refreshing, setRefreshing] = useState(false)
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
|
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.positionUpdate)
|
const update = useSelector((state: any) => state.positionUpdate)
|
||||||
@@ -146,24 +149,24 @@ export default function Index() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
<View style={[Styles.wrapBtnTab]}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="true"
|
value="true"
|
||||||
onPress={() => { setStatus("true") }}
|
onPress={() => { setStatus("true") }}
|
||||||
label="Aktif"
|
label="Aktif"
|
||||||
icon={<Feather name="check-circle" color={status == "true" ? 'white' : 'black'} size={20} />}
|
icon={<Feather name="check-circle" color={status == "true" ? 'white' : colors.dimmed} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
<ButtonTab
|
<ButtonTab
|
||||||
active={status == "false" ? "false" : "true"}
|
active={status == "false" ? "false" : "true"}
|
||||||
value="false"
|
value="false"
|
||||||
onPress={() => { setStatus("false") }}
|
onPress={() => { setStatus("false") }}
|
||||||
label="Tidak Aktif"
|
label="Tidak Aktif"
|
||||||
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : 'black'} size={20} />}
|
icon={<AntDesign name="closecircleo" color={status == "false" ? 'white' : colors.dimmed} size={20} />}
|
||||||
n={2} />
|
n={2} />
|
||||||
</View>
|
</WrapTab>
|
||||||
<InputSearch onChange={setSearch} />
|
<InputSearch onChange={setSearch} />
|
||||||
{
|
{
|
||||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||||
@@ -173,7 +176,7 @@ export default function Index() {
|
|||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }, Styles.mt05]}>
|
<View style={[Styles.flex2, Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
arrSkeleton.map((item, index) => {
|
arrSkeleton.map((item, index) => {
|
||||||
@@ -197,8 +200,8 @@ export default function Index() {
|
|||||||
}}
|
}}
|
||||||
borderType="all"
|
borderType="all"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
|
<View style={[Styles.iconContent]}>
|
||||||
<MaterialCommunityIcons name="account-tie" size={25} color={'#384288'} />
|
<MaterialCommunityIcons name="account-tie-outline" size={25} color={'black'} />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
@@ -212,29 +215,28 @@ export default function Index() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} 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={colors.text} size={25} />}
|
||||||
title={chooseData.active ? 'Non Aktifkan' : "Aktifkan"}
|
title={chooseData.active ? 'Non Aktifkan' : "Aktifkan"}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
AlertKonfirmasi({
|
setTimeout(() => {
|
||||||
title: 'Konfirmasi',
|
setShowDeleteModal(true)
|
||||||
desc: chooseData.active ? 'Apakah anda yakin ingin menonaktifkan data?' : 'Apakah anda yakin ingin mengaktifkan data?',
|
}, 600)
|
||||||
onPress: () => { handleDelete() }
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
|
icon={<MaterialCommunityIcons name="pencil-outline" color={colors.text} size={25} />}
|
||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setModal(false)
|
setModal(false)
|
||||||
@@ -248,13 +250,14 @@ export default function Index() {
|
|||||||
|
|
||||||
|
|
||||||
<DrawerBottom animation="none" keyboard height={30} backdropPressable={false} isVisible={isVisibleEdit} setVisible={() => setVisibleEdit(false)} title="Edit Jabatan">
|
<DrawerBottom animation="none" keyboard height={30} backdropPressable={false} isVisible={isVisibleEdit} setVisible={() => setVisibleEdit(false)} title="Edit Jabatan">
|
||||||
<View style={{ justifyContent: 'space-between', flex: 1 }}>
|
<View style={[Styles.justifySpaceBetween, Styles.flex1]}>
|
||||||
<View>
|
<View>
|
||||||
<InputForm
|
<InputForm
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Nama Jabatan"
|
placeholder="Nama Jabatan"
|
||||||
required
|
required
|
||||||
label="Jabatan"
|
label="Jabatan"
|
||||||
|
bg={"transparent"}
|
||||||
value={chooseData.name}
|
value={chooseData.name}
|
||||||
onChange={(val) => { validationForm(val) }}
|
onChange={(val) => { validationForm(val) }}
|
||||||
error={error.name}
|
error={error.name}
|
||||||
@@ -266,6 +269,19 @@ export default function Index() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message={chooseData.active ? 'Apakah anda yakin ingin menonaktifkan data?' : 'Apakah anda yakin ingin mengaktifkan data?'}
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDelete()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText={chooseData.active ? "Nonaktifkan" : "Aktifkan"}
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import AlertKonfirmasi from "@/components/alertKonfirmasi";
|
|
||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import { ButtonHeader } from "@/components/buttonHeader";
|
import { ButtonHeader } from "@/components/buttonHeader";
|
||||||
import ItemDetailMember from "@/components/itemDetailMember";
|
import ItemDetailMember from "@/components/itemDetailMember";
|
||||||
@@ -6,23 +5,45 @@ import Text from "@/components/Text";
|
|||||||
import { assetUserImage } from "@/constants/AssetsError";
|
import { assetUserImage } from "@/constants/AssetsError";
|
||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
|
import { apiGetProfile } from "@/lib/api";
|
||||||
|
import { setEntities } from "@/lib/entitiesSlice";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { AntDesign } from "@expo/vector-icons";
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
import { Feather } from "@expo/vector-icons";
|
||||||
|
import { LinearGradient } from "expo-linear-gradient";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Image, Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
import { Image, Pressable, RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import ImageViewing from 'react-native-image-viewing';
|
import ImageViewing from 'react-native-image-viewing';
|
||||||
import { useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
const { signOut } = useAuthSession()
|
const { colors } = useTheme();
|
||||||
const entities = useSelector((state: any) => state.entities)
|
const entities = useSelector((state: any) => state.entities)
|
||||||
const [error, setError] = useState(false)
|
const [error, setError] = useState(false)
|
||||||
const [preview, setPreview] = useState(false)
|
const [preview, setPreview] = useState(false)
|
||||||
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
|
||||||
|
async function handleUserLogin() {
|
||||||
|
const hasil = await decryptToken(String(token?.current))
|
||||||
|
apiGetProfile({ id: hasil })
|
||||||
|
.then((data) => dispatch(setEntities(data.data)))
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleRefresh = async () => {
|
||||||
|
setRefreshing(true)
|
||||||
|
handleUserLogin()
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
|
setRefreshing(false)
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
headerTitle: 'Profile',
|
headerTitle: 'Profile',
|
||||||
@@ -34,33 +55,31 @@ export default function Profile() {
|
|||||||
onPressLeft={() => router.back()}
|
onPressLeft={() => router.back()}
|
||||||
right={
|
right={
|
||||||
<ButtonHeader
|
<ButtonHeader
|
||||||
item={<AntDesign name="logout" size={20} color="white" />}
|
item={<Feather name="settings" size={20} color="white" />}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
AlertKonfirmasi({
|
router.push('/setting')
|
||||||
title: 'Keluar',
|
|
||||||
desc: 'Apakah anda yakin ingin keluar?',
|
|
||||||
onPress: () => { signOut() }
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
// headerRight: () => <ButtonHeader
|
|
||||||
// item={<AntDesign name="logout" size={20} color="white" />}
|
|
||||||
// onPress={() => {
|
|
||||||
// AlertKonfirmasi({
|
|
||||||
// title: 'Keluar',
|
|
||||||
// desc: 'Apakah anda yakin ingin keluar?',
|
|
||||||
// onPress: () => { signOut() }
|
|
||||||
// })
|
|
||||||
// }}
|
|
||||||
// />
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView style={[Styles.h100]}>
|
<ScrollView
|
||||||
<View style={{ flexDirection: 'column' }}>
|
refreshControl={
|
||||||
<View style={[Styles.wrapHeadViewMember]}>
|
<RefreshControl
|
||||||
|
refreshing={refreshing}
|
||||||
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
|
>
|
||||||
|
<View style={[Styles.flexColumn]}>
|
||||||
|
<LinearGradient
|
||||||
|
colors={[colors.header, colors.homeGradient]}
|
||||||
|
style={[Styles.wrapHeadViewMember]}
|
||||||
|
>
|
||||||
<Pressable onPress={() => setPreview(true)}>
|
<Pressable onPress={() => setPreview(true)}>
|
||||||
<Image
|
<Image
|
||||||
source={error ? require("../../assets/images/user.jpg") : { uri: `${ConstEnv.url_storage}/files/${entities.img}` }}
|
source={error ? require("../../assets/images/user.jpg") : { uri: `${ConstEnv.url_storage}/files/${entities.img}` }}
|
||||||
@@ -70,14 +89,12 @@ export default function Profile() {
|
|||||||
</Pressable>
|
</Pressable>
|
||||||
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10]}>{entities.name}</Text>
|
<Text style={[Styles.textSubtitle, Styles.cWhite, Styles.mt10]}>{entities.name}</Text>
|
||||||
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{entities.role}</Text>
|
<Text style={[Styles.textMediumNormal, Styles.cWhite]}>{entities.role}</Text>
|
||||||
</View>
|
</LinearGradient>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold]}>Informasi</Text>
|
<Text style={[Styles.textDefaultSemiBold, { color: colors.text }]}>Informasi</Text>
|
||||||
{
|
|
||||||
entities.idUserRole != "developer" && <Text onPress={() => { router.push('/edit-profile') }} style={[Styles.textLink]}>Edit</Text>
|
|
||||||
}
|
|
||||||
</View>
|
</View>
|
||||||
|
{/* Note: ItemDetailMember might need updates to support dynamic colors if it uses default text colors */}
|
||||||
<ItemDetailMember category="nik" value={entities.nik} />
|
<ItemDetailMember category="nik" value={entities.nik} />
|
||||||
<ItemDetailMember category="group" value={entities.group} />
|
<ItemDetailMember category="group" value={entities.group} />
|
||||||
<ItemDetailMember category="position" value={entities.position} />
|
<ItemDetailMember category="position" value={entities.position} />
|
||||||
@@ -87,6 +104,7 @@ export default function Profile() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<ImageViewing
|
<ImageViewing
|
||||||
images={[{ uri: error ? assetUserImage.uri : `${ConstEnv.url_storage}/files/${entities.img}` }]}
|
images={[{ uri: error ? assetUserImage.uri : `${ConstEnv.url_storage}/files/${entities.img}` }]}
|
||||||
imageIndex={0}
|
imageIndex={0}
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import BorderBottomItem from "@/components/borderBottomItem"
|
|||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader"
|
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 LoadingCenter from "@/components/loadingCenter"
|
||||||
import MenuItemRow from "@/components/menuItemRow"
|
import MenuItemRow from "@/components/menuItemRow"
|
||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiAddFileProject, apiCheckFileProject } from "@/lib/api"
|
import { apiAddFileProject, apiCheckFileProject } from "@/lib/api"
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate"
|
import { setUpdateProject } from "@/lib/projectUpdate"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
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"
|
||||||
@@ -17,6 +19,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [fileForm, setFileForm] = useState<any[]>([])
|
const [fileForm, setFileForm] = useState<any[]>([])
|
||||||
const [listFile, setListFile] = useState<any[]>([])
|
const [listFile, setListFile] = useState<any[]>([])
|
||||||
@@ -127,7 +130,7 @@ export default function ProjectAddFile() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -153,20 +156,23 @@ export default function ProjectAddFile() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
{
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
loading && <LoadingCenter size="large" />
|
||||||
|
}
|
||||||
|
<ScrollView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
|
<View style={[Styles.p15]}>
|
||||||
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
<ButtonSelect value="Upload File" onPress={pickDocumentAsync} />
|
||||||
{
|
{
|
||||||
listFile.length > 0 && (
|
listFile.length > 0 && (
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.mv05, { color: colors.text }]}>File</Text>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
listFile.map((item, index) => (
|
listFile.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType="all"
|
borderType="all"
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
title={item}
|
title={item}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||||
@@ -180,15 +186,12 @@ export default function ProjectAddFile() {
|
|||||||
{
|
{
|
||||||
loadingCheck && <ActivityIndicator size="small" />
|
loadingCheck && <ActivityIndicator size="small" />
|
||||||
}
|
}
|
||||||
{
|
|
||||||
loading && <ActivityIndicator size="large" />
|
|
||||||
}
|
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ 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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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";
|
||||||
@@ -23,6 +24,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddMemberProject() {
|
export default function AddMemberProject() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.projectUpdate)
|
const update = useSelector((state: any) => state.projectUpdate)
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
@@ -98,7 +100,7 @@ export default function AddMemberProject() {
|
|||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
headerTitle: 'Tambah Anggota Kegiatan',
|
headerTitle: 'Tambah Anggota',
|
||||||
headerTitleAlign: 'center',
|
headerTitleAlign: 'center',
|
||||||
// headerRight: () => (
|
// headerRight: () => (
|
||||||
// <ButtonSaveHeader
|
// <ButtonSaveHeader
|
||||||
@@ -111,7 +113,7 @@ export default function AddMemberProject() {
|
|||||||
// )
|
// )
|
||||||
header: () => (
|
header: () => (
|
||||||
<AppHeader
|
<AppHeader
|
||||||
title="Tambah Anggota Kegiatan"
|
title="Tambah Anggota"
|
||||||
showBack={true}
|
showBack={true}
|
||||||
onPressLeft={() => router.back()}
|
onPressLeft={() => router.back()}
|
||||||
right={
|
right={
|
||||||
@@ -127,7 +129,7 @@ export default function AddMemberProject() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, { flex: 1, backgroundColor: colors.background }]}>
|
||||||
<InputSearch onChange={(val) => handleSearch(val)} value={search} />
|
<InputSearch onChange={(val) => handleSearch(val)} value={search} />
|
||||||
{
|
{
|
||||||
selectMember.length > 0
|
selectMember.length > 0
|
||||||
@@ -148,11 +150,11 @@ export default function AddMemberProject() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.pv05, { textAlign: 'center', color: colors.dimmed }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
data.length > 0 ?
|
data.length > 0 ?
|
||||||
@@ -163,7 +165,7 @@ export default function AddMemberProject() {
|
|||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal, { borderColor: colors.icon + '20' }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
!found && onChoose(item.id, item.name, item.img)
|
!found && onChoose(item.id, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
@@ -173,12 +175,12 @@ export default function AddMemberProject() {
|
|||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
<Text style={[Styles.textDefault]} numberOfLines={1}>{item.name}</Text>
|
||||||
{
|
{
|
||||||
found && <Text style={[Styles.textInformation, Styles.cGray]}>sudah menjadi anggota</Text>
|
found && <Text style={[Styles.textInformation, { color: colors.dimmed }]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalAddDetailTugasProject from "@/components/project/modalAddDetailTugasProject";
|
import ModalAddDetailTugasProject from "@/components/project/modalAddDetailTugasProject";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -9,6 +10,7 @@ import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
|||||||
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import 'intl';
|
import 'intl';
|
||||||
@@ -18,7 +20,6 @@ import { useEffect, useState } from "react";
|
|||||||
import {
|
import {
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
Platform,
|
Platform,
|
||||||
Pressable,
|
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
View
|
View
|
||||||
@@ -30,6 +31,7 @@ import DateTimePicker, {
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function ProjectAddTask() {
|
export default function ProjectAddTask() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const headerHeight = useHeaderHeight();
|
const headerHeight = useHeaderHeight();
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
@@ -133,7 +135,7 @@ export default function ProjectAddTask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -158,11 +160,11 @@ export default function ProjectAddTask() {
|
|||||||
showBack={true}
|
showBack={true}
|
||||||
onPressLeft={() => router.back()}
|
onPressLeft={() => router.back()}
|
||||||
right={
|
right={
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disable || loading}
|
disable={disable || loading}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => { handleCreate() }}
|
onPress={() => { handleCreate() }}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
@@ -172,9 +174,9 @@ export default function ProjectAddTask() {
|
|||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
keyboardVerticalOffset={headerHeight}
|
keyboardVerticalOffset={headerHeight}
|
||||||
>
|
>
|
||||||
<ScrollView>
|
<ScrollView style={[Styles.h100, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
mode="range"
|
mode="range"
|
||||||
startDate={range.startDate}
|
startDate={range.startDate}
|
||||||
@@ -184,52 +186,53 @@ export default function ProjectAddTask() {
|
|||||||
selected: Styles.selectedDate,
|
selected: Styles.selectedDate,
|
||||||
selected_label: Styles.cWhite,
|
selected_label: Styles.cWhite,
|
||||||
range_fill: Styles.selectRangeDate,
|
range_fill: Styles.selectRangeDate,
|
||||||
month_label: Styles.cBlack,
|
month_label: { color: colors.text },
|
||||||
month_selector_label: Styles.cBlack,
|
month_selector_label: { color: colors.text },
|
||||||
year_label: Styles.cBlack,
|
year_label: { color: colors.text },
|
||||||
year_selector_label: Styles.cBlack,
|
year_selector_label: { color: colors.text },
|
||||||
day_label: Styles.cBlack,
|
day_label: { color: colors.text },
|
||||||
time_label: Styles.cBlack,
|
time_label: { color: colors.text },
|
||||||
weekday_label: Styles.cBlack,
|
weekday_label: { color: colors.text },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv10]}>
|
<View style={[Styles.mv10]}>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mb10]}>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[Styles.w48]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
Tanggal Mulai <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
<Text style={Styles.textCenter}>{from}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[Styles.w48]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
Tanggal Berakhir <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
<Text style={Styles.textCenter}>{to}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, { color: colors.error }, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
}
|
}
|
||||||
<Pressable
|
{/* <Pressable
|
||||||
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
||||||
disabled={dsbButton}
|
disabled={dsbButton}
|
||||||
onPress={() => { setModalDetail(true) }}
|
onPress={() => { setModalDetail(true) }}
|
||||||
>
|
>
|
||||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||||
</Pressable>
|
</Pressable> */}
|
||||||
|
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul Tugas"
|
label="Judul Tugas"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Tugas"
|
placeholder="Judul Tugas"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={title}
|
value={title}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiCancelProject } from "@/lib/api";
|
import { apiCancelProject } from "@/lib/api";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { SafeAreaView, ScrollView, View } from "react-native";
|
import { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -12,6 +13,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -65,7 +67,7 @@ export default function ProjectCancel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -106,7 +108,7 @@ export default function ProjectCancel() {
|
|||||||
/>
|
/>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -114,7 +116,7 @@ export default function ProjectCancel() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Alasan Pembatalan"
|
placeholder="Alasan Pembatalan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
error={error}
|
error={error}
|
||||||
errorText="Alasan pembatalan harus diisi"
|
errorText="Alasan pembatalan harus diisi"
|
||||||
onChange={(val) => onValidation(val)}
|
onChange={(val) => onValidation(val)}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiEditProject, apiGetProjectOne } from "@/lib/api";
|
import { apiEditProject, apiGetProjectOne } from "@/lib/api";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -12,6 +13,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
@@ -86,7 +88,7 @@ export default function EditProject() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -121,14 +123,14 @@ export default function EditProject() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView style={[Styles.h100, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul Kegiatan"
|
label="Judul Kegiatan"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Kegiatan"
|
placeholder="Judul Kegiatan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={judul}
|
value={judul}
|
||||||
onChange={(val) => { onValidation(val) }}
|
onChange={(val) => { onValidation(val) }}
|
||||||
error={error}
|
error={error}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import SectionProgress from "@/components/sectionProgress";
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetProjectOne } from "@/lib/api";
|
import { apiGetProjectOne } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -32,6 +33,7 @@ type Props = {
|
|||||||
|
|
||||||
export default function DetailProject() {
|
export default function DetailProject() {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const [data, setData] = useState<Props>()
|
const [data, setData] = useState<Props>()
|
||||||
const [progress, setProgress] = useState(0)
|
const [progress, setProgress] = useState(0)
|
||||||
@@ -91,7 +93,7 @@ export default function DetailProject() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -111,10 +113,12 @@ export default function DetailProject() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
refreshControl={
|
refreshControl={
|
||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiGetProjectOne, apiReportProject } from "@/lib/api";
|
import { apiGetProjectOne, apiReportProject } from "@/lib/api";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 { SafeAreaView, ScrollView, View } from "react-native";
|
||||||
@@ -12,6 +13,7 @@ import Toast from "react-native-toast-message";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function ReportProject() {
|
export default function ReportProject() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
@@ -86,7 +88,7 @@ export default function ReportProject() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -123,7 +125,7 @@ export default function ReportProject() {
|
|||||||
/>
|
/>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
<InputForm
|
<InputForm
|
||||||
@@ -131,7 +133,7 @@ export default function ReportProject() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Laporan Kegiatan"
|
placeholder="Laporan Kegiatan"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={laporan}
|
value={laporan}
|
||||||
onChange={(val) => { onValidation(val) }}
|
onChange={(val) => { onValidation(val) }}
|
||||||
error={error}
|
error={error}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import ButtonSelect from "@/components/buttonSelect";
|
|||||||
import DrawerBottom from "@/components/drawerBottom";
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
import ImageUser from "@/components/imageNew";
|
import ImageUser from "@/components/imageNew";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
|
import LoadingCenter from "@/components/loadingCenter";
|
||||||
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";
|
||||||
@@ -18,6 +19,7 @@ import { setMemberChoose } from "@/lib/memberChoose";
|
|||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
import { setTaskCreate } from "@/lib/taskCreate";
|
import { setTaskCreate } from "@/lib/taskCreate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import * as DocumentPicker from "expo-document-picker";
|
import * as DocumentPicker from "expo-document-picker";
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
@@ -31,6 +33,7 @@ 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() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
||||||
@@ -190,7 +193,7 @@ export default function CreateProject() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -228,9 +231,12 @@ export default function CreateProject() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{
|
||||||
|
loading && <LoadingCenter />
|
||||||
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
style={[Styles.h100]}
|
style={[Styles.h100, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15]}>
|
||||||
{
|
{
|
||||||
@@ -242,6 +248,7 @@ export default function CreateProject() {
|
|||||||
placeholder="Pilih Lembaga Desa"
|
placeholder="Pilih Lembaga Desa"
|
||||||
value={chooseGroup.label}
|
value={chooseGroup.label}
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setValChoose(chooseGroup.val);
|
setValChoose(chooseGroup.val);
|
||||||
setValSelect("group");
|
setValSelect("group");
|
||||||
@@ -257,6 +264,7 @@ export default function CreateProject() {
|
|||||||
type="default"
|
type="default"
|
||||||
placeholder="Nama Kegiatan"
|
placeholder="Nama Kegiatan"
|
||||||
required
|
required
|
||||||
|
bg={colors.card}
|
||||||
value={dataForm.title}
|
value={dataForm.title}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
errorText="Nama kegiatan tidak boleh kosong"
|
errorText="Nama kegiatan tidak boleh kosong"
|
||||||
@@ -294,13 +302,13 @@ export default function CreateProject() {
|
|||||||
fileForm.length > 0 && (
|
fileForm.length > 0 && (
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>File</Text>
|
||||||
<View style={[Styles.wrapPaper]}>
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
fileForm.map((item, index) => (
|
fileForm.map((item, index) => (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
key={index}
|
key={index}
|
||||||
borderType="all"
|
borderType="all"
|
||||||
icon={<MaterialCommunityIcons name="file-outline" size={25} color="black" />}
|
icon={<MaterialCommunityIcons name="file-outline" size={25} color={colors.text} />}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
titleWeight="normal"
|
titleWeight="normal"
|
||||||
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
onPress={() => { setIndexDelFile(index); setModal(true) }}
|
||||||
@@ -318,7 +326,7 @@ export default function CreateProject() {
|
|||||||
<Text>Total {entitiesMember.length} Anggota</Text>
|
<Text>Total {entitiesMember.length} Anggota</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={[Styles.borderAll, Styles.round10, Styles.p10]}>
|
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { borderColor: colors.icon + '20', backgroundColor: colors.card }]}>
|
||||||
{entitiesMember.map(
|
{entitiesMember.map(
|
||||||
(item: { img: any; name: any }, index: any) => {
|
(item: { img: any; name: any }, index: any) => {
|
||||||
return (
|
return (
|
||||||
@@ -344,7 +352,7 @@ export default function CreateProject() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => { deleteFile(indexDelFile) }}
|
onPress={() => { deleteFile(indexDelFile) }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiGetUser } from "@/lib/api";
|
import { apiGetUser } from "@/lib/api";
|
||||||
import { setMemberChoose } from "@/lib/memberChoose";
|
import { setMemberChoose } from "@/lib/memberChoose";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
@@ -23,6 +24,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AddMemberCreateProject() {
|
export default function AddMemberCreateProject() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
@@ -103,7 +105,7 @@ export default function AddMemberCreateProject() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -125,10 +127,11 @@ export default function AddMemberCreateProject() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }, Styles.pv05]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView
|
<ScrollView
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
|
style={[Styles.h100, Styles.flex1, { backgroundColor: colors.background }]}
|
||||||
>
|
>
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -137,7 +140,7 @@ export default function AddMemberCreateProject() {
|
|||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.itemSelectModal]}
|
style={[Styles.itemSelectModal, { borderColor: colors.icon + '20' }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
onChoose(item.id, item.name, item.img)
|
onChoose(item.id, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
@@ -149,14 +152,14 @@ export default function AddMemberCreateProject() {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={'black'} />
|
selectMember.some((i: any) => i.idUser == item.id) && <AntDesign name="check" size={20} color={colors.text} />
|
||||||
}
|
}
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
<Text style={[Styles.textDefault, { textAlign: 'center' }]}>Tidak ada data</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter]}>Tidak ada data</Text>
|
||||||
}
|
}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalAddDetailTugasProject from "@/components/project/modalAddDetailTugasProject";
|
import ModalAddDetailTugasProject from "@/components/project/modalAddDetailTugasProject";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -7,6 +8,7 @@ import Styles from "@/constants/Styles";
|
|||||||
import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
||||||
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
||||||
import { setTaskCreate } from "@/lib/taskCreate";
|
import { setTaskCreate } from "@/lib/taskCreate";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import { router, Stack } from "expo-router";
|
import { router, Stack } from "expo-router";
|
||||||
import 'intl';
|
import 'intl';
|
||||||
@@ -16,7 +18,6 @@ import React, { useEffect, useState } from "react";
|
|||||||
import {
|
import {
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
Platform,
|
Platform,
|
||||||
Pressable,
|
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
View
|
View
|
||||||
@@ -27,6 +28,7 @@ import DateTimePicker, {
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CreateProjectAddTask() {
|
export default function CreateProjectAddTask() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const headerHeight = useHeaderHeight();
|
const headerHeight = useHeaderHeight();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const [disable, setDisable] = useState(true);
|
const [disable, setDisable] = useState(true);
|
||||||
@@ -119,7 +121,7 @@ export default function CreateProjectAddTask() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => (
|
// headerLeft: () => (
|
||||||
@@ -158,9 +160,9 @@ export default function CreateProjectAddTask() {
|
|||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
keyboardVerticalOffset={headerHeight}
|
keyboardVerticalOffset={headerHeight}
|
||||||
>
|
>
|
||||||
<ScrollView>
|
<ScrollView style={[Styles.h100, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
mode="range"
|
mode="range"
|
||||||
startDate={range.startDate}
|
startDate={range.startDate}
|
||||||
@@ -170,52 +172,53 @@ export default function CreateProjectAddTask() {
|
|||||||
selected: Styles.selectedDate,
|
selected: Styles.selectedDate,
|
||||||
selected_label: Styles.cWhite,
|
selected_label: Styles.cWhite,
|
||||||
range_fill: Styles.selectRangeDate,
|
range_fill: Styles.selectRangeDate,
|
||||||
month_label: Styles.cBlack,
|
month_label: { color: colors.text },
|
||||||
month_selector_label: Styles.cBlack,
|
month_selector_label: { color: colors.text },
|
||||||
year_label: Styles.cBlack,
|
year_label: { color: colors.text },
|
||||||
year_selector_label: Styles.cBlack,
|
year_selector_label: { color: colors.text },
|
||||||
day_label: Styles.cBlack,
|
day_label: { color: colors.text },
|
||||||
time_label: Styles.cBlack,
|
time_label: { color: colors.text },
|
||||||
weekday_label: Styles.cBlack,
|
weekday_label: { color: colors.text },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv10]}>
|
<View style={[Styles.mv10]}>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mb10]}>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Mulai <Text style={Styles.cError}>*</Text>
|
Tanggal Mulai <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{from}</Text>
|
<Text style={Styles.textCenter}>{from}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ width: "48%" }]}>
|
<View style={[{ width: "48%" }]}>
|
||||||
<Text style={[Styles.mb05]}>
|
<Text style={[Styles.mb05]}>
|
||||||
Tanggal Berakhir <Text style={Styles.cError}>*</Text>
|
Tanggal Berakhir <Text style={{ color: colors.error }}>*</Text>
|
||||||
</Text>
|
</Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: "center" }}>{to}</Text>
|
<Text style={Styles.textCenter}>{to}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.mt05, { color: colors.error }]}>Tanggal tidak boleh kosong</Text>
|
||||||
}
|
}
|
||||||
<Pressable
|
{/* <Pressable
|
||||||
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
||||||
disabled={dsbButton}
|
disabled={dsbButton}
|
||||||
onPress={() => { setModalDetail(true) }}
|
onPress={() => { setModalDetail(true) }}
|
||||||
>
|
>
|
||||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||||
</Pressable>
|
</Pressable> */}
|
||||||
|
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul Tugas"
|
label="Judul Tugas"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Tugas"
|
placeholder="Judul Tugas"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={title}
|
value={title}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ 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 Text from "@/components/Text";
|
||||||
|
import WrapTab from "@/components/wrapTab";
|
||||||
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";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import {
|
import {
|
||||||
AntDesign,
|
AntDesign,
|
||||||
Ionicons,
|
Ionicons,
|
||||||
@@ -40,9 +42,11 @@ export default function ListProject() {
|
|||||||
}>();
|
}>();
|
||||||
const [statusFix, setStatusFix] = useState<'0' | '1' | '2' | '3'>('0')
|
const [statusFix, setStatusFix] = useState<'0' | '1' | '2' | '3'>('0')
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
|
const { colors } = useTheme();
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
const [search, setSearch] = useState("")
|
const [search, setSearch] = useState("")
|
||||||
const [nameGroup, setNameGroup] = useState("")
|
const [nameGroup, setNameGroup] = useState("")
|
||||||
|
// ... state same ...
|
||||||
const [isYear, setYear] = useState("")
|
const [isYear, setYear] = useState("")
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const [isList, setList] = useState(false)
|
const [isList, setList] = useState(false)
|
||||||
@@ -122,67 +126,70 @@ export default function ListProject() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.p15, { flex: 1 }]}>
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<View>
|
<View>
|
||||||
<ScrollView horizontal style={[Styles.mb10]} showsHorizontalScrollIndicator={false}>
|
<WrapTab>
|
||||||
<ButtonTab
|
<ScrollView horizontal showsHorizontalScrollIndicator={false} style={[Styles.round20]}>
|
||||||
active={statusFix}
|
<ButtonTab
|
||||||
value="0"
|
active={statusFix}
|
||||||
onPress={() => { setStatusFix("0") }}
|
value="0"
|
||||||
label="Segera"
|
onPress={() => { setStatusFix("0") }}
|
||||||
icon={
|
label="Segera"
|
||||||
<MaterialCommunityIcons
|
icon={
|
||||||
name="clock-alert-outline"
|
<MaterialCommunityIcons
|
||||||
color={statusFix == "0" ? "white" : "black"}
|
name="clock-alert-outline"
|
||||||
size={20}
|
color={statusFix == "0" ? "white" : colors.dimmed}
|
||||||
/>
|
size={20}
|
||||||
}
|
/>
|
||||||
n={4}
|
}
|
||||||
/>
|
n={4}
|
||||||
<ButtonTab
|
/>
|
||||||
active={statusFix}
|
<ButtonTab
|
||||||
value="1"
|
active={statusFix}
|
||||||
onPress={() => { setStatusFix("1") }}
|
value="1"
|
||||||
label="Dikerjakan"
|
onPress={() => { setStatusFix("1") }}
|
||||||
icon={
|
label="Dikerjakan"
|
||||||
<MaterialCommunityIcons
|
icon={
|
||||||
name="progress-check"
|
<MaterialCommunityIcons
|
||||||
color={statusFix == "1" ? "white" : "black"}
|
name="progress-check"
|
||||||
size={20}
|
color={statusFix == "1" ? "white" : colors.dimmed}
|
||||||
/>
|
size={20}
|
||||||
}
|
/>
|
||||||
n={4}
|
}
|
||||||
/>
|
n={4}
|
||||||
<ButtonTab
|
/>
|
||||||
active={statusFix}
|
<ButtonTab
|
||||||
value="2"
|
active={statusFix}
|
||||||
onPress={() => { setStatusFix("2") }}
|
value="2"
|
||||||
label="Selesai"
|
onPress={() => { setStatusFix("2") }}
|
||||||
icon={
|
label="Selesai"
|
||||||
<Ionicons
|
icon={
|
||||||
name="checkmark-done-circle-outline"
|
<Ionicons
|
||||||
color={statusFix == "2" ? "white" : "black"}
|
name="checkmark-done-circle-outline"
|
||||||
size={20}
|
color={statusFix == "2" ? "white" : colors.dimmed}
|
||||||
/>
|
size={20}
|
||||||
}
|
/>
|
||||||
n={4}
|
}
|
||||||
/>
|
n={4}
|
||||||
<ButtonTab
|
/>
|
||||||
active={statusFix}
|
<ButtonTab
|
||||||
value="3"
|
active={statusFix}
|
||||||
onPress={() => { setStatusFix("3") }}
|
value="3"
|
||||||
label="Batal"
|
onPress={() => { setStatusFix("3") }}
|
||||||
icon={
|
label="Batal"
|
||||||
<AntDesign
|
icon={
|
||||||
name="closecircleo"
|
<AntDesign
|
||||||
color={statusFix == "3" ? "white" : "black"}
|
name="closecircleo"
|
||||||
size={20}
|
color={statusFix == "3" ? "white" : colors.dimmed}
|
||||||
/>
|
size={20}
|
||||||
}
|
/>
|
||||||
n={4}
|
}
|
||||||
/>
|
n={4}
|
||||||
</ScrollView>
|
/>
|
||||||
<View style={[Styles.rowSpaceBetween, { alignItems: 'center' }]}>
|
</ScrollView>
|
||||||
|
</WrapTab>
|
||||||
|
|
||||||
|
<View style={[Styles.rowSpaceBetween, Styles.rowItemsCenter]}>
|
||||||
<InputSearch width={68} onChange={setSearch} />
|
<InputSearch width={68} onChange={setSearch} />
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
@@ -191,26 +198,26 @@ export default function ListProject() {
|
|||||||
>
|
>
|
||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name={isList ? "format-list-bulleted" : "view-grid"}
|
name={isList ? "format-list-bulleted" : "view-grid"}
|
||||||
color={"black"}
|
color={colors.text}
|
||||||
size={30}
|
size={30}
|
||||||
/>
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv05]}>
|
<View style={[Styles.mt10]}>
|
||||||
{
|
{
|
||||||
// entityUser.role != 'cosupadmin' && entityUser.role != 'admin' &&
|
// entityUser.role != 'cosupadmin' && entityUser.role != 'admin' &&
|
||||||
<View style={[Styles.rowOnly]}>
|
<View style={[Styles.rowOnly]}>
|
||||||
<Text style={[Styles.mr05]}>Filter :</Text>
|
<Text style={[Styles.mr05]}>Filter :</Text>
|
||||||
{
|
{
|
||||||
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
(entityUser.role == "supadmin" || entityUser.role == "developer") &&
|
||||||
<LabelStatus size="small" category="secondary" text={nameGroup} style={{ marginRight: 5 }} />
|
<LabelStatus size="small" category="secondary" text={nameGroup} style={[Styles.mr05]} />
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
(entityUser.role == 'user' || entityUser.role == 'coadmin')
|
(entityUser.role == 'user' || entityUser.role == 'coadmin')
|
||||||
? (cat == 'null' || cat == 'undefined' || cat == undefined || cat == '' || cat == 'data-saya') ? <LabelStatus size="small" category="secondary" text="Kegiatan Saya" style={{ marginRight: 5 }} /> : <LabelStatus size="small" category="secondary" text="Semua Kegiatan" style={{ marginRight: 5 }} />
|
? (cat == 'null' || cat == 'undefined' || cat == undefined || cat == '' || cat == 'data-saya') ? <LabelStatus size="small" category="secondary" text="Kegiatan Saya" style={[Styles.mr05]} /> : <LabelStatus size="small" category="secondary" text="Semua Kegiatan" style={[Styles.mr05]} />
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
<LabelStatus size="small" category="secondary" text={isYear} style={{ marginRight: 5 }} />
|
<LabelStatus size="small" category="secondary" text={isYear} style={[Styles.mr05]} />
|
||||||
{/* {
|
{/* {
|
||||||
(entityUser.role == 'user' || entityUser.role == 'coadmin')
|
(entityUser.role == 'user' || entityUser.role == 'coadmin')
|
||||||
? (cat == 'null' || cat == 'undefined' || cat == undefined || cat == '' || cat == 'data-saya') ? <LabelStatus size="small" category="primary" text="Kegiatan Saya" /> : <LabelStatus size="small" category="primary" text="Semua Kegiatan" />
|
? (cat == 'null' || cat == 'undefined' || cat == undefined || cat == '' || cat == 'data-saya') ? <LabelStatus size="small" category="primary" text="Kegiatan Saya" /> : <LabelStatus size="small" category="primary" text="Semua Kegiatan" />
|
||||||
@@ -220,7 +227,7 @@ export default function ListProject() {
|
|||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ flex: 2 }]}>
|
<View style={[Styles.flex2, Styles.mt10]}>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
isList ?
|
isList ?
|
||||||
@@ -246,12 +253,13 @@ export default function ListProject() {
|
|||||||
key={index}
|
key={index}
|
||||||
onPress={() => { router.push(`/project/${item.id}`); }}
|
onPress={() => { router.push(`/project/${item.id}`); }}
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
|
bgColor="transparent"
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, ColorsStatus.lightGreen]} >
|
<View style={[Styles.iconContent]} >
|
||||||
<AntDesign
|
<AntDesign
|
||||||
name="areachart"
|
name="areachart"
|
||||||
size={25}
|
size={25}
|
||||||
color={"#384288"}
|
color={"black"}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
@@ -267,6 +275,7 @@ export default function ListProject() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -313,17 +322,17 @@ export default function ListProject() {
|
|||||||
>
|
>
|
||||||
<ProgressBar value={item.progress} category="list" />
|
<ProgressBar value={item.progress} category="list" />
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<Text style={[Styles.textDefault, Styles.cGray]}>
|
<Text style={[Styles.textDefault, { color: colors.dimmed }]}>
|
||||||
{item.createdAt}
|
{item.createdAt}
|
||||||
</Text>
|
</Text>
|
||||||
<LabelStatus
|
<LabelStatus
|
||||||
size="default"
|
size="default"
|
||||||
category={
|
category={
|
||||||
item.status === 0 ? 'primary' :
|
item.status === 0 ? 'secondary' :
|
||||||
item.status === 1 ? 'warning' :
|
item.status === 1 ? 'warning' :
|
||||||
item.status === 2 ? 'success' :
|
item.status === 2 ? 'success' :
|
||||||
item.status === 3 ? 'error' :
|
item.status === 3 ? 'error' :
|
||||||
'primary'
|
'secondary'
|
||||||
}
|
}
|
||||||
text={
|
text={
|
||||||
item.status === 0 ? 'SEGERA' :
|
item.status === 0 ? 'SEGERA' :
|
||||||
@@ -345,6 +354,7 @@ export default function ListProject() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -361,7 +371,7 @@ export default function ListProject() {
|
|||||||
>
|
>
|
||||||
<ProgressBar value={item.progress} category="list" />
|
<ProgressBar value={item.progress} category="list" />
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween]}>
|
||||||
<Text style={[Styles.textDefault, Styles.cGray]}>
|
<Text style={[Styles.textDefault, { color: colors.dimmed }]}>
|
||||||
{item.createdAt}
|
{item.createdAt}
|
||||||
</Text>
|
</Text>
|
||||||
<LabelStatus
|
<LabelStatus
|
||||||
@@ -389,7 +399,7 @@ export default function ListProject() {
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
<View style={[Styles.mt15]}>
|
<View style={[Styles.mt15]}>
|
||||||
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada kegiatan</Text>
|
<Text style={[Styles.textDefault, Styles.textCenter, { color: colors.dimmed }]}>Tidak ada kegiatan</Text>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import AppHeader from "@/components/AppHeader";
|
import AppHeader from "@/components/AppHeader";
|
||||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||||
|
import ButtonSelect from "@/components/buttonSelect";
|
||||||
import { InputForm } from "@/components/inputForm";
|
import { InputForm } from "@/components/inputForm";
|
||||||
import ModalAddDetailTugasProject from "@/components/project/modalAddDetailTugasProject";
|
import ModalAddDetailTugasProject from "@/components/project/modalAddDetailTugasProject";
|
||||||
import Text from "@/components/Text";
|
import Text from "@/components/Text";
|
||||||
@@ -9,18 +10,20 @@ import { formatDateOnly } from "@/lib/fun_formatDateOnly";
|
|||||||
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
import { getDatesInRange } from "@/lib/fun_getDatesInRange";
|
||||||
import { setUpdateProject } from "@/lib/projectUpdate";
|
import { setUpdateProject } from "@/lib/projectUpdate";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useHeaderHeight } from '@react-navigation/elements';
|
import { useHeaderHeight } from '@react-navigation/elements';
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import 'intl';
|
import 'intl';
|
||||||
import 'intl/locale-data/jsonp/id';
|
import 'intl/locale-data/jsonp/id';
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { KeyboardAvoidingView, Platform, Pressable, SafeAreaView, ScrollView, View } from "react-native";
|
import { KeyboardAvoidingView, Platform, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import Toast from "react-native-toast-message";
|
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";
|
||||||
|
|
||||||
export default function UpdateProjectTask() {
|
export default function UpdateProjectTask() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const headerHeight = useHeaderHeight();
|
const headerHeight = useHeaderHeight();
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const update = useSelector((state: any) => state.projectUpdate)
|
const update = useSelector((state: any) => state.projectUpdate)
|
||||||
@@ -169,7 +172,7 @@ export default function UpdateProjectTask() {
|
|||||||
}, [range])
|
}, [range])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
// headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
@@ -200,9 +203,9 @@ export default function UpdateProjectTask() {
|
|||||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||||
keyboardVerticalOffset={headerHeight}
|
keyboardVerticalOffset={headerHeight}
|
||||||
>
|
>
|
||||||
<ScrollView>
|
<ScrollView style={[Styles.h100, { backgroundColor: colors.background }]}>
|
||||||
<View style={[Styles.p15, Styles.mb100]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.p10, { backgroundColor: colors.card, borderColor: colors.background }]}>
|
||||||
{
|
{
|
||||||
!loading
|
!loading
|
||||||
&&
|
&&
|
||||||
@@ -217,50 +220,51 @@ export default function UpdateProjectTask() {
|
|||||||
selected: Styles.selectedDate,
|
selected: Styles.selectedDate,
|
||||||
selected_label: Styles.cWhite,
|
selected_label: Styles.cWhite,
|
||||||
range_fill: Styles.selectRangeDate,
|
range_fill: Styles.selectRangeDate,
|
||||||
month_label: Styles.cBlack,
|
month_label: { color: colors.text },
|
||||||
month_selector_label: Styles.cBlack,
|
month_selector_label: { color: colors.text },
|
||||||
year_label: Styles.cBlack,
|
year_label: { color: colors.text },
|
||||||
year_selector_label: Styles.cBlack,
|
year_selector_label: { color: colors.text },
|
||||||
day_label: Styles.cBlack,
|
day_label: { color: colors.text },
|
||||||
time_label: Styles.cBlack,
|
time_label: { color: colors.text },
|
||||||
weekday_label: Styles.cBlack,
|
weekday_label: { color: colors.text },
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
<View style={[Styles.mv10]}>
|
<View style={[Styles.mv10]}>
|
||||||
<View style={[Styles.rowSpaceBetween]}>
|
<View style={[Styles.rowSpaceBetween, Styles.mb10]}>
|
||||||
<View style={[{ width: '48%' }]}>
|
<View style={[{ width: '48%' }]}>
|
||||||
<Text style={[Styles.mb05]}>Tanggal Mulai <Text style={Styles.cError}>*</Text></Text>
|
<Text style={[Styles.mb05]}>Tanggal Mulai <Text style={{ color: colors.error }}>*</Text></Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: 'center' }}>{from}</Text>
|
<Text style={Styles.textCenter}>{from}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View style={[{ width: '48%' }]}>
|
<View style={[{ width: '48%' }]}>
|
||||||
<Text style={[Styles.mb05]}>Tanggal Berakhir <Text style={Styles.cError}>*</Text></Text>
|
<Text style={[Styles.mb05]}>Tanggal Berakhir <Text style={{ color: colors.error }}>*</Text></Text>
|
||||||
<View style={[Styles.wrapPaper, Styles.p10]}>
|
<View style={[Styles.wrapPaper, Styles.noShadow, Styles.borderAll, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||||
<Text style={{ textAlign: 'center' }}>{to}</Text>
|
<Text style={Styles.textCenter}>{to}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, { color: colors.error }, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
|
||||||
}
|
}
|
||||||
<Pressable
|
{/* <Pressable
|
||||||
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
style={[Styles.btnTab, Styles.btnLainnya, dsbButton && Styles.btnDisabled]}
|
||||||
disabled={dsbButton}
|
disabled={dsbButton}
|
||||||
onPress={() => { setModalDetail(true) }}
|
onPress={() => { setModalDetail(true) }}
|
||||||
>
|
>
|
||||||
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
<Text style={[dsbButton ? Styles.cGray : Styles.cWhite]}>Detail</Text>
|
||||||
</Pressable>
|
</Pressable> */}
|
||||||
|
<ButtonSelect value="Detail" onPress={() => { setModalDetail(true) }} />
|
||||||
</View>
|
</View>
|
||||||
<InputForm
|
<InputForm
|
||||||
label="Judul Tugas"
|
label="Judul Tugas"
|
||||||
type="default"
|
type="default"
|
||||||
placeholder="Judul Tugas"
|
placeholder="Judul Tugas"
|
||||||
required
|
required
|
||||||
bg="white"
|
bg={colors.card}
|
||||||
value={title}
|
value={title}
|
||||||
error={error.title}
|
error={error.title}
|
||||||
errorText="Judul tidak boleh kosong"
|
errorText="Judul tidak boleh kosong"
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ import { ConstEnv } from "@/constants/ConstEnv";
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiGetSearch } from "@/lib/api";
|
import { apiGetSearch } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
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 React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
|
||||||
import Toast from "react-native-toast-message";
|
import Toast from "react-native-toast-message";
|
||||||
|
|
||||||
|
// ... types ...
|
||||||
type PropsUser = {
|
type PropsUser = {
|
||||||
id: string
|
id: string
|
||||||
name: string
|
name: string
|
||||||
@@ -43,6 +45,7 @@ export default function Search() {
|
|||||||
const [dataProject, setDataProject] = useState<PropProject[]>([])
|
const [dataProject, setDataProject] = useState<PropProject[]>([])
|
||||||
const [refreshing, setRefreshing] = useState(false)
|
const [refreshing, setRefreshing] = useState(false)
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
async function handleSearch(cari: string) {
|
async function handleSearch(cari: string) {
|
||||||
try {
|
try {
|
||||||
@@ -79,7 +82,7 @@ export default function Search() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SafeAreaView>
|
<SafeAreaView style={[Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
options={{
|
options={{
|
||||||
headerTitle: 'Pencarian',
|
headerTitle: 'Pencarian',
|
||||||
@@ -100,6 +103,7 @@ export default function Search() {
|
|||||||
<RefreshControl
|
<RefreshControl
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={handleRefresh}
|
onRefresh={handleRefresh}
|
||||||
|
tintColor={colors.icon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -177,7 +181,7 @@ export default function Search() {
|
|||||||
</ScrollView>
|
</ScrollView>
|
||||||
:
|
:
|
||||||
<View style={[Styles.contentItemCenter, Styles.mt10]}>
|
<View style={[Styles.contentItemCenter, Styles.mt10]}>
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>Tidak ada data</Text>
|
<Text style={[Styles.textInformation, { color: colors.icon }]}>Tidak ada data</Text>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
186
app/(application)/setting/index.tsx
Normal file
186
app/(application)/setting/index.tsx
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
import ModalConfirmation from "@/components/ModalConfirmation";
|
||||||
|
import Text from "@/components/Text";
|
||||||
|
import ButtonSetting from "@/components/buttonSetting";
|
||||||
|
import DrawerBottom from "@/components/drawerBottom";
|
||||||
|
import Styles from "@/constants/Styles";
|
||||||
|
import { apiRegisteredToken, apiUnregisteredToken } from "@/lib/api";
|
||||||
|
import { checkPermission, getToken, openSettings, requestPermission } from "@/lib/useNotification";
|
||||||
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
import { Feather, Ionicons } from "@expo/vector-icons";
|
||||||
|
import { router } from "expo-router";
|
||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
import { AppState, AppStateStatus, Pressable, View } from "react-native";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
export default function ListSetting() {
|
||||||
|
const { theme, setTheme, colors } = useTheme()
|
||||||
|
const { signOut } = useAuthSession()
|
||||||
|
const [isNotificationEnabled, setIsNotificationEnabled] = useState<boolean | null>(null);
|
||||||
|
const entities = useSelector((state: any) => state.entities)
|
||||||
|
const [modalVisible, setModalVisible] = useState(false);
|
||||||
|
const [modalConfig, setModalConfig] = useState({
|
||||||
|
title: '',
|
||||||
|
message: '',
|
||||||
|
confirmText: 'Buka Pengaturan',
|
||||||
|
onConfirm: () => { }
|
||||||
|
});
|
||||||
|
|
||||||
|
const [showLogoutModal, setShowLogoutModal] = useState(false)
|
||||||
|
const [showThemeModal, setShowThemeModal] = useState(false)
|
||||||
|
|
||||||
|
const registerToken = async () => {
|
||||||
|
try {
|
||||||
|
const token = await getToken();
|
||||||
|
if (token) {
|
||||||
|
await apiRegisteredToken({ user: entities.id, token });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Error registering token:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const unregisterToken = async () => {
|
||||||
|
try {
|
||||||
|
const token = await getToken();
|
||||||
|
if (token) {
|
||||||
|
await apiUnregisteredToken({ user: entities.id, token });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Error unregistering token:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkNotif = useCallback(async () => {
|
||||||
|
const status = await checkPermission();
|
||||||
|
setIsNotificationEnabled((prev) => {
|
||||||
|
if (prev === false && status === true) {
|
||||||
|
registerToken();
|
||||||
|
} else if (prev === true && status === false) {
|
||||||
|
unregisterToken();
|
||||||
|
}
|
||||||
|
return !!status;
|
||||||
|
});
|
||||||
|
}, [entities.id]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
checkNotif();
|
||||||
|
|
||||||
|
const subscription = AppState.addEventListener('change', (nextAppState: AppStateStatus) => {
|
||||||
|
if (nextAppState === 'active') {
|
||||||
|
checkNotif();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
subscription.remove();
|
||||||
|
};
|
||||||
|
}, [checkNotif]);
|
||||||
|
|
||||||
|
const handleToggleNotif = async () => {
|
||||||
|
if (isNotificationEnabled) {
|
||||||
|
setModalConfig({
|
||||||
|
title: "Matikan Notifikasi?",
|
||||||
|
message: "Anda akan diarahkan ke pengaturan sistem untuk mematikan notifikasi.",
|
||||||
|
confirmText: "Buka Pengaturan",
|
||||||
|
onConfirm: () => {
|
||||||
|
setModalVisible(false);
|
||||||
|
openSettings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setModalVisible(true);
|
||||||
|
} else {
|
||||||
|
const granted = await requestPermission();
|
||||||
|
if (granted) {
|
||||||
|
setIsNotificationEnabled(true);
|
||||||
|
registerToken();
|
||||||
|
} else {
|
||||||
|
setModalConfig({
|
||||||
|
title: "Aktifkan Notifikasi?",
|
||||||
|
message: "Izin notifikasi tidak diberikan. Buka pengaturan sistem untuk mengaktifkannya?",
|
||||||
|
confirmText: "Buka Pengaturan",
|
||||||
|
onConfirm: () => {
|
||||||
|
setModalVisible(false);
|
||||||
|
openSettings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setModalVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const ThemeOption = ({ label, value, icon }: { label: string, value: 'light' | 'dark' | 'system', icon: string }) => (
|
||||||
|
<Pressable
|
||||||
|
style={[Styles.itemSelectModal, { borderColor: colors.icon + '20' }]}
|
||||||
|
onPress={() => {
|
||||||
|
setTheme(value);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<View style={Styles.rowItemsCenter}>
|
||||||
|
<Ionicons name={icon as any} size={20} color={colors.text} style={Styles.mr10} />
|
||||||
|
<Text style={{ color: colors.text }}>{label}</Text>
|
||||||
|
</View>
|
||||||
|
{theme === value && <Ionicons name="checkmark" size={20} color={colors.text} />}
|
||||||
|
</Pressable>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[Styles.p15, Styles.flex1, { backgroundColor: colors.background }]}>
|
||||||
|
<View style={[Styles.wrapPaper, { backgroundColor: colors.card, borderColor: colors.icon + '20' }, Styles.p0, Styles.round05]}>
|
||||||
|
{
|
||||||
|
entities.idUserRole != "developer" &&
|
||||||
|
<ButtonSetting
|
||||||
|
title="Edit Profile"
|
||||||
|
icon={<Feather name="user" size={20} color={colors.text} />}
|
||||||
|
onPress={() => { router.push('/edit-profile') }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
<ButtonSetting
|
||||||
|
title="Tema Aplikasi"
|
||||||
|
icon={<Ionicons name="color-palette-outline" size={20} color={colors.text} />}
|
||||||
|
onPress={() => setShowThemeModal(true)}
|
||||||
|
value={theme === 'light' ? 'Terang' : theme === 'dark' ? 'Gelap' : 'Sistem'}
|
||||||
|
/>
|
||||||
|
<ButtonSetting
|
||||||
|
title="Notifikasi"
|
||||||
|
icon={<Feather name="bell" size={20} color={colors.text} />}
|
||||||
|
onPress={handleToggleNotif}
|
||||||
|
value={isNotificationEnabled === null ? 'Memuat...' : isNotificationEnabled ? 'Aktif' : 'Nonaktif'}
|
||||||
|
/>
|
||||||
|
<ButtonSetting
|
||||||
|
title="Keluar"
|
||||||
|
icon={<Feather name="log-out" size={20} color={colors.text} />}
|
||||||
|
onPress={() => setShowLogoutModal(true)}
|
||||||
|
borderBottom={false}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={modalVisible}
|
||||||
|
title={modalConfig.title}
|
||||||
|
message={modalConfig.message}
|
||||||
|
confirmText={modalConfig.confirmText}
|
||||||
|
onConfirm={modalConfig.onConfirm}
|
||||||
|
onCancel={() => setModalVisible(false)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showLogoutModal}
|
||||||
|
title="Keluar"
|
||||||
|
message="Apakah anda yakin ingin keluar?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowLogoutModal(false)
|
||||||
|
signOut()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowLogoutModal(false)}
|
||||||
|
confirmText="Keluar"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
|
<DrawerBottom animation="slide" isVisible={showThemeModal} setVisible={setShowThemeModal} title="Tema Aplikasi">
|
||||||
|
<ThemeOption label="Terang" value="light" icon="sunny-outline" />
|
||||||
|
<ThemeOption label="Gelap" value="dark" icon="moon-outline" />
|
||||||
|
<ThemeOption label="Sistem" value="system" icon="phone-portrait-outline" />
|
||||||
|
</DrawerBottom>
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import AuthProvider from '@/providers/AuthProvider';
|
import AuthProvider from '@/providers/AuthProvider';
|
||||||
|
import ThemeProvider, { useTheme } from '@/providers/ThemeProvider';
|
||||||
import { useFonts } from 'expo-font';
|
import { useFonts } from 'expo-font';
|
||||||
import { Stack } from 'expo-router';
|
import { Stack } from 'expo-router';
|
||||||
import * as SplashScreen from 'expo-splash-screen';
|
import * as SplashScreen from 'expo-splash-screen';
|
||||||
@@ -7,10 +8,27 @@ import { useEffect } from 'react';
|
|||||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||||
import { NotifierWrapper } from 'react-native-notifier';
|
import { NotifierWrapper } from 'react-native-notifier';
|
||||||
import 'react-native-reanimated';
|
import 'react-native-reanimated';
|
||||||
|
import Styles from '@/constants/Styles';
|
||||||
|
|
||||||
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
||||||
SplashScreen.preventAutoHideAsync();
|
SplashScreen.preventAutoHideAsync();
|
||||||
|
|
||||||
|
// Inner component - berada di dalam ThemeProvider, bisa pakai useTheme()
|
||||||
|
function AppStack() {
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Stack screenOptions={{ contentStyle: { backgroundColor: colors.header } }}>
|
||||||
|
<Stack.Screen name="index" options={{ headerShown: false }} />
|
||||||
|
<Stack.Screen name="verification" options={{ headerShown: false }} />
|
||||||
|
<Stack.Screen name="(application)" options={{ headerShown: false }} />
|
||||||
|
</Stack>
|
||||||
|
<StatusBar style="auto" />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
const [loaded] = useFonts({
|
const [loaded] = useFonts({
|
||||||
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
|
||||||
@@ -27,16 +45,13 @@ export default function RootLayout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GestureHandlerRootView style={{ flex: 1 }}>
|
<GestureHandlerRootView style={Styles.flex1}>
|
||||||
<NotifierWrapper>
|
<NotifierWrapper>
|
||||||
<AuthProvider>
|
<ThemeProvider>
|
||||||
<Stack>
|
<AuthProvider>
|
||||||
<Stack.Screen name="index" options={{ headerShown: false }} />
|
<AppStack />
|
||||||
<Stack.Screen name="verification" options={{ headerShown: false }} />
|
</AuthProvider>
|
||||||
<Stack.Screen name="(application)" options={{ headerShown: false }} />
|
</ThemeProvider>
|
||||||
</Stack>
|
|
||||||
<StatusBar style="auto" />
|
|
||||||
</AuthProvider>
|
|
||||||
</NotifierWrapper>
|
</NotifierWrapper>
|
||||||
</GestureHandlerRootView>
|
</GestureHandlerRootView>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Text from '@/components/Text';
|
|||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import CryptoES from "crypto-es";
|
import CryptoES from "crypto-es";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Image, View } from "react-native";
|
import { Image, View } from "react-native";
|
||||||
@@ -15,17 +16,24 @@ export default function Index() {
|
|||||||
value,
|
value,
|
||||||
setValue,
|
setValue,
|
||||||
});
|
});
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
const { signIn } = useAuthSession();
|
const { signIn } = useAuthSession();
|
||||||
const login = (): void => {
|
const login = (): void => {
|
||||||
const random: string = 'contohLoginMobileDarmasaba';
|
// WARNING: This is a hardcoded bypass for development purposes.
|
||||||
var mytexttoEncryption = "contohLoginMobileDarmasaba"
|
// It should be removed or secured before production release.
|
||||||
const encrypted = CryptoES.AES.encrypt(mytexttoEncryption, ConstEnv.pass_encrypt).toString();
|
if (__DEV__) {
|
||||||
signIn(encrypted);
|
const random: string = 'contohLoginMobileDarmasaba';
|
||||||
|
var mytexttoEncryption = "contohLoginMobileDarmasaba"
|
||||||
|
const encrypted = CryptoES.AES.encrypt(mytexttoEncryption, ConstEnv.pass_encrypt).toString();
|
||||||
|
signIn(encrypted);
|
||||||
|
} else {
|
||||||
|
console.warn("Bypass login disabled in production.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View style={Styles.wrapLogin} >
|
<View style={[Styles.wrapLogin, { backgroundColor: colors.background }]} >
|
||||||
<View style={{ alignItems: "center", marginVertical: 50 }}>
|
<View style={[Styles.rowItemsCenter, Styles.mv50]}>
|
||||||
<Image
|
<Image
|
||||||
source={require("../assets/images/logo.png")}
|
source={require("../assets/images/logo.png")}
|
||||||
style={[{ width: 300, height: 150 }]}
|
style={[{ width: 300, height: 150 }]}
|
||||||
@@ -50,7 +58,7 @@ export default function Index() {
|
|||||||
renderCell={({ index, symbol, isFocused }) => (
|
renderCell={({ index, symbol, isFocused }) => (
|
||||||
<Text
|
<Text
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.verificationCell, isFocused && Styles.verificationFocusCell]}
|
style={[Styles.verificationCell, isFocused && Styles.verificationFocusCell, { borderColor: isFocused ? colors.tint : colors.icon, color: colors.text }]}
|
||||||
onLayout={getCellOnLayoutHandler(index)}>
|
onLayout={getCellOnLayoutHandler(index)}>
|
||||||
{symbol || (isFocused ? <Cursor /> : null)}
|
{symbol || (isFocused ? <Cursor /> : null)}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -61,7 +69,7 @@ export default function Index() {
|
|||||||
// onPress={() => { router.push("/home") }}
|
// onPress={() => { router.push("/home") }}
|
||||||
onPress={login}
|
onPress={login}
|
||||||
/>
|
/>
|
||||||
<Text style={[Styles.textInformation, Styles.mt05, Styles.cDefault, { textAlign: 'center' }]}>
|
<Text style={[Styles.textInformation, Styles.mt05, Styles.cDefault, { textAlign: 'center', color: colors.tint }]}>
|
||||||
Tidak Menerima kode verifikasi? Kirim Ulang
|
Tidak Menerima kode verifikasi? Kirim Ulang
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
BIN
assets/images/bgproject-dark.png
Normal file
BIN
assets/images/bgproject-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/images/bgproject-light.png
Normal file
BIN
assets/images/bgproject-light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/images/cogniti-dark.png
Normal file
BIN
assets/images/cogniti-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/images/cogniti-light.png
Normal file
BIN
assets/images/cogniti-light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
assets/images/logo-dark.png
Normal file
BIN
assets/images/logo-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
@@ -1,4 +1,5 @@
|
|||||||
import Styles from '@/constants/Styles';
|
import Styles from '@/constants/Styles';
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { useRouter } from 'expo-router';
|
import { useRouter } from 'expo-router';
|
||||||
import { Platform, Text, View } from 'react-native';
|
import { Platform, Text, View } from 'react-native';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
@@ -15,20 +16,22 @@ type Props = {
|
|||||||
export default function AppHeader({ title, right, showBack = true, onPressLeft, left }: Props) {
|
export default function AppHeader({ title, right, showBack = true, onPressLeft, left }: Props) {
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.headerContainer, Platform.OS === 'ios' ? Styles.pb05 : Styles.pb13, { paddingTop: Platform.OS === 'ios' ? insets.top : 10 }]}>
|
<View style={[Styles.headerContainer, Platform.OS === 'ios' ? Styles.pb05 : Styles.pb13, { backgroundColor: colors.header, paddingTop: Platform.OS === 'ios' ? insets.top : 10 }]}>
|
||||||
<View style={Styles.headerApp}>
|
<View style={Styles.headerApp}>
|
||||||
{showBack ? (
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
<ButtonBackHeader onPress={onPressLeft} />
|
{showBack ? (
|
||||||
) :
|
<ButtonBackHeader onPress={onPressLeft} />
|
||||||
left ? left :
|
) :
|
||||||
(
|
left ? left :
|
||||||
<View style={Styles.headerSide} />
|
(
|
||||||
)}
|
<View style={Styles.headerSide} />
|
||||||
|
)}
|
||||||
<Text style={Styles.headerTitle}>{title}</Text>
|
|
||||||
|
|
||||||
|
<Text style={[Styles.headerTitle, Styles.ml05]}>{title}</Text>
|
||||||
|
</View>
|
||||||
<View style={Styles.headerSide}>{right}</View>
|
<View style={Styles.headerSide}>{right}</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
82
components/ModalConfirmation.tsx
Normal file
82
components/ModalConfirmation.tsx
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import Styles from '@/constants/Styles';
|
||||||
|
import { useTheme } from '@/providers/ThemeProvider';
|
||||||
|
import React from 'react';
|
||||||
|
import { Modal, TouchableOpacity, View } from 'react-native';
|
||||||
|
import Text from './Text';
|
||||||
|
|
||||||
|
interface ModalConfirmationProps {
|
||||||
|
visible: boolean;
|
||||||
|
title: string;
|
||||||
|
message: string;
|
||||||
|
onConfirm: () => void;
|
||||||
|
onCancel: () => void;
|
||||||
|
confirmText?: string;
|
||||||
|
cancelText?: string;
|
||||||
|
isDestructive?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ModalConfirmation: React.FC<ModalConfirmationProps> = ({
|
||||||
|
visible,
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
onConfirm,
|
||||||
|
onCancel,
|
||||||
|
confirmText = 'Ya',
|
||||||
|
cancelText = 'Batal',
|
||||||
|
isDestructive = false,
|
||||||
|
}) => {
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
transparent
|
||||||
|
visible={visible}
|
||||||
|
animationType="fade"
|
||||||
|
onRequestClose={onCancel}
|
||||||
|
>
|
||||||
|
<View style={Styles.modalOverlay}>
|
||||||
|
<View style={[Styles.modalConfirmContainer, { backgroundColor: colors.modalBackground }]}>
|
||||||
|
<View style={Styles.modalConfirmContent}>
|
||||||
|
<Text style={Styles.modalConfirmTitle}>{title}</Text>
|
||||||
|
<Text style={[Styles.modalConfirmMessage, { color: colors.text }]}>
|
||||||
|
{message}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={[Styles.modalConfirmDivider, { backgroundColor: colors.icon + '20' }]} />
|
||||||
|
|
||||||
|
<View style={Styles.modalConfirmFooter}>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={Styles.modalConfirmButton}
|
||||||
|
onPress={onCancel}
|
||||||
|
activeOpacity={0.7}
|
||||||
|
>
|
||||||
|
<Text style={[Styles.modalConfirmButtonText, { color: colors.text }]}>
|
||||||
|
{cancelText}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<View style={[Styles.modalConfirmVerticalDivider, { backgroundColor: colors.icon + '20' }]} />
|
||||||
|
|
||||||
|
<TouchableOpacity
|
||||||
|
style={Styles.modalConfirmButton}
|
||||||
|
onPress={onConfirm}
|
||||||
|
activeOpacity={0.7}
|
||||||
|
>
|
||||||
|
<Text
|
||||||
|
style={[
|
||||||
|
Styles.modalConfirmButtonText,
|
||||||
|
{ color: isDestructive ? colors.error : colors.text }
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{confirmText}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ModalConfirmation;
|
||||||
@@ -1,23 +1,19 @@
|
|||||||
|
import { useTheme } from '@/providers/ThemeProvider';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Text as RNText, TextProps as RNTextProps, StyleSheet } from 'react-native';
|
import { StyleSheet, Text as RNText, TextProps as RNTextProps } from 'react-native';
|
||||||
|
|
||||||
type TextProps = RNTextProps & {
|
type TextProps = RNTextProps & {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Text: React.FC<TextProps> = ({ style, ...props }) => {
|
const Text: React.FC<TextProps> = ({ style, ...props }) => {
|
||||||
|
const { colors } = useTheme();
|
||||||
return (
|
return (
|
||||||
<RNText
|
<RNText
|
||||||
style={[styles.defaultText, style]}
|
style={[{ color: colors.text }, style]}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
defaultText: {
|
|
||||||
color: 'black',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default Text;
|
export default Text;
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ import Styles from "@/constants/Styles"
|
|||||||
import { setUpdateAnnouncement } from "@/lib/announcementUpdate"
|
import { setUpdateAnnouncement } from "@/lib/announcementUpdate"
|
||||||
import { apiDeleteAnnouncement } from "@/lib/api"
|
import { apiDeleteAnnouncement } from "@/lib/api"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
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 { View } from "react-native"
|
import { View } from "react-native"
|
||||||
import Toast from "react-native-toast-message"
|
import Toast from "react-native-toast-message"
|
||||||
import { useDispatch, useSelector } from "react-redux"
|
import { useDispatch, useSelector } from "react-redux"
|
||||||
import AlertKonfirmasi from "../alertKonfirmasi"
|
import ModalConfirmation from "../ModalConfirmation"
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader"
|
import ButtonMenuHeader from "../buttonMenuHeader"
|
||||||
import DrawerBottom from "../drawerBottom"
|
import DrawerBottom from "../drawerBottom"
|
||||||
import MenuItemRow from "../menuItemRow"
|
import MenuItemRow from "../menuItemRow"
|
||||||
@@ -18,8 +19,10 @@ type Props = {
|
|||||||
}
|
}
|
||||||
export default function HeaderRightAnnouncementDetail({ id }: Props) {
|
export default function HeaderRightAnnouncementDetail({ id }: Props) {
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
|
const { colors } = useTheme();
|
||||||
const [isVisible, setVisible] = useState(false)
|
const [isVisible, setVisible] = useState(false)
|
||||||
const update = useSelector((state: any) => state.announcementUpdate)
|
const update = useSelector((state: any) => state.announcementUpdate)
|
||||||
|
const [showDeleteModal, setShowDeleteModal] = useState(false)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
|
|
||||||
@@ -28,15 +31,14 @@ export default function HeaderRightAnnouncementDetail({ id }: Props) {
|
|||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiDeleteAnnouncement({ user: hasil }, id)
|
const response = await apiDeleteAnnouncement({ user: hasil }, id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateAnnouncement(!update))
|
|
||||||
setVisible(false)
|
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
|
||||||
router.back()
|
router.back()
|
||||||
|
dispatch(setUpdateAnnouncement(!update))
|
||||||
|
return Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
setVisible(false)
|
setShowDeleteModal(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ export default function HeaderRightAnnouncementDetail({ id }: Props) {
|
|||||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} 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={colors.text} size={25} />}
|
||||||
title="Edit"
|
title="Edit"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
@@ -54,21 +56,30 @@ export default function HeaderRightAnnouncementDetail({ id }: Props) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<Ionicons name="trash" color="black" size={25} />}
|
icon={<Ionicons name="trash-outline" color={colors.text} size={25} />}
|
||||||
title="Hapus"
|
title="Hapus"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
AlertKonfirmasi({
|
setTimeout(() => {
|
||||||
title: 'Konfirmasi',
|
setShowDeleteModal(true)
|
||||||
desc: 'Apakah anda yakin ingin menghapus pengumuman ini?',
|
}, 600)
|
||||||
onPress: () => {
|
|
||||||
handleDelete()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</DrawerBottom>
|
</DrawerBottom>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showDeleteModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message="Apakah anda yakin ingin menghapus pengumuman ini?"
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowDeleteModal(false)
|
||||||
|
handleDelete()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowDeleteModal(false)}
|
||||||
|
confirmText="Hapus"
|
||||||
|
cancelText="Batal"
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
import { AntDesign } from "@expo/vector-icons"
|
import { AntDesign } from "@expo/vector-icons"
|
||||||
import { router } from "expo-router"
|
import { router } from "expo-router"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
@@ -9,6 +10,7 @@ import DrawerBottom from "../drawerBottom"
|
|||||||
import MenuItemRow from "../menuItemRow"
|
import MenuItemRow from "../menuItemRow"
|
||||||
|
|
||||||
export default function HeaderRightAnnouncementList() {
|
export default function HeaderRightAnnouncementList() {
|
||||||
|
const { colors } = useTheme();
|
||||||
const [isVisible, setVisible] = useState(false)
|
const [isVisible, setVisible] = useState(false)
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
|
|
||||||
@@ -21,7 +23,7 @@ export default function HeaderRightAnnouncementList() {
|
|||||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
|
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
|
||||||
<View style={Styles.rowItemsCenter}>
|
<View style={Styles.rowItemsCenter}>
|
||||||
<MenuItemRow
|
<MenuItemRow
|
||||||
icon={<AntDesign name="pluscircle" color="black" size={25} />}
|
icon={<AntDesign name="pluscircleo" color={colors.text} size={25} />}
|
||||||
title="Tambah Pengumuman"
|
title="Tambah Pengumuman"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Styles from "@/constants/Styles"
|
import Styles from "@/constants/Styles"
|
||||||
import { apiCheckPhoneLogin, apiSendOtp } from "@/lib/api"
|
import { apiCheckPhoneLogin, apiSendOtp } from "@/lib/api"
|
||||||
import { useAuthSession } from "@/providers/AuthProvider"
|
import { useAuthSession } from "@/providers/AuthProvider"
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider"
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage"
|
import AsyncStorage from "@react-native-async-storage/async-storage"
|
||||||
import { StatusBar } from "expo-status-bar"
|
import { StatusBar } from "expo-status-bar"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
@@ -21,6 +22,7 @@ export default function ViewLogin({ onValidate }: Props) {
|
|||||||
const [disableLogin, setDisableLogin] = useState(true)
|
const [disableLogin, setDisableLogin] = useState(true)
|
||||||
const [phone, setPhone] = useState('')
|
const [phone, setPhone] = useState('')
|
||||||
const { signIn, encryptToken } = useAuthSession();
|
const { signIn, encryptToken } = useAuthSession();
|
||||||
|
const { colors, theme } = useTheme();
|
||||||
|
|
||||||
const handleCheckPhone = async () => {
|
const handleCheckPhone = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -49,13 +51,12 @@ export default function ViewLogin({ onValidate }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<StatusBar style={Platform.OS === 'ios' ? 'dark' : 'light'} translucent={false} backgroundColor="black" />
|
<StatusBar style={theme === 'dark' ? 'light' : 'dark'} translucent={false} backgroundColor={colors.background} />
|
||||||
<ToastCustom />
|
|
||||||
<View style={[Styles.p20, Styles.h100]}>
|
<View style={[Styles.p20, Styles.h100]}>
|
||||||
<View style={{ alignItems: "center", marginTop: 70, marginBottom: 50 }}>
|
<View style={{ alignItems: "center", marginTop: 70, marginBottom: 50 }}>
|
||||||
<Image
|
<Image
|
||||||
source={require("../../assets/images/logo.png")}
|
source={theme === 'dark' ? require("../../assets/images/logo-dark.png") : require("../../assets/images/logo.png")}
|
||||||
style={[{ width: 300, height: 150 }]}
|
style={[{ width: 300, height: 150 }]}
|
||||||
width={270}
|
width={270}
|
||||||
height={110}
|
height={110}
|
||||||
@@ -69,18 +70,28 @@ export default function ViewLogin({ onValidate }: Props) {
|
|||||||
}}
|
}}
|
||||||
type="numeric"
|
type="numeric"
|
||||||
placeholder="XXX-XXX-XXXX"
|
placeholder="XXX-XXX-XXXX"
|
||||||
round
|
|
||||||
itemLeft={<Text style={[Platform.OS === 'ios' && Styles.mt02]}>+62</Text>}
|
itemLeft={<Text style={[Platform.OS === 'ios' && Styles.mt02]}>+62</Text>}
|
||||||
info="Kami akan mengirim kode verifikasi melalui WhatsApp, guna mengonfirmasikan nomor Anda." />
|
info="Kami akan mengirim kode verifikasi melalui WhatsApp, guna mengonfirmasikan nomor Anda." />
|
||||||
<ButtonForm
|
<View style={[{ width: '50%', alignSelf: 'center' }]}>
|
||||||
text="MASUK"
|
<ButtonForm
|
||||||
onPress={() => { handleCheckPhone() }}
|
text="MASUK"
|
||||||
disabled={disableLogin}
|
onPress={() => { handleCheckPhone() }}
|
||||||
/>
|
disabled={disableLogin}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<View style={{ alignItems: 'center' }}>
|
||||||
|
<Image
|
||||||
|
source={theme === 'dark' ? require("../../assets/images/cogniti-dark.png") : require("../../assets/images/cogniti-light.png")}
|
||||||
|
style={{ width: 86, height: 27 }}
|
||||||
|
resizeMode="contain"
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
loadingLogin && <ModalLoading isVisible={true} setVisible={setLoadingLogin} />
|
loadingLogin && <ModalLoading isVisible={true} setVisible={setLoadingLogin} />
|
||||||
}
|
}
|
||||||
|
<ToastCustom position="bottom" />
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import { apiSendOtp } from "@/lib/api";
|
import { apiSendOtp } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
import { StatusBar } from "expo-status-bar";
|
import { StatusBar } from "expo-status-bar";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Image, Platform, View } from "react-native";
|
import { Image, SafeAreaView, View } from "react-native";
|
||||||
import { OtpInput } from "react-native-otp-entry";
|
import { OtpInput } from "react-native-otp-entry";
|
||||||
import Toast from 'react-native-toast-message';
|
import Toast from 'react-native-toast-message';
|
||||||
import { ButtonForm } from "../buttonForm";
|
import { ButtonForm } from "../buttonForm";
|
||||||
@@ -20,6 +21,7 @@ export default function ViewVerification({ phone, otp }: Props) {
|
|||||||
const [value, setValue] = useState('');
|
const [value, setValue] = useState('');
|
||||||
const [otpFix, setOtpFix] = useState(otp)
|
const [otpFix, setOtpFix] = useState(otp)
|
||||||
const { signIn, encryptToken } = useAuthSession();
|
const { signIn, encryptToken } = useAuthSession();
|
||||||
|
const { colors, theme } = useTheme();
|
||||||
|
|
||||||
const login = async () => {
|
const login = async () => {
|
||||||
const valueUser = await AsyncStorage.getItem('user');
|
const valueUser = await AsyncStorage.getItem('user');
|
||||||
@@ -56,13 +58,12 @@ export default function ViewVerification({ phone, otp }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||||
<StatusBar style={Platform.OS === 'ios' ? 'dark' : 'light'} translucent={false} backgroundColor="black" />
|
<StatusBar style={theme === 'dark' ? 'light' : 'dark'} translucent={false} backgroundColor={colors.background} />
|
||||||
<ToastCustom />
|
<View style={[Styles.p20, Styles.h100]} >
|
||||||
<View style={Styles.wrapLogin} >
|
|
||||||
<View style={{ alignItems: "center", marginTop: 70, marginBottom: 50 }}>
|
<View style={{ alignItems: "center", marginTop: 70, marginBottom: 50 }}>
|
||||||
<Image
|
<Image
|
||||||
source={require("../../assets/images/logo.png")}
|
source={theme === 'dark' ? require("../../assets/images/logo-dark.png") : require("../../assets/images/logo.png")}
|
||||||
style={[{ width: 300, height: 150 }]}
|
style={[{ width: 300, height: 150 }]}
|
||||||
width={270}
|
width={270}
|
||||||
height={110}
|
height={110}
|
||||||
@@ -77,25 +78,36 @@ export default function ViewVerification({ phone, otp }: Props) {
|
|||||||
<OtpInput
|
<OtpInput
|
||||||
numberOfDigits={4}
|
numberOfDigits={4}
|
||||||
onTextChange={(text) => setValue(text)}
|
onTextChange={(text) => setValue(text)}
|
||||||
focusColor={'#19345E'}
|
focusColor={colors.tint}
|
||||||
type="numeric"
|
type="numeric"
|
||||||
theme={{
|
theme={{
|
||||||
containerStyle: {
|
containerStyle: {
|
||||||
width: '80%',
|
width: '80%',
|
||||||
alignSelf: 'center'
|
alignSelf: 'center'
|
||||||
},
|
},
|
||||||
pinCodeContainerStyle: Styles.verificationCell,
|
pinCodeContainerStyle: { ...Styles.verificationCell, borderColor: colors.icon },
|
||||||
pinCodeTextStyle: { color: 'black' }
|
pinCodeTextStyle: { color: colors.text }
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ButtonForm
|
<View style={[{ width: '50%', alignSelf: 'center' }]}>
|
||||||
text="SUBMIT"
|
<ButtonForm
|
||||||
onPress={() => { onCheckOtp() }}
|
text="SUBMIT"
|
||||||
/>
|
onPress={() => { onCheckOtp() }}
|
||||||
<Text style={[Styles.textInformation, Styles.mt05, Styles.cDefault, { textAlign: 'center' }]}>
|
/>
|
||||||
Tidak Menerima kode verifikasi? <Text onPress={() => { resendOtp() }}>Kirim Ulang</Text>
|
</View>
|
||||||
|
<Text style={[Styles.textInformation, Styles.mt05, { textAlign: 'center', color: colors.dimmed }]}>
|
||||||
|
Tidak Menerima kode verifikasi? <Text onPress={() => { resendOtp() }} style={[{ color: colors.tint }]}>Kirim Ulang</Text>
|
||||||
</Text>
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<View style={[{ alignItems: 'center' }]}>
|
||||||
|
<Image
|
||||||
|
source={theme === 'dark' ? require("../../assets/images/cogniti-dark.png") : require("../../assets/images/cogniti-light.png")}
|
||||||
|
style={{ width: 86, height: 27 }}
|
||||||
|
resizeMode="contain"
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</>
|
<ToastCustom position="bottom" />
|
||||||
|
</SafeAreaView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,23 @@
|
|||||||
import { useState } from "react";
|
|
||||||
import ButtonMenuHeader from "../buttonMenuHeader";
|
|
||||||
import DrawerBottom from "../drawerBottom";
|
|
||||||
import { View } from "react-native";
|
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
import MenuItemRow from "../menuItemRow";
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { AntDesign } from "@expo/vector-icons";
|
import { AntDesign } from "@expo/vector-icons";
|
||||||
import { router } from "expo-router";
|
import { router } from "expo-router";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { View } from "react-native";
|
||||||
|
import ButtonMenuHeader from "../buttonMenuHeader";
|
||||||
|
import DrawerBottom from "../drawerBottom";
|
||||||
|
import MenuItemRow from "../menuItemRow";
|
||||||
|
|
||||||
export default function HeaderRightBannerList() {
|
export default function HeaderRightBannerList() {
|
||||||
const [isVisible, setVisible] = useState(false)
|
const [isVisible, setVisible] = useState(false)
|
||||||
|
const { colors } = useTheme()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
|
||||||
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={() => setVisible(false)} 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="pluscircleo" color={colors.text} size={25} />}
|
||||||
title="Tambah Banner"
|
title="Tambah Banner"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
setVisible(false)
|
setVisible(false)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Dimensions, Pressable, View } from "react-native";
|
import { Pressable, View } from "react-native";
|
||||||
import Text from "./Text";
|
import Text from "./Text";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -16,18 +16,16 @@ type Props = {
|
|||||||
leftBottomInfo?: React.ReactNode | string
|
leftBottomInfo?: React.ReactNode | string
|
||||||
rightBottomInfo?: React.ReactNode | string
|
rightBottomInfo?: React.ReactNode | string
|
||||||
titleWeight?: 'normal' | 'bold'
|
titleWeight?: 'normal' | 'bold'
|
||||||
bgColor?: 'white' | 'transparent'
|
bgColor?: string
|
||||||
width?: number
|
|
||||||
descEllipsize?: boolean
|
descEllipsize?: boolean
|
||||||
textColor?: string,
|
textColor?: string,
|
||||||
colorPress?: boolean
|
colorPress?: boolean
|
||||||
titleShowAll?: boolean
|
titleShowAll?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function BorderBottomItem({ title, subtitle, icon, desc, onPress, onLongPress, rightTopInfo, borderType, leftBottomInfo, rightBottomInfo, titleWeight, bgColor, width, descEllipsize, textColor, colorPress, titleShowAll }: Props) {
|
export default function BorderBottomItem({ title, subtitle, icon, desc, onPress, onLongPress, rightTopInfo, borderType, leftBottomInfo, rightBottomInfo, titleWeight, bgColor, descEllipsize, textColor, colorPress, titleShowAll }: Props) {
|
||||||
const lebarDim = Dimensions.get("window").width;
|
const { colors } = useTheme();
|
||||||
const lebar = width ? lebarDim * width / 100 : 'auto';
|
const textColorFix = textColor ? textColor : colors.text;
|
||||||
const textColorFix = textColor ? textColor : 'black';
|
|
||||||
const [isTap, setIsTap] = useState(false);
|
const [isTap, setIsTap] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
@@ -37,31 +35,31 @@ export default function BorderBottomItem({ title, subtitle, icon, desc, onPress,
|
|||||||
onPressOut={() => setIsTap(false)}
|
onPressOut={() => setIsTap(false)}
|
||||||
style={({ pressed }) => [
|
style={({ pressed }) => [
|
||||||
borderType == 'bottom'
|
borderType == 'bottom'
|
||||||
? Styles.wrapItemBorderBottom
|
? [Styles.wrapItemBorderBottom, { borderBottomColor: colors.icon + '20' }]
|
||||||
: borderType == 'all'
|
: borderType == 'all'
|
||||||
? Styles.wrapItemBorderAll
|
? [Styles.wrapItemBorderAll, { borderColor: colors.icon + '20' }]
|
||||||
: Styles.wrapItemBorderNone,
|
: Styles.wrapItemBorderNone,
|
||||||
bgColor && bgColor == 'white' && ColorsStatus.white,
|
bgColor == "transparent" ? { backgroundColor: 'transparent' } : { backgroundColor: colors.card },
|
||||||
// efek warna saat ditekan (sementara)
|
// efek warna saat ditekan (sementara)
|
||||||
isTap && colorPress && ColorsStatus.pressedGray,
|
isTap && colorPress && { backgroundColor: colors.icon + '20' },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
{icon}
|
{icon}
|
||||||
<View style={[Styles.rowSpaceBetween, width ? { width: lebar } : { width: '88%' }]}>
|
<View style={[Styles.rowSpaceBetween, Styles.flex1]}>
|
||||||
<View style={[Styles.ml10, rightTopInfo ? { width: '70%' } : { width: '90%' }]}>
|
<View style={[Styles.ml10, Styles.flex1, Styles.mr10]}>
|
||||||
<Text style={[titleWeight == 'normal' ? Styles.textDefault : Styles.textDefaultSemiBold, { color: textColorFix }]} numberOfLines={titleShowAll ? 0 : 1} ellipsizeMode='tail'>{title}</Text>
|
<Text style={[titleWeight == 'normal' ? Styles.textDefault : Styles.textDefaultSemiBold, { color: textColorFix }]} numberOfLines={titleShowAll ? 0 : 1} ellipsizeMode='tail'>{title}</Text>
|
||||||
{
|
{
|
||||||
subtitle &&
|
subtitle &&
|
||||||
typeof subtitle == "string"
|
typeof subtitle == "string"
|
||||||
? <Text style={[Styles.textMediumNormal, { lineHeight: 15, color: textColorFix }]}>{subtitle}</Text>
|
? <Text style={[Styles.textMediumNormal, { lineHeight: 15, color: colors.dimmed }]}>{subtitle}</Text>
|
||||||
: <View style={{ alignItems: 'flex-start' }}>
|
: <View style={{ alignItems: 'flex-start' }}>
|
||||||
{subtitle}
|
{subtitle}
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
{
|
{
|
||||||
rightTopInfo && <Text style={[Styles.textInformation, Styles.mt05, { color: textColorFix }]}>{rightTopInfo}</Text>
|
rightTopInfo && <Text style={[Styles.textInformation, Styles.mt05, { color: colors.dimmed }]}>{rightTopInfo}</Text>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@@ -70,16 +68,16 @@ export default function BorderBottomItem({ title, subtitle, icon, desc, onPress,
|
|||||||
{
|
{
|
||||||
(leftBottomInfo || rightBottomInfo) &&
|
(leftBottomInfo || rightBottomInfo) &&
|
||||||
(
|
(
|
||||||
<View style={[rightBottomInfo && !leftBottomInfo ? Styles.rowSpaceBetweenReverse : Styles.rowSpaceBetween, Styles.mt05]}>
|
<View style={[rightBottomInfo && !leftBottomInfo ? Styles.rowSpaceBetweenReverse : Styles.rowSpaceBetween, Styles.mt02]}>
|
||||||
{
|
{
|
||||||
typeof leftBottomInfo == 'string' ?
|
typeof leftBottomInfo == 'string' ?
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>{leftBottomInfo}</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{leftBottomInfo}</Text>
|
||||||
:
|
:
|
||||||
leftBottomInfo
|
leftBottomInfo
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typeof rightBottomInfo == 'string' ?
|
typeof rightBottomInfo == 'string' ?
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>{rightBottomInfo}</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{rightBottomInfo}</Text>
|
||||||
:
|
:
|
||||||
rightBottomInfo
|
rightBottomInfo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { ColorsStatus } from "@/constants/ColorsStatus";
|
|||||||
import { ConstEnv } from "@/constants/ConstEnv";
|
import { ConstEnv } from "@/constants/ConstEnv";
|
||||||
import { isImageFile } from "@/constants/FileExtensions";
|
import { isImageFile } from "@/constants/FileExtensions";
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
import * as FileSystem from 'expo-file-system';
|
import * as FileSystem from 'expo-file-system';
|
||||||
import { startActivityAsync } from 'expo-intent-launcher';
|
import { startActivityAsync } from 'expo-intent-launcher';
|
||||||
@@ -45,9 +46,10 @@ type PropsFile = {
|
|||||||
|
|
||||||
|
|
||||||
export default function BorderBottomItem2({ title, subtitle, icon, desc, onPress, onLongPress, rightTopInfo, borderType, leftBottomInfo, rightBottomInfo, titleWeight, bgColor, width, descEllipsize, textColor, colorPress, titleShowAll, dataFile }: Props) {
|
export default function BorderBottomItem2({ title, subtitle, icon, desc, onPress, onLongPress, rightTopInfo, borderType, leftBottomInfo, rightBottomInfo, titleWeight, bgColor, width, descEllipsize, textColor, colorPress, titleShowAll, dataFile }: Props) {
|
||||||
|
const { colors } = useTheme();
|
||||||
const lebarDim = Dimensions.get("window").width;
|
const lebarDim = Dimensions.get("window").width;
|
||||||
const lebar = width ? lebarDim * width / 100 : 'auto';
|
const lebar = width ? lebarDim * width / 100 : 'auto';
|
||||||
const textColorFix = textColor ? textColor : 'black';
|
const textColorFix = textColor ? textColor : colors.text;
|
||||||
const [isTap, setIsTap] = useState(false);
|
const [isTap, setIsTap] = useState(false);
|
||||||
const [loadingOpen, setLoadingOpen] = useState(false)
|
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||||
const [chooseFile, setChooseFile] = useState<PropsFile>()
|
const [chooseFile, setChooseFile] = useState<PropsFile>()
|
||||||
@@ -115,11 +117,11 @@ export default function BorderBottomItem2({ title, subtitle, icon, desc, onPress
|
|||||||
onPressOut={() => setIsTap(false)}
|
onPressOut={() => setIsTap(false)}
|
||||||
style={({ pressed }) => [
|
style={({ pressed }) => [
|
||||||
borderType == 'bottom'
|
borderType == 'bottom'
|
||||||
? Styles.wrapItemBorderBottom
|
? [Styles.wrapItemBorderBottom, { borderBottomColor: colors.icon + '20' }]
|
||||||
: borderType == 'all'
|
: borderType == 'all'
|
||||||
? Styles.wrapItemBorderAll
|
? [Styles.wrapItemBorderAll, { borderColor: colors.icon + '20' }]
|
||||||
: Styles.wrapItemBorderNone,
|
: Styles.wrapItemBorderNone,
|
||||||
bgColor && bgColor == 'white' && ColorsStatus.white,
|
bgColor && bgColor == 'white' && { backgroundColor: colors.card },
|
||||||
// efek warna saat ditekan (sementara)
|
// efek warna saat ditekan (sementara)
|
||||||
isTap && colorPress && ColorsStatus.pressedGray,
|
isTap && colorPress && ColorsStatus.pressedGray,
|
||||||
]}
|
]}
|
||||||
@@ -147,11 +149,11 @@ export default function BorderBottomItem2({ title, subtitle, icon, desc, onPress
|
|||||||
{desc && <Text style={[Styles.textDefault, Styles.mt05, { textAlign: 'left', color: textColorFix }]} numberOfLines={descEllipsize == false ? 0 : 2} ellipsizeMode='tail'>{desc}</Text>}
|
{desc && <Text style={[Styles.textDefault, Styles.mt05, { textAlign: 'left', color: textColorFix }]} numberOfLines={descEllipsize == false ? 0 : 2} ellipsizeMode='tail'>{desc}</Text>}
|
||||||
{
|
{
|
||||||
dataFile.length > 0 && (
|
dataFile.length > 0 && (
|
||||||
<ScrollView horizontal style={[Styles.mv05]} showsHorizontalScrollIndicator={false}>
|
<ScrollView horizontal style={[Styles.mv10]} showsHorizontalScrollIndicator={false}>
|
||||||
{dataFile.map((item, index) => (
|
{dataFile.map((item, index) => (
|
||||||
<Pressable
|
<Pressable
|
||||||
key={index}
|
key={index}
|
||||||
style={[Styles.rowItemsCenter, Styles.borderAll, Styles.round10, Styles.ph05, Styles.pv03, Styles.mr05]}
|
style={[Styles.rowItemsCenter, Styles.borderAll, Styles.round05, Styles.ph05, Styles.pv03, Styles.mr05, { borderColor: colors.icon }]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
isImageFile(item.extension) ?
|
isImageFile(item.extension) ?
|
||||||
handleChooseFile(item)
|
handleChooseFile(item)
|
||||||
@@ -161,8 +163,8 @@ export default function BorderBottomItem2({ title, subtitle, icon, desc, onPress
|
|||||||
<MaterialCommunityIcons
|
<MaterialCommunityIcons
|
||||||
name={isImageFile(item.extension) ? "file-image-outline" : "file-document-outline"}
|
name={isImageFile(item.extension) ? "file-image-outline" : "file-document-outline"}
|
||||||
size={18}
|
size={18}
|
||||||
color="grey" />
|
color={colors.icon} />
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>{item.name}.{item.extension}</Text>
|
<Text style={[Styles.textInformation]}>{item.name}.{item.extension}</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
))}
|
))}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
@@ -171,16 +173,16 @@ export default function BorderBottomItem2({ title, subtitle, icon, desc, onPress
|
|||||||
{
|
{
|
||||||
(leftBottomInfo || rightBottomInfo) &&
|
(leftBottomInfo || rightBottomInfo) &&
|
||||||
(
|
(
|
||||||
<View style={[rightBottomInfo && !leftBottomInfo ? Styles.rowSpaceBetweenReverse : Styles.rowSpaceBetween, Styles.mt05]}>
|
<View style={[rightBottomInfo && !leftBottomInfo ? Styles.rowSpaceBetweenReverse : Styles.rowSpaceBetween, Styles.mt10]}>
|
||||||
{
|
{
|
||||||
typeof leftBottomInfo == 'string' ?
|
typeof leftBottomInfo == 'string' ?
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>{leftBottomInfo}</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{leftBottomInfo}</Text>
|
||||||
:
|
:
|
||||||
leftBottomInfo
|
leftBottomInfo
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typeof rightBottomInfo == 'string' ?
|
typeof rightBottomInfo == 'string' ?
|
||||||
<Text style={[Styles.textInformation, Styles.cGray]}>{rightBottomInfo}</Text>
|
<Text style={[Styles.textInformation, { color: colors.dimmed }]}>{rightBottomInfo}</Text>
|
||||||
:
|
:
|
||||||
rightBottomInfo
|
rightBottomInfo
|
||||||
}
|
}
|
||||||
@@ -213,7 +215,7 @@ export default function BorderBottomItem2({ title, subtitle, icon, desc, onPress
|
|||||||
accessibilityLabel="Download or share image"
|
accessibilityLabel="Download or share image"
|
||||||
disabled={loadingOpen}
|
disabled={loadingOpen}
|
||||||
>
|
>
|
||||||
<Text style={{ color: loadingOpen ? 'gray' : 'white', fontSize: 22 }}>⋯</Text>
|
<Text style={{ color: loadingOpen ? 'gray' : 'white', fontSize: 26 }}>⋯</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|||||||
53
components/borderBottomItemVertical.tsx
Normal file
53
components/borderBottomItemVertical.tsx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import Styles from "@/constants/Styles";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { Pressable, View } from "react-native";
|
||||||
|
import Text from "./Text";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
title?: string
|
||||||
|
icon: React.ReactNode
|
||||||
|
desc?: string
|
||||||
|
rightTopInfo?: string
|
||||||
|
onPress?: () => void
|
||||||
|
onLongPress?: () => void
|
||||||
|
borderType: 'all' | 'bottom' | 'none'
|
||||||
|
titleWeight?: 'normal' | 'bold'
|
||||||
|
bgColor?: string
|
||||||
|
descEllipsize?: boolean
|
||||||
|
textColor?: string,
|
||||||
|
titleShowAll?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function BorderBottomItemVertical({ title, icon, desc, onPress, onLongPress, rightTopInfo, borderType, titleWeight, bgColor, descEllipsize, textColor, titleShowAll }: Props) {
|
||||||
|
const { colors } = useTheme();
|
||||||
|
const textColorFix = textColor ? textColor : colors.text;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Pressable onLongPress={onLongPress} onPress={onPress}
|
||||||
|
style={({ pressed }) => [
|
||||||
|
borderType == 'bottom'
|
||||||
|
? [Styles.wrapItemBorderBottom, { borderBottomColor: colors.icon + '20' }]
|
||||||
|
: borderType == 'all'
|
||||||
|
? [Styles.wrapItemBorderAll, { borderColor: colors.icon + '20' }]
|
||||||
|
: Styles.wrapItemBorderNone,
|
||||||
|
bgColor == "transparent" ? { backgroundColor: 'transparent' } : { backgroundColor: colors.card },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<View style={Styles.rowItemsCenter}>
|
||||||
|
{icon}
|
||||||
|
<View style={[Styles.ml10, Styles.flex1]}>
|
||||||
|
<View style={Styles.rowSpaceBetween}>
|
||||||
|
<View style={[Styles.flex1, Styles.mr10]}>
|
||||||
|
<Text style={[titleWeight == 'normal' ? Styles.textDefault : Styles.textDefaultSemiBold, { color: textColorFix }]} numberOfLines={titleShowAll ? 0 : 1} ellipsizeMode='tail'>{title}</Text>
|
||||||
|
</View>
|
||||||
|
{
|
||||||
|
rightTopInfo && <Text style={[Styles.textInformation, Styles.mt05, { color: textColorFix }]}>{rightTopInfo}</Text>
|
||||||
|
}
|
||||||
|
</View>
|
||||||
|
{desc && <Text style={[Styles.textDefault, { textAlign: 'left', color: textColorFix }]} numberOfLines={descEllipsize == false ? 0 : 2} ellipsizeMode='tail'>{desc}</Text>}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</Pressable>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ export default function ButtonBackHeader({ onPress }: Props) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonHeader
|
<ButtonHeader
|
||||||
item={<Feather name="chevron-left" size={20} color="white" />}
|
item={<Feather name="chevron-left" size={25} color="white" />}
|
||||||
onPress={() => { onPress && onPress() }}
|
onPress={() => { onPress && onPress() }}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { TouchableWithoutFeedback, View } from "react-native";
|
import { TouchableWithoutFeedback, View } from "react-native";
|
||||||
import Text from "./Text";
|
import Text from "./Text";
|
||||||
@@ -10,13 +11,14 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function ButtonFiturMenu({ onPress, icon, text }: Props) {
|
export function ButtonFiturMenu({ onPress, icon, text }: Props) {
|
||||||
|
const { colors } = useTheme();
|
||||||
return (
|
return (
|
||||||
<TouchableWithoutFeedback onPress={onPress}>
|
<TouchableWithoutFeedback onPress={onPress}>
|
||||||
<View style={{ alignItems: 'center' }}>
|
<View style={{ alignItems: 'center' }}>
|
||||||
<View style={[Styles.btnFiturMenu]}>
|
<View style={[Styles.btnFiturMenu, { backgroundColor: colors.card, borderColor: colors.icon + '20', shadowColor: colors.text }]}>
|
||||||
{icon}
|
{icon}
|
||||||
</View>
|
</View>
|
||||||
<Text style={[Styles.mt05]}>{text}</Text>
|
<Text style={[Styles.mt05, { color: colors.text }]}>{text}</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableWithoutFeedback>
|
</TouchableWithoutFeedback>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
|
||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { TouchableOpacity } from "react-native";
|
import { TouchableOpacity } from "react-native";
|
||||||
import Text from './Text';
|
import Text from './Text';
|
||||||
|
|
||||||
@@ -10,8 +10,9 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function ButtonForm({ text, onPress, disabled }: Props) {
|
export function ButtonForm({ text, onPress, disabled }: Props) {
|
||||||
|
const { colors } = useTheme();
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={[Styles.btnRound, { marginTop: 30,}, disabled && ColorsStatus.gray]} onPress={onPress} disabled={disabled}>
|
<TouchableOpacity style={[Styles.btnRound, Styles.round05, Styles.mt30, { backgroundColor: colors.primary }, disabled && { backgroundColor: colors.tabIconDefault }]} onPress={onPress} disabled={disabled}>
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.cWhite]}>{text}</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.cWhite]}>{text}</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export default function ButtonMenuHeader({ onPress }: Props) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonHeader
|
<ButtonHeader
|
||||||
item={<Feather name="menu" size={20} color="white" />}
|
item={<Feather name="menu" size={25} color="white" />}
|
||||||
onPress={() => onPress()}
|
onPress={() => onPress()}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default function ButtonNextHeader({ onPress, disable }: Props) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonHeader
|
<ButtonHeader
|
||||||
item={<Feather name="chevron-right" size={20} color={disable ? "grey" : "white"} />}
|
item={<Feather name="chevron-right" size={25} color={disable ? "grey" : "white"} />}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
!disable && onPress && onPress()
|
!disable && onPress && onPress()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Feather } from "@expo/vector-icons"
|
import { Feather } from "@expo/vector-icons"
|
||||||
import AlertKonfirmasi from "./alertKonfirmasi"
|
import ModalConfirmation from "./ModalConfirmation"
|
||||||
import { ButtonHeader } from "./buttonHeader"
|
import { ButtonHeader } from "./buttonHeader"
|
||||||
|
import { useState } from "react"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
category: 'create' | 'update' | 'cancel' | 'update-calendar'
|
category: 'create' | 'update' | 'cancel' | 'update-calendar'
|
||||||
@@ -9,29 +10,37 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ButtonSaveHeader({ category, onPress, disable }: Props) {
|
export default function ButtonSaveHeader({ category, onPress, disable }: Props) {
|
||||||
|
const [showModal, setShowModal] = useState(false)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ButtonHeader
|
<ButtonHeader
|
||||||
item={<Feather name="check" size={20} color={disable ? "grey" : "white"} />}
|
item={<Feather name="check" size={25} color={disable ? "grey" : "white"} />}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (!disable) {
|
if (!disable) {
|
||||||
AlertKonfirmasi({
|
setShowModal(true)
|
||||||
title: 'Konfirmasi',
|
|
||||||
desc: category == 'create'
|
|
||||||
? 'Apakah anda yakin ingin menambahkan data?'
|
|
||||||
: category == 'cancel'
|
|
||||||
? 'Apakah anda yakin ingin membatalkan kegiatan? Pembatalan bersifat permanen'
|
|
||||||
: category == 'update-calendar'
|
|
||||||
? 'Apakah Anda yakin ingin mengubah data acara ini? Data ini akan mempengaruhi semua data yang terkait'
|
|
||||||
: 'Apakah anda yakin mengubah data?',
|
|
||||||
onPress: () => {
|
|
||||||
onPress && onPress()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ModalConfirmation
|
||||||
|
visible={showModal}
|
||||||
|
title="Konfirmasi"
|
||||||
|
message={
|
||||||
|
category == 'create'
|
||||||
|
? 'Apakah anda yakin ingin menambahkan data?'
|
||||||
|
: category == 'cancel'
|
||||||
|
? 'Apakah anda yakin ingin membatalkan kegiatan? Pembatalan bersifat permanen'
|
||||||
|
: category == 'update-calendar'
|
||||||
|
? 'Apakah Anda yakin ingin mengubah data acara ini? Data ini akan mempengaruhi semua data yang terkait'
|
||||||
|
: 'Apakah anda yakin mengubah data?'
|
||||||
}
|
}
|
||||||
|
onConfirm={() => {
|
||||||
|
setShowModal(false)
|
||||||
|
onPress && onPress()
|
||||||
|
}}
|
||||||
|
onCancel={() => setShowModal(false)}
|
||||||
|
confirmText="Ya"
|
||||||
|
cancelText="Batal"
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Styles from "@/constants/Styles";
|
import Styles from "@/constants/Styles";
|
||||||
|
import { useTheme } from "@/providers/ThemeProvider";
|
||||||
import { Feather } from "@expo/vector-icons";
|
import { Feather } from "@expo/vector-icons";
|
||||||
import { Pressable, View } from "react-native";
|
import { Pressable, View } from "react-native";
|
||||||
import Text from "./Text";
|
import Text from "./Text";
|
||||||
@@ -12,15 +13,23 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ButtonSelect({ value, onPress, round, error, errorText }: Props) {
|
export default function ButtonSelect({ value, onPress, round, error, errorText }: Props) {
|
||||||
|
const { colors } = useTheme();
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.mv05]}>
|
<View style={[Styles.mv05]}>
|
||||||
<Pressable onPress={onPress}>
|
<Pressable onPress={onPress}>
|
||||||
<View style={[Styles.inputRoundForm, Styles.inputRoundFormRight, round && Styles.round30, Styles.pv10, error && { borderColor: "red" }]}>
|
<View style={[
|
||||||
<Feather name="arrow-right-circle" size={20} color="black" />
|
Styles.inputRoundForm,
|
||||||
<Text style={[Styles.cBlack]}>{value}</Text>
|
Styles.inputRoundFormRight,
|
||||||
|
round && Styles.round30,
|
||||||
|
Styles.pv10,
|
||||||
|
{ borderColor: colors.icon + '20', backgroundColor: colors.input },
|
||||||
|
error && { borderColor: "red" }
|
||||||
|
]}>
|
||||||
|
<Feather name="arrow-right-circle" size={20} color={colors.text} />
|
||||||
|
<Text style={[{ color: colors.text }]}>{value}</Text>
|
||||||
</View>
|
</View>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
{error && (<Text style={[Styles.textInformation, Styles.mt05, Styles.cError]}>{errorText}</Text>)}
|
{error && (<Text style={[Styles.textInformation, Styles.mt05, { color: colors.error }]}>{errorText}</Text>)}
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user