From 1e9a26e3df1e7900632df701e4f95ef78dc9ddde Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Thu, 9 Jun 2022 14:04:35 +0300 Subject: [PATCH] missing swipe cont --- assets/langs/ar-SA.json | 1 + assets/langs/en-US.json | 1 + lib/api/my_attendance_api_client.dart | 34 + lib/config/routes.dart | 4 + lib/generated/locale_keys.g.dart | 1 + lib/models/generic_response_model.dart | 41 +- lib/models/get_approves_list_model.dart | 60 ++ .../submit_eit_transaction_list_model.dart | 28 + .../validate_eit_transaction_list_model.dart | 18 + lib/ui/misc/request_submit_screen.dart | 206 +++++ .../dynamic_screens/dynamic_input_screen.dart | 14 +- .../my_attendance/my_attendance_screen.dart | 6 +- lib/ui/screens/tangheem_detail_screen.dart | 819 ------------------ lib/widgets/button/default_button.dart | 46 +- lib/widgets/button/simple_button.dart | 42 + pubspec.yaml | 1 + 16 files changed, 446 insertions(+), 876 deletions(-) create mode 100644 lib/models/get_approves_list_model.dart create mode 100644 lib/models/submit_eit_transaction_list_model.dart create mode 100644 lib/models/validate_eit_transaction_list_model.dart create mode 100644 lib/ui/misc/request_submit_screen.dart delete mode 100644 lib/ui/screens/tangheem_detail_screen.dart create mode 100644 lib/widgets/button/simple_button.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index fe71e90..27f1ab0 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -210,6 +210,7 @@ "myAttendance": "حضوري", "workOnBreak": "العمل على استراحة", "next": "التالي", + "submit": "ارسال", "profile": { "reset_password": { "label": "Reset Password", diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index a1bfdfa..498d3e1 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -210,6 +210,7 @@ "myAttendance": "My Attendance", "workOnBreak": "Work On Break", "next": "Next", + "submit": "Submit", "profile": { "reset_password": { "label": "Reset Password", diff --git a/lib/api/my_attendance_api_client.dart b/lib/api/my_attendance_api_client.dart index 4c88ec1..44b91da 100644 --- a/lib/api/my_attendance_api_client.dart +++ b/lib/api/my_attendance_api_client.dart @@ -3,8 +3,10 @@ import 'dart:async'; import 'package:mohem_flutter_app/app_state/app_state.dart'; import 'package:mohem_flutter_app/classes/consts.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; +import 'package:mohem_flutter_app/models/get_approves_list_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; import 'package:mohem_flutter_app/models/get_eit_transaction_list_model.dart'; +import 'package:mohem_flutter_app/models/submit_eit_transaction_list_model.dart'; import 'api_client.dart'; @@ -88,4 +90,36 @@ class MyAttendanceApiClient { return responseData; //ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson()); }, url, postParams); } + + Future submitEitTransaction(String pDescFlexContextCode, String pFunctionName, List> list) async { + String url = "${ApiConsts.erpRest}SUBMIT_EIT_TRANSACTION"; + Map postParams = { + "P_SELECTED_RESP_ID": -999, + "P_MENU_TYPE": "E", + "P_DESC_FLEX_CONTEXT_CODE": pDescFlexContextCode, + "P_FUNCTION_NAME": pFunctionName, + "EITTransactionTBL": list, + "EITTransactionTBLModel": list, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel responseData = GenericResponseModel.fromJson(json); + return responseData.submitEITTransactionList!; //ESERVICESDV.fromJson(responseData.getDefaultValueList!.toJson()); + }, url, postParams); + } + + Future> getApproversList(String pAmeTransactionType, int pTransactionId) async { + String url = "${ApiConsts.erpRest}GET_APPROVERS_LIST"; + Map postParams = { + "P_AME_TRANSACTION_TYPE": pAmeTransactionType, + "P_PAGE_LIMIT": 1000, + "P_PAGE_NUM": 1, + "P_TRANSACTION_ID": pTransactionId, + }; + postParams.addAll(AppState().postParamsJson); + return await ApiClient().postJsonForObject((json) { + GenericResponseModel? responseData = GenericResponseModel.fromJson(json); + return responseData.getApprovesList ?? []; + }, url, postParams); + } } diff --git a/lib/config/routes.dart b/lib/config/routes.dart index a31d24c..929924a 100644 --- a/lib/config/routes.dart +++ b/lib/config/routes.dart @@ -6,6 +6,7 @@ import 'package:mohem_flutter_app/ui/login/login_screen.dart'; import 'package:mohem_flutter_app/ui/login/new_password_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_last_login_screen.dart'; import 'package:mohem_flutter_app/ui/login/verify_login_screen.dart'; +import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/my_attendance_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; @@ -37,6 +38,7 @@ class AppRoutes { static const String myAttendance = "/myAttendance"; static const String dynamicScreen = "/dynamicScreen"; static const String addDynamicInput = "/addDynamicInput"; + static const String requestSubmitScreen = "/requestSubmitScreen"; static final Map routes = { login: (context) => LoginScreen(), @@ -56,5 +58,7 @@ class AppRoutes { myAttendance: (context) => MyAttendanceScreen(), dynamicScreen: (context) => DynamicListViewScreen(), addDynamicInput: (context) => DynamicInputScreen(), + + requestSubmitScreen: (context) => RequestSubmitScreen(), }; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index fed6ef6..bb7f085 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -221,5 +221,6 @@ abstract class LocaleKeys { static const myAttendance = 'myAttendance'; static const workOnBreak = 'workOnBreak'; static const next = 'next'; + static const submit = 'submit'; } diff --git a/lib/models/generic_response_model.dart b/lib/models/generic_response_model.dart index c9edf47..de0404d 100644 --- a/lib/models/generic_response_model.dart +++ b/lib/models/generic_response_model.dart @@ -1,5 +1,6 @@ import 'package:mohem_flutter_app/models/get_absence_collection_notification_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_action_history_list_model.dart'; +import 'package:mohem_flutter_app/models/get_approves_list_model.dart'; import 'package:mohem_flutter_app/models/get_attachement_list_model.dart'; import 'package:mohem_flutter_app/models/get_basic_det_ntf_body_list_model.dart'; import 'package:mohem_flutter_app/models/get_default_value_list_model.dart'; @@ -17,7 +18,9 @@ import 'package:mohem_flutter_app/models/get_stamp_ns_notification_body_list_mod import 'package:mohem_flutter_app/models/member_login_list_model.dart'; import 'package:mohem_flutter_app/models/notification_action_model.dart'; import 'package:mohem_flutter_app/models/notification_get_respond_attributes_list_model.dart'; +import 'package:mohem_flutter_app/models/submit_eit_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/subordinates_on_leaves_model.dart'; +import 'package:mohem_flutter_app/models/validate_eit_transaction_list_model.dart'; import 'package:mohem_flutter_app/models/worklist_response_model.dart'; import 'basic_member_information_model.dart'; @@ -88,7 +91,7 @@ class GenericResponseModel { List? getActionHistoryList; List? getAddressDffStructureList; List? getAddressNotificationBodyList; - List? getApprovesList; + List? getApprovesList; List? getAttachementList; GetAttendanceTracking? getAttendanceTrackingList; List? getBasicDetColsStructureList; @@ -253,7 +256,7 @@ class GenericResponseModel { String? submitCEITransactionList; String? submitCcpTransactionList; String? submitContactTransactionList; - String? submitEITTransactionList; + SubmitEITTransactionList? submitEITTransactionList; String? submitHrTransactionList; String? submitPhonesTransactionList; String? submitSITTransactionList; @@ -272,7 +275,7 @@ class GenericResponseModel { String? vHRGetProjectByCodeList; bool? vHRIsVerificationCodeValid; String? validateAbsenceTransactionList; - String? validateEITTransactionList; + ValidateEITTransactionList? validateEITTransactionList; String? validatePhonesTransactionList; String? vrItemTypesList; String? wFLookUpList; @@ -608,7 +611,13 @@ class GenericResponseModel { getAddressDffStructureList = json['GetAddressDffStructureList']; getAddressNotificationBodyList = json['GetAddressNotificationBodyList']; - getApprovesList = json['GetApprovesList']; + + if (json['GetApprovesList'] != null) { + getApprovesList = []; + json['GetApprovesList'].forEach((v) { + getApprovesList!.add(new GetApprovesList.fromJson(v)); + }); + } if (json['GetAttachementList'] != null) { getAttachementList = []; @@ -887,7 +896,8 @@ class GenericResponseModel { submitCEITransactionList = json['SubmitCEITransactionList']; submitCcpTransactionList = json['SubmitCcpTransactionList']; submitContactTransactionList = json['SubmitContactTransactionList']; - submitEITTransactionList = json['SubmitEITTransactionList']; + submitEITTransactionList = json['SubmitEITTransactionList'] != null ? new SubmitEITTransactionList.fromJson(json['SubmitEITTransactionList']) : null; + submitHrTransactionList = json['SubmitHrTransactionList']; submitPhonesTransactionList = json['SubmitPhonesTransactionList']; submitSITTransactionList = json['SubmitSITTransactionList']; @@ -913,7 +923,9 @@ class GenericResponseModel { vHRGetProjectByCodeList = json['VHR_GetProjectByCodeList']; vHRIsVerificationCodeValid = json['VHR_IsVerificationCodeValid']; validateAbsenceTransactionList = json['ValidateAbsenceTransactionList']; - validateEITTransactionList = json['ValidateEITTransactionList']; + + validateEITTransactionList = json['ValidateEITTransactionList'] != null ? new ValidateEITTransactionList.fromJson(json['ValidateEITTransactionList']) : null; + validatePhonesTransactionList = json['ValidatePhonesTransactionList']; vrItemTypesList = json['VrItemTypesList']; wFLookUpList = json['WFLookUpList']; @@ -994,7 +1006,10 @@ class GenericResponseModel { data['GetAddressDffStructureList'] = this.getAddressDffStructureList; data['GetAddressNotificationBodyList'] = this.getAddressNotificationBodyList; - data['GetApprovesList'] = this.getApprovesList; + + if (this.getApprovesList != null) { + data['GetApprovesList'] = this.getApprovesList!.map((v) => v.toJson()).toList(); + } if (this.getAttachementList != null) { data['GetAttachementList'] = this.getAttachementList!.map((v) => v.toJson()).toList(); @@ -1226,7 +1241,11 @@ class GenericResponseModel { data['SubmitCEITransactionList'] = this.submitCEITransactionList; data['SubmitCcpTransactionList'] = this.submitCcpTransactionList; data['SubmitContactTransactionList'] = this.submitContactTransactionList; - data['SubmitEITTransactionList'] = this.submitEITTransactionList; + + if (this.submitEITTransactionList != null) { + data['SubmitEITTransactionList'] = this.submitEITTransactionList!.toJson(); + } + data['SubmitHrTransactionList'] = this.submitHrTransactionList; data['SubmitPhonesTransactionList'] = this.submitPhonesTransactionList; data['SubmitSITTransactionList'] = this.submitSITTransactionList; @@ -1250,7 +1269,11 @@ class GenericResponseModel { data['VHR_GetProjectByCodeList'] = this.vHRGetProjectByCodeList; data['VHR_IsVerificationCodeValid'] = this.vHRIsVerificationCodeValid; data['ValidateAbsenceTransactionList'] = this.validateAbsenceTransactionList; - data['ValidateEITTransactionList'] = this.validateEITTransactionList; + + if (this.validateEITTransactionList != null) { + data['ValidateEITTransactionList'] = this.validateEITTransactionList!.toJson(); + } + data['ValidatePhonesTransactionList'] = this.validatePhonesTransactionList; data['VrItemTypesList'] = this.vrItemTypesList; data['WFLookUpList'] = this.wFLookUpList; diff --git a/lib/models/get_approves_list_model.dart b/lib/models/get_approves_list_model.dart new file mode 100644 index 0000000..f5a4d82 --- /dev/null +++ b/lib/models/get_approves_list_model.dart @@ -0,0 +1,60 @@ +class GetApprovesList { + String? aPPROVALSTATUS; + String? aPPROVER; + String? aPPROVERCATEGORY; + int? aPPROVERORDERNUMBER; + String? aPPROVERTYPE; + String? eMPLOYEEIMAGE; + int? fROMROWNUM; + int? lINENO; + int? nOOFROWS; + String? pOSITIONTITLE; + int? rOWNUM; + int? tOROWNUM; + + GetApprovesList( + {this.aPPROVALSTATUS, + this.aPPROVER, + this.aPPROVERCATEGORY, + this.aPPROVERORDERNUMBER, + this.aPPROVERTYPE, + this.eMPLOYEEIMAGE, + this.fROMROWNUM, + this.lINENO, + this.nOOFROWS, + this.pOSITIONTITLE, + this.rOWNUM, + this.tOROWNUM}); + + GetApprovesList.fromJson(Map json) { + aPPROVALSTATUS = json['APPROVAL_STATUS']; + aPPROVER = json['APPROVER']; + aPPROVERCATEGORY = json['APPROVER_CATEGORY']; + aPPROVERORDERNUMBER = json['APPROVER_ORDER_NUMBER']; + aPPROVERTYPE = json['APPROVER_TYPE']; + eMPLOYEEIMAGE = json['EMPLOYEE_IMAGE']; + fROMROWNUM = json['FROM_ROW_NUM']; + lINENO = json['LINE_NO']; + nOOFROWS = json['NO_OF_ROWS']; + pOSITIONTITLE = json['POSITION_TITLE']; + rOWNUM = json['ROW_NUM']; + tOROWNUM = json['TO_ROW_NUM']; + } + + Map toJson() { + final Map data = new Map(); + data['APPROVAL_STATUS'] = this.aPPROVALSTATUS; + data['APPROVER'] = this.aPPROVER; + data['APPROVER_CATEGORY'] = this.aPPROVERCATEGORY; + data['APPROVER_ORDER_NUMBER'] = this.aPPROVERORDERNUMBER; + data['APPROVER_TYPE'] = this.aPPROVERTYPE; + data['EMPLOYEE_IMAGE'] = this.eMPLOYEEIMAGE; + data['FROM_ROW_NUM'] = this.fROMROWNUM; + data['LINE_NO'] = this.lINENO; + data['NO_OF_ROWS'] = this.nOOFROWS; + data['POSITION_TITLE'] = this.pOSITIONTITLE; + data['ROW_NUM'] = this.rOWNUM; + data['TO_ROW_NUM'] = this.tOROWNUM; + return data; + } +} \ No newline at end of file diff --git a/lib/models/submit_eit_transaction_list_model.dart b/lib/models/submit_eit_transaction_list_model.dart new file mode 100644 index 0000000..288ce8e --- /dev/null +++ b/lib/models/submit_eit_transaction_list_model.dart @@ -0,0 +1,28 @@ +class SubmitEITTransactionList { + String? pITEMKEY; + String? pRETURNMSG; + String? pRETURNSTATUS; + int? pTRANSACTIONID; + + SubmitEITTransactionList( + {this.pITEMKEY, + this.pRETURNMSG, + this.pRETURNSTATUS, + this.pTRANSACTIONID}); + + SubmitEITTransactionList.fromJson(Map json) { + pITEMKEY = json['P_ITEM_KEY']; + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + pTRANSACTIONID = json['P_TRANSACTION_ID']; + } + + Map toJson() { + final Map data = new Map(); + data['P_ITEM_KEY'] = this.pITEMKEY; + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + data['P_TRANSACTION_ID'] = this.pTRANSACTIONID; + return data; + } +} \ No newline at end of file diff --git a/lib/models/validate_eit_transaction_list_model.dart b/lib/models/validate_eit_transaction_list_model.dart new file mode 100644 index 0000000..02f2af0 --- /dev/null +++ b/lib/models/validate_eit_transaction_list_model.dart @@ -0,0 +1,18 @@ +class ValidateEITTransactionList { + String? pRETURNMSG; + String? pRETURNSTATUS; + + ValidateEITTransactionList({this.pRETURNMSG, this.pRETURNSTATUS}); + + ValidateEITTransactionList.fromJson(Map json) { + pRETURNMSG = json['P_RETURN_MSG']; + pRETURNSTATUS = json['P_RETURN_STATUS']; + } + + Map toJson() { + final Map data = new Map(); + data['P_RETURN_MSG'] = this.pRETURNMSG; + data['P_RETURN_STATUS'] = this.pRETURNSTATUS; + return data; + } +} \ No newline at end of file diff --git a/lib/ui/misc/request_submit_screen.dart b/lib/ui/misc/request_submit_screen.dart new file mode 100644 index 0000000..c57ce6b --- /dev/null +++ b/lib/ui/misc/request_submit_screen.dart @@ -0,0 +1,206 @@ +import 'dart:io'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; +import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/extensions/int_extensions.dart'; +import 'package:mohem_flutter_app/extensions/string_extensions.dart'; +import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; +import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/models/get_approves_list_model.dart'; +import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; +import 'package:mohem_flutter_app/widgets/button/default_button.dart'; +import 'package:mohem_flutter_app/widgets/button/simple_button.dart'; +import 'package:mohem_flutter_app/widgets/circular_avatar.dart'; +import 'package:mohem_flutter_app/widgets/input_widget.dart'; + +class RequestSubmitScreenParams { + String title; + int transactionId; + + RequestSubmitScreenParams(this.title, this.transactionId); +} + +class RequestSubmitScreen extends StatefulWidget { + RequestSubmitScreen({Key? key}) : super(key: key); + + @override + _RequestSubmitScreenState createState() { + return _RequestSubmitScreenState(); + } +} + +class _RequestSubmitScreenState extends State { + RequestSubmitScreenParams? params; + + List approverList = []; + List attachmentFiles = []; + + @override + void initState() { + super.initState(); + } + + void getApproverList() async { + try { + Utils.showLoading(context); + approverList = await MyAttendanceApiClient().getApproversList("SSHRMS", params!.transactionId); + + Utils.hideLoading(context); + setState(() {}); + } catch (ex) { + Utils.hideLoading(context); + Utils.handleException(ex, context, null); + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + if (params == null) { + params = ModalRoute.of(context)!.settings.arguments as RequestSubmitScreenParams; + getApproverList(); + } + return Scaffold( + backgroundColor: Colors.white, + appBar: AppBarWidget( + context, + title: params!.title, + ), + body: Column( + children: [ + ListView( + padding: const EdgeInsets.all(21).copyWith(top: 14), + physics: const BouncingScrollPhysics(), + children: [ + attachmentView("Attachments"), + 14.height, + InputWidget( + "Comments", + "Write a comment", + TextEditingController(), + isBackgroundEnable: true, + lines: 3, + onChange: (String note) { + // this.note = note; + }, + ), //.objectContainerView(title: "Comments"), + 14.height, + "Approvers List".toSectionHeading(), + 14.height, + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) { + return approverView(cxt, approverList[index]); + }, + separatorBuilder: (cxt, index) => 12.height, + itemCount: approverList.length, + ) + ], + ).expanded, + DefaultButton( + LocaleKeys.submit.tr(), + () { + //Navigator.of(context).pushNamed(LOGIN_TYPE) + }, + ).insideContainer, + ], + ), + ); + } + + Widget approverView(BuildContext context, GetApprovesList approver) { + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CircularAvatar(url: approver.eMPLOYEEIMAGE, isImageBase64: true, height: 40, width: 40), + 9.width, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + approver.aPPROVER!.toText16(), + approver.pOSITIONTITLE!.toText12(color: MyColors.lightTextColor), + ], + ), + ) + ], + ).objectContainerView(); + } + + Widget attachmentView(String title) { + return Container( + padding: const EdgeInsets.only(top: 15, bottom: 15, left: 14, right: 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + boxShadow: [ + BoxShadow( + color: const Color(0xff000000).withOpacity(.05), + blurRadius: 26, + offset: const Offset(0, -3), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + title.toText16().expanded, + 6.width, + SimpleButton("Add", () async { + FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true); + if (result != null) { + attachmentFiles = attachmentFiles + result.paths.map((path) => File(path!)).toList(); + attachmentFiles = attachmentFiles.toSet().toList(); + setState(() {}); + } + }, fontSize: 14), + ], + ), + if (attachmentFiles.isNotEmpty) 12.height, + if (attachmentFiles.isNotEmpty) + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (cxt, index) { + String fileName = attachmentFiles[index].path.split('/').last; + + return Row( + children: [ + fileName.toText13().expanded, + 6.width, + IconButton( + padding: EdgeInsets.zero, + iconSize: 20, + icon: const Icon(Icons.cancel_rounded), + color: MyColors.redColor, + constraints: const BoxConstraints(), + onPressed: () async { + attachmentFiles.removeAt(index); + setState(() {}); + }, + ) + ], + ); + }, + separatorBuilder: (cxt, index) => 6.height, + itemCount: attachmentFiles.length), + ], + ), + ); + } +} diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index f668ea2..bdbc1d6 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:mohem_flutter_app/api/my_attendance_api_client.dart'; import 'package:mohem_flutter_app/classes/utils.dart'; +import 'package:mohem_flutter_app/config/routes.dart'; import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; @@ -13,6 +14,8 @@ import 'package:mohem_flutter_app/models/dyanmic_forms/get_set_values_request_mo import 'package:mohem_flutter_app/models/dyanmic_forms/validate_eit_transaction_model.dart'; import 'package:mohem_flutter_app/models/generic_response_model.dart'; import 'package:mohem_flutter_app/models/get_eit_dff_structure_list_model.dart'; +import 'package:mohem_flutter_app/models/submit_eit_transaction_list_model.dart'; +import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; import 'package:mohem_flutter_app/widgets/button/default_button.dart'; @@ -54,12 +57,6 @@ class _DynamicInputScreenState extends State { void validateTransaction() async { try { Utils.showLoading(context); - - // List> values = getEitDffStructureList! - // .map((e) => - // ValidateEitTransactionModel(dATEVALUE: null, nAME: e.aPPLICATIONCOLUMNNAME, nUMBERVALUE: null, tRANSACTIONNUMBER: 2, vARCHAR2VALUE: e.eSERVICESDV?.pIDCOLUMNNAME ?? "").toJson()) - // .toList(); - List> values = getEitDffStructureList!.map((e) { String tempVar = e.eSERVICESDV?.pIDCOLUMNNAME ?? ""; if (e.fORMATTYPE == "X") { @@ -81,10 +78,9 @@ class _DynamicInputScreenState extends State { values.add(ValidateEitTransactionModel(dATEVALUE: null, nAME: "PEI_OBJECT_VERSION_NUMBER", nUMBERVALUE: 0, tRANSACTIONNUMBER: 2, vARCHAR2VALUE: null).toJson()); genericResponseModel = await MyAttendanceApiClient().validateEitTransaction(genericResponseModel!.pDESCFLEXCONTEXTCODE!, dynamicParams!.dynamicId, values); - getEitDffStructureList = genericResponseModel?.getEITDFFStructureList ?? []; - //getEitDffStructureList = getEitDffStructureList!.where((element) => element.dISPLAYFLAG != "N").toList(); + SubmitEITTransactionList submitEITTransactionList = await MyAttendanceApiClient().submitEitTransaction(genericResponseModel!.pDESCFLEXCONTEXTCODE!, dynamicParams!.dynamicId, values); Utils.hideLoading(context); - setState(() {}); + Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams("title", submitEITTransactionList.pTRANSACTIONID!)); } catch (ex) { Utils.hideLoading(context); Utils.handleException(ex, context, null); diff --git a/lib/ui/my_attendance/my_attendance_screen.dart b/lib/ui/my_attendance/my_attendance_screen.dart index 2b74c98..e00a5c6 100644 --- a/lib/ui/my_attendance/my_attendance_screen.dart +++ b/lib/ui/my_attendance/my_attendance_screen.dart @@ -7,6 +7,7 @@ import 'package:mohem_flutter_app/extensions/int_extensions.dart'; import 'package:mohem_flutter_app/extensions/string_extensions.dart'; import 'package:mohem_flutter_app/extensions/widget_extensions.dart'; import 'package:mohem_flutter_app/generated/locale_keys.g.dart'; +import 'package:mohem_flutter_app/ui/misc/request_submit_screen.dart'; import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart'; import 'package:mohem_flutter_app/widgets/app_bar_widget.dart'; @@ -31,7 +32,6 @@ class MyAttendanceScreen extends StatelessWidget { LocaleKeys.missingSwipes.tr(), ).onPress(() { Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS")); - }), 12.height, itemView( @@ -44,7 +44,9 @@ class MyAttendanceScreen extends StatelessWidget { itemView( "assets/images/pdf.svg", LocaleKeys.workOnBreak.tr(), - ), + ).onPress(() { + Navigator.pushNamed(context, AppRoutes.requestSubmitScreen, arguments: RequestSubmitScreenParams("title", 8724807)); + }), ], ).paddingAll(21)), ); diff --git a/lib/ui/screens/tangheem_detail_screen.dart b/lib/ui/screens/tangheem_detail_screen.dart deleted file mode 100644 index 0f4ea7b..0000000 --- a/lib/ui/screens/tangheem_detail_screen.dart +++ /dev/null @@ -1,819 +0,0 @@ -// import 'package:flutter/cupertino.dart'; -// import 'package:flutter/material.dart'; -// import 'package:flutter_html/flutter_html.dart'; -// import 'package:flutter_svg/flutter_svg.dart'; -// import 'package:shared_preferences/shared_preferences.dart'; -// import 'package:tangheem/api/admin_configuration_api_client.dart'; -// import 'package:tangheem/api/tangheem_user_api_client.dart'; -// import 'package:tangheem/app_state/app_state.dart'; -// import 'package:tangheem/classes/colors.dart'; -// import 'package:tangheem/classes/consts.dart'; -// import 'package:tangheem/classes/utils.dart'; -// import 'package:tangheem/extensions/string_extensions.dart'; -// import 'package:tangheem/models/aya_tangheem_type_mapped.dart'; -// import 'package:tangheem/models/discussion_model.dart'; -// import 'package:tangheem/ui/dialogs/discussion_input_dialog.dart'; -// import 'package:tangheem/widgets/aya_player_widget.dart'; -// import 'package:tangheem/widgets/aya_record_widget.dart'; -// import 'package:tangheem/widgets/text_highlight_widget.dart'; -// -// import 'login_screen.dart'; -// -// class TangheemDetailParams { -// final String selectedTangheemTypeId; -// final List ayatTangheemTypeMappedDataList; -// -// TangheemDetailParams({@required this.selectedTangheemTypeId, @required this.ayatTangheemTypeMappedDataList}); -// } -// -// class TangheemDetailScreen extends StatefulWidget { -// static const String routeName = "/tangheem_detail"; -// final TangheemDetailParams tangheemDetailParams; -// -// TangheemDetailScreen({Key key, this.tangheemDetailParams}) : super(key: key); -// -// @override -// _TangheemDetailScreenState createState() { -// return _TangheemDetailScreenState(); -// } -// } -// -// class _TangheemDetailScreenState extends State { -// GlobalKey _globalKey = GlobalKey(); -// -// List voiceNoteList = []; -// -// List ayatTangheemTypeMappedDataList = []; -// -// List _dataList = []; -// -// int _discussionPage = -1; -// AyatTangheemTypeMappedData _ayatTangheemTypeMappedFirstData; -// DiscussionModel _discussionModel; -// -// bool showAyaPlayer = false; -// -// @override -// void initState() { -// super.initState(); -// ayatTangheemTypeMappedDataList = widget.tangheemDetailParams.ayatTangheemTypeMappedDataList; -// _ayatTangheemTypeMappedFirstData = ayatTangheemTypeMappedDataList.first; -// filterVoiceListData(); -// getPrefs(); -// getTangheemDiscussionAndRelatedData(); -// } -// -// double fontSize = 18; -// -// SharedPreferences prefs; -// -// void getPrefs() async { -// prefs = await SharedPreferences.getInstance(); -// fontSize = (prefs.getInt(GlobalConsts.fontZoomSize) ?? 18) + 0.0; -// setState(() {}); -// } -// -// String getArabicIndexWord(int index) { -// if (index == 0) { -// return 'الأولى'; -// } else if (index == 1) { -// return 'الثانية'; -// } else if (index == 2) { -// return 'الثالثة'; -// } else if (index == 3) { -// return 'الرابعة'; -// } else if (index == 4) { -// return 'الخامسة'; -// } -// return ""; -// } -// -// void getTangheemDiscussionAndRelatedData() async { -// Utils.showLoading(context); -// try { -// _discussionModel = await TangheemUserApiClient().getDiscussionByTangheemID(_discussionPage, widget.tangheemDetailParams.selectedTangheemTypeId); -// if (!_ayatTangheemTypeMappedFirstData.ayatNumberInSurahs.contains(",")) { -// _dataList = await getTangheemRelatedData(); -// } -// Utils.hideLoading(context); -// setState(() {}); -// } catch (ex) { -// print(ex); -// Utils.handleException(ex, context, null); -// Utils.hideLoading(context); -// } -// } -// -// Future> getTangheemRelatedData() async { -// _dataList = []; -// AyatTangheemTypeMapped _ayatTangheemTypeMapped = -// await TangheemUserApiClient().getAyaTangheemTypeMappedRelated(_ayatTangheemTypeMappedFirstData.surahNo, _ayatTangheemTypeMappedFirstData.ayatNumberInSurahs); -// _dataList = _ayatTangheemTypeMapped?.data ?? []; -// if (_dataList.isNotEmpty) { -// _dataList = _dataList.where((element) => element.tangheemTypeId != _ayatTangheemTypeMappedFirstData.tangheemTypeId)?.toList() ?? []; -// var _tempList = _dataList.map((e) => e.tangheemTypeId).toList().toSet().toList(); -// var _dataTempList = []; -// _tempList.forEach((_tempElement) { -// _dataTempList.add(_dataList.firstWhere((element) { -// return !element.ayatNumberInSurahs.contains(",") && (element.tangheemTypeId == _tempElement); -// }, orElse: null)); -// }); -// _dataList = _dataTempList; -// } -// -// return _dataList; -// } -// -// void sendComment(String discussionText) async { -// Utils.showLoading(context); -// try { -// await AdminConfigurationApiClient().addDiscussion(discussionText, _ayatTangheemTypeMappedFirstData.ayaTangheemTypeId); -// Utils.showToast("تم إرسال التعليق ، سيكون مرئيًا بمجرد موافقة المسؤول عليه"); -// Utils.hideLoading(context); -// Navigator.pop(context); -// } catch (ex) { -// Utils.handleException(ex, context, null); -// Utils.hideLoading(context); -// } -// } -// -// void filterVoiceListData() { -// ayatTangheemTypeMappedDataList.forEach((element) { -// voiceNoteList.addAll(element.voiceNote); -// }); -// } -// -// @override -// void dispose() { -// super.dispose(); -// } -// -// @override -// Widget build(BuildContext context) { -// return Container( -// padding: EdgeInsets.fromLTRB(16, 0, 16, 0), -// width: double.infinity, -// child: _ayatTangheemTypeMappedFirstData == null -// ? SizedBox() -// : Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Expanded( -// child: ListView( -// physics: BouncingScrollPhysics(), -// padding: EdgeInsets.only(bottom: 16, top: 16), -// children: [ -// Text( -// _ayatTangheemTypeMappedFirstData.tangheemTypeName ?? "", -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20, color: ColorConsts.primaryBlue, height: 1.5), -// ), -// SizedBox(height: 8), -// Text( -// _ayatTangheemTypeMappedFirstData.tangheemTypeDescription ?? "", -// style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1), -// ), -// SizedBox(height: 8), -// Container( -// margin: EdgeInsets.only(top: 4, bottom: 4), -// padding: EdgeInsets.only(top: 8, bottom: 8, right: 4, left: 4), -// decoration: BoxDecoration( -// color: Colors.white, -// borderRadius: BorderRadius.circular(8), -// ), -// child: SingleChildScrollView( -// physics: NeverScrollableScrollPhysics(), -// child: RepaintBoundary( -// key: _globalKey, -// child: Material( -// color: Colors.white, -// child: ListView.builder( -// physics: NeverScrollableScrollPhysics(), -// shrinkWrap: true, -// itemCount: ayatTangheemTypeMappedDataList.length > 5 ? 5 : ayatTangheemTypeMappedDataList.length, -// itemBuilder: (context, index) { -// var _ayatTangheemTypeMappedData = ayatTangheemTypeMappedDataList[index]; -// List _tangheemInsideTableList = []; -// List _tangheemAboveTableList = []; -// List _tangheemBelowTableList = []; -// List _tangheemWords = []; -// -// List _tempPropertyList = List() + _ayatTangheemTypeMappedData?.property ?? []; -// int firstIndex = _tempPropertyList.indexWhere((element) => element.isInsideTable); -// if (firstIndex >= 0) { -// var _tempPropertyListTop = _tempPropertyList.take(firstIndex); -// _tempPropertyListTop = _tempPropertyListTop.where((element) => (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; -// _tangheemAboveTableList = _tempPropertyListTop; -// _tempPropertyListTop.forEach((element) { -// _tempPropertyList.remove(element); -// }); -// var _tempPropertyListInside = _tempPropertyList?.where((element) => (element.isInsideTable))?.toList() ?? []; -// _tempPropertyListInside.forEach((element) { -// _tempPropertyList.remove(element); -// }); -// _tempPropertyListInside = _tempPropertyListInside.where((element) => (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; -// _tangheemInsideTableList = _tempPropertyListInside; -// var _tempPropertyListBelow = _tempPropertyList; -// _tempPropertyListBelow = _tempPropertyListBelow.where((element) => (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; -// _tangheemBelowTableList = _tempPropertyListBelow; -// } -// -// _tangheemWords.add(_ayatTangheemTypeMappedData.highlightText ?? ""); -// // _tangheemInsideTableList = -// // _ayatTangheemTypeMappedData?.property?.where((element) => (element.isInsideTable) && (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; -// // _tangheemAboveTableList = -// // _ayatTangheemTypeMappedData?.property?.where((element) => (!element.isInsideTable) && (element.propertyValue ?? "").isNotEmpty)?.toList() ?? []; -// // -// // -// -// var _tempTangheemIndexWord = ""; -// if (ayatTangheemTypeMappedDataList.length == 1) { -// _tempTangheemIndexWord = ""; -// } else { -// _tempTangheemIndexWord = getArabicIndexWord(index) + " "; -// } -// -// return ListView( -// physics: NeverScrollableScrollPhysics(), -// shrinkWrap: true, -// padding: EdgeInsets.all(4), -// children: [ -// Row( -// children: [ -// Text( -// " جملة ${_ayatTangheemTypeMappedData.tangheemTypeName} $_tempTangheemIndexWord", -// style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, backgroundColor: ColorConsts.primaryBlue), -// ), -// Expanded( -// child: Container(height: 2, color: ColorConsts.primaryBlue), -// ), -// ], -// ), -// SizedBox(height: 8), -// TextHighLightWidget( -// text: _ayatTangheemTypeMappedData.reverseAyatNumber() ?? "", -// valueColor: ColorConsts.primaryBlue, -// highlights: _tangheemWords, -// highLightFontSize: fontSize, -// style: TextStyle( -// fontFamily: "UthmanicHafs", -// fontSize: fontSize, -// fontWeight: FontWeight.bold, -// ), -// ), -// SizedBox(height: 16), -// ListView.separated( -// itemCount: _tangheemAboveTableList.length, -// physics: NeverScrollableScrollPhysics(), -// shrinkWrap: true, -// separatorBuilder: (context, index) { -// return Divider( -// color: Colors.white, -// height: 4, -// thickness: 0, -// ); -// }, -// itemBuilder: (context, index) { -// return Row( -// children: [ -// Expanded( -// child: Container( -// height: 40, -// padding: EdgeInsets.only(left: 4, right: 8), -// alignment: Alignment.centerRight, -// child: Text( -// _tangheemAboveTableList[index].propertyText, -// maxLines: 1, -// style: TextStyle(fontWeight: FontWeight.bold, color: ColorConsts.secondaryOrange), -// ), -// color: ColorConsts.secondaryWhite, -// ), -// ), -// SizedBox(width: 4), -// Expanded( -// child: Container( -// color: ColorConsts.secondaryWhite, -// padding: EdgeInsets.all(4), -// child: Container( -// color: Colors.white, -// padding: EdgeInsets.only(left: 4, right: 8), -// // alignment: Alignment.centerRight, -// child: Html( -// data: _tangheemAboveTableList[index]?.propertyValue ?? "", -// style: { -// 'html': Style(textAlign: TextAlign.left), -// }, -// ), -// -// // Text( -// // _tangheemAboveTableList[index].propertyValue, -// // maxLines: 1, -// // style: TextStyle( -// // color: Color( -// // Utils.stringToHex(_tangheemAboveTableList[index].textColor), -// // ), -// // ), -// // ), -// ), -// ), -// ) -// ], -// ); -// }), -// if (_tangheemInsideTableList.isNotEmpty) -// Container( -// color: ColorConsts.primaryBlue, -// margin: EdgeInsets.only(top: 8, bottom: 8), -// padding: EdgeInsets.all(8), -// child: Column( -// children: [ -// Text( -// "خط النبر و التنغيم ل${_ayatTangheemTypeMappedData.tangheemTypeName ?? ""}", -// style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white), -// ), -// SizedBox(height: 8), -// tangheemInsideTablePropertyView(_tangheemInsideTableList) -// ], -// ), -// ), -// tangheemOutSideTablePropertyView(_tangheemBelowTableList) -// ], -// ); -// }), -// ), -// ), -// ), -// ), -// SizedBox(height: 8), -// discussionView(_discussionModel?.data ?? []), -// if (_dataList.isNotEmpty) -// Container( -// margin: EdgeInsets.only(top: 8), -// padding: EdgeInsets.only(bottom: 20), -// width: double.infinity, -// decoration: BoxDecoration( -// color: Colors.white, -// borderRadius: BorderRadius.circular(8), -// ), -// child: Column( -// children: [ -// Container( -// height: 60, -// width: double.infinity, -// margin: EdgeInsets.only(bottom: 8), -// alignment: Alignment.center, -// decoration: BoxDecoration( -// color: ColorConsts.primaryBlue, -// borderRadius: BorderRadius.only( -// topLeft: Radius.circular(8), -// topRight: Radius.circular(8), -// ), -// ), -// child: Text( -// "قائمة الأساليب اللغوية في هذه الآية", -// style: TextStyle(fontSize: 16, color: Colors.white), -// ), -// ), -// ListView.separated( -// padding: EdgeInsets.fromLTRB(4, 8, 4, 4), -// shrinkWrap: true, -// physics: NeverScrollableScrollPhysics(), -// itemCount: _dataList.length, -// separatorBuilder: (context, index) => SizedBox(height: 16), -// itemBuilder: (context, index) { -// return InkWell( -// onTap: () { -// List list = _dataList; -// var removedData = list[index]; -// list.remove(removedData); -// list.insert(0, removedData); -// TangheemDetailParams tangheem = TangheemDetailParams(selectedTangheemTypeId: _dataList[index].ayaTangheemTypeId, ayatTangheemTypeMappedDataList: list); -// Navigator.pushNamed(context, TangheemDetailScreen.routeName, arguments: tangheem); -// }, -// child: Text( -// _dataList[index].tangheemTypeName, -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: ColorConsts.secondaryOrange, height: 1.5), -// ), -// ); -// }, -// ), -// ], -// ), -// ), -// SizedBox(height: 16), -// AyaRecordWidget() -// ], -// ), -// ), -// if (MediaQuery.of(context).orientation == Orientation.portrait) -// AyaPlayerWidget( -// surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", -// ayaTangheemTypeId: _ayatTangheemTypeMappedFirstData?.ayaTangheemTypeId ?? "", -// globalKey: _globalKey, -// ayaNo: _ayatTangheemTypeMappedFirstData?.ayahNo, -// surahNo: _ayatTangheemTypeMappedFirstData?.surahNo, -// voiceNoteList: voiceNoteList), -// if (MediaQuery.of(context).orientation == Orientation.landscape) -// Column( -// mainAxisSize: MainAxisSize.min, -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Container( -// height: 24, -// margin: EdgeInsets.only(bottom: 8, top: 8), -// // color: Colors.transparent, -// child: TextButton( -// onPressed: () { -// setState(() { -// showAyaPlayer = !showAyaPlayer; -// }); -// }, -// child: Text( -// showAyaPlayer ? "إخفاء التسجيلات" : "إظهار التسجيلات", -// style: TextStyle(color: Colors.black87, fontSize: 12), -// ), -// style: TextButton.styleFrom( -// backgroundColor: ColorConsts.gradientOrange, -// primary: ColorConsts.primaryBlue, -// padding: EdgeInsets.only(top: 4, bottom: 4, right: 8, left: 8), -// textStyle: TextStyle(color: Colors.white, fontSize: 12), -// ), -// ), -// ), -// if (showAyaPlayer) -// AyaPlayerWidget( -// surahName: _ayatTangheemTypeMappedFirstData?.surahNameAr ?? "", -// ayaTangheemTypeId: _ayatTangheemTypeMappedFirstData?.ayaTangheemTypeId ?? "", -// ayaNo: _ayatTangheemTypeMappedFirstData?.ayahNo, -// surahNo: _ayatTangheemTypeMappedFirstData?.surahNo, -// globalKey: _globalKey, -// voiceNoteList: voiceNoteList), -// ], -// ) -// ], -// ), -// ); -// } -// -// Widget nextOptionButton(String icon, String text, VoidCallback onPressed) { -// return InkWell( -// onTap: onPressed, -// child: onPressed == null -// ? SizedBox() -// : Row( -// crossAxisAlignment: CrossAxisAlignment.center, -// mainAxisSize: MainAxisSize.min, -// children: [ -// SvgPicture.asset(icon, height: 12, width: 12), -// SizedBox(width: 4), -// Text( -// text, -// style: TextStyle(color: ColorConsts.textGrey), -// ), -// ], -// ), -// ); -// } -// -// Widget previousOptionButton(String icon, String text, VoidCallback onPressed) { -// return InkWell( -// onTap: onPressed, -// child: onPressed == null -// ? SizedBox() -// : Row( -// crossAxisAlignment: CrossAxisAlignment.center, -// mainAxisSize: MainAxisSize.min, -// children: [ -// Text( -// text, -// style: TextStyle(color: ColorConsts.textGrey), -// ), -// SizedBox(width: 4), -// SvgPicture.asset(icon, height: 12, width: 12), -// ], -// ), -// ); -// } -// -// Widget tangheemOutSideTablePropertyView(List tangheemPropertyList) { -// return ListView.separated( -// itemCount: tangheemPropertyList.length, -// physics: NeverScrollableScrollPhysics(), -// shrinkWrap: true, -// separatorBuilder: (context, index) { -// return Divider( -// color: Colors.white, -// height: 4, -// thickness: 0, -// ); -// }, -// itemBuilder: (context, index) { -// return Row( -// children: [ -// Expanded( -// child: Container( -// height: 40, -// padding: EdgeInsets.only(left: 4, right: 8), -// alignment: Alignment.centerRight, -// child: Text( -// tangheemPropertyList[index].propertyText, -// maxLines: 1, -// style: TextStyle(fontWeight: FontWeight.bold, color: ColorConsts.secondaryOrange), -// ), -// color: ColorConsts.secondaryWhite, -// ), -// ), -// SizedBox(width: 4), -// Expanded( -// child: Container( -// color: ColorConsts.secondaryWhite, -// padding: EdgeInsets.all(4), -// child: Container( -// color: Colors.white, -// padding: EdgeInsets.only(left: 4, right: 8), -// // alignment: Alignment.centerRight, -// child: Html( -// data: tangheemPropertyList[index]?.propertyValue ?? "", -// style: { -// 'html': Style(textAlign: TextAlign.left), -// }, -// ), -// // Text( -// // tangheemPropertyList[index].propertyValue, -// // maxLines: 1, -// // style: TextStyle( -// // color: Color( -// // Utils.stringToHex(tangheemPropertyList[index].textColor), -// // ), -// // ), -// // ), -// ), -// ), -// ) -// ], -// ); -// }); -// } -// -// Widget tangheemInsideTablePropertyView(List tangheemPropertyList) { -// return Container( -// color: Colors.white, -// padding: EdgeInsets.all(2), -// child: Row( -// children: [ -// for (var property in tangheemPropertyList) -// Expanded( -// child: Container( -// // color: ColorConsts.secondaryWhite, -// // padding: EdgeInsets.all(8), -// margin: EdgeInsets.only(left: 2, right: 2), -// child: Column( -// mainAxisSize: MainAxisSize.min, -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// Container( -// color: ColorConsts.secondaryWhite, -// //height: 30, -// alignment: Alignment.center, -// padding: EdgeInsets.only(left: 2, right: 4), -// width: double.infinity, -// child: Text( -// property.propertyText ?? "", -// // maxLines: 1, -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: ColorConsts.secondaryOrange), -// ), -// ), -// Container(width: double.infinity, height: 4, color: Colors.white), -// Container( -// color: ColorConsts.secondaryWhite, -// padding: EdgeInsets.all(4), -// child: Container( -// color: Colors.white, -// padding: EdgeInsets.only(left: 2, right: 4), -// width: double.infinity, -// child: Html( -// data: property.propertyValue ?? "", -// style: { -// 'html': Style(textAlign: TextAlign.left), -// }, -// ), -// -// // Text( -// // property.propertyValue ?? "", -// // maxLines: 1, -// // style: TextStyle( -// // fontSize: 12, -// // color: Color( -// // Utils.stringToHex(property.textColor), -// // ), -// // ), -// // ), -// ), -// ), -// ], -// ), -// ), -// ) -// ], -// ) -// -// //@todo sikander :commented these line for later discussion -// // ListView.separated( -// // itemCount: tangheemPropertyList.length, -// // physics: NeverScrollableScrollPhysics(), -// // padding: EdgeInsets.zero, -// // shrinkWrap: true, -// // separatorBuilder: (context, index) { -// // return Divider( -// // color: Colors.white, -// // height: 1, -// // thickness: 0, -// // ); -// // }, -// // itemBuilder: (context, index) { -// // return Container( -// // color: ColorConsts.secondaryWhite, -// // padding: EdgeInsets.all(8), -// // child: Column( -// // mainAxisSize: MainAxisSize.min, -// // crossAxisAlignment: CrossAxisAlignment.start, -// // mainAxisAlignment: MainAxisAlignment.center, -// // children: [ -// // Text( -// // tangheemPropertyList[index].propertyText ?? "", -// // style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: ColorConsts.secondaryOrange), -// // ), -// // SizedBox(height: 4), -// // Text( -// // tangheemPropertyList[index].propertyValue ?? "", -// // style: TextStyle( -// // fontSize: 12, -// // color: Color( -// // Utils.stringToHex(tangheemPropertyList[index].textColor), -// // ), -// // ), -// // ), -// // ], -// // ), -// // ); -// // }, -// // ), -// ); -// } -// -// Widget discussionView(List _discussionList) { -// _discussionList = _discussionList.where((element) => element.status.toLowerCase() == "Accept".toLowerCase()).toList(); -// return Stack( -// alignment: Alignment.bottomCenter, -// children: [ -// Container( -// margin: EdgeInsets.only(top: 4, bottom: 25), -// padding: EdgeInsets.all(8), -// width: double.infinity, -// decoration: BoxDecoration( -// color: Colors.white, -// borderRadius: BorderRadius.circular(8), -// ), -// child: _discussionList.length > 0 -// ? ListView.separated( -// padding: EdgeInsets.only(top: 4, bottom: 24), -// shrinkWrap: true, -// physics: NeverScrollableScrollPhysics(), -// itemCount: _discussionList.length, -// separatorBuilder: (context, index) => SizedBox(height: 16), -// itemBuilder: (context, index) { -// return Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisSize: MainAxisSize.min, -// children: [ -// Row( -// children: [ -// SvgPicture.asset( -// "assets/icons/chat_user.svg", -// width: 60, -// height: 60, -// ), -// SizedBox(width: 8), -// Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// mainAxisAlignment: MainAxisAlignment.center, -// children: [ -// Text( -// "تعليق على الآية ${_ayatTangheemTypeMappedFirstData.ayatNumberInSurahs}", -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16, color: ColorConsts.primaryBlue, height: 1.5), -// ), -// SizedBox(height: 4), -// Directionality( -// textDirection: TextDirection.ltr, -// child: Text( -// _discussionList[index].date.toFormattedDate(), -// style: TextStyle(fontSize: 12, color: ColorConsts.textGrey, height: 1), -// ), -// ), -// ], -// ) -// ], -// ), -// SizedBox(height: 4), -// Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Text( -// "تعليق من: " + _discussionList[index].userName, -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: ColorConsts.primaryBlue, height: 1.5), -// ), -// Text( -// _discussionList[index].discussionText, -// style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1.4), -// ), -// if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) SizedBox(height: 4), -// if ((_discussionList[index]?.adminResponse ?? "").isNotEmpty) -// Text( -// "رد من المسؤول: " + _discussionList[index].adminResponse, -// style: TextStyle(fontSize: 14, color: ColorConsts.textGrey, height: 1.4), -// ), -// ], -// ) -// ], -// ); -// }, -// ) -// : Text( -// "لا يوجد تعليقات", -// style: TextStyle(fontSize: 12, color: ColorConsts.primaryBlue, height: 1.5), -// ), -// ), -// Positioned( -// bottom: 0, -// child: InkWell( -// borderRadius: BorderRadius.circular(30), -// onTap: () async { -// if (!AppState().isUserLogin) { -// Widget cancelButton = FlatButton( -// child: Text("أرغب بالتسجيل"), -// onPressed: () async { -// Navigator.pop(context); -// await Navigator.pushNamed(context, LoginScreen.routeName); -// if (!AppState().isUserLogin) { -// return; -// } -// }, -// ); -// Widget continueButton = FlatButton( -// child: Text("استمرار كضيف"), -// onPressed: () { -// Navigator.pop(context); -// return; -// }, -// ); -// -// AlertDialog alert = AlertDialog( -// content: Text("هذه الخاصية متاحه فقط للأعضاء المسجلين"), -// actions: [ -// cancelButton, -// continueButton, -// ], -// ); -// -// showDialog( -// context: context, -// builder: (BuildContext context) { -// return alert; -// }, -// ); -// -// return; -// } -// showDialog( -// context: context, -// barrierColor: ColorConsts.secondaryWhite.withOpacity(0.8), -// builder: (BuildContext context) => DiscussionInputDialog(onCommentPress: (comment) { -// sendComment(comment); -// }), -// ); -// }, -// child: Container( -// height: 40, -// padding: EdgeInsets.only(left: 24, right: 24), -// alignment: Alignment.centerRight, -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(30), -// color: ColorConsts.gradientPink, -// gradient: LinearGradient( -// stops: [0.0, 0.5], -// begin: Alignment.topCenter, -// end: Alignment.bottomCenter, -// colors: [ColorConsts.gradientPink, ColorConsts.gradientOrange], -// ), -// ), -// child: Text( -// "إضافة تعليق", -// style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Colors.white, height: 1.5), -// ), -// ), -// ), -// ), -// ], -// ); -// } -// } diff --git a/lib/widgets/button/default_button.dart b/lib/widgets/button/default_button.dart index 77d1c61..d572d0c 100644 --- a/lib/widgets/button/default_button.dart +++ b/lib/widgets/button/default_button.dart @@ -3,10 +3,7 @@ import 'package:flutter_svg/svg.dart'; import 'package:mohem_flutter_app/classes/colors.dart'; extension WithContainer on Widget { - Widget get insideContainer => Container( - color: Colors.white, - padding: const EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: this); + Widget get insideContainer => Container(color: Colors.white, padding: const EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); } class DefaultButton extends StatelessWidget { @@ -23,15 +20,7 @@ class DefaultButton extends StatelessWidget { final List? colors; DefaultButton(this.text, this.onPress, - {this.color, - this.isTextExpanded = true, - this.svgIcon, - this.disabledColor, - this.count = 0, - this.textColor = Colors.white, - this.iconData, - this.fontSize, - this.colors}); + {this.color, this.isTextExpanded = true, this.svgIcon, this.disabledColor, this.count = 0, this.textColor = Colors.white, this.iconData, this.fontSize, this.colors}); @override Widget build(BuildContext context) { @@ -42,8 +31,7 @@ class DefaultButton extends StatelessWidget { decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.0), gradient: onPress == null - ? const LinearGradient( - colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)]) + ? const LinearGradient(colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)]) : LinearGradient( transform: GradientRotation(.83), begin: Alignment.topRight, @@ -58,20 +46,14 @@ class DefaultButton extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ if (iconData != null) Icon(iconData, color: textColor), - if (svgIcon != null) - SvgPicture.asset(svgIcon ?? "", color: textColor), + if (svgIcon != null) SvgPicture.asset(svgIcon ?? "", color: textColor), if (!isTextExpanded) Padding( - padding: EdgeInsets.only( - left: (iconData ?? svgIcon) != null ? 6 : 0), + padding: EdgeInsets.only(left: (iconData ?? svgIcon) != null ? 6 : 0), child: Text( text, textAlign: TextAlign.center, - style: TextStyle( - fontSize: fontSize ?? 16, - fontWeight: FontWeight.w600, - color: textColor, - letterSpacing: -0.48), + style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), ), ), if (isTextExpanded) @@ -79,11 +61,7 @@ class DefaultButton extends StatelessWidget { child: Text( text, textAlign: TextAlign.center, - style: TextStyle( - fontSize: fontSize ?? 16, - fontWeight: FontWeight.w600, - color: textColor, - letterSpacing: -0.48), + style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), ), ), if (count > 0) @@ -94,17 +72,11 @@ class DefaultButton extends StatelessWidget { padding: const EdgeInsets.only(left: 5, right: 5), alignment: Alignment.center, height: 16, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10.0), - color: Colors.white), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10.0), color: Colors.white), child: Text( "$count", textAlign: TextAlign.center, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.w700, - color: Color(0xffD02127), - letterSpacing: -0.6), + style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w700, color: Color(0xffD02127), letterSpacing: -0.6), ), ), ) diff --git a/lib/widgets/button/simple_button.dart b/lib/widgets/button/simple_button.dart new file mode 100644 index 0000000..eecce21 --- /dev/null +++ b/lib/widgets/button/simple_button.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; +import 'package:mohem_flutter_app/classes/colors.dart'; + +class SimpleButton extends StatelessWidget { + final String text; + final VoidCallback? onPress; + final Color textColor; + final Color? color; + final double? fontSize; + final List? colors; + + SimpleButton(this.text, this.onPress, {this.color, this.textColor = Colors.white, this.fontSize, this.colors}); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onPress, + child: Container( + alignment: Alignment.center, + padding: const EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + gradient: onPress == null + ? const LinearGradient(colors: [Color(0xffEAEAEA), Color(0xffEAEAEA)]) + : LinearGradient( + transform: const GradientRotation(.83), + begin: Alignment.topRight, + end: Alignment.bottomLeft, + colors: colors ?? + [ + MyColors.gradiantEndColor, + MyColors.gradiantStartColor, + ]), + ), + child: Text( + text, + style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), + ), + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index d38cc5a..a28ba95 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,7 @@ dependencies: flutter_countdown_timer: ^4.1.0 nfc_manager: ^3.1.1 uuid: ^3.0.6 + file_picker: ^4.6.1 # maps google_maps_flutter: ^2.0.2