added user page, pimpinan page, e signature

This commit is contained in:
kicap 2023-08-03 17:58:40 +08:00
parent 30131e5ffe
commit 914e24706b
35 changed files with 2341 additions and 327 deletions

BIN
assets/qrcode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

View File

@ -1,8 +1,9 @@
import 'package:panti_asuhan/ui/views/admin_index_tracking/admin_index/admin_index_view.dart';
import 'package:panti_asuhan/ui/views/admin_index_tracking/dana_sosial_admin/dana_sosial_admin_view.dart'; import 'package:panti_asuhan/ui/views/admin_index_tracking/dana_sosial_admin/dana_sosial_admin_view.dart';
import 'package:panti_asuhan/ui/views/admin_index_tracking/data_siswa/data_siswa_view.dart'; import 'package:panti_asuhan/ui/views/admin_index_tracking/data_siswa/data_siswa_view.dart';
import 'package:panti_asuhan/ui/views/admin_index_tracking/edit_siswa/edit_siswa_view.dart'; import 'package:panti_asuhan/ui/views/admin_index_tracking/edit_siswa/edit_siswa_view.dart';
import 'package:panti_asuhan/ui/views/admin_index_tracking/profil/profil_view.dart'; import 'package:panti_asuhan/ui/views/admin_index_tracking/profil/profil_view.dart';
import 'package:panti_asuhan/ui/views/detail_dana_sosial/detail_dana_sosial_view.dart';
import 'package:panti_asuhan/ui/views/pimpinan_index_tracking/pimpinan_index_tracking/pimpinan_index_tracking_view.dart';
import 'package:panti_asuhan/ui/views/tambah_dana_sosial/tambah_dana_sosial_view.dart'; import 'package:panti_asuhan/ui/views/tambah_dana_sosial/tambah_dana_sosial_view.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
import 'package:stacked/stacked_annotations.dart'; import 'package:stacked/stacked_annotations.dart';
@ -11,11 +12,13 @@ import '../services/http_services.dart';
import '../services/my_easyloading.dart'; import '../services/my_easyloading.dart';
import '../ui/views/admin_index_tracking/add_siswa_dialog/add_siswa_dialog/add_siswa_dialog_view.dart'; import '../ui/views/admin_index_tracking/add_siswa_dialog/add_siswa_dialog/add_siswa_dialog_view.dart';
import '../ui/views/admin_index_tracking/admin_index_tracking_view.dart'; import '../ui/views/admin_index_tracking/admin_index_tracking_view.dart';
import '../ui/views/admin_index_tracking/filter_dialog/filter_dialog_view.dart';
import '../ui/views/admin_index_tracking/sejarah/sejarah_view.dart'; import '../ui/views/admin_index_tracking/sejarah/sejarah_view.dart';
import '../ui/views/admin_index_tracking/struktur_organisasi/struktur_organisasi_view.dart'; import '../ui/views/admin_index_tracking/struktur_organisasi/struktur_organisasi_view.dart';
import '../ui/views/admin_index_tracking/visi_misi/visi_misi_view.dart'; import '../ui/views/admin_index_tracking/visi_misi/visi_misi_view.dart';
import '../ui/views/login_screen/login_screen_view.dart'; import '../ui/views/login_screen/login_screen_view.dart';
import '../ui/views/splash_screen/splash_screen_view.dart'; import '../ui/views/splash_screen/splash_screen_view.dart';
import '../ui/views/user_index_tracking/user_index_tracking_view.dart';
@StackedApp( @StackedApp(
routes: [ routes: [
@ -24,7 +27,7 @@ import '../ui/views/splash_screen/splash_screen_view.dart';
MaterialRoute( MaterialRoute(
page: AdminIndexTrackingView, page: AdminIndexTrackingView,
children: [ children: [
MaterialRoute(page: AdminIndexView, initial: true), // MaterialRoute(page: AdminIndexView, initial: true),
MaterialRoute(page: DanaSosialAdminView), MaterialRoute(page: DanaSosialAdminView),
MaterialRoute(page: DataSiswaView), MaterialRoute(page: DataSiswaView),
MaterialRoute(page: ProfilView), MaterialRoute(page: ProfilView),
@ -34,10 +37,33 @@ import '../ui/views/splash_screen/splash_screen_view.dart';
], ],
), ),
MaterialRoute(page: TambahDanaSosialView), MaterialRoute(page: TambahDanaSosialView),
MaterialRoute(page: EditSiswaView) MaterialRoute(page: EditSiswaView),
MaterialRoute(page: DetailDanaSosialView),
MaterialRoute(
page: PimpinanIndexTrackingView,
children: [
// MaterialRoute(page: AdminIndexView, initial: true),
MaterialRoute(page: DanaSosialAdminView),
MaterialRoute(page: DataSiswaView),
MaterialRoute(page: ProfilView),
],
),
MaterialRoute(
page: UserIndexTrackingView,
children: [
// MaterialRoute(page: AdminIndexView, initial: true),
MaterialRoute(page: DanaSosialAdminView),
MaterialRoute(page: DataSiswaView),
MaterialRoute(page: ProfilView),
MaterialRoute(page: VisiMisiView),
MaterialRoute(page: SejarahView),
MaterialRoute(page: StrukturOrganisasiView),
],
),
], ],
dialogs: [ dialogs: [
StackedDialog(classType: AddSiswaDialogView), StackedDialog(classType: AddSiswaDialogView),
StackedDialog(classType: FilterDialogView),
], ],
dependencies: [ dependencies: [
LazySingleton(classType: NavigationService), LazySingleton(classType: NavigationService),

View File

@ -8,9 +8,11 @@ import 'package:stacked_services/stacked_services.dart';
import 'app.locator.dart'; import 'app.locator.dart';
import '../ui/views/admin_index_tracking/add_siswa_dialog/add_siswa_dialog/add_siswa_dialog_view.dart'; import '../ui/views/admin_index_tracking/add_siswa_dialog/add_siswa_dialog/add_siswa_dialog_view.dart';
import '../ui/views/admin_index_tracking/filter_dialog/filter_dialog_view.dart';
enum DialogType { enum DialogType {
addSiswaDialogView, addSiswaDialogView,
filterDialogView,
} }
void setupDialogUi() { void setupDialogUi() {
@ -19,6 +21,8 @@ void setupDialogUi() {
final Map<DialogType, DialogBuilder> builders = { final Map<DialogType, DialogBuilder> builders = {
DialogType.addSiswaDialogView: (context, request, completer) => DialogType.addSiswaDialogView: (context, request, completer) =>
AddSiswaDialogView(request: request, completer: completer), AddSiswaDialogView(request: request, completer: completer),
DialogType.filterDialogView: (context, request, completer) =>
FilterDialogView(request: request, completer: completer),
}; };
dialogService.registerCustomDialogBuilders(builders); dialogService.registerCustomDialogBuilders(builders);

View File

@ -5,34 +5,38 @@
// ************************************************************************** // **************************************************************************
// ignore_for_file: no_leading_underscores_for_library_prefixes // ignore_for_file: no_leading_underscores_for_library_prefixes
import 'package:flutter/material.dart' as _i7; import 'package:flutter/material.dart' as _i10;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:panti_asuhan/ui/views/admin_index_tracking/admin_index/admin_index_view.dart'
as _i8;
import 'package:panti_asuhan/ui/views/admin_index_tracking/admin_index_tracking_view.dart' import 'package:panti_asuhan/ui/views/admin_index_tracking/admin_index_tracking_view.dart'
as _i4; as _i4;
import 'package:panti_asuhan/ui/views/admin_index_tracking/dana_sosial_admin/dana_sosial_admin_view.dart' import 'package:panti_asuhan/ui/views/admin_index_tracking/dana_sosial_admin/dana_sosial_admin_view.dart'
as _i9; as _i11;
import 'package:panti_asuhan/ui/views/admin_index_tracking/data_siswa/data_siswa_view.dart' import 'package:panti_asuhan/ui/views/admin_index_tracking/data_siswa/data_siswa_view.dart'
as _i10; as _i12;
import 'package:panti_asuhan/ui/views/admin_index_tracking/edit_siswa/edit_siswa_view.dart' import 'package:panti_asuhan/ui/views/admin_index_tracking/edit_siswa/edit_siswa_view.dart'
as _i6; as _i6;
import 'package:panti_asuhan/ui/views/admin_index_tracking/profil/profil_view.dart' import 'package:panti_asuhan/ui/views/admin_index_tracking/profil/profil_view.dart'
as _i11;
import 'package:panti_asuhan/ui/views/admin_index_tracking/sejarah/sejarah_view.dart'
as _i13; as _i13;
import 'package:panti_asuhan/ui/views/admin_index_tracking/sejarah/sejarah_view.dart'
as _i15;
import 'package:panti_asuhan/ui/views/admin_index_tracking/struktur_organisasi/struktur_organisasi_view.dart' import 'package:panti_asuhan/ui/views/admin_index_tracking/struktur_organisasi/struktur_organisasi_view.dart'
as _i14; as _i16;
import 'package:panti_asuhan/ui/views/admin_index_tracking/visi_misi/visi_misi_view.dart' import 'package:panti_asuhan/ui/views/admin_index_tracking/visi_misi/visi_misi_view.dart'
as _i12; as _i14;
import 'package:panti_asuhan/ui/views/detail_dana_sosial/detail_dana_sosial_view.dart'
as _i7;
import 'package:panti_asuhan/ui/views/login_screen/login_screen_view.dart' import 'package:panti_asuhan/ui/views/login_screen/login_screen_view.dart'
as _i3; as _i3;
import 'package:panti_asuhan/ui/views/pimpinan_index_tracking/pimpinan_index_tracking/pimpinan_index_tracking_view.dart'
as _i8;
import 'package:panti_asuhan/ui/views/splash_screen/splash_screen_view.dart' import 'package:panti_asuhan/ui/views/splash_screen/splash_screen_view.dart'
as _i2; as _i2;
import 'package:panti_asuhan/ui/views/tambah_dana_sosial/tambah_dana_sosial_view.dart' import 'package:panti_asuhan/ui/views/tambah_dana_sosial/tambah_dana_sosial_view.dart'
as _i5; as _i5;
import 'package:panti_asuhan/ui/views/user_index_tracking/user_index_tracking_view.dart'
as _i9;
import 'package:stacked/stacked.dart' as _i1; import 'package:stacked/stacked.dart' as _i1;
import 'package:stacked_services/stacked_services.dart' as _i15; import 'package:stacked_services/stacked_services.dart' as _i17;
class Routes { class Routes {
static const splashScreenView = '/'; static const splashScreenView = '/';
@ -45,12 +49,21 @@ class Routes {
static const editSiswaView = '/edit-siswa-view'; static const editSiswaView = '/edit-siswa-view';
static const detailDanaSosialView = '/detail-dana-sosial-view';
static const pimpinanIndexTrackingView = '/pimpinan-index-tracking-view';
static const userIndexTrackingView = '/user-index-tracking-view';
static const all = <String>{ static const all = <String>{
splashScreenView, splashScreenView,
loginScreenView, loginScreenView,
adminIndexTrackingView, adminIndexTrackingView,
tambahDanaSosialView, tambahDanaSosialView,
editSiswaView, editSiswaView,
detailDanaSosialView,
pimpinanIndexTrackingView,
userIndexTrackingView,
}; };
} }
@ -76,32 +89,44 @@ class StackedRouter extends _i1.RouterBase {
Routes.editSiswaView, Routes.editSiswaView,
page: _i6.EditSiswaView, page: _i6.EditSiswaView,
), ),
_i1.RouteDef(
Routes.detailDanaSosialView,
page: _i7.DetailDanaSosialView,
),
_i1.RouteDef(
Routes.pimpinanIndexTrackingView,
page: _i8.PimpinanIndexTrackingView,
),
_i1.RouteDef(
Routes.userIndexTrackingView,
page: _i9.UserIndexTrackingView,
),
]; ];
final _pagesMap = <Type, _i1.StackedRouteFactory>{ final _pagesMap = <Type, _i1.StackedRouteFactory>{
_i2.SplashScreenView: (data) { _i2.SplashScreenView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i2.SplashScreenView(), builder: (context) => const _i2.SplashScreenView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i3.LoginScreenView: (data) { _i3.LoginScreenView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i3.LoginScreenView(), builder: (context) => const _i3.LoginScreenView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i4.AdminIndexTrackingView: (data) { _i4.AdminIndexTrackingView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i4.AdminIndexTrackingView(), builder: (context) => const _i4.AdminIndexTrackingView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i5.TambahDanaSosialView: (data) { _i5.TambahDanaSosialView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i5.TambahDanaSosialView(), builder: (context) => const _i5.TambahDanaSosialView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
@ -109,13 +134,36 @@ class StackedRouter extends _i1.RouterBase {
}, },
_i6.EditSiswaView: (data) { _i6.EditSiswaView: (data) {
final args = data.getArgs<EditSiswaViewArguments>(nullOk: false); final args = data.getArgs<EditSiswaViewArguments>(nullOk: false);
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => builder: (context) =>
_i6.EditSiswaView(idSiswa: args.idSiswa, key: args.key), _i6.EditSiswaView(idSiswa: args.idSiswa, key: args.key),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i7.DetailDanaSosialView: (data) {
final args = data.getArgs<DetailDanaSosialViewArguments>(nullOk: false);
return _i10.MaterialPageRoute<dynamic>(
builder: (context) =>
_i7.DetailDanaSosialView(key: args.key, id: args.id),
settings: data,
maintainState: false,
);
},
_i8.PimpinanIndexTrackingView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i8.PimpinanIndexTrackingView(),
settings: data,
maintainState: false,
);
},
_i9.UserIndexTrackingView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i9.UserIndexTrackingView(),
settings: data,
maintainState: false,
);
},
}; };
@override @override
@ -132,7 +180,7 @@ class EditSiswaViewArguments {
final int idSiswa; final int idSiswa;
final _i7.Key? key; final _i10.Key? key;
@override @override
String toString() { String toString() {
@ -140,9 +188,23 @@ class EditSiswaViewArguments {
} }
} }
class AdminIndexTrackingViewRoutes { class DetailDanaSosialViewArguments {
static const adminIndexView = ''; const DetailDanaSosialViewArguments({
this.key,
required this.id,
});
final _i10.Key? key;
final int id;
@override
String toString() {
return '{"key": "$key", "id": "$id"}';
}
}
class AdminIndexTrackingViewRoutes {
static const danaSosialAdminView = 'dana-sosial-admin-view'; static const danaSosialAdminView = 'dana-sosial-admin-view';
static const dataSiswaView = 'data-siswa-view'; static const dataSiswaView = 'data-siswa-view';
@ -156,7 +218,6 @@ class AdminIndexTrackingViewRoutes {
static const strukturOrganisasiView = 'struktur-organisasi-view'; static const strukturOrganisasiView = 'struktur-organisasi-view';
static const all = <String>{ static const all = <String>{
adminIndexView,
danaSosialAdminView, danaSosialAdminView,
dataSiswaView, dataSiswaView,
profilView, profilView,
@ -168,82 +229,71 @@ class AdminIndexTrackingViewRoutes {
class AdminIndexTrackingViewRouter extends _i1.RouterBase { class AdminIndexTrackingViewRouter extends _i1.RouterBase {
final _routes = <_i1.RouteDef>[ final _routes = <_i1.RouteDef>[
_i1.RouteDef(
AdminIndexTrackingViewRoutes.adminIndexView,
page: _i8.AdminIndexView,
),
_i1.RouteDef( _i1.RouteDef(
AdminIndexTrackingViewRoutes.danaSosialAdminView, AdminIndexTrackingViewRoutes.danaSosialAdminView,
page: _i9.DanaSosialAdminView, page: _i11.DanaSosialAdminView,
), ),
_i1.RouteDef( _i1.RouteDef(
AdminIndexTrackingViewRoutes.dataSiswaView, AdminIndexTrackingViewRoutes.dataSiswaView,
page: _i10.DataSiswaView, page: _i12.DataSiswaView,
), ),
_i1.RouteDef( _i1.RouteDef(
AdminIndexTrackingViewRoutes.profilView, AdminIndexTrackingViewRoutes.profilView,
page: _i11.ProfilView, page: _i13.ProfilView,
), ),
_i1.RouteDef( _i1.RouteDef(
AdminIndexTrackingViewRoutes.visiMisiView, AdminIndexTrackingViewRoutes.visiMisiView,
page: _i12.VisiMisiView, page: _i14.VisiMisiView,
), ),
_i1.RouteDef( _i1.RouteDef(
AdminIndexTrackingViewRoutes.sejarahView, AdminIndexTrackingViewRoutes.sejarahView,
page: _i13.SejarahView, page: _i15.SejarahView,
), ),
_i1.RouteDef( _i1.RouteDef(
AdminIndexTrackingViewRoutes.strukturOrganisasiView, AdminIndexTrackingViewRoutes.strukturOrganisasiView,
page: _i14.StrukturOrganisasiView, page: _i16.StrukturOrganisasiView,
), ),
]; ];
final _pagesMap = <Type, _i1.StackedRouteFactory>{ final _pagesMap = <Type, _i1.StackedRouteFactory>{
_i8.AdminIndexView: (data) { _i11.DanaSosialAdminView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i8.AdminIndexView(), builder: (context) => const _i11.DanaSosialAdminView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i9.DanaSosialAdminView: (data) { _i12.DataSiswaView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i9.DanaSosialAdminView(), builder: (context) => const _i12.DataSiswaView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i10.DataSiswaView: (data) { _i13.ProfilView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i10.DataSiswaView(), builder: (context) => const _i13.ProfilView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i11.ProfilView: (data) { _i14.VisiMisiView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i11.ProfilView(), builder: (context) => const _i14.VisiMisiView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i12.VisiMisiView: (data) { _i15.SejarahView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => _i12.VisiMisiView(), builder: (context) => const _i15.SejarahView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
}, },
_i13.SejarahView: (data) { _i16.StrukturOrganisasiView: (data) {
return _i7.MaterialPageRoute<dynamic>( return _i10.MaterialPageRoute<dynamic>(
builder: (context) => _i13.SejarahView(), builder: (context) => const _i16.StrukturOrganisasiView(),
settings: data,
maintainState: false,
);
},
_i14.StrukturOrganisasiView: (data) {
return _i7.MaterialPageRoute<dynamic>(
builder: (context) => _i14.StrukturOrganisasiView(),
settings: data, settings: data,
maintainState: false, maintainState: false,
); );
@ -256,7 +306,169 @@ class AdminIndexTrackingViewRouter extends _i1.RouterBase {
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap; Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
} }
extension NavigatorStateExtension on _i15.NavigationService { class PimpinanIndexTrackingViewRoutes {
static const danaSosialAdminView = 'dana-sosial-admin-view';
static const dataSiswaView = 'data-siswa-view';
static const profilView = 'profil-view';
static const all = <String>{
danaSosialAdminView,
dataSiswaView,
profilView,
};
}
class PimpinanIndexTrackingViewRouter extends _i1.RouterBase {
final _routes = <_i1.RouteDef>[
_i1.RouteDef(
PimpinanIndexTrackingViewRoutes.danaSosialAdminView,
page: _i11.DanaSosialAdminView,
),
_i1.RouteDef(
PimpinanIndexTrackingViewRoutes.dataSiswaView,
page: _i12.DataSiswaView,
),
_i1.RouteDef(
PimpinanIndexTrackingViewRoutes.profilView,
page: _i13.ProfilView,
),
];
final _pagesMap = <Type, _i1.StackedRouteFactory>{
_i11.DanaSosialAdminView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i11.DanaSosialAdminView(),
settings: data,
maintainState: false,
);
},
_i12.DataSiswaView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i12.DataSiswaView(),
settings: data,
maintainState: false,
);
},
_i13.ProfilView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i13.ProfilView(),
settings: data,
maintainState: false,
);
},
};
@override
List<_i1.RouteDef> get routes => _routes;
@override
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
}
class UserIndexTrackingViewRoutes {
static const danaSosialAdminView = 'dana-sosial-admin-view';
static const dataSiswaView = 'data-siswa-view';
static const profilView = 'profil-view';
static const visiMisiView = 'visi-misi-view';
static const sejarahView = 'sejarah-view';
static const strukturOrganisasiView = 'struktur-organisasi-view';
static const all = <String>{
danaSosialAdminView,
dataSiswaView,
profilView,
visiMisiView,
sejarahView,
strukturOrganisasiView,
};
}
class UserIndexTrackingViewRouter extends _i1.RouterBase {
final _routes = <_i1.RouteDef>[
_i1.RouteDef(
UserIndexTrackingViewRoutes.danaSosialAdminView,
page: _i11.DanaSosialAdminView,
),
_i1.RouteDef(
UserIndexTrackingViewRoutes.dataSiswaView,
page: _i12.DataSiswaView,
),
_i1.RouteDef(
UserIndexTrackingViewRoutes.profilView,
page: _i13.ProfilView,
),
_i1.RouteDef(
UserIndexTrackingViewRoutes.visiMisiView,
page: _i14.VisiMisiView,
),
_i1.RouteDef(
UserIndexTrackingViewRoutes.sejarahView,
page: _i15.SejarahView,
),
_i1.RouteDef(
UserIndexTrackingViewRoutes.strukturOrganisasiView,
page: _i16.StrukturOrganisasiView,
),
];
final _pagesMap = <Type, _i1.StackedRouteFactory>{
_i11.DanaSosialAdminView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i11.DanaSosialAdminView(),
settings: data,
maintainState: false,
);
},
_i12.DataSiswaView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i12.DataSiswaView(),
settings: data,
maintainState: false,
);
},
_i13.ProfilView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i13.ProfilView(),
settings: data,
maintainState: false,
);
},
_i14.VisiMisiView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i14.VisiMisiView(),
settings: data,
maintainState: false,
);
},
_i15.SejarahView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i15.SejarahView(),
settings: data,
maintainState: false,
);
},
_i16.StrukturOrganisasiView: (data) {
return _i10.MaterialPageRoute<dynamic>(
builder: (context) => const _i16.StrukturOrganisasiView(),
settings: data,
maintainState: false,
);
},
};
@override
List<_i1.RouteDef> get routes => _routes;
@override
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
}
extension NavigatorStateExtension on _i17.NavigationService {
Future<dynamic> navigateToSplashScreenView([ Future<dynamic> navigateToSplashScreenView([
int? routerId, int? routerId,
bool preventDuplicates = true, bool preventDuplicates = true,
@ -315,7 +527,7 @@ extension NavigatorStateExtension on _i15.NavigationService {
Future<dynamic> navigateToEditSiswaView({ Future<dynamic> navigateToEditSiswaView({
required int idSiswa, required int idSiswa,
_i7.Key? key, _i10.Key? key,
int? routerId, int? routerId,
bool preventDuplicates = true, bool preventDuplicates = true,
Map<String, String>? parameters, Map<String, String>? parameters,
@ -330,14 +542,45 @@ extension NavigatorStateExtension on _i15.NavigationService {
transition: transition); transition: transition);
} }
Future<dynamic> navigateToNestedAdminIndexViewInAdminIndexTrackingViewRouter([ Future<dynamic> navigateToDetailDanaSosialView({
_i10.Key? key,
required int id,
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return navigateTo<dynamic>(Routes.detailDanaSosialView,
arguments: DetailDanaSosialViewArguments(key: key, id: id),
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> navigateToPimpinanIndexTrackingView([
int? routerId, int? routerId,
bool preventDuplicates = true, bool preventDuplicates = true,
Map<String, String>? parameters, Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)? Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition, transition,
]) async { ]) async {
return navigateTo<dynamic>(AdminIndexTrackingViewRoutes.adminIndexView, return navigateTo<dynamic>(Routes.pimpinanIndexTrackingView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> navigateToUserIndexTrackingView([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(Routes.userIndexTrackingView,
id: routerId, id: routerId,
preventDuplicates: preventDuplicates, preventDuplicates: preventDuplicates,
parameters: parameters, parameters: parameters,
@ -431,6 +674,138 @@ extension NavigatorStateExtension on _i15.NavigationService {
transition: transition); transition: transition);
} }
Future<dynamic>
navigateToNestedDanaSosialAdminViewInPimpinanIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(
PimpinanIndexTrackingViewRoutes.danaSosialAdminView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic>
navigateToNestedDataSiswaViewInPimpinanIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(PimpinanIndexTrackingViewRoutes.dataSiswaView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> navigateToNestedProfilViewInPimpinanIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(PimpinanIndexTrackingViewRoutes.profilView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic>
navigateToNestedDanaSosialAdminViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(UserIndexTrackingViewRoutes.danaSosialAdminView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> navigateToNestedDataSiswaViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(UserIndexTrackingViewRoutes.dataSiswaView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> navigateToNestedProfilViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(UserIndexTrackingViewRoutes.profilView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> navigateToNestedVisiMisiViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(UserIndexTrackingViewRoutes.visiMisiView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> navigateToNestedSejarahViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(UserIndexTrackingViewRoutes.sejarahView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic>
navigateToNestedStrukturOrganisasiViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return navigateTo<dynamic>(
UserIndexTrackingViewRoutes.strukturOrganisasiView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithSplashScreenView([ Future<dynamic> replaceWithSplashScreenView([
int? routerId, int? routerId,
bool preventDuplicates = true, bool preventDuplicates = true,
@ -489,7 +864,7 @@ extension NavigatorStateExtension on _i15.NavigationService {
Future<dynamic> replaceWithEditSiswaView({ Future<dynamic> replaceWithEditSiswaView({
required int idSiswa, required int idSiswa,
_i7.Key? key, _i10.Key? key,
int? routerId, int? routerId,
bool preventDuplicates = true, bool preventDuplicates = true,
Map<String, String>? parameters, Map<String, String>? parameters,
@ -504,15 +879,45 @@ extension NavigatorStateExtension on _i15.NavigationService {
transition: transition); transition: transition);
} }
Future<dynamic> Future<dynamic> replaceWithDetailDanaSosialView({
replaceWithNestedAdminIndexViewInAdminIndexTrackingViewRouter([ _i10.Key? key,
required int id,
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
}) async {
return replaceWith<dynamic>(Routes.detailDanaSosialView,
arguments: DetailDanaSosialViewArguments(key: key, id: id),
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithPimpinanIndexTrackingView([
int? routerId, int? routerId,
bool preventDuplicates = true, bool preventDuplicates = true,
Map<String, String>? parameters, Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)? Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition, transition,
]) async { ]) async {
return replaceWith<dynamic>(AdminIndexTrackingViewRoutes.adminIndexView, return replaceWith<dynamic>(Routes.pimpinanIndexTrackingView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithUserIndexTrackingView([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(Routes.userIndexTrackingView,
id: routerId, id: routerId,
preventDuplicates: preventDuplicates, preventDuplicates: preventDuplicates,
parameters: parameters, parameters: parameters,
@ -606,4 +1011,136 @@ extension NavigatorStateExtension on _i15.NavigationService {
parameters: parameters, parameters: parameters,
transition: transition); transition: transition);
} }
Future<dynamic>
replaceWithNestedDanaSosialAdminViewInPimpinanIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(
PimpinanIndexTrackingViewRoutes.danaSosialAdminView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic>
replaceWithNestedDataSiswaViewInPimpinanIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(PimpinanIndexTrackingViewRoutes.dataSiswaView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithNestedProfilViewInPimpinanIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(PimpinanIndexTrackingViewRoutes.profilView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic>
replaceWithNestedDanaSosialAdminViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(UserIndexTrackingViewRoutes.danaSosialAdminView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithNestedDataSiswaViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(UserIndexTrackingViewRoutes.dataSiswaView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithNestedProfilViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(UserIndexTrackingViewRoutes.profilView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithNestedVisiMisiViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(UserIndexTrackingViewRoutes.visiMisiView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic> replaceWithNestedSejarahViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(UserIndexTrackingViewRoutes.sejarahView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
Future<dynamic>
replaceWithNestedStrukturOrganisasiViewInUserIndexTrackingViewRouter([
int? routerId,
bool preventDuplicates = true,
Map<String, String>? parameters,
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
transition,
]) async {
return replaceWith<dynamic>(
UserIndexTrackingViewRoutes.strukturOrganisasiView,
id: routerId,
preventDuplicates: preventDuplicates,
parameters: parameters,
transition: transition);
}
} }

View File

@ -1,3 +1,4 @@
import 'package:shared_preferences/shared_preferences.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
@ -8,6 +9,7 @@ class CustomBaseViewModel extends BaseViewModel {
final navigationService = locator<NavigationService>(); final navigationService = locator<NavigationService>();
final bottomSheetService = locator<BottomSheetService>(); final bottomSheetService = locator<BottomSheetService>();
final snackbarService = locator<SnackbarService>(); final snackbarService = locator<SnackbarService>();
final Future<SharedPreferences> prefs = SharedPreferences.getInstance();
void back() { void back() {
navigationService.back(); navigationService.back();

View File

@ -1,3 +0,0 @@
#!/bin/bash
ffmpeg -i "rtsp://admin:admin123@192.168.2.109/cam/realmonitor?channel=1&subtype=1" -acodec copy -vcodec copy abcd.mp4 -y

View File

@ -3,6 +3,9 @@ class DanaSosialModel {
String? nama; String? nama;
String? jumlah; String? jumlah;
String? tanggal; String? tanggal;
String? keterangan;
String? jenisDonasi;
String? status;
String? createdAt; String? createdAt;
String? updatedAt; String? updatedAt;
@ -12,6 +15,9 @@ class DanaSosialModel {
this.nama, this.nama,
this.jumlah, this.jumlah,
this.tanggal, this.tanggal,
this.keterangan,
this.jenisDonasi,
this.status,
this.createdAt, this.createdAt,
this.updatedAt}); this.updatedAt});
@ -20,6 +26,10 @@ class DanaSosialModel {
nama = json['nama']; nama = json['nama'];
jumlah = json['jumlah']; jumlah = json['jumlah'];
tanggal = json['tanggal']; tanggal = json['tanggal'];
keterangan = json['ket'];
jenisDonasi = json['jenis'];
status =
json['status'] == '0' ? 'Belum Dikonfirmasi' : 'Sudah Dikonfirmasi';
createdAt = json['created_at']; createdAt = json['created_at'];
updatedAt = json['updated_at']; updatedAt = json['updated_at'];
} }
@ -30,6 +40,9 @@ class DanaSosialModel {
data['nama'] = nama; data['nama'] = nama;
data['jumlah'] = jumlah; data['jumlah'] = jumlah;
data['tanggal'] = tanggal; data['tanggal'] = tanggal;
data['ket'] = keterangan;
data['jenis'] = jenisDonasi;
data['status'] = status;
data['created_at'] = createdAt; data['created_at'] = createdAt;
data['updated_at'] = updatedAt; data['updated_at'] = updatedAt;
return data; return data;

View File

@ -15,4 +15,35 @@ class OtherFunction {
final formatter = NumberFormat('#,###'); final formatter = NumberFormat('#,###');
return formatter.format(number); return formatter.format(number);
} }
String changeMonth(String month) {
switch (month) {
case 'Januari':
return '01';
case 'Februari':
return '02';
case 'Maret':
return '03';
case 'April':
return '04';
case 'Mei':
return '05';
case 'Juni':
return '06';
case 'Juli':
return '07';
case 'Agustus':
return '08';
case 'September':
return '09';
case 'Oktober':
return '10';
case 'November':
return '11';
case 'Desember':
return '12';
default:
return '';
}
}
} }

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/themes/app_text.dart';
import 'package:panti_asuhan/ui/widgets/my_textformfield.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
import 'package:validatorless/validatorless.dart'; import 'package:validatorless/validatorless.dart';
import '../../../../../app/themes/app_colors.dart'; import '../../../../../app/themes/app_colors.dart';
import '../../../../../app/themes/app_text.dart';
import '../../../../widgets/my_textformfield.dart';
import './add_siswa_dialog_view_model.dart'; import './add_siswa_dialog_view_model.dart';
class DataSiswa { class DataSiswa {

View File

@ -36,12 +36,21 @@ class AdminIndexTrackingView extends StatelessWidget {
backgroundColor: mainColor, backgroundColor: mainColor,
elevation: 0, elevation: 0,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
actions: [
IconButton(
onPressed: () {
model.logout();
},
icon: const Icon(Icons.logout, color: Colors.white),
),
],
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15), padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
child: ExtendedNavigator( child: ExtendedNavigator(
navigatorKey: StackedService.nestedNavigationKey(3), navigatorKey: StackedService.nestedNavigationKey(3),
router: AdminIndexTrackingViewRouter(), router: AdminIndexTrackingViewRouter(),
initialRoute: AdminIndexTrackingViewRoutes.danaSosialAdminView,
), ),
), ),
bottomNavigationBar: StylishBottomBar( bottomNavigationBar: StylishBottomBar(

View File

@ -1,14 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/app.router.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
import '../../../app/app.locator.dart'; import '../../../app/app.locator.dart';
import '../../../app/app.logger.dart'; import '../../../app/app.logger.dart';
import '../../../app/app.router.dart';
class AdminIndexTrackingViewModel extends IndexTrackingViewModel { class AdminIndexTrackingViewModel extends IndexTrackingViewModel {
final log = getLogger('AdminIndexTrackingViewModel'); final log = getLogger('AdminIndexTrackingViewModel');
final _navigationService = locator<NavigationService>(); final _navigationService = locator<NavigationService>();
final _dialogService = locator<DialogService>();
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
final _bottomNavBarList = [ final _bottomNavBarList = [
{ {
@ -47,11 +50,11 @@ class AdminIndexTrackingViewModel extends IndexTrackingViewModel {
Future<void> init() async { Future<void> init() async {
setIndex(1); setIndex(1);
// await 2 seconds to make sure the view is loaded // await 2 seconds to make sure the view is loaded
await Future.delayed(const Duration(milliseconds: 500)); // await Future.delayed(const Duration(milliseconds: 500));
_navigationService.navigateTo( // _navigationService.navigateTo(
_views[1], // _views[1],
id: 3, // id: 3,
); // );
} }
void handleNavigation(int index) { void handleNavigation(int index) {
@ -67,4 +70,26 @@ class AdminIndexTrackingViewModel extends IndexTrackingViewModel {
id: 3, id: 3,
); );
} }
logout() {
_dialogService
.showConfirmationDialog(
title: 'Logout',
description: 'Apakah anda yakin ingin logout?',
cancelTitle: 'Ya',
confirmationTitle: 'Tidak',
// barrierDismissible: true,
)
.then((value) {
if (!value!.confirmed) {
_prefs.then((SharedPreferences prefs) {
prefs.setBool('isLogin', false);
prefs.remove('role');
_navigationService.clearStackAndShow(Routes.loginScreenView);
});
} else {
_navigationService.back();
}
});
}
} }

View File

@ -1,9 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/themes/app_colors.dart';
import 'package:panti_asuhan/services/other_function.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import '../../../../app/themes/app_colors.dart';
import '../../../../app/themes/app_text.dart'; import '../../../../app/themes/app_text.dart';
import '../../../../services/other_function.dart';
import './dana_sosial_admin_view_model.dart'; import './dana_sosial_admin_view_model.dart';
class DanaSosialAdminView extends StatelessWidget { class DanaSosialAdminView extends StatelessWidget {
@ -24,9 +24,13 @@ class DanaSosialAdminView extends StatelessWidget {
return Scaffold( return Scaffold(
body: Column( body: Column(
children: [ children: [
Container( Row(
padding: mainAxisAlignment: MainAxisAlignment.spaceBetween,
const EdgeInsets.symmetric(horizontal: 15, vertical: 10), children: [
Expanded(
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 15, vertical: 10),
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
color: mainColor, color: mainColor,
@ -36,7 +40,8 @@ class DanaSosialAdminView extends StatelessWidget {
color: mainGrey.withOpacity(0.5), color: mainGrey.withOpacity(0.5),
spreadRadius: 5, spreadRadius: 5,
blurRadius: 7, blurRadius: 7,
offset: const Offset(0, 3), // changes position of shadow offset: const Offset(
0, 3), // changes position of shadow
), ),
], ],
), ),
@ -73,6 +78,27 @@ class DanaSosialAdminView extends StatelessWidget {
], ],
), ),
), ),
),
const SizedBox(width: 10),
Container(
width: 50,
height: 50,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: mainColor,
),
child: IconButton(
icon: const Icon(
Icons.filter_list,
color: Colors.white,
),
onPressed: () {
model.filterDialog(context);
},
),
),
],
),
const SizedBox(height: 25), const SizedBox(height: 25),
Expanded( Expanded(
child: Container( child: Container(
@ -98,36 +124,75 @@ class DanaSosialAdminView extends StatelessWidget {
), ),
), ),
) )
: ListView.builder( : const TheData(),
padding: const EdgeInsets.symmetric( ),
horizontal: 15, vertical: 10), ),
itemCount: model.danaSosialModelList.length, ],
),
floatingActionButton: model.role == 'admin'
? FloatingActionButton(
onPressed: () {
model.goToTambahDanaSosial();
},
child: const Icon(Icons.add),
)
: null,
);
},
);
}
}
class TheData extends ViewModelWidget<DanaSosialAdminViewModel> {
const TheData({
super.key,
});
@override
Widget build(BuildContext context, DanaSosialAdminViewModel viewModel) {
return ListView.builder(
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
itemCount: viewModel.danaSosialModelList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
String jumlahDonasi = OtherFunction().commaFormat( String jumlahDonasi = viewModel
int.parse( .danaSosialModelList[index].jenisDonasi !=
model.danaSosialModelList[index].jumlah ?? 'Barang'
'0')); ? OtherFunction().commaFormat(
int.parse(viewModel.danaSosialModelList[index].jumlah ?? '0'))
: '0';
return Card( return Card(
child: ListTile( child: ListTile(
title: Text( title: Text(viewModel.danaSosialModelList[index].tanggal ?? '',
model.danaSosialModelList[index].tanggal ?? style: boldTextStyle.copyWith(fontSize: 13, color: mainColor)),
'',
style: boldTextStyle.copyWith(
fontSize: 13, color: mainColor)),
subtitle: Column( subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(viewModel.danaSosialModelList[index].nama ?? '',
style: regularTextStyle.copyWith(
fontSize: 13, color: mainColor)),
Text( Text(
model.danaSosialModelList[index].nama ?? viewModel.danaSosialModelList[index].jenisDonasi == 'Uang'
'', ? (viewModel.isLogin == true ? 'Rp. $jumlahDonasi' : '-')
: 'Donasi Barang',
style:
regularTextStyle.copyWith(fontSize: 13, color: mainColor),
),
Text(
viewModel.danaSosialModelList[index].status ?? '',
style: regularTextStyle.copyWith( style: regularTextStyle.copyWith(
fontSize: 13, color: mainColor)), fontSize: 13,
Text('Rp. $jumlahDonasi', color: viewModel.danaSosialModelList[index].status ==
style: regularTextStyle.copyWith( 'Belum Dikonfirmasi'
fontSize: 13, color: mainColor)), ? Colors.red
: Colors.green,
),
),
], ],
), ),
trailing: Container( trailing: viewModel.isLogin == null
? null
: (viewModel.isLogin == true
? Container(
width: 50, width: 50,
height: 50, height: 50,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -136,27 +201,16 @@ class DanaSosialAdminView extends StatelessWidget {
), ),
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {
// model.goToTambahDanaSosial(); viewModel.goToEditDanaSosial(int.parse(viewModel
.danaSosialModelList[index].idDanaSosial!));
}, },
icon: const Icon( icon: const Icon(
Icons.edit, Icons.edit,
color: Colors.white, color: Colors.white,
), ),
), ),
), )
), : null),
);
},
),
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () {
model.goToTambahDanaSosial();
},
child: const Icon(Icons.add),
), ),
); );
}, },

View File

@ -1,3 +1,8 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../../app/app.dialogs.dart';
import '../../../../app/app.locator.dart'; import '../../../../app/app.locator.dart';
import '../../../../app/app.logger.dart'; import '../../../../app/app.logger.dart';
import '../../../../app/app.router.dart'; import '../../../../app/app.router.dart';
@ -5,6 +10,7 @@ import '../../../../app/core/custom_base_view_model.dart';
import '../../../../model/dana_sosial_model.dart'; import '../../../../model/dana_sosial_model.dart';
import '../../../../services/http_services.dart'; import '../../../../services/http_services.dart';
import '../../../../services/my_easyloading.dart'; import '../../../../services/my_easyloading.dart';
import '../../../../services/other_function.dart';
class DanaSosialAdminViewModel extends CustomBaseViewModel { class DanaSosialAdminViewModel extends CustomBaseViewModel {
final log = getLogger('DanaSosialAdminViewModel'); final log = getLogger('DanaSosialAdminViewModel');
@ -13,8 +19,15 @@ class DanaSosialAdminViewModel extends CustomBaseViewModel {
List<DanaSosialModel> danaSosialModelList = []; List<DanaSosialModel> danaSosialModelList = [];
String? role;
bool? isLogin;
Future<void> init() async { Future<void> init() async {
await getData(); await getData();
prefs.then((SharedPreferences prefs) {
role = prefs.getString('role');
isLogin = prefs.getBool('isLogin');
});
} }
getData() async { getData() async {
@ -47,4 +60,93 @@ class DanaSosialAdminViewModel extends CustomBaseViewModel {
goToTambahDanaSosial() { goToTambahDanaSosial() {
navigationService.navigateTo(Routes.tambahDanaSosialView); navigationService.navigateTo(Routes.tambahDanaSosialView);
} }
getFilter(String sql) async {
setBusy(true);
easyLoading.showLoading();
FormData formData = FormData.fromMap({
'sql': sql,
});
try {
var response = await _httpService.postWithFormData(
'filter_dana',
formData,
);
log.i(response.data);
danaSosialModelList = [];
var datanya = response.data['data'];
// log.i(datanya.length);
if (datanya.length > 0) {
for (var item in datanya) {
danaSosialModelList.add(DanaSosialModel.fromJson(item));
}
}
setBusy(false);
notifyListeners();
log.i(danaSosialModelList);
} catch (e) {
log.e(e);
setBusy(false);
} finally {
easyLoading.dismissLoading();
}
}
filterDialog(BuildContext context) async {
// create a dialog
final res = await dialogService.showCustomDialog(
variant: DialogType.filterDialogView,
);
if (res!.confirmed) {
String jenisDonasi = res.data['jenisDonasi'] == 'Semua'
? ''
: "jenis = '${res.data['jenisDonasi']}' and ";
String bulan = res.data['bulan'] == 'Semua'
? ''
: "tanggal like '%-${OtherFunction().changeMonth(res.data['bulan'])}-%' and ";
String tahun = res.data['tahun'] == 'Semua'
? ''
: 'tanggal like "%${res.data['tahun']}-%" and ';
String status = res.data['status'] == 'Semua'
? ''
: (res.data['status'] == 'Belum Dikonfirmasi')
? 'status = 0'
: 'status = 1';
if (jenisDonasi == 'Semua' &&
bulan == 'Semua' &&
tahun == 'Semua' &&
status == 'Semua') {
getData();
return;
}
String sql =
'Select * from tb_dana_sosial where $jenisDonasi$bulan$tahun$status';
// check the last 3 character if it is 'or ' then remove it
// if (sql.substring(sql.length - 3) == 'or ') {
// sql = sql.substring(0, sql.length - 3);
// }
if (sql.substring(sql.length - 4) == 'and ') {
sql = sql.substring(0, sql.length - 4);
}
log.i(sql);
getFilter(sql);
}
}
goToEditDanaSosial(int id) async {
navigationService.navigateTo(
Routes.detailDanaSosialView,
arguments: DetailDanaSosialViewArguments(
id: id,
),
);
}
} }

View File

@ -127,12 +127,14 @@ class DataSiswaView extends StatelessWidget {
), ),
], ],
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: model.role == 'admin'
? FloatingActionButton(
onPressed: () { onPressed: () {
model.addSiswa(); model.addSiswa();
}, },
child: const Icon(Icons.add), child: const Icon(Icons.add),
), )
: null,
); );
}, },
); );

View File

@ -1,4 +1,5 @@
import 'package:panti_asuhan/ui/views/admin_index_tracking/edit_siswa/edit_siswa_view.dart'; import 'package:panti_asuhan/ui/views/admin_index_tracking/edit_siswa/edit_siswa_view.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../../app/app.dialogs.dart'; import '../../../../app/app.dialogs.dart';
import '../../../../app/app.locator.dart'; import '../../../../app/app.locator.dart';
@ -16,8 +17,13 @@ class DataSiswaViewModel extends CustomBaseViewModel {
List<SiswaModel> siswaModelList = []; List<SiswaModel> siswaModelList = [];
String? role;
Future<void> init() async { Future<void> init() async {
await getData(); await getData();
prefs.then((SharedPreferences prefs) {
role = prefs.getString('role');
});
} }
getData() async { getData() async {

View File

@ -0,0 +1,284 @@
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import '../../../../app/themes/app_colors.dart';
import '../../../../app/themes/app_text.dart';
import './filter_dialog_view_model.dart';
class FilterDialogView extends StatelessWidget {
final DialogRequest? request;
final Function(DialogResponse)? completer;
const FilterDialogView({
Key? key,
this.request,
this.completer,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ViewModelBuilder<FilterDialogViewModel>.reactive(
viewModelBuilder: () => FilterDialogViewModel(),
onViewModelReady: (FilterDialogViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
FilterDialogViewModel model,
Widget? child,
) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
padding: const EdgeInsets.all(10),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"FILTER LAPORAN",
style: boldTextStyle.copyWith(
fontSize: 16,
),
),
const SizedBox(height: 10),
Align(
alignment: Alignment.centerLeft,
child: Text(
"Jenis Dana Sosial",
style: regularTextStyle.copyWith(color: mainColor),
textAlign: TextAlign.left,
),
),
Container(
width: double.infinity,
height: 60,
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
border: Border.all(
color: mainColor,
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: model.jenisDonasi,
onChanged: (String? newValue) {
// model.setSelectedjenisDonasi(newValue!);
model.log.i(newValue);
model.jenisDonasi = newValue!;
model.notifyListeners();
},
items: model.jenisDonasiList.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: regularTextStyle.copyWith(
fontSize: 16,
),
),
);
}).toList(),
),
),
),
const SizedBox(height: 10),
Align(
alignment: Alignment.centerLeft,
child: Text(
"Filter Bulan",
style: regularTextStyle.copyWith(color: mainColor),
textAlign: TextAlign.left,
),
),
Container(
width: double.infinity,
height: 60,
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
border: Border.all(
color: mainColor,
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: model.bulan,
onChanged: (String? newValue) {
// model.setSelectedbulan(newValue!);
model.log.i(newValue);
model.bulan = newValue!;
model.notifyListeners();
},
items: model.bulanList.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: regularTextStyle.copyWith(
fontSize: 16,
),
),
);
}).toList(),
),
),
),
const SizedBox(height: 10),
Align(
alignment: Alignment.centerLeft,
child: Text(
"Filter Tahun",
style: regularTextStyle.copyWith(color: mainColor),
textAlign: TextAlign.left,
),
),
Container(
width: double.infinity,
height: 60,
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
border: Border.all(
color: mainColor,
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: model.tahun,
onChanged: (String? newValue) {
// model.setSelectedtahun(newValue!);
model.log.i(newValue);
model.tahun = newValue!;
model.notifyListeners();
},
items: model.tahunList.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: regularTextStyle.copyWith(
fontSize: 16,
),
),
);
}).toList(),
),
),
),
const SizedBox(height: 10),
Align(
alignment: Alignment.centerLeft,
child: Text(
"Filter Status",
style: regularTextStyle.copyWith(color: mainColor),
textAlign: TextAlign.left,
),
),
Container(
width: double.infinity,
height: 60,
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
border: Border.all(
color: mainColor,
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: model.status,
onChanged: (String? newValue) {
// model.setSelectedstatus(newValue!);
model.log.i(newValue);
model.status = newValue!;
model.notifyListeners();
},
items: model.statusList.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: regularTextStyle.copyWith(
fontSize: 16,
),
),
);
}).toList(),
),
),
),
const SizedBox(height: 15),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: TextButton(
onPressed: () {
// model.filter();
// model.filter();
completer!(
DialogResponse(
confirmed: true,
data: {
'jenisDonasi': model.jenisDonasi,
'bulan': model.bulan,
'tahun': model.tahun,
'status': model.status,
},
),
);
},
style: TextButton.styleFrom(
backgroundColor: mainColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
),
child: Text(
"Filter",
style: boldTextStyle.copyWith(
fontSize: 16,
color: Colors.white,
),
),
),
),
const SizedBox(width: 10),
Expanded(
child: TextButton(
onPressed: () {
completer!(DialogResponse(confirmed: false));
},
style: TextButton.styleFrom(
backgroundColor: mainGrey,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
),
child: Text(
"Close",
style: boldTextStyle.copyWith(
fontSize: 16,
color: Colors.white,
),
),
),
),
],
)
],
),
),
);
},
);
}
}

View File

@ -0,0 +1,41 @@
import '../../../../app/app.logger.dart';
import '../../../../app/core/custom_base_view_model.dart';
class FilterDialogViewModel extends CustomBaseViewModel {
final log = getLogger('FilterDialogViewModel');
String jenisDonasi = 'Semua';
List<String> jenisDonasiList = ['Semua', 'Uang', 'Barang'];
String bulan = 'Semua';
List<String> bulanList = [
'Semua',
'Januari',
'Februari',
'Maret',
'April',
'Mei',
'Juni',
'Agustus',
'September',
'Oktober',
'November',
'Desember'
];
String tahun = 'Semua';
List<String> tahunList = [
'Semua',
'2023',
'2022',
];
String status = 'Semua';
List<String> statusList = [
'Semua',
'Belum Dikonfirmasi',
'Sudah Dikonfirmasi',
];
Future<void> init() async {}
}

View File

@ -4,11 +4,13 @@ import 'package:stacked/stacked.dart';
import './sejarah_view_model.dart'; import './sejarah_view_model.dart';
class SejarahView extends StatelessWidget { class SejarahView extends StatelessWidget {
const SejarahView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ViewModelBuilder<SejarahViewModel>.nonReactive( return ViewModelBuilder<SejarahViewModel>.nonReactive(
viewModelBuilder: () => SejarahViewModel(), viewModelBuilder: () => SejarahViewModel(),
onModelReady: (SejarahViewModel model) async { onViewModelReady: (SejarahViewModel model) async {
await model.init(); await model.init();
}, },
builder: ( builder: (
@ -29,9 +31,9 @@ class SejarahView extends StatelessWidget {
height: 150, height: 150,
), ),
), ),
SizedBox(height: 20), const SizedBox(height: 20),
Text( Text(
model.isi1 + '\n\n' + model.isi2, '${model.isi1}\n\n${model.isi2}',
style: const TextStyle(fontSize: 18), style: const TextStyle(fontSize: 18),
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
), ),

View File

@ -4,11 +4,13 @@ import 'package:stacked/stacked.dart';
import './struktur_organisasi_view_model.dart'; import './struktur_organisasi_view_model.dart';
class StrukturOrganisasiView extends StatelessWidget { class StrukturOrganisasiView extends StatelessWidget {
const StrukturOrganisasiView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ViewModelBuilder<StrukturOrganisasiViewModel>.nonReactive( return ViewModelBuilder<StrukturOrganisasiViewModel>.nonReactive(
viewModelBuilder: () => StrukturOrganisasiViewModel(), viewModelBuilder: () => StrukturOrganisasiViewModel(),
onModelReady: (StrukturOrganisasiViewModel model) async { onViewModelReady: (StrukturOrganisasiViewModel model) async {
await model.init(); await model.init();
}, },
builder: ( builder: (
@ -43,7 +45,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
model.Ketua, model.ketua,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -62,7 +64,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
model.Sekretaris, model.sekretaris,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -81,7 +83,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
model.Bendahara, model.bendahara,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -100,7 +102,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
'${model.SeksiPengasuh1}\n${model.SeksiPengasuh2}\n${model.SeksiPengasuh3}\n${model.SeksiPengasuh4}', '${model.seksiPengasuh1}\n${model.seksiPengasuh2}\n${model.seksiPengasuh3}\n${model.seksiPengasuh4}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -119,7 +121,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
'${model.SeksiIbadah1}\n${model.SeksiIbadah2}\n${model.SeksiIbadah3}\n${model.SeksiIbadah4}', '${model.seksiIbadah1}\n${model.seksiIbadah2}\n${model.seksiIbadah3}\n${model.seksiIbadah4}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -138,7 +140,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
'${model.SeksiPendidikan1}\n${model.SeksiPendidikan2}', '${model.seksiPendidikan1}\n${model.seksiPendidikan2}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -157,7 +159,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
model.SeksiKesehatan, model.seksiKesehatan,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -176,7 +178,7 @@ class StrukturOrganisasiView extends StatelessWidget {
height: 2, height: 2,
), ),
Text( Text(
model.SeksiKebersihan, model.seksiKebersihan,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -192,7 +194,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
model.SeksiKeterampilan1, model.seksiKeterampilan1,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -208,7 +210,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
model.SeksiSaranaPrasarana1, model.seksiSaranaPrasarana1,
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -224,7 +226,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
'${model.SeksiKonsumsi1}\n${model.SeksiKonsumsi2}', '${model.seksiKonsumsi1}\n${model.seksiKonsumsi2}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -240,7 +242,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
'${model.SeksiKeamanan1}\n${model.SeksiKeamanan2}', '${model.seksiKeamanan1}\n${model.seksiKeamanan2}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -256,7 +258,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
'${model.SeksiGedung1}\n${model.SeksiGedung2}\n${model.SeksiGedung3}\n${model.SeksiGedung4}', '${model.seksiGedung1}\n${model.seksiGedung2}\n${model.seksiGedung3}\n${model.seksiGedung4}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -272,7 +274,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
'${model.SeksiWisma1}\n${model.SeksiWisma2}\n${model.SeksiWisma3}\n${model.SeksiWisma4}\n${model.SeksiWisma5}', '${model.seksiWisma1}\n${model.seksiWisma2}\n${model.seksiWisma3}\n${model.seksiWisma4}\n${model.seksiWisma5}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -288,7 +290,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
'${model.KelompokPutri1}\n${model.KelompokPutri2}\n${model.KelompokPutri3}', '${model.kelompokPutri1}\n${model.kelompokPutri2}\n${model.kelompokPutri3}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),
@ -304,7 +306,7 @@ class StrukturOrganisasiView extends StatelessWidget {
), ),
), ),
Text( Text(
'${model.KelompokPutra1}\n${model.KelompokPutra2}\n${model.KelompokPutra3}', '${model.kelompokPutra1}\n${model.kelompokPutra2}\n${model.kelompokPutra3}',
style: const TextStyle( style: const TextStyle(
fontSize: 20, fontSize: 20,
), ),

View File

@ -1,54 +1,54 @@
import 'package:panti_asuhan/app/core/custom_base_view_model.dart'; import 'package:panti_asuhan/app/core/custom_base_view_model.dart';
class StrukturOrganisasiViewModel extends CustomBaseViewModel { class StrukturOrganisasiViewModel extends CustomBaseViewModel {
String Ketua = "Dr. Andi Fitriani D, S.Ag, M.Pd"; String ketua = "Dr. Andi Fitriani D, S.Ag, M.Pd";
String Sekretaris = "Fitriana Buyanus, S.Si ., M.Kes"; String sekretaris = "Fitriana Buyanus, S.Si ., M.Kes";
String Bendahara = "Hj. Djaliah, A.Ma"; String bendahara = "Hj. Djaliah, A.Ma";
String SeksiPengasuh1 = "Dra Hj, CIA"; String seksiPengasuh1 = "Dra Hj, CIA";
String SeksiPengasuh2 = "Dahang, S.Ag"; String seksiPengasuh2 = "Dahang, S.Ag";
String SeksiPengasuh3 = "Sumadin, S.Pd.I"; String seksiPengasuh3 = "Sumadin, S.Pd.I";
String SeksiPengasuh4 = "Darwan"; String seksiPengasuh4 = "Darwan";
String SeksiIbadah1 = "Drs. Najib La'ady"; String seksiIbadah1 = "Drs. Najib La'ady";
String SeksiIbadah2 = "Sumadin, S.Pd.I"; String seksiIbadah2 = "Sumadin, S.Pd.I";
String SeksiIbadah3 = "Ahmad"; String seksiIbadah3 = "Ahmad";
String SeksiIbadah4 = "Darwan"; String seksiIbadah4 = "Darwan";
String SeksiPendidikan1 = "Dra. Hj. CIA"; String seksiPendidikan1 = "Dra. Hj. CIA";
String SeksiPendidikan2 = "Hj. Djaliah, A.Ma"; String seksiPendidikan2 = "Hj. Djaliah, A.Ma";
String SeksiKesehatan = "Haerul, SKM"; String seksiKesehatan = "Haerul, SKM";
String SeksiKebersihan = "Bd. Lina Sutomo"; String seksiKebersihan = "Bd. Lina Sutomo";
String SeksiKeterampilan1 = "Yuslihudriani, S.Pd"; String seksiKeterampilan1 = "Yuslihudriani, S.Pd";
String SeksiSaranaPrasarana1 = "Muh.Adham, ST"; String seksiSaranaPrasarana1 = "Muh.Adham, ST";
String SeksiKonsumsi1 = "Fatmawati"; String seksiKonsumsi1 = "Fatmawati";
String SeksiKonsumsi2 = "Rasnaya"; String seksiKonsumsi2 = "Rasnaya";
String SeksiKeamanan1 = "Firdaus"; String seksiKeamanan1 = "Firdaus";
String SeksiKeamanan2 = "Ahmad"; String seksiKeamanan2 = "Ahmad";
String SeksiGedung1 = "Dra. Bangsuari"; String seksiGedung1 = "Dra. Bangsuari";
String SeksiGedung2 = "Hidayani"; String seksiGedung2 = "Hidayani";
String SeksiGedung3 = "Dahang. S,Ag"; String seksiGedung3 = "Dahang. S,Ag";
String SeksiGedung4 = "Saharia"; String seksiGedung4 = "Saharia";
String SeksiWisma1 = "Drs. Muh, Yasmin"; String seksiWisma1 = "Drs. Muh, Yasmin";
String SeksiWisma2 = "Hj. Hadilah"; String seksiWisma2 = "Hj. Hadilah";
String SeksiWisma3 = "Muh.Adham, ST"; String seksiWisma3 = "Muh.Adham, ST";
String SeksiWisma4 = "Ahmad"; String seksiWisma4 = "Ahmad";
String SeksiWisma5 = "Dahang, S.Ag"; String seksiWisma5 = "Dahang, S.Ag";
String KelompokPutri1 = "St. Khadijah"; String kelompokPutri1 = "St. Khadijah";
String KelompokPutri2 = "St. Aisyah"; String kelompokPutri2 = "St. Aisyah";
String KelompokPutri3 = "St. Fatimah"; String kelompokPutri3 = "St. Fatimah";
String KelompokPutra1 = "Ahmad Dahlan"; String kelompokPutra1 = "Ahmad Dahlan";
String KelompokPutra2 = "Ar. Fahruddin"; String kelompokPutra2 = "Ar. Fahruddin";
String KelompokPutra3 = "Amin Rais"; String kelompokPutra3 = "Amin Rais";
Future<void> init() async {} Future<void> init() async {}
} }

View File

@ -4,11 +4,13 @@ import 'package:stacked/stacked.dart';
import './visi_misi_view_model.dart'; import './visi_misi_view_model.dart';
class VisiMisiView extends StatelessWidget { class VisiMisiView extends StatelessWidget {
const VisiMisiView({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ViewModelBuilder<VisiMisiViewModel>.nonReactive( return ViewModelBuilder<VisiMisiViewModel>.nonReactive(
viewModelBuilder: () => VisiMisiViewModel(), viewModelBuilder: () => VisiMisiViewModel(),
onModelReady: (VisiMisiViewModel model) async { onViewModelReady: (VisiMisiViewModel model) async {
await model.init(); await model.init();
}, },
builder: ( builder: (
@ -29,36 +31,28 @@ class VisiMisiView extends StatelessWidget {
height: 150, height: 150,
), ),
), ),
Center( const Center(
child: Text( child: Text(
'Visi', 'Visi',
style: const TextStyle(fontSize: 20), style: TextStyle(fontSize: 20),
), ),
), ),
SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
model.visi, model.visi,
style: const TextStyle(fontSize: 18), style: const TextStyle(fontSize: 18),
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
), ),
SizedBox(height: 30), const SizedBox(height: 30),
Center( const Center(
child: Text( child: Text(
'Misi', 'Misi',
style: const TextStyle(fontSize: 20), style: TextStyle(fontSize: 20),
), ),
), ),
SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
model.misi1 + '${model.misi1}\n\n${model.misi2}\n\n${model.misi3}\n\n${model.misi4}\n\n${model.misi5}',
'\n\n' +
model.misi2 +
'\n\n' +
model.misi3 +
'\n\n' +
model.misi4 +
'\n\n' +
model.misi5,
style: const TextStyle(fontSize: 18), style: const TextStyle(fontSize: 18),
textAlign: TextAlign.justify, textAlign: TextAlign.justify,
), ),

View File

@ -0,0 +1,213 @@
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import '../../../app/themes/app_colors.dart';
import '../../../app/themes/app_text.dart';
import '../../widgets/my_textformfield.dart';
import './detail_dana_sosial_view_model.dart';
class DetailDanaSosialView extends StatelessWidget {
final int id;
const DetailDanaSosialView({Key? key, required this.id}) : super(key: key);
@override
Widget build(BuildContext context) {
return ViewModelBuilder<DetailDanaSosialViewModel>.reactive(
viewModelBuilder: () => DetailDanaSosialViewModel(),
onViewModelReady: (DetailDanaSosialViewModel model) async {
await model.init(id);
},
builder: (
BuildContext context,
DetailDanaSosialViewModel model,
Widget? child,
) {
return Scaffold(
appBar: AppBar(
title: const Text('Detail Dana Sosial',
style: TextStyle(color: Colors.white)),
backgroundColor: mainColor,
iconTheme: const IconThemeData(color: Colors.white),
),
body: Padding(
padding: const EdgeInsets.all(15),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Align(
alignment: Alignment.centerLeft,
child: Text(
"Nama Donator",
style: regularTextStyle.copyWith(color: mainColor),
),
),
MyTextFormField(
controller: model.namaController,
maxLines: 1,
readOnly: true,
),
const SizedBox(
height: 15,
),
Align(
alignment: Alignment.centerLeft,
child: Text(
"Tanggal",
style: regularTextStyle.copyWith(color: mainColor),
),
),
MyTextFormField(
controller: model.tanggalController,
maxLines: 1,
readOnly: true,
),
const SizedBox(
height: 15,
),
Align(
alignment: Alignment.centerLeft,
child: Text(
"Jenis",
style: regularTextStyle.copyWith(color: mainColor),
),
),
MyTextFormField(
controller: model.jenisController,
maxLines: 1,
readOnly: true,
),
Visibility(
visible: model.jenisBool,
child: const SizedBox(
height: 15,
),
),
Visibility(
visible: model.jenisBool,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"Jumlah",
style: regularTextStyle.copyWith(color: mainColor),
),
),
),
Visibility(
visible: model.jenisBool,
child: MyTextFormField(
controller: model.jumlahController,
maxLines: 1,
readOnly: true,
),
),
Visibility(
visible: !model.jenisBool,
child: const SizedBox(
height: 15,
),
),
Visibility(
visible: !model.jenisBool,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"Keterangan",
style: regularTextStyle.copyWith(color: mainColor),
),
),
),
Visibility(
visible: !model.jenisBool,
child: MyTextFormField(
controller: model.keteranganController,
maxLines: 2,
readOnly: true,
),
),
const SizedBox(
height: 15,
),
Expanded(
child: Align(
alignment: Alignment.centerRight,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Tanda Tangan",
style: regularTextStyle.copyWith(color: mainColor),
),
SizedBox(
height: 150,
width: 150,
child: model.danaSosialModel == null
? Container(
decoration: BoxDecoration(
border: Border.all(color: mainColor),
),
)
: (model.danaSosialModel!.status! ==
'Belum Dikonfirmasi'
? const TtdWidget()
: Image.asset(
'assets/qrcode.png',
fit: BoxFit.cover,
)),
),
const SizedBox(
height: 10,
),
Text(
"Dr. Andi Fitriani D, S.Ag, M.Pd",
style: regularTextStyle.copyWith(
color: mainColor,
fontWeight: FontWeight.bold,
),
),
// create a horizontal line
],
),
),
),
],
),
),
);
},
);
}
}
class TtdWidget extends ViewModelWidget<DetailDanaSosialViewModel> {
const TtdWidget({
super.key,
});
@override
Widget build(BuildContext context, DetailDanaSosialViewModel viewModel) {
return Container(
decoration: BoxDecoration(
border: Border.all(color: mainColor),
),
child: viewModel.role == 'pimpinan'
? InkWell(
onTap: () {
viewModel.handleTtd();
},
child: Center(
child: Text(
"Tanda Tangan",
style: regularTextStyle.copyWith(
color: mainColor,
fontStyle: FontStyle.italic,
),
),
),
)
: null,
);
}
}

View File

@ -0,0 +1,105 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../app/app.locator.dart';
import '../../../app/app.logger.dart';
import '../../../app/core/custom_base_view_model.dart';
import '../../../model/dana_sosial_model.dart';
import '../../../services/http_services.dart';
import '../../../services/my_easyloading.dart';
import '../../../services/other_function.dart';
class DetailDanaSosialViewModel extends CustomBaseViewModel {
final log = getLogger('DetailDanaSosialViewModel');
final _httpService = locator<MyHttpServices>();
final easyLoading = locator<MyEasyLoading>();
int? idDanaSosial;
DanaSosialModel? danaSosialModel;
bool jenisBool = true;
String? role;
TextEditingController namaController = TextEditingController();
TextEditingController tanggalController = TextEditingController();
TextEditingController jumlahController = TextEditingController();
TextEditingController jenisController = TextEditingController();
TextEditingController keteranganController = TextEditingController();
Future<void> init(int id) async {
log.i('init and id: $id');
getData(id);
idDanaSosial = id;
prefs.then((SharedPreferences prefs) {
role = prefs.getString('role');
});
}
getData(int id) async {
setBusy(true);
easyLoading.showLoading();
try {
var response = await _httpService.get('dana_sosial_detail?id=$id');
log.i(response.data);
danaSosialModel = DanaSosialModel.fromJson(response.data['data']);
namaController.text = danaSosialModel!.nama!;
tanggalController.text = danaSosialModel!.tanggal!;
jumlahController.text =
"Rp. ${OtherFunction().commaFormat(danaSosialModel!.jumlah != null ? int.parse(danaSosialModel!.jumlah!) : 0)}";
jenisController.text = danaSosialModel!.jenisDonasi!;
keteranganController.text = danaSosialModel!.keterangan!;
if (danaSosialModel!.jenisDonasi == 'Uang') {
jenisBool = true;
} else {
jenisBool = false;
}
log.i('status: ${danaSosialModel!.status}');
setBusy(false);
notifyListeners();
} catch (e) {
log.e(e);
setBusy(false);
} finally {
easyLoading.dismissLoading();
}
}
void handleTtd() {
dialogService
.showConfirmationDialog(
title: 'Konfirmasi',
description: 'Apakah anda yakin ingin mengkonfirmasi tanda tangan ini?',
cancelTitle: 'Tidak',
confirmationTitle: 'Ya',
)
.then((value) async {
if (value!.confirmed) {
setBusy(true);
easyLoading.showLoading();
try {
FormData formData = FormData.fromMap({
'id': idDanaSosial,
});
var response =
await _httpService.postWithFormData('dana_sosial_ttd', formData);
log.i(response.data);
getData(idDanaSosial!);
setBusy(false);
notifyListeners();
} catch (e) {
log.e(e);
setBusy(false);
dialogService.showDialog(
title: 'Error',
description: e.toString(),
);
} finally {
easyLoading.dismissLoading();
}
}
});
}
}

View File

@ -1,9 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:panti_asuhan/ui/widgets/my_button.dart';
import 'package:panti_asuhan/ui/widgets/my_textformfield.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:validatorless/validatorless.dart';
import '../../../app/app.router.dart';
import '../../../app/themes/app_text.dart'; import '../../../app/themes/app_text.dart';
import '../../widgets/my_button.dart';
import '../../widgets/my_textformfield.dart';
import './login_screen_view_model.dart'; import './login_screen_view_model.dart';
class LoginScreenView extends StatelessWidget { class LoginScreenView extends StatelessWidget {
@ -25,6 +27,8 @@ class LoginScreenView extends StatelessWidget {
body: Padding( body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20), padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Form(
key: model.formKey,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -51,19 +55,23 @@ class LoginScreenView extends StatelessWidget {
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
const MyTextFormField( MyTextFormField(
hintText: "Username", hintText: "Username",
prefixIcon: Icon(Icons.person), prefixIcon: const Icon(Icons.person),
// controller: model.usernameController, controller: model.usernameController,
validator:
Validatorless.required("Username tidak boleh kosong"),
), ),
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
const MyTextFormField( MyTextFormField(
hintText: "Password", hintText: "Password",
prefixIcon: Icon(Icons.lock), prefixIcon: const Icon(Icons.lock),
// controller: model.passwordController, controller: model.passwordController,
obscureText: true, obscureText: true,
validator:
Validatorless.required("Password tidak boleh kosong"),
), ),
const SizedBox( const SizedBox(
height: 10, height: 10,
@ -73,14 +81,26 @@ class LoginScreenView extends StatelessWidget {
child: MyButton( child: MyButton(
text: "LOGIN", text: "LOGIN",
onPressed: () { onPressed: () {
model.goToAdmin(); if (model.formKey.currentState!.validate()) {
model.login();
}
}, },
), ),
), ),
TextButton(
onPressed: () {
model.navigationService
.navigateTo(Routes.userIndexTrackingView);
},
child: const Text(
"Kembali ke beranda",
),
)
], ],
), ),
), ),
), ),
),
); );
}, },
); );

View File

@ -1,13 +1,45 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../app/app.logger.dart'; import '../../../app/app.logger.dart';
import '../../../app/app.router.dart'; import '../../../app/app.router.dart';
import '../../../app/core/custom_base_view_model.dart'; import '../../../app/core/custom_base_view_model.dart';
class LoginScreenViewModel extends CustomBaseViewModel { class LoginScreenViewModel extends CustomBaseViewModel {
final log = getLogger('LoginScreenViewModel'); final log = getLogger('LoginScreenViewModel');
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
Future<void> init() async {} Future<void> init() async {}
goToAdmin() { final formKey = GlobalKey<FormState>();
TextEditingController usernameController = TextEditingController();
TextEditingController passwordController = TextEditingController();
login() {
if (usernameController.text == 'admin' &&
passwordController.text == 'admin') {
_prefs.then((SharedPreferences prefs) {
prefs.setBool('isLogin', true);
prefs.setString('role', 'admin');
});
log.d('goToAdmin'); log.d('goToAdmin');
navigationService.navigateTo(Routes.adminIndexTrackingView); navigationService.navigateTo(Routes.adminIndexTrackingView);
} else if (usernameController.text == 'pimpinan' &&
passwordController.text == 'pimpinan') {
_prefs.then((SharedPreferences prefs) {
prefs.setBool('isLogin', true);
prefs.setString('role', 'pimpinan');
});
log.d('goToPimpinan');
navigationService.navigateTo(Routes.pimpinanIndexTrackingView);
} else {
dialogService.showDialog(
title: 'Gagal',
description: 'Username atau password salah',
);
_prefs.then((SharedPreferences prefs) {
prefs.setBool('isLogin', false);
prefs.remove('role');
});
}
} }
} }

View File

@ -0,0 +1,99 @@
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:stylish_bottom_bar/model/bar_items.dart';
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';
import '../../../../app/app.router.dart';
import '../../../../app/themes/app_colors.dart';
import '../../../../app/themes/app_text.dart';
import './pimpinan_index_tracking_view_model.dart';
class PimpinanIndexTrackingView extends StatelessWidget {
const PimpinanIndexTrackingView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<PimpinanIndexTrackingViewModel>.reactive(
viewModelBuilder: () => PimpinanIndexTrackingViewModel(),
onViewModelReady: (PimpinanIndexTrackingViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
PimpinanIndexTrackingViewModel model,
Widget? child,
) {
return Scaffold(
appBar: AppBar(
title: Text(
model.header,
style: const TextStyle(
color: Colors.white,
fontSize: 20,
),
),
backgroundColor: mainColor,
elevation: 0,
automaticallyImplyLeading: false,
actions: [
IconButton(
onPressed: () {
// model.navigationService.navigateTo(Routes.loginScreenView);
model.logout();
},
icon: const Icon(
Icons.logout,
color: Colors.white,
),
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
child: ExtendedNavigator(
navigatorKey: StackedService.nestedNavigationKey(4),
router: PimpinanIndexTrackingViewRouter(),
initialRoute: PimpinanIndexTrackingViewRoutes.danaSosialAdminView,
),
),
bottomNavigationBar: StylishBottomBar(
items: [
for (var item in model.bottomNavBarList)
BottomBarItem(
icon: Icon(item['icon'],
color: model.currentIndex ==
model.bottomNavBarList.indexOf(item)
? sixthGrey
: backgroundColor),
title: Text(
item['name'],
style: regularTextStyle.copyWith(
color: model.currentIndex ==
model.bottomNavBarList.indexOf(item)
? sixthGrey
: Colors.grey,
),
),
backgroundColor:
model.currentIndex == model.bottomNavBarList.indexOf(item)
? Colors.white
: Colors.grey,
),
],
currentIndex: model.currentIndex,
hasNotch: true,
backgroundColor: mainColor,
onTap: (value) {
model.handleNavigation(value);
},
option: BubbleBarOptions(
barStyle: BubbleBarStyle.horizotnal,
bubbleFillStyle: BubbleFillStyle.fill,
opacity: 0.3),
),
);
},
);
}
}

View File

@ -0,0 +1,88 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import '../../../../app/app.locator.dart';
import '../../../../app/app.logger.dart';
import '../../../../app/app.router.dart';
class PimpinanIndexTrackingViewModel extends IndexTrackingViewModel {
final log = getLogger('PimpinanIndexTrackingViewModel');
final _navigationService = locator<NavigationService>();
final _dialogService = locator<DialogService>();
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
String header = 'Dana Sosial';
final _bottomNavBarList = [
{
'name': 'Siswa',
'icon': Icons.people_alt_outlined,
'header': 'List Siswa'
},
{'name': 'Dana', 'icon': Icons.money, 'header': 'Dana Sosial'},
{
'name': 'Profil',
'icon': Icons.person_4_outlined,
'header': 'Profil Panti Asuhan'
},
];
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
final List<String> _views = [
PimpinanIndexTrackingViewRoutes.dataSiswaView,
PimpinanIndexTrackingViewRoutes.danaSosialAdminView,
PimpinanIndexTrackingViewRoutes.profilView,
];
Future<void> init() async {
_prefs.then((SharedPreferences prefs) {
if (prefs.getString('role') == 'pimpinan') {
setIndex(1);
// // await 2 seconds to make sure the view is loaded
// Future.delayed(const Duration(milliseconds: 500));
} else {
prefs.setBool('isLogin', false);
prefs.remove('role');
_navigationService.clearStackAndShow(Routes.loginScreenView);
}
});
}
void handleNavigation(int index) {
log.d("handleNavigation: $index");
log.d("currentIndex: $currentIndex");
if (currentIndex == index) return;
setIndex(index);
header = _bottomNavBarList[index]['header'] as String;
_navigationService.navigateTo(
_views[index],
id: 4,
);
}
logout() {
_dialogService
.showConfirmationDialog(
title: 'Logout',
description: 'Apakah anda yakin ingin logout?',
cancelTitle: 'Ya',
confirmationTitle: 'Tidak',
// barrierDismissible: true,
)
.then((value) {
if (!value!.confirmed) {
_prefs.then((SharedPreferences prefs) {
prefs.setBool('isLogin', false);
prefs.remove('role');
_navigationService.clearStackAndShow(Routes.loginScreenView);
});
} else {
_navigationService.back();
}
});
}
}

View File

@ -1,3 +1,5 @@
import 'package:shared_preferences/shared_preferences.dart';
import '../../../app/app.logger.dart'; import '../../../app/app.logger.dart';
import '../../../app/app.router.dart'; import '../../../app/app.router.dart';
import '../../../app/core/custom_base_view_model.dart'; import '../../../app/core/custom_base_view_model.dart';
@ -7,8 +9,29 @@ class SplashScreenViewModel extends CustomBaseViewModel {
Future<void> init() async { Future<void> init() async {
// wait 2 seconds then navigate to login // wait 2 seconds then navigate to login
await Future.delayed(const Duration(seconds: 2)); await Future.delayed(const Duration(seconds: 2));
await navigationService.navigateTo( prefs.then((SharedPreferences prefs) {
Routes.loginScreenView, if (prefs.getBool('isLogin') != true) {
return navigationService.navigateTo(
Routes.userIndexTrackingView,
); );
} }
if (prefs.getString('role') == 'admin') {
return navigationService.navigateTo(
Routes.adminIndexTrackingView,
);
}
if (prefs.getString('role') == 'pimpinan') {
return navigationService.navigateTo(
Routes.pimpinanIndexTrackingView,
);
}
});
// await navigationService.navigateTo(
// // Routes.loginScreenView,
// Routes.userIndexTrackingView,
// );
}
} }

View File

@ -58,18 +58,68 @@ class TambahDanaSosialView extends StatelessWidget {
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Text( Text(
"Jenis Donasi",
style: regularTextStyle.copyWith(color: mainColor),
),
Container(
width: double.infinity,
height: 60,
padding: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
border: Border.all(
color: mainColor,
),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: model.jenisDonasi,
onChanged: (String? newValue) {
// model.setSelectedjenisDonasi(newValue!);
model.log.i(newValue);
model.jenisDonasi = newValue!;
model.notifyListeners();
},
items: model.jenisDonasiList.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: regularTextStyle.copyWith(
fontSize: 16,
),
),
);
}).toList(),
),
),
),
Visibility(
visible: model.jenisDonasi == 'Uang',
child: const SizedBox(height: 20),
),
Visibility(
visible: model.jenisDonasi == 'Uang',
child: Text(
"Jumlah (Rp. )", "Jumlah (Rp. )",
style: regularTextStyle.copyWith(color: mainColor), style: regularTextStyle.copyWith(color: mainColor),
), ),
MyTextFormField( ),
hintText: "Jumlah (Rp. )", Visibility(
visible: model.jenisDonasi == 'Uang',
child: MyTextFormField(
hintText: "Jumlah (Rp. ) Donasi",
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
controller: model.jumlahController, controller: model.jumlahController,
validator: Validatorless.multiple( validator: model.jenisDonasi == 'Uang'
? Validatorless.multiple(
[ [
Validatorless.required('Jumlah tidak boleh kosong'), Validatorless.required(
'Jumlah tidak boleh kosong'),
Validatorless.number('Jumlah harus angka'), Validatorless.number('Jumlah harus angka'),
], ],
)
: null,
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@ -78,7 +128,7 @@ class TambahDanaSosialView extends StatelessWidget {
style: regularTextStyle.copyWith(color: mainColor), style: regularTextStyle.copyWith(color: mainColor),
), ),
MyTextFormField( MyTextFormField(
hintText: 'Tanggal', hintText: ' Pilih Tanggal',
readOnly: true, readOnly: true,
controller: model.tanggalController, controller: model.tanggalController,
validator: Validatorless.required( validator: Validatorless.required(
@ -88,6 +138,30 @@ class TambahDanaSosialView extends StatelessWidget {
}, },
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Visibility(
visible: model.jenisDonasi == 'Barang',
child: Text(
"Keterangan",
style: regularTextStyle.copyWith(color: mainColor),
),
),
Visibility(
visible: model.jenisDonasi == 'Barang',
child: MyTextFormField(
hintText: 'Masukkan Keterangan',
maxLines: 3,
controller: model.keteranganController,
validator: model.jenisDonasi == 'Barang'
? Validatorless.multiple(
[
Validatorless.required(
'Keterangan tidak boleh kosong'),
],
)
: null,
),
),
const SizedBox(height: 20),
MyButton( MyButton(
text: "Simpan Data", text: "Simpan Data",
onPressed: () { onPressed: () {

View File

@ -13,14 +13,15 @@ class TambahDanaSosialViewModel extends CustomBaseViewModel {
final _httpService = locator<MyHttpServices>(); final _httpService = locator<MyHttpServices>();
final easyLoading = locator<MyEasyLoading>(); final easyLoading = locator<MyEasyLoading>();
String jenisDana = 'Pemasukan'; String jenisDonasi = 'Uang';
List<String> jenisDanaList = ['Pemasukan', 'Pengeluaran']; List<String> jenisDonasiList = ['Uang', 'Barang'];
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
TextEditingController namaController = TextEditingController(); TextEditingController namaController = TextEditingController();
TextEditingController jumlahController = TextEditingController(); TextEditingController jumlahController = TextEditingController();
TextEditingController tanggalController = TextEditingController(); TextEditingController tanggalController = TextEditingController();
TextEditingController keteranganController = TextEditingController();
Future<void> init() async {} Future<void> init() async {}
@ -47,6 +48,8 @@ class TambahDanaSosialViewModel extends CustomBaseViewModel {
'nama': namaController.text, 'nama': namaController.text,
'jumlah': jumlahController.text, 'jumlah': jumlahController.text,
'tanggal': tanggalController.text, 'tanggal': tanggalController.text,
'ket': keteranganController.text,
'jenis': jenisDonasi,
}); });
var response = var response =
await _httpService.postWithFormData('dana_sosial', formData); await _httpService.postWithFormData('dana_sosial', formData);

View File

@ -0,0 +1,95 @@
import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/app.router.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:stylish_bottom_bar/model/bar_items.dart';
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';
import '../../../app/themes/app_colors.dart';
import '../../../app/themes/app_text.dart';
import './user_index_tracking_view_model.dart';
class UserIndexTrackingView extends StatelessWidget {
const UserIndexTrackingView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ViewModelBuilder<UserIndexTrackingViewModel>.reactive(
viewModelBuilder: () => UserIndexTrackingViewModel(),
onViewModelReady: (UserIndexTrackingViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
UserIndexTrackingViewModel model,
Widget? child,
) {
return Scaffold(
appBar: AppBar(
title: Text(
model.header,
style: const TextStyle(
color: Colors.white,
fontSize: 20,
),
),
backgroundColor: mainColor,
elevation: 0,
automaticallyImplyLeading: false,
actions: [
IconButton(
onPressed: () {
model.login();
},
icon: const Icon(Icons.login, color: Colors.white),
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
child: ExtendedNavigator(
navigatorKey: StackedService.nestedNavigationKey(5),
router: UserIndexTrackingViewRouter(),
initialRoute: UserIndexTrackingViewRoutes.danaSosialAdminView,
),
),
bottomNavigationBar: StylishBottomBar(
items: [
for (var item in model.bottomNavBarList)
BottomBarItem(
icon: Icon(item['icon'],
color: model.currentIndex ==
model.bottomNavBarList.indexOf(item)
? sixthGrey
: backgroundColor),
title: Text(
item['name'],
style: regularTextStyle.copyWith(
color: model.currentIndex ==
model.bottomNavBarList.indexOf(item)
? sixthGrey
: Colors.grey,
),
),
backgroundColor:
model.currentIndex == model.bottomNavBarList.indexOf(item)
? Colors.white
: Colors.grey,
),
],
currentIndex: model.currentIndex,
hasNotch: true,
backgroundColor: mainColor,
onTap: (value) {
model.handleNavigation(value);
},
option: BubbleBarOptions(
barStyle: BubbleBarStyle.horizotnal,
bubbleFillStyle: BubbleFillStyle.fill,
opacity: 0.3),
),
);
},
);
}
}

View File

@ -0,0 +1,71 @@
import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/app.router.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import '../../../app/app.locator.dart';
import '../../../app/app.logger.dart';
class UserIndexTrackingViewModel extends IndexTrackingViewModel {
final log = getLogger('PimpinanIndexTrackingViewModel');
final _navigationService = locator<NavigationService>();
// final _dialogService = locator<DialogService>();
String header = 'Dana Sosial';
final _bottomNavBarList = [
{
'name': 'Siswa',
'icon': Icons.people_alt_outlined,
'header': 'List Siswa'
},
{'name': 'Dana', 'icon': Icons.money, 'header': 'Dana Sosial'},
{
'name': 'Profil',
'icon': Icons.person_4_outlined,
'header': 'Profil Panti Asuhan'
},
{'name': 'V & M', 'icon': Icons.list_alt_rounded, 'header': 'Visi & Misi'},
{'name': 'Sejarah', 'icon': Icons.list_outlined, 'header': 'Sejarah'},
{
'name': 'S O',
'icon': Icons.people_alt_outlined,
'header': 'Struktur Organisasi'
},
];
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
final List<String> _views = [
UserIndexTrackingViewRoutes.dataSiswaView,
UserIndexTrackingViewRoutes.danaSosialAdminView,
UserIndexTrackingViewRoutes.profilView,
UserIndexTrackingViewRoutes.visiMisiView,
UserIndexTrackingViewRoutes.sejarahView,
UserIndexTrackingViewRoutes.strukturOrganisasiView
];
Future<void> init() async {
setIndex(1);
}
void handleNavigation(int index) {
log.d("handleNavigation: $index");
log.d("currentIndex: $currentIndex");
if (currentIndex == index) return;
setIndex(index);
header = _bottomNavBarList[index]['header'] as String;
_navigationService.navigateTo(
_views[index],
id: 5,
);
}
void login() {
_navigationService.navigateTo(
Routes.loginScreenView,
);
}
}

View File

@ -7,8 +7,10 @@ import Foundation
import location import location
import path_provider_foundation import path_provider_foundation
import shared_preferences_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
} }

View File

@ -688,6 +688,62 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.1.0" version: "4.1.0"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "0344316c947ffeb3a529eac929e1978fcd37c26be4e8468628bac399365a3ca1"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: fe8401ec5b6dcd739a0fe9588802069e608c3fdbfd3c3c93e546cf2f90438076
url: "https://pub.dev"
source: hosted
version: "2.2.0"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: f39696b83e844923b642ce9dd4bd31736c17e697f6731a5adf445b1274cf3cd4
url: "https://pub.dev"
source: hosted
version: "2.3.2"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: "71d6806d1449b0a9d4e85e0c7a917771e672a3d5dc61149cc9fac871115018e1"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: "23b052f17a25b90ff2b61aad4cc962154da76fb62848a9ce088efe30d7c50ab1"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: "7347b194fb0bbeb4058e6a4e87ee70350b6b2b90f8ac5f8bd5b3a01548f6d33a"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: f95e6a43162bce43c9c3405f3eb6f39e5b5d11f65fab19196cf8225e2777624d
url: "https://pub.dev"
source: hosted
version: "2.3.0"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:

View File

@ -50,6 +50,7 @@ dependencies:
flutter_holo_date_picker: ^1.1.0 flutter_holo_date_picker: ^1.1.0
validatorless: ^1.2.3 validatorless: ^1.2.3
intl: intl:
shared_preferences:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -79,6 +80,7 @@ flutter:
assets: assets:
- .env - .env
- assets/logo.png - assets/logo.png
- assets/qrcode.png
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see