upd: home
Deskripsi: - integrasi api kegiatan terupdate - integrasi api divisi teraktif - integrasi api progres kegiatan - integrasi api jumlah dokumen - integrasi api event hari ini - integrasi api diskusi No Issues
This commit is contained in:
@@ -2,14 +2,22 @@ import ButtonBackHeader from "@/components/buttonBackHeader";
|
||||
import ButtonSaveHeader from "@/components/buttonSaveHeader";
|
||||
import { InputForm } from "@/components/inputForm";
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiCreateBanner } from "@/lib/api";
|
||||
import { addEntity } from "@/lib/bannerSlice";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { Entypo } from "@expo/vector-icons";
|
||||
import * as ImagePicker from 'expo-image-picker';
|
||||
import { router, Stack } from "expo-router";
|
||||
import { useState } from "react";
|
||||
import { Image, Pressable, SafeAreaView, ScrollView, Text, View } from "react-native";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
||||
export default function CreateBanner() {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const dispatch = useDispatch()
|
||||
const [selectedImage, setSelectedImage] = useState<string | undefined>(undefined)
|
||||
const [imgForm, setImgForm] = useState<any>()
|
||||
const [title, setTitle] = useState('')
|
||||
|
||||
const pickImageAsync = async () => {
|
||||
let result = await ImagePicker.launchImageLibraryAsync({
|
||||
@@ -20,11 +28,31 @@ export default function CreateBanner() {
|
||||
|
||||
if (!result.canceled) {
|
||||
setSelectedImage(result.assets[0].uri);
|
||||
setImgForm(result.assets[0])
|
||||
} else {
|
||||
alert('Tidak ada gambar yang dipilih');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const handleCreateEntity = async () => {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const fd = new FormData()
|
||||
fd.append("file", JSON.stringify({
|
||||
uri: imgForm.uri,
|
||||
type: 'image/jpeg', // or response.assets[0].type
|
||||
name: imgForm.fileName,
|
||||
}))
|
||||
fd.append("data", JSON.stringify(
|
||||
{
|
||||
title: title,
|
||||
user: hasil
|
||||
}
|
||||
))
|
||||
const createdEntity = await apiCreateBanner(fd);
|
||||
dispatch(addEntity(createdEntity));
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<Stack.Screen
|
||||
@@ -32,7 +60,7 @@ export default function CreateBanner() {
|
||||
headerLeft: () => <ButtonBackHeader onPress={() => { router.back() }} />,
|
||||
headerTitle: 'Tambah Banner',
|
||||
headerTitleAlign: 'center',
|
||||
headerRight: () => <ButtonSaveHeader category="create" />
|
||||
headerRight: () => <ButtonSaveHeader category="create" onPress={() => { handleCreateEntity() }} />
|
||||
}}
|
||||
/>
|
||||
<ScrollView>
|
||||
@@ -47,25 +75,13 @@ export default function CreateBanner() {
|
||||
<Pressable onPress={pickImageAsync} style={[Styles.wrapPaper, Styles.contentItemCenter]}>
|
||||
<View style={{ justifyContent: 'center', alignItems: 'center' }}>
|
||||
<Entypo name="image" size={50} color={'#aeaeae'} />
|
||||
<Text style={[Styles.textInformation, Styles.mt05]}>Mohon unggah gambar dalam resolusi 1535 x 450 piksel untuk memastikan</Text>
|
||||
<Text style={[Styles.textInformation, Styles.mt05]}>Mohon unggah gambar dalam resolusi 1535 x 450 pixel untuk memastikan</Text>
|
||||
</View>
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
</View>
|
||||
<InputForm label="Judul" type="numeric" placeholder="Judul" required bg="white" />
|
||||
{/* <ButtonForm
|
||||
text="SIMPAN"
|
||||
onPress={() => {
|
||||
AlertKonfirmasi({
|
||||
title: 'Konfirmasi',
|
||||
desc: 'Apakah anda yakin ingin menambahkan data?',
|
||||
onPress: () => {
|
||||
ToastAndroid.show('Berhasil menambahkan data', ToastAndroid.SHORT)
|
||||
router.push('/banner')
|
||||
}
|
||||
})
|
||||
}} /> */}
|
||||
<InputForm label="Judul" type="default" placeholder="Judul" required bg="white" onChange={setTitle} />
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
|
||||
@@ -9,9 +9,13 @@ import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"
|
||||
import { router, Stack } from "expo-router"
|
||||
import { useState } from "react"
|
||||
import { Image, SafeAreaView, ScrollView, ToastAndroid, View } from "react-native"
|
||||
import { useSelector } from "react-redux"
|
||||
|
||||
export default function BannerList() {
|
||||
const [isModal, setModal] = useState(false)
|
||||
const entities = useSelector((state: any) => state.banner)
|
||||
const [dataId, setDataId] = useState('')
|
||||
const [dataStorage, setDataStorage] = useState('')
|
||||
|
||||
return (
|
||||
<SafeAreaView>
|
||||
@@ -26,39 +30,24 @@ export default function BannerList() {
|
||||
|
||||
<ScrollView>
|
||||
<View style={[Styles.p15, Styles.mb100]}>
|
||||
<BorderBottomItem
|
||||
onPress={() => { setModal(true) }}
|
||||
borderType="all"
|
||||
icon={
|
||||
<Image
|
||||
source={require("../../../assets/images/bg.png")}
|
||||
style={[Styles.imgListBanner]}
|
||||
/>
|
||||
}
|
||||
title="Banner 1"
|
||||
/>
|
||||
<BorderBottomItem
|
||||
onPress={() => { setModal(true) }}
|
||||
borderType="all"
|
||||
icon={
|
||||
<Image
|
||||
source={require("../../../assets/images/bg.png")}
|
||||
style={[Styles.imgListBanner]}
|
||||
/>
|
||||
}
|
||||
title="Banner 2"
|
||||
/>
|
||||
<BorderBottomItem
|
||||
onPress={() => { setModal(true) }}
|
||||
borderType="all"
|
||||
icon={
|
||||
<Image
|
||||
source={require("../../../assets/images/bg.png")}
|
||||
style={[Styles.imgListBanner]}
|
||||
/>
|
||||
}
|
||||
title="Banner 3"
|
||||
/>
|
||||
{entities.map((index: any, key: number) => (
|
||||
<BorderBottomItem
|
||||
key={key}
|
||||
onPress={() => {
|
||||
setDataId(index.id)
|
||||
setDataStorage(index.image)
|
||||
setModal(true)
|
||||
}}
|
||||
borderType="all"
|
||||
icon={
|
||||
<Image
|
||||
source={{ uri: `https://wibu-storage.wibudev.com/api/files/${index.image}` }}
|
||||
style={[Styles.imgListBanner]}
|
||||
/>
|
||||
}
|
||||
title={index.title}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
</ScrollView>
|
||||
|
||||
@@ -69,7 +58,7 @@ export default function BannerList() {
|
||||
title="Edit"
|
||||
onPress={() => {
|
||||
setModal(false)
|
||||
router.push('/banner/784')
|
||||
router.push(`/banner/${dataId}`)
|
||||
}}
|
||||
/>
|
||||
<MenuItemRow
|
||||
|
||||
@@ -1,14 +1,49 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Dimensions, Text, View } from "react-native";
|
||||
import { BarChart } from "react-native-gifted-charts";
|
||||
|
||||
type Props = {
|
||||
value: number;
|
||||
label: string;
|
||||
frontColor: string;
|
||||
}[]
|
||||
|
||||
export default function ChartDokumenHome() {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const [data, setData] = useState<Props>([])
|
||||
const [maxValue, setMaxValue] = useState(5)
|
||||
const barData = [
|
||||
{ value: 23, label: 'Gambar', frontColor: '#fac858' },
|
||||
{ value: 12, label: 'Dokumen', frontColor: '#92cc76' },
|
||||
];
|
||||
const width = Dimensions.get("window").width;
|
||||
|
||||
|
||||
async function handleData() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "dokumen", user: hasil })
|
||||
const maxValue = response.data.reduce((max: number, obj: { value: number; }) => Math.max(max, obj.value), -Infinity);
|
||||
const roundUp = Math.ceil(maxValue / 10) * 10
|
||||
setMaxValue(roundUp)
|
||||
const convertedArray = response.data.map((item: { color: any; label: any; value: any; }) => ({
|
||||
frontColor: item.color,
|
||||
label: item.label,
|
||||
value: Number(item.value)
|
||||
}));
|
||||
setData(convertedArray)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleData()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={[Styles.wrapPaper, Styles.contentItemCenter, Styles.mb15]}>
|
||||
<Text style={[Styles.textSubtitle, Styles.mv15]}>JUMLAH DOKUMEN</Text>
|
||||
@@ -16,8 +51,8 @@ export default function ChartDokumenHome() {
|
||||
showFractionalValues={false}
|
||||
showYAxisIndices
|
||||
noOfSections={4}
|
||||
maxValue={25}
|
||||
data={barData}
|
||||
maxValue={maxValue}
|
||||
data={data}
|
||||
isAnimated
|
||||
width={width - 140}
|
||||
barWidth={width * 0.25}
|
||||
|
||||
@@ -1,20 +1,44 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import { PieChart } from "react-native-gifted-charts";
|
||||
|
||||
type Props = {
|
||||
value: number;
|
||||
text: string;
|
||||
color: string;
|
||||
}[]
|
||||
|
||||
export default function ChartProgresHome() {
|
||||
const pieData = [
|
||||
{ value: 54, text: "54%", color: '#177AD5' },
|
||||
{ value: 40, text: "40%", color: '#92cc76' },
|
||||
{ value: 20, text: "20%", color: '#ED6665' },
|
||||
{ value: 0, text: "0%", color: '#fac858' },
|
||||
];
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const [data, setData] = useState<Props>([])
|
||||
|
||||
async function handleData() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "progress", user: hasil })
|
||||
const convertedArray = response.data.map((item: { color: any; text: any; value: any; }) => ({
|
||||
color: item.color,
|
||||
text: item.text,
|
||||
value: Number(item.value)
|
||||
}));
|
||||
setData(convertedArray)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleData()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={[Styles.wrapPaper, Styles.contentItemCenter, Styles.mb15]}>
|
||||
<Text style={[Styles.textSubtitle, Styles.mv15]}>PROGRES KEGIATAN</Text>
|
||||
<PieChart
|
||||
data={pieData}
|
||||
data={data}
|
||||
showText
|
||||
showValuesAsTooltipText
|
||||
textColor="black"
|
||||
@@ -26,6 +50,31 @@ export default function ChartProgresHome() {
|
||||
textBackgroundRadius={0}
|
||||
isAnimated
|
||||
/>
|
||||
|
||||
<View style={[Styles.mt15]}>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.w80]}>
|
||||
<View style={[Styles.rowItemsCenter, Styles.w60]}>
|
||||
<View style={[Styles.iconContent, { backgroundColor: '#177AD5' }]}></View>
|
||||
<Text style={[Styles.textInformation, Styles.ml10]}>Segera Dikerjakan</Text>
|
||||
</View>
|
||||
|
||||
<View style={[Styles.rowItemsCenter, Styles.w50]}>
|
||||
<View style={[Styles.iconContent, { backgroundColor: '#92cc76' }]}></View>
|
||||
<Text style={[Styles.textInformation, Styles.ml10]}>Selesai</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View style={[Styles.rowSpaceBetween, Styles.w80, Styles.mt10]}>
|
||||
<View style={[Styles.rowItemsCenter, Styles.w60]}>
|
||||
<View style={[Styles.iconContent, { backgroundColor: '#fac858' }]}></View>
|
||||
<Text style={[Styles.textInformation, Styles.ml10]}>Dikerjakan</Text>
|
||||
</View>
|
||||
|
||||
<View style={[Styles.rowItemsCenter, Styles.w50]}>
|
||||
<View style={[Styles.iconContent, { backgroundColor: '#ED6665' }]}></View>
|
||||
<Text style={[Styles.textInformation, Styles.ml10]}>Dibatalkan</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
@@ -1,15 +1,51 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import DiscussionItem from "../discussionItem";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
idDivision: string
|
||||
desc: string
|
||||
title: string
|
||||
date: string
|
||||
user: string
|
||||
}
|
||||
|
||||
export default function DisccussionHome() {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
|
||||
|
||||
async function handleData() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "discussion", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleData()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Diskusi</Text>
|
||||
<View style={[Styles.wrapPaper]}>
|
||||
<DiscussionItem title="Bagaimana cara mengatasi banjir?" user="Amalia" date="13 Februari 2025" />
|
||||
<DiscussionItem title="Bagaimana cara mengatasi banjir?" user="Amalia" date="13 Februari 2025" />
|
||||
<DiscussionItem title="Bagaimana cara mengatasi banjir?" user="Amalia" date="13 Februari 2025" />
|
||||
{
|
||||
data.length > 0 ?
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<DiscussionItem key={index} title={item.desc} user={item.user} date={item.date} />
|
||||
)
|
||||
})
|
||||
: <Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada acara hari ini</Text>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -1,13 +1,38 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import React from "react";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { router } from "expo-router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Dimensions, Text, View } from "react-native";
|
||||
import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel";
|
||||
import PaperGridContent from "../paperGridContent";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
name: string
|
||||
jumlah: number
|
||||
}
|
||||
|
||||
export default function DivisionHome() {
|
||||
const data = [...new Array(6).keys()];
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const ref = React.useRef<ICarouselInstance>(null);
|
||||
const width = Dimensions.get("window").width;
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
|
||||
async function handleData() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "division", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleData()
|
||||
}, []);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
@@ -26,9 +51,9 @@ export default function DivisionHome() {
|
||||
snapEnabled={true}
|
||||
vertical={false}
|
||||
renderItem={({ index }) => (
|
||||
<PaperGridContent content="carousel" title="Kesekretariatan" headerColor="warning">
|
||||
<PaperGridContent onPress={() => { router.push(`/division/${data[index].id}`) }} content="carousel" title={data[index].name} headerColor="warning">
|
||||
<View>
|
||||
<Text style={{ fontSize: 50, textAlign: "center", fontWeight: 'bold' }}>12</Text>
|
||||
<Text style={{ fontSize: 50, textAlign: "center", fontWeight: 'bold' }}>{data[index].jumlah}</Text>
|
||||
<Text style={[Styles.textSubtitle, { textAlign: "center" }]}>KEGIATAN</Text>
|
||||
</View>
|
||||
</PaperGridContent>
|
||||
|
||||
@@ -1,14 +1,56 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Text, View } from "react-native";
|
||||
import EventItem from "../eventItem";
|
||||
import { router } from "expo-router";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
idDivision: string
|
||||
title: string
|
||||
desc: string
|
||||
status: number
|
||||
timeStart: string
|
||||
timeEnd: string
|
||||
dateStart: string
|
||||
dateEnd: string
|
||||
createdAt: string
|
||||
user_name: string
|
||||
}
|
||||
|
||||
export default function EventHome() {
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
|
||||
async function handleData() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "event", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleData()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb15]}>
|
||||
<Text style={[Styles.textDefaultSemiBold, Styles.mv10]}>Acara Hari Ini</Text>
|
||||
<View style={[Styles.wrapPaper]}>
|
||||
<EventItem category="purple" title="Meeting Pertama" user="Amalia" jamAwal="10.00" jamAkhir="11.00" />
|
||||
<EventItem category="orange" title="Meeting Pertama" user="Amalia" jamAwal="10.00" jamAkhir="11.00" />
|
||||
{
|
||||
data.length > 0 ?
|
||||
data.map((item, index) => {
|
||||
return (
|
||||
<EventItem key={index} category={index % 2 == 0 ? 'purple' : 'orange'} onPress={() => {router.push(`/division/${item.idDivision}/calendar/${item.id}`)}} title={item.title} user={item.user_name} jamAwal={item.timeStart} jamAkhir={item.timeEnd} />
|
||||
)
|
||||
})
|
||||
: <Text style={[Styles.textDefault, Styles.cGray, { textAlign: 'center' }]}>Tidak ada acara hari ini</Text>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -1,15 +1,42 @@
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import Styles from "@/constants/Styles";
|
||||
import React from "react";
|
||||
import { apiGetDataHome } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { router } from "expo-router";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Dimensions, Text, View } from "react-native";
|
||||
import Carousel, { ICarouselInstance } from "react-native-reanimated-carousel";
|
||||
import ProgressBar from "../progressBar";
|
||||
import { ColorsStatus } from "@/constants/ColorsStatus";
|
||||
import PaperGridContent from "../paperGridContent";
|
||||
import ProgressBar from "../progressBar";
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
title: string
|
||||
desc: string
|
||||
status: number
|
||||
progress: number
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export default function ProjectHome() {
|
||||
const data = [...new Array(6).keys()];
|
||||
const { decryptToken, token } = useAuthSession()
|
||||
const ref = React.useRef<ICarouselInstance>(null);
|
||||
const width = Dimensions.get("window").width;
|
||||
const [data, setData] = useState<Props[]>([])
|
||||
|
||||
async function handleData() {
|
||||
try {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiGetDataHome({ cat: "kegiatan", user: hasil })
|
||||
setData(response.data)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleData()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={[Styles.mb15]}>
|
||||
@@ -27,12 +54,26 @@ export default function ProjectHome() {
|
||||
snapEnabled={true}
|
||||
vertical={false}
|
||||
renderItem={({ index }) => (
|
||||
<PaperGridContent content="carousel" title="Pembangunan Jembatan" headerColor="primary">
|
||||
<PaperGridContent content="carousel" onPress={() => { router.push(`/project/${data[index].id}`) }} title={data[index].title} headerColor="primary">
|
||||
<ProgressBar />
|
||||
<View style={[Styles.rowSpaceBetween]}>
|
||||
<Text style={[Styles.textDefault, Styles.cGray]}>13 Februari 2025</Text>
|
||||
<View style={[Styles.labelStatus, ColorsStatus.warning]}>
|
||||
<Text style={[Styles.textMediumSemiBold, Styles.cWhite]}>DIKERJAKAN</Text>
|
||||
<Text style={[Styles.textDefault, Styles.cGray]}>{data[index].createdAt}</Text>
|
||||
<View style={[Styles.labelStatus,
|
||||
data[index].status === 0 ? ColorsStatus.primary :
|
||||
data[index].status === 1 ? ColorsStatus.warning :
|
||||
data[index].status === 2 ? ColorsStatus.success :
|
||||
data[index].status === 3 ? ColorsStatus.error :
|
||||
ColorsStatus.primary
|
||||
]}>
|
||||
<Text style={[Styles.textMediumSemiBold, Styles.cWhite]}>
|
||||
{
|
||||
data[index].status === 0 ? 'SEGERA' :
|
||||
data[index].status === 1 ? 'DIKERJAKAN' :
|
||||
data[index].status === 2 ? 'SELESAI' :
|
||||
data[index].status === 3 ? 'DIBATALKAN' :
|
||||
"SEGERA"
|
||||
}
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</PaperGridContent>
|
||||
|
||||
@@ -158,6 +158,18 @@ const Styles = StyleSheet.create({
|
||||
w100: {
|
||||
width: '100%'
|
||||
},
|
||||
w90: {
|
||||
width: '90%'
|
||||
},
|
||||
w80: {
|
||||
width: '80%'
|
||||
},
|
||||
w70: {
|
||||
width: '70%'
|
||||
},
|
||||
w60: {
|
||||
width: '60%'
|
||||
},
|
||||
w50: {
|
||||
width: '50%'
|
||||
},
|
||||
|
||||
21
lib/api.ts
21
lib/api.ts
@@ -31,10 +31,23 @@ export const apiGetBanner = async ({ user }: { user: string }) => {
|
||||
};
|
||||
|
||||
|
||||
// export const createEntity = async (newEntity: any) => {
|
||||
// const response = await api.post('/entities', newEntity);
|
||||
// return response.data;
|
||||
// };
|
||||
export const apiCreateBanner = async (data: FormData) => {
|
||||
await api.post('/banner', data, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
}).then(response => {
|
||||
return response.data;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
};
|
||||
|
||||
export const apiGetDataHome = async ({ cat, user }: { cat: 'kegiatan' | 'division' | 'progress' | 'dokumen' | 'event' | 'discussion' | 'header' | 'check-late-project', user: string }) => {
|
||||
const response = await api.get(`mobile/home?user=${user}&cat=${cat}`);
|
||||
return response.data;
|
||||
};
|
||||
|
||||
// export const updateEntityById = async (id: any, updatedEntity: any) => {
|
||||
// const response = await api.put(`/entities/${id}`, updatedEntity);
|
||||
|
||||
Reference in New Issue
Block a user