Skip to content

Commit

Permalink
Merge pull request #50 from E-Waste-Bank/staging
Browse files Browse the repository at this point in the history
Final: 2.0.1
  • Loading branch information
hugo-setiawan authored Dec 12, 2022
2 parents 50f2279 + d0eb56a commit 65d3356
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 18 deletions.
3 changes: 1 addition & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ android {
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.e_waste_bank_mobile"
applicationId "org.PBPF07.e_waste_bank_mobile"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</queries>

<application
android:label="e_waste_bank_mobile"
android:label="E-Waste Bank"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
30 changes: 30 additions & 0 deletions keuangan/lib/widgets/admin_list_cashouts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,36 @@ class _AdminListCashoutsPageState extends State<AdminListCashoutsPage> {
'approved': checkboxValue
.toString()
});
if (response[
'status']) {
// ignore: use_build_context_synchronously
ScaffoldMessenger
.of(context)
.showSnackBar(
SnackBar(
backgroundColor:
Colors.blue,
// ignore: prefer_const_constructors
content: Text(
"Request user berhasil diupdate",
style: const TextStyle(
color: Colors
.white),
),
action:
SnackBarAction(
label: 'Close',
textColor:
Colors
.white,
onPressed: () {
ScaffoldMessenger.of(
context)
.hideCurrentSnackBar();
},
),
));
}
// ignore: use_build_context_synchronously
Navigator.push(
context,
Expand Down
30 changes: 30 additions & 0 deletions keuangan/lib/widgets/admin_list_keuangan.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,36 @@ class _AdminListKeuanganPageState extends State<AdminListKeuanganPage> {
'uang_user': amount
.toString()
});
if (response[
'status']) {
// ignore: use_build_context_synchronously
ScaffoldMessenger
.of(context)
.showSnackBar(
SnackBar(
backgroundColor:
Colors.blue,
// ignore: prefer_const_constructors
content: Text(
"Uang user berhasil ditambahkan",
style: const TextStyle(
color: Colors
.white),
),
action:
SnackBarAction(
label: 'Close',
textColor:
Colors
.white,
onPressed: () {
ScaffoldMessenger.of(
context)
.hideCurrentSnackBar();
},
),
));
}
// ignore: use_build_context_synchronously
Navigator.push(
context,
Expand Down
16 changes: 6 additions & 10 deletions keuangan/lib/widgets/user_cashouts_create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:keuangan/providers/user_keuanganadmin_provider.dart';
import 'package:provider/provider.dart';
import 'package:pbp_django_auth/pbp_django_auth.dart';


class UserCreateCashoutsPage extends StatefulWidget {
const UserCreateCashoutsPage({Key? key}) : super(key: key);

Expand All @@ -19,7 +18,8 @@ class _UserCreateCashoutsPageState extends State<UserCreateCashoutsPage> {

@override
Widget build(BuildContext context) {
CookieRequest requester = Provider.of<CookieRequest>(context, listen: false);
CookieRequest requester =
Provider.of<CookieRequest>(context, listen: false);

return Scaffold(
appBar: AppBar(
Expand Down Expand Up @@ -86,8 +86,6 @@ class _UserCreateCashoutsPageState extends State<UserCreateCashoutsPage> {
return 'Nominal tidak boleh kosong!';
} else if (double.tryParse(value) == null) {
return 'Nominal tidak valid!';
} else if (((double.parse(value) / 0.01) % 1) != 0) { // TODO handler floating point menyebalkan
return 'Nominal hanya boleh mengandung dua angka di belakang koma!';
}
return null;
},
Expand Down Expand Up @@ -117,6 +115,7 @@ class _UserCreateCashoutsPageState extends State<UserCreateCashoutsPage> {
const Center(
child: Text(
"Request penarikan berhasil!",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold),
),
Expand All @@ -136,9 +135,7 @@ class _UserCreateCashoutsPageState extends State<UserCreateCashoutsPage> {
],
),
);
}
)
);
}));
} else {
showDialog(
context: context,
Expand All @@ -156,6 +153,7 @@ class _UserCreateCashoutsPageState extends State<UserCreateCashoutsPage> {
Center(
child: Text(
"Request penarikan gagal: ${response['message']}",
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold),
),
Expand All @@ -174,9 +172,7 @@ class _UserCreateCashoutsPageState extends State<UserCreateCashoutsPage> {
],
),
);
}
)
);
}));
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion keuangan/lib/widgets/user_cashouts_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CashoutDetailPage extends StatelessWidget {
backgroundColor: MaterialStateProperty.all(Colors.blue),
),
child: const Text(
'Back',
'Kembali',
style: TextStyle(color: Colors.white),
),
),
Expand Down
1 change: 1 addition & 0 deletions keuangan/lib/widgets/user_list_cashouts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class _UserListCashoutsPageState extends State<UserListCashoutsPage> {
children: const [
Text(
"Belum ada penarikan yang anda buat.",
textAlign: TextAlign.center,
style: TextStyle(color: Color(0xff59A5D8), fontSize: 20),
),
SizedBox(height: 8),
Expand Down
4 changes: 2 additions & 2 deletions lib/authentication/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,12 @@ class _LoginPageState extends State<LoginPage> {
TextButton(
onPressed: () async {
if (_loginPageFormKey.currentState!.validate()) {
// TODO CircularProgessIndicator
final response = await requester.login(
"https://e-waste-bank.up.railway.app/auth/login/", {
'username': username,
'password': password,
});

// TODO text formatting di dialog berhasil dan gagal
if (requester.loggedIn) {
userProvider.login(username, response['role']);
userKeuanganAdminProvider.login(
Expand All @@ -154,6 +152,7 @@ class _LoginPageState extends State<LoginPage> {
const Center(
child: Text(
"Login berhasil!",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold),
),
Expand Down Expand Up @@ -195,6 +194,7 @@ class _LoginPageState extends State<LoginPage> {
Center(
child: Text(
"Login gagal! ${response['message']}",
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.bold),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _MyDrawerState extends State<MyDrawer> {
Visibility(
visible: userProvider.isAuthenticated(),
child: ListTile(
title: const Text('penjemputan'),
title: const Text('Penjemputan'),
onTap: () {
Navigator.pushReplacement(
context,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.0.0+1
version: 2.0.1+1

environment:
sdk: '>=2.18.4 <3.0.0'
Expand Down

0 comments on commit 65d3356

Please sign in to comment.