Compare commits

..

25 Commits

Author SHA1 Message Date
b0e959e3e1 Merge pull request 'amalia/19-agustus-25' (#25) from amalia/19-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#25
2025-08-19 17:42:31 +08:00
263875ae55 upd: fitur tambahan project
Deskripsi:
- tampilan list detail waktu task project
- integrasi api mobile list detail
- tampilan tambah detail task project > blm selesai

No Issues
2025-08-19 17:39:27 +08:00
7810eb1686 upd: pake env
Deskripsi:
- ganti app.json menjadi app.config.js agar bisa pake env
- membuat env
- ganti url pake env > api url, storage url, firebase database url, otp url

No Issues
2025-08-15 17:20:23 +08:00
0956dea846 upd: tampilan
Deskripsi:
- header menu detail project
- header menu detail tugas divisi

No Issues
2025-08-15 16:25:48 +08:00
2e5698b566 fix: tampilan
Deskripsi:
- tinggi modal

No Issues
2025-08-15 11:53:46 +08:00
1ee9bea65e upd: laporan kegiatan
Deskripsi
:
- tampilan list laporan pada project dan task divisi
- tampilan form update laporan pada project dan task divisi
- integrasi api update laporan pada project dan task divisi
- integrasi api view laporan pada project dan task divisi

NO Issues'
2025-08-15 11:47:43 +08:00
fa5005a76a Merge pull request 'upd: upload link' (#23) from amalia/14-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#23
2025-08-14 17:15:23 +08:00
7015e92366 upd: upload link
Deskripsi:
- tampilan section link pada project dan tugas divisi
- tampilan tambah link pada project dan tugas divisi
- integrasi api tambah data link pada project dan tugas divisi
- integrasi api hapus data link pada project dan tugas divisi

No Issues
2025-08-14 12:13:41 +08:00
acc464bfc8 Merge pull request 'amalia/12-agustus-25' (#22) from amalia/12-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#22
2025-08-12 17:42:40 +08:00
edbeb30ebe fix : tampilan
Deskripsi:
- border bottom komponen width

No Issues
2025-08-12 14:53:28 +08:00
57a4e2fce6 fix : function
Deskripsi:
- function validation edit judul projectt

No Issues
2025-08-12 13:46:08 +08:00
fd1d20bb32 upd: task divisi detail
Deskripsi:
- mengganti caraousel pada list task hari ini pada detail divisi

No Issues
2025-08-12 13:43:19 +08:00
e8e5af7126 upd: ios dan komponen modal
Deskripsi:
- update ios
- komponen modal loading on click backdrop

No Issues
2025-08-12 11:43:53 +08:00
1089afb6aa Merge pull request 'amalia/11-agustus-25' (#21) from amalia/11-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#21
2025-08-11 17:33:44 +08:00
0f5a56c612 upd: login
Deskripsi:
- tinggi view
- toast error kode verification

No Issues
2025-08-11 17:08:55 +08:00
f929791075 fix: list data
Deskripsi:
- perbaikan list data pada jabatan dan group menggunakan virtualized

No Issues
2025-08-11 10:43:50 +08:00
a49d25500a Merge pull request 'fix: pengumuman' (#20) from amalia/08-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#20
2025-08-08 17:37:54 +08:00
5ad055f543 Merge pull request 'amalia/08-agustus-25' (#19) from amalia/08-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#19
2025-08-08 12:18:33 +08:00
b490b93c00 Merge pull request 'upd: clear warning' (#18) from amalia/08-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#18
2025-08-08 11:27:27 +08:00
3efd44ce70 Merge pull request 'upd: push notification on background' (#17) from amalia/07-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#17
2025-08-07 17:43:02 +08:00
0c8297f785 Merge pull request 'amalia/07-agustus-25' (#16) from amalia/07-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#16
2025-08-07 14:09:10 +08:00
24c07efb97 Merge pull request 'amalia/06-agustus-25' (#15) from amalia/06-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#15
2025-08-06 17:34:43 +08:00
323d31250b Merge pull request 'upd: notifikasi diskusi umum' (#14) from amalia/06-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#14
2025-08-06 12:00:02 +08:00
c119d3e775 Merge pull request 'amalia/05-agustus-25' (#13) from amalia/05-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#13
2025-08-05 17:39:56 +08:00
9a5765f0d0 Merge pull request 'amalia/04-agustus-25' (#12) from amalia/04-agustus-25 into join
Reviewed-on: bip/mobile-darmasaba#12
2025-08-04 17:45:44 +08:00
43 changed files with 1349 additions and 212 deletions

3
.gitignore vendored
View File

@@ -32,6 +32,9 @@ yarn-error.*
# local env files
.env*.local
#env
.env
# typescript
*.tsbuildinfo

72
app.config.js Normal file
View File

@@ -0,0 +1,72 @@
import 'dotenv/config';
export default {
expo: {
name: "mobile-darmasaba",
slug: "mobile-darmasaba",
version: "1.0.0",
jsEngine: "jsc",
orientation: "portrait",
icon: "./assets/images/icon.png",
scheme: "myapp",
userInterfaceStyle: "automatic",
newArchEnabled: false,
ios: {
supportsTablet: true,
bundleIdentifier: "mobiledarmasaba.app",
infoPlist: {
ITSAppUsesNonExemptEncryption: false
},
googleServicesFile: "./ios/mobiledarmasaba/GoogleService-Info.plist"
},
android: {
package: "mobiledarmasaba.app",
adaptiveIcon: {
foregroundImage: "./assets/images/splash-icon.png",
backgroundColor: "#ffffff"
},
googleServicesFile: "./google-services.json"
},
web: {
bundler: "metro",
output: "static",
favicon: "./assets/images/favicon.png"
},
plugins: [
"expo-router",
[
"expo-splash-screen",
{
image: "./assets/images/splash-icon.png",
imageWidth: 200,
resizeMode: "contain",
backgroundColor: "#ffffff"
}
],
"expo-font",
"expo-image-picker",
"expo-web-browser",
[
"@react-native-firebase/app",
{
ios: {
googleServicesFile: "./ios/mobiledarmasaba/GoogleService-Info.plist"
}
}
]
],
experiments: {
typedRoutes: true
},
extra: {
router: {},
eas: {
projectId: "cfe34fb8-da8c-4004-b5c6-29d07df75cf2"
},
URL_API: process.env.URL_API,
URL_OTP: process.env.URL_OTP,
URL_STORAGE : process.env.URL_STORAGE,
URL_FIREBASE_DB : process.env.URL_FIREBASE_DB
}
}
};

View File

@@ -146,7 +146,6 @@ export default function DetailDiscussionGeneral() {
:
<BorderBottomItem
descEllipsize={false}
width={55}
borderType="bottom"
icon={
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
@@ -183,7 +182,6 @@ export default function DetailDiscussionGeneral() {
return (
<BorderBottomItem
key={i}
width={55}
borderType="bottom"
icon={
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} size="xs" />

View File

@@ -217,7 +217,6 @@ export default function DiscussionDetail() {
:
<BorderBottomItem
descEllipsize={false}
width={55}
borderType="bottom"
icon={
<ImageUser
@@ -265,7 +264,6 @@ export default function DiscussionDetail() {
dataComment.map((item, index) => (
<BorderBottomItem
key={index}
width={55}
borderType="bottom"
icon={
<ImageUser

View File

@@ -138,7 +138,6 @@ export default function DiscussionDivision() {
return (
<BorderBottomItem
key={index}
width={55}
onPress={() => { router.push(`./discussion/${item.id}`) }}
borderType="bottom"
icon={
@@ -174,7 +173,6 @@ export default function DiscussionDivision() {
// data.map((item, index) => (
// <BorderBottomItem
// key={index}
// width={55}
// onPress={() => { router.push(`./discussion/${item.id}`) }}
// borderType="bottom"
// icon={

View File

@@ -3,7 +3,9 @@ import SectionCancel from "@/components/sectionCancel";
import SectionProgress from "@/components/sectionProgress";
import HeaderRightTaskDetail from "@/components/task/headerTaskDetail";
import SectionFileTask from "@/components/task/sectionFileTask";
import SectionLinkTask from "@/components/task/sectionLinkTask";
import SectionMemberTask from "@/components/task/sectionMemberTask";
import SectionReportTask from "@/components/task/sectionReportTask";
import SectionTanggalTugasTask from "@/components/task/sectionTanggalTugasTask";
import Styles from "@/constants/Styles";
import { apiGetTaskOne } from "@/lib/api";
@@ -88,9 +90,11 @@ export default function DetailTaskDivision() {
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
}
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
<SectionTanggalTugasTask refreshing={refreshing}/>
<SectionFileTask refreshing={refreshing}/>
<SectionMemberTask refreshing={refreshing}/>
<SectionReportTask refreshing={refreshing} />
<SectionTanggalTugasTask refreshing={refreshing} />
<SectionFileTask refreshing={refreshing} />
<SectionLinkTask refreshing={refreshing} />
<SectionMemberTask refreshing={refreshing} />
</View>
</ScrollView>
</SafeAreaView>

View File

@@ -0,0 +1,129 @@
import ButtonBackHeader from "@/components/buttonBackHeader";
import ButtonSaveHeader from "@/components/buttonSaveHeader";
import { InputForm } from "@/components/inputForm";
import Styles from "@/constants/Styles";
import { apiGetTaskOne, apiReportTask } from "@/lib/api";
import { setUpdateTask } from "@/lib/taskUpdate";
import { useAuthSession } from "@/providers/AuthProvider";
import { router, Stack, useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { SafeAreaView, ScrollView, View } from "react-native";
import Toast from "react-native-toast-message";
import { useDispatch, useSelector } from "react-redux";
export default function TaskDivisionReport() {
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
const { token, decryptToken } = useAuthSession();
const [laporan, setLaporan] = useState("");
const [error, setError] = useState(false);
const [disable, setDisable] = useState(false);
const dispatch = useDispatch();
const update = useSelector((state: any) => state.taskUpdate);
const [loading, setLoading] = useState(false)
async function handleLoad() {
try {
const hasil = await decryptToken(String(token?.current));
const response = await apiGetTaskOne({
user: hasil,
cat: "data",
id: detail,
});
setLaporan(response.data.report);
} catch (error) {
console.error(error);
}
}
useEffect(() => {
handleLoad();
}, []);
function onValidation(val: string) {
setLaporan(val);
if (val == "" || val == "null") {
setError(true);
} else {
setError(false);
}
}
function checkAll() {
if (laporan == "" || laporan == "null" || laporan == undefined || laporan == null || error) {
setDisable(true);
} else {
setDisable(false);
}
}
useEffect(() => {
checkAll();
}, [laporan, error]);
async function handleUpdate() {
try {
setLoading(true)
const hasil = await decryptToken(String(token?.current));
const response = await apiReportTask(
{
report: laporan,
user: hasil,
},
detail
);
if (response.success) {
dispatch(setUpdateTask({ ...update, report: !update.report }));
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
router.back();
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
} finally {
setLoading(false)
}
}
return (
<SafeAreaView>
<Stack.Screen
options={{
headerLeft: () => (
<ButtonBackHeader
onPress={() => {
router.back();
}}
/>
),
headerTitle: "Laporan Kegiatan",
headerTitleAlign: "center",
headerRight: () => (
<ButtonSaveHeader
category="update"
disable={disable || loading}
onPress={() => { handleUpdate() }}
/>
),
}}
/>
<ScrollView>
<View style={[Styles.p15, Styles.mb100]}>
<InputForm
label="Laporan Kegiatan"
type="default"
placeholder="Laporan Kegiatan"
required
bg="white"
value={laporan}
onChange={(val) => { onValidation(val) }}
error={error}
errorText="Laporan kegiatan harus diisi"
multiline
/>
</View>
</ScrollView>
</SafeAreaView>
);
}

View File

@@ -184,7 +184,6 @@ export default function InformationDivision() {
dataMember.map((item, index) => {
return (
<BorderBottomItem
width={55}
key={index}
borderType="bottom"
onPress={() => { dataDetail?.isActive && handleChooseMember(item) }}

View File

@@ -15,7 +15,7 @@ import { setUpdateGroup } from "@/lib/groupSlice";
import { useAuthSession } from "@/providers/AuthProvider";
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
import { useEffect, useState } from "react";
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
import { RefreshControl, View, VirtualizedList } from "react-native";
import Toast from "react-native-toast-message";
import { useDispatch, useSelector } from "react-redux";
@@ -116,9 +116,17 @@ export default function Index() {
}
const getItem = (_data: unknown, index: number): Props => ({
id: data[index].id,
name: data[index].name,
isActive: data[index].isActive,
});
return (
<SafeAreaView>
<View style={[Styles.p15]}>
<View style={[Styles.p15, { flex: 1 }]}>
<View>
<View style={[Styles.wrapBtnTab]}>
<ButtonTab
active={status == "false" ? "false" : "true"}
@@ -136,51 +144,53 @@ export default function Index() {
n={2} />
</View>
<InputSearch onChange={setSearch} />
<ScrollView
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={handleRefresh}
/>
}
style={[Styles.h100]}
>
<View>
{
loading ?
arrSkeleton.map((item, index) => {
</View>
<View style={{ flex: 2 }}>
{
loading ?
arrSkeleton.map((item, index) => {
return (
<SkeletonTwoItem key={index} />
)
})
:
data.length > 0 ?
<VirtualizedList
data={data}
getItemCount={() => data.length}
getItem={getItem}
renderItem={({ item, index }: { item: Props, index: number }) => {
return (
<SkeletonTwoItem key={index} />
<BorderBottomItem
key={index}
onPress={() => {
setIdChoose(item.id)
setActiveChoose(item.isActive)
setTitleChoose(item.name)
setModal(true)
}}
borderType="all"
icon={
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
<MaterialCommunityIcons name="office-building-outline" size={25} color={'#384288'} />
</View>
}
title={item.name}
/>
)
})
:
data.length > 0 ?
data.map((item, index) => {
return (
<BorderBottomItem
key={index}
onPress={() => {
setIdChoose(item.id)
setActiveChoose(item.isActive)
setTitleChoose(item.name)
setModal(true)
}}
borderType="all"
icon={
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
<MaterialCommunityIcons name="office-building-outline" size={25} color={'#384288'} />
</View>
}
title={item.name}
/>
)
})
:
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
}
</View>
</ScrollView>
}}
keyExtractor={(item, index) => String(index)}
showsVerticalScrollIndicator={false}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={handleRefresh}
/>
}
/>
:
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
}
</View>
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title={titleChoose}>
@@ -228,8 +238,7 @@ export default function Index() {
</View>
</View>
</DrawerBottom>
</View >
</SafeAreaView>
)
}

View File

@@ -136,7 +136,6 @@ export default function Notification() {
return (
<BorderBottomItem
borderType="bottom"
width={55}
icon={
<View style={[Styles.iconContent, item.isRead ? ColorsStatus.secondary : ColorsStatus.primary]}>
<Feather name="bell" size={25} color="white" />

View File

@@ -16,7 +16,7 @@ import { useAuthSession } from "@/providers/AuthProvider";
import { AntDesign, Feather, MaterialCommunityIcons } from "@expo/vector-icons";
import { useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native";
import { RefreshControl, View, VirtualizedList } from "react-native";
import Toast from "react-native-toast-message";
import { useDispatch, useSelector } from "react-redux";
@@ -129,9 +129,18 @@ export default function Index() {
setRefreshing(false)
};
const getItem = (_data: unknown, index: number): Props => ({
id: data[index].id,
name: data[index].name,
idGroup: data[index].idGroup,
group: data[index].group,
isActive: data[index].isActive,
});
return (
<SafeAreaView>
<View style={[Styles.p15]}>
<View style={[Styles.p15, { flex: 1 }]}>
<View>
<View style={[Styles.wrapBtnTab]}>
<ButtonTab
active={status == "false" ? "false" : "true"}
@@ -155,47 +164,50 @@ export default function Index() {
<Text>Filter : {nameGroup}</Text>
</View>
}
<ScrollView
style={[Styles.h100]}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={handleRefresh}
/>
}>
<View>
{
loading ?
arrSkeleton.map((item, index) => {
return (
<SkeletonTwoItem key={index} />
)
})
:
data.length > 0 ?
data.map((item, index) => {
return (
<BorderBottomItem
key={index}
onPress={() => { handleChooseData(item.id, item.name, item.isActive, item.idGroup) }}
borderType="all"
icon={
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
<MaterialCommunityIcons name="account-tie" size={25} color={'#384288'} />
</View>
}
title={item.name}
subtitle={item.group}
/>
)
})
:
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
}
</View>
</ScrollView>
</View>
<View style={[{ flex: 2 }]}>
{
loading ?
arrSkeleton.map((item, index) => {
return (
<SkeletonTwoItem key={index} />
)
})
:
data.length > 0 ?
<VirtualizedList
data={data}
getItemCount={() => data.length}
getItem={getItem}
renderItem={({ item, index }: { item: Props, index: number }) => {
return (
<BorderBottomItem
key={index}
onPress={() => { handleChooseData(item.id, item.name, item.isActive, item.idGroup) }}
borderType="all"
icon={
<View style={[Styles.iconContent, ColorsStatus.lightGreen]}>
<MaterialCommunityIcons name="account-tie" size={25} color={'#384288'} />
</View>
}
title={item.name}
subtitle={item.group}
/>
)
}}
keyExtractor={(item, index) => String(index)}
showsVerticalScrollIndicator={false}
refreshControl={
<RefreshControl
refreshing={refreshing}
onRefresh={handleRefresh}
/>
}
/>
:
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada data</Text>
}
</View>
<DrawerBottom animation="slide" isVisible={isModal} setVisible={() => setModal(false)} title={chooseData.name}>
<View style={Styles.rowItemsCenter}>
<MenuItemRow
@@ -243,7 +255,6 @@ export default function Index() {
</View>
</View>
</DrawerBottom>
</SafeAreaView>
</View>
)
}

View File

@@ -6,14 +6,16 @@ import Styles from "@/constants/Styles";
import { apiCreateProjectTask } from "@/lib/api";
import { setUpdateProject } from "@/lib/projectUpdate";
import { useAuthSession } from "@/providers/AuthProvider";
import 'intl';
import 'intl/locale-data/jsonp/id';
import { useHeaderHeight } from '@react-navigation/elements';
import dayjs from "dayjs";
import { router, Stack, useLocalSearchParams } from "expo-router";
import 'intl';
import 'intl/locale-data/jsonp/id';
import { useEffect, useState } from "react";
import {
KeyboardAvoidingView,
Platform,
Pressable,
SafeAreaView,
ScrollView,
View
@@ -23,7 +25,6 @@ import DateTimePicker, {
DateType
} from "react-native-ui-datepicker";
import { useDispatch, useSelector } from "react-redux";
import { useHeaderHeight } from '@react-navigation/elements';
export default function ProjectAddTask() {
const headerHeight = useHeaderHeight();
@@ -162,6 +163,10 @@ export default function ProjectAddTask() {
{
(error.endDate || error.startDate) && <Text style={[Styles.textInformation, Styles.cError, Styles.mt05]}>Tanggal tidak boleh kosong</Text>
}
{/* TODO */}
<Pressable style={[Styles.btnTab, Styles.btnLainnya]}>
<Text style={[Styles.cWhite]}>Detail</Text>
</Pressable>
</View>
<InputForm
label="Judul Tugas"

View File

@@ -43,6 +43,8 @@ export default function EditProject() {
setJudul(val)
if (val == "" || val == "null") {
setError(true)
}else{
setError(false)
}
}

View File

@@ -1,7 +1,9 @@
import ButtonBackHeader from "@/components/buttonBackHeader";
import HeaderRightProjectDetail from "@/components/project/headerProjectDetail";
import SectionFile from "@/components/project/sectionFile";
import SectionLink from "@/components/project/sectionLink";
import SectionMember from "@/components/project/sectionMember";
import SectionReportProject from "@/components/project/sectionReportProject";
import SectionTanggalTugasProject from "@/components/project/sectionTanggalTugas";
import SectionCancel from "@/components/sectionCancel";
import SectionProgress from "@/components/sectionProgress";
@@ -111,8 +113,10 @@ export default function DetailProject() {
data?.reason != null && data?.reason != "" && <SectionCancel text={data?.reason} />
}
<SectionProgress text={`Kemajuan Kegiatan ${progress}%`} progress={progress} />
<SectionTanggalTugasProject status={data?.status} member={isMember} refreshing={refreshing}/>
<SectionReportProject refreshing={refreshing} />
<SectionTanggalTugasProject status={data?.status} member={isMember} refreshing={refreshing} />
<SectionFile status={data?.status} member={isMember} refreshing={refreshing} />
<SectionLink status={data?.status} member={isMember} refreshing={refreshing} />
<SectionMember status={data?.status} refreshing={refreshing} />
</View>
</ScrollView>

View File

@@ -0,0 +1,128 @@
import ButtonBackHeader from "@/components/buttonBackHeader";
import ButtonSaveHeader from "@/components/buttonSaveHeader";
import { InputForm } from "@/components/inputForm";
import Styles from "@/constants/Styles";
import { apiGetProjectOne, apiReportProject } from "@/lib/api";
import { setUpdateProject } from "@/lib/projectUpdate";
import { useAuthSession } from "@/providers/AuthProvider";
import { router, Stack, useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { SafeAreaView, ScrollView, View } from "react-native";
import Toast from "react-native-toast-message";
import { useDispatch, useSelector } from "react-redux";
export default function ReportProject() {
const { token, decryptToken } = useAuthSession();
const { id } = useLocalSearchParams<{ id: string }>();
const dispatch = useDispatch()
const update = useSelector((state: any) => state.projectUpdate)
const [laporan, setLaporan] = useState("");
const [error, setError] = useState(false);
const [disable, setDisable] = useState(false);
const [loading, setLoading] = useState(false)
async function handleLoad() {
try {
const hasil = await decryptToken(String(token?.current));
const response = await apiGetProjectOne({
user: hasil,
cat: "data",
id: id,
});
setLaporan(response.data.report);
} catch (error) {
console.error(error);
}
}
useEffect(() => {
handleLoad();
}, []);
function onValidation(val: string) {
setLaporan(val)
if (val == "" || val == "null") {
setError(true)
} else {
setError(false)
}
}
function checkAll() {
if (laporan == "" || laporan == "null" || laporan == null || laporan == undefined || error) {
setDisable(true)
} else {
setDisable(false)
}
}
useEffect(() => {
checkAll()
}, [laporan, error]);
async function handleUpdate() {
try {
setLoading(true)
const hasil = await decryptToken(String(token?.current));
const response = await apiReportProject({
report: laporan,
user: hasil,
}, id);
if (response.success) {
dispatch(setUpdateProject({ ...update, report: !update.report }))
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
router.back();
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
} finally {
setLoading(false)
}
}
return (
<SafeAreaView>
<Stack.Screen
options={{
headerLeft: () => (
<ButtonBackHeader
onPress={() => {
router.back();
}}
/>
),
headerTitle: "Laporan Kegiatan",
headerTitleAlign: "center",
headerRight: () => (
<ButtonSaveHeader
disable={disable || loading}
category="update"
onPress={() => { handleUpdate() }}
/>
),
}}
/>
<ScrollView>
<View style={[Styles.p15, Styles.mb100]}>
<InputForm
label="Laporan Kegiatan"
type="default"
placeholder="Laporan Kegiatan"
required
bg="white"
value={laporan}
onChange={(val) => { onValidation(val) }}
error={error}
errorText="Judul Kegiatan harus diisi"
multiline
/>
</View>
</ScrollView>
</SafeAreaView>
);
}

View File

@@ -4,6 +4,7 @@ import { InputForm } from "@/components/inputForm";
import Text from "@/components/Text";
import Styles from "@/constants/Styles";
import { setTaskCreate } from "@/lib/taskCreate";
import { useHeaderHeight } from '@react-navigation/elements';
import dayjs from "dayjs";
import { router, Stack } from "expo-router";
import 'intl';
@@ -20,7 +21,6 @@ import DateTimePicker, {
DateType
} from "react-native-ui-datepicker";
import { useDispatch, useSelector } from "react-redux";
import { useHeaderHeight } from '@react-navigation/elements';
export default function CreateProjectAddTask() {
const headerHeight = useHeaderHeight();

BIN
bun.lockb

Binary file not shown.

View File

@@ -44,7 +44,7 @@ export default function ViewLogin({ onValidate }: Props) {
return (
<SafeAreaView>
<ToastCustom />
<View style={Styles.p20}>
<View style={[Styles.p20, Styles.h100]}>
<View style={{ alignItems: "center", marginVertical: 50 }}>
<Image
source={require("../../assets/images/splash-icon.png")}

View File

@@ -35,7 +35,7 @@ export default function ViewVerification({ phone, otp }: Props) {
if (value === otpFix.toString()) {
login()
} else {
return Toast.show({ type: 'error', text1: 'Kode OTP tidak sesuai' });
return Toast.show({ type: 'small', text1: 'Kode OTP tidak sesuai' });
}
}

View File

@@ -31,7 +31,7 @@ export default function BorderBottomItem({ title, subtitle, icon, desc, onPress,
<View style={[Styles.rowItemsCenter]}>
{icon}
<View style={[Styles.rowSpaceBetween, width ? { width: lebar } : { width: '88%' }]}>
<View style={[Styles.ml10, rightTopInfo ? { width: lebar } : { width: '90%' },]}>
<View style={[Styles.ml10, rightTopInfo ? { width: '70%' } : { width: '90%' }]}>
<Text style={[titleWeight == 'normal' ? Styles.textDefault : Styles.textDefaultSemiBold, { color: textColorFix }]} numberOfLines={1} ellipsizeMode='tail'>{title}</Text>
{
subtitle &&

View File

@@ -2,12 +2,12 @@ import Styles from "@/constants/Styles";
import { apiGetDivisionOneFeature } from "@/lib/api";
import { useAuthSession } from "@/providers/AuthProvider";
import { Feather } from "@expo/vector-icons";
import { useLocalSearchParams } from "expo-router";
import { router, useLocalSearchParams } from "expo-router";
import React, { useEffect, useState } from "react";
import { Dimensions, View } from "react-native";
import Text from "../Text";
import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel";
import { Dimensions, Pressable, View } from "react-native";
import { ICarouselInstance } from "react-native-reanimated-carousel";
import Skeleton from "../skeleton";
import Text from "../Text";
type Props = {
id: string
@@ -46,34 +46,42 @@ export default function TaskDivisionDetail() {
return (
<View>
<Text style={[Styles.textDefaultSemiBold, Styles.mb05]}>Tugas Hari Ini</Text>
{
loading ?
<Skeleton width={100} widthType="percent" height={60} borderRadius={10} />
:
data.length > 0 ?
<Carousel
ref={ref}
style={{ width: "100%" }}
width={width * 0.8}
height={100}
data={data}
loop={true}
autoPlay={false}
autoPlayReverse={false}
pagingEnabled={true}
snapEnabled={true}
vertical={false}
renderItem={({ index }) => (
<View style={[Styles.wrapPaper, { width: '95%' }]}>
<Text style={[Styles.textDefaultSemiBold]} numberOfLines={1} ellipsizeMode="tail">{data[index].title} - {data[index].projectTitle}</Text>
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
<Feather name="clock" size={18} color="grey" style={Styles.mr05} />
<Text style={[Styles.textInformation]} numberOfLines={1} ellipsizeMode="tail">{data[index].dateStart} - {data[index].dateEnd}</Text>
</View>
data.map((item, index) => (
<Pressable key={index} style={[Styles.wrapPaper]} onPress={() => { router.push(`/division/${id}/task/${item.idProject}`) }}>
<Text style={[Styles.textDefaultSemiBold]} numberOfLines={1} ellipsizeMode="tail">{item.title} - {item.projectTitle}</Text>
<View style={[Styles.rowItemsCenter, Styles.mt10]}>
<Feather name="clock" size={18} color="grey" style={Styles.mr05} />
<Text style={[Styles.textInformation]} numberOfLines={1} ellipsizeMode="tail">{item.dateStart} - {item.dateEnd}</Text>
</View>
)}
/>
</Pressable>
))
// <Carousel
// ref={ref}
// style={{ width: "100%" }}
// width={width * 0.8}
// height={100}
// data={data}
// loop={true}
// autoPlay={false}
// autoPlayReverse={false}
// pagingEnabled={true}
// snapEnabled={true}
// vertical={false}
// renderItem={({ index }) => (
// <View style={[Styles.wrapPaper, { width: '95%' }]}>
// <Text style={[Styles.textDefaultSemiBold]} numberOfLines={1} ellipsizeMode="tail">{data[index].title} - {data[index].projectTitle}</Text>
// <View style={[Styles.rowItemsCenter, Styles.mt10]}>
// <Feather name="clock" size={18} color="grey" style={Styles.mr05} />
// <Text style={[Styles.textInformation]} numberOfLines={1} ellipsizeMode="tail">{data[index].dateStart} - {data[index].dateEnd}</Text>
// </View>
// </View>
// )}
// />
:
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada tugas</Text>
}

View File

@@ -8,7 +8,7 @@ type Props = {
setVisible: (value: boolean) => void
title?: string
children: React.ReactNode
onSubmit: () => void
onSubmit?: () => void
disableSubmit?: boolean
buttonHide?: boolean
}

View File

@@ -13,7 +13,9 @@ export default function ModalLoading({ isVisible, setVisible }: Props) {
animationOut={"slideOutDown"}
isVisible={isVisible}
hideModalContentWhileAnimating={true}
onBackdropPress={() => { setVisible(false) }}
onBackdropPress={() => {
// setVisible(false)
}}
>
<ActivityIndicator size="large" />
</Modal>

View File

@@ -1,8 +1,8 @@
import Styles from "@/constants/Styles"
import { apiDeleteProject } from "@/lib/api"
import { apiAddLinkProject, apiDeleteProject } from "@/lib/api"
import { setUpdateProject } from "@/lib/projectUpdate"
import { useAuthSession } from "@/providers/AuthProvider"
import { AntDesign, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
import { AntDesign, Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
import { router } from "expo-router"
import { useState } from "react"
import { View } from "react-native"
@@ -11,7 +11,9 @@ import { useDispatch, useSelector } from "react-redux"
import AlertKonfirmasi from "../alertKonfirmasi"
import ButtonMenuHeader from "../buttonMenuHeader"
import DrawerBottom from "../drawerBottom"
import { InputForm } from "../inputForm"
import MenuItemRow from "../menuItemRow"
import ModalFloat from "../modalFloat"
type Props = {
id: string | string[]
@@ -24,6 +26,8 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
const [isVisible, setVisible] = useState(false)
const dispatch = useDispatch()
const update = useSelector((state: any) => state.projectUpdate)
const [isAddLink, setAddLink] = useState(false)
const [link, setLink] = useState("")
async function handleDelete() {
try {
@@ -43,10 +47,27 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
}
}
async function handleAddLink() {
try {
const hasil = await decryptToken(String(token?.current))
const response = await apiAddLinkProject({ user: hasil, link }, String(id))
if (response.success) {
dispatch(setUpdateProject({ ...update, link: !update.link }))
Toast.show({ type: 'small', text1: 'Berhasil menambahkan link', })
} else {
Toast.show({ type: 'small', text1: 'Gagal menambahkan link', })
}
} catch (error) {
console.error(error)
} finally {
setAddLink(false)
}
}
return (
<>
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu" height={30}>
<View style={Styles.rowItemsCenter}>
<MenuItemRow
icon={<AntDesign name="pluscircle" color="black" size={25} />}
@@ -68,33 +89,59 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
}}
disabled={status == 3}
/>
<MenuItemRow
icon={<Feather name="link" color="black" size={25} />}
title="Tambah Link"
onPress={() => {
if (status == 3) return
setVisible(false)
setTimeout(() => {
setAddLink(true)
}, 600)
}}
disabled={status == 3}
/>
</View>
<View style={[Styles.rowItemsCenter, Styles.mt15]}>
<MenuItemRow
icon={<MaterialCommunityIcons name="file-document" color="black" size={25} />}
title="Laporan"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`/project/${id}/report`)
}}
disabled={status == 3}
/>
{
entityUser.role != "user" && entityUser.role != "coadmin" &&
<MenuItemRow
icon={<MaterialIcons name="groups" color="black" size={25} />}
title="Tambah Anggota"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`/project/${id}/add-member`)
}}
disabled={status == 3}
/>
<>
<MenuItemRow
icon={<MaterialIcons name="groups" color="black" size={25} />}
title="Tambah Anggota"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`/project/${id}/add-member`)
}}
disabled={status == 3}
/>
<MenuItemRow
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
title="Edit"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`/project/${id}/edit`)
}}
disabled={status == 3}
/>
</>
}
</View>
{
entityUser.role != "user" && entityUser.role != "coadmin" &&
<View style={[Styles.rowItemsCenter, Styles.mt15]}>
<MenuItemRow
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
title="Edit"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`/project/${id}/edit`)
}}
disabled={status == 3}
/>
{
status == 3
?
@@ -123,6 +170,23 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
</View>
}
</DrawerBottom>
<ModalFloat
title="Tambah Link"
isVisible={isAddLink}
setVisible={() => { setAddLink(false) }}
onSubmit={() => { handleAddLink() }}
disableSubmit={link == ""}
>
<View>
<InputForm
type="default"
placeholder="Masukkan link"
value={link}
onChange={(text) => { setLink(text) }}
/>
</View>
</ModalFloat>
</>
)
}

View File

@@ -0,0 +1,116 @@
import Styles from "@/constants/Styles";
import { apiGetProjectTask } from "@/lib/api";
import { useAuthSession } from "@/providers/AuthProvider";
import { useEffect, useState } from "react";
import { Dimensions, View, VirtualizedList } from "react-native";
import { InputDate } from "../inputDate";
import ModalFloat from "../modalFloat";
import Skeleton from "../skeleton";
import Text from "../Text";
interface Props {
id: string;
date: string;
timeStart: string;
timeEnd: string;
}
export default function ModalListDetailTugasProject({ isVisible, setVisible, idTask }: { isVisible: boolean, setVisible: (value: boolean) => void, idTask: string }) {
const [data, setData] = useState([])
const [loading, setLoading] = useState(false)
const { token, decryptToken } = useAuthSession()
const arrSkeleton = Array.from({ length: 3 }, (_, index) => index)
const tinggiScreen = Dimensions.get("window").height;
const tinggiFix = tinggiScreen * 70 / 100;
async function getData() {
try {
setLoading(true)
const hasil = await decryptToken(String(token?.current));
const res = await apiGetProjectTask({ user: hasil, id: idTask, cat: "detailTask" })
setData(res.data)
} catch (error) {
console.error(error)
} finally {
setLoading(false)
}
}
useEffect(() => {
if (isVisible) {
getData()
}
}, [isVisible, idTask])
const getItem = (_data: unknown, index: number): Props => ({
id: data[index].id,
date: data[index].date,
timeStart: data[index].timeStart,
timeEnd: data[index].timeEnd,
})
return (
<ModalFloat
title="Detail Tanggal dan Waktu Tugas"
isVisible={isVisible}
setVisible={setVisible}
buttonHide
>
<View style={[{ height: tinggiFix }]} >
{
loading ?
arrSkeleton.map((item: any, i: number) => {
return (
<Skeleton key={i} width={100} widthType="percent" height={40} borderRadius={5} />
)
})
:
data.length > 0 ?
(
<VirtualizedList
data={data}
getItemCount={() => data.length}
getItem={getItem}
renderItem={({ item, index }: { item: Props, index: number }) => {
return (
<View key={index} style={[Styles.borderBottom, Styles.pv05]}>
<Text style={[Styles.textDefaultSemiBold]}>{item.date}</Text>
<View style={[Styles.rowSpaceBetween]}>
<View style={[{ width: "48%" }]}>
<InputDate
mode="time"
disable
onChange={(val) => { }}
value={item.timeStart}
label="Waktu Awal"
placeholder="--:--"
/>
</View>
<View style={[{ width: "48%" }]}>
<InputDate
onChange={(val) => { }}
mode="time"
value={item.timeEnd}
label="Waktu Akhir"
placeholder="--:--"
disable
/>
</View>
</View>
</View>
)
}}
keyExtractor={(item, index) => String(index)}
showsVerticalScrollIndicator={false}
/>
)
:
<Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]} >Tidak ada data</Text>
}
</View>
</ModalFloat>
)
}

View File

@@ -90,12 +90,6 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
}
}
// async function download() {
// const destination = new Directory(Paths.document, 'pdfs');
// const filename = "dummy.pdf";
// const result = await File.downloadFileAsync('https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf', destination);
// }
const openFile = () => {
setModal(false)

View File

@@ -0,0 +1,140 @@
import Styles from "@/constants/Styles";
import { apiDeleteLinkProject, apiGetProjectOne } from "@/lib/api";
import { urlCompleted } from "@/lib/fun_urlCompleted";
import { setUpdateProject } from "@/lib/projectUpdate";
import { useAuthSession } from "@/providers/AuthProvider";
import { Feather, Ionicons } from "@expo/vector-icons";
import { useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { Linking, View } from "react-native";
import Toast from "react-native-toast-message";
import { useDispatch, useSelector } from "react-redux";
import AlertKonfirmasi from "../alertKonfirmasi";
import BorderBottomItem from "../borderBottomItem";
import DrawerBottom from "../drawerBottom";
import MenuItemRow from "../menuItemRow";
import Text from "../Text";
type Props = {
id: string
link: string
}
export default function SectionLink({ status, member, refreshing }: { status: number | undefined, member: boolean, refreshing?: boolean }) {
const entityUser = useSelector((state: any) => state.user)
const [isModal, setModal] = useState(false)
const { token, decryptToken } = useAuthSession();
const { id } = useLocalSearchParams<{ id: string }>();
const [data, setData] = useState<Props[]>([]);
const update = useSelector((state: any) => state.projectUpdate)
const dispatch = useDispatch()
const [selectLink, setSelectLink] = useState<Props | null>(null)
async function handleLoad() {
try {
const hasil = await decryptToken(String(token?.current));
const response = await apiGetProjectOne({
user: hasil,
cat: "link",
id: id,
});
setData(response.data);
} catch (error) {
console.error(error);
}
}
useEffect(() => {
handleLoad();
}, [update.link]);
useEffect(() => {
if (refreshing)
handleLoad();
}, [refreshing]);
async function handleDelete() {
try {
const hasil = await decryptToken(String(token?.current));
const response = await apiDeleteLinkProject({ user: hasil, idLink: String(selectLink?.id) }, String(id));
if (response.success) {
Toast.show({ type: 'small', text1: 'Berhasil menghapus link', })
dispatch(setUpdateProject({ ...update, link: !update.link }))
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
} finally {
setModal(false)
}
}
return (
<>
{
data.length > 0 &&
<>
<View style={[Styles.mb15]}>
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Link</Text>
<View style={[Styles.wrapPaper]}>
{
data.map((item, index) => {
return (
<BorderBottomItem
key={index}
borderType="all"
icon={<Feather name="link" size={25} color="black" />}
title={item.link}
titleWeight="normal"
onPress={() => { setSelectLink(item); setModal(true) }}
width={65}
/>
)
})
}
</View>
</View>
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
<View style={Styles.rowItemsCenter}>
<MenuItemRow
icon={<Feather name="external-link" color="black" size={25} />}
title="Buka Link"
onPress={() => {
Linking.openURL(urlCompleted(String(selectLink?.link)))
}}
/>
{
!member && (entityUser.role == "user" || entityUser.role == "coadmin") ? <></>
:
<MenuItemRow
icon={<Ionicons name="trash" color="black" size={25} />}
title="Hapus"
disabled={status == 3}
onPress={() => {
if (status == 3) return
setModal(false)
AlertKonfirmasi({
title: 'Konfirmasi',
desc: 'Apakah Anda yakin ingin menghapus link ini? Link yang dihapus tidak dapat dikembalikan',
onPress: () => {
handleDelete()
}
})
}}
/>
}
</View>
</DrawerBottom>
</>
}
</>
)
}

View File

@@ -0,0 +1,55 @@
import Styles from "@/constants/Styles";
import { apiGetProjectOne } from "@/lib/api";
import { useAuthSession } from "@/providers/AuthProvider";
import { useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { View } from "react-native";
import { useSelector } from "react-redux";
import Text from "../Text";
import TextExpandable from "../textExpandable";
export default function SectionReportProject({ refreshing }: { refreshing?: boolean }) {
const update = useSelector((state: any) => state.projectUpdate)
const { token, decryptToken } = useAuthSession();
const { id } = useLocalSearchParams<{ id: string }>();
const [data, setData] = useState("");
async function handleLoad() {
try {
const hasil = await decryptToken(String(token?.current));
const response = await apiGetProjectOne({
user: hasil,
cat: "data",
id: id,
});
setData(response.data.report);
} catch (error) {
console.error(error);
}
}
useEffect(() => {
handleLoad();
}, [update.report]);
useEffect(() => {
if (refreshing)
handleLoad();
}, [refreshing]);
return (
<>
{
data != "" && data != null &&
<View style={[Styles.mb15, Styles.mt10]}>
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>
Laporan Kegiatan
</Text>
<View style={[Styles.wrapPaper]}>
<TextExpandable content={data} maxLines={2} />
</View>
</View>
}
</>
);
}

View File

@@ -15,6 +15,7 @@ import MenuItemRow from "../menuItemRow";
import ModalSelect from "../modalSelect";
import SkeletonTask from "../skeletonTask";
import Text from "../Text";
import ModalListDetailTugasProject from "./modalListDetailTugasProject";
type Props = {
id: string;
@@ -33,6 +34,7 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
const [isModal, setModal] = useState(false);
const [isSelect, setSelect] = useState(false);
const { token, decryptToken } = useAuthSession();
const [modalDetail, setModalDetail] = useState(false)
const { id } = useLocalSearchParams<{ id: string }>();
const [data, setData] = useState<Props[]>([]);
const [loading, setLoading] = useState(true)
@@ -188,6 +190,24 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
}}
/>
<MenuItemRow
icon={
<MaterialCommunityIcons
name="clock-time-three-outline"
color="black"
size={25}
/>
}
title="Detail Waktu"
onPress={() => {
setModal(false);
setTimeout(() => {
setModalDetail(true)
}, 600)
}}
/>
</View>
<View style={[Styles.rowItemsCenter, Styles.mt15]}>
<MenuItemRow
icon={<Ionicons name="trash" color="black" size={25} />}
title="Hapus Tugas"
@@ -213,6 +233,12 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
open={isSelect}
valChoose={String(tugas.status)}
/>
<ModalListDetailTugasProject
isVisible={modalDetail}
setVisible={setModalDetail}
idTask={tugas.id}
/>
</>
);
}

View File

@@ -1,8 +1,8 @@
import Styles from "@/constants/Styles"
import { apiDeleteTask, apiGetDivisionOneFeature } from "@/lib/api"
import { apiAddLinkTask, apiDeleteTask, apiGetDivisionOneFeature } from "@/lib/api"
import { setUpdateTask } from "@/lib/taskUpdate"
import { useAuthSession } from "@/providers/AuthProvider"
import { AntDesign, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
import { AntDesign, Feather, Ionicons, MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
import { router } from "expo-router"
import { useEffect, useState } from "react"
import { View } from "react-native"
@@ -11,7 +11,9 @@ import { useDispatch, useSelector } from "react-redux"
import AlertKonfirmasi from "../alertKonfirmasi"
import ButtonMenuHeader from "../buttonMenuHeader"
import DrawerBottom from "../drawerBottom"
import { InputForm } from "../inputForm"
import MenuItemRow from "../menuItemRow"
import ModalFloat from "../modalFloat"
type Props = {
id: string | string[]
@@ -27,6 +29,8 @@ export default function HeaderRightTaskDetail({ id, division, status }: Props) {
const [isAdminDivision, setIsAdminDivision] = useState(false);
const dispatch = useDispatch()
const update = useSelector((state: any) => state.taskUpdate)
const [isAddLink, setAddLink] = useState(false)
const [link, setLink] = useState("")
async function handleCheckMember() {
try {
@@ -72,6 +76,23 @@ export default function HeaderRightTaskDetail({ id, division, status }: Props) {
}
}
async function handleAddLink() {
try {
const hasil = await decryptToken(String(token?.current))
const response = await apiAddLinkTask({ user: hasil, link, idDivision: division }, String(id))
if (response.success) {
dispatch(setUpdateTask({ ...update, link: !update.link }))
Toast.show({ type: 'small', text1: 'Berhasil menambahkan link', })
} else {
Toast.show({ type: 'small', text1: 'Gagal menambahkan link', })
}
} catch (error) {
console.error(error)
} finally {
setAddLink(false)
}
}
return (
<>
{
@@ -80,7 +101,7 @@ export default function HeaderRightTaskDetail({ id, division, status }: Props) {
:
<ButtonMenuHeader onPress={() => { setVisible(true) }} />
}
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
<DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu" height={30}>
<View style={Styles.rowItemsCenter}>
<MenuItemRow
icon={<AntDesign name="pluscircle" color="black" size={25} />}
@@ -102,38 +123,63 @@ export default function HeaderRightTaskDetail({ id, division, status }: Props) {
}}
disabled={status == 3}
/>
<MenuItemRow
icon={<Feather name="link" color="black" size={25} />}
title="Tambah Link"
onPress={() => {
if (status == 3) return
setVisible(false)
setTimeout(() => {
setAddLink(true)
}, 600)
}}
disabled={status == 3}
/>
</View>
<View style={[Styles.rowItemsCenter, Styles.mt15]}>
<MenuItemRow
icon={<MaterialCommunityIcons name="file-document" color="black" size={25} />}
title="Laporan"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`./${id}/report`)
}}
disabled={status == 3}
/>
{
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision)
&&
<MenuItemRow
icon={<MaterialIcons name="groups" color="black" size={25} />}
title="Tambah Anggota"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`./${id}/add-member`)
}}
disabled={status == 3}
/>
<>
<MenuItemRow
icon={<MaterialIcons name="groups" color="black" size={25} />}
title="Tambah Anggota"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`./${id}/add-member`)
}}
disabled={status == 3}
/>
<MenuItemRow
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
title="Edit"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`./${id}/edit`)
}}
disabled={status == 3}
/>
</>
}
</View>
{
((entityUser.role != "user" && entityUser.role != "coadmin") || isAdminDivision)
&&
<View style={[Styles.rowItemsCenter, Styles.mt15]}>
<MenuItemRow
icon={<MaterialCommunityIcons name="pencil-outline" color="black" size={25} />}
title="Edit"
onPress={() => {
if (status == 3) return
setVisible(false)
router.push(`./${id}/edit`)
}}
disabled={status == 3}
/>
{
status == 3
?
@@ -162,7 +208,24 @@ export default function HeaderRightTaskDetail({ id, division, status }: Props) {
}
</View>
}
</DrawerBottom>
</DrawerBottom >
<ModalFloat
title="Tambah Link"
isVisible={isAddLink}
setVisible={() => { setAddLink(false) }}
onSubmit={() => { handleAddLink() }}
disableSubmit={link == ""}
>
<View>
<InputForm
type="default"
placeholder="Masukkan link"
value={link}
onChange={(text) => { setLink(text) }}
/>
</View>
</ModalFloat>
</>
)
}

View File

@@ -0,0 +1,122 @@
import Styles from "@/constants/Styles";
import { apiDeleteLinkTask, apiGetTaskOne } from "@/lib/api";
import { urlCompleted } from "@/lib/fun_urlCompleted";
import { setUpdateTask } from "@/lib/taskUpdate";
import { useAuthSession } from "@/providers/AuthProvider";
import { Feather, Ionicons } from "@expo/vector-icons";
import { useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { Linking, View } from "react-native";
import Toast from "react-native-toast-message";
import { useDispatch, useSelector } from "react-redux";
import AlertKonfirmasi from "../alertKonfirmasi";
import BorderBottomItem from "../borderBottomItem";
import DrawerBottom from "../drawerBottom";
import MenuItemRow from "../menuItemRow";
import Text from "../Text";
type Props = {
id: string
link: string
}
export default function SectionLinkTask({ refreshing }: { refreshing: boolean }) {
const [isModal, setModal] = useState(false)
const { token, decryptToken } = useAuthSession()
const { detail } = useLocalSearchParams<{ detail: string }>()
const [data, setData] = useState<Props[]>([])
const update = useSelector((state: any) => state.taskUpdate)
const dispatch = useDispatch()
const [selectLink, setSelectLink] = useState<Props | null>(null)
async function handleLoad() {
try {
const hasil = await decryptToken(String(token?.current))
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: 'link' })
setData(response.data)
} catch (error) {
console.error(error)
}
}
useEffect(() => {
handleLoad()
}, [update.link])
useEffect(() => {
if (refreshing)
handleLoad();
}, [refreshing]);
async function handleDelete() {
try {
const hasil = await decryptToken(String(token?.current));
const response = await apiDeleteLinkTask({ user: hasil, idLink: String(selectLink?.id) }, String(detail));
if (response.success) {
Toast.show({ type: 'small', text1: 'Berhasil menghapus link', })
dispatch(setUpdateTask({ ...update, link: !update.link }))
} else {
Toast.show({ type: 'small', text1: response.message, })
}
} catch (error) {
console.error(error);
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
} finally {
setModal(false)
}
}
return (
<>
{
data.length > 0 &&
<>
<View style={[Styles.mb15]}>
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>Link</Text>
<View style={[Styles.wrapPaper]}>
{
data.map((item, index) => {
return (
<BorderBottomItem
key={index}
borderType="all"
icon={<Feather name="link" size={25} color="black" />}
title={item.link}
titleWeight="normal"
onPress={() => { setSelectLink(item); setModal(true) }}
width={65}
/>
)
})
}
</View>
</View>
<DrawerBottom animation="slide" isVisible={isModal} setVisible={setModal} title="Menu">
<View style={Styles.rowItemsCenter}>
<MenuItemRow
icon={<Feather name="external-link" color="black" size={25} />}
title="Buka Link"
onPress={() => {
Linking.openURL(urlCompleted(String(selectLink?.link)))
}}
/>
<MenuItemRow
icon={<Ionicons name="trash" color="black" size={25} />}
title="Hapus"
onPress={() => {
setModal(false)
AlertKonfirmasi({
title: 'Konfirmasi',
desc: 'Apakah Anda yakin ingin menghapus link ini? Link yang dihapus tidak dapat dikembalikan',
onPress: () => { handleDelete() }
})
}}
/>
</View>
</DrawerBottom>
</>
}
</>
)
}

View File

@@ -0,0 +1,53 @@
import Styles from "@/constants/Styles";
import { apiGetTaskOne } from "@/lib/api";
import { useAuthSession } from "@/providers/AuthProvider";
import { useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
import { View } from "react-native";
import { useSelector } from "react-redux";
import Text from "../Text";
import TextExpandable from "../textExpandable";
export default function SectionReportTask({ refreshing }: { refreshing: boolean }) {
const update = useSelector((state: any) => state.taskUpdate)
const { token, decryptToken } = useAuthSession()
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>();
const [data, setData] = useState('')
async function handleLoad() {
try {
const hasil = await decryptToken(String(token?.current))
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: 'data' })
setData(response.data.report)
} catch (error) {
console.error(error)
}
}
useEffect(() => {
handleLoad()
}, [update.report])
useEffect(() => {
if (refreshing)
handleLoad();
}, [refreshing]);
return (
<>
{
data != "" && data != null &&
<View style={[Styles.mb15, Styles.mt10]}>
<Text style={[Styles.textDefaultSemiBold, Styles.mv05]}>
Laporan Kegiatan
</Text>
<View style={[Styles.wrapPaper]}>
<TextExpandable content={data} maxLines={2} />
</View>
</View>
}
</>
)
}

View File

@@ -0,0 +1,83 @@
import Styles from "@/constants/Styles";
import { useRef, useState, useEffect } from "react";
import { Animated, Pressable, View } from "react-native";
import Text from "./Text";
export default function TextExpandable({ content, maxLines }: { content: string, maxLines: number }) {
const [isExpanded, setIsExpanded] = useState(false);
const [shouldShowMore, setShouldShowMore] = useState(false);
const [collapsedHeight, setCollapsedHeight] = useState(0);
const [fullHeight, setFullHeight] = useState(0);
const animatedHeight = useRef(new Animated.Value(0)).current;
const measureCollapsed = (e: any) => {
if (collapsedHeight === 0) {
setCollapsedHeight(e.nativeEvent.layout.height);
animatedHeight.setValue(e.nativeEvent.layout.height);
}
};
const measureFull = (e: any) => {
if (fullHeight === 0) {
setFullHeight(e.nativeEvent.layout.height);
}
};
// Cek apakah memang perlu "View More"
useEffect(() => {
if (collapsedHeight > 0 && fullHeight > 0) {
setShouldShowMore(fullHeight > collapsedHeight + 1); // +1 untuk toleransi float
}
}, [collapsedHeight, fullHeight]);
const toggleExpand = () => {
Animated.timing(animatedHeight, {
toValue: isExpanded ? collapsedHeight : fullHeight,
duration: 300,
useNativeDriver: false,
}).start();
setIsExpanded(!isExpanded);
};
return (
<View>
{/* Hidden full text for measurement */}
<View style={Styles.hidden}>
<Text style={Styles.textDefault} onLayout={measureFull}>
{content}
</Text>
</View>
{/* Collapsed text for measurement */}
<View style={Styles.hidden}>
<Text
numberOfLines={maxLines}
style={Styles.textDefault}
onLayout={measureCollapsed}
ellipsizeMode="tail"
>
{content}
</Text>
</View>
{/* Animated visible text */}
<Animated.View style={{ height: animatedHeight, overflow: 'hidden' }}>
<Text
style={Styles.textDefault}
numberOfLines={isExpanded ? undefined : maxLines}
ellipsizeMode="tail"
>
{content}
</Text>
</Animated.View>
{shouldShowMore && (
<Pressable onPress={toggleExpand}>
<Text style={Styles.textLink}>
{isExpanded ? 'View Less' : 'View More'}
</Text>
</Pressable>
)}
</View>
);
};

View File

@@ -1,8 +1,3 @@
/**
* Below are the colors that are used in the app. The colors are defined in the light and dark mode.
* There are many other ways to style your app. For example, [Nativewind](https://www.nativewind.dev/), [Tamagui](https://tamagui.dev/), [unistyles](https://reactnativeunistyles.vercel.app), etc.
*/
const tintColorLight = '#19345E';
const tintColorDark = '#fff';

5
constants/ConstEnv.ts Normal file
View File

@@ -0,0 +1,5 @@
import Constants from 'expo-constants';
export const ConstEnv = {
url_storage : Constants?.expoConfig?.extra?.URL_STORAGE
}

View File

@@ -45,8 +45,7 @@ const Styles = StyleSheet.create({
fontWeight: 'bold',
},
textLink: {
lineHeight: 30,
fontSize: 16,
fontSize: 14,
color: '#0a7ea4',
},
textInformation: {
@@ -270,6 +269,12 @@ const Styles = StyleSheet.create({
flexDirection: 'row',
justifyContent: 'center'
},
btnLainnya: {
alignSelf: 'flex-start',
backgroundColor: '#19345E',
paddingVertical: 5,
marginVertical: 5
},
btnMenuRow: {
width: '33%',
alignItems: 'center'
@@ -593,6 +598,11 @@ const Styles = StyleSheet.create({
bottom: 5,
right: 5,
position: 'absolute'
},
hidden: {
position: 'absolute',
opacity: 0,
zIndex: -1,
}
})

View File

@@ -409,6 +409,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = mobiledarmasaba/mobiledarmasaba.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 5W96P6CVXB;
INFOPLIST_FILE = mobiledarmasaba/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (

View File

@@ -1,9 +1,11 @@
import axios from 'axios';
import Constants from 'expo-constants';
const api = axios.create({
// baseURL: 'http://10.0.2.2:3000/api',
// baseURL: 'https://stg-darmasaba.wibudev.com/api',
baseURL: 'http://192.168.1.89:3000/api',
// baseURL: 'http://192.168.154.198:3000/api',
baseURL: Constants?.expoConfig?.extra?.URL_API
});
export const apiCheckPhoneLogin = async (body: { phone: string }) => {
@@ -12,7 +14,7 @@ export const apiCheckPhoneLogin = async (body: { phone: string }) => {
}
export const apiSendOtp = async (body: { phone: string, otp: number }) => {
const res = await axios.get(`https://wa.wibudev.com/code?nom=${body.phone}&text=*DARMASABA*%0A%0A
const res = await axios.get(`${Constants.expoConfig?.extra?.URL_OTP}/code?nom=${body.phone}&text=*DARMASABA*%0A%0A
JANGAN BERIKAN KODE RAHASIA ini kepada siapa pun TERMASUK PIHAK DARMASABA. Masukkan otentikasi: *${encodeURIComponent(body.otp)}*`)
return res.status
}
@@ -150,7 +152,7 @@ export const apiGetUser = async ({ user, active, search, group, page }: { user:
};
export const apiCreateUser = async ({data}: {data: FormData}) => {
export const apiCreateUser = async ({ data }: { data: FormData }) => {
const response = await api.post('/mobile/user', data, {
headers: {
'Content-Type': 'multipart/form-data',
@@ -264,7 +266,7 @@ export const apiGetProject = async ({ user, status, search, group, kategori, pag
return response.data;
};
export const apiGetProjectOne = async ({ user, cat, id }: { user: string, cat: 'data' | 'progress' | 'task' | 'file' | 'member', id: string }) => {
export const apiGetProjectOne = async ({ user, cat, id }: { user: string, cat: 'data' | 'progress' | 'task' | 'file' | 'member' | 'link', id: string }) => {
const response = await api.get(`mobile/project/${id}?user=${user}&cat=${cat}`);
return response.data;
};
@@ -274,6 +276,11 @@ export const apiEditProject = async (data: { name: string, user: string }, id: s
return response.data;
};
export const apiReportProject = async (data: { report: string, user: string }, id: string) => {
const response = await api.put(`/mobile/project/${id}/lainnya`, data)
return response.data;
};
export const apiCreateProjectTask = async ({ data, id }: { data: { name: string, dateStart: string, user: string, dateEnd: string }, id: string }) => {
const response = await api.post(`/mobile/project/${id}`, data)
return response.data;
@@ -294,8 +301,8 @@ export const apiDeleteProjectTask = async (data: { user: string, idProject: stri
return response.data
};
export const apiGetProjectTask = async ({ user, id }: { user: string, id: string }) => {
const response = await api.get(`mobile/project/detail/${id}?user=${user}`);
export const apiGetProjectTask = async ({ user, id, cat }: { user: string, id: string, cat?: string }) => {
const response = await api.get(`mobile/project/detail/${id}?user=${user}${cat ? `&cat=${cat}` : ""}`);
return response.data;
};
@@ -329,6 +336,11 @@ export const apiDeleteProject = async (data: { user: string }, id: string) => {
return response.data;
};
export const apiAddLinkProject = async (data: { user: string, link: string }, id: string) => {
const response = await api.post(`/mobile/project/${id}/link`, data)
return response.data;
};
export const apiAddFileProject = async ({ data, id }: { data: FormData, id: string }) => {
const response = await api.post(`/mobile/project/file/${id}`, data,
{
@@ -356,6 +368,11 @@ export const apiDeleteFileProject = async (data: { user: string }, id: string) =
return response.data;
};
export const apiDeleteLinkProject = async (data: { idLink: string, user: string }, id: string) => {
const response = await api.delete(`/mobile/project/${id}/link`, { data })
return response.data;
};
export const apiGetDivision = async ({ user, search, group, kategori, active, page }: { user: string, search: string, group?: string, kategori?: string, active?: string, page?: number }) => {
const response = await api.get(`mobile/division?user=${user}&active=${active}&group=${group}&search=${search}&cat=${kategori}&page=${page}`);
return response.data;
@@ -502,7 +519,7 @@ export const apiGetTask = async ({ user, status, search, division, page }: { use
return response.data;
};
export const apiGetTaskOne = async ({ user, cat, id }: { user: string, cat: 'data' | 'progress' | 'task' | 'file' | 'member', id: string }) => {
export const apiGetTaskOne = async ({ user, cat, id }: { user: string, cat: 'data' | 'progress' | 'task' | 'file' | 'member' | 'link', id: string }) => {
const response = await api.get(`mobile/task/${id}?user=${user}&cat=${cat}`);
return response.data;
};
@@ -532,6 +549,11 @@ export const apiDeleteFileTask = async (data: { user: string }, id: string) => {
return response.data;
};
export const apiDeleteLinkTask = async (data: { user: string, idLink: string }, id: string) => {
const response = await api.delete(`/mobile/task/${id}/link`, { data })
return response.data;
};
export const apiDeleteTaskMember = async (data: { user: string, idUser: string }, id: string) => {
const response = await api.delete(`mobile/task/${id}/member`, { data })
return response.data
@@ -569,6 +591,11 @@ export const apiEditTask = async (data: { title: string, user: string }, id: str
return response.data;
};
export const apiReportTask = async (data: { report: string, user: string }, id: string) => {
const response = await api.put(`/mobile/task/${id}/lainnya`, data)
return response.data;
};
export const apiCancelTask = async (data: { user: string, reason: string }, id: string) => {
const response = await api.delete(`mobile/task/${id}`, { data })
return response.data
@@ -593,6 +620,11 @@ export const apiDeleteTask = async (data: { user: string }, id: string) => {
return response.data;
};
export const apiAddLinkTask = async (data: { user: string, link: string, idDivision: string }, id: string) => {
const response = await api.post(`/mobile/task/${id}/link`, data)
return response.data;
};
export const apiGetDocument = async ({ user, path, division, category }: { user: string, path: string, division: string, category: 'all' | 'folder' }) => {
const response = await api.get(`mobile/document?user=${user}&path=${path}&division=${division}&category=${category}`);
return response.data;

4
lib/fun_urlCompleted.ts Normal file
View File

@@ -0,0 +1,4 @@
export function urlCompleted(url: string) {
if (url.startsWith('http://') || url.startsWith('https://')) return url
return 'https://' + url
}

View File

@@ -7,7 +7,9 @@ const projectUpdate = createSlice({
progress: false,
task: false,
file: false,
member: false
member: false,
link: false,
report: false,
},
reducers: {
setUpdateProject: (state, action) => {

View File

@@ -7,7 +7,9 @@ const taskUpdate = createSlice({
progress: false,
task: false,
file: false,
member: false
member: false,
link: false,
report: false,
},
reducers: {
setUpdateTask: (state, action) => {

View File

@@ -32,6 +32,7 @@
"crypto-es": "^2.1.0",
"crypto-js": "^3.1.9-1",
"dayjs": "^1.11.13",
"dotenv": "^17.2.1",
"expo": "^53.0.9",
"expo-blur": "~14.1.4",
"expo-clipboard": "^7.1.4",