fix : tampilan
deskripsi: - detail divisi > on klik pda file - update project dan tugas divisi tidak perlu loading judul project - tampilan notifikasi top right info No Issues
This commit is contained in:
@@ -104,7 +104,7 @@ export default function AddMemberTask() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
<InputSearch onChange={(val) => setSearch(val)} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -142,10 +142,10 @@ export default function AddMemberTask() {
|
|||||||
!found && onChoose(item.idUser, item.name, item.img)
|
!found && onChoose(item.idUser, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter, Styles.w80]}>
|
||||||
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]}>{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, Styles.cGray]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,14 +31,16 @@ export default function DetailTaskDivision() {
|
|||||||
const update = useSelector((state: any) => state.taskUpdate)
|
const update = useSelector((state: any) => state.taskUpdate)
|
||||||
|
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad(cat: 'data' | 'progress') {
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
if (cat == 'data') setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: 'data' })
|
const response = await apiGetTaskOne({ id: detail, user: hasil, cat: cat })
|
||||||
setData(response.data)
|
if (cat == 'data') {
|
||||||
const responseProgress = await apiGetTaskOne({ id: detail, user: hasil, cat: 'progress' })
|
setData(response.data)
|
||||||
setProgress(responseProgress.data.progress)
|
} else {
|
||||||
|
setProgress(response.data.progress)
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -47,8 +49,12 @@ export default function DetailTaskDivision() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleLoad()
|
handleLoad('data')
|
||||||
}, [update.progress, update.data])
|
}, [update.data])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleLoad('progress')
|
||||||
|
}, [update.progress])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
@@ -57,7 +63,7 @@ export default function DetailTaskDivision() {
|
|||||||
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||||
headerTitle: loading ? 'Loading... ' : data?.title,
|
headerTitle: loading ? 'Loading... ' : data?.title,
|
||||||
headerTitleAlign: 'center',
|
headerTitleAlign: 'center',
|
||||||
headerRight: () => <HeaderRightTaskDetail id={detail} division={id} status={data?.status}/>,
|
headerRight: () => <HeaderRightTaskDetail id={detail} division={id} status={data?.status} />,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ export default function Notification() {
|
|||||||
return (
|
return (
|
||||||
<BorderBottomItem
|
<BorderBottomItem
|
||||||
borderType="bottom"
|
borderType="bottom"
|
||||||
|
width={55}
|
||||||
icon={
|
icon={
|
||||||
<View style={[Styles.iconContent, item.isRead ? ColorsStatus.secondary : ColorsStatus.primary]}>
|
<View style={[Styles.iconContent, item.isRead ? ColorsStatus.secondary : ColorsStatus.primary]}>
|
||||||
<Feather name="bell" size={25} color="white" />
|
<Feather name="bell" size={25} color="white" />
|
||||||
|
|||||||
@@ -102,9 +102,8 @@ export default function AddMemberProject() {
|
|||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<View style={[Styles.p15]}>
|
<View style={[Styles.p15, Styles.mb100]}>
|
||||||
<InputSearch onChange={(val) => handleSearch(val)} value={search} />
|
<InputSearch onChange={(val) => handleSearch(val)} value={search} />
|
||||||
|
|
||||||
{
|
{
|
||||||
selectMember.length > 0
|
selectMember.length > 0
|
||||||
?
|
?
|
||||||
@@ -115,7 +114,7 @@ export default function AddMemberProject() {
|
|||||||
<ImageWithLabel
|
<ImageWithLabel
|
||||||
key={index}
|
key={index}
|
||||||
label={item.name}
|
label={item.name}
|
||||||
src={item.img}
|
src={`https://wibu-storage.wibudev.com/api/files/${item.img}`}
|
||||||
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
onClick={() => onChoose(item.idUser, item.name, item.img)}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
@@ -127,7 +126,6 @@ export default function AddMemberProject() {
|
|||||||
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
<Text style={[Styles.textDefault, Styles.cGray, Styles.pv05, { textAlign: 'center' }]}>Tidak ada member yang dipilih</Text>
|
||||||
}
|
}
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
|
|
||||||
{
|
{
|
||||||
data.length > 0 ?
|
data.length > 0 ?
|
||||||
data.map((item: any, index: any) => {
|
data.map((item: any, index: any) => {
|
||||||
@@ -140,10 +138,10 @@ export default function AddMemberProject() {
|
|||||||
!found && onChoose(item.id, item.name, item.img)
|
!found && onChoose(item.id, item.name, item.img)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter, Styles.w80]}>
|
||||||
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
<ImageUser src={`https://wibu-storage.wibudev.com/api/files/${item.img}`} border />
|
||||||
<View style={[Styles.ml10]}>
|
<View style={[Styles.ml10]}>
|
||||||
<Text style={[Styles.textDefault]}>{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, Styles.cGray]}>sudah menjadi anggota</Text>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,14 +38,16 @@ export default function DetailProject() {
|
|||||||
const [isMember, setIsMember] = useState(false)
|
const [isMember, setIsMember] = useState(false)
|
||||||
const entityUser = useSelector((state: any) => state.user)
|
const entityUser = useSelector((state: any) => state.user)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad(cat: 'data' | 'progress') {
|
||||||
try {
|
try {
|
||||||
setLoading(true)
|
if (cat == 'data') setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiGetProjectOne({ user: hasil, cat: 'data', id: id })
|
const response = await apiGetProjectOne({ user: hasil, cat: cat, id: id })
|
||||||
setData(response.data)
|
if (cat == 'data') {
|
||||||
const responseProgress = await apiGetProjectOne({ user: hasil, cat: 'progress', id: id })
|
setData(response.data)
|
||||||
setProgress(responseProgress.data.progress)
|
} else {
|
||||||
|
setProgress(response.data.progress)
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -65,8 +67,12 @@ export default function DetailProject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleLoad()
|
handleLoad('data')
|
||||||
}, [update.data, update.progress])
|
}, [update.data])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleLoad('progress')
|
||||||
|
}, [update.progress])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
checkMember()
|
checkMember()
|
||||||
|
|||||||
@@ -2,11 +2,16 @@ import Styles from "@/constants/Styles";
|
|||||||
import { apiGetDivisionOneFeature } from "@/lib/api";
|
import { apiGetDivisionOneFeature } from "@/lib/api";
|
||||||
import { useAuthSession } from "@/providers/AuthProvider";
|
import { useAuthSession } from "@/providers/AuthProvider";
|
||||||
import { Feather } from "@expo/vector-icons";
|
import { Feather } from "@expo/vector-icons";
|
||||||
|
import * as FileSystem from 'expo-file-system';
|
||||||
|
import { startActivityAsync } from 'expo-intent-launcher';
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
|
import * as Sharing from 'expo-sharing';
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Dimensions, Text, View } from "react-native";
|
import { Alert, Dimensions, Platform, Pressable, Text, View } from "react-native";
|
||||||
|
import * as mime from 'react-native-mime-types';
|
||||||
import { ICarouselInstance } from "react-native-reanimated-carousel";
|
import { ICarouselInstance } from "react-native-reanimated-carousel";
|
||||||
import Skeleton from "../skeleton";
|
import Skeleton from "../skeleton";
|
||||||
|
import ModalLoading from "../modalLoading";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
id: string
|
id: string
|
||||||
@@ -14,6 +19,7 @@ type Props = {
|
|||||||
extension: string
|
extension: string
|
||||||
path: string
|
path: string
|
||||||
share: boolean
|
share: boolean
|
||||||
|
idStorage: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FileDivisionDetail() {
|
export default function FileDivisionDetail() {
|
||||||
@@ -23,6 +29,7 @@ export default function FileDivisionDetail() {
|
|||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string }>()
|
const { id } = useLocalSearchParams<{ id: string }>()
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [loadingOpen, setLoadingOpen] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -41,8 +48,45 @@ export default function FileDivisionDetail() {
|
|||||||
handleLoad()
|
handleLoad()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
||||||
|
const openFile = (item: Props) => {
|
||||||
|
setLoadingOpen(true)
|
||||||
|
let remoteUrl = 'https://wibu-storage.wibudev.com/api/files/' + item.idStorage;
|
||||||
|
const fileName = item.name + '.' + item.extension;
|
||||||
|
let localPath = `${FileSystem.documentDirectory}/${fileName}`;
|
||||||
|
const mimeType = mime.lookup(fileName)
|
||||||
|
|
||||||
|
FileSystem.downloadAsync(remoteUrl, localPath).then(async ({ uri }) => {
|
||||||
|
const contentURL = await FileSystem.getContentUriAsync(uri);
|
||||||
|
try {
|
||||||
|
if (Platform.OS == 'android') {
|
||||||
|
// open with android intent
|
||||||
|
await startActivityAsync(
|
||||||
|
'android.intent.action.VIEW',
|
||||||
|
{
|
||||||
|
data: contentURL,
|
||||||
|
flags: 1,
|
||||||
|
type: mimeType as string,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// or
|
||||||
|
// Sharing.shareAsync(localPath);
|
||||||
|
|
||||||
|
} else if (Platform.OS == 'ios') {
|
||||||
|
Sharing.shareAsync(localPath);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Alert.alert('INFO', 'Gagal membuka file, tidak ada aplikasi yang dapat membuka file ini');
|
||||||
|
} finally {
|
||||||
|
setLoadingOpen(false)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[Styles.mb15]}>
|
<View style={[Styles.mb15]}>
|
||||||
|
<ModalLoading isVisible={loadingOpen} setVisible={setLoadingOpen} />
|
||||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Dokumen Terkini</Text>
|
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Dokumen Terkini</Text>
|
||||||
{
|
{
|
||||||
loading ?
|
loading ?
|
||||||
@@ -56,7 +100,7 @@ export default function FileDivisionDetail() {
|
|||||||
<View style={[Styles.rowItemsCenter]}>
|
<View style={[Styles.rowItemsCenter]}>
|
||||||
{
|
{
|
||||||
data.map((item, index) => (
|
data.map((item, index) => (
|
||||||
<View style={[Styles.mr05, { width: '24%' }]} key={index}>
|
<Pressable style={[Styles.mr05, { width: '24%' }]} key={index} onPress={() => openFile(item)}>
|
||||||
<View style={{ alignItems: 'center' }}>
|
<View style={{ alignItems: 'center' }}>
|
||||||
<View style={[Styles.wrapPaper, { alignItems: 'center' }]}>
|
<View style={[Styles.wrapPaper, { alignItems: 'center' }]}>
|
||||||
<Feather name="file-text" size={50} color="black" style={Styles.mr05} />
|
<Feather name="file-text" size={50} color="black" style={Styles.mr05} />
|
||||||
@@ -65,7 +109,7 @@ export default function FileDivisionDetail() {
|
|||||||
<View style={[Styles.contentItemCenter]}>
|
<View style={[Styles.contentItemCenter]}>
|
||||||
<Text style={[Styles.textMediumNormal, Styles.w90, { textAlign: 'center' }]} numberOfLines={1}>{item.name}.{item.extension}</Text>
|
<Text style={[Styles.textMediumNormal, Styles.w90, { textAlign: 'center' }]} numberOfLines={1}>{item.name}.{item.extension}</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</Pressable>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user