Fakultas Ilmu Komputer UI

Commit aec21a99 authored by Muhammad Farhan Ghaffar's avatar Muhammad Farhan Ghaffar
Browse files

[REFACTOR] menambahkan kode untuk get data dari API

parent e12f16bc
Pipeline #82468 passed with stages
in 7 minutes and 45 seconds
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-06-09 20:17:40.792290","version":"2.1.0-12.1.pre"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"D:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-06-10 14:29:42.755737","version":"2.1.0-12.1.pre"}
\ No newline at end of file
......@@ -791,8 +791,8 @@ class _BiodataBodyState extends State<BiodataBody> {
Api().birthdate(strDate, idbirthdate);
print(strDate);
Api().kyc_progress(
true, false, false, false, false);
// Api().kyc_progress(
// true, false, false, false, false);
}
Navigator.push(context,
......
......@@ -770,8 +770,8 @@ class _BiodataKeluargaBodyState extends State<BiodataKeluarga> {
Api().heir_relation(_hubunganAhli);
Api().heir_phone(_nomorHandphone);
Api().heir_address(_alamatAhli);
Api().put_kyc_progress(idKYC, true,
true, true, false, false);
// Api().put_kyc_progress(idKYC, true,
// true, true, false, false);
}
Navigator.push(context,
......
import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:fundex_app/api/api.dart';
import 'package:fundex_app/assets/colors.dart';
import 'package:fundex_app/main-screen.dart';
import 'package:fundex_app/pages/kyc/data_identitas.dart';
......@@ -35,7 +36,7 @@ var latarBelakang;
class ValidasiTempat {
static String validate(String value) {
return value.isEmpty ? 'Harus diisi' : latarBelakang = value;
return value.isEmpty ? 'Harus diisi' : null;
}
}
......@@ -52,7 +53,13 @@ class PekerjaanList {
class _DataPendukungState extends State<DataPendukung> {
final GlobalKey<FormState> _formkey = GlobalKey<FormState>();
final TextEditingController _typeAheadController = TextEditingController();
TextEditingController _typeAheadController = TextEditingController();
TextEditingController _formNamaPerusahaan = TextEditingController();
TextEditingController _formBidangUsaha = TextEditingController();
TextEditingController _formAlamatKantor = TextEditingController();
TextEditingController _formJabatan = TextEditingController();
TextEditingController _formNoTeleponKantor = TextEditingController();
TextEditingController _formEmailKantor = TextEditingController();
// ignore: unused_field
String _latarBelakang;
......@@ -74,6 +81,148 @@ class _DataPendukungState extends State<DataPendukung> {
String _tujuanInvestasi;
bool _checkBox = false;
var _onPressed;
int selectedRadio;
int idKYC;
bool alreadyFilledSection = false;
int getIdEducation;
int getIdIncomeSource;
int getIdOccupation;
int getIdMotivation;
String getEducation;
String getIncomeSource;
String getOccupation;
String getMotivation;
int getIdOrganizationName;
int getIdOrganizationField;
String getOrganizationName;
String getOrganizationField;
int getIdPosition;
int getIdOrganizationPhone;
String getPosition;
String getOrganizationPhone;
int getIdOrganizationEmail;
int getIdOrganizationAddr;
String getOrganizationEmail;
String getOrganizationaddr;
void initState(){
super.initState();
selectedRadio = 0;
init();
}
Future init() async {
final List<dynamic> jsonMemberAttribute = await Api().getMemberAttribute();
for (var i = 0; i < jsonMemberAttribute.length; i++) {
if (jsonMemberAttribute[i]['attribute_name'] == 'education') {
getIdEducation = jsonMemberAttribute[i]['id'];
getEducation = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'income_source') {
getIdIncomeSource = jsonMemberAttribute[i]['id'];
getIncomeSource = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'occupation') {
getIdOccupation = jsonMemberAttribute[i]['id'];
getOccupation = jsonMemberAttribute[i]['attribute_value'];
print("already filled this section before. $getOccupation");
if (getOccupation == 'Lainnya') {
print("already filled this section before. Male");
validateRadioButton(1);
} else if (getOccupation == 'Pegawai Swasta'){
validateRadioButton(2);
} else if (getOccupation == 'Pegawai Negeri Sipil'){
validateRadioButton(3);
} else if (getOccupation == 'Ibu Rumah Tangga'){
validateRadioButton(4);
} else if (getOccupation == 'Pengusaha'){
validateRadioButton(5);
} else if (getOccupation == 'Pelajar/Mahasiswa'){
print('masuk 6');
validateRadioButton(6);
} else if (getOccupation == 'TNI/Polisi'){
validateRadioButton(7);
} else if (getOccupation == 'Pensiunan'){
validateRadioButton(8);
} else if (getOccupation == 'Guru'){
validateRadioButton(9);
}
} else if (jsonMemberAttribute[i]['attribute_name'] == 'organization_name') {
getIdOrganizationName = jsonMemberAttribute[i]['id'];
getOrganizationName = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'organization_field') {
getIdOrganizationField = jsonMemberAttribute[i]['id'];
getOrganizationField = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'organization_address') {
getIdOrganizationAddr = jsonMemberAttribute[i]['id'];
getOrganizationaddr = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'position') {
getIdPosition = jsonMemberAttribute[i]['id'];
getPosition = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'organization_phone') {
getIdOrganizationPhone = jsonMemberAttribute[i]['id'];
getOrganizationPhone = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'organization_email') {
getIdOrganizationEmail = jsonMemberAttribute[i]['id'];
getOrganizationEmail = jsonMemberAttribute[i]['attribute_value'];
} else if (jsonMemberAttribute[i]['attribute_name'] == 'motivation') {
getIdMotivation = jsonMemberAttribute[i]['id'];
getMotivation = jsonMemberAttribute[i]['attribute_value'];
var str = getMotivation.substring(1, getMotivation.length - 1);
List<String> listGetMotivation = [];
for (int i=0; i<str.length; i++) {
var split = str.split(",")[i];
listGetMotivation.add(split);
}
validasiTujuanInvestasi(listGetMotivation);
} else if (jsonMemberAttribute[i]['attribute_name'] == 'kyc_progress') {
var map = (jsonMemberAttribute[i] as Map<String, dynamic>);
idKYC = map['id'];
var val = (map)['attribute_value'];
var str = val.substring(1, val.length - 1);
var step1 = str.split(",")[1];
var value = step1.substring(8);
if (value == "true") {
setState(() {
alreadyFilledSection = true;
});
}
}
}
setState(() {
this.getEducation= getEducation;
this.getIdEducation = getIdEducation;
this.getIdIncomeSource = getIdIncomeSource;
this.getIdMotivation = getIdMotivation;
this.getIdOccupation = getIdOccupation;
this.getIncomeSource = getIncomeSource;
this.getMotivation = getMotivation;
this.getOccupation = getOccupation;
this.getIdOrganizationAddr = getIdOrganizationAddr;
this.getIdOrganizationEmail = getIdOrganizationEmail;
this.getIdOrganizationField = getIdOrganizationField;
this.getIdOrganizationName = getIdOrganizationName;
this.getIdOrganizationPhone = getIdOrganizationPhone;
this.getIdPosition = getIdPosition;
this.getOrganizationaddr = getOrganizationaddr;
this.getOrganizationEmail = getOrganizationEmail;
this.getOrganizationField = getOrganizationField;
this.getOrganizationName = getOrganizationName;
this.getOrganizationPhone = getOrganizationPhone;
this.getPosition = getPosition;
if (alreadyFilledSection) {
_typeAheadController.text = getEducation;
_formAlamatKantor.text = getOrganizationaddr;
_formBidangUsaha.text = getOrganizationField;
_formEmailKantor.text = getOrganizationEmail;
_formJabatan.text = getPosition;
_formNamaPerusahaan.text = getOrganizationName;
_formNoTeleponKantor.text = getOrganizationPhone;
}
});
}
List<String> tujuanInvestasiList = [
'Pendapatan',
'Spekulasi',
......@@ -101,10 +250,65 @@ class _DataPendukungState extends State<DataPendukung> {
List<String> finalSumberPenghasilanList = [];
double opacitySumberPenghasilan = 0;
double opacityTujuanInvestasi = 0;
double opacityPekerjaan = 0;
bool tujuanInvestasi = false;
bool sumberPenghasilan = false;
String sumberLainnya;
void validateRadioButton(value) {
selectedRadio = value;
if (selectedRadio == 0) {
setState(() {
opacityPekerjaan = 1;
});
} else if (selectedRadio == 1) {
setState(() {
_pekerjaan = 'Lainnya';
opacityPekerjaan = 0;
});
} else if (selectedRadio == 2) {
setState(() {
_pekerjaan = 'Pegawai Swasta';
opacityPekerjaan = 0;
});
} else if (selectedRadio == 3) {
setState(() {
_pekerjaan = 'Pegawai Negeri Sipil';
opacityPekerjaan = 0;
});
} else if (selectedRadio == 4) {
setState(() {
_pekerjaan = 'Ibu Rumah Tangga';
opacityPekerjaan = 0;
});
} else if (selectedRadio == 5) {
setState(() {
_pekerjaan = 'Pengusaha';
opacityPekerjaan = 0;
});
} else if (selectedRadio == 6) {
setState(() {
_pekerjaan = 'Pelajar/Mahasiswa';
opacityPekerjaan = 0;
});
} else if (selectedRadio == 7) {
setState(() {
_pekerjaan = 'TNI/Polisi';
opacityPekerjaan = 0;
});
} else if (selectedRadio == 8) {
setState(() {
_pekerjaan = 'Pensiunan';
opacityPekerjaan = 0;
});
} else {
setState(() {
_pekerjaan = 'Guru';
opacityPekerjaan = 0;
});
}
}
void validasiTujuanInvestasi(itemList) {
checkedtujuanInvestasiList = itemList;
print('CHECKED SUMBER PENGHASILAN $itemList');
......@@ -113,13 +317,17 @@ class _DataPendukungState extends State<DataPendukung> {
finalTujuanInvestasiList = [];
tujuanInvestasi = true;
for (var i = 0; i < checkedtujuanInvestasiList.length; i++) {
if (checkedtujuanInvestasiList[i] == ('Pendapatan')) {
if (checkedtujuanInvestasiList[i] == ('Pendapatan')
|| checkedtujuanInvestasiList[i] == ('5')) {
finalTujuanInvestasiList.add('5');
} else if (checkedtujuanInvestasiList[i] == ('Spekulasi')) {
} else if (checkedtujuanInvestasiList[i] == ('Spekulasi')
|| checkedtujuanInvestasiList[i] == ('4')) {
finalTujuanInvestasiList.add('4');
} else if (checkedtujuanInvestasiList[i] == ('Investasi')) {
} else if (checkedtujuanInvestasiList[i] == ('Investasi')
|| checkedtujuanInvestasiList[i] == ('3')) {
finalTujuanInvestasiList.add('3');
} else if (checkedtujuanInvestasiList[i] == ('Price Appreciation')) {
} else if (checkedtujuanInvestasiList[i] == ('Price Appreciation')
|| checkedtujuanInvestasiList[i] == ('2')) {
finalTujuanInvestasiList.add('2');
} else {
finalTujuanInvestasiList.add('1');
......@@ -209,10 +417,11 @@ class _DataPendukungState extends State<DataPendukung> {
@override
Widget build(BuildContext context) {
String radioItem;
// String radioItem;
if (_checkBox == true) {
_onPressed = () {
if (!_formkey.currentState.validate()) {
validateRadioButton(selectedRadio);
validasiSumberPenghasilan(checkedSumberPenghasilanList);
validasiTujuanInvestasi(checkedtujuanInvestasiList);
print("Failed");
......@@ -226,19 +435,25 @@ class _DataPendukungState extends State<DataPendukung> {
return;
}
// Api().education(latarBelakang);
// Api().income_source(finalSumberPenghasilanList);
// Api().occupation(radioItem);
// if (!(id == 4
// || id == 6
// || id == 8)) {
// Api().organization_name(val);
// Api().organization_field(val);
// Api().organization_address(val);
// Api().organization_phone(val);
// Api().position(val);
// }
// Api().motivation(finalTujuanInvestasiList);
if (alreadyFilledSection == true) {
Api().putMemberAttribute(getIdEducation, 'education', latarBelakang);
Api().putMemberAttribute(getIdOccupation, 'occupation', _pekerjaan);
} else {
Api().education(latarBelakang);
// Api().income_source(finalSumberPenghasilanList);
Api().occupation(_pekerjaan);
// belom bener parameternya
// if (!(id == 4
// || id == 6
// || id == 8)) {
// Api().organization_name(val);
// Api().organization_field(val);
// Api().organization_address(val);
// Api().organization_phone(val);
// Api().position(val);
// }
// Api().motivation(finalTujuanInvestasiList);
}
Navigator.push(context, MaterialPageRoute(builder: (context) {
return MaterialApp(home: MainScreen());
......@@ -277,7 +492,7 @@ class _DataPendukungState extends State<DataPendukung> {
// ignore: unused_element
void initState() {
super.initState();
id = 0;
selectedRadio = 0;
}
List<PekerjaanList> fList = [
......@@ -574,12 +789,16 @@ class _DataPendukungState extends State<DataPendukung> {
groupValue: id,
value: data.index,
onChanged: (val) {
setState(() {
radioItem = data.name;
id = data.index;
print(radioItem);
print(id);
});
validateRadioButton(data.index);
print(data.index);
// setState(() {
// radioItem = data.name;
// id = data.index;
// selectedRadio = data.index;
// print(radioItem);
// print(id);
// print(selectedRadio);
// });
},
))
.toList(),
......@@ -589,6 +808,19 @@ class _DataPendukungState extends State<DataPendukung> {
],
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Opacity(
opacity: opacityPekerjaan,
child: Text(
'Harus diisi',
style: TextStyle(
color: formError,
fontSize: 12,
),
),
),
),
hasilPekerjaan(),
// form tujuan investasi
......@@ -772,7 +1004,7 @@ class _DataPendukungState extends State<DataPendukung> {
// // ignore: missing_return
Widget hasilPekerjaan() {
if (!(id == 4 || id == 6 || id == 8)) {
if (!(selectedRadio == 4 || selectedRadio == 6 || selectedRadio == 8)) {
print('masuk');
return Container(
child: Row(children: <Widget>[
......
......@@ -29,6 +29,8 @@ class Validasi {
class _DataIdentitasState extends State<DataIdentitas> {
final GlobalKey<FormState> _formkey = GlobalKey<FormState>();
TextEditingController _formNomorKTP = TextEditingController();
TextEditingController _formNomorNPWP = TextEditingController();
// ignore: unused_field
String _noKTP;
// ignore: unused_field
......@@ -42,6 +44,56 @@ class _DataIdentitasState extends State<DataIdentitas> {
// ignore: unused_field
PickedFile _imageFileFotoSelfieDenganKTP;
int idKYC;
bool alreadyFilledSection = true;
int getIdNoKTP;
int getIdNoNPWP;
String getNoKTP;
String getNoNPWP;
void initState() {
super.initState();
init();
}
Future init() async {
final List<dynamic> jsonMemberAttribute = await Api().getMemberAttribute();
for (var i = 0; i < jsonMemberAttribute.length; i++) {
if (jsonMemberAttribute[i]['attribute_name'] ==
'identity_number') {
getIdNoKTP = jsonMemberAttribute[i]['id'];
getNoKTP = jsonMemberAttribute[i]['attribute_value'];
print(
"already filled this section before. nomor ktp = $getNoKTP");
} else if (jsonMemberAttribute[i]['attribute_name'] ==
'npwp_number') {
getIdNoNPWP = jsonMemberAttribute[i]['id'];
getNoNPWP = jsonMemberAttribute[i]['attribute_value'];
print(
"already filled this section before. nomor npwp = $getNoNPWP");
} else if (jsonMemberAttribute[i]['attribute_name'] == 'kyc_progress') {
var map = (jsonMemberAttribute[i] as Map<String, dynamic>);
idKYC = map['id'];
var val = map['attribute_value'];
var str = val.substring(1, val.length - 1);
var step1 = str.split(",")[3];
var value = step1.substring(8);
if (value == "true") {
setState(() {
alreadyFilledSection = true;
});
}
}
}
setState(() {
if (alreadyFilledSection) {
_formNomorKTP.text = getNoKTP;
_formNomorNPWP.text = getNoNPWP;
}
});
}
// ignore: missing_return
_openCameraKTP() async {
PickedFile pickedImage = await ImagePicker()
......@@ -228,6 +280,7 @@ class _DataIdentitasState extends State<DataIdentitas> {
margin: EdgeInsets.fromLTRB(0, 4, 0, 0),
child: TextFormField(
key: Key('noKtp'),
controller: _formNomorKTP,
keyboardType: TextInputType.number,
decoration: formInputDecoration(),
validator: Validasi.validate,
......@@ -277,6 +330,7 @@ class _DataIdentitasState extends State<DataIdentitas> {
margin: EdgeInsets.fromLTRB(0, 4, 0, 0),
child: TextFormField(
key: Key('noNpwp'),
controller: _formNomorNPWP,
keyboardType: TextInputType.number,
decoration: formInputDecoration(),
validator: Validasi.validate,
......@@ -396,20 +450,7 @@ class _DataIdentitasState extends State<DataIdentitas> {
primary: red1,
onPrimary: secondary,
),
onPressed: () {
if (!_formkey.currentState
.validate()) {
print("Failed");
return;
}
if (_imageFileKTP == null ||
_imageFileNPWP == null ||
_imageFileFotoSelfie == null ||
_imageFileFotoSelfieDenganKTP ==
null) {
print("masuk");
return;
}
onPressed: () {
Navigator.push(context,
MaterialPageRoute(
builder: (context) {
......
......@@ -123,7 +123,7 @@ void main() {
test('Latar belakang valid', () {
var tes = ValidasiTempat.validate('SD');
expect(tes, 'SD');
expect(tes, null);
});
test('Field kosong', () {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment