Skip to content

Commit

Permalink
Merge pull request #192 from fleetimee/refactor_submit
Browse files Browse the repository at this point in the history
feat: refactor submit reviewer
  • Loading branch information
fleetimee authored Apr 20, 2023
2 parents 03192af + 51c1595 commit 822eeba
Show file tree
Hide file tree
Showing 23 changed files with 2,951 additions and 1,906 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ class ReviewerSubmitController extends GetxController {
var isInputanRead = false.obs;
var isGalleryRead = false.obs;

var isHasilInputanRead = false.obs;
var isDraftUsulanRead = false.obs;
var isUsulanRead = false.obs;
var isDraftPutusanRead = false.obs;

var isLaporanKeuanganRead = false.obs;
var isKeteranganNeracaRead = false.obs;
var isAnalisaKeuanganRead = false.obs;

var isAnalisisKarakterRead = false.obs;

var isAnalisisBisnisRead = false.obs;

var isAnalisisUsahaRead = false.obs;

var isAnalisaAgunanRead = false.obs;
var isDetailAgunanRead = false.obs;

var isGalleryPhotoRead = false.obs;
var isGalleryDocumentRead = false.obs;

void getRating() async {
var debtor = insightDebitur.value;

Expand Down
2,266 changes: 403 additions & 1,863 deletions lib/app/modules/reviewer_submit/views/reviewer_submit_view.dart

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
// 🎯 Dart imports:

// 🐦 Flutter imports:
import 'package:akm/app/modules/reviewer_submit/controllers/reviewer_submit_controller.dart';
import 'package:akm/app/widget/dialog_box.dart';
import 'package:akm/app/widget/simple_snackbar.dart';
import 'package:flutter/material.dart';

// 📦 Package imports:
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:get/get.dart';
import 'package:getwidget/getwidget.dart';

// 🌎 Project imports:
import 'package:akm/app/common/style.dart';
import 'package:akm/app/routes/app_pages.dart';

class ReviewerAgunanSectionButton extends StatelessWidget {
const ReviewerAgunanSectionButton({
super.key,
required this.controller,
required this.iconNotyet,
required this.iconDone,
required this.buttonStyle,
});

final ReviewerSubmitController controller;
final Icon iconNotyet;
final Icon iconDone;
final TextStyle buttonStyle;

@override
Widget build(BuildContext context) {
TextStyle promptText(Color backgroundColor, BuildContext context) {
return Theme.of(context).textTheme.bodySmall!.merge(
TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: Colors.black87,
backgroundColor: backgroundColor,
),
);
}

TextStyle promptTextSubtitle(Color backgroundColor, BuildContext context) {
return Theme.of(context).textTheme.bodySmall!.merge(
TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.black87,
backgroundColor: backgroundColor,
),
);
}

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Obx(
() => controller.isAnalisaAgunanRead.value == false
? iconNotyet
: iconDone,
),
const SizedBox(
width: 5.0,
),
Expanded(
child: GFButton(
onPressed: () {
Get.toNamed(Routes.AGUNAN_PRINT,
arguments: controller.insightDebitur.value);

controller.isAnalisaAgunanRead(true);
},
color: primaryColor,
shape: GFButtonShape.pills,
text: 'Cek Analisa Agunan',
textStyle: buttonStyle,
fullWidthButton: true,
size: GFSize.LARGE,
),
),
],
),
const SizedBox(
height: 10.0,
),
Row(
children: [
Obx(
() => controller.isDetailAgunanRead.value == false
? iconNotyet
: iconDone,
),
const SizedBox(
width: 5.0,
),
Expanded(
child: GFButton(
onPressed: () {
Get.toNamed(Routes.DETAIL_AGUNAN,
arguments: controller.insightDebitur.value);

controller.isDetailAgunanRead(true);
},
color: primaryColor,
shape: GFButtonShape.pills,
text: 'Cek Detail Agunan',
textStyle: buttonStyle,
fullWidthButton: true,
size: GFSize.LARGE,
),
),
],
),
const SizedBox(height: 10),
Obx(
() => GestureDetector(
onTap: () {
if (!controller.isDetailAgunanRead.value ||
!controller.isAnalisaAgunanRead.value) {
ErrorDialog(
title: 'Perhatian',
desc:
'Silahkan cek detail agunan dan analisa agunan terlebih dahulu',
context: context,
btnOkOnPress: () {},
).show();
}
},
child: FormBuilderRadioGroup(
name: 'agunan',
activeColor: primaryColor,
enabled: controller.isDetailAgunanRead.value &&
controller.isAnalisaAgunanRead.value,
wrapAlignment: WrapAlignment.center,
onChanged: (value) {
// if clicked then change isPressed to true
controller.isAgunanPressed.value = true;

if (value == true) {
CustomSnackBar.show(
context, 'Agunan debitur ini dinyatakan LAYAK');
} else {
CustomSnackBar.show(
context, 'Agunan debitur ini dinyatakan TIDAK LAYAK');
}
},
decoration: InputDecoration(
labelText: 'Apakah agunan debitur ini layak?',
floatingLabelAlignment: FloatingLabelAlignment.center,
labelStyle: promptText(Colors.transparent, context),
border: InputBorder.none,
alignLabelWithHint: true,
),
options: [
FormBuilderFieldOption(
value: true,
child: Text('YA',
style: promptTextSubtitle(Colors.transparent, context)),
),
FormBuilderFieldOption(
value: false,
child: Text('TIDAK',
style: promptTextSubtitle(Colors.transparent, context)),
),
],
validator: FormBuilderValidators.required(),
),
),
),
],
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
// 🎯 Dart imports:

// 🐦 Flutter imports:
import 'package:akm/app/modules/reviewer_submit/controllers/reviewer_submit_controller.dart';
import 'package:akm/app/widget/dialog_box.dart';
import 'package:akm/app/widget/simple_snackbar.dart';
import 'package:flutter/material.dart';

// 📦 Package imports:
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:get/get.dart';
import 'package:getwidget/getwidget.dart';

// 🌎 Project imports:
import 'package:akm/app/common/style.dart';
import 'package:akm/app/routes/app_pages.dart';

class ReviewerSubmitBisnisButton extends StatelessWidget {
const ReviewerSubmitBisnisButton({
super.key,
required this.controller,
required this.iconNotYet,
required this.iconDone,
required this.buttonStyle,
});

final ReviewerSubmitController controller;
final Icon iconNotYet;
final Icon iconDone;
final TextStyle buttonStyle;

@override
Widget build(BuildContext context) {
TextStyle promptText(Color backgroundColor, BuildContext context) {
return Theme.of(context).textTheme.bodySmall!.merge(
TextStyle(
fontSize: 24,
fontWeight: FontWeight.w600,
color: Colors.black87,
backgroundColor: backgroundColor,
),
);
}

TextStyle promptTextSubtitle(Color backgroundColor, BuildContext context) {
return Theme.of(context).textTheme.bodySmall!.merge(
TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.black87,
backgroundColor: backgroundColor,
),
);
}

return Column(
children: [
Row(
children: [
Obx(
() => controller.isAnalisisBisnisRead.value == true
? iconDone
: iconNotYet,
),
const SizedBox(
width: 5,
),
Expanded(
child: GFButton(
onPressed: () {
Get.toNamed(Routes.BISNIS_PRINT,
arguments: controller.insightDebitur.value);

controller.isAnalisisBisnisRead(true);
},
color: primaryColor,
shape: GFButtonShape.pills,
text: 'Cek Analisa Bisnis',
textStyle: buttonStyle,
fullWidthButton: true,
size: GFSize.LARGE,
),
)
],
),
const SizedBox(
height: 10,
),
Obx(
() => GestureDetector(
onTap: () {
if (!controller.isAnalisisBisnisRead.value) {
// Show snackbar indicating that the radio group is disabled
ErrorDialog(
title: 'Analisa Bisnis Belum Dibaca',
desc: 'Silahkan baca analisa bisnis terlebih dahulu',
context: context,
btnOkOnPress: () {},
).show();
}
},
child: FormBuilderRadioGroup(
name: 'bisnis',
activeColor: primaryColor,
enabled: controller.isAnalisisBisnisRead.value,
wrapAlignment: WrapAlignment.center,
onChanged: (value) {
// if clicked then change isPressed to true
controller.isBisnisPressed.value = true;

if (value == true) {
CustomSnackBar.show(
context,
'Bisnis debitur ini dinyatakan LAYAK',
);
} else {
CustomSnackBar.show(
context,
'Bisnis debitur ini dinyatakan TIDAK LAYAK',
);
}
},
decoration: InputDecoration(
labelText: 'Apakah bisnis debitur ini layak?',
floatingLabelAlignment: FloatingLabelAlignment.center,
labelStyle: promptText(Colors.transparent, context),
border: InputBorder.none,
alignLabelWithHint: true,
),
options: [
FormBuilderFieldOption(
value: true,
child: Text(
'YA',
style: promptTextSubtitle(
Colors.transparent,
context,
),
),
),
FormBuilderFieldOption(
value: false,
child: Text('TIDAK',
style: promptTextSubtitle(Colors.transparent, context)),
),
],
validator: FormBuilderValidators.required(),
),
),
),
],
);
}
}
Loading

1 comment on commit 822eeba

@vercel
Copy link

@vercel vercel bot commented on 822eeba Apr 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.