step 16 : add M_CompanyID for trans, menu drawer, fix bug overflow btn
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
|
||||
import '../screen/change_company/change_company.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../screen/home/home_screen.dart';
|
||||
import '../screen/transaksi/history_transaksi_screen.dart';
|
||||
import '../screen/transaksi/transaksi_screen.dart';
|
||||
import '../screen/login/login_screen.dart';
|
||||
import '../screen/splash/splash_screen.dart';
|
||||
@@ -16,6 +17,8 @@ const homeRoute = "/homeRoute";
|
||||
const transaksiRoute = "/transaksiRoute";
|
||||
const userRoute = "/userRoute";
|
||||
const reportRoute = "/reportRoute";
|
||||
const changeCompanyRoute = "/changeCompanyRoute";
|
||||
const historyTransaksiRoute = "/historyTransaksiRoute";
|
||||
|
||||
// test screen
|
||||
const testFilePickerRoute = "/testFilePickerRoute";
|
||||
@@ -35,6 +38,32 @@ class AppRoute {
|
||||
});
|
||||
}
|
||||
|
||||
// change Company
|
||||
if (settings.name == changeCompanyRoute) {
|
||||
return MaterialPageRoute(builder: (context) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaleFactor: 1.0,
|
||||
padding: EdgeInsets.all(0),
|
||||
),
|
||||
child: ChangeCompanyScreen(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// history transaksi
|
||||
if (settings.name == historyTransaksiRoute) {
|
||||
return MaterialPageRoute(builder: (context) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaleFactor: 1.0,
|
||||
padding: EdgeInsets.all(0),
|
||||
),
|
||||
child: HistoryTransaksiScreen(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// report screen
|
||||
if (settings.name == reportRoute) {
|
||||
return MaterialPageRoute(builder: (context) {
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
import '../model/auth_model.dart';
|
||||
import 'base_repository.dart';
|
||||
|
||||
@@ -2,11 +2,33 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../app/constant.dart';
|
||||
|
||||
abstract class BaseRepository {
|
||||
final Dio dio;
|
||||
BaseRepository({required this.dio});
|
||||
|
||||
Future<String> getCompanyID() async {
|
||||
final shared = await SharedPreferences.getInstance();
|
||||
String M_CompanyID = "0";
|
||||
|
||||
if (shared != null) {
|
||||
final bearerString = shared.get(Constant.bearerName).toString();
|
||||
final xmodel = jsonDecode(bearerString);
|
||||
if (xmodel != null) {
|
||||
M_CompanyID = xmodel["model"]["M_CompanyID"];
|
||||
}
|
||||
}
|
||||
|
||||
if (M_CompanyID == "0") {
|
||||
throw BaseRepositoryException(message: 'Invalid Company ID');
|
||||
}
|
||||
|
||||
return M_CompanyID;
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> post({
|
||||
required Map<String, dynamic> param,
|
||||
required String service,
|
||||
|
||||
@@ -58,6 +58,7 @@ class TransaksiRepository extends BaseRepository {
|
||||
String sender,
|
||||
String url) async {
|
||||
String paramPostInUrl = "";
|
||||
String M_CompanyID = await getCompanyID();
|
||||
if (tipe == "DEBIT") {
|
||||
sender = "";
|
||||
paramPostInUrl =
|
||||
@@ -69,6 +70,8 @@ class TransaksiRepository extends BaseRepository {
|
||||
"?tanggal=$tanggal&tipe=$tipe&kategoriid=$kategoriid&jumlah=$jumlah&catatan=$catatan&url=$url&userid=$userid&sender=$sender";
|
||||
}
|
||||
}
|
||||
|
||||
paramPostInUrl += "&companyid=$M_CompanyID";
|
||||
// /?tanggal=2023-12-29&tipe=KREDIT&kategoriid=3&jumlah=5000&catatan=Lakban%20Besar&url=&userid=1&sender=
|
||||
|
||||
final service =
|
||||
|
||||
@@ -25,6 +25,7 @@ class ChangeCompanyScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
drawer: CustomDrawer(),
|
||||
body: Text('Under Construction'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../widget/sankbar_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
@@ -25,6 +29,26 @@ class ReportScreen extends HookConsumerWidget {
|
||||
|
||||
final tglAkhir = useState<DateTime>(DateTime.now());
|
||||
final tglAkhirTmp = useState<String>("");
|
||||
String M_CompanyID = "0";
|
||||
|
||||
Future<String> getCompanyID() async {
|
||||
final shared = await SharedPreferences.getInstance();
|
||||
String M_CompanyID = "0";
|
||||
|
||||
if (shared != null) {
|
||||
final bearerString = shared.get(Constant.bearerName).toString();
|
||||
final xmodel = jsonDecode(bearerString);
|
||||
if (xmodel != null) {
|
||||
M_CompanyID = xmodel["model"]["M_CompanyID"];
|
||||
}
|
||||
}
|
||||
|
||||
if (M_CompanyID == "0") {
|
||||
// throw BaseRepositoryException(message: 'Invalid Company ID');
|
||||
}
|
||||
|
||||
return M_CompanyID;
|
||||
}
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
@@ -58,7 +82,6 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
drawer: CustomDrawer(),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
@@ -125,8 +148,7 @@ class ReportScreen extends HookConsumerWidget {
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
@@ -220,8 +242,7 @@ class ReportScreen extends HookConsumerWidget {
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
@@ -249,27 +270,13 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Container(
|
||||
// height: 150,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
// right: Constant.getActualXPhone(context: context, x: 27),
|
||||
// left: Constant.getActualXPhone(context: context, x: 27),
|
||||
// bottom: Constant.getActualYPhone(context: context, y: 32),
|
||||
top: Constant.getActualYPhone(context: context, y: 24),
|
||||
),
|
||||
child: Column(
|
||||
|
||||
Spacer(),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// Excel
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
child: ElevatedButton(
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => Colors.white),
|
||||
@@ -279,7 +286,8 @@ class ReportScreen extends HookConsumerWidget {
|
||||
|
||||
// backgroundColor: MaterialStateColor.resolveWith(
|
||||
// (st) => Constant.pcBtnBackgroundColor),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
shape:
|
||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
@@ -295,10 +303,10 @@ class ReportScreen extends HookConsumerWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width:
|
||||
Constant.getActualXPhone(context: context, x: 16),
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 16),
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 16),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 16),
|
||||
// decoration: BoxDecoration(color: Colors.grey),
|
||||
child: Image.asset(
|
||||
"images/logo_excel.png",
|
||||
@@ -307,8 +315,8 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualXPhone(context: context, x: 8),
|
||||
height: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
'Download Report (xls) ',
|
||||
@@ -320,22 +328,29 @@ class ReportScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
M_CompanyID = await getCompanyID();
|
||||
if(M_CompanyID == "0"){
|
||||
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
|
||||
return;
|
||||
}
|
||||
// Awal
|
||||
DateTime parsedDateAwal = DateFormat('dd-MM-yyyy').parse(
|
||||
DateTime parsedDateAwal =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAwal =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAwal);
|
||||
|
||||
// Akhir
|
||||
DateTime parsedDateAkhir = DateFormat('dd-MM-yyyy').parse(
|
||||
DateTime parsedDateAkhir =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAkhir =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
|
||||
|
||||
String url =
|
||||
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=0&username=adminsas%20";
|
||||
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=xls&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20";
|
||||
if (!await launchUrl(Uri.parse(url))) {
|
||||
// throw Exception('Could not launch $url');
|
||||
SanckbarWidget(context, 'Could not launch $url',
|
||||
@@ -344,21 +359,14 @@ class ReportScreen extends HookConsumerWidget {
|
||||
// https://devone.aplikasi.web.id/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=2023-11-01&PEndDate=2023-12-30&PCompanyID=0&username=adminsas%20&tm=1701327096267
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
|
||||
// PDF
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
child: ElevatedButton(
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(st) => Constant.pcBtnBackgroundColor),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
shape:
|
||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
@@ -374,10 +382,10 @@ class ReportScreen extends HookConsumerWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width:
|
||||
Constant.getActualXPhone(context: context, x: 16),
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 16),
|
||||
width: Constant.getActualXPhone(
|
||||
context: context, x: 16),
|
||||
height: Constant.getActualYPhone(
|
||||
context: context, y: 16),
|
||||
// decoration: BoxDecoration(color: Colors.grey),
|
||||
child: Image.asset(
|
||||
"images/logo_pdf.png",
|
||||
@@ -386,8 +394,8 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualXPhone(context: context, x: 8),
|
||||
height: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
'Download Report (PDF)',
|
||||
@@ -398,15 +406,37 @@ class ReportScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
// String url =
|
||||
// "https://pub.dev/packages?q=url+launcher";
|
||||
// if (!await launchUrl(Uri.parse(url))) {
|
||||
// // throw Exception('Could not launch $url');
|
||||
// SanckbarWidget(context, 'Could not launch $url',
|
||||
// snackbarType.error);
|
||||
// }
|
||||
M_CompanyID = await getCompanyID();
|
||||
if(M_CompanyID == "0"){
|
||||
SanckbarWidget(context, 'Invalid Company', snackbarType.error);
|
||||
return;
|
||||
}
|
||||
// Awal
|
||||
DateTime parsedDateAwal =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAwal =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAwal);
|
||||
|
||||
// Akhir
|
||||
DateTime parsedDateAkhir =
|
||||
DateFormat('dd-MM-yyyy').parse(
|
||||
ctrlTglAwal.value.text.toString(),
|
||||
);
|
||||
String formattedDateAkhir =
|
||||
DateFormat('yyyy-MM-dd').format(parsedDateAkhir);
|
||||
|
||||
String url =
|
||||
"https://${Constant.baseUrlDevoneReport}/birt/run?__report=report/one/pettycash/rpt_r_pt_001.rptdesign&__format=pdf&PStartDate=$formattedDateAwal&PEndDate=$formattedDateAkhir&PCompanyID=$M_CompanyID&username=adminsas%20";
|
||||
if (!await launchUrl(Uri.parse(url))) {
|
||||
// throw Exception('Could not launch $url');
|
||||
SanckbarWidget(context, 'Could not launch $url',
|
||||
snackbarType.error);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../widget/custom_drawer.dart';
|
||||
|
||||
class HistoryTransaksiScreen extends HookConsumerWidget {
|
||||
const HistoryTransaksiScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualYPhone(context: context, y: 30),
|
||||
),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'History Transaksi',
|
||||
style: TextStyle(color: Constant.textWhite),
|
||||
),
|
||||
backgroundColor: Constant.pcBtnBackgroundColor,
|
||||
iconTheme: IconThemeData(
|
||||
color: Constant.textWhite,
|
||||
),
|
||||
),
|
||||
drawer: CustomDrawer(),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height - 10,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Card(
|
||||
margin: EdgeInsets.all(16.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Tipe Catatan: DEBIT'),
|
||||
SizedBox(height: 8.0),
|
||||
Text('Tanggal: 15-12-2023'),
|
||||
SizedBox(height: 8.0),
|
||||
Text('Nominal: 100.000'),
|
||||
SizedBox(height: 8.0),
|
||||
Text('Kategori: Jumat Sehat'),
|
||||
SizedBox(height: 8.0),
|
||||
Chip(
|
||||
label: Text('Verify'),
|
||||
backgroundColor: Constant.green_600,
|
||||
labelStyle: TextStyle(color: Colors.white),
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
// Handle delete button tap
|
||||
},
|
||||
child: Text(
|
||||
'Delete',
|
||||
style: TextStyle(
|
||||
color: Constant.textWhite
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors
|
||||
.red, // Ganti dengan warna delete button yang diinginkan
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -156,6 +156,9 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
// Navigator.popAndPushNamed(context, loginRoute);
|
||||
return;
|
||||
}
|
||||
|
||||
ctrlCompanyName.text =
|
||||
ref.read(currentUserProvider)?.model.M_CompanyName ?? "";
|
||||
});
|
||||
return () {};
|
||||
}, []);
|
||||
@@ -200,6 +203,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height - 10,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -207,7 +212,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
Text(
|
||||
'Company Name',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
@@ -246,7 +252,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
Text(
|
||||
'Tanggal Transaksi',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
@@ -342,7 +349,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
Text(
|
||||
'Tipe Transaksi',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
@@ -389,7 +397,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
},
|
||||
),
|
||||
Text(
|
||||
listTypeData.value[i].typename ?? "",
|
||||
listTypeData.value[i].typename ??
|
||||
"",
|
||||
style:
|
||||
Constant.body1(context: context)
|
||||
.copyWith(
|
||||
@@ -409,7 +418,7 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
),
|
||||
|
||||
// Kategori
|
||||
if (selectedListTypeData.value.typeid == "KREDIT") ...[
|
||||
if (selectedListTypeData.value.typeid == "DEBIT") ...[
|
||||
Text(
|
||||
'Kategori',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
@@ -418,7 +427,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Dropdown kategori
|
||||
(listCategoryLoading.value)
|
||||
@@ -442,7 +452,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Select Item',
|
||||
style: Constant.body1(context: context)
|
||||
style: Constant.body1(
|
||||
context: context)
|
||||
.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
@@ -468,7 +479,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
onChanged: (ListCategory? newValue) {
|
||||
// if (newValue) {
|
||||
selectedListCategory.value = newValue!;
|
||||
print(selectedListCategory.value.categoryid);
|
||||
print(
|
||||
selectedListCategory.value.categoryid);
|
||||
// }
|
||||
},
|
||||
buttonStyleData: ButtonStyleData(
|
||||
@@ -551,12 +563,13 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
],
|
||||
|
||||
// Nama Pengirim
|
||||
if (selectedListTypeData.value.typeid == "DEBIT") ...[
|
||||
if (selectedListTypeData.value.typeid == "KREDIT") ...[
|
||||
Text(
|
||||
'Nama Pengirim',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
@@ -564,7 +577,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
height:
|
||||
Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
TextField(
|
||||
controller: ctrlNamaPengirim,
|
||||
@@ -602,7 +616,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
Text(
|
||||
'Jumlah',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
@@ -611,10 +626,12 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
controller: ctrlJumlah,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
hintStyle: Constant.body2_400(context: context).copyWith(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
labelStyle: Constant.body2_400(context: context).copyWith(
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
@@ -642,7 +659,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
Text(
|
||||
'Catatan',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
@@ -652,10 +670,12 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
controller: ctrlCatatan,
|
||||
maxLines: 4,
|
||||
decoration: InputDecoration(
|
||||
hintStyle: Constant.body2_400(context: context).copyWith(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
labelStyle: Constant.body2_400(context: context).copyWith(
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Constant.textGreyv2,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
@@ -701,28 +721,17 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
right: Constant.getActualXPhone(context: context, x: 27),
|
||||
left: Constant.getActualXPhone(context: context, x: 27),
|
||||
bottom: Constant.getActualYPhone(context: context, y: 32),
|
||||
top: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
child: BottomAppBar(
|
||||
elevation: 2.0,
|
||||
child: Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
|
||||
Spacer(),
|
||||
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 390),
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(st) => Constant.pcBtnBackgroundColor),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
shape:
|
||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
@@ -730,7 +739,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
shadowColor: MaterialStateProperty.all(Color(0xffff48423d)),
|
||||
shadowColor:
|
||||
MaterialStateProperty.all(Color(0xffff48423d)),
|
||||
elevation: MaterialStateProperty.all(4.0),
|
||||
),
|
||||
child: Stack(
|
||||
@@ -747,7 +757,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
)
|
||||
: Text(
|
||||
'Simpan',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
style: Constant.body1(context: context)
|
||||
.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.white),
|
||||
),
|
||||
@@ -773,18 +784,22 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
DateFormat('yyyy-MM-dd').format(parsedDate);
|
||||
var param = {
|
||||
"tgltransaksi": formattedDateTransaksi,
|
||||
"typeid": selectedListTypeData.value.typeid.toString(),
|
||||
"typeid":
|
||||
selectedListTypeData.value.typeid.toString(),
|
||||
"categoryid":
|
||||
selectedListCategory.value.categoryid.toString(),
|
||||
"jumlah": ctrlJumlah.value.text.toString(),
|
||||
"catatan": ctrlCatatan.value.text.toString(),
|
||||
// "userid": "1",
|
||||
"userid": userIDLogin,
|
||||
"namapengirim": ctrlNamaPengirim.value.text.toString(),
|
||||
"namapengirim":
|
||||
ctrlNamaPengirim.value.text.toString(),
|
||||
"url": "",
|
||||
};
|
||||
print(param);
|
||||
ref.read(insertTransaksiProvider.notifier).insertTransaksi(
|
||||
ref
|
||||
.read(insertTransaksiProvider.notifier)
|
||||
.insertTransaksi(
|
||||
formattedDateTransaksi,
|
||||
selectedListTypeData.value.typeid.toString(),
|
||||
selectedListCategory.value.categoryid.toString(),
|
||||
@@ -798,9 +813,106 @@ class TransaksiScreen extends HookConsumerWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// bottomNavigationBar: Padding(
|
||||
// padding: EdgeInsets.only(
|
||||
// right: Constant.getActualXPhone(context: context, x: 27),
|
||||
// left: Constant.getActualXPhone(context: context, x: 27),
|
||||
// bottom: Constant.getActualYPhone(context: context, y: 32),
|
||||
// top: Constant.getActualYPhone(context: context, y: 10),
|
||||
// ),
|
||||
// child: BottomAppBar(
|
||||
// elevation: 2.0,
|
||||
// child: Container(
|
||||
// width: Constant.getActualXPhone(context: context, x: 336),
|
||||
// height: Constant.getActualYPhone(context: context, y: 42),
|
||||
// child: ElevatedButton(
|
||||
// style: ButtonStyle(
|
||||
// backgroundColor: MaterialStateColor.resolveWith(
|
||||
// (st) => Constant.pcBtnBackgroundColor),
|
||||
// shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
// RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// side: BorderSide(
|
||||
// color: Constant.pcBtnBackgroundColor,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// shadowColor: MaterialStateProperty.all(Color(0xffff48423d)),
|
||||
// elevation: MaterialStateProperty.all(4.0),
|
||||
// ),
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// (transaksiIsLoading.value)
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context, x: 24),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context, y: 32),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// )
|
||||
// : Text(
|
||||
// 'Simpan',
|
||||
// style: Constant.body1(context: context).copyWith(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// color: Constant.white),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// if (selectedListTypeData.value.typeid.toString() == "DEBIT") {
|
||||
// ctrlNamaPengirim.text = "";
|
||||
// // validasi form
|
||||
// } else {
|
||||
// if (selectedListTypeData.value.typeid.toString() ==
|
||||
// "KREDIT") {
|
||||
// selectedListCategory.value.categoryid = "0";
|
||||
// // validasi form
|
||||
// }
|
||||
// }
|
||||
|
||||
// DateTime parsedDate = DateFormat('dd-MM-yyyy').parse(
|
||||
// ctrlTglAwal.value.text.toString(),
|
||||
// );
|
||||
// String formattedDateTransaksi =
|
||||
// DateFormat('yyyy-MM-dd').format(parsedDate);
|
||||
// var param = {
|
||||
// "tgltransaksi": formattedDateTransaksi,
|
||||
// "typeid": selectedListTypeData.value.typeid.toString(),
|
||||
// "categoryid":
|
||||
// selectedListCategory.value.categoryid.toString(),
|
||||
// "jumlah": ctrlJumlah.value.text.toString(),
|
||||
// "catatan": ctrlCatatan.value.text.toString(),
|
||||
// // "userid": "1",
|
||||
// "userid": userIDLogin,
|
||||
// "namapengirim": ctrlNamaPengirim.value.text.toString(),
|
||||
// "url": "",
|
||||
// };
|
||||
// print(param);
|
||||
// ref.read(insertTransaksiProvider.notifier).insertTransaksi(
|
||||
// formattedDateTransaksi,
|
||||
// selectedListTypeData.value.typeid.toString(),
|
||||
// selectedListCategory.value.categoryid.toString(),
|
||||
// ctrlJumlah.value.text.toString(),
|
||||
// ctrlCatatan.value.text.toString(),
|
||||
// // "1",
|
||||
// userIDLogin,
|
||||
// ctrlNamaPengirim.value.text.toString(),
|
||||
// "",
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,22 +70,22 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
|
||||
return Drawer(
|
||||
child: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
top: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// padding: EdgeInsets.only(
|
||||
// top: Constant.getActualYPhone(context: context, y: 10),
|
||||
// ),
|
||||
children: [
|
||||
// DrawerHeader(
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.blue,
|
||||
// ),
|
||||
// child: Text(
|
||||
// 'Drawer Header',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 24,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
DrawerHeader(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.blue,
|
||||
),
|
||||
child: Text(
|
||||
'Drawer Header',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Home',
|
||||
@@ -126,7 +126,7 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Report',
|
||||
'History Transaksi',
|
||||
style: TextStyle(
|
||||
color: (currentMenu == 2)
|
||||
? Constant.textWhite
|
||||
@@ -137,15 +137,15 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
? Constant.pcBtnBackgroundColor
|
||||
: Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to Transaksi screen
|
||||
// Handle navigation to User screen
|
||||
Navigator.pop(context);
|
||||
ref.read(currentPageProvider.state).update((state) => 2);
|
||||
Navigator.pushNamed(context, reportRoute);
|
||||
Navigator.pushNamed(context, historyTransaksiRoute);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'User',
|
||||
'Report',
|
||||
style: TextStyle(
|
||||
color: (currentMenu == 3)
|
||||
? Constant.textWhite
|
||||
@@ -156,12 +156,50 @@ class CustomDrawer extends HookConsumerWidget {
|
||||
? Constant.pcBtnBackgroundColor
|
||||
: Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to User screen
|
||||
// Handle navigation to Transaksi screen
|
||||
Navigator.pop(context);
|
||||
ref.read(currentPageProvider.state).update((state) => 3);
|
||||
Navigator.pushNamed(context, reportRoute);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'User',
|
||||
style: TextStyle(
|
||||
color: (currentMenu == 4)
|
||||
? Constant.textWhite
|
||||
: Constant.textBlack,
|
||||
),
|
||||
),
|
||||
tileColor: (currentMenu == 4)
|
||||
? Constant.pcBtnBackgroundColor
|
||||
: Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to User screen
|
||||
Navigator.pop(context);
|
||||
ref.read(currentPageProvider.state).update((state) => 4);
|
||||
Navigator.pushNamed(context, userRoute);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Change Company',
|
||||
style: TextStyle(
|
||||
color: (currentMenu == 5)
|
||||
? Constant.textWhite
|
||||
: Constant.textBlack,
|
||||
),
|
||||
),
|
||||
tileColor: (currentMenu == 5)
|
||||
? Constant.pcBtnBackgroundColor
|
||||
: Colors.transparent,
|
||||
onTap: () {
|
||||
// Handle navigation to User screen
|
||||
Navigator.pop(context);
|
||||
ref.read(currentPageProvider.state).update((state) => 5);
|
||||
Navigator.pushNamed(context, changeCompanyRoute);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
'Logout',
|
||||
|
||||
Reference in New Issue
Block a user