add edit siswa page
This commit is contained in:
parent
b1dc1851a4
commit
667aae745b
8
.env
8
.env
|
@ -1,6 +1,6 @@
|
||||||
# url = 'https://panti-asuhan.s-keytech.com/'
|
url = 'https://panti-asuhan.s-keytech.com/'
|
||||||
# api_url = 'https://panti-asuhan.s-keytech.com/api/'
|
api_url = 'https://panti-asuhan.s-keytech.com/api/'
|
||||||
# url = 'http://172.29.85.181/panti_asuhan2/'
|
# url = 'http://172.29.85.181/panti_asuhan2/'
|
||||||
# api_url = 'http://172.29.85.181/panti_asuhan2/api/'
|
# api_url = 'http://172.29.85.181/panti_asuhan2/api/'
|
||||||
url = 'http://20.20.20.25/panti_asuhan2/'
|
# url = 'http://20.20.20.25/panti_asuhan2/'
|
||||||
api_url = 'http://20.20.20.25/panti_asuhan2/api/'
|
# api_url = 'http://20.20.20.25/panti_asuhan2/api/'
|
|
@ -26,10 +26,10 @@ class DanaSosialModel {
|
||||||
DanaSosialModel.fromJson(Map<String, dynamic> json) {
|
DanaSosialModel.fromJson(Map<String, dynamic> json) {
|
||||||
idDanaSosial = json['id_dana_sosial'];
|
idDanaSosial = json['id_dana_sosial'];
|
||||||
bentuk = json['bentuk'];
|
bentuk = json['bentuk'];
|
||||||
nama = json['nama'];
|
nama = json['nama'] ?? '';
|
||||||
jumlah = json['jumlah'];
|
jumlah = json['jumlah'];
|
||||||
tanggal = json['tanggal'];
|
tanggal = json['tanggal'];
|
||||||
keterangan = json['ket'];
|
keterangan = json['ket'] ?? '';
|
||||||
jenisDonasi = json['jenis'];
|
jenisDonasi = json['jenis'];
|
||||||
status =
|
status =
|
||||||
json['status'] == '0' ? 'Belum Dikonfirmasi' : 'Sudah Dikonfirmasi';
|
json['status'] == '0' ? 'Belum Dikonfirmasi' : 'Sudah Dikonfirmasi';
|
||||||
|
|
|
@ -270,7 +270,9 @@ class EditDialogSiswaView extends StatelessWidget {
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
completer(DialogResponse(confirmed: false));
|
||||||
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'Batal',
|
'Batal',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
@ -281,15 +283,14 @@ class EditDialogSiswaView extends StatelessWidget {
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (model.formKey.currentState!.validate()) {
|
if (model.formKey.currentState!.validate()) {
|
||||||
// bool res = await model.postData();
|
bool res = await model.updateSiswa();
|
||||||
// model.log.i("res: $res");
|
|
||||||
// if (res) {
|
if (res) {
|
||||||
// completer(
|
Navigator.pop(context);
|
||||||
// DialogResponse(
|
completer(DialogResponse(confirmed: true));
|
||||||
// confirmed: true,
|
}
|
||||||
// ),
|
|
||||||
// );
|
// completer(DialogResponse(confirmed: true));
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_holo_date_picker/flutter_holo_date_picker.dart';
|
import 'package:flutter_holo_date_picker/flutter_holo_date_picker.dart';
|
||||||
|
|
||||||
|
import '../../../../../app/app.locator.dart';
|
||||||
import '../../../../../app/app.logger.dart';
|
import '../../../../../app/app.logger.dart';
|
||||||
import '../../../../../app/core/custom_base_view_model.dart';
|
import '../../../../../app/core/custom_base_view_model.dart';
|
||||||
import '../../../../../model/siswa_model.dart';
|
import '../../../../../model/siswa_model.dart';
|
||||||
|
import '../../../../../services/http_services.dart';
|
||||||
|
import '../../../../../services/my_easyloading.dart';
|
||||||
|
|
||||||
class EditDialogSiswaViewModel extends CustomBaseViewModel {
|
class EditDialogSiswaViewModel extends CustomBaseViewModel {
|
||||||
final log = getLogger('EditDialogSiswaViewModel');
|
final log = getLogger('EditDialogSiswaViewModel');
|
||||||
|
final easyLoading = locator<MyEasyLoading>();
|
||||||
|
final _httpService = locator<MyHttpServices>();
|
||||||
SiswaModel? siswaModel;
|
SiswaModel? siswaModel;
|
||||||
String jenisKelamin = 'Laki-laki';
|
String jenisKelamin = 'Laki-laki';
|
||||||
List<String> jenisKelaminList = ['Laki-laki', 'Perempuan'];
|
List<String> jenisKelaminList = ['Laki-laki', 'Perempuan'];
|
||||||
|
@ -66,4 +72,37 @@ class EditDialogSiswaViewModel extends CustomBaseViewModel {
|
||||||
tanggalLahirController.text = date;
|
tanggalLahirController.text = date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> updateSiswa() async {
|
||||||
|
setBusy(true);
|
||||||
|
easyLoading.customLoading('Updating data...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
var formData = FormData.fromMap({
|
||||||
|
'id': siswaModel!.idSiswa,
|
||||||
|
'nama': namaController.text,
|
||||||
|
'tanggal_lahir': tanggalLahirController.text,
|
||||||
|
'tempat_lahir': tempatLahirController.text,
|
||||||
|
'jenis_kelamin': jenisKelamin,
|
||||||
|
'alamat': alamatController.text,
|
||||||
|
'no_telpon': noTelponController.text,
|
||||||
|
'agama': agamaController.text,
|
||||||
|
'kewarganegaraan': kewarganegaraanController.text,
|
||||||
|
'pendidikan_sd': pendidikanSDController.text,
|
||||||
|
'pendidikan_smp': pendidikanSMPController.text,
|
||||||
|
'pendidikan_sma': pendidikanSMAController.text,
|
||||||
|
'kemampuan': kemampuanController.text,
|
||||||
|
'hobi': hobiController.text,
|
||||||
|
});
|
||||||
|
await _httpService.postWithFormData('siswa_edit', formData);
|
||||||
|
snackbarService.showSnackbar(message: 'Data berhasil diupdate');
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
log.e(e);
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
easyLoading.dismissLoading();
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,8 @@ class EditSiswaView extends StatelessWidget {
|
||||||
// ),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Positioned(
|
model.role == 'admin'
|
||||||
|
? Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 45,
|
right: 45,
|
||||||
// create a edit rounded button
|
// create a edit rounded button
|
||||||
|
@ -250,8 +251,10 @@ class EditSiswaView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
Positioned(
|
: SizedBox(),
|
||||||
|
model.role == 'admin'
|
||||||
|
? Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
// create a close rounded button
|
// create a close rounded button
|
||||||
|
@ -295,7 +298,8 @@ class EditSiswaView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
|
: SizedBox(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.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';
|
||||||
|
@ -13,6 +14,7 @@ class EditSiswaViewModel extends CustomBaseViewModel {
|
||||||
final log = getLogger('EditSiswaViewModel');
|
final log = getLogger('EditSiswaViewModel');
|
||||||
final _httpService = locator<MyHttpServices>();
|
final _httpService = locator<MyHttpServices>();
|
||||||
final easyLoading = locator<MyEasyLoading>();
|
final easyLoading = locator<MyEasyLoading>();
|
||||||
|
String? role;
|
||||||
SiswaModel? siswaModel;
|
SiswaModel? siswaModel;
|
||||||
List<String> jenisKelaminList = ['Laki-laki', 'Perempuan'];
|
List<String> jenisKelaminList = ['Laki-laki', 'Perempuan'];
|
||||||
String jenisKelamin = 'Laki-laki';
|
String jenisKelamin = 'Laki-laki';
|
||||||
|
@ -34,6 +36,9 @@ class EditSiswaViewModel extends CustomBaseViewModel {
|
||||||
Future<void> init(int idSiswa) async {
|
Future<void> init(int idSiswa) async {
|
||||||
log.i('idSiswa: $idSiswa');
|
log.i('idSiswa: $idSiswa');
|
||||||
getData(idSiswa);
|
getData(idSiswa);
|
||||||
|
prefs.then((SharedPreferences prefs) {
|
||||||
|
role = prefs.getString('role');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getData(int idSiswa) async {
|
getData(int idSiswa) async {
|
||||||
|
@ -101,11 +106,13 @@ class EditSiswaViewModel extends CustomBaseViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
editData() async {
|
editData() async {
|
||||||
var res = dialogService.showCustomDialog(
|
var res = await dialogService.showCustomDialog(
|
||||||
variant: DialogType.editDialogSiswaView,
|
variant: DialogType.editDialogSiswaView,
|
||||||
data: siswaModel,
|
data: siswaModel,
|
||||||
);
|
);
|
||||||
|
|
||||||
res;
|
if (res?.confirmed != true) {
|
||||||
|
init(int.parse(siswaModel!.idSiswa!));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,12 +203,14 @@ class SecondWidget extends ViewModelWidget<StrukturOrganisasiViewModel> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
IconButton(
|
viewModel.role == 'admin'
|
||||||
|
? IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
viewModel.editData(title, true);
|
viewModel.editData(title, true);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.edit),
|
icon: const Icon(Icons.edit),
|
||||||
)
|
)
|
||||||
|
: const SizedBox(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++)
|
||||||
|
@ -287,12 +289,14 @@ class FirstWidget extends ViewModelWidget<StrukturOrganisasiViewModel> {
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
width: 10,
|
width: 10,
|
||||||
),
|
),
|
||||||
IconButton(
|
viewModel.role == 'admin'
|
||||||
|
? IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
viewModel.editData(title, false);
|
viewModel.editData(title, false);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.edit),
|
icon: const Icon(Icons.edit),
|
||||||
)
|
)
|
||||||
|
: const SizedBox(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
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';
|
||||||
import '../../../../app/app.logger.dart';
|
import '../../../../app/app.logger.dart';
|
||||||
|
@ -9,6 +11,7 @@ class StrukturOrganisasiViewModel extends CustomBaseViewModel {
|
||||||
final log = getLogger('StrukturOrganisasiViewModel');
|
final log = getLogger('StrukturOrganisasiViewModel');
|
||||||
final _httpService = locator<MyHttpServices>();
|
final _httpService = locator<MyHttpServices>();
|
||||||
final easyLoading = locator<MyEasyLoading>();
|
final easyLoading = locator<MyEasyLoading>();
|
||||||
|
String? role;
|
||||||
|
|
||||||
Map<String, dynamic> dataKetua = {};
|
Map<String, dynamic> dataKetua = {};
|
||||||
Map<String, dynamic> dataSekretaris = {};
|
Map<String, dynamic> dataSekretaris = {};
|
||||||
|
@ -54,6 +57,9 @@ class StrukturOrganisasiViewModel extends CustomBaseViewModel {
|
||||||
int dataKelompokPutriLength = 0;
|
int dataKelompokPutriLength = 0;
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
|
prefs.then((SharedPreferences prefs) {
|
||||||
|
role = prefs.getString('role');
|
||||||
|
});
|
||||||
getData('Ketua', false, null);
|
getData('Ketua', false, null);
|
||||||
getData('Sekretaris', false, null);
|
getData('Sekretaris', false, null);
|
||||||
getData('Bendahara', false, null);
|
getData('Bendahara', false, null);
|
||||||
|
|
|
@ -32,7 +32,28 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.all(15),
|
padding: const EdgeInsets.all(15),
|
||||||
child: Column(
|
child: model.danaSosialModel == null
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
)
|
||||||
|
: (model.danaSosialModel!.bentuk == 'Pemasukan'
|
||||||
|
? PemasukanWidget()
|
||||||
|
: PengeluaranWidget()),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PengeluaranWidget extends ViewModelWidget<DetailDanaSosialViewModel> {
|
||||||
|
const PengeluaranWidget({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, DetailDanaSosialViewModel viewModel) {
|
||||||
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
@ -40,12 +61,12 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Nama Donator",
|
"Bentuk",
|
||||||
style: regularTextStyle.copyWith(color: mainColor),
|
style: regularTextStyle.copyWith(color: mainColor),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyTextFormField(
|
MyTextFormField(
|
||||||
controller: model.namaController,
|
controller: viewModel.bentukController,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
),
|
),
|
||||||
|
@ -60,7 +81,7 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyTextFormField(
|
MyTextFormField(
|
||||||
controller: model.tanggalController,
|
controller: viewModel.tanggalController,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
),
|
),
|
||||||
|
@ -75,18 +96,18 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MyTextFormField(
|
MyTextFormField(
|
||||||
controller: model.jenisController,
|
controller: viewModel.jenisController,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: model.jenisBool,
|
visible: viewModel.jenisBool,
|
||||||
child: const SizedBox(
|
child: const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: model.jenisBool,
|
visible: viewModel.jenisBool,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -96,21 +117,21 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: model.jenisBool,
|
visible: viewModel.jenisBool,
|
||||||
child: MyTextFormField(
|
child: MyTextFormField(
|
||||||
controller: model.jumlahController,
|
controller: viewModel.jumlahController,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !model.jenisBool,
|
visible: !viewModel.jenisBool,
|
||||||
child: const SizedBox(
|
child: const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !model.jenisBool,
|
visible: !viewModel.jenisBool,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Text(
|
child: Text(
|
||||||
|
@ -120,9 +141,9 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !model.jenisBool,
|
visible: !viewModel.jenisBool,
|
||||||
child: MyTextFormField(
|
child: MyTextFormField(
|
||||||
controller: model.keteranganController,
|
controller: viewModel.keteranganController,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
),
|
),
|
||||||
|
@ -143,13 +164,13 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 150,
|
height: 150,
|
||||||
width: 150,
|
width: 150,
|
||||||
child: model.danaSosialModel == null
|
child: viewModel.danaSosialModel == null
|
||||||
? Container(
|
? Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(color: mainColor),
|
border: Border.all(color: mainColor),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: (model.danaSosialModel!.status! ==
|
: (viewModel.danaSosialModel!.status! ==
|
||||||
'Belum Dikonfirmasi'
|
'Belum Dikonfirmasi'
|
||||||
? const TtdWidget()
|
? const TtdWidget()
|
||||||
: Image.asset(
|
: Image.asset(
|
||||||
|
@ -173,10 +194,158 @@ class DetailDanaSosialView extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PemasukanWidget extends ViewModelWidget<DetailDanaSosialViewModel> {
|
||||||
|
const PemasukanWidget({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, DetailDanaSosialViewModel viewModel) {
|
||||||
|
return 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: viewModel.namaController,
|
||||||
|
maxLines: 1,
|
||||||
|
readOnly: true,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
"Tanggal",
|
||||||
|
style: regularTextStyle.copyWith(color: mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MyTextFormField(
|
||||||
|
controller: viewModel.tanggalController,
|
||||||
|
maxLines: 1,
|
||||||
|
readOnly: true,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
"Jenis",
|
||||||
|
style: regularTextStyle.copyWith(color: mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MyTextFormField(
|
||||||
|
controller: viewModel.jenisController,
|
||||||
|
maxLines: 1,
|
||||||
|
readOnly: true,
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: viewModel.jenisBool,
|
||||||
|
child: const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: viewModel.jenisBool,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
"Jumlah",
|
||||||
|
style: regularTextStyle.copyWith(color: mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: viewModel.jenisBool,
|
||||||
|
child: MyTextFormField(
|
||||||
|
controller: viewModel.jumlahController,
|
||||||
|
maxLines: 1,
|
||||||
|
readOnly: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: !viewModel.jenisBool,
|
||||||
|
child: const SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: !viewModel.jenisBool,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Text(
|
||||||
|
"Keterangan",
|
||||||
|
style: regularTextStyle.copyWith(color: mainColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: !viewModel.jenisBool,
|
||||||
|
child: MyTextFormField(
|
||||||
|
controller: viewModel.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: viewModel.danaSosialModel == null
|
||||||
|
? Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: mainColor),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: (viewModel.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
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,8 @@ class DetailDanaSosialViewModel extends CustomBaseViewModel {
|
||||||
TextEditingController jenisController = TextEditingController();
|
TextEditingController jenisController = TextEditingController();
|
||||||
TextEditingController keteranganController = TextEditingController();
|
TextEditingController keteranganController = TextEditingController();
|
||||||
|
|
||||||
|
TextEditingController bentukController = TextEditingController();
|
||||||
|
|
||||||
Future<void> init(int id) async {
|
Future<void> init(int id) async {
|
||||||
log.i('init and id: $id');
|
log.i('init and id: $id');
|
||||||
getData(id);
|
getData(id);
|
||||||
|
@ -41,7 +43,7 @@ class DetailDanaSosialViewModel extends CustomBaseViewModel {
|
||||||
easyLoading.showLoading();
|
easyLoading.showLoading();
|
||||||
try {
|
try {
|
||||||
var response = await _httpService.get('dana_sosial_detail?id=$id');
|
var response = await _httpService.get('dana_sosial_detail?id=$id');
|
||||||
log.i(response.data);
|
log.i(response.data['data']);
|
||||||
danaSosialModel = DanaSosialModel.fromJson(response.data['data']);
|
danaSosialModel = DanaSosialModel.fromJson(response.data['data']);
|
||||||
namaController.text = danaSosialModel!.nama!;
|
namaController.text = danaSosialModel!.nama!;
|
||||||
tanggalController.text = danaSosialModel!.tanggal!;
|
tanggalController.text = danaSosialModel!.tanggal!;
|
||||||
|
@ -50,12 +52,14 @@ class DetailDanaSosialViewModel extends CustomBaseViewModel {
|
||||||
jenisController.text = danaSosialModel!.jenisDonasi!;
|
jenisController.text = danaSosialModel!.jenisDonasi!;
|
||||||
keteranganController.text = danaSosialModel!.keterangan!;
|
keteranganController.text = danaSosialModel!.keterangan!;
|
||||||
|
|
||||||
|
bentukController.text = danaSosialModel!.bentuk!;
|
||||||
|
|
||||||
if (danaSosialModel!.jenisDonasi == 'Uang') {
|
if (danaSosialModel!.jenisDonasi == 'Uang') {
|
||||||
jenisBool = true;
|
jenisBool = true;
|
||||||
} else {
|
} else {
|
||||||
jenisBool = false;
|
jenisBool = false;
|
||||||
}
|
}
|
||||||
log.i('status: ${danaSosialModel!.status}');
|
// log.i('status: ${danaSosialModel!.status}');
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue