mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
Merge branch 'development' of gitlab.com:mbugroup/lti-web-client into dev/hotfix/restu
This commit is contained in:
@@ -144,13 +144,9 @@ export function MasterAktivitasContent() {
|
||||
id: '',
|
||||
name: '',
|
||||
description: '',
|
||||
time_type: 'umum',
|
||||
time_type: '',
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setInitialLoading(false);
|
||||
}, []);
|
||||
|
||||
// Phase handlers
|
||||
const handleAddPhase = () => {
|
||||
if (!selectedCategory) {
|
||||
@@ -277,7 +273,7 @@ export function MasterAktivitasContent() {
|
||||
return;
|
||||
}
|
||||
setActivityModalMode('create');
|
||||
setActivityForm({ id: '', name: '', description: '', time_type: 'umum' });
|
||||
setActivityForm({ id: '', name: '', description: '', time_type: '' });
|
||||
setShowActivityModal(true);
|
||||
};
|
||||
|
||||
@@ -293,16 +289,25 @@ export function MasterAktivitasContent() {
|
||||
};
|
||||
|
||||
const handleSaveActivity = async () => {
|
||||
if (!activityForm.name.trim()) {
|
||||
const isTimeTypeValid = Boolean(activityForm.time_type);
|
||||
const isNameValid = Boolean(activityForm.name.trim());
|
||||
const isNameLengthValid = activityForm.name.trim().length >= 3;
|
||||
|
||||
if (!isNameValid) {
|
||||
toast.error('Nama aktivitas harus diisi');
|
||||
return;
|
||||
}
|
||||
|
||||
if (activityForm.name.trim().length < 3) {
|
||||
if (!isNameLengthValid) {
|
||||
toast.error('Nama aktivitas minimal 3 karakter!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isTimeTypeValid) {
|
||||
toast.error('Tipe waktu harus diisi');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!selectedPhase) {
|
||||
toast.error('Pilih phase terlebih dahulu');
|
||||
return;
|
||||
@@ -356,7 +361,7 @@ export function MasterAktivitasContent() {
|
||||
}
|
||||
|
||||
setShowActivityModal(false);
|
||||
setActivityForm({ id: '', name: '', description: '', time_type: 'umum' });
|
||||
setActivityForm({ id: '', name: '', description: '', time_type: '' });
|
||||
} catch (error) {
|
||||
console.error('Error saving activity:', error);
|
||||
toast.error('Terjadi kesalahan saat menyimpan aktivitas');
|
||||
@@ -423,6 +428,14 @@ export function MasterAktivitasContent() {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setInitialLoading(false);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedPhase(null);
|
||||
}, [selectedCategory]);
|
||||
|
||||
if (initialLoading) {
|
||||
return (
|
||||
<div className='min-h-screen'>
|
||||
|
||||
Reference in New Issue
Block a user