Compare commits
2 Commits
add_change
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4974e02956 | ||
|
|
4e3d251169 |
@@ -13,7 +13,7 @@ class Constant {
|
|||||||
// static String version = "1.00";
|
// static String version = "1.00";
|
||||||
|
|
||||||
// NOTE VERSI HARUS SAMA DENGAN PUBSPEC.YAML
|
// NOTE VERSI HARUS SAMA DENGAN PUBSPEC.YAML
|
||||||
static String version = "1.1.5";
|
static String version = "1.2.0";
|
||||||
|
|
||||||
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/";
|
// static String baseUrl = "https://devregonline.pramita.co.id/one-api/xdoc/";
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import 'package:app_petty_cash/screen/change_pasword/change_password_screen.dart';
|
|
||||||
|
|
||||||
import '../screen/change_company/change_company.dart';
|
import '../screen/change_company/change_company.dart';
|
||||||
import 'package:app_petty_cash/screen/camera/coba_camera.dart';
|
import 'package:app_petty_cash/screen/camera/coba_camera.dart';
|
||||||
import 'package:app_petty_cash/screen/camera/example.dart';
|
import 'package:app_petty_cash/screen/camera/example.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../screen/change_password/change_password_screen.dart';
|
||||||
import '../screen/home/home_screen.dart';
|
import '../screen/home/home_screen.dart';
|
||||||
import '../screen/transaksi/history_transaksi_screen.dart';
|
import '../screen/transaksi/history_transaksi_screen.dart';
|
||||||
import '../screen/transaksi/transaksi_screen.dart';
|
import '../screen/transaksi/transaksi_screen.dart';
|
||||||
@@ -22,7 +21,6 @@ const transaksiRoute = "/transaksiRoute";
|
|||||||
const userRoute = "/userRoute";
|
const userRoute = "/userRoute";
|
||||||
const reportRoute = "/reportRoute";
|
const reportRoute = "/reportRoute";
|
||||||
const changeCompanyRoute = "/changeCompanyRoute";
|
const changeCompanyRoute = "/changeCompanyRoute";
|
||||||
const changePasswordRoute = "/changePasswordRoute";
|
|
||||||
const historyTransaksiRoute = "/historyTransaksiRoute";
|
const historyTransaksiRoute = "/historyTransaksiRoute";
|
||||||
const cameraExampleRoute = "/cameraExampleRoute";
|
const cameraExampleRoute = "/cameraExampleRoute";
|
||||||
const cobaCameraRoute = "/cobaCameraRoute";
|
const cobaCameraRoute = "/cobaCameraRoute";
|
||||||
@@ -30,8 +28,24 @@ const cobaCameraRoute = "/cobaCameraRoute";
|
|||||||
// test screen
|
// test screen
|
||||||
const testFilePickerRoute = "/testFilePickerRoute";
|
const testFilePickerRoute = "/testFilePickerRoute";
|
||||||
|
|
||||||
|
const changePasswordRoute = "/changePasswordRoute";
|
||||||
|
|
||||||
class AppRoute {
|
class AppRoute {
|
||||||
static Route<dynamic> generateRoute(RouteSettings settings) {
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
||||||
|
|
||||||
|
// change password
|
||||||
|
if (settings.name == changePasswordRoute) {
|
||||||
|
return MaterialPageRoute(builder: (context) {
|
||||||
|
return MediaQuery(
|
||||||
|
data: MediaQuery.of(context).copyWith(
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
padding: EdgeInsets.all(0),
|
||||||
|
),
|
||||||
|
child: ChangePasswordScreen(),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// splash screen
|
// splash screen
|
||||||
if (settings.name == splashScreen) {
|
if (settings.name == splashScreen) {
|
||||||
return MaterialPageRoute(builder: (context) {
|
return MaterialPageRoute(builder: (context) {
|
||||||
@@ -122,18 +136,6 @@ class AppRoute {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// transaksi screen
|
|
||||||
if (settings.name == changePasswordRoute) {
|
|
||||||
return MaterialPageRoute(builder: (context) {
|
|
||||||
return MediaQuery(
|
|
||||||
data: MediaQuery.of(context).copyWith(
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
padding: EdgeInsets.all(0),
|
|
||||||
),
|
|
||||||
child: ChangePasswordScreen(),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// test file picker screen
|
// test file picker screen
|
||||||
if (settings.name == testFilePickerRoute) {
|
if (settings.name == testFilePickerRoute) {
|
||||||
|
|||||||
17
app_petty_cash/lib/model/history_total_model.dart
Normal file
17
app_petty_cash/lib/model/history_total_model.dart
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
class HistoryTotalModel {
|
||||||
|
String? totalAll;
|
||||||
|
|
||||||
|
HistoryTotalModel({
|
||||||
|
this.totalAll,
|
||||||
|
});
|
||||||
|
|
||||||
|
HistoryTotalModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
totalAll = json['total_all'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['total_all'] = this.totalAll;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import '../model/history_total_model.dart';
|
||||||
|
|
||||||
|
final currentHistoryTotalProvider = StateProvider<HistoryTotalModel>(
|
||||||
|
((ref) => HistoryTotalModel(
|
||||||
|
totalAll: "0",
|
||||||
|
)),
|
||||||
|
);
|
||||||
@@ -59,6 +59,43 @@ class AuthRepository extends BaseRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String> change_password({
|
||||||
|
required String token,
|
||||||
|
required String M_UserID,
|
||||||
|
required String username,
|
||||||
|
required String doctor_id,
|
||||||
|
required String new_password,
|
||||||
|
required String confirm_password,
|
||||||
|
}) async {
|
||||||
|
final param = {
|
||||||
|
"token": token,
|
||||||
|
"M_UserID": M_UserID,
|
||||||
|
"username": username,
|
||||||
|
"doctor_id": doctor_id,
|
||||||
|
"new_password": new_password,
|
||||||
|
"confirm_password": confirm_password
|
||||||
|
|
||||||
|
// "username": "alhadad",
|
||||||
|
// "doctor_id": "3101210841",
|
||||||
|
// "password": "riau123"
|
||||||
|
};
|
||||||
|
|
||||||
|
final service = "${Constant.baseUrlDevone}auth/change_password";
|
||||||
|
final resp = await post(param: param, service: service);
|
||||||
|
|
||||||
|
// final result = AuthModel(
|
||||||
|
// token: resp["data"]["token"],
|
||||||
|
// model: AuthDoctorModel.fromJson(resp["data"]["user"]),
|
||||||
|
// );
|
||||||
|
// return result;
|
||||||
|
|
||||||
|
if (resp["status"] == "OK") {
|
||||||
|
return resp['message'];
|
||||||
|
} else {
|
||||||
|
return resp['message'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> changePassword({
|
Future<String> changePassword({
|
||||||
required String userID,
|
required String userID,
|
||||||
required String token,
|
required String token,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
|||||||
import 'package:app_petty_cash/model/list_type_model.dart';
|
import 'package:app_petty_cash/model/list_type_model.dart';
|
||||||
|
|
||||||
import '../app/constant.dart';
|
import '../app/constant.dart';
|
||||||
|
import '../model/history_total_model.dart';
|
||||||
import '../model/history_transaksi_model.dart';
|
import '../model/history_transaksi_model.dart';
|
||||||
import '../model/list_category_model.dart';
|
import '../model/list_category_model.dart';
|
||||||
import 'base_repository.dart';
|
import 'base_repository.dart';
|
||||||
@@ -216,4 +217,33 @@ class TransaksiRepository extends BaseRepository {
|
|||||||
|
|
||||||
return resp['status'];
|
return resp['status'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// total by category di history
|
||||||
|
Future<HistoryTotalModel> getHistoryTotal(
|
||||||
|
String companyid,
|
||||||
|
String tglAwal,
|
||||||
|
String tglAkhir,
|
||||||
|
String categoryid,
|
||||||
|
) async {
|
||||||
|
final service =
|
||||||
|
"${Constant.baseUrlDevone}history/list_total/?companyid=$companyid&startdate=$tglAwal&enddate=$tglAkhir&kategoriid=$categoryid";
|
||||||
|
final resp = await get(
|
||||||
|
// param: {
|
||||||
|
// "": "",
|
||||||
|
// },
|
||||||
|
service: service,
|
||||||
|
);
|
||||||
|
|
||||||
|
print("url total History Transaksi : $service");
|
||||||
|
|
||||||
|
HistoryTotalModel result = HistoryTotalModel(
|
||||||
|
totalAll: "0",
|
||||||
|
);
|
||||||
|
|
||||||
|
// print(resp['data']);
|
||||||
|
|
||||||
|
final model = HistoryTotalModel.fromJson(resp['data']);
|
||||||
|
result = model;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:app_petty_cash/app/constant.dart';
|
import 'package:app_petty_cash/app/constant.dart';
|
||||||
import 'package:app_petty_cash/provider/current_menu_provider.dart';
|
|
||||||
import 'package:app_petty_cash/screen/change_pasword/change_password_provider.dart';
|
|
||||||
import 'package:app_petty_cash/screen/login/logout_provider.dart';
|
|
||||||
import 'package:app_petty_cash/widget/custom_drawer.dart';
|
import 'package:app_petty_cash/widget/custom_drawer.dart';
|
||||||
import 'package:app_petty_cash/widget/sankbar_widget.dart';
|
import 'package:app_petty_cash/widget/sankbar_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -13,6 +8,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
|
|
||||||
import '../../app/route.dart';
|
import '../../app/route.dart';
|
||||||
import '../../provider/current_user_provider.dart';
|
import '../../provider/current_user_provider.dart';
|
||||||
|
import 'change_password_provider.dart';
|
||||||
|
|
||||||
class ChangePasswordScreen extends HookConsumerWidget {
|
class ChangePasswordScreen extends HookConsumerWidget {
|
||||||
const ChangePasswordScreen({super.key});
|
const ChangePasswordScreen({super.key});
|
||||||
@@ -26,7 +22,11 @@ class ChangePasswordScreen extends HookConsumerWidget {
|
|||||||
final tokenx = ref.read(currentUserProvider)?.token ?? "";
|
final tokenx = ref.read(currentUserProvider)?.token ?? "";
|
||||||
|
|
||||||
final isLoading = useState(false);
|
final isLoading = useState(false);
|
||||||
final obscureText = useState<bool>(true);
|
|
||||||
|
final obscureTextOldPassword = useState<bool>(true);
|
||||||
|
final obscureTextNewPassword = useState<bool>(true);
|
||||||
|
final obscureTextConfirmPassword = useState<bool>(true);
|
||||||
|
|
||||||
final ctrlOldPassword = useTextEditingController(text: "");
|
final ctrlOldPassword = useTextEditingController(text: "");
|
||||||
final ctrlNewPassword = useTextEditingController(text: "");
|
final ctrlNewPassword = useTextEditingController(text: "");
|
||||||
final ctrlConfirmPassword = useTextEditingController(text: "");
|
final ctrlConfirmPassword = useTextEditingController(text: "");
|
||||||
@@ -47,6 +47,8 @@ class ChangePasswordScreen extends HookConsumerWidget {
|
|||||||
});
|
});
|
||||||
return () {};
|
return () {};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// fungsi logout
|
||||||
Logout() async {
|
Logout() async {
|
||||||
final shared = await SharedPreferences.getInstance();
|
final shared = await SharedPreferences.getInstance();
|
||||||
final bearerString = shared.get(Constant.bearerName).toString();
|
final bearerString = shared.get(Constant.bearerName).toString();
|
||||||
@@ -134,18 +136,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
|
|||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
right: Constant.getActualXPhone(context: context, x: 20),
|
||||||
),
|
),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
obscureText: obscureText.value,
|
obscureText: obscureTextOldPassword.value,
|
||||||
controller: ctrlOldPassword,
|
controller: ctrlOldPassword,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
obscureText.value
|
obscureTextOldPassword.value
|
||||||
? Icons.visibility
|
? Icons.visibility
|
||||||
: Icons.visibility_off,
|
: Icons.visibility_off,
|
||||||
color: Constant.textGreyv2,
|
color: Constant.textGreyv2,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
obscureText.value = !obscureText.value;
|
obscureTextOldPassword.value = !obscureTextOldPassword.value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
hintStyle:
|
hintStyle:
|
||||||
@@ -204,18 +206,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
|
|||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
right: Constant.getActualXPhone(context: context, x: 20),
|
||||||
),
|
),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
obscureText: obscureText.value,
|
obscureText: obscureTextNewPassword.value,
|
||||||
controller: ctrlNewPassword,
|
controller: ctrlNewPassword,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
obscureText.value
|
obscureTextNewPassword.value
|
||||||
? Icons.visibility
|
? Icons.visibility
|
||||||
: Icons.visibility_off,
|
: Icons.visibility_off,
|
||||||
color: Constant.textGreyv2,
|
color: Constant.textGreyv2,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
obscureText.value = !obscureText.value;
|
obscureTextNewPassword.value = !obscureTextNewPassword.value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
hintStyle:
|
hintStyle:
|
||||||
@@ -276,18 +278,18 @@ class ChangePasswordScreen extends HookConsumerWidget {
|
|||||||
right: Constant.getActualXPhone(context: context, x: 20),
|
right: Constant.getActualXPhone(context: context, x: 20),
|
||||||
),
|
),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
obscureText: obscureText.value,
|
obscureText: obscureTextConfirmPassword.value,
|
||||||
controller: ctrlConfirmPassword,
|
controller: ctrlConfirmPassword,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
obscureText.value
|
obscureTextConfirmPassword.value
|
||||||
? Icons.visibility
|
? Icons.visibility
|
||||||
: Icons.visibility_off,
|
: Icons.visibility_off,
|
||||||
color: Constant.textGreyv2,
|
color: Constant.textGreyv2,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
obscureText.value = !obscureText.value;
|
obscureTextConfirmPassword.value = !obscureTextConfirmPassword.value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
hintStyle:
|
hintStyle:
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
import 'package:app_petty_cash/model/history_total_model.dart';
|
||||||
|
import 'package:app_petty_cash/provider/current_info_account_balance_provider.dart';
|
||||||
|
import 'package:app_petty_cash/repository/home_repository.dart';
|
||||||
|
import 'package:app_petty_cash/repository/transaksi_repository.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import '../../model/info_account_balance.dart';
|
||||||
|
import '../../provider/dio_provider.dart';
|
||||||
|
import '../../repository/base_repository.dart';
|
||||||
|
|
||||||
|
abstract class HistoryTotalState extends Equatable {
|
||||||
|
final DateTime date;
|
||||||
|
const HistoryTotalState(this.date);
|
||||||
|
@override
|
||||||
|
List<Object?> get props => [date];
|
||||||
|
}
|
||||||
|
|
||||||
|
class HistoryTotalStateInit extends HistoryTotalState {
|
||||||
|
HistoryTotalStateInit() : super(DateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
class HistoryTotalStateLoading extends HistoryTotalState {
|
||||||
|
HistoryTotalStateLoading() : super(DateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
class HistoryTotalStateError extends HistoryTotalState {
|
||||||
|
final String message;
|
||||||
|
HistoryTotalStateError({
|
||||||
|
required this.message,
|
||||||
|
}) : super(DateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
class HistoryTotalStateDone extends HistoryTotalState {
|
||||||
|
final HistoryTotalModel model;
|
||||||
|
// final String resp;
|
||||||
|
HistoryTotalStateDone({
|
||||||
|
required this.model,
|
||||||
|
}) : super(DateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
//notifier
|
||||||
|
class HistoryTotalNotifier extends StateNotifier<HistoryTotalState> {
|
||||||
|
final Ref ref;
|
||||||
|
HistoryTotalNotifier({
|
||||||
|
required this.ref,
|
||||||
|
}) : super(HistoryTotalStateInit());
|
||||||
|
|
||||||
|
void historyTotal(
|
||||||
|
String companyid,
|
||||||
|
String tglAwal,
|
||||||
|
String tglAkhir,
|
||||||
|
String categoryid,
|
||||||
|
) async {
|
||||||
|
try {
|
||||||
|
state = HistoryTotalStateLoading();
|
||||||
|
final dio = ref.read(dioProvider);
|
||||||
|
final resp = await TransaksiRepository(dio: dio).getHistoryTotal(
|
||||||
|
companyid,
|
||||||
|
tglAwal,
|
||||||
|
tglAkhir,
|
||||||
|
categoryid
|
||||||
|
);
|
||||||
|
state = HistoryTotalStateDone(model: resp);
|
||||||
|
} catch (e) {
|
||||||
|
if (e is BaseRepositoryException) {
|
||||||
|
state = HistoryTotalStateError(message: e.message.toString());
|
||||||
|
} else {
|
||||||
|
state = HistoryTotalStateError(message: e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//provider
|
||||||
|
final historyTotalProvider =
|
||||||
|
StateNotifierProvider<HistoryTotalNotifier, HistoryTotalState>(
|
||||||
|
(ref) => HistoryTotalNotifier(ref: ref),
|
||||||
|
);
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:app_petty_cash/model/history_total_model.dart';
|
||||||
import 'package:app_petty_cash/screen/transaksi/confirm_transaksi_provider.dart';
|
import 'package:app_petty_cash/screen/transaksi/confirm_transaksi_provider.dart';
|
||||||
import 'package:app_petty_cash/screen/transaksi/delete_transaksi_provider.dart';
|
import 'package:app_petty_cash/screen/transaksi/delete_transaksi_provider.dart';
|
||||||
|
import 'package:app_petty_cash/screen/transaksi/history_total_provider.dart';
|
||||||
import 'package:app_petty_cash/screen/transaksi/search_history_transaksi_provider.dart';
|
import 'package:app_petty_cash/screen/transaksi/search_history_transaksi_provider.dart';
|
||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -17,6 +19,7 @@ import '../../app/route.dart';
|
|||||||
import '../../model/history_transaksi_model.dart';
|
import '../../model/history_transaksi_model.dart';
|
||||||
import '../../model/list_category_model.dart';
|
import '../../model/list_category_model.dart';
|
||||||
import '../../model/list_type_model.dart';
|
import '../../model/list_type_model.dart';
|
||||||
|
import '../../provider/current_total_history_provider.dart';
|
||||||
import '../../provider/current_user_provider.dart';
|
import '../../provider/current_user_provider.dart';
|
||||||
import '../../widget/custom_drawer.dart';
|
import '../../widget/custom_drawer.dart';
|
||||||
import '../../widget/field_row_history_transaksi.dart';
|
import '../../widget/field_row_history_transaksi.dart';
|
||||||
@@ -64,6 +67,8 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final historyTotalLoading = useState(false);
|
||||||
|
|
||||||
// A. LISTEN PROVIDER
|
// A. LISTEN PROVIDER
|
||||||
|
|
||||||
// type
|
// type
|
||||||
@@ -142,6 +147,29 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// read provider info account balance
|
||||||
|
ref.listen(
|
||||||
|
historyTotalProvider,
|
||||||
|
(previous, next) {
|
||||||
|
if (next is HistoryTotalStateLoading) {
|
||||||
|
historyTotalLoading.value = true;
|
||||||
|
} else if (next is HistoryTotalStateError) {
|
||||||
|
// print(next.message);
|
||||||
|
historyTotalLoading.value = false;
|
||||||
|
SanckbarWidget(context, next.message, snackbarType.error);
|
||||||
|
} else if (next is HistoryTotalStateDone) {
|
||||||
|
// print(jsonEncode(next.model));
|
||||||
|
// print(next.model.length);
|
||||||
|
// infoAccountBalanceObject.value = next.model;
|
||||||
|
ref.read(currentHistoryTotalProvider.notifier).state =
|
||||||
|
HistoryTotalModel(
|
||||||
|
totalAll: next.model.totalAll,
|
||||||
|
);
|
||||||
|
historyTotalLoading.value = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// delete transaksi
|
// delete transaksi
|
||||||
ref.listen(
|
ref.listen(
|
||||||
deleteTransaksiProvider,
|
deleteTransaksiProvider,
|
||||||
@@ -1035,6 +1063,70 @@ class HistoryTransaksiScreen extends HookConsumerWidget {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
|
|
||||||
|
// Total by Filter Category
|
||||||
|
|
||||||
|
if (historyTotalLoading.value)
|
||||||
|
Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
|
||||||
|
(selectedListCategory.value.categoryid != "ALL" &&
|
||||||
|
historyTotalLoading.value == false)
|
||||||
|
? Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Kategori Total',
|
||||||
|
style:
|
||||||
|
Constant.body1(context: context).copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Constant.textBlack,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: Constant.getActualXPhone(
|
||||||
|
context: context,
|
||||||
|
x: 4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
':',
|
||||||
|
style:
|
||||||
|
Constant.body1(context: context).copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Constant.textBlack,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: Constant.getActualXPhone(
|
||||||
|
context: context,
|
||||||
|
x: 4,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
ref
|
||||||
|
.read(currentHistoryTotalProvider
|
||||||
|
.notifier)
|
||||||
|
.state
|
||||||
|
.totalAll
|
||||||
|
.toString(),
|
||||||
|
style: Constant.body1(context: context)
|
||||||
|
.copyWith(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Constant.pcBtnBackgroundColor,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: SizedBox.shrink(),
|
||||||
|
|
||||||
|
SizedBox(
|
||||||
|
height: Constant.getActualYPhone(context: context, y: 20),
|
||||||
|
),
|
||||||
|
|
||||||
(searchHistoryIsLoading.value)
|
(searchHistoryIsLoading.value)
|
||||||
? Center(
|
? Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import '../../model/history_transaksi_model.dart';
|
|||||||
import '../../repository/transaksi_repository.dart';
|
import '../../repository/transaksi_repository.dart';
|
||||||
import '../../provider/dio_provider.dart';
|
import '../../provider/dio_provider.dart';
|
||||||
import '../../repository/base_repository.dart';
|
import '../../repository/base_repository.dart';
|
||||||
|
import 'history_total_provider.dart';
|
||||||
|
|
||||||
abstract class SearchHistoryTransaksiState extends Equatable {
|
abstract class SearchHistoryTransaksiState extends Equatable {
|
||||||
final DateTime date;
|
final DateTime date;
|
||||||
@@ -47,18 +48,26 @@ class SearchHistoryTransaksiNotifier
|
|||||||
String companyid,
|
String companyid,
|
||||||
String tglAwal,
|
String tglAwal,
|
||||||
String tglAkhir,
|
String tglAkhir,
|
||||||
String categoryid,
|
String categoryid,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
state = SearchHistoryTransaksiStateLoading();
|
state = SearchHistoryTransaksiStateLoading();
|
||||||
final dio = ref.read(dioProvider);
|
final dio = ref.read(dioProvider);
|
||||||
final resp = await TransaksiRepository(dio: dio).getListHistoryTransaksi(
|
final resp = await TransaksiRepository(dio: dio).getListHistoryTransaksi(
|
||||||
companyid,
|
companyid,
|
||||||
tglAwal,
|
tglAwal,
|
||||||
tglAkhir,
|
tglAkhir,
|
||||||
categoryid,
|
categoryid,
|
||||||
);
|
);
|
||||||
state = SearchHistoryTransaksiStateDone(model: resp);
|
state = SearchHistoryTransaksiStateDone(model: resp);
|
||||||
|
|
||||||
|
// panggil provider total transaksi by category for non all
|
||||||
|
ref.read(historyTotalProvider.notifier).historyTotal(
|
||||||
|
companyid,
|
||||||
|
tglAwal,
|
||||||
|
tglAkhir,
|
||||||
|
categoryid,
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e is BaseRepositoryException) {
|
if (e is BaseRepositoryException) {
|
||||||
state = SearchHistoryTransaksiStateError(message: e.message.toString());
|
state = SearchHistoryTransaksiStateError(message: e.message.toString());
|
||||||
|
|||||||
@@ -20,10 +20,13 @@ import 'package:intl/intl.dart';
|
|||||||
|
|
||||||
import '../../app/constant.dart';
|
import '../../app/constant.dart';
|
||||||
import '../../model/list_category_model.dart';
|
import '../../model/list_category_model.dart';
|
||||||
|
import '../../provider/current_menu_provider.dart';
|
||||||
import '../../provider/current_user_provider.dart';
|
import '../../provider/current_user_provider.dart';
|
||||||
import '../../widget/custom_drawer.dart';
|
import '../../widget/custom_drawer.dart';
|
||||||
import '../../widget/sankbar_widget.dart';
|
import '../../widget/sankbar_widget.dart';
|
||||||
|
|
||||||
|
import 'package:image/image.dart' as img;
|
||||||
|
|
||||||
class DummyDropdownTipe {
|
class DummyDropdownTipe {
|
||||||
final String options;
|
final String options;
|
||||||
final int id;
|
final int id;
|
||||||
@@ -151,6 +154,8 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
'Data Berhasil Disimpan',
|
'Data Berhasil Disimpan',
|
||||||
snackbarType.success,
|
snackbarType.success,
|
||||||
);
|
);
|
||||||
|
// diupdate ke menu home jika sukses
|
||||||
|
ref.read(currentPageProvider.notifier).update((state) => 0);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pushNamed(homeRoute);
|
Navigator.of(context).pushNamed(homeRoute);
|
||||||
}
|
}
|
||||||
@@ -194,7 +199,7 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
|
|
||||||
final userIDLogin = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
|
final userIDLogin = ref.read(currentUserProvider)?.model.M_UserID ?? "0";
|
||||||
|
|
||||||
getBase64() async {
|
getBase64_v1() async {
|
||||||
// List<int> imageBytes = await fileData.value?.readAsBytes();
|
// List<int> imageBytes = await fileData.value?.readAsBytes();
|
||||||
if (fileData.value != null) {
|
if (fileData.value != null) {
|
||||||
final bytes = io.File(fileData.value!.path).readAsBytesSync();
|
final bytes = io.File(fileData.value!.path).readAsBytesSync();
|
||||||
@@ -211,11 +216,32 @@ class TransaksiScreen extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBase64() async {
|
||||||
|
// List<int> imageBytes = await fileData.value?.readAsBytes();
|
||||||
|
if (fileData.value != null) {
|
||||||
|
final bytes = io.File(fileData.value!.path).readAsBytesSync();
|
||||||
|
String base64Image = base64Encode(await fileData.value!.readAsBytes());
|
||||||
|
fileDataBase64.value = base64Image;
|
||||||
|
final file = File(fileData.value!.path);
|
||||||
|
|
||||||
|
print(file.lengthSync() / 1000000);
|
||||||
|
print(await fileData.value!.length());
|
||||||
|
fileSize.value = await fileData.value!.length();
|
||||||
|
|
||||||
|
// await getExternalStorageDirectory();
|
||||||
|
// print(await fileData.value!.saveTo(path));
|
||||||
|
print(fileDataBase64.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final ImagePicker _picker = ImagePicker();
|
final ImagePicker _picker = ImagePicker();
|
||||||
pickImage() async {
|
pickImage() async {
|
||||||
final XFile? pickedFile = await _picker.pickImage(
|
final XFile? pickedFile = await _picker.pickImage(
|
||||||
source: ImageSource.camera,
|
source: ImageSource.camera,
|
||||||
);
|
// maxWidth set untuk width image
|
||||||
|
maxWidth: 640,
|
||||||
|
// maxHeight set untuk width image
|
||||||
|
maxHeight: 480);
|
||||||
if (pickedFile != null) {
|
if (pickedFile != null) {
|
||||||
final tmpFile = FilePickerResult([
|
final tmpFile = FilePickerResult([
|
||||||
PlatformFile(
|
PlatformFile(
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ class CustomDrawer extends HookConsumerWidget {
|
|||||||
Navigator.pushNamed(context, reportRoute);
|
Navigator.pushNamed(context, reportRoute);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
Icons.account_balance,
|
Icons.account_balance,
|
||||||
color: (currentMenu == 4)
|
color: (currentMenu == 4)
|
||||||
@@ -273,7 +273,7 @@ class CustomDrawer extends HookConsumerWidget {
|
|||||||
Navigator.pushNamed(context, changeCompanyRoute);
|
Navigator.pushNamed(context, changeCompanyRoute);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
Icons.lock_reset,
|
Icons.lock_reset,
|
||||||
color: (currentMenu == 5)
|
color: (currentMenu == 5)
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.18.0"
|
version: "1.17.1"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -337,7 +337,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.2"
|
version: "4.0.2"
|
||||||
image:
|
image:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: image
|
name: image
|
||||||
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
|
sha256: "004a2e90ce080f8627b5a04aecb4cdfac87d2c3f3b520aa291260be5a32c033d"
|
||||||
@@ -444,26 +444,26 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
|
sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.16"
|
version: "0.12.15"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: material_color_utilities
|
name: material_color_utilities
|
||||||
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
|
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.0"
|
version: "0.2.0"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
|
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.9.1"
|
||||||
mime:
|
mime:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -697,18 +697,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.9.1"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.11.1"
|
version: "1.11.0"
|
||||||
state_notifier:
|
state_notifier:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -721,10 +721,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.1"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -745,10 +745,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
|
sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.1"
|
version: "0.5.1"
|
||||||
top_snackbar_flutter:
|
top_snackbar_flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -901,14 +901,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.17"
|
version: "2.0.17"
|
||||||
web:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: web
|
|
||||||
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "0.3.0"
|
|
||||||
whatsapp_share:
|
whatsapp_share:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -950,5 +942,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.2.0-194.0.dev <4.0.0"
|
dart: ">=3.0.6 <4.0.0"
|
||||||
flutter: ">=3.10.0"
|
flutter: ">=3.10.0"
|
||||||
|
|||||||
@@ -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
|
# 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
|
# 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.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.1.5
|
version: 1.2.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.0.6 <4.0.0'
|
sdk: '>=3.0.6 <4.0.0'
|
||||||
@@ -60,6 +60,7 @@ dependencies:
|
|||||||
path_provider: ^2.1.2
|
path_provider: ^2.1.2
|
||||||
flutter_share: ^2.0.0
|
flutter_share: ^2.0.0
|
||||||
whatsapp_share: ^2.0.2
|
whatsapp_share: ^2.0.2
|
||||||
|
image: ^4.1.4
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user