upd: button save
Deskripsi: - disable button saat udh submit No Issues
This commit is contained in:
@@ -21,7 +21,8 @@ export default function CreateAnnouncement() {
|
|||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const [disableBtn, setDisableBtn] = useState(true);
|
const [disableBtn, setDisableBtn] = useState(true);
|
||||||
const [modalDivisi, setModalDivisi] = useState(false);
|
const [modalDivisi, setModalDivisi] = useState(false);
|
||||||
const [divisionMember, setDivisionMember] = useState<any>([]);
|
const [divisionMember, setDivisionMember] = useState<any>([])
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [dataForm, setDataForm] = useState({
|
const [dataForm, setDataForm] = useState({
|
||||||
title: "",
|
title: "",
|
||||||
desc: "",
|
desc: "",
|
||||||
@@ -66,6 +67,7 @@ export default function CreateAnnouncement() {
|
|||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateAnnouncement({
|
const response = await apiCreateAnnouncement({
|
||||||
data: { ...dataForm, user: hasil, groups: divisionMember },
|
data: { ...dataForm, user: hasil, groups: divisionMember },
|
||||||
@@ -77,6 +79,8 @@ export default function CreateAnnouncement() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +99,7 @@ export default function CreateAnnouncement() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading ? true : false}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
divisionMember.length == 0
|
divisionMember.length == 0
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export default function EditAnnouncement() {
|
|||||||
const [modalDivisi, setModalDivisi] = useState(false);
|
const [modalDivisi, setModalDivisi] = useState(false);
|
||||||
const [disableBtn, setDisableBtn] = useState(true);
|
const [disableBtn, setDisableBtn] = useState(true);
|
||||||
const [dataMember, setDataMember] = useState<any>([]);
|
const [dataMember, setDataMember] = useState<any>([]);
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [dataForm, setDataForm] = useState({
|
const [dataForm, setDataForm] = useState({
|
||||||
title: "",
|
title: "",
|
||||||
desc: "",
|
desc: "",
|
||||||
@@ -109,6 +110,7 @@ export default function EditAnnouncement() {
|
|||||||
|
|
||||||
async function handleEdit() {
|
async function handleEdit() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiEditAnnouncement({
|
const response = await apiEditAnnouncement({
|
||||||
...dataForm, user: hasil, groups: dataMember,
|
...dataForm, user: hasil, groups: dataMember,
|
||||||
@@ -120,6 +122,8 @@ export default function EditAnnouncement() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +142,7 @@ export default function EditAnnouncement() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading ? true : false}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
dataMember.length == 0
|
dataMember.length == 0
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default function EditBanner() {
|
|||||||
const [title, setTitle] = useState("");
|
const [title, setTitle] = useState("");
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const [imgForm, setImgForm] = useState<any>();
|
const [imgForm, setImgForm] = useState<any>();
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const pickImageAsync = async () => {
|
const pickImageAsync = async () => {
|
||||||
let result = await ImagePicker.launchImageLibraryAsync({
|
let result = await ImagePicker.launchImageLibraryAsync({
|
||||||
@@ -71,6 +72,7 @@ export default function EditBanner() {
|
|||||||
|
|
||||||
const handleUpdateEntity = async () => {
|
const handleUpdateEntity = async () => {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
|
|
||||||
@@ -105,6 +107,8 @@ export default function EditBanner() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,7 +126,7 @@ export default function EditBanner() {
|
|||||||
headerTitle: "Edit Banner",
|
headerTitle: "Edit Banner",
|
||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => <ButtonSaveHeader
|
headerRight: () => <ButtonSaveHeader
|
||||||
disable={title == "" || error ? true : false}
|
disable={title == "" || error || loading ? true : false}
|
||||||
onPress={() => { handleUpdateEntity() }}
|
onPress={() => { handleUpdateEntity() }}
|
||||||
category="update" />,
|
category="update" />,
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export default function CreateBanner() {
|
|||||||
const [imgForm, setImgForm] = useState<any>();
|
const [imgForm, setImgForm] = useState<any>();
|
||||||
const [title, setTitle] = useState("");
|
const [title, setTitle] = useState("");
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const pickImageAsync = async () => {
|
const pickImageAsync = async () => {
|
||||||
let result = await ImagePicker.launchImageLibraryAsync({
|
let result = await ImagePicker.launchImageLibraryAsync({
|
||||||
@@ -57,32 +58,40 @@ export default function CreateBanner() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleCreateEntity = async () => {
|
const handleCreateEntity = async () => {
|
||||||
const hasil = await decryptToken(String(token?.current));
|
try {
|
||||||
const fd = new FormData();
|
setLoading(true)
|
||||||
|
const hasil = await decryptToken(String(token?.current));
|
||||||
|
const fd = new FormData();
|
||||||
|
|
||||||
fd.append("file", {
|
fd.append("file", {
|
||||||
uri: imgForm.uri,
|
uri: imgForm.uri,
|
||||||
type: imgForm.mimeType,
|
type: imgForm.mimeType,
|
||||||
name: imgForm.fileName,
|
name: imgForm.fileName,
|
||||||
} as any);
|
} as any);
|
||||||
|
|
||||||
fd.append(
|
fd.append(
|
||||||
"data",
|
"data",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
title,
|
title,
|
||||||
user: hasil,
|
user: hasil,
|
||||||
})
|
})
|
||||||
);
|
|
||||||
|
|
||||||
const createdEntity = await apiCreateBanner(fd);
|
|
||||||
if (createdEntity.success) {
|
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
|
||||||
apiGetBanner({ user: hasil }).then((data) =>
|
|
||||||
dispatch(setEntities(data.data))
|
|
||||||
);
|
);
|
||||||
router.back();
|
|
||||||
} else {
|
const createdEntity = await apiCreateBanner(fd);
|
||||||
|
if (createdEntity.success) {
|
||||||
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||||
|
apiGetBanner({ user: hasil }).then((data) =>
|
||||||
|
dispatch(setEntities(data.data))
|
||||||
|
);
|
||||||
|
router.back();
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,7 +110,7 @@ export default function CreateBanner() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={title == "" || selectedImage == undefined || error ? true : false}
|
disable={title == "" || selectedImage == undefined || error || loading ? true : false}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleCreateEntity();
|
handleCreateEntity();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
const [idGroup, setIdGroup] = useState('')
|
const [idGroup, setIdGroup] = useState('')
|
||||||
const [selectMember, setSelectMember] = useState<any[]>([])
|
const [selectMember, setSelectMember] = useState<any[]>([])
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -70,15 +71,21 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
|
|
||||||
async function handleAddMember() {
|
async function handleAddMember() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberDiscussionGeneral({ id: id, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberDiscussionGeneral({ id: id, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil menambahkan anggota', })
|
Toast.show({ type: 'small', text1: 'Berhasil menambahkan anggota', })
|
||||||
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
dispatch(setUpdateDiscussionGeneralDetail(!update))
|
||||||
router.back()
|
router.back()
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Toast.show({ type: 'small', text1: 'Gagal menambahkan anggota', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +100,7 @@ export default function AddMemberDiscussionDetail() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="update"
|
category="update"
|
||||||
disable={selectMember.length > 0 ? false : true}
|
disable={selectMember.length == 0 || loading ? true : false}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleAddMember()
|
handleAddMember()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
const [isSelect, setSelect] = useState(false);
|
const [isSelect, setSelect] = useState(false);
|
||||||
const entitiesMember = useSelector((state: any) => state.memberChoose)
|
const entitiesMember = useSelector((state: any) => state.memberChoose)
|
||||||
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [dataForm, setDataForm] = useState({
|
const [dataForm, setDataForm] = useState({
|
||||||
idGroup: "",
|
idGroup: "",
|
||||||
title: "",
|
title: "",
|
||||||
@@ -95,6 +96,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateDiscussionGeneral({
|
const response = await apiCreateDiscussionGeneral({
|
||||||
data: { ...dataForm, user: hasil, member: entitiesMember },
|
data: { ...dataForm, user: hasil, member: entitiesMember },
|
||||||
@@ -110,6 +112,8 @@ export default function CreateDiscussionGeneral() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +131,7 @@ export default function CreateDiscussionGeneral() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="create"
|
category="create"
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading ? true : false}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
entitiesMember.length == 0
|
entitiesMember.length == 0
|
||||||
? Toast.show({ type: 'small', text1: 'Anda belum memilih anggota', })
|
? Toast.show({ type: 'small', text1: 'Anda belum memilih anggota', })
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
const [disableBtn, setDisableBtn] = useState(false)
|
const [disableBtn, setDisableBtn] = useState(false)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
const update = useSelector((state: any) => state.discussionGeneralDetailUpdate)
|
||||||
const [dataForm, setDataForm] = useState({
|
const [dataForm, setDataForm] = useState({
|
||||||
title: "",
|
title: "",
|
||||||
@@ -80,6 +81,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
|
|
||||||
async function handleEdit() {
|
async function handleEdit() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiEditDiscussionGeneral({ user: hasil, title: dataForm.title, desc: dataForm.desc }, id);
|
const response = await apiEditDiscussionGeneral({ user: hasil, title: dataForm.title, desc: dataForm.desc }, id);
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -89,6 +91,9 @@ export default function EditDiscussionGeneral() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +112,7 @@ export default function EditDiscussionGeneral() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading ? true : false}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => { handleEdit() }}
|
onPress={() => { handleEdit() }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default function AddMemberCalendarEvent() {
|
|||||||
const [selectMember, setSelectMember] = useState<any[]>([])
|
const [selectMember, setSelectMember] = useState<any[]>([])
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const [idCalendar, setIdCalendar] = useState('')
|
const [idCalendar, setIdCalendar] = useState('')
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoadOldMember() {
|
async function handleLoadOldMember() {
|
||||||
try {
|
try {
|
||||||
@@ -78,6 +79,7 @@ export default function AddMemberCalendarEvent() {
|
|||||||
|
|
||||||
async function handleAddMember() {
|
async function handleAddMember() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberCalendar({ id: idCalendar, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberCalendar({ id: idCalendar, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -90,6 +92,8 @@ export default function AddMemberCalendarEvent() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +108,7 @@ export default function AddMemberCalendarEvent() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="update"
|
category="update"
|
||||||
disable={selectMember.length > 0 ? false : true}
|
disable={selectMember.length == 0 || loading ? true : false}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleAddMember()
|
handleAddMember()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export default function EditEventCalendar() {
|
|||||||
const [isSelect, setSelect] = useState(false)
|
const [isSelect, setSelect] = useState(false)
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>()
|
const { id, detail } = useLocalSearchParams<{ id: string, detail: string }>()
|
||||||
const [idCalendar, setIdCalendar] = useState('')
|
const [idCalendar, setIdCalendar] = useState('')
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const [error, setError] = useState({
|
const [error, setError] = useState({
|
||||||
title: false,
|
title: false,
|
||||||
@@ -140,6 +141,7 @@ export default function EditEventCalendar() {
|
|||||||
|
|
||||||
async function handleUpdate() {
|
async function handleUpdate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiUpdateCalendar({ data: { ...data, user: hasil }, id: idCalendar })
|
const response = await apiUpdateCalendar({ data: { ...data, user: hasil }, id: idCalendar })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -150,7 +152,9 @@ export default function EditEventCalendar() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Gagal mengubah acara', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +168,7 @@ export default function EditEventCalendar() {
|
|||||||
headerTitleAlign: 'center',
|
headerTitleAlign: 'center',
|
||||||
headerRight: () =>
|
headerRight: () =>
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={Object.values(error).some((val) => val == true) || data.title == "" || data.dateStart == "" || data.timeStart == "" || data.timeEnd == "" || data.repeatEventTyper == ""}
|
disable={Object.values(error).some((val) => val == true) || data.title == "" || data.dateStart == "" || data.timeStart == "" || data.timeEnd == "" || data.repeatEventTyper == "" || loading}
|
||||||
category="update-calendar"
|
category="update-calendar"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleUpdate()
|
handleUpdate()
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
const update = useSelector((state: any) => state.calendarCreate)
|
const update = useSelector((state: any) => state.calendarCreate)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const updateRefresh = useSelector((state: any) => state.calendarUpdate)
|
const updateRefresh = useSelector((state: any) => state.calendarUpdate)
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -58,6 +59,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
|
|
||||||
async function handleAddMember() {
|
async function handleAddMember() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateCalendar({ data: { ...update, user: hasil, idDivision: id, member: selectMember } })
|
const response = await apiCreateCalendar({ data: { ...update, user: hasil, idDivision: id, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -80,7 +82,9 @@ export default function CreateCalendarAddMember() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Gagal membuat acara', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +98,7 @@ export default function CreateCalendarAddMember() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="create"
|
category="create"
|
||||||
disable={selectMember.length > 0 ? false : true}
|
disable={selectMember.length == 0 || loading ? true : false}
|
||||||
onPress={() => { handleAddMember() }}
|
onPress={() => { handleAddMember() }}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
const [data, setData] = useState("");
|
const [data, setData] = useState("");
|
||||||
const update = useSelector((state: any) => state.discussionUpdate);
|
const update = useSelector((state: any) => state.discussionUpdate);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -38,6 +39,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
|
|
||||||
async function handleUpdate() {
|
async function handleUpdate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiEditDiscussion({
|
const response = await apiEditDiscussion({
|
||||||
data: { user: hasil, desc: data },
|
data: { user: hasil, desc: data },
|
||||||
@@ -47,9 +49,14 @@ export default function DiscussionDivisionEdit() {
|
|||||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
dispatch(setUpdateDiscussion({ ...update, data: !update.data }));
|
||||||
router.back();
|
router.back();
|
||||||
|
}else{
|
||||||
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +75,7 @@ export default function DiscussionDivisionEdit() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={data == ""}
|
disable={data == "" || loading}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleUpdate();
|
handleUpdate();
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ export default function CreateDiscussionDivision() {
|
|||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const update = useSelector((state: any) => state.discussionUpdate)
|
const update = useSelector((state: any) => state.discussionUpdate)
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateDiscussion({ data: { user: hasil, desc, idDivision: id } })
|
const response = await apiCreateDiscussion({ data: { user: hasil, desc, idDivision: id } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -32,6 +34,8 @@ export default function CreateDiscussionDivision() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +47,7 @@ export default function CreateDiscussionDivision() {
|
|||||||
headerTitle: 'Tambah Diskusi',
|
headerTitle: 'Tambah Diskusi',
|
||||||
headerTitleAlign: 'center',
|
headerTitleAlign: 'center',
|
||||||
headerRight: () => <ButtonSaveHeader
|
headerRight: () => <ButtonSaveHeader
|
||||||
disable={desc == ""}
|
disable={desc == "" || loading}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleCreate()
|
handleCreate()
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default function AddMemberTask() {
|
|||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const [selectMember, setSelectMember] = useState<any[]>([])
|
const [selectMember, setSelectMember] = useState<any[]>([])
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoadOldMember() {
|
async function handleLoadOldMember() {
|
||||||
try {
|
try {
|
||||||
@@ -72,6 +73,7 @@ export default function AddMemberTask() {
|
|||||||
|
|
||||||
async function handleAddMember() {
|
async function handleAddMember() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberTask({ id: detail, data: { user: hasil, member: selectMember, idDivision: id } })
|
const response = await apiAddMemberTask({ id: detail, data: { user: hasil, member: selectMember, idDivision: id } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -83,7 +85,9 @@ export default function AddMemberTask() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan anggota', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +102,7 @@ export default function AddMemberTask() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="update"
|
category="update"
|
||||||
disable={selectMember.length > 0 ? false : true}
|
disable={selectMember.length == 0 || loading ? true : false}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleAddMember()
|
handleAddMember()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export default function TaskDivisionAddTask() {
|
|||||||
const update = useSelector((state: any) => state.taskUpdate);
|
const update = useSelector((state: any) => state.taskUpdate);
|
||||||
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
const { id, detail } = useLocalSearchParams<{ id: string; detail: string }>();
|
||||||
const [disable, setDisable] = useState(true);
|
const [disable, setDisable] = useState(true);
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [range, setRange] = useState<{
|
const [range, setRange] = useState<{
|
||||||
startDate: DateType;
|
startDate: DateType;
|
||||||
endDate: DateType;
|
endDate: DateType;
|
||||||
@@ -73,6 +74,7 @@ export default function TaskDivisionAddTask() {
|
|||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiCreateTaskTugas({
|
const response = await apiCreateTaskTugas({
|
||||||
data: {
|
data: {
|
||||||
@@ -93,7 +95,9 @@ export default function TaskDivisionAddTask() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
Toast.show({ type: 'small', text1: 'Gagal menambah data', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +117,7 @@ export default function TaskDivisionAddTask() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="create"
|
category="create"
|
||||||
disable={disable}
|
disable={disable || loading}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleCreate();
|
handleCreate();
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export default function TaskDivisionCancel() {
|
|||||||
const [reason, setReason] = useState("");
|
const [reason, setReason] = useState("");
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const [disable, setDisable] = useState(false);
|
const [disable, setDisable] = useState(false);
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
function onValidation(val: string) {
|
function onValidation(val: string) {
|
||||||
setReason(val);
|
setReason(val);
|
||||||
@@ -43,6 +44,7 @@ export default function TaskDivisionCancel() {
|
|||||||
|
|
||||||
async function handleCancel() {
|
async function handleCancel() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiCancelTask(
|
const response = await apiCancelTask(
|
||||||
{
|
{
|
||||||
@@ -60,7 +62,9 @@ export default function TaskDivisionCancel() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
Toast.show({ type: 'small', text1: 'Gagal membatalkan kegiatan', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +83,7 @@ export default function TaskDivisionCancel() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disable}
|
disable={disable || loading}
|
||||||
category="cancel"
|
category="cancel"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleCancel();
|
handleCancel();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export default function TaskDivisionEdit() {
|
|||||||
const [disable, setDisable] = useState(false);
|
const [disable, setDisable] = useState(false);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const update = useSelector((state: any) => state.taskUpdate);
|
const update = useSelector((state: any) => state.taskUpdate);
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -61,6 +62,7 @@ export default function TaskDivisionEdit() {
|
|||||||
|
|
||||||
async function handleUpdate() {
|
async function handleUpdate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiEditTask(
|
const response = await apiEditTask(
|
||||||
{
|
{
|
||||||
@@ -79,6 +81,8 @@ export default function TaskDivisionEdit() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +102,7 @@ export default function TaskDivisionEdit() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="update"
|
category="update"
|
||||||
disable={disable}
|
disable={disable || loading}
|
||||||
onPress={() => { handleUpdate() }}
|
onPress={() => { handleUpdate() }}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export default function CreateTaskDivision() {
|
|||||||
const [title, setTitle] = useState('')
|
const [title, setTitle] = useState('')
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const [isModal, setModal] = useState(false)
|
const [isModal, setModal] = useState(false)
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
let hitung = 0;
|
let hitung = 0;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -77,6 +78,7 @@ export default function CreateTaskDivision() {
|
|||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
|
|
||||||
@@ -102,6 +104,9 @@ export default function CreateTaskDivision() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +126,7 @@ export default function CreateTaskDivision() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={title == "" || entitiesMember.length == 0 || taskCreate.length == 0}
|
disable={title == "" || entitiesMember.length == 0 || taskCreate.length == 0 || loading}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => { handleCreate() }}
|
onPress={() => { handleCreate() }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ export default function AddMemberCreateTask() {
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const { token, decryptToken } = useAuthSession()
|
const { token, decryptToken } = useAuthSession()
|
||||||
const { id } = useLocalSearchParams<{ id: string, detail: string }>()
|
const { id } = useLocalSearchParams<{ id: string, detail: string }>()
|
||||||
const [dataOld, setDataOld] = useState<Props[]>([])
|
|
||||||
const [data, setData] = useState<Props[]>([])
|
const [data, setData] = useState<Props[]>([])
|
||||||
const [selectMember, setSelectMember] = useState<any[]>([])
|
const [selectMember, setSelectMember] = useState<any[]>([])
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
startDate: DateType;
|
startDate: DateType;
|
||||||
endDate: DateType;
|
endDate: DateType;
|
||||||
}>({ startDate: undefined, endDate: undefined });
|
}>({ startDate: undefined, endDate: undefined });
|
||||||
|
const [loadingSubmit, setLoadingSubmit] = useState(false)
|
||||||
const [month, setMonth] = useState<any>();
|
const [month, setMonth] = useState<any>();
|
||||||
const [year, setYear] = useState<any>();
|
const [year, setYear] = useState<any>();
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@@ -73,6 +74,7 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
|
|
||||||
async function handleEdit() {
|
async function handleEdit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingSubmit(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiEditTaskTugas({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
const response = await apiEditTaskTugas({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -84,7 +86,9 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoadingSubmit(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +138,7 @@ export default function UpdateProjectTaskDivision() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loadingSubmit}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleEdit()
|
handleEdit()
|
||||||
|
|||||||
@@ -31,9 +31,11 @@ export default function AddMemberDivision() {
|
|||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const update = useSelector((state: any) => state.divisionUpdate)
|
const update = useSelector((state: any) => state.divisionUpdate)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiGetDivisionOneDetail({ user: hasil, id })
|
const response = await apiGetDivisionOneDetail({ user: hasil, id })
|
||||||
setDataOld(response.data.member)
|
setDataOld(response.data.member)
|
||||||
@@ -72,6 +74,7 @@ export default function AddMemberDivision() {
|
|||||||
|
|
||||||
async function handleAddMember() {
|
async function handleAddMember() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberDivision({ id: id, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberDivision({ id: id, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -83,7 +86,9 @@ export default function AddMemberDivision() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan anggota', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +103,7 @@ export default function AddMemberDivision() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="update"
|
category="update"
|
||||||
disable={selectMember.length > 0 ? false : true}
|
disable={selectMember.length == 0 || loading ? true : false}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleAddMember()
|
handleAddMember()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default function EditDivision() {
|
|||||||
const update = useSelector((state: any) => state.divisionUpdate)
|
const update = useSelector((state: any) => state.divisionUpdate)
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const { id } = useLocalSearchParams<{ id: string }>();
|
const { id } = useLocalSearchParams<{ id: string }>();
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
name: "",
|
name: "",
|
||||||
desc: "",
|
desc: "",
|
||||||
@@ -43,6 +44,7 @@ export default function EditDivision() {
|
|||||||
|
|
||||||
async function handleEdit() {
|
async function handleEdit() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiEditDivision({ user: hasil, name: data.name, desc: data.desc }, id)
|
const response = await apiEditDivision({ user: hasil, name: data.name, desc: data.desc }, id)
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -55,6 +57,8 @@ export default function EditDivision() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +77,7 @@ export default function EditDivision() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={error.name}
|
disable={error.name || loading ? true : false}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => { handleEdit() }}
|
onPress={() => { handleEdit() }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export default function CreateDivisionAddAdmin() {
|
|||||||
const update = useSelector((state: any) => state.divisionCreate)
|
const update = useSelector((state: any) => state.divisionCreate)
|
||||||
const updateDivision = useSelector((state: any) => state.divisionUpdate)
|
const updateDivision = useSelector((state: any) => state.divisionUpdate)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoadMember() {
|
async function handleLoadMember() {
|
||||||
setData(update.member)
|
setData(update.member)
|
||||||
@@ -48,6 +49,7 @@ export default function CreateDivisionAddAdmin() {
|
|||||||
|
|
||||||
async function handleAddMember() {
|
async function handleAddMember() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
dispatch(setFormCreateDivision({ ...update, admin: selectMember }))
|
dispatch(setFormCreateDivision({ ...update, admin: selectMember }))
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiCreateDivision({ ...update, user: hasil })
|
const response = await apiCreateDivision({ ...update, user: hasil })
|
||||||
@@ -61,7 +63,9 @@ export default function CreateDivisionAddAdmin() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Gagal membuat divisi', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +80,7 @@ export default function CreateDivisionAddAdmin() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="create"
|
category="create"
|
||||||
disable={selectMember.length > 0 ? false : true}
|
disable={selectMember.length == 0 || loading ? true : false}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleAddMember()
|
handleAddMember()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ export default function EditProfile() {
|
|||||||
const [isSelect, setSelect] = useState(false);
|
const [isSelect, setSelect] = useState(false);
|
||||||
const [disableBtn, setDisableBtn] = useState(false)
|
const [disableBtn, setDisableBtn] = useState(false)
|
||||||
const [valChoose, setValChoose] = useState("")
|
const [valChoose, setValChoose] = useState("")
|
||||||
const [imgForm, setImgForm] = useState<any>();
|
const [imgForm, setImgForm] = useState<any>()
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [data, setData] = useState<Props>({
|
const [data, setData] = useState<Props>({
|
||||||
id: entities.id,
|
id: entities.id,
|
||||||
name: entities.name,
|
name: entities.name,
|
||||||
@@ -150,6 +151,7 @@ export default function EditProfile() {
|
|||||||
|
|
||||||
async function handleEdit() {
|
async function handleEdit() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
|
|
||||||
@@ -179,6 +181,8 @@ export default function EditProfile() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +221,7 @@ export default function EditProfile() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading ? true : false}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleEdit()
|
handleEdit()
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export default function CreateMember() {
|
|||||||
const [disableBtn, setDisableBtn] = useState(true)
|
const [disableBtn, setDisableBtn] = useState(true)
|
||||||
const [valChoose, setValChoose] = useState("")
|
const [valChoose, setValChoose] = useState("")
|
||||||
const [imgForm, setImgForm] = useState<any>()
|
const [imgForm, setImgForm] = useState<any>()
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [error, setError] = useState({
|
const [error, setError] = useState({
|
||||||
group: false,
|
group: false,
|
||||||
position: false,
|
position: false,
|
||||||
@@ -152,6 +153,7 @@ export default function CreateMember() {
|
|||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
|
|
||||||
@@ -179,6 +181,9 @@ export default function CreateMember() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
}finally{
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +220,7 @@ export default function CreateMember() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => { handleCreate() }}
|
onPress={() => { handleCreate() }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export default function EditMember() {
|
|||||||
const [disableBtn, setDisableBtn] = useState(false)
|
const [disableBtn, setDisableBtn] = useState(false)
|
||||||
const [valChoose, setValChoose] = useState("")
|
const [valChoose, setValChoose] = useState("")
|
||||||
const [imgForm, setImgForm] = useState<any>();
|
const [imgForm, setImgForm] = useState<any>();
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
const [data, setData] = useState<Props>({
|
const [data, setData] = useState<Props>({
|
||||||
id: "",
|
id: "",
|
||||||
name: "",
|
name: "",
|
||||||
@@ -175,6 +176,7 @@ export default function EditMember() {
|
|||||||
|
|
||||||
async function handleEdit() {
|
async function handleEdit() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
|
|
||||||
@@ -203,7 +205,9 @@ export default function EditMember() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
}finally{
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +246,7 @@ export default function EditMember() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleEdit()
|
handleEdit()
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export default function AddMemberProject() {
|
|||||||
const [idGroup, setIdGroup] = useState('')
|
const [idGroup, setIdGroup] = useState('')
|
||||||
const [selectMember, setSelectMember] = useState<any[]>([])
|
const [selectMember, setSelectMember] = useState<any[]>([])
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -43,6 +44,7 @@ export default function AddMemberProject() {
|
|||||||
setData(responsemember.data.filter((i: any) => i.idUserRole != 'supadmin'))
|
setData(responsemember.data.filter((i: any) => i.idUserRole != 'supadmin'))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +75,7 @@ export default function AddMemberProject() {
|
|||||||
|
|
||||||
async function handleAddMember() {
|
async function handleAddMember() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const response = await apiAddMemberProject({ id: id, data: { user: hasil, member: selectMember } })
|
const response = await apiAddMemberProject({ id: id, data: { user: hasil, member: selectMember } })
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
@@ -82,6 +85,9 @@ export default function AddMemberProject() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +102,7 @@ export default function AddMemberProject() {
|
|||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
category="update"
|
category="update"
|
||||||
disable={selectMember.length > 0 ? false : true}
|
disable={selectMember.length == 0 || loading ? true : false}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleAddMember()
|
handleAddMember()
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export default function ProjectAddTask() {
|
|||||||
title: false,
|
title: false,
|
||||||
})
|
})
|
||||||
const [title, setTitle] = useState('');
|
const [title, setTitle] = useState('');
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
const from = range.startDate
|
const from = range.startDate
|
||||||
? dayjs(range.startDate).format("DD-MM-YYYY")
|
? dayjs(range.startDate).format("DD-MM-YYYY")
|
||||||
@@ -69,15 +70,21 @@ export default function ProjectAddTask() {
|
|||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiCreateProjectTask({ data: { name: title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id });
|
const response = await apiCreateProjectTask({ data: { name: title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil menambah data', })
|
Toast.show({ type: 'small', text1: 'Berhasil menambah data', })
|
||||||
router.back();
|
router.back();
|
||||||
|
}else{
|
||||||
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +103,7 @@ export default function ProjectAddTask() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disable}
|
disable={disable || loading}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => { handleCreate() }}
|
onPress={() => { handleCreate() }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export default function ProjectCancel() {
|
|||||||
const [reason, setReason] = useState("");
|
const [reason, setReason] = useState("");
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const [disable, setDisable] = useState(false);
|
const [disable, setDisable] = useState(false);
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
function onValidation(val: string) {
|
function onValidation(val: string) {
|
||||||
@@ -44,6 +45,7 @@ export default function ProjectCancel() {
|
|||||||
|
|
||||||
async function handleCancel() {
|
async function handleCancel() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiCancelProject({
|
const response = await apiCancelProject({
|
||||||
reason: reason,
|
reason: reason,
|
||||||
@@ -56,6 +58,9 @@ export default function ProjectCancel() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +79,7 @@ export default function ProjectCancel() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disable}
|
disable={disable || loading}
|
||||||
category="cancel"
|
category="cancel"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleCancel();
|
handleCancel();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export default function EditProject() {
|
|||||||
const [judul, setJudul] = useState("");
|
const [judul, setJudul] = useState("");
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const [disable, setDisable] = useState(false);
|
const [disable, setDisable] = useState(false);
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
async function handleLoad() {
|
async function handleLoad() {
|
||||||
try {
|
try {
|
||||||
@@ -59,6 +60,7 @@ export default function EditProject() {
|
|||||||
|
|
||||||
async function handleUpdate() {
|
async function handleUpdate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiEditProject({
|
const response = await apiEditProject({
|
||||||
name: judul,
|
name: judul,
|
||||||
@@ -68,9 +70,14 @@ export default function EditProject() {
|
|||||||
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
dispatch(setUpdateProject({ ...update, data: !update.data }))
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +98,7 @@ export default function EditProject() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disable}
|
disable={disable || loading}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => { handleUpdate() }}
|
onPress={() => { handleUpdate() }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import Toast from "react-native-toast-message";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function CreateProject() {
|
export default function CreateProject() {
|
||||||
|
const [loading, setLoading] =useState(false)
|
||||||
const { token, decryptToken } = useAuthSession();
|
const { token, decryptToken } = useAuthSession();
|
||||||
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
const [chooseGroup, setChooseGroup] = useState({ val: "", label: "" });
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -102,6 +103,7 @@ export default function CreateProject() {
|
|||||||
|
|
||||||
async function handleCreate() {
|
async function handleCreate() {
|
||||||
try {
|
try {
|
||||||
|
setLoading(true)
|
||||||
const hasil = await decryptToken(String(token?.current))
|
const hasil = await decryptToken(String(token?.current))
|
||||||
const fd = new FormData()
|
const fd = new FormData()
|
||||||
|
|
||||||
@@ -127,6 +129,9 @@ export default function CreateProject() {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
}finally{
|
||||||
|
setLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +183,7 @@ export default function CreateProject() {
|
|||||||
headerTitleAlign: "center",
|
headerTitleAlign: "center",
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
<ButtonSaveHeader
|
<ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loading}
|
||||||
category="create"
|
category="create"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
handleCreate()
|
handleCreate()
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export default function UpdateProjectTask() {
|
|||||||
const [year, setYear] = useState<any>()
|
const [year, setYear] = useState<any>()
|
||||||
const [loading, setLoading] = useState(true)
|
const [loading, setLoading] = useState(true)
|
||||||
const [disableBtn, setDisableBtn] = useState(false)
|
const [disableBtn, setDisableBtn] = useState(false)
|
||||||
|
const [loadingSubmit, setLoadingSubmit] = useState(false)
|
||||||
|
|
||||||
const [title, setTitle] = useState('')
|
const [title, setTitle] = useState('')
|
||||||
const [error, setError] = useState({
|
const [error, setError] = useState({
|
||||||
@@ -65,15 +66,21 @@ export default function UpdateProjectTask() {
|
|||||||
|
|
||||||
async function handleEdit() {
|
async function handleEdit() {
|
||||||
try {
|
try {
|
||||||
|
setLoadingSubmit(true)
|
||||||
const hasil = await decryptToken(String(token?.current));
|
const hasil = await decryptToken(String(token?.current));
|
||||||
const response = await apiEditProjectTask({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
const response = await apiEditProjectTask({ data: { title, dateStart: dayjs(range.startDate).format("YYYY-MM-DD"), dateEnd: dayjs(range.endDate).format("YYYY-MM-DD"), user: hasil }, id: detail });
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
dispatch(setUpdateProject({ ...update, task: !update.task, progress: !update.progress }))
|
||||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||||
router.back();
|
router.back();
|
||||||
|
} else {
|
||||||
|
Toast.show({ type: 'small', text1: response.message, })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||||
|
} finally {
|
||||||
|
setLoadingSubmit(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +115,7 @@ export default function UpdateProjectTask() {
|
|||||||
headerTitle: 'Edit Tanggal dan Tugas',
|
headerTitle: 'Edit Tanggal dan Tugas',
|
||||||
headerTitleAlign: 'center',
|
headerTitleAlign: 'center',
|
||||||
headerRight: () => <ButtonSaveHeader
|
headerRight: () => <ButtonSaveHeader
|
||||||
disable={disableBtn}
|
disable={disableBtn || loadingSubmit}
|
||||||
category="update"
|
category="update"
|
||||||
onPress={() => { handleEdit() }}
|
onPress={() => { handleEdit() }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user