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';
|
||||
@@ -82,7 +86,7 @@ class AuthRepository extends BaseRepository {
|
||||
// model: AuthDoctorModel.fromJson(resp["data"]["user"]),
|
||||
// );
|
||||
// return result;
|
||||
|
||||
|
||||
if (resp["status"] == "OK") {
|
||||
return resp['message'];
|
||||
} else {
|
||||
|
||||
@@ -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,355 +82,361 @@ class ReportScreen extends HookConsumerWidget {
|
||||
),
|
||||
drawer: CustomDrawer(),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Tanggal Awal',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Awal
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAwal,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Awal',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAwal = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAwal.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAwal.value,
|
||||
);
|
||||
|
||||
if (selectedDateAwal != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAwal);
|
||||
// ctrlTglAwal.text =
|
||||
// selectedDateAwal.toString().split(' ')[0];
|
||||
ctrlTglAwal.text = formattedDate;
|
||||
tglAwal.value = selectedDateAwal;
|
||||
tglAwalTmp.value = selectedDateAwal.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAwal == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 20),
|
||||
),
|
||||
|
||||
Text(
|
||||
'Tanggal Akhir',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Akhir
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAkhir,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Akhir',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAkhir = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode:
|
||||
DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAkhir.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAkhir.value,
|
||||
);
|
||||
|
||||
if (selectedDateAkhir != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAkhir);
|
||||
// ctrlTglAkhir.text =
|
||||
// selectedDateAkhir.toString().split(' ')[0];
|
||||
ctrlTglAkhir.text = formattedDate;
|
||||
tglAkhir.value = selectedDateAkhir;
|
||||
tglAkhirTmp.value = selectedDateAkhir.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAkhir == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Excel
|
||||
Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 336),
|
||||
height: Constant.getActualYPhone(context: context, y: 42),
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => Colors.white),
|
||||
// side: MaterialStateBorderSide.resolveWith(
|
||||
// (states) => BorderSide(color: Colors.green),
|
||||
// ),
|
||||
|
||||
// backgroundColor: MaterialStateColor.resolveWith(
|
||||
// (st) => Constant.pcBtnBackgroundColor),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Colors.green,
|
||||
Text(
|
||||
'Tanggal Awal',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Awal
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAwal,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Awal',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAwal = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAwal.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAwal.value,
|
||||
);
|
||||
|
||||
if (selectedDateAwal != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAwal);
|
||||
// ctrlTglAwal.text =
|
||||
// selectedDateAwal.toString().split(' ')[0];
|
||||
ctrlTglAwal.text = formattedDate;
|
||||
tglAwal.value = selectedDateAwal;
|
||||
tglAwalTmp.value = selectedDateAwal.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAwal == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
shadowColor:
|
||||
MaterialStateProperty.all(Color(0xffff48423d)),
|
||||
elevation: MaterialStateProperty.all(4.0),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
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",
|
||||
fit: BoxFit.fill,
|
||||
// scale: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualXPhone(context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
'Download Report (xls) ',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
// 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=0&username=adminsas%20";
|
||||
if (!await launchUrl(Uri.parse(url))) {
|
||||
// throw Exception('Could not launch $url');
|
||||
SanckbarWidget(context, 'Could not launch $url',
|
||||
snackbarType.error);
|
||||
}
|
||||
// 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(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(st) => Constant.pcBtnBackgroundColor),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Constant.pcBtnBackgroundColor,
|
||||
Text(
|
||||
'Tanggal Akhir',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600, color: Constant.textBlack),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualYPhone(context: context, y: 10),
|
||||
),
|
||||
// Tanggal Akhir
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: ctrlTglAkhir,
|
||||
decoration: InputDecoration(
|
||||
hintStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
labelStyle:
|
||||
Constant.body2_400(context: context).copyWith(
|
||||
color: Colors.orange,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.orange,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
// labelText: "Tanggal Awal",
|
||||
hintText: 'Tanggal Akhir',
|
||||
// suffixIcon: isLoadingFilterScope.value
|
||||
// ? SizedBox(
|
||||
// width: Constant.getActualXPhone(
|
||||
// context: context,
|
||||
// x: 4,
|
||||
// ),
|
||||
// height: Constant.getActualYPhone(
|
||||
// context: context,
|
||||
// y: 4,
|
||||
// ),
|
||||
// child: CircularProgressIndicator(
|
||||
// color: Constant.textRed,
|
||||
// ),
|
||||
// )
|
||||
// : Icon(
|
||||
// Icons.calendar_month_sharp,
|
||||
// color: Constant.colorIconDate,
|
||||
// ),
|
||||
),
|
||||
onTap: () async {
|
||||
final selectedDateAkhir = await showDatePicker(
|
||||
// locale: const Locale("en-CA"),
|
||||
// locale: ,
|
||||
context: context,
|
||||
initialEntryMode: DatePickerEntryMode.calendarOnly,
|
||||
firstDate: DateTime(2000),
|
||||
lastDate: DateTime(2100),
|
||||
|
||||
initialDate: (ctrlTglAkhir.text.isEmpty)
|
||||
? DateTime.now()
|
||||
: tglAkhir.value,
|
||||
);
|
||||
|
||||
if (selectedDateAkhir != null) {
|
||||
String formattedDate = DateFormat('dd-MM-yyyy')
|
||||
.format(selectedDateAkhir);
|
||||
// ctrlTglAkhir.text =
|
||||
// selectedDateAkhir.toString().split(' ')[0];
|
||||
ctrlTglAkhir.text = formattedDate;
|
||||
tglAkhir.value = selectedDateAkhir;
|
||||
tglAkhirTmp.value = selectedDateAkhir.toString();
|
||||
}
|
||||
|
||||
if (selectedDateAkhir == null) {
|
||||
print('cancel button');
|
||||
return;
|
||||
}
|
||||
},
|
||||
),
|
||||
shadowColor:
|
||||
MaterialStateProperty.all(Color(0xffff48423d)),
|
||||
elevation: MaterialStateProperty.all(4.0),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
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",
|
||||
fit: BoxFit.fill,
|
||||
// scale: 1,
|
||||
],
|
||||
),
|
||||
|
||||
Spacer(),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateColor.resolveWith(
|
||||
(states) => Colors.white),
|
||||
// side: MaterialStateBorderSide.resolveWith(
|
||||
// (states) => BorderSide(color: Colors.green),
|
||||
// ),
|
||||
|
||||
// backgroundColor: MaterialStateColor.resolveWith(
|
||||
// (st) => Constant.pcBtnBackgroundColor),
|
||||
shape:
|
||||
MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
Constant.getActualXPhone(context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
'Download Report (PDF)',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
shadowColor:
|
||||
MaterialStateProperty.all(Color(0xffff48423d)),
|
||||
elevation: MaterialStateProperty.all(4.0),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
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",
|
||||
fit: BoxFit.fill,
|
||||
// scale: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
'Download Report (xls) ',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.white),
|
||||
),
|
||||
],
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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(
|
||||
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=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',
|
||||
snackbarType.error);
|
||||
}
|
||||
// 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
|
||||
},
|
||||
),
|
||||
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);
|
||||
// }
|
||||
},
|
||||
),
|
||||
|
||||
// PDF
|
||||
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: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
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",
|
||||
fit: BoxFit.fill,
|
||||
// scale: 1,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: Constant.getActualXPhone(
|
||||
context: context, x: 8),
|
||||
),
|
||||
Text(
|
||||
'Download Report (PDF)',
|
||||
style: Constant.body1(context: context).copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Constant.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
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(
|
||||
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
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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