From 7210793a7146b58eb85c955193c2822fa4aab24f Mon Sep 17 00:00:00 2001 From: Sai Srinivas Date: Wed, 17 Sep 2025 13:09:42 +0530 Subject: [PATCH] 17-09 --- lib/Models/AccountSuggestionResponse.dart | 18 +- lib/Models/AddContactResponse.dart | 8 +- lib/Models/AttendanceHistoryresponse.dart | 313 +++-- lib/Models/AttendanceListResponse.dart | 22 +- lib/Models/CheckInResponse.dart | 8 +- lib/Models/CheckOutResponse.dart | 8 +- lib/Models/ComplaintRegister.dart | 6 +- lib/Models/ComplaintsSelectionResponse.dart | 59 +- lib/Models/DashboardResponse.dart | 21 +- lib/Models/DayWiseAttendance.dart | 37 +- lib/Models/FollowUpResponse.dart | 69 +- .../Inventory_Part_details_response.dart | 139 +- lib/Models/LoginQRResponse.dart | 8 +- lib/Models/LogoutResponse.dart | 6 +- lib/Models/NearbyGeneratorsResponse.dart | 41 +- lib/Models/PaymentCollectionResponse.dart | 45 +- .../PaymentCollectionValidateOTPResponse.dart | 15 +- .../PaymentCollectionWalletResponse.dart | 62 +- lib/Models/ProfileResponse.dart | 47 +- lib/Models/QRResponse.dart | 10 +- lib/Models/SessionResponse.dart | 6 +- lib/Models/StatusResponse.dart | 61 +- lib/Models/SubmitComplaintResponse.dart | 6 +- lib/Models/TagGeneratorResponse.dart | 8 +- lib/Models/TagLocationResponse.dart | 6 +- ...echnicianAddPaymentCollectionResponse.dart | 18 +- lib/Models/TechnicianDashboardResponse.dart | 42 +- lib/Models/TechnicianLoadNumbersResponse.dart | 38 +- .../TechniciansPendingComplaintsResponse.dart | 37 +- lib/Models/TodayVisitResponse.dart | 63 +- lib/Models/UpdateComplaintResponse.dart | 8 +- lib/Models/UpdatePasswordResponse.dart | 8 +- lib/Models/VersionsResponse.dart | 37 +- lib/Models/ViewVisitDetailsResponse.dart | 237 ++-- lib/Models/ViewVisitDetailsResponseNew.dart | 516 +++---- .../commonModels/DistrictsResponse.dart | 29 +- .../commonModels/SubLocationsResponse.dart | 35 +- .../commonAccessiblePagesResponse.dart | 27 +- .../commonAccountLedgerFilterResponse.dart | 18 +- .../commonAccountLedgerResponse.dart | 165 +-- .../commonAccountdetailsResponse.dart | 165 +-- .../commonAccountlistResponse.dart | 113 +- .../commonAddAccountsSubmitResponse.dart | 16 +- .../commonAddAccountsViewResponse.dart | 26 +- .../crmModels/AccessiblePagesResponse.dart | 20 +- .../crmModels/GetDistrictOnStateResponse.dart | 45 +- .../crmModels/GetSegmentOnTeamResponse.dart | 45 +- .../GetSourceOnReferenceResponse.dart | 45 +- .../GetSubLocOnDistrictResponse.dart | 46 +- lib/Models/crmModels/LeadDetailsResponse.dart | 589 ++++---- .../LeadListContactPopUpResponse.dart | 73 +- .../crmModels/LeadListViewResponse.dart | 74 +- .../crmModels/NearbyOpenLeadsResponse.dart | 113 +- .../crmModels/ProspectListViewResponse.dart | 18 +- .../SubmitLeadListFilterResponse.dart | 247 ++-- .../SubmitProspectListFilterResponse.dart | 61 +- .../appointmentCalendarResponse.dart | 30 +- .../crmModels/crmAddFollowUpResponse.dart | 18 +- .../crmDashboardFollowUpResponse.dart | 60 +- .../crmDashboardQuotationResponse.dart | 44 +- .../crmModels/crmDashboardResponse.dart | 285 ++-- .../crmDownloadGenQuoteResponse.dart | 18 +- ...crmLeadDetailsEditAccountViewResponse.dart | 45 +- ...rmLeadDetailsEditProductsViewResponse.dart | 85 +- ...etailsGenerateQuotationSubmitResponse.dart | 18 +- ...dDetailsGenerateQuotationViewResponse.dart | 142 +- .../crmNewLeadsProspectsSubmitResponse.dart | 8 +- .../crmNewLeadsProspectsViewResponse.dart | 92 +- .../crmModels/crmPendingTasksResponse.dart | 54 +- ...DetailsAddFollowUpAppointmentResponse.dart | 18 +- .../crmProspectDetailsAddLeadsResponse.dart | 42 +- ...rospectDetailsEditAccountViewResponse.dart | 132 +- .../crmModels/crmProspectDetailsResponse.dart | 583 ++++---- .../crmSelectedProductDetailsResponse.dart | 84 +- .../crmModels/crmUniversalSearchResponse.dart | 220 +-- .../addDirectPaymentResponse.dart | 60 +- .../addPaymentRequestionResponse.dart | 71 +- .../addReceiptPaymentResponse.dart | 60 +- .../financeDashboardPagesResponse.dart | 27 +- .../paymentRequesitionListsResponse.dart | 113 +- .../paymentRequestionBankDetailsResponse.dart | 60 +- .../paymentRequisitionDetailsResponse.dart | 165 +-- ...entRequisitionPaymentsDetailsResponse.dart | 140 +- ...aymentRequisitionPaymentsListResponse.dart | 109 +- ...sitionPaymentsReceiptsDetailsResponse.dart | 116 +- ...quisitionPaymentsReceiptsListResponse.dart | 108 +- lib/Models/generatorComplaintResponse.dart | 45 +- .../attendanceRequestDetailsResponse.dart | 121 +- .../attendanceRequestListResponse.dart | 72 +- .../hrmModels/hrmAccessiblePagesResponse.dart | 30 +- .../hrmModels/jobDescriptionResponse.dart | 35 +- .../leaveApplicationDetailsResponse.dart | 84 +- .../leaveApplicationLIstResponse.dart | 50 +- lib/Models/hrmModels/rewardListResponse.dart | 107 +- .../tourExpensesAddViewResponse.dart | 29 +- .../tourExpensesDetailsResponse.dart | 257 ++-- .../hrmModels/tourExpensesListResponse.dart | 63 +- lib/Models/hrmmodels/ogresponse.dart | 58 +- lib/Models/loadGeneratorDetailsResponse.dart | 284 ++-- .../AddOrderPaymentSelectAccountResponse.dart | 25 +- .../AddOrderPaymentSelectOrderResponse.dart | 44 +- .../ordersModels/AddOrderViewResponse.dart | 169 +-- ...mentDetailsAdjustedOrdersViewResponse.dart | 91 +- .../PendingTPCAgentListResponse.dart | 128 +- .../ordersModels/TPCAgentDetailsResponse.dart | 204 +-- lib/Models/ordersModels/TPCListResponse.dart | 86 +- .../addOrderAccontDetailsResponse.dart | 109 +- .../addOrderPaymentViewResponse.dart | 18 +- .../addOrderTpcAgentListResponse.dart | 18 +- lib/Models/ordersModels/commonResponse.dart | 8 +- .../ordersModels/orderDashboardResponse.dart | 84 +- .../orderPendingTasksListResponse.dart | 54 +- .../ordersAccessiblePagesResponse.dart | 27 +- .../ordersDetailsByModeResponse.dart | 499 +++---- ...rdersDetailsDispatchOrderViewResponse.dart | 84 +- .../ordersDetailsEditOrderViewResponse.dart | 296 ++-- .../ordersListByModeFilterResponse.dart | 28 +- .../ordersListByModeResponse.dart | 117 +- .../ordersPdiIdByEngNumberResponse.dart | 8 +- .../paymentDetailsByModeFilterResponse.dart | 329 ++--- .../paymentListByModeFilterResponse.dart | 18 +- .../paymentListByModeResponse.dart | 89 +- ...technicianAddPaymentResendOTPResponse.dart | 15 +- lib/Notifiers/AttendanceNotifier.dart | 19 +- lib/Notifiers/CheckInProvider.dart | 44 +- lib/Notifiers/GeneratorDetailsProvider.dart | 56 +- lib/Notifiers/HomeScreenNotifier.dart | 16 +- lib/Notifiers/InventoryProvider.dart | 89 +- lib/Notifiers/LogoutNotifier.dart | 56 +- lib/Notifiers/NearByGeneratorsProvider.dart | 79 +- lib/Notifiers/PCWalletProvider.dart | 12 +- lib/Notifiers/PaymentCollectionProvider.dart | 9 +- lib/Notifiers/PaymentDetailsProvider.dart | 70 +- lib/Notifiers/PendingComplaintsProvider.dart | 77 +- lib/Notifiers/ProfileNotifier.dart | 127 +- .../ServiceEngineerDashboardProvider.dart | 12 +- lib/Notifiers/TodayMontlyVisitsProvider.dart | 6 +- lib/Notifiers/UpdatePasswordProvider.dart | 21 +- lib/Notifiers/VisitDetailsProvider.dart | 116 +- .../accountDetailsProvider.dart | 62 +- .../commonProvider/accountLedgerProvider.dart | 70 +- .../commonProvider/accountsListProvider.dart | 168 ++- .../commonProvider/commonPagesProvider.dart | 24 +- .../crmProvider/LeadListProvider.dart | 183 ++- .../crmProvider/ProspectListProvider.dart | 31 +- .../addNewLeadsandProspectsProvider.dart | 189 +-- .../crmProvider/addProspectLeadsProvider.dart | 34 +- .../appointmentCalendarProvider.dart | 21 +- .../crmProvider/crmDashboardProvider.dart | 41 +- .../crmEditProspectAccountProvider.dart | 55 +- .../crmGenerateQuotationProvider.dart | 85 +- .../crmProvider/crmLeadDetailsProvider.dart | 167 +-- .../crmNearbyOpenLeadsProvider.dart | 80 +- .../crmProspectDetailsProvider.dart | 16 +- .../editCrmAccountDetailsProvider.dart | 26 +- .../crmProvider/editProductListProvider.dart | 55 +- .../crmProvider/followUpUpdateProvider.dart | 97 +- .../financeProvider/DashboardProvider.dart | 47 +- .../RequesitionLidtDetailsProvider.dart | 356 ++--- .../RequestionListProvider.dart | 77 +- .../approveRejectPaymentRequestResponse.dart | 114 +- .../paymentReceiptsProvider.dart | 57 +- ...aymentRequisitionPaymentsListProvider.dart | 165 ++- .../LeaveApplicationDetailsProvider.dart | 27 +- .../attendanceDetailsProvider.dart | 31 +- .../hrmProvider/attendanceListProvider.dart | 242 ++-- .../hrmAccessiblePagesProvider.dart | 4 +- .../leaveApplicationListProvider.dart | 202 +-- .../tourExpensesDetailsProvider.dart | 7 +- lib/Notifiers/hrmprovider/orgprovider.dart | 36 +- lib/Notifiers/loginNotifier.dart | 47 +- .../ordersProvider/addOrderProvider.dart | 358 ++--- .../ordersProvider/addPaymentProvider.dart | 408 +++--- .../ordersProvider/dispatchOrderProvider.dart | 141 +- .../ordersProvider/editOrderProvider.dart | 65 +- .../ordersProvider/editPaymentProvider.dart | 151 +- .../pagesDashboardProvider.dart | 287 ++-- .../ordersProvider/paymentsProvider.dart | 63 +- .../ordersProvider/tpcAgentsProvider.dart | 190 +-- lib/Notifiers/scanLoginProvider.dart | 79 +- lib/Notifiers/splashVersionNotifier.dart | 23 +- lib/main.dart | 13 +- lib/screens/AttendanceScreen.dart | 90 +- lib/screens/CheckInScreen.dart | 460 +++--- lib/screens/CommonFilter2.dart | 313 +++-- lib/screens/FrontCameraCapture.dart | 102 +- lib/screens/JobDescription.dart | 5 +- lib/screens/LoginScreen.dart | 42 +- lib/screens/ScannerLogin.dart | 3 +- lib/screens/UpdatePasswordScreen.dart | 136 +- lib/screens/WebERPScreen.dart | 730 +++++----- lib/screens/commom/accountLedger.dart | 17 +- lib/screens/commom/accountsList.dart | 225 ++- lib/screens/commom/accountsListDetails.dart | 38 +- lib/screens/commom/addCommonPayment.dart | 527 +++---- lib/screens/commonDateRangeFilter.dart | 277 ++-- lib/screens/crm/AppointmentDetails.dart | 120 +- lib/screens/crm/FollowUpDetails.dart | 5 +- lib/screens/crm/LeadDetailsByMode.dart | 384 +++-- lib/screens/crm/LeadListByMode.dart | 282 ++-- lib/screens/crm/NearbyOpenLeads.dart | 77 +- lib/screens/crm/ProspectDetailsByMode.dart | 452 +++--- lib/screens/crm/ProspectListByMode.dart | 6 +- lib/screens/crm/addLeadProductScreen.dart | 75 +- lib/screens/crm/addLeadsProspectsScreen.dart | 491 ++++--- lib/screens/crm/addProspectLeads.dart | 19 +- lib/screens/crm/appointmentCalendar.dart | 8 +- lib/screens/crm/crmDashboard.dart | 11 +- lib/screens/crm/editAccountDetails.dart | 130 +- lib/screens/crm/followUpListonType.dart | 334 +++-- lib/screens/crm/followUpUpdateScreen.dart | 710 +++++----- .../crm/generateQuotationAddEditProduct.dart | 26 +- lib/screens/crm/generateQuotationScreen.dart | 4 +- lib/screens/crm/generatedQuotesList.dart | 215 +-- lib/screens/crm/pendingTasksDetails.dart | 77 +- lib/screens/crm/pendingTasksList.dart | 77 +- lib/screens/crm/productDetails.dart | 1 - lib/screens/crm/universalSearchScreen.dart | 174 ++- .../AllPaymentRequesitionListsByModes.dart | 576 ++++---- lib/screens/finance/FileViewer.dart | 12 +- .../finance/PaymentRequestionListDetails.dart | 162 +-- .../finance/addPaymentReceiptList.dart | 100 +- .../finance/directPaymentRequesitionList.dart | 96 +- lib/screens/finance/financeDashboard.dart | 3 +- .../paymentDetailsPaymentRequisition.dart | 171 +-- .../paymentListPaymentRequisition.dart | 264 ++-- .../finance/paymentReceiptDetails.dart | 43 +- lib/screens/finance/paymentreceiptList.dart | 254 ++-- .../submitPaymentRequestionListsByMode.dart | 64 +- lib/screens/genTracker/ComplaintHistory.dart | 222 +-- lib/screens/genTracker/GeneratorDetails.dart | 16 +- lib/screens/genTracker/RegisterComplaint.dart | 9 +- .../ScanEnterGeneratorIDScreen.dart | 1 - lib/screens/hrm/AddLiveAttendance.dart | 211 +-- lib/screens/hrm/AddManualAttendance.dart | 225 +-- lib/screens/hrm/AddTourExpBillScreen.dart | 625 ++++++--- lib/screens/hrm/AttendanceRequestDetail.dart | 942 ++++++++----- lib/screens/hrm/Attendancelist.dart | 904 ++++++------ lib/screens/hrm/HrmDashboardScreen.dart | 120 +- lib/screens/hrm/LeaveApplicationScreen.dart | 266 ++-- .../hrm/OrganizationStructureScreen.dart | 67 +- lib/screens/hrm/RewardListScreen.dart | 552 ++++---- lib/screens/hrm/RewardSearchScreen.dart | 118 +- .../hrm/TourExpensesDetailsScreen.dart | 508 ++++--- lib/screens/hrm/oggchart.dart | 1 - .../inventory/GeneratorPartDetailsScreen.dart | 31 +- lib/screens/inventory/InventoryScreen.dart | 4 +- lib/screens/old/AllrequesitionListsOld.dart | 558 ++++---- lib/screens/old/HomescreenOld.dart | 994 ++++++------- lib/screens/old/crmDashboardold.dart | 92 +- lib/screens/old/leadDetailsOld.dart | 130 +- lib/screens/old/leadListOld.dart | 797 ++++++----- lib/screens/old/paymentListPayReqOld.dart | 500 +++---- lib/screens/old/paymentreceiptListOld.dart | 441 +++--- lib/screens/old/prospectDetailsOld.dart | 537 ++++--- lib/screens/old/prospectListold.dart | 416 +++--- lib/screens/order/addOrder.dart | 194 ++- lib/screens/order/addPayment.dart | 1243 +++++++++-------- lib/screens/order/addTpcAgent.dart | 513 +++---- lib/screens/order/editAdjustedOrderList.dart | 58 +- .../order/editOrderAccountDetails.dart | 290 ++-- .../order/editPaymentDetailsByMode.dart | 54 +- .../order/orderDetailsFeedbackHistory.dart | 268 ++-- .../order/orderDetailsPaymentHistory.dart | 189 +-- lib/screens/order/orderModuleDashboard.dart | 44 +- lib/screens/order/ordersDetailsByModes.dart | 488 +++---- lib/screens/order/ordersListByModes.dart | 323 ++--- lib/screens/order/paymentDetailsByMode.dart | 134 +- lib/screens/order/paymentListsByMode.dart | 807 +++++------ lib/screens/order/tpcAgentDetailsByMode.dart | 220 ++- lib/screens/order/tpcAgentIssueList.dart | 640 ++++----- .../order/tpcAgentIssueListDetails.dart | 1098 +++++++-------- lib/screens/order/tpcAgentListByMode.dart | 727 +++++----- .../serviceEngineer/AccountSuggestions.dart | 83 +- .../serviceEngineer/NearbyGenerators.dart | 211 +-- lib/screens/serviceEngineer/PCWallet.dart | 304 ++-- .../serviceEngineer/PaymentDetails.dart | 27 +- .../serviceEngineer/PendingComplaints.dart | 20 +- .../serviceEngineer/TodayMontlyVisists.dart | 719 +++++----- .../serviceEngineer/UpdateComplaints.dart | 16 +- lib/screens/serviceEngineer/VisitDetails.dart | 2 +- .../serviceEngineer/scanComplaintDetails.dart | 38 +- .../serviceEngineerDashboard.dart | 4 +- lib/screens/splash.dart | 6 +- lib/screens/test.dart | 181 +-- 285 files changed, 22212 insertions(+), 20560 deletions(-) diff --git a/lib/Models/AccountSuggestionResponse.dart b/lib/Models/AccountSuggestionResponse.dart index b236000..19d527a 100644 --- a/lib/Models/AccountSuggestionResponse.dart +++ b/lib/Models/AccountSuggestionResponse.dart @@ -9,7 +9,7 @@ class AccountSuggestionResonse { if (json['account_list'] != null) { accountList = []; json['account_list'].forEach((v) { - accountList!.add(new AccountList.fromJson(v)); + accountList!.add(AccountList.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class AccountSuggestionResonse { } Map toJson() { - final Map data = new Map(); - if (this.accountList != null) { - data['account_list'] = this.accountList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accountList != null) { + data['account_list'] = accountList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -39,9 +39,9 @@ class AccountList { } Map toJson() { - final Map data = new Map(); - data['account_name'] = this.accountName; - data['account_id'] = this.accountId; + final Map data = {}; + data['account_name'] = accountName; + data['account_id'] = accountId; return data; } } diff --git a/lib/Models/AddContactResponse.dart b/lib/Models/AddContactResponse.dart index 10cdb60..564b8a7 100644 --- a/lib/Models/AddContactResponse.dart +++ b/lib/Models/AddContactResponse.dart @@ -12,10 +12,10 @@ class AddContactResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/AttendanceHistoryresponse.dart b/lib/Models/AttendanceHistoryresponse.dart index befa00a..2e9bcbf 100644 --- a/lib/Models/AttendanceHistoryresponse.dart +++ b/lib/Models/AttendanceHistoryresponse.dart @@ -12,45 +12,48 @@ class AttendanceHistory { int? error; int? sessionExists; - AttendanceHistory( - {this.presentDays, - this.absentDays, - this.holidays, - this.latePenalties, - this.dateArray, - this.latePenaltyArray, - this.error, - this.sessionExists}); + AttendanceHistory({ + this.presentDays, + this.absentDays, + this.holidays, + this.latePenalties, + this.dateArray, + this.latePenaltyArray, + this.error, + this.sessionExists, + }); AttendanceHistory.fromJson(Map json) { presentDays = json['present_days']; absentDays = json['absent_days']; holidays = json['holidays']; latePenalties = json['late_penalties']; - dateArray = json['date_array'] != null - ? new DateArray.fromJson(json['date_array']) - : null; - latePenaltyArray = json['late_penalty_array'] != null - ? new LatePenaltyArray.fromJson(json['late_penalty_array']) - : null; + dateArray = + json['date_array'] != null + ? DateArray.fromJson(json['date_array']) + : null; + latePenaltyArray = + json['late_penalty_array'] != null + ? LatePenaltyArray.fromJson(json['late_penalty_array']) + : null; error = json['error']; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - data['present_days'] = this.presentDays; - data['absent_days'] = this.absentDays; - data['holidays'] = this.holidays; - data['late_penalties'] = this.latePenalties; - if (this.dateArray != null) { - data['date_array'] = this.dateArray!.toJson(); + final Map data = {}; + data['present_days'] = presentDays; + data['absent_days'] = absentDays; + data['holidays'] = holidays; + data['late_penalties'] = latePenalties; + if (dateArray != null) { + data['date_array'] = dateArray!.toJson(); } - if (this.latePenaltyArray != null) { - data['late_penalty_array'] = this.latePenaltyArray!.toJson(); + if (latePenaltyArray != null) { + data['late_penalty_array'] = latePenaltyArray!.toJson(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -88,38 +91,39 @@ class DateArray { String? s20240224; String? s20240225; - DateArray( - {this.s20240126, - this.s20240127, - this.s20240128, - this.s20240129, - this.s20240130, - this.s20240131, - this.s20240201, - this.s20240202, - this.s20240203, - this.s20240204, - this.s20240205, - this.s20240206, - this.s20240207, - this.s20240208, - this.s20240209, - this.s20240210, - this.s20240211, - this.s20240212, - this.s20240213, - this.s20240214, - this.s20240215, - this.s20240216, - this.s20240217, - this.s20240218, - this.s20240219, - this.s20240220, - this.s20240221, - this.s20240222, - this.s20240223, - this.s20240224, - this.s20240225}); + DateArray({ + this.s20240126, + this.s20240127, + this.s20240128, + this.s20240129, + this.s20240130, + this.s20240131, + this.s20240201, + this.s20240202, + this.s20240203, + this.s20240204, + this.s20240205, + this.s20240206, + this.s20240207, + this.s20240208, + this.s20240209, + this.s20240210, + this.s20240211, + this.s20240212, + this.s20240213, + this.s20240214, + this.s20240215, + this.s20240216, + this.s20240217, + this.s20240218, + this.s20240219, + this.s20240220, + this.s20240221, + this.s20240222, + this.s20240223, + this.s20240224, + this.s20240225, + }); DateArray.fromJson(Map json) { s20240126 = json['2024-01-26']; @@ -156,38 +160,38 @@ class DateArray { } Map toJson() { - final Map data = new Map(); - data['2024-01-26'] = this.s20240126; - data['2024-01-27'] = this.s20240127; - data['2024-01-28'] = this.s20240128; - data['2024-01-29'] = this.s20240129; - data['2024-01-30'] = this.s20240130; - data['2024-01-31'] = this.s20240131; - data['2024-02-01'] = this.s20240201; - data['2024-02-02'] = this.s20240202; - data['2024-02-03'] = this.s20240203; - data['2024-02-04'] = this.s20240204; - data['2024-02-05'] = this.s20240205; - data['2024-02-06'] = this.s20240206; - data['2024-02-07'] = this.s20240207; - data['2024-02-08'] = this.s20240208; - data['2024-02-09'] = this.s20240209; - data['2024-02-10'] = this.s20240210; - data['2024-02-11'] = this.s20240211; - data['2024-02-12'] = this.s20240212; - data['2024-02-13'] = this.s20240213; - data['2024-02-14'] = this.s20240214; - data['2024-02-15'] = this.s20240215; - data['2024-02-16'] = this.s20240216; - data['2024-02-17'] = this.s20240217; - data['2024-02-18'] = this.s20240218; - data['2024-02-19'] = this.s20240219; - data['2024-02-20'] = this.s20240220; - data['2024-02-21'] = this.s20240221; - data['2024-02-22'] = this.s20240222; - data['2024-02-23'] = this.s20240223; - data['2024-02-24'] = this.s20240224; - data['2024-02-25'] = this.s20240225; + final Map data = {}; + data['2024-01-26'] = s20240126; + data['2024-01-27'] = s20240127; + data['2024-01-28'] = s20240128; + data['2024-01-29'] = s20240129; + data['2024-01-30'] = s20240130; + data['2024-01-31'] = s20240131; + data['2024-02-01'] = s20240201; + data['2024-02-02'] = s20240202; + data['2024-02-03'] = s20240203; + data['2024-02-04'] = s20240204; + data['2024-02-05'] = s20240205; + data['2024-02-06'] = s20240206; + data['2024-02-07'] = s20240207; + data['2024-02-08'] = s20240208; + data['2024-02-09'] = s20240209; + data['2024-02-10'] = s20240210; + data['2024-02-11'] = s20240211; + data['2024-02-12'] = s20240212; + data['2024-02-13'] = s20240213; + data['2024-02-14'] = s20240214; + data['2024-02-15'] = s20240215; + data['2024-02-16'] = s20240216; + data['2024-02-17'] = s20240217; + data['2024-02-18'] = s20240218; + data['2024-02-19'] = s20240219; + data['2024-02-20'] = s20240220; + data['2024-02-21'] = s20240221; + data['2024-02-22'] = s20240222; + data['2024-02-23'] = s20240223; + data['2024-02-24'] = s20240224; + data['2024-02-25'] = s20240225; return data; } } @@ -225,38 +229,39 @@ class LatePenaltyArray { int? i20240224; int? i20240225; - LatePenaltyArray( - {this.i20240126, - this.i20240127, - this.i20240128, - this.i20240129, - this.i20240130, - this.i20240131, - this.i20240201, - this.i20240202, - this.i20240203, - this.i20240204, - this.i20240205, - this.i20240206, - this.i20240207, - this.i20240208, - this.i20240209, - this.i20240210, - this.i20240211, - this.i20240212, - this.i20240213, - this.i20240214, - this.i20240215, - this.i20240216, - this.i20240217, - this.i20240218, - this.i20240219, - this.i20240220, - this.i20240221, - this.i20240222, - this.i20240223, - this.i20240224, - this.i20240225}); + LatePenaltyArray({ + this.i20240126, + this.i20240127, + this.i20240128, + this.i20240129, + this.i20240130, + this.i20240131, + this.i20240201, + this.i20240202, + this.i20240203, + this.i20240204, + this.i20240205, + this.i20240206, + this.i20240207, + this.i20240208, + this.i20240209, + this.i20240210, + this.i20240211, + this.i20240212, + this.i20240213, + this.i20240214, + this.i20240215, + this.i20240216, + this.i20240217, + this.i20240218, + this.i20240219, + this.i20240220, + this.i20240221, + this.i20240222, + this.i20240223, + this.i20240224, + this.i20240225, + }); LatePenaltyArray.fromJson(Map json) { i20240126 = json['2024-01-26']; @@ -293,38 +298,38 @@ class LatePenaltyArray { } Map toJson() { - final Map data = new Map(); - data['2024-01-26'] = this.i20240126; - data['2024-01-27'] = this.i20240127; - data['2024-01-28'] = this.i20240128; - data['2024-01-29'] = this.i20240129; - data['2024-01-30'] = this.i20240130; - data['2024-01-31'] = this.i20240131; - data['2024-02-01'] = this.i20240201; - data['2024-02-02'] = this.i20240202; - data['2024-02-03'] = this.i20240203; - data['2024-02-04'] = this.i20240204; - data['2024-02-05'] = this.i20240205; - data['2024-02-06'] = this.i20240206; - data['2024-02-07'] = this.i20240207; - data['2024-02-08'] = this.i20240208; - data['2024-02-09'] = this.i20240209; - data['2024-02-10'] = this.i20240210; - data['2024-02-11'] = this.i20240211; - data['2024-02-12'] = this.i20240212; - data['2024-02-13'] = this.i20240213; - data['2024-02-14'] = this.i20240214; - data['2024-02-15'] = this.i20240215; - data['2024-02-16'] = this.i20240216; - data['2024-02-17'] = this.i20240217; - data['2024-02-18'] = this.i20240218; - data['2024-02-19'] = this.i20240219; - data['2024-02-20'] = this.i20240220; - data['2024-02-21'] = this.i20240221; - data['2024-02-22'] = this.i20240222; - data['2024-02-23'] = this.i20240223; - data['2024-02-24'] = this.i20240224; - data['2024-02-25'] = this.i20240225; + final Map data = {}; + data['2024-01-26'] = i20240126; + data['2024-01-27'] = i20240127; + data['2024-01-28'] = i20240128; + data['2024-01-29'] = i20240129; + data['2024-01-30'] = i20240130; + data['2024-01-31'] = i20240131; + data['2024-02-01'] = i20240201; + data['2024-02-02'] = i20240202; + data['2024-02-03'] = i20240203; + data['2024-02-04'] = i20240204; + data['2024-02-05'] = i20240205; + data['2024-02-06'] = i20240206; + data['2024-02-07'] = i20240207; + data['2024-02-08'] = i20240208; + data['2024-02-09'] = i20240209; + data['2024-02-10'] = i20240210; + data['2024-02-11'] = i20240211; + data['2024-02-12'] = i20240212; + data['2024-02-13'] = i20240213; + data['2024-02-14'] = i20240214; + data['2024-02-15'] = i20240215; + data['2024-02-16'] = i20240216; + data['2024-02-17'] = i20240217; + data['2024-02-18'] = i20240218; + data['2024-02-19'] = i20240219; + data['2024-02-20'] = i20240220; + data['2024-02-21'] = i20240221; + data['2024-02-22'] = i20240222; + data['2024-02-23'] = i20240223; + data['2024-02-24'] = i20240224; + data['2024-02-25'] = i20240225; return data; } } diff --git a/lib/Models/AttendanceListResponse.dart b/lib/Models/AttendanceListResponse.dart index cc03941..3c6bd1d 100644 --- a/lib/Models/AttendanceListResponse.dart +++ b/lib/Models/AttendanceListResponse.dart @@ -10,19 +10,19 @@ class AttendanceDashboard { if (json['att_history'] != null) { attHistory = []; json['att_history'].forEach((v) { - attHistory!.add(new AttHistory.fromJson(v)); + attHistory!.add(AttHistory.fromJson(v)); }); } sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - data['att_status'] = this.attStatus; - if (this.attHistory != null) { - data['att_history'] = this.attHistory!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['att_status'] = attStatus; + if (attHistory != null) { + data['att_history'] = attHistory!.map((v) => v.toJson()).toList(); } - data['session_exists'] = this.sessionExists; + data['session_exists'] = sessionExists; return data; } } @@ -41,10 +41,10 @@ class AttHistory { } Map toJson() { - final Map data = new Map(); - data['date'] = this.date; - data['check_in_time'] = this.checkInTime; - data['check_out_time'] = this.checkOutTime; + final Map data = {}; + data['date'] = date; + data['check_in_time'] = checkInTime; + data['check_out_time'] = checkOutTime; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/CheckInResponse.dart b/lib/Models/CheckInResponse.dart index 4a95be4..67731d0 100644 --- a/lib/Models/CheckInResponse.dart +++ b/lib/Models/CheckInResponse.dart @@ -10,9 +10,9 @@ class CheckInResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/CheckOutResponse.dart b/lib/Models/CheckOutResponse.dart index 822dec5..744b96b 100644 --- a/lib/Models/CheckOutResponse.dart +++ b/lib/Models/CheckOutResponse.dart @@ -10,9 +10,9 @@ class CheckOutResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/ComplaintRegister.dart b/lib/Models/ComplaintRegister.dart index 84be4fc..ee98b11 100644 --- a/lib/Models/ComplaintRegister.dart +++ b/lib/Models/ComplaintRegister.dart @@ -10,9 +10,9 @@ class ComplaintRegidterResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/ComplaintsSelectionResponse.dart b/lib/Models/ComplaintsSelectionResponse.dart index 6ccea4f..356462e 100644 --- a/lib/Models/ComplaintsSelectionResponse.dart +++ b/lib/Models/ComplaintsSelectionResponse.dart @@ -5,30 +5,31 @@ class ComplaintsSelectionResponse { int? error; int? sessionExists; - ComplaintsSelectionResponse( - {this.serviceComptType, - this.serviceComptCat, - this.serviceComptDesc, - this.error, - this.sessionExists}); + ComplaintsSelectionResponse({ + this.serviceComptType, + this.serviceComptCat, + this.serviceComptDesc, + this.error, + this.sessionExists, + }); ComplaintsSelectionResponse.fromJson(Map json) { if (json['service_compt_type'] != null) { serviceComptType = []; json['service_compt_type'].forEach((v) { - serviceComptType!.add(new ServiceComptType.fromJson(v)); + serviceComptType!.add(ServiceComptType.fromJson(v)); }); } if (json['service_compt_cat'] != null) { serviceComptCat = []; json['service_compt_cat'].forEach((v) { - serviceComptCat!.add(new ServiceComptCat.fromJson(v)); + serviceComptCat!.add(ServiceComptCat.fromJson(v)); }); } if (json['service_compt_desc'] != null) { serviceComptDesc = []; json['service_compt_desc'].forEach((v) { - serviceComptDesc!.add(new ServiceComptDesc.fromJson(v)); + serviceComptDesc!.add(ServiceComptDesc.fromJson(v)); }); } error = json['error']; @@ -36,21 +37,21 @@ class ComplaintsSelectionResponse { } Map toJson() { - final Map data = new Map(); - if (this.serviceComptType != null) { + final Map data = {}; + if (serviceComptType != null) { data['service_compt_type'] = - this.serviceComptType!.map((v) => v.toJson()).toList(); + serviceComptType!.map((v) => v.toJson()).toList(); } - if (this.serviceComptCat != null) { + if (serviceComptCat != null) { data['service_compt_cat'] = - this.serviceComptCat!.map((v) => v.toJson()).toList(); + serviceComptCat!.map((v) => v.toJson()).toList(); } - if (this.serviceComptDesc != null) { + if (serviceComptDesc != null) { data['service_compt_desc'] = - this.serviceComptDesc!.map((v) => v.toJson()).toList(); + serviceComptDesc!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -67,12 +68,13 @@ class ServiceComptType { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class ServiceComptCat { String? id; String? name; @@ -85,12 +87,13 @@ class ServiceComptCat { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class ServiceComptDesc { String? id; String? name; @@ -103,9 +106,9 @@ class ServiceComptDesc { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/DashboardResponse.dart b/lib/Models/DashboardResponse.dart index 633cd37..7ea993b 100644 --- a/lib/Models/DashboardResponse.dart +++ b/lib/Models/DashboardResponse.dart @@ -4,11 +4,12 @@ class DashboardResponse { String? notificationsCount; int? sessionExists; - DashboardResponse( - {this.attStatus, - this.appRequestAutostart, - this.notificationsCount, - this.sessionExists}); + DashboardResponse({ + this.attStatus, + this.appRequestAutostart, + this.notificationsCount, + this.sessionExists, + }); DashboardResponse.fromJson(Map json) { attStatus = json['att_status']; @@ -18,11 +19,11 @@ class DashboardResponse { } Map toJson() { - final Map data = new Map(); - data['att_status'] = this.attStatus; - data['app_request_autostart'] = this.appRequestAutostart; - data['notifications_count'] = this.notificationsCount; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['att_status'] = attStatus; + data['app_request_autostart'] = appRequestAutostart; + data['notifications_count'] = notificationsCount; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/DayWiseAttendance.dart b/lib/Models/DayWiseAttendance.dart index e732da2..52ea051 100644 --- a/lib/Models/DayWiseAttendance.dart +++ b/lib/Models/DayWiseAttendance.dart @@ -3,18 +3,19 @@ class AttendanceDaywiseResponse { String? intime; String? outtime; String? inlocation; - dynamic? outlocation; + dynamic outlocation; String? latePenalties; int? sessionExists; - AttendanceDaywiseResponse( - {this.date, - this.intime, - this.outtime, - this.inlocation, - this.outlocation, - this.latePenalties, - this.sessionExists}); + AttendanceDaywiseResponse({ + this.date, + this.intime, + this.outtime, + this.inlocation, + this.outlocation, + this.latePenalties, + this.sessionExists, + }); AttendanceDaywiseResponse.fromJson(Map json) { date = json['date']; @@ -27,14 +28,14 @@ class AttendanceDaywiseResponse { } Map toJson() { - final Map data = new Map(); - data['date'] = this.date; - data['intime'] = this.intime; - data['outtime'] = this.outtime; - data['inlocation'] = this.inlocation; - data['outlocation'] = this.outlocation; - data['late_penalties'] = this.latePenalties; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['date'] = date; + data['intime'] = intime; + data['outtime'] = outtime; + data['inlocation'] = inlocation; + data['outlocation'] = outlocation; + data['late_penalties'] = latePenalties; + data['session_exists'] = sessionExists; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/FollowUpResponse.dart b/lib/Models/FollowUpResponse.dart index 3e0d5a6..9253909 100644 --- a/lib/Models/FollowUpResponse.dart +++ b/lib/Models/FollowUpResponse.dart @@ -9,7 +9,7 @@ class FollowupListResponse { if (json['list'] != null) { list = []; json['list'].forEach((v) { - list!.add(new Followuplist.fromJson(v)); + list!.add(Followuplist.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class FollowupListResponse { } Map toJson() { - final Map data = new Map(); - if (this.list != null) { - data['list'] = this.list!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (list != null) { + data['list'] = list!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -42,20 +42,21 @@ class Followuplist { String? time; String? ename; - Followuplist( - {this.id, - this.empId, - this.compId, - this.inTime, - this.outTime, - this.feedback, - this.type, - this.date, - this.fsrNo, - this.fsrExt, - this.runningHrs, - this.time, - this.ename}); + Followuplist({ + this.id, + this.empId, + this.compId, + this.inTime, + this.outTime, + this.feedback, + this.type, + this.date, + this.fsrNo, + this.fsrExt, + this.runningHrs, + this.time, + this.ename, + }); Followuplist.fromJson(Map json) { id = json['id']; @@ -74,20 +75,20 @@ class Followuplist { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['emp_id'] = this.empId; - data['comp_id'] = this.compId; - data['in_time'] = this.inTime; - data['out_time'] = this.outTime; - data['feedback'] = this.feedback; - data['type'] = this.type; - data['date'] = this.date; - data['fsr_no'] = this.fsrNo; - data['fsr_ext'] = this.fsrExt; - data['running_hrs'] = this.runningHrs; - data['time'] = this.time; - data['ename'] = this.ename; + final Map data = {}; + data['id'] = id; + data['emp_id'] = empId; + data['comp_id'] = compId; + data['in_time'] = inTime; + data['out_time'] = outTime; + data['feedback'] = feedback; + data['type'] = type; + data['date'] = date; + data['fsr_no'] = fsrNo; + data['fsr_ext'] = fsrExt; + data['running_hrs'] = runningHrs; + data['time'] = time; + data['ename'] = ename; return data; } } diff --git a/lib/Models/Inventory_Part_details_response.dart b/lib/Models/Inventory_Part_details_response.dart index eb9a98c..3ae2e9f 100644 --- a/lib/Models/Inventory_Part_details_response.dart +++ b/lib/Models/Inventory_Part_details_response.dart @@ -3,24 +3,26 @@ class Inventory_Part_details_response { PartData? partData; int? sessionExists; - Inventory_Part_details_response( - {this.error, this.partData, this.sessionExists}); + Inventory_Part_details_response({ + this.error, + this.partData, + this.sessionExists, + }); Inventory_Part_details_response.fromJson(Map json) { error = json['error']; - partData = json['part_data'] != null - ? new PartData.fromJson(json['part_data']) - : null; + partData = + json['part_data'] != null ? PartData.fromJson(json['part_data']) : null; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.partData != null) { - data['part_data'] = this.partData!.toJson(); + final Map data = {}; + data['error'] = error; + if (partData != null) { + data['part_data'] = partData!.toJson(); } - data['session_exists'] = this.sessionExists; + data['session_exists'] = sessionExists; return data; } } @@ -55,35 +57,36 @@ class PartData { int? remainingQuantity; String? branchName; - PartData( - {this.id, - this.productCode, - this.project, - this.subGroup, - this.vendor1, - this.vendor2, - this.vendorCode, - this.prodName, - this.brand, - this.imageDirFilePath, - this.imageViewFileName, - this.prodDesc, - this.hsnCode, - this.units, - this.unitsId, - this.worksMsl, - this.refType, - this.refId, - this.price, - this.type, - this.productionProcessId, - this.createdBy, - this.datetime, - this.isExists, - this.updatedDatetime, - this.msl, - this.remainingQuantity, - this.branchName}); + PartData({ + this.id, + this.productCode, + this.project, + this.subGroup, + this.vendor1, + this.vendor2, + this.vendorCode, + this.prodName, + this.brand, + this.imageDirFilePath, + this.imageViewFileName, + this.prodDesc, + this.hsnCode, + this.units, + this.unitsId, + this.worksMsl, + this.refType, + this.refId, + this.price, + this.type, + this.productionProcessId, + this.createdBy, + this.datetime, + this.isExists, + this.updatedDatetime, + this.msl, + this.remainingQuantity, + this.branchName, + }); PartData.fromJson(Map json) { id = json['id']; @@ -117,35 +120,35 @@ class PartData { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['product_code'] = this.productCode; - data['project'] = this.project; - data['sub_group'] = this.subGroup; - data['vendor_1'] = this.vendor1; - data['vendor_2'] = this.vendor2; - data['vendor_code'] = this.vendorCode; - data['prod_name'] = this.prodName; - data['brand'] = this.brand; - data['image_dir_file_path'] = this.imageDirFilePath; - data['image_view_file_name'] = this.imageViewFileName; - data['prod_desc'] = this.prodDesc; - data['hsn_code'] = this.hsnCode; - data['units'] = this.units; - data['units_id'] = this.unitsId; - data['works_msl'] = this.worksMsl; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['price'] = this.price; - data['type'] = this.type; - data['production_process_id'] = this.productionProcessId; - data['created_by'] = this.createdBy; - data['datetime'] = this.datetime; - data['is_exists'] = this.isExists; - data['updated_datetime'] = this.updatedDatetime; - data['msl'] = this.msl; - data['remaining_quantity'] = this.remainingQuantity; - data['branch_name'] = this.branchName; + final Map data = {}; + data['id'] = id; + data['product_code'] = productCode; + data['project'] = project; + data['sub_group'] = subGroup; + data['vendor_1'] = vendor1; + data['vendor_2'] = vendor2; + data['vendor_code'] = vendorCode; + data['prod_name'] = prodName; + data['brand'] = brand; + data['image_dir_file_path'] = imageDirFilePath; + data['image_view_file_name'] = imageViewFileName; + data['prod_desc'] = prodDesc; + data['hsn_code'] = hsnCode; + data['units'] = units; + data['units_id'] = unitsId; + data['works_msl'] = worksMsl; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['price'] = price; + data['type'] = type; + data['production_process_id'] = productionProcessId; + data['created_by'] = createdBy; + data['datetime'] = datetime; + data['is_exists'] = isExists; + data['updated_datetime'] = updatedDatetime; + data['msl'] = msl; + data['remaining_quantity'] = remainingQuantity; + data['branch_name'] = branchName; return data; } } diff --git a/lib/Models/LoginQRResponse.dart b/lib/Models/LoginQRResponse.dart index 9a7dc9f..93533f8 100644 --- a/lib/Models/LoginQRResponse.dart +++ b/lib/Models/LoginQRResponse.dart @@ -12,10 +12,10 @@ class LoginQRResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/LogoutResponse.dart b/lib/Models/LogoutResponse.dart index f5e602f..a2b9022 100644 --- a/lib/Models/LogoutResponse.dart +++ b/lib/Models/LogoutResponse.dart @@ -10,9 +10,9 @@ class LogoutResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/NearbyGeneratorsResponse.dart b/lib/Models/NearbyGeneratorsResponse.dart index 2533196..d5ac120 100644 --- a/lib/Models/NearbyGeneratorsResponse.dart +++ b/lib/Models/NearbyGeneratorsResponse.dart @@ -1,5 +1,3 @@ - - class NearbyGeneratorsResponse { List? list; int? error; @@ -11,7 +9,7 @@ class NearbyGeneratorsResponse { if (json['list'] != null) { list = []; json['list'].forEach((v) { - list!.add(new Nearbygenerators.fromJson(v)); + list!.add(Nearbygenerators.fromJson(v)); }); } error = json['error']; @@ -19,12 +17,12 @@ class NearbyGeneratorsResponse { } Map toJson() { - final Map data = new Map(); - if (this.list != null) { - data['list'] = this.list!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (list != null) { + data['list'] = list!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -36,12 +34,13 @@ class Nearbygenerators { String? accName; String? distance; - Nearbygenerators( - {this.generatorId, - this.loc, - this.productName, - this.accName, - this.distance}); + Nearbygenerators({ + this.generatorId, + this.loc, + this.productName, + this.accName, + this.distance, + }); Nearbygenerators.fromJson(Map json) { generatorId = json['generator_id']; @@ -52,12 +51,12 @@ class Nearbygenerators { } Map toJson() { - final Map data = new Map(); - data['generator_id'] = this.generatorId; - data['loc'] = this.loc; - data['product_name'] = this.productName; - data['acc_name'] = this.accName; - data['distance'] = this.distance; + final Map data = {}; + data['generator_id'] = generatorId; + data['loc'] = loc; + data['product_name'] = productName; + data['acc_name'] = accName; + data['distance'] = distance; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/PaymentCollectionResponse.dart b/lib/Models/PaymentCollectionResponse.dart index 75c29ec..5dee667 100644 --- a/lib/Models/PaymentCollectionResponse.dart +++ b/lib/Models/PaymentCollectionResponse.dart @@ -9,7 +9,7 @@ class PaymentCollectionResponse { if (json['list'] != null) { list = []; json['list'].forEach((v) { - list!.add(new PC_List.fromJson(v)); + list!.add(PC_List.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class PaymentCollectionResponse { } Map toJson() { - final Map data = new Map(); - if (this.list != null) { - data['list'] = this.list!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (list != null) { + data['list'] = list!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -36,14 +36,15 @@ class PC_List { String? paymentProofViewFileName; String? approvalStatus; - PC_List( - {this.accountName, - this.amount, - this.paymentMode, - this.paymentRefNo, - this.paymentProofFilePath, - this.paymentProofViewFileName, - this.approvalStatus}); + PC_List({ + this.accountName, + this.amount, + this.paymentMode, + this.paymentRefNo, + this.paymentProofFilePath, + this.paymentProofViewFileName, + this.approvalStatus, + }); PC_List.fromJson(Map json) { accountName = json['account_name']; @@ -56,14 +57,14 @@ class PC_List { } Map toJson() { - final Map data = new Map(); - data['account_name'] = this.accountName; - data['amount'] = this.amount; - data['payment_mode'] = this.paymentMode; - data['payment_ref_no'] = this.paymentRefNo; - data['payment_proof_file_path'] = this.paymentProofFilePath; - data['payment_proof_view_file_name'] = this.paymentProofViewFileName; - data['approval_status'] = this.approvalStatus; + final Map data = {}; + data['account_name'] = accountName; + data['amount'] = amount; + data['payment_mode'] = paymentMode; + data['payment_ref_no'] = paymentRefNo; + data['payment_proof_file_path'] = paymentProofFilePath; + data['payment_proof_view_file_name'] = paymentProofViewFileName; + data['approval_status'] = approvalStatus; return data; } } diff --git a/lib/Models/PaymentCollectionValidateOTPResponse.dart b/lib/Models/PaymentCollectionValidateOTPResponse.dart index ff0b0b4..5c184f6 100644 --- a/lib/Models/PaymentCollectionValidateOTPResponse.dart +++ b/lib/Models/PaymentCollectionValidateOTPResponse.dart @@ -3,8 +3,11 @@ class PaymentCollectionValidateOTPResponse { String? message; int? sessionExists; - PaymentCollectionValidateOTPResponse( - {this.error, this.message, this.sessionExists}); + PaymentCollectionValidateOTPResponse({ + this.error, + this.message, + this.sessionExists, + }); PaymentCollectionValidateOTPResponse.fromJson(Map json) { error = json['error']; @@ -13,10 +16,10 @@ class PaymentCollectionValidateOTPResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/PaymentCollectionWalletResponse.dart b/lib/Models/PaymentCollectionWalletResponse.dart index 2fa1d0a..ec2a9e8 100644 --- a/lib/Models/PaymentCollectionWalletResponse.dart +++ b/lib/Models/PaymentCollectionWalletResponse.dart @@ -4,17 +4,20 @@ class PaymentCollectionWalletResponse { int? error; int? sessionExists; - PaymentCollectionWalletResponse( - {this.totalDet, this.historyList, this.error, this.sessionExists}); + PaymentCollectionWalletResponse({ + this.totalDet, + this.historyList, + this.error, + this.sessionExists, + }); PaymentCollectionWalletResponse.fromJson(Map json) { - totalDet = json['total_det'] != null - ? new TotalDet.fromJson(json['total_det']) - : null; + totalDet = + json['total_det'] != null ? TotalDet.fromJson(json['total_det']) : null; if (json['history_list'] != null) { historyList = []; json['history_list'].forEach((v) { - historyList!.add(new HistoryList.fromJson(v)); + historyList!.add(HistoryList.fromJson(v)); }); } error = json['error']; @@ -22,15 +25,15 @@ class PaymentCollectionWalletResponse { } Map toJson() { - final Map data = new Map(); - if (this.totalDet != null) { - data['total_det'] = this.totalDet!.toJson(); + final Map data = {}; + if (totalDet != null) { + data['total_det'] = totalDet!.toJson(); } - if (this.historyList != null) { - data['history_list'] = this.historyList!.map((v) => v.toJson()).toList(); + if (historyList != null) { + data['history_list'] = historyList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -49,10 +52,10 @@ class TotalDet { } Map toJson() { - final Map data = new Map(); - data['credit_amount'] = this.creditAmount; - data['debit_amount'] = this.debitAmount; - data['balance_amount'] = this.balanceAmount; + final Map data = {}; + data['credit_amount'] = creditAmount; + data['debit_amount'] = debitAmount; + data['balance_amount'] = balanceAmount; return data; } } @@ -64,12 +67,13 @@ class HistoryList { String? amount; String? datetime; - HistoryList( - {this.id, - this.transactionType, - this.description, - this.amount, - this.datetime}); + HistoryList({ + this.id, + this.transactionType, + this.description, + this.amount, + this.datetime, + }); HistoryList.fromJson(Map json) { id = json['id']; @@ -80,12 +84,12 @@ class HistoryList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['transaction_type'] = this.transactionType; - data['description'] = this.description; - data['amount'] = this.amount; - data['datetime'] = this.datetime; + final Map data = {}; + data['id'] = id; + data['transaction_type'] = transactionType; + data['description'] = description; + data['amount'] = amount; + data['datetime'] = datetime; return data; } } diff --git a/lib/Models/ProfileResponse.dart b/lib/Models/ProfileResponse.dart index be7b856..2769eda 100644 --- a/lib/Models/ProfileResponse.dart +++ b/lib/Models/ProfileResponse.dart @@ -1,4 +1,3 @@ - class ProfileResponse { String? totpSecret; String? empId; @@ -11,18 +10,18 @@ class ProfileResponse { String? profilePic; int? sessionExists; - - ProfileResponse( - {this.totpSecret, - this.empId, - this.empName, - this.emailId, - this.branchName, - this.mobileNo, - this.designation, - this.company, - this.profilePic, - this.sessionExists}); + ProfileResponse({ + this.totpSecret, + this.empId, + this.empName, + this.emailId, + this.branchName, + this.mobileNo, + this.designation, + this.company, + this.profilePic, + this.sessionExists, + }); ProfileResponse.fromJson(Map json) { totpSecret = json['totp_secret']; @@ -38,17 +37,17 @@ class ProfileResponse { } Map toJson() { - final Map data = new Map(); - data['totp_secret'] = this.totpSecret; - data['emp_id'] = this.empId; - data['emp_name'] = this.empName; - data['email_id'] = this.emailId; - data['branch_name'] = this.branchName; - data['mobile_no'] = this.mobileNo; - data['designation'] = this.designation; - data['company'] = this.company; - data['profile_pic'] = this.profilePic; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['totp_secret'] = totpSecret; + data['emp_id'] = empId; + data['emp_name'] = empName; + data['email_id'] = emailId; + data['branch_name'] = branchName; + data['mobile_no'] = mobileNo; + data['designation'] = designation; + data['company'] = company; + data['profile_pic'] = profilePic; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/QRResponse.dart b/lib/Models/QRResponse.dart index 8a040df..3570b8a 100644 --- a/lib/Models/QRResponse.dart +++ b/lib/Models/QRResponse.dart @@ -5,16 +5,16 @@ class QRResponse { QRResponse({this.data, this.type}); QRResponse.fromJson(Map json) { - data = json['data'] != null ? new Data.fromJson(json['data']) : null; + data = json['data'] != null ? Data.fromJson(json['data']) : null; type = json['type']; } Map toJson() { - final Map data = new Map(); + final Map data = {}; if (this.data != null) { data['data'] = this.data!.toJson(); } - data['type'] = this.type; + data['type'] = type; return data; } } @@ -29,8 +29,8 @@ class Data { } Map toJson() { - final Map data = new Map(); - data['token'] = this.token; + final Map data = {}; + data['token'] = token; return data; } } diff --git a/lib/Models/SessionResponse.dart b/lib/Models/SessionResponse.dart index c556b1c..ae4f5f8 100644 --- a/lib/Models/SessionResponse.dart +++ b/lib/Models/SessionResponse.dart @@ -10,9 +10,9 @@ class SessionResponse { } Map toJson() { - final Map data = new Map(); - data['update_password_required'] = this.updatePasswordRequired; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['update_password_required'] = updatePasswordRequired; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/StatusResponse.dart b/lib/Models/StatusResponse.dart index 56e6cd9..b3e068c 100644 --- a/lib/Models/StatusResponse.dart +++ b/lib/Models/StatusResponse.dart @@ -14,21 +14,22 @@ class StatusResponse { String? notificationsCount; int? sessionExists; - StatusResponse( - {this.error, - this.ccsUsername, - this.ccsPassword, - this.ccsPbxDomain, - this.ccsPbxSipProtocol, - this.sessionId, - this.userId, - this.name, - this.emailId, - this.permissions, - this.attStatus, - this.appRequestAutostart, - this.notificationsCount, - this.sessionExists}); + StatusResponse({ + this.error, + this.ccsUsername, + this.ccsPassword, + this.ccsPbxDomain, + this.ccsPbxSipProtocol, + this.sessionId, + this.userId, + this.name, + this.emailId, + this.permissions, + this.attStatus, + this.appRequestAutostart, + this.notificationsCount, + this.sessionExists, + }); StatusResponse.fromJson(Map json) { error = json['error']; @@ -50,21 +51,21 @@ class StatusResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['ccs_username'] = this.ccsUsername; - data['ccs_password'] = this.ccsPassword; - data['ccs_pbx_domain'] = this.ccsPbxDomain; - data['ccs_pbx_sip_protocol'] = this.ccsPbxSipProtocol; - data['session_id'] = this.sessionId; - data['user_id'] = this.userId; - data['name'] = this.name; - data['email_id'] = this.emailId; - data['permissions'] = this.permissions; - data['att_status'] = this.attStatus; - data['app_request_autostart'] = this.appRequestAutostart; - data['notifications_count'] = this.notificationsCount; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['ccs_username'] = ccsUsername; + data['ccs_password'] = ccsPassword; + data['ccs_pbx_domain'] = ccsPbxDomain; + data['ccs_pbx_sip_protocol'] = ccsPbxSipProtocol; + data['session_id'] = sessionId; + data['user_id'] = userId; + data['name'] = name; + data['email_id'] = emailId; + data['permissions'] = permissions; + data['att_status'] = attStatus; + data['app_request_autostart'] = appRequestAutostart; + data['notifications_count'] = notificationsCount; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/SubmitComplaintResponse.dart b/lib/Models/SubmitComplaintResponse.dart index a145a9a..f85f480 100644 --- a/lib/Models/SubmitComplaintResponse.dart +++ b/lib/Models/SubmitComplaintResponse.dart @@ -10,9 +10,9 @@ class SubmitComplaintResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/TagGeneratorResponse.dart b/lib/Models/TagGeneratorResponse.dart index 5b59648..93d2f0e 100644 --- a/lib/Models/TagGeneratorResponse.dart +++ b/lib/Models/TagGeneratorResponse.dart @@ -12,10 +12,10 @@ class TagGeneratorResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/TagLocationResponse.dart b/lib/Models/TagLocationResponse.dart index 97fc9d2..3674db8 100644 --- a/lib/Models/TagLocationResponse.dart +++ b/lib/Models/TagLocationResponse.dart @@ -10,9 +10,9 @@ class TagLocationResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/TechnicianAddPaymentCollectionResponse.dart b/lib/Models/TechnicianAddPaymentCollectionResponse.dart index 707424c..86e2616 100644 --- a/lib/Models/TechnicianAddPaymentCollectionResponse.dart +++ b/lib/Models/TechnicianAddPaymentCollectionResponse.dart @@ -4,8 +4,12 @@ class TechnicianAddPaymentCollectionResponse { String? message; int? sessionExists; - TechnicianAddPaymentCollectionResponse( - {this.paymentCollectionId, this.error, this.message, this.sessionExists}); + TechnicianAddPaymentCollectionResponse({ + this.paymentCollectionId, + this.error, + this.message, + this.sessionExists, + }); TechnicianAddPaymentCollectionResponse.fromJson(Map json) { paymentCollectionId = json['payment_collection_id']; @@ -15,11 +19,11 @@ class TechnicianAddPaymentCollectionResponse { } Map toJson() { - final Map data = new Map(); - data['payment_collection_id'] = this.paymentCollectionId; - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['payment_collection_id'] = paymentCollectionId; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/TechnicianDashboardResponse.dart b/lib/Models/TechnicianDashboardResponse.dart index dc00870..8416dc5 100644 --- a/lib/Models/TechnicianDashboardResponse.dart +++ b/lib/Models/TechnicianDashboardResponse.dart @@ -8,15 +8,16 @@ class TechnicianResponse { int? error; int? sessionExists; - TechnicianResponse( - {this.avgRating, - this.pendingComplaints, - this.todayVisits, - this.thisMonthsVisits, - this.paymentCollectionWalletBalanceAmount, - this.monthlyPaymentCollectionAmount, - this.error, - this.sessionExists}); + TechnicianResponse({ + this.avgRating, + this.pendingComplaints, + this.todayVisits, + this.thisMonthsVisits, + this.paymentCollectionWalletBalanceAmount, + this.monthlyPaymentCollectionAmount, + this.error, + this.sessionExists, + }); TechnicianResponse.fromJson(Map json) { avgRating = json['avg_rating']; @@ -24,24 +25,23 @@ class TechnicianResponse { todayVisits = json['today_visits']; thisMonthsVisits = json['this_months_visits']; paymentCollectionWalletBalanceAmount = - json['payment_collection_wallet_balance_amount']; + json['payment_collection_wallet_balance_amount']; monthlyPaymentCollectionAmount = json['monthly_payment_collection_amount']; error = json['error']; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - data['avg_rating'] = this.avgRating; - data['pending_complaints'] = this.pendingComplaints; - data['today_visits'] = this.todayVisits; - data['this_months_visits'] = this.thisMonthsVisits; + final Map data = {}; + data['avg_rating'] = avgRating; + data['pending_complaints'] = pendingComplaints; + data['today_visits'] = todayVisits; + data['this_months_visits'] = thisMonthsVisits; data['payment_collection_wallet_balance_amount'] = - this.paymentCollectionWalletBalanceAmount; - data['monthly_payment_collection_amount'] = - this.monthlyPaymentCollectionAmount; - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + paymentCollectionWalletBalanceAmount; + data['monthly_payment_collection_amount'] = monthlyPaymentCollectionAmount; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/TechnicianLoadNumbersResponse.dart b/lib/Models/TechnicianLoadNumbersResponse.dart index aebfb46..14d4df7 100644 --- a/lib/Models/TechnicianLoadNumbersResponse.dart +++ b/lib/Models/TechnicianLoadNumbersResponse.dart @@ -4,20 +4,24 @@ class TechnicianLoadNumbersResponse { int? error; int? sessionExists; - TechnicianLoadNumbersResponse( - {this.paymentModeList, this.contacts, this.error, this.sessionExists}); + TechnicianLoadNumbersResponse({ + this.paymentModeList, + this.contacts, + this.error, + this.sessionExists, + }); TechnicianLoadNumbersResponse.fromJson(Map json) { if (json['payment_mode_list'] != null) { paymentModeList = []; json['payment_mode_list'].forEach((v) { - paymentModeList!.add(new PaymentModeList.fromJson(v)); + paymentModeList!.add(PaymentModeList.fromJson(v)); }); } if (json['contacts'] != null) { contacts = []; json['contacts'].forEach((v) { - contacts!.add(new Contacts.fromJson(v)); + contacts!.add(Contacts.fromJson(v)); }); } error = json['error']; @@ -25,16 +29,16 @@ class TechnicianLoadNumbersResponse { } Map toJson() { - final Map data = new Map(); - if (this.paymentModeList != null) { + final Map data = {}; + if (paymentModeList != null) { data['payment_mode_list'] = - this.paymentModeList!.map((v) => v.toJson()).toList(); + paymentModeList!.map((v) => v.toJson()).toList(); } - if (this.contacts != null) { - data['contacts'] = this.contacts!.map((v) => v.toJson()).toList(); + if (contacts != null) { + data['contacts'] = contacts!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -51,9 +55,9 @@ class PaymentModeList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -70,9 +74,9 @@ class Contacts { } Map toJson() { - final Map data = new Map(); - data['mob1'] = this.mob1; - data['name'] = this.name; + final Map data = {}; + data['mob1'] = mob1; + data['name'] = name; return data; } } diff --git a/lib/Models/TechniciansPendingComplaintsResponse.dart b/lib/Models/TechniciansPendingComplaintsResponse.dart index a2e595d..bc4cc4a 100644 --- a/lib/Models/TechniciansPendingComplaintsResponse.dart +++ b/lib/Models/TechniciansPendingComplaintsResponse.dart @@ -13,7 +13,7 @@ class TechnicianPendingComplaintsResponse { if (json['list'] != null) { list = []; json['list'].forEach((v) { - list!.add(new TP_List.fromJson(v)); + list!.add(TP_List.fromJson(v)); }); } error = json['error']; @@ -21,12 +21,12 @@ class TechnicianPendingComplaintsResponse { } Map toJson() { - final Map data = new Map(); - if (this.list != null) { - data['list'] = this.list!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (list != null) { + data['list'] = list!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -44,7 +44,6 @@ class TP_List { String? contactName; String? engineNo; - TP_List({ this.genId, this.address, @@ -74,18 +73,18 @@ class TP_List { } Map toJson() { - final Map data = new Map(); - data['gen_id'] = this.genId; - data['address'] = this.address; - data['loc'] = this.loc; - data['complaint_id'] = this.complaintId; - data['company_name'] = this.companyName; - data['product_name'] = this.productName; - data['complaint_category'] = this.complaintCategory; - data['comp_reg_datetime'] = this.compRegDatetime; - data['mobile_no'] = this.mobileNo; - data['contact_name'] = this.contactName; - data['engine_number'] = this.engineNo; + final Map data = {}; + data['gen_id'] = genId; + data['address'] = address; + data['loc'] = loc; + data['complaint_id'] = complaintId; + data['company_name'] = companyName; + data['product_name'] = productName; + data['complaint_category'] = complaintCategory; + data['comp_reg_datetime'] = compRegDatetime; + data['mobile_no'] = mobileNo; + data['contact_name'] = contactName; + data['engine_number'] = engineNo; return data; } } diff --git a/lib/Models/TodayVisitResponse.dart b/lib/Models/TodayVisitResponse.dart index bfbaf92..6e178a4 100644 --- a/lib/Models/TodayVisitResponse.dart +++ b/lib/Models/TodayVisitResponse.dart @@ -9,7 +9,7 @@ class TodayVisitResponse { if (json['list'] != null) { list = []; json['list'].forEach((v) { - list!.add(new Visitlist.fromJson(v)); + list!.add(Visitlist.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class TodayVisitResponse { } Map toJson() { - final Map data = new Map(); - if (this.list != null) { - data['list'] = this.list!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (list != null) { + data['list'] = list!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -40,18 +40,19 @@ class Visitlist { String? complaintCategory; String? visitDatetime; - Visitlist( - {this.genId, - this.complaintId, - this.address, - this.loc, - this.mobileNo, - this.followupId, - this.companyName, - this.contactName, - this.productName, - this.complaintCategory, - this.visitDatetime}); + Visitlist({ + this.genId, + this.complaintId, + this.address, + this.loc, + this.mobileNo, + this.followupId, + this.companyName, + this.contactName, + this.productName, + this.complaintCategory, + this.visitDatetime, + }); Visitlist.fromJson(Map json) { genId = json['gen_id']; @@ -68,18 +69,18 @@ class Visitlist { } Map toJson() { - final Map data = new Map(); - data['gen_id'] = this.genId; - data['complaint_id'] = this.complaintId; - data['address'] = this.address; - data['loc'] = this.loc; - data['mobile_no'] = this.mobileNo; - data['followup_id'] = this.followupId; - data['company_name'] = this.companyName; - data['contact_name'] = this.contactName; - data['product_name'] = this.productName; - data['complaint_category'] = this.complaintCategory; - data['visit_datetime'] = this.visitDatetime; + final Map data = {}; + data['gen_id'] = genId; + data['complaint_id'] = complaintId; + data['address'] = address; + data['loc'] = loc; + data['mobile_no'] = mobileNo; + data['followup_id'] = followupId; + data['company_name'] = companyName; + data['contact_name'] = contactName; + data['product_name'] = productName; + data['complaint_category'] = complaintCategory; + data['visit_datetime'] = visitDatetime; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/UpdateComplaintResponse.dart b/lib/Models/UpdateComplaintResponse.dart index 001fbc0..d1863a3 100644 --- a/lib/Models/UpdateComplaintResponse.dart +++ b/lib/Models/UpdateComplaintResponse.dart @@ -12,10 +12,10 @@ class UpdateComplaintResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['fsr_file_name'] = this.fsrFileName; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['fsr_file_name'] = fsrFileName; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/UpdatePasswordResponse.dart b/lib/Models/UpdatePasswordResponse.dart index 9bd0c9d..841f421 100644 --- a/lib/Models/UpdatePasswordResponse.dart +++ b/lib/Models/UpdatePasswordResponse.dart @@ -12,10 +12,10 @@ class UpdatePasswordResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/VersionsResponse.dart b/lib/Models/VersionsResponse.dart index 3552b45..3a417a7 100644 --- a/lib/Models/VersionsResponse.dart +++ b/lib/Models/VersionsResponse.dart @@ -8,15 +8,16 @@ class VersionsResponse { String? iosUrl; String? iosReleaseNotes; - VersionsResponse( - {this.latestVersion, - this.latestVersionCode, - this.url, - this.releaseNotes, - this.iosLatestVersion, - this.iosLatestVersionCode, - this.iosUrl, - this.iosReleaseNotes}); + VersionsResponse({ + this.latestVersion, + this.latestVersionCode, + this.url, + this.releaseNotes, + this.iosLatestVersion, + this.iosLatestVersionCode, + this.iosUrl, + this.iosReleaseNotes, + }); VersionsResponse.fromJson(Map json) { latestVersion = json['latestVersion']; @@ -30,15 +31,15 @@ class VersionsResponse { } Map toJson() { - final Map data = new Map(); - data['latestVersion'] = this.latestVersion; - data['latestVersionCode'] = this.latestVersionCode; - data['url'] = this.url; - data['releaseNotes'] = this.releaseNotes; - data['ios_latestVersion'] = this.iosLatestVersion; - data['ios_latestVersionCode'] = this.iosLatestVersionCode; - data['ios_url'] = this.iosUrl; - data['ios_releaseNotes'] = this.iosReleaseNotes; + final Map data = {}; + data['latestVersion'] = latestVersion; + data['latestVersionCode'] = latestVersionCode; + data['url'] = url; + data['releaseNotes'] = releaseNotes; + data['ios_latestVersion'] = iosLatestVersion; + data['ios_latestVersionCode'] = iosLatestVersionCode; + data['ios_url'] = iosUrl; + data['ios_releaseNotes'] = iosReleaseNotes; return data; } } diff --git a/lib/Models/ViewVisitDetailsResponse.dart b/lib/Models/ViewVisitDetailsResponse.dart index 0fd8e46..b8fe840 100644 --- a/lib/Models/ViewVisitDetailsResponse.dart +++ b/lib/Models/ViewVisitDetailsResponse.dart @@ -3,24 +3,28 @@ class ViewVisitDetailsResponse { int? error; int? sessionExists; - ViewVisitDetailsResponse( - {this.complaintDetails, this.error, this.sessionExists}); + ViewVisitDetailsResponse({ + this.complaintDetails, + this.error, + this.sessionExists, + }); ViewVisitDetailsResponse.fromJson(Map json) { - complaintDetails = json['complaint_details'] != null - ? new Complaintdetails.fromJson(json['complaint_details']) - : null; + complaintDetails = + json['complaint_details'] != null + ? Complaintdetails.fromJson(json['complaint_details']) + : null; error = json['error']; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - if (this.complaintDetails != null) { - data['complaint_details'] = this.complaintDetails!.toJson(); + final Map data = {}; + if (complaintDetails != null) { + data['complaint_details'] = complaintDetails!.toJson(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -79,59 +83,60 @@ class Complaintdetails { String? complaintCategory; String? complaintDesc; - Complaintdetails( - {this.id, - this.oemPemName, - this.accId, - this.productId, - this.genHashId, - this.engineModel, - this.alt, - this.engineNo, - this.altNo, - this.invNo, - this.dgSetNo, - this.btryNo, - this.state, - this.district, - this.address, - this.branchId, - this.salesEmpId, - this.dispDate, - this.cmsngDate, - this.dateOfEngineSale, - this.pdiDate, - this.wrntyExpiryDate, - this.nextService, - this.date, - this.extra, - this.status, - this.dataSource, - this.refType, - this.refId, - this.orderId, - this.empId, - this.isSuspense, - this.loc, - this.tempLoc, - this.locStatus, - this.isExist, - this.delRemarks, - this.delEmpId, - this.delDatetime, - this.cname, - this.mob1, - this.mob2, - this.mail, - this.aname, - this.emodel, - this.spname, - this.complaintId, - this.openedDate, - this.dateOfSupply, - this.complaintType, - this.complaintCategory, - this.complaintDesc}); + Complaintdetails({ + this.id, + this.oemPemName, + this.accId, + this.productId, + this.genHashId, + this.engineModel, + this.alt, + this.engineNo, + this.altNo, + this.invNo, + this.dgSetNo, + this.btryNo, + this.state, + this.district, + this.address, + this.branchId, + this.salesEmpId, + this.dispDate, + this.cmsngDate, + this.dateOfEngineSale, + this.pdiDate, + this.wrntyExpiryDate, + this.nextService, + this.date, + this.extra, + this.status, + this.dataSource, + this.refType, + this.refId, + this.orderId, + this.empId, + this.isSuspense, + this.loc, + this.tempLoc, + this.locStatus, + this.isExist, + this.delRemarks, + this.delEmpId, + this.delDatetime, + this.cname, + this.mob1, + this.mob2, + this.mail, + this.aname, + this.emodel, + this.spname, + this.complaintId, + this.openedDate, + this.dateOfSupply, + this.complaintType, + this.complaintCategory, + this.complaintDesc, + }); Complaintdetails.fromJson(Map json) { id = json['id']; @@ -189,59 +194,59 @@ class Complaintdetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['oem_pem_name'] = this.oemPemName; - data['acc_id'] = this.accId; - data['product_id'] = this.productId; - data['gen_hash_id'] = this.genHashId; - data['engine_model'] = this.engineModel; - data['alt'] = this.alt; - data['engine_no'] = this.engineNo; - data['alt_no'] = this.altNo; - data['inv_no'] = this.invNo; - data['dg_set_no'] = this.dgSetNo; - data['btry_no'] = this.btryNo; - data['state'] = this.state; - data['district'] = this.district; - data['address'] = this.address; - data['branch_id'] = this.branchId; - data['sales_emp_id'] = this.salesEmpId; - data['disp_date'] = this.dispDate; - data['cmsng_date'] = this.cmsngDate; - data['date_of_engine_sale'] = this.dateOfEngineSale; - data['pdi_date'] = this.pdiDate; - data['wrnty_expiry_date'] = this.wrntyExpiryDate; - data['next_service'] = this.nextService; - data['date'] = this.date; - data['extra'] = this.extra; - data['status'] = this.status; - data['data_source'] = this.dataSource; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['order_id'] = this.orderId; - data['emp_id'] = this.empId; - data['is_suspense'] = this.isSuspense; - data['loc'] = this.loc; - data['temp_loc'] = this.tempLoc; - data['loc_status'] = this.locStatus; - data['is_exist'] = this.isExist; - data['del_remarks'] = this.delRemarks; - data['del_emp_id'] = this.delEmpId; - data['del_datetime'] = this.delDatetime; - data['cname'] = this.cname; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['mail'] = this.mail; - data['aname'] = this.aname; - data['emodel'] = this.emodel; - data['spname'] = this.spname; - data['complaint_id'] = this.complaintId; - data['opened_date'] = this.openedDate; - data['date_of_supply'] = this.dateOfSupply; - data['complaint_type'] = this.complaintType; - data['complaint_category'] = this.complaintCategory; - data['complaint_desc'] = this.complaintDesc; + final Map data = {}; + data['id'] = id; + data['oem_pem_name'] = oemPemName; + data['acc_id'] = accId; + data['product_id'] = productId; + data['gen_hash_id'] = genHashId; + data['engine_model'] = engineModel; + data['alt'] = alt; + data['engine_no'] = engineNo; + data['alt_no'] = altNo; + data['inv_no'] = invNo; + data['dg_set_no'] = dgSetNo; + data['btry_no'] = btryNo; + data['state'] = state; + data['district'] = district; + data['address'] = address; + data['branch_id'] = branchId; + data['sales_emp_id'] = salesEmpId; + data['disp_date'] = dispDate; + data['cmsng_date'] = cmsngDate; + data['date_of_engine_sale'] = dateOfEngineSale; + data['pdi_date'] = pdiDate; + data['wrnty_expiry_date'] = wrntyExpiryDate; + data['next_service'] = nextService; + data['date'] = date; + data['extra'] = extra; + data['status'] = status; + data['data_source'] = dataSource; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['order_id'] = orderId; + data['emp_id'] = empId; + data['is_suspense'] = isSuspense; + data['loc'] = loc; + data['temp_loc'] = tempLoc; + data['loc_status'] = locStatus; + data['is_exist'] = isExist; + data['del_remarks'] = delRemarks; + data['del_emp_id'] = delEmpId; + data['del_datetime'] = delDatetime; + data['cname'] = cname; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['mail'] = mail; + data['aname'] = aname; + data['emodel'] = emodel; + data['spname'] = spname; + data['complaint_id'] = complaintId; + data['opened_date'] = openedDate; + data['date_of_supply'] = dateOfSupply; + data['complaint_type'] = complaintType; + data['complaint_category'] = complaintCategory; + data['complaint_desc'] = complaintDesc; return data; } } diff --git a/lib/Models/ViewVisitDetailsResponseNew.dart b/lib/Models/ViewVisitDetailsResponseNew.dart index 43385ca..c541f9e 100644 --- a/lib/Models/ViewVisitDetailsResponseNew.dart +++ b/lib/Models/ViewVisitDetailsResponseNew.dart @@ -6,47 +6,52 @@ class ViewVisitDetailsResponseNew { int? error; int? sessionExists; - ViewVisitDetailsResponseNew( - {this.complaintDetails, - this.customerDetails, - this.generatorDetails, - this.complaintDetailsNew, - this.error, - this.sessionExists}); + ViewVisitDetailsResponseNew({ + this.complaintDetails, + this.customerDetails, + this.generatorDetails, + this.complaintDetailsNew, + this.error, + this.sessionExists, + }); ViewVisitDetailsResponseNew.fromJson(Map json) { - complaintDetails = json['complaint_details'] != null - ? new ComplaintDetails.fromJson(json['complaint_details']) - : null; - customerDetails = json['customer_details'] != null - ? new CustomerDetails.fromJson(json['customer_details']) - : null; - generatorDetails = json['generator_details'] != null - ? new GeneratorDetails.fromJson(json['generator_details']) - : null; - complaintDetailsNew = json['complaint_details_new'] != null - ? new ComplaintDetailsNew.fromJson(json['complaint_details_new']) - : null; + complaintDetails = + json['complaint_details'] != null + ? ComplaintDetails.fromJson(json['complaint_details']) + : null; + customerDetails = + json['customer_details'] != null + ? CustomerDetails.fromJson(json['customer_details']) + : null; + generatorDetails = + json['generator_details'] != null + ? GeneratorDetails.fromJson(json['generator_details']) + : null; + complaintDetailsNew = + json['complaint_details_new'] != null + ? ComplaintDetailsNew.fromJson(json['complaint_details_new']) + : null; error = json['error']; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - if (this.complaintDetails != null) { - data['complaint_details'] = this.complaintDetails!.toJson(); + final Map data = {}; + if (complaintDetails != null) { + data['complaint_details'] = complaintDetails!.toJson(); } - if (this.customerDetails != null) { - data['customer_details'] = this.customerDetails!.toJson(); + if (customerDetails != null) { + data['customer_details'] = customerDetails!.toJson(); } - if (this.generatorDetails != null) { - data['generator_details'] = this.generatorDetails!.toJson(); + if (generatorDetails != null) { + data['generator_details'] = generatorDetails!.toJson(); } - if (this.complaintDetailsNew != null) { - data['complaint_details_new'] = this.complaintDetailsNew!.toJson(); + if (complaintDetailsNew != null) { + data['complaint_details_new'] = complaintDetailsNew!.toJson(); } - data['error'] = this.error; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['session_exists'] = sessionExists; return data; } } @@ -105,59 +110,60 @@ class ComplaintDetails { String? complaintCategory; String? complaintDesc; - ComplaintDetails( - {this.id, - this.oemPemName, - this.accId, - this.productId, - this.genHashId, - this.engineModel, - this.alt, - this.engineNo, - this.altNo, - this.invNo, - this.dgSetNo, - this.btryNo, - this.state, - this.district, - this.address, - this.branchId, - this.salesEmpId, - this.dispDate, - this.cmsngDate, - this.dateOfEngineSale, - this.pdiDate, - this.wrntyExpiryDate, - this.nextService, - this.date, - this.extra, - this.status, - this.dataSource, - this.refType, - this.refId, - this.orderId, - this.empId, - this.isSuspense, - this.loc, - this.tempLoc, - this.locStatus, - this.isExist, - this.delRemarks, - this.delEmpId, - this.delDatetime, - this.cname, - this.mob1, - this.mob2, - this.mail, - this.aname, - this.emodel, - this.spname, - this.complaintId, - this.openedDate, - this.dateOfSupply, - this.complaintType, - this.complaintCategory, - this.complaintDesc}); + ComplaintDetails({ + this.id, + this.oemPemName, + this.accId, + this.productId, + this.genHashId, + this.engineModel, + this.alt, + this.engineNo, + this.altNo, + this.invNo, + this.dgSetNo, + this.btryNo, + this.state, + this.district, + this.address, + this.branchId, + this.salesEmpId, + this.dispDate, + this.cmsngDate, + this.dateOfEngineSale, + this.pdiDate, + this.wrntyExpiryDate, + this.nextService, + this.date, + this.extra, + this.status, + this.dataSource, + this.refType, + this.refId, + this.orderId, + this.empId, + this.isSuspense, + this.loc, + this.tempLoc, + this.locStatus, + this.isExist, + this.delRemarks, + this.delEmpId, + this.delDatetime, + this.cname, + this.mob1, + this.mob2, + this.mail, + this.aname, + this.emodel, + this.spname, + this.complaintId, + this.openedDate, + this.dateOfSupply, + this.complaintType, + this.complaintCategory, + this.complaintDesc, + }); ComplaintDetails.fromJson(Map json) { id = json['id']; @@ -215,59 +221,59 @@ class ComplaintDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['oem_pem_name'] = this.oemPemName; - data['acc_id'] = this.accId; - data['product_id'] = this.productId; - data['gen_hash_id'] = this.genHashId; - data['engine_model'] = this.engineModel; - data['alt'] = this.alt; - data['engine_no'] = this.engineNo; - data['alt_no'] = this.altNo; - data['inv_no'] = this.invNo; - data['dg_set_no'] = this.dgSetNo; - data['btry_no'] = this.btryNo; - data['state'] = this.state; - data['district'] = this.district; - data['address'] = this.address; - data['branch_id'] = this.branchId; - data['sales_emp_id'] = this.salesEmpId; - data['disp_date'] = this.dispDate; - data['cmsng_date'] = this.cmsngDate; - data['date_of_engine_sale'] = this.dateOfEngineSale; - data['pdi_date'] = this.pdiDate; - data['wrnty_expiry_date'] = this.wrntyExpiryDate; - data['next_service'] = this.nextService; - data['date'] = this.date; - data['extra'] = this.extra; - data['status'] = this.status; - data['data_source'] = this.dataSource; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['order_id'] = this.orderId; - data['emp_id'] = this.empId; - data['is_suspense'] = this.isSuspense; - data['loc'] = this.loc; - data['temp_loc'] = this.tempLoc; - data['loc_status'] = this.locStatus; - data['is_exist'] = this.isExist; - data['del_remarks'] = this.delRemarks; - data['del_emp_id'] = this.delEmpId; - data['del_datetime'] = this.delDatetime; - data['cname'] = this.cname; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['mail'] = this.mail; - data['aname'] = this.aname; - data['emodel'] = this.emodel; - data['spname'] = this.spname; - data['complaint_id'] = this.complaintId; - data['opened_date'] = this.openedDate; - data['date_of_supply'] = this.dateOfSupply; - data['complaint_type'] = this.complaintType; - data['complaint_category'] = this.complaintCategory; - data['complaint_desc'] = this.complaintDesc; + final Map data = {}; + data['id'] = id; + data['oem_pem_name'] = oemPemName; + data['acc_id'] = accId; + data['product_id'] = productId; + data['gen_hash_id'] = genHashId; + data['engine_model'] = engineModel; + data['alt'] = alt; + data['engine_no'] = engineNo; + data['alt_no'] = altNo; + data['inv_no'] = invNo; + data['dg_set_no'] = dgSetNo; + data['btry_no'] = btryNo; + data['state'] = state; + data['district'] = district; + data['address'] = address; + data['branch_id'] = branchId; + data['sales_emp_id'] = salesEmpId; + data['disp_date'] = dispDate; + data['cmsng_date'] = cmsngDate; + data['date_of_engine_sale'] = dateOfEngineSale; + data['pdi_date'] = pdiDate; + data['wrnty_expiry_date'] = wrntyExpiryDate; + data['next_service'] = nextService; + data['date'] = date; + data['extra'] = extra; + data['status'] = status; + data['data_source'] = dataSource; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['order_id'] = orderId; + data['emp_id'] = empId; + data['is_suspense'] = isSuspense; + data['loc'] = loc; + data['temp_loc'] = tempLoc; + data['loc_status'] = locStatus; + data['is_exist'] = isExist; + data['del_remarks'] = delRemarks; + data['del_emp_id'] = delEmpId; + data['del_datetime'] = delDatetime; + data['cname'] = cname; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['mail'] = mail; + data['aname'] = aname; + data['emodel'] = emodel; + data['spname'] = spname; + data['complaint_id'] = complaintId; + data['opened_date'] = openedDate; + data['date_of_supply'] = dateOfSupply; + data['complaint_type'] = complaintType; + data['complaint_category'] = complaintCategory; + data['complaint_desc'] = complaintDesc; return data; } } @@ -290,12 +296,12 @@ class CustomerDetails { } Map toJson() { - final Map data = new Map(); - data['cname'] = this.cname; - data['aname'] = this.aname; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['mail'] = this.mail; + final Map data = {}; + data['cname'] = cname; + data['aname'] = aname; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['mail'] = mail; return data; } } @@ -343,48 +349,49 @@ class GeneratorDetails { String? emodel; String? spname; - GeneratorDetails( - {this.id, - this.oemPemName, - this.accId, - this.productId, - this.genHashId, - this.engineModel, - this.alt, - this.engineNo, - this.altNo, - this.invNo, - this.dgSetNo, - this.btryNo, - this.state, - this.district, - this.address, - this.branchId, - this.salesEmpId, - this.dispDate, - this.cmsngDate, - this.dateOfEngineSale, - this.pdiDate, - this.wrntyExpiryDate, - this.nextService, - this.date, - this.extra, - this.status, - this.dataSource, - this.refType, - this.refId, - this.orderId, - this.empId, - this.isSuspense, - this.loc, - this.tempLoc, - this.locStatus, - this.isExist, - this.delRemarks, - this.delEmpId, - this.delDatetime, - this.emodel, - this.spname}); + GeneratorDetails({ + this.id, + this.oemPemName, + this.accId, + this.productId, + this.genHashId, + this.engineModel, + this.alt, + this.engineNo, + this.altNo, + this.invNo, + this.dgSetNo, + this.btryNo, + this.state, + this.district, + this.address, + this.branchId, + this.salesEmpId, + this.dispDate, + this.cmsngDate, + this.dateOfEngineSale, + this.pdiDate, + this.wrntyExpiryDate, + this.nextService, + this.date, + this.extra, + this.status, + this.dataSource, + this.refType, + this.refId, + this.orderId, + this.empId, + this.isSuspense, + this.loc, + this.tempLoc, + this.locStatus, + this.isExist, + this.delRemarks, + this.delEmpId, + this.delDatetime, + this.emodel, + this.spname, + }); GeneratorDetails.fromJson(Map json) { id = json['id']; @@ -431,48 +438,48 @@ class GeneratorDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['oem_pem_name'] = this.oemPemName; - data['acc_id'] = this.accId; - data['product_id'] = this.productId; - data['gen_hash_id'] = this.genHashId; - data['engine_model'] = this.engineModel; - data['alt'] = this.alt; - data['engine_no'] = this.engineNo; - data['alt_no'] = this.altNo; - data['inv_no'] = this.invNo; - data['dg_set_no'] = this.dgSetNo; - data['btry_no'] = this.btryNo; - data['state'] = this.state; - data['district'] = this.district; - data['address'] = this.address; - data['branch_id'] = this.branchId; - data['sales_emp_id'] = this.salesEmpId; - data['disp_date'] = this.dispDate; - data['cmsng_date'] = this.cmsngDate; - data['date_of_engine_sale'] = this.dateOfEngineSale; - data['pdi_date'] = this.pdiDate; - data['wrnty_expiry_date'] = this.wrntyExpiryDate; - data['next_service'] = this.nextService; - data['date'] = this.date; - data['extra'] = this.extra; - data['status'] = this.status; - data['data_source'] = this.dataSource; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['order_id'] = this.orderId; - data['emp_id'] = this.empId; - data['is_suspense'] = this.isSuspense; - data['loc'] = this.loc; - data['temp_loc'] = this.tempLoc; - data['loc_status'] = this.locStatus; - data['is_exist'] = this.isExist; - data['del_remarks'] = this.delRemarks; - data['del_emp_id'] = this.delEmpId; - data['del_datetime'] = this.delDatetime; - data['emodel'] = this.emodel; - data['spname'] = this.spname; + final Map data = {}; + data['id'] = id; + data['oem_pem_name'] = oemPemName; + data['acc_id'] = accId; + data['product_id'] = productId; + data['gen_hash_id'] = genHashId; + data['engine_model'] = engineModel; + data['alt'] = alt; + data['engine_no'] = engineNo; + data['alt_no'] = altNo; + data['inv_no'] = invNo; + data['dg_set_no'] = dgSetNo; + data['btry_no'] = btryNo; + data['state'] = state; + data['district'] = district; + data['address'] = address; + data['branch_id'] = branchId; + data['sales_emp_id'] = salesEmpId; + data['disp_date'] = dispDate; + data['cmsng_date'] = cmsngDate; + data['date_of_engine_sale'] = dateOfEngineSale; + data['pdi_date'] = pdiDate; + data['wrnty_expiry_date'] = wrntyExpiryDate; + data['next_service'] = nextService; + data['date'] = date; + data['extra'] = extra; + data['status'] = status; + data['data_source'] = dataSource; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['order_id'] = orderId; + data['emp_id'] = empId; + data['is_suspense'] = isSuspense; + data['loc'] = loc; + data['temp_loc'] = tempLoc; + data['loc_status'] = locStatus; + data['is_exist'] = isExist; + data['del_remarks'] = delRemarks; + data['del_emp_id'] = delEmpId; + data['del_datetime'] = delDatetime; + data['emodel'] = emodel; + data['spname'] = spname; return data; } } @@ -492,20 +499,21 @@ class ComplaintDetailsNew { String? complaintCategory; String? complaintDesc; - ComplaintDetailsNew( - {this.cname, - this.mob1, - this.mob2, - this.mail, - this.aname, - this.emodel, - this.spname, - this.complaintId, - this.openedDate, - this.dateOfSupply, - this.complaintType, - this.complaintCategory, - this.complaintDesc}); + ComplaintDetailsNew({ + this.cname, + this.mob1, + this.mob2, + this.mail, + this.aname, + this.emodel, + this.spname, + this.complaintId, + this.openedDate, + this.dateOfSupply, + this.complaintType, + this.complaintCategory, + this.complaintDesc, + }); ComplaintDetailsNew.fromJson(Map json) { cname = json['cname']; @@ -524,20 +532,20 @@ class ComplaintDetailsNew { } Map toJson() { - final Map data = new Map(); - data['cname'] = this.cname; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['mail'] = this.mail; - data['aname'] = this.aname; - data['emodel'] = this.emodel; - data['spname'] = this.spname; - data['complaint_id'] = this.complaintId; - data['opened_date'] = this.openedDate; - data['date_of_supply'] = this.dateOfSupply; - data['complaint_type'] = this.complaintType; - data['complaint_category'] = this.complaintCategory; - data['complaint_desc'] = this.complaintDesc; + final Map data = {}; + data['cname'] = cname; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['mail'] = mail; + data['aname'] = aname; + data['emodel'] = emodel; + data['spname'] = spname; + data['complaint_id'] = complaintId; + data['opened_date'] = openedDate; + data['date_of_supply'] = dateOfSupply; + data['complaint_type'] = complaintType; + data['complaint_category'] = complaintCategory; + data['complaint_desc'] = complaintDesc; return data; } } diff --git a/lib/Models/commonModels/DistrictsResponse.dart b/lib/Models/commonModels/DistrictsResponse.dart index 9070e81..e92803e 100644 --- a/lib/Models/commonModels/DistrictsResponse.dart +++ b/lib/Models/commonModels/DistrictsResponse.dart @@ -6,11 +6,10 @@ class DistrictsResponse { DistrictsResponse({this.districts, this.error, this.message}); DistrictsResponse.fromJson(Map json) { - if (json['districts'] != null) { districts = []; json['districts'].forEach((v) { - districts!.add(new Districts.fromJson(v)); + districts!.add(Districts.fromJson(v)); }); } @@ -19,14 +18,14 @@ class DistrictsResponse { } Map toJson() { - final Map data = new Map(); + final Map data = {}; - if (this.districts != null) { - data['districts'] = this.districts!.map((v) => v.toJson()).toList(); + if (districts != null) { + data['districts'] = districts!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -61,14 +60,14 @@ class Districts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['state'] = this.state; - data['district'] = this.district; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['state'] = state; + data['district'] = district; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/commonModels/SubLocationsResponse.dart b/lib/Models/commonModels/SubLocationsResponse.dart index 4866367..54f87ba 100644 --- a/lib/Models/commonModels/SubLocationsResponse.dart +++ b/lib/Models/commonModels/SubLocationsResponse.dart @@ -3,17 +3,13 @@ class SubLocationsResponse { String? error; String? message; - SubLocationsResponse({ - this.subLocations, - this.error, - this.message, - }); + SubLocationsResponse({this.subLocations, this.error, this.message}); SubLocationsResponse.fromJson(Map json) { if (json['sub_locations'] != null) { subLocations = []; json['sub_locations'].forEach((v) { - subLocations!.add(new SubLocations.fromJson(v)); + subLocations!.add(SubLocations.fromJson(v)); }); } @@ -22,15 +18,14 @@ class SubLocationsResponse { } Map toJson() { - final Map data = new Map(); + final Map data = {}; - if (this.subLocations != null) { - data['sub_locations'] = - this.subLocations!.map((v) => v.toJson()).toList(); + if (subLocations != null) { + data['sub_locations'] = subLocations!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -65,14 +60,14 @@ class SubLocations { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['district_id'] = this.districtId; - data['sub_locality'] = this.subLocality; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['district_id'] = districtId; + data['sub_locality'] = subLocality; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/commonModels/commonAccessiblePagesResponse.dart b/lib/Models/commonModels/commonAccessiblePagesResponse.dart index 9ad74b7..acc2321 100644 --- a/lib/Models/commonModels/commonAccessiblePagesResponse.dart +++ b/lib/Models/commonModels/commonAccessiblePagesResponse.dart @@ -3,28 +3,31 @@ class commonAccessiblePagesResponse { List? pagesAccessible; String? message; - commonAccessiblePagesResponse( - {this.error, this.pagesAccessible, this.message}); + commonAccessiblePagesResponse({ + this.error, + this.pagesAccessible, + this.message, + }); commonAccessiblePagesResponse.fromJson(Map json) { error = json['error']; if (json['pages_accessible'] != null) { pagesAccessible = []; json['pages_accessible'].forEach((v) { - pagesAccessible!.add(new PagesAccessible.fromJson(v)); + pagesAccessible!.add(PagesAccessible.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.pagesAccessible != null) { + final Map data = {}; + data['error'] = error; + if (pagesAccessible != null) { data['pages_accessible'] = - this.pagesAccessible!.map((v) => v.toJson()).toList(); + pagesAccessible!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -43,10 +46,10 @@ class PagesAccessible { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['page_name'] = this.pageName; - data['mode'] = this.mode; + final Map data = {}; + data['id'] = id; + data['page_name'] = pageName; + data['mode'] = mode; return data; } } diff --git a/lib/Models/commonModels/commonAccountLedgerFilterResponse.dart b/lib/Models/commonModels/commonAccountLedgerFilterResponse.dart index f33c60b..417f8cf 100644 --- a/lib/Models/commonModels/commonAccountLedgerFilterResponse.dart +++ b/lib/Models/commonModels/commonAccountLedgerFilterResponse.dart @@ -9,7 +9,7 @@ class commonAccountLedgerFilterResponse { if (json['accounts'] != null) { accounts = []; json['accounts'].forEach((v) { - accounts!.add(new Accounts.fromJson(v)); + accounts!.add(Accounts.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class commonAccountLedgerFilterResponse { } Map toJson() { - final Map data = new Map(); - if (this.accounts != null) { - data['accounts'] = this.accounts!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accounts != null) { + data['accounts'] = accounts!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -39,9 +39,9 @@ class Accounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/commonModels/commonAccountLedgerResponse.dart b/lib/Models/commonModels/commonAccountLedgerResponse.dart index c794108..c4a5672 100644 --- a/lib/Models/commonModels/commonAccountLedgerResponse.dart +++ b/lib/Models/commonModels/commonAccountLedgerResponse.dart @@ -5,43 +5,46 @@ class commonAccountLedgerResponse { String? error; String? message; - commonAccountLedgerResponse( - {this.ledgerList, - this.balanceDetails, - this.accountDetails, - this.error, - this.message}); + commonAccountLedgerResponse({ + this.ledgerList, + this.balanceDetails, + this.accountDetails, + this.error, + this.message, + }); commonAccountLedgerResponse.fromJson(Map json) { if (json['ledger_list'] != null) { ledgerList = []; json['ledger_list'].forEach((v) { - ledgerList!.add(new LedgerList.fromJson(v)); + ledgerList!.add(LedgerList.fromJson(v)); }); } - balanceDetails = json['balance_details'] != null - ? new BalanceDetails.fromJson(json['balance_details']) - : null; - accountDetails = json['account_details'] != null - ? new AccountDetails.fromJson(json['account_details']) - : null; + balanceDetails = + json['balance_details'] != null + ? BalanceDetails.fromJson(json['balance_details']) + : null; + accountDetails = + json['account_details'] != null + ? AccountDetails.fromJson(json['account_details']) + : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.ledgerList != null) { - data['ledger_list'] = this.ledgerList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (ledgerList != null) { + data['ledger_list'] = ledgerList!.map((v) => v.toJson()).toList(); } - if (this.balanceDetails != null) { - data['balance_details'] = this.balanceDetails!.toJson(); + if (balanceDetails != null) { + data['balance_details'] = balanceDetails!.toJson(); } - if (this.accountDetails != null) { - data['account_details'] = this.accountDetails!.toJson(); + if (accountDetails != null) { + data['account_details'] = accountDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -58,17 +61,18 @@ class LedgerList { String? date; String? createdDatetime; - LedgerList( - {this.id, - this.accountId, - this.refType, - this.refId, - this.type, - this.description, - this.creditAmount, - this.debitAmount, - this.date, - this.createdDatetime}); + LedgerList({ + this.id, + this.accountId, + this.refType, + this.refId, + this.type, + this.description, + this.creditAmount, + this.debitAmount, + this.date, + this.createdDatetime, + }); LedgerList.fromJson(Map json) { id = json['id']; @@ -84,17 +88,17 @@ class LedgerList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['account_id'] = this.accountId; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['type'] = this.type; - data['description'] = this.description; - data['credit_amount'] = this.creditAmount; - data['debit_amount'] = this.debitAmount; - data['date'] = this.date; - data['created_datetime'] = this.createdDatetime; + final Map data = Map(); + data['id'] = id; + data['account_id'] = accountId; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['type'] = type; + data['description'] = description; + data['credit_amount'] = creditAmount; + data['debit_amount'] = debitAmount; + data['date'] = date; + data['created_datetime'] = createdDatetime; return data; } } @@ -113,10 +117,10 @@ class BalanceDetails { } Map toJson() { - final Map data = new Map(); - data['total_debit'] = this.totalDebit; - data['total_credit'] = this.totalCredit; - data['balance'] = this.balance; + final Map data = {}; + data['total_debit'] = totalDebit; + data['total_credit'] = totalCredit; + data['balance'] = balance; return data; } } @@ -138,22 +142,23 @@ class AccountDetails { String? district; String? subLocality; - AccountDetails( - {this.id, - this.type, - this.refId, - this.name, - this.address, - this.createdDatetime, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.bankUpiId, - this.state, - this.district, - this.subLocality}); + AccountDetails({ + this.id, + this.type, + this.refId, + this.name, + this.address, + this.createdDatetime, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.bankUpiId, + this.state, + this.district, + this.subLocality, + }); AccountDetails.fromJson(Map json) { id = json['id']; @@ -174,22 +179,22 @@ class AccountDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['type'] = this.type; - data['ref_id'] = this.refId; - data['name'] = this.name; - data['address'] = this.address; - data['created_datetime'] = this.createdDatetime; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; - data['state'] = this.state; - data['district'] = this.district; - data['sub_locality'] = this.subLocality; + final Map data = Map(); + data['id'] = id; + data['type'] = type; + data['ref_id'] = refId; + data['name'] = name; + data['address'] = address; + data['created_datetime'] = createdDatetime; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; + data['state'] = state; + data['district'] = district; + data['sub_locality'] = subLocality; return data; } } diff --git a/lib/Models/commonModels/commonAccountdetailsResponse.dart b/lib/Models/commonModels/commonAccountdetailsResponse.dart index 45cd46a..25d7022 100644 --- a/lib/Models/commonModels/commonAccountdetailsResponse.dart +++ b/lib/Models/commonModels/commonAccountdetailsResponse.dart @@ -5,24 +5,27 @@ class commonAccountdetailsResponse { String? error; String? message; - commonAccountdetailsResponse( - {this.accountDetails, - this.balanceDetails, - this.ledgerList, - this.error, - this.message}); + commonAccountdetailsResponse({ + this.accountDetails, + this.balanceDetails, + this.ledgerList, + this.error, + this.message, + }); commonAccountdetailsResponse.fromJson(Map json) { - accountDetails = json['account_details'] != null - ? new AccountDetails.fromJson(json['account_details']) - : null; - balanceDetails = json['balance_details'] != null - ? new BalanceDetails.fromJson(json['balance_details']) - : null; + accountDetails = + json['account_details'] != null + ? AccountDetails.fromJson(json['account_details']) + : null; + balanceDetails = + json['balance_details'] != null + ? BalanceDetails.fromJson(json['balance_details']) + : null; if (json['ledger_list'] != null) { ledgerList = []; json['ledger_list'].forEach((v) { - ledgerList!.add(new LedgerList.fromJson(v)); + ledgerList!.add(LedgerList.fromJson(v)); }); } error = json['error']; @@ -30,18 +33,18 @@ class commonAccountdetailsResponse { } Map toJson() { - final Map data = new Map(); - if (this.accountDetails != null) { - data['account_details'] = this.accountDetails!.toJson(); + final Map data = {}; + if (accountDetails != null) { + data['account_details'] = accountDetails!.toJson(); } - if (this.balanceDetails != null) { - data['balance_details'] = this.balanceDetails!.toJson(); + if (balanceDetails != null) { + data['balance_details'] = balanceDetails!.toJson(); } - if (this.ledgerList != null) { - data['ledger_list'] = this.ledgerList!.map((v) => v.toJson()).toList(); + if (ledgerList != null) { + data['ledger_list'] = ledgerList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -63,22 +66,23 @@ class AccountDetails { String? district; String? subLocality; - AccountDetails( - {this.id, - this.type, - this.refId, - this.name, - this.address, - this.createdDatetime, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.bankUpiId, - this.state, - this.district, - this.subLocality}); + AccountDetails({ + this.id, + this.type, + this.refId, + this.name, + this.address, + this.createdDatetime, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.bankUpiId, + this.state, + this.district, + this.subLocality, + }); AccountDetails.fromJson(Map json) { id = json['id']; @@ -99,22 +103,22 @@ class AccountDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['type'] = this.type; - data['ref_id'] = this.refId; - data['name'] = this.name; - data['address'] = this.address; - data['created_datetime'] = this.createdDatetime; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; - data['state'] = this.state; - data['district'] = this.district; - data['sub_locality'] = this.subLocality; + final Map data = Map(); + data['id'] = id; + data['type'] = type; + data['ref_id'] = refId; + data['name'] = name; + data['address'] = address; + data['created_datetime'] = createdDatetime; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; + data['state'] = state; + data['district'] = district; + data['sub_locality'] = subLocality; return data; } } @@ -133,10 +137,10 @@ class BalanceDetails { } Map toJson() { - final Map data = new Map(); - data['total_debit'] = this.totalDebit; - data['total_credit'] = this.totalCredit; - data['balance'] = this.balance; + final Map data = Map(); + data['total_debit'] = totalDebit; + data['total_credit'] = totalCredit; + data['balance'] = balance; return data; } } @@ -153,17 +157,18 @@ class LedgerList { String? date; String? createdDatetime; - LedgerList( - {this.id, - this.accountId, - this.refType, - this.refId, - this.type, - this.description, - this.creditAmount, - this.debitAmount, - this.date, - this.createdDatetime}); + LedgerList({ + this.id, + this.accountId, + this.refType, + this.refId, + this.type, + this.description, + this.creditAmount, + this.debitAmount, + this.date, + this.createdDatetime, + }); LedgerList.fromJson(Map json) { id = json['id']; @@ -179,17 +184,17 @@ class LedgerList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['account_id'] = this.accountId; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['type'] = this.type; - data['description'] = this.description; - data['credit_amount'] = this.creditAmount; - data['debit_amount'] = this.debitAmount; - data['date'] = this.date; - data['created_datetime'] = this.createdDatetime; + final Map data = {}; + data['id'] = id; + data['account_id'] = accountId; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['type'] = type; + data['description'] = description; + data['credit_amount'] = creditAmount; + data['debit_amount'] = debitAmount; + data['date'] = date; + data['created_datetime'] = createdDatetime; return data; } } diff --git a/lib/Models/commonModels/commonAccountlistResponse.dart b/lib/Models/commonModels/commonAccountlistResponse.dart index 83a50b6..caae9f3 100644 --- a/lib/Models/commonModels/commonAccountlistResponse.dart +++ b/lib/Models/commonModels/commonAccountlistResponse.dart @@ -9,7 +9,7 @@ class commonAccountlistResponse { if (json['account_list'] != null) { accountList = []; json['account_list'].forEach((v) { - accountList!.add(new AccountList.fromJson(v)); + accountList!.add(AccountList.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class commonAccountlistResponse { } Map toJson() { - final Map data = new Map(); - if (this.accountList != null) { - data['account_list'] = this.accountList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accountList != null) { + data['account_list'] = accountList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -53,31 +53,32 @@ class AccountList { String? email; String? contactName; - AccountList( - {this.id, - this.isPaymentAccount, - this.createdEmployeeId, - this.type, - this.refId, - this.name, - this.subLocality, - this.district, - this.state, - this.address, - this.datetime, - this.empId, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.bankUpiId, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.mob1, - this.email, - this.contactName}); + AccountList({ + this.id, + this.isPaymentAccount, + this.createdEmployeeId, + this.type, + this.refId, + this.name, + this.subLocality, + this.district, + this.state, + this.address, + this.datetime, + this.empId, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.bankUpiId, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.mob1, + this.email, + this.contactName, + }); AccountList.fromJson(Map json) { id = json['id']; @@ -107,31 +108,31 @@ class AccountList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['is_payment_account'] = this.isPaymentAccount; - data['created_employee_id'] = this.createdEmployeeId; - data['type'] = this.type; - data['ref_id'] = this.refId; - data['name'] = this.name; - data['sub_locality'] = this.subLocality; - data['district'] = this.district; - data['state'] = this.state; - data['address'] = this.address; - data['datetime'] = this.datetime; - data['emp_id'] = this.empId; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['mob1'] = this.mob1; - data['email'] = this.email; - data['contact_name'] = this.contactName; + final Map data = {}; + data['id'] = id; + data['is_payment_account'] = isPaymentAccount; + data['created_employee_id'] = createdEmployeeId; + data['type'] = type; + data['ref_id'] = refId; + data['name'] = name; + data['sub_locality'] = subLocality; + data['district'] = district; + data['state'] = state; + data['address'] = address; + data['datetime'] = datetime; + data['emp_id'] = empId; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['mob1'] = mob1; + data['email'] = email; + data['contact_name'] = contactName; return data; } } diff --git a/lib/Models/commonModels/commonAddAccountsSubmitResponse.dart b/lib/Models/commonModels/commonAddAccountsSubmitResponse.dart index 92a049b..d1cdd7a 100644 --- a/lib/Models/commonModels/commonAddAccountsSubmitResponse.dart +++ b/lib/Models/commonModels/commonAddAccountsSubmitResponse.dart @@ -3,25 +3,19 @@ class commonAddAccountsSubmitResponse { String? message; String? id; - commonAddAccountsSubmitResponse({ - this.error, - this.message, - this.id, - }); + commonAddAccountsSubmitResponse({this.error, this.message, this.id}); commonAddAccountsSubmitResponse.fromJson(Map json) { - error = json['error']; message = json['message']; id = json['id']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['id'] = this.id; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['id'] = id; return data; } } - diff --git a/lib/Models/commonModels/commonAddAccountsViewResponse.dart b/lib/Models/commonModels/commonAddAccountsViewResponse.dart index 19441e5..e12bf3f 100644 --- a/lib/Models/commonModels/commonAddAccountsViewResponse.dart +++ b/lib/Models/commonModels/commonAddAccountsViewResponse.dart @@ -16,12 +16,11 @@ class commonAddAccountsViewResponse { if (json['states'] != null) { states = []; json['states'].forEach((v) { - states!.add(new States.fromJson(v)); + states!.add(States.fromJson(v)); }); } - if(json['account_types']!=null){ - + if (json['account_types'] != null) { accountTypes = json['account_types'].cast(); } @@ -30,17 +29,16 @@ class commonAddAccountsViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.states != null) { - data['states'] = this.states!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (states != null) { + data['states'] = states!.map((v) => v.toJson()).toList(); } - if(this.accountTypes!=null){ - - data['account_types'] = this.accountTypes; + if (accountTypes != null) { + data['account_types'] = accountTypes; } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -57,9 +55,9 @@ class States { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/crmModels/AccessiblePagesResponse.dart b/lib/Models/crmModels/AccessiblePagesResponse.dart index b2bac6d..7ea6c67 100644 --- a/lib/Models/crmModels/AccessiblePagesResponse.dart +++ b/lib/Models/crmModels/AccessiblePagesResponse.dart @@ -10,20 +10,20 @@ class AccessiblePagesResponse { if (json['pages_accessible'] != null) { pagesAccessible = []; json['pages_accessible'].forEach((v) { - pagesAccessible!.add(new PagesAccessible.fromJson(v)); + pagesAccessible!.add(PagesAccessible.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.pagesAccessible != null) { + final Map data = {}; + data['error'] = error; + if (pagesAccessible != null) { data['pages_accessible'] = - this.pagesAccessible!.map((v) => v.toJson()).toList(); + pagesAccessible!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -42,10 +42,10 @@ class PagesAccessible { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['page_name'] = this.pageName; - data['mode'] = this.mode; + final Map data = {}; + data['id'] = id; + data['page_name'] = pageName; + data['mode'] = mode; return data; } } diff --git a/lib/Models/crmModels/GetDistrictOnStateResponse.dart b/lib/Models/crmModels/GetDistrictOnStateResponse.dart index 665d19c..b1051a9 100644 --- a/lib/Models/crmModels/GetDistrictOnStateResponse.dart +++ b/lib/Models/crmModels/GetDistrictOnStateResponse.dart @@ -10,19 +10,19 @@ class GetDistrictOnStateResponse { if (json['districts'] != null) { districts = []; json['districts'].forEach((v) { - districts!.add(new Districts.fromJson(v)); + districts!.add(Districts.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.districts != null) { - data['districts'] = this.districts!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (districts != null) { + data['districts'] = districts!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -36,14 +36,15 @@ class Districts { String? createdDatetime; String? updatedDatetime; - Districts( - {this.id, - this.state, - this.district, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + Districts({ + this.id, + this.state, + this.district, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); Districts.fromJson(Map json) { id = json['id']; @@ -56,14 +57,14 @@ class Districts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['state'] = this.state; - data['district'] = this.district; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['state'] = state; + data['district'] = district; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/GetSegmentOnTeamResponse.dart b/lib/Models/crmModels/GetSegmentOnTeamResponse.dart index 24b7985..c99c4b4 100644 --- a/lib/Models/crmModels/GetSegmentOnTeamResponse.dart +++ b/lib/Models/crmModels/GetSegmentOnTeamResponse.dart @@ -10,19 +10,19 @@ class GetSegmentOnTeamResponse { if (json['segments'] != null) { segments = []; json['segments'].forEach((v) { - segments!.add(new Segments.fromJson(v)); + segments!.add(Segments.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.segments != null) { - data['segments'] = this.segments!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (segments != null) { + data['segments'] = segments!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -36,14 +36,15 @@ class Segments { String? createdDatetime; String? updatedDatetime; - Segments( - {this.id, - this.teamId, - this.name, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + Segments({ + this.id, + this.teamId, + this.name, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); Segments.fromJson(Map json) { id = json['id']; @@ -56,14 +57,14 @@ class Segments { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['team_id'] = this.teamId; - data['name'] = this.name; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['team_id'] = teamId; + data['name'] = name; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/GetSourceOnReferenceResponse.dart b/lib/Models/crmModels/GetSourceOnReferenceResponse.dart index 4713411..e6111f4 100644 --- a/lib/Models/crmModels/GetSourceOnReferenceResponse.dart +++ b/lib/Models/crmModels/GetSourceOnReferenceResponse.dart @@ -10,19 +10,19 @@ class GetSourceOnReferenceResponse { if (json['references'] != null) { references = []; json['references'].forEach((v) { - references!.add(new References.fromJson(v)); + references!.add(References.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.references != null) { - data['references'] = this.references!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (references != null) { + data['references'] = references!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -36,14 +36,15 @@ class References { String? createdDatetime; String? updatedDatetime; - References( - {this.id, - this.sourceId, - this.name, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + References({ + this.id, + this.sourceId, + this.name, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); References.fromJson(Map json) { id = json['id']; @@ -56,14 +57,14 @@ class References { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['source_id'] = this.sourceId; - data['name'] = this.name; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['source_id'] = sourceId; + data['name'] = name; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/GetSubLocOnDistrictResponse.dart b/lib/Models/crmModels/GetSubLocOnDistrictResponse.dart index b4d12ff..a0352d4 100644 --- a/lib/Models/crmModels/GetSubLocOnDistrictResponse.dart +++ b/lib/Models/crmModels/GetSubLocOnDistrictResponse.dart @@ -10,20 +10,19 @@ class GetSubLocOnDistrictResponse { if (json['sub_locations'] != null) { subLocations = []; json['sub_locations'].forEach((v) { - subLocations!.add(new SubLocations.fromJson(v)); + subLocations!.add(SubLocations.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.subLocations != null) { - data['sub_locations'] = - this.subLocations!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (subLocations != null) { + data['sub_locations'] = subLocations!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -37,14 +36,15 @@ class SubLocations { String? createdDatetime; String? updatedDatetime; - SubLocations( - {this.id, - this.districtId, - this.subLocality, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + SubLocations({ + this.id, + this.districtId, + this.subLocality, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); SubLocations.fromJson(Map json) { id = json['id']; @@ -57,14 +57,14 @@ class SubLocations { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['district_id'] = this.districtId; - data['sub_locality'] = this.subLocality; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['district_id'] = districtId; + data['sub_locality'] = subLocality; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/LeadDetailsResponse.dart b/lib/Models/crmModels/LeadDetailsResponse.dart index c786a2b..80a5159 100644 --- a/lib/Models/crmModels/LeadDetailsResponse.dart +++ b/lib/Models/crmModels/LeadDetailsResponse.dart @@ -11,57 +11,59 @@ class LeadDetailsResponse { String? message; String? showEditAccountButton; - LeadDetailsResponse( - {this.error, - this.sessionExists, - this.leadDetails, - this.accountDetails, - this.leadProducts, - this.contactDetails, - this.followupDetails, - this.appointmentDetails, - this.quotationsDetails, - this.message, - this.showEditAccountButton, - }); + LeadDetailsResponse({ + this.error, + this.sessionExists, + this.leadDetails, + this.accountDetails, + this.leadProducts, + this.contactDetails, + this.followupDetails, + this.appointmentDetails, + this.quotationsDetails, + this.message, + this.showEditAccountButton, + }); LeadDetailsResponse.fromJson(Map json) { error = json['error']; sessionExists = json['session_exists']; - leadDetails = json['lead_details'] != null - ? new LeadDetails.fromJson(json['lead_details']) - : null; - accountDetails = json['account_details'] != null - ? new AccountDetails.fromJson(json['account_details']) - : null; + leadDetails = + json['lead_details'] != null + ? LeadDetails.fromJson(json['lead_details']) + : null; + accountDetails = + json['account_details'] != null + ? AccountDetails.fromJson(json['account_details']) + : null; if (json['lead_products'] != null) { leadProducts = []; json['lead_products'].forEach((v) { - leadProducts!.add(new LeadProducts.fromJson(v)); + leadProducts!.add(LeadProducts.fromJson(v)); }); } if (json['contact_details'] != null) { contactDetails = []; json['contact_details'].forEach((v) { - contactDetails!.add(new ContactDetails.fromJson(v)); + contactDetails!.add(ContactDetails.fromJson(v)); }); } if (json['followup_details'] != null) { followupDetails = []; json['followup_details'].forEach((v) { - followupDetails!.add(new FollowupDetails.fromJson(v)); + followupDetails!.add(FollowupDetails.fromJson(v)); }); } if (json['appointment_details'] != null) { appointmentDetails = []; json['appointment_details'].forEach((v) { - appointmentDetails!.add(new AppointmentDetails.fromJson(v)); + appointmentDetails!.add(AppointmentDetails.fromJson(v)); }); } if (json['quotations_details'] != null) { quotationsDetails = []; json['quotations_details'].forEach((v) { - quotationsDetails!.add(new QuotationsDetails.fromJson(v)); + quotationsDetails!.add(QuotationsDetails.fromJson(v)); }); } message = json['message']; @@ -69,37 +71,35 @@ class LeadDetailsResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['session_exists'] = this.sessionExists; - if (this.leadDetails != null) { - data['lead_details'] = this.leadDetails!.toJson(); + final Map data = {}; + data['error'] = error; + data['session_exists'] = sessionExists; + if (leadDetails != null) { + data['lead_details'] = leadDetails!.toJson(); } - if (this.accountDetails != null) { - data['account_details'] = this.accountDetails!.toJson(); + if (accountDetails != null) { + data['account_details'] = accountDetails!.toJson(); } - if (this.leadProducts != null) { - data['lead_products'] = - this.leadProducts!.map((v) => v.toJson()).toList(); + if (leadProducts != null) { + data['lead_products'] = leadProducts!.map((v) => v.toJson()).toList(); } - if (this.contactDetails != null) { - data['contact_details'] = - this.contactDetails!.map((v) => v.toJson()).toList(); + if (contactDetails != null) { + data['contact_details'] = contactDetails!.map((v) => v.toJson()).toList(); } - if (this.followupDetails != null) { + if (followupDetails != null) { data['followup_details'] = - this.followupDetails!.map((v) => v.toJson()).toList(); + followupDetails!.map((v) => v.toJson()).toList(); } - if (this.appointmentDetails != null) { + if (appointmentDetails != null) { data['appointment_details'] = - this.appointmentDetails!.map((v) => v.toJson()).toList(); + appointmentDetails!.map((v) => v.toJson()).toList(); } - if (this.quotationsDetails != null) { + if (quotationsDetails != null) { data['quotations_details'] = - this.quotationsDetails!.map((v) => v.toJson()).toList(); + quotationsDetails!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; - data['show_edit_account_button'] = this.showEditAccountButton; + data['message'] = message; + data['show_edit_account_button'] = showEditAccountButton; return data; } } @@ -131,32 +131,33 @@ class LeadDetails { String? lage; String? copyMessage; - LeadDetails( - {this.id, - this.ownerId, - this.accId, - this.accManagerId, - this.status, - this.openStatus, - this.date, - this.closeDate, - this.closereason, - this.competitor, - this.orderGainId, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.followupFunction, - this.name, - this.contName, - this.address, - this.mob1, - this.mob2, - this.tel, - this.email, - this.prod, - this.lage, - this.copyMessage}); + LeadDetails({ + this.id, + this.ownerId, + this.accId, + this.accManagerId, + this.status, + this.openStatus, + this.date, + this.closeDate, + this.closereason, + this.competitor, + this.orderGainId, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.followupFunction, + this.name, + this.contName, + this.address, + this.mob1, + this.mob2, + this.tel, + this.email, + this.prod, + this.lage, + this.copyMessage, + }); LeadDetails.fromJson(Map json) { id = json['id']; @@ -187,32 +188,32 @@ class LeadDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['owner_id'] = this.ownerId; - data['acc_id'] = this.accId; - data['acc_manager_id'] = this.accManagerId; - data['status'] = this.status; - data['open_status'] = this.openStatus; - data['date'] = this.date; - data['close_date'] = this.closeDate; - data['closereason'] = this.closereason; - data['competitor'] = this.competitor; - data['order_gain_id'] = this.orderGainId; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['followup_function'] = this.followupFunction; - data['name'] = this.name; - data['cont_name'] = this.contName; - data['address'] = this.address; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['tel'] = this.tel; - data['email'] = this.email; - data['prod'] = this.prod; - data['lage'] = this.lage; - data['copy_message'] = this.copyMessage; + final Map data = {}; + data['id'] = id; + data['owner_id'] = ownerId; + data['acc_id'] = accId; + data['acc_manager_id'] = accManagerId; + data['status'] = status; + data['open_status'] = openStatus; + data['date'] = date; + data['close_date'] = closeDate; + data['closereason'] = closereason; + data['competitor'] = competitor; + data['order_gain_id'] = orderGainId; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['followup_function'] = followupFunction; + data['name'] = name; + data['cont_name'] = contName; + data['address'] = address; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['tel'] = tel; + data['email'] = email; + data['prod'] = prod; + data['lage'] = lage; + data['copy_message'] = copyMessage; return data; } } @@ -243,31 +244,32 @@ class AccountDetails { String? accManager; String? owner; - AccountDetails( - {this.id, - this.tempId, - this.ownerId, - this.accManagerId, - this.name, - this.salutationName, - this.subLocality, - this.district, - this.state, - this.pincode, - this.address, - this.date, - this.source, - this.reference, - this.segment, - this.team, - this.gstNumber, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.email, - this.mob1, - this.accManager, - this.owner}); + AccountDetails({ + this.id, + this.tempId, + this.ownerId, + this.accManagerId, + this.name, + this.salutationName, + this.subLocality, + this.district, + this.state, + this.pincode, + this.address, + this.date, + this.source, + this.reference, + this.segment, + this.team, + this.gstNumber, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.email, + this.mob1, + this.accManager, + this.owner, + }); AccountDetails.fromJson(Map json) { id = json['id']; @@ -297,31 +299,31 @@ class AccountDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['temp_id'] = this.tempId; - data['owner_id'] = this.ownerId; - data['acc_manager_id'] = this.accManagerId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['sub_locality'] = this.subLocality; - data['district'] = this.district; - data['state'] = this.state; - data['pincode'] = this.pincode; - data['address'] = this.address; - data['date'] = this.date; - data['source'] = this.source; - data['reference'] = this.reference; - data['segment'] = this.segment; - data['team'] = this.team; - data['gst_number'] = this.gstNumber; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['email'] = this.email; - data['mob1'] = this.mob1; - data['acc_manager'] = this.accManager; - data['owner'] = this.owner; + final Map data = {}; + data['id'] = id; + data['temp_id'] = tempId; + data['owner_id'] = ownerId; + data['acc_manager_id'] = accManagerId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['sub_locality'] = subLocality; + data['district'] = district; + data['state'] = state; + data['pincode'] = pincode; + data['address'] = address; + data['date'] = date; + data['source'] = source; + data['reference'] = reference; + data['segment'] = segment; + data['team'] = team; + data['gst_number'] = gstNumber; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['email'] = email; + data['mob1'] = mob1; + data['acc_manager'] = accManager; + data['owner'] = owner; return data; } } @@ -340,19 +342,20 @@ class LeadProducts { String? updatedDatetime; String? productName; - LeadProducts( - {this.id, - this.leadId, - this.productId, - this.qty, - this.price, - this.prodTotalPrice, - this.date, - this.isDel, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.productName}); + LeadProducts({ + this.id, + this.leadId, + this.productId, + this.qty, + this.price, + this.prodTotalPrice, + this.date, + this.isDel, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.productName, + }); LeadProducts.fromJson(Map json) { id = json['id']; @@ -370,19 +373,19 @@ class LeadProducts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['lead_id'] = this.leadId; - data['product_id'] = this.productId; - data['qty'] = this.qty; - data['price'] = this.price; - data['prod_total_price'] = this.prodTotalPrice; - data['date'] = this.date; - data['is_del'] = this.isDel; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['product_name'] = this.productName; + final Map data = {}; + data['id'] = id; + data['lead_id'] = leadId; + data['product_id'] = productId; + data['qty'] = qty; + data['price'] = price; + data['prod_total_price'] = prodTotalPrice; + data['date'] = date; + data['is_del'] = isDel; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['product_name'] = productName; return data; } } @@ -403,21 +406,22 @@ class ContactDetails { String? createdDatetime; String? updatedDatetime; - ContactDetails( - {this.id, - this.accId, - this.name, - this.salutationName, - this.mob1, - this.mob2, - this.tel, - this.email, - this.type, - this.designation, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + ContactDetails({ + this.id, + this.accId, + this.name, + this.salutationName, + this.mob1, + this.mob2, + this.tel, + this.email, + this.type, + this.designation, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); ContactDetails.fromJson(Map json) { id = json['id']; @@ -437,21 +441,21 @@ class ContactDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['acc_id'] = this.accId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['tel'] = this.tel; - data['email'] = this.email; - data['type'] = this.type; - data['designation'] = this.designation; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['acc_id'] = accId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['tel'] = tel; + data['email'] = email; + data['type'] = type; + data['designation'] = designation; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } @@ -465,14 +469,15 @@ class FollowupDetails { String? fstatus; String? ffeedback; - FollowupDetails( - {this.ename, - this.ftype, - this.fdate, - this.finTime, - this.foutTime, - this.fstatus, - this.ffeedback}); + FollowupDetails({ + this.ename, + this.ftype, + this.fdate, + this.finTime, + this.foutTime, + this.fstatus, + this.ffeedback, + }); FollowupDetails.fromJson(Map json) { ename = json['ename']; @@ -485,14 +490,14 @@ class FollowupDetails { } Map toJson() { - final Map data = new Map(); - data['ename'] = this.ename; - data['ftype'] = this.ftype; - data['fdate'] = this.fdate; - data['fin_time'] = this.finTime; - data['fout_time'] = this.foutTime; - data['fstatus'] = this.fstatus; - data['ffeedback'] = this.ffeedback; + final Map data = {}; + data['ename'] = ename; + data['ftype'] = ftype; + data['fdate'] = fdate; + data['fin_time'] = finTime; + data['fout_time'] = foutTime; + data['fstatus'] = fstatus; + data['ffeedback'] = ffeedback; return data; } } @@ -505,13 +510,14 @@ class AppointmentDetails { String? astatus; String? adate; - AppointmentDetails( - {this.ename, - this.aappDate, - this.atype, - this.anote, - this.astatus, - this.adate}); + AppointmentDetails({ + this.ename, + this.aappDate, + this.atype, + this.anote, + this.astatus, + this.adate, + }); AppointmentDetails.fromJson(Map json) { ename = json['ename']; @@ -523,13 +529,13 @@ class AppointmentDetails { } Map toJson() { - final Map data = new Map(); - data['ename'] = this.ename; - data['aapp_date'] = this.aappDate; - data['atype'] = this.atype; - data['anote'] = this.anote; - data['astatus'] = this.astatus; - data['adate'] = this.adate; + final Map data = {}; + data['ename'] = ename; + data['aapp_date'] = aappDate; + data['atype'] = atype; + data['anote'] = anote; + data['astatus'] = astatus; + data['adate'] = adate; return data; } } @@ -564,35 +570,36 @@ class QuotationsDetails { String? updatedDatetime; String? employee; - QuotationsDetails( - {this.id, - this.empId, - this.leadId, - this.email, - this.mobile, - this.quote, - this.info, - this.type, - this.quoteType, - this.subject, - this.taxes, - this.spclNote, - this.forTxt, - this.payTerms, - this.priceShead, - this.extraChargeNarr, - this.extraChargeAmount, - this.transportCharge, - this.loadUnloadCharge, - this.minDuration, - this.deliveryPeriod, - this.minAdvance, - this.extraHoursCharge, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.employee}); + QuotationsDetails({ + this.id, + this.empId, + this.leadId, + this.email, + this.mobile, + this.quote, + this.info, + this.type, + this.quoteType, + this.subject, + this.taxes, + this.spclNote, + this.forTxt, + this.payTerms, + this.priceShead, + this.extraChargeNarr, + this.extraChargeAmount, + this.transportCharge, + this.loadUnloadCharge, + this.minDuration, + this.deliveryPeriod, + this.minAdvance, + this.extraHoursCharge, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.employee, + }); QuotationsDetails.fromJson(Map json) { id = json['id']; @@ -626,35 +633,35 @@ class QuotationsDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['emp_id'] = this.empId; - data['lead_id'] = this.leadId; - data['email'] = this.email; - data['mobile'] = this.mobile; - data['quote'] = this.quote; - data['info'] = this.info; - data['type'] = this.type; - data['quote_type'] = this.quoteType; - data['subject'] = this.subject; - data['taxes'] = this.taxes; - data['spcl_note'] = this.spclNote; - data['for_txt'] = this.forTxt; - data['pay_terms'] = this.payTerms; - data['price_shead'] = this.priceShead; - data['extra_charge_narr'] = this.extraChargeNarr; - data['extra_charge_amount'] = this.extraChargeAmount; - data['transport_charge'] = this.transportCharge; - data['load_unload_charge'] = this.loadUnloadCharge; - data['min_duration'] = this.minDuration; - data['delivery_period'] = this.deliveryPeriod; - data['min_advance'] = this.minAdvance; - data['extra_hours_charge'] = this.extraHoursCharge; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['employee'] = this.employee; + final Map data = {}; + data['id'] = id; + data['emp_id'] = empId; + data['lead_id'] = leadId; + data['email'] = email; + data['mobile'] = mobile; + data['quote'] = quote; + data['info'] = info; + data['type'] = type; + data['quote_type'] = quoteType; + data['subject'] = subject; + data['taxes'] = taxes; + data['spcl_note'] = spclNote; + data['for_txt'] = forTxt; + data['pay_terms'] = payTerms; + data['price_shead'] = priceShead; + data['extra_charge_narr'] = extraChargeNarr; + data['extra_charge_amount'] = extraChargeAmount; + data['transport_charge'] = transportCharge; + data['load_unload_charge'] = loadUnloadCharge; + data['min_duration'] = minDuration; + data['delivery_period'] = deliveryPeriod; + data['min_advance'] = minAdvance; + data['extra_hours_charge'] = extraHoursCharge; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['employee'] = employee; return data; } } diff --git a/lib/Models/crmModels/LeadListContactPopUpResponse.dart b/lib/Models/crmModels/LeadListContactPopUpResponse.dart index 82b0916..c8702f4 100644 --- a/lib/Models/crmModels/LeadListContactPopUpResponse.dart +++ b/lib/Models/crmModels/LeadListContactPopUpResponse.dart @@ -10,19 +10,19 @@ class LeadListContactPopUpResponse { if (json['contacts'] != null) { contacts = []; json['contacts'].forEach((v) { - contacts!.add(new Contacts.fromJson(v)); + contacts!.add(Contacts.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.contacts != null) { - data['contacts'] = this.contacts!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (contacts != null) { + data['contacts'] = contacts!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -43,21 +43,22 @@ class Contacts { String? createdDatetime; String? updatedDatetime; - Contacts( - {this.id, - this.accId, - this.name, - this.salutationName, - this.mob1, - this.mob2, - this.tel, - this.email, - this.type, - this.designation, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + Contacts({ + this.id, + this.accId, + this.name, + this.salutationName, + this.mob1, + this.mob2, + this.tel, + this.email, + this.type, + this.designation, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); Contacts.fromJson(Map json) { id = json['id']; @@ -77,21 +78,21 @@ class Contacts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['acc_id'] = this.accId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['tel'] = this.tel; - data['email'] = this.email; - data['type'] = this.type; - data['designation'] = this.designation; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['acc_id'] = accId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['tel'] = tel; + data['email'] = email; + data['type'] = type; + data['designation'] = designation; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/LeadListViewResponse.dart b/lib/Models/crmModels/LeadListViewResponse.dart index af97b49..ddf1af4 100644 --- a/lib/Models/crmModels/LeadListViewResponse.dart +++ b/lib/Models/crmModels/LeadListViewResponse.dart @@ -6,37 +6,38 @@ class LeadListViewResponse { String? error; String? message; - LeadListViewResponse( - {this.sources, - this.teams, - this.states, - this.employees, - this.error, - this.message}); + LeadListViewResponse({ + this.sources, + this.teams, + this.states, + this.employees, + this.error, + this.message, + }); LeadListViewResponse.fromJson(Map json) { if (json['sources'] != null) { sources = []; json['sources'].forEach((v) { - sources!.add(new Sources.fromJson(v)); + sources!.add(Sources.fromJson(v)); }); } if (json['teams'] != null) { teams = []; json['teams'].forEach((v) { - teams!.add(new Teams.fromJson(v)); + teams!.add(Teams.fromJson(v)); }); } if (json['states'] != null) { states = []; json['states'].forEach((v) { - states!.add(new States.fromJson(v)); + states!.add(States.fromJson(v)); }); } if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new Employees.fromJson(v)); + employees!.add(Employees.fromJson(v)); }); } error = json['error']; @@ -44,21 +45,21 @@ class LeadListViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.sources != null) { - data['sources'] = this.sources!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (sources != null) { + data['sources'] = sources!.map((v) => v.toJson()).toList(); } - if (this.teams != null) { - data['teams'] = this.teams!.map((v) => v.toJson()).toList(); + if (teams != null) { + data['teams'] = teams!.map((v) => v.toJson()).toList(); } - if (this.states != null) { - data['states'] = this.states!.map((v) => v.toJson()).toList(); + if (states != null) { + data['states'] = states!.map((v) => v.toJson()).toList(); } - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -75,12 +76,13 @@ class Sources { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class Teams { String? id; String? name; @@ -93,12 +95,13 @@ class Teams { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class States { String? id; String? name; @@ -111,12 +114,13 @@ class States { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class Employees { String? id; String? name; @@ -129,9 +133,9 @@ class Employees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/crmModels/NearbyOpenLeadsResponse.dart b/lib/Models/crmModels/NearbyOpenLeadsResponse.dart index 1da244a..75ced64 100644 --- a/lib/Models/crmModels/NearbyOpenLeadsResponse.dart +++ b/lib/Models/crmModels/NearbyOpenLeadsResponse.dart @@ -9,7 +9,7 @@ class NearbyOpenLeadsResponse { if (json['lead_list'] != null) { leadList = []; json['lead_list'].forEach((v) { - leadList!.add(new LeadList.fromJson(v)); + leadList!.add(LeadList.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class NearbyOpenLeadsResponse { } Map toJson() { - final Map data = new Map(); - if (this.leadList != null) { - data['lead_list'] = this.leadList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (leadList != null) { + data['lead_list'] = leadList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -53,31 +53,32 @@ class LeadList { String? email; String? distance; - LeadList( - {this.id, - this.ownerId, - this.accId, - this.accManagerId, - this.status, - this.openStatus, - this.date, - this.closeDate, - this.closereason, - this.competitor, - this.orderGainId, - this.loc, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.followupFunction, - this.name, - this.contName, - this.address, - this.mob1, - this.mob2, - this.tel, - this.email, - this.distance}); + LeadList({ + this.id, + this.ownerId, + this.accId, + this.accManagerId, + this.status, + this.openStatus, + this.date, + this.closeDate, + this.closereason, + this.competitor, + this.orderGainId, + this.loc, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.followupFunction, + this.name, + this.contName, + this.address, + this.mob1, + this.mob2, + this.tel, + this.email, + this.distance, + }); LeadList.fromJson(Map json) { id = json['id']; @@ -107,31 +108,31 @@ class LeadList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['owner_id'] = this.ownerId; - data['acc_id'] = this.accId; - data['acc_manager_id'] = this.accManagerId; - data['status'] = this.status; - data['open_status'] = this.openStatus; - data['date'] = this.date; - data['close_date'] = this.closeDate; - data['closereason'] = this.closereason; - data['competitor'] = this.competitor; - data['order_gain_id'] = this.orderGainId; - data['loc'] = this.loc; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['followup_function'] = this.followupFunction; - data['name'] = this.name; - data['cont_name'] = this.contName; - data['address'] = this.address; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['tel'] = this.tel; - data['email'] = this.email; - data['distance'] = this.distance; + final Map data = {}; + data['id'] = id; + data['owner_id'] = ownerId; + data['acc_id'] = accId; + data['acc_manager_id'] = accManagerId; + data['status'] = status; + data['open_status'] = openStatus; + data['date'] = date; + data['close_date'] = closeDate; + data['closereason'] = closereason; + data['competitor'] = competitor; + data['order_gain_id'] = orderGainId; + data['loc'] = loc; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['followup_function'] = followupFunction; + data['name'] = name; + data['cont_name'] = contName; + data['address'] = address; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['tel'] = tel; + data['email'] = email; + data['distance'] = distance; return data; } } diff --git a/lib/Models/crmModels/ProspectListViewResponse.dart b/lib/Models/crmModels/ProspectListViewResponse.dart index 966a08f..d9f6b45 100644 --- a/lib/Models/crmModels/ProspectListViewResponse.dart +++ b/lib/Models/crmModels/ProspectListViewResponse.dart @@ -9,7 +9,7 @@ class ProspectListViewResponse { if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new Employees.fromJson(v)); + employees!.add(Employees.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class ProspectListViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -39,9 +39,9 @@ class Employees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/crmModels/SubmitLeadListFilterResponse.dart b/lib/Models/crmModels/SubmitLeadListFilterResponse.dart index 155bd67..e94bdae 100644 --- a/lib/Models/crmModels/SubmitLeadListFilterResponse.dart +++ b/lib/Models/crmModels/SubmitLeadListFilterResponse.dart @@ -10,19 +10,19 @@ class SubmitLeadListFilterResponse { if (json['lead_list'] != null) { leadList = []; json['lead_list'].forEach((v) { - leadList!.add(new LeadList.fromJson(v)); + leadList!.add(LeadList.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.leadList != null) { - data['lead_list'] = this.leadList!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (leadList != null) { + data['lead_list'] = leadList!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -48,26 +48,27 @@ class LeadList { Account? account; List? contact; - LeadList( - {this.ldate, - this.stateName, - this.district, - this.subLocality, - this.accman, - this.accId, - this.cname, - this.mob1, - this.leadid, - this.status, - this.openStatus, - this.address, - this.aid, - this.company, - this.lage, - this.product, - this.followupfun, - this.account, - this.contact}); + LeadList({ + this.ldate, + this.stateName, + this.district, + this.subLocality, + this.accman, + this.accId, + this.cname, + this.mob1, + this.leadid, + this.status, + this.openStatus, + this.address, + this.aid, + this.company, + this.lage, + this.product, + this.followupfun, + this.account, + this.contact, + }); LeadList.fromJson(Map json) { ldate = json['ldate']; @@ -88,39 +89,39 @@ class LeadList { product = json['product']; followupfun = json['followupfun']; account = - json['account'] != null ? new Account.fromJson(json['account']) : null; + json['account'] != null ? Account.fromJson(json['account']) : null; if (json['contact'] != null) { contact = []; json['contact'].forEach((v) { - contact!.add(new Contact.fromJson(v)); + contact!.add(Contact.fromJson(v)); }); } } Map toJson() { - final Map data = new Map(); - data['ldate'] = this.ldate; - data['state_name'] = this.stateName; - data['district'] = this.district; - data['sub_locality'] = this.subLocality; - data['accman'] = this.accman; - data['acc_id'] = this.accId; - data['cname'] = this.cname; - data['mob1'] = this.mob1; - data['leadid'] = this.leadid; - data['status'] = this.status; - data['open_status'] = this.openStatus; - data['address'] = this.address; - data['aid'] = this.aid; - data['company'] = this.company; - data['lage'] = this.lage; - data['product'] = this.product; - data['followupfun'] = this.followupfun; - if (this.account != null) { - data['account'] = this.account!.toJson(); + final Map data = {}; + data['ldate'] = ldate; + data['state_name'] = stateName; + data['district'] = district; + data['sub_locality'] = subLocality; + data['accman'] = accman; + data['acc_id'] = accId; + data['cname'] = cname; + data['mob1'] = mob1; + data['leadid'] = leadid; + data['status'] = status; + data['open_status'] = openStatus; + data['address'] = address; + data['aid'] = aid; + data['company'] = company; + data['lage'] = lage; + data['product'] = product; + data['followupfun'] = followupfun; + if (account != null) { + data['account'] = account!.toJson(); } - if (this.contact != null) { - data['contact'] = this.contact!.map((v) => v.toJson()).toList(); + if (contact != null) { + data['contact'] = contact!.map((v) => v.toJson()).toList(); } return data; } @@ -148,27 +149,28 @@ class Account { String? createdDatetime; String? updatedDatetime; - Account( - {this.id, - this.tempId, - this.ownerId, - this.accManagerId, - this.name, - this.salutationName, - this.subLocality, - this.district, - this.state, - this.pincode, - this.address, - this.date, - this.source, - this.reference, - this.segment, - this.team, - this.gstNumber, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + Account({ + this.id, + this.tempId, + this.ownerId, + this.accManagerId, + this.name, + this.salutationName, + this.subLocality, + this.district, + this.state, + this.pincode, + this.address, + this.date, + this.source, + this.reference, + this.segment, + this.team, + this.gstNumber, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); Account.fromJson(Map json) { id = json['id']; @@ -194,27 +196,27 @@ class Account { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['temp_id'] = this.tempId; - data['owner_id'] = this.ownerId; - data['acc_manager_id'] = this.accManagerId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['sub_locality'] = this.subLocality; - data['district'] = this.district; - data['state'] = this.state; - data['pincode'] = this.pincode; - data['address'] = this.address; - data['date'] = this.date; - data['source'] = this.source; - data['reference'] = this.reference; - data['segment'] = this.segment; - data['team'] = this.team; - data['gst_number'] = this.gstNumber; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['temp_id'] = tempId; + data['owner_id'] = ownerId; + data['acc_manager_id'] = accManagerId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['sub_locality'] = subLocality; + data['district'] = district; + data['state'] = state; + data['pincode'] = pincode; + data['address'] = address; + data['date'] = date; + data['source'] = source; + data['reference'] = reference; + data['segment'] = segment; + data['team'] = team; + data['gst_number'] = gstNumber; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } @@ -235,21 +237,22 @@ class Contact { String? createdDatetime; String? updatedDatetime; - Contact( - {this.id, - this.accId, - this.name, - this.salutationName, - this.mob1, - this.mob2, - this.tel, - this.email, - this.type, - this.designation, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + Contact({ + this.id, + this.accId, + this.name, + this.salutationName, + this.mob1, + this.mob2, + this.tel, + this.email, + this.type, + this.designation, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); Contact.fromJson(Map json) { id = json['id']; @@ -269,21 +272,21 @@ class Contact { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['acc_id'] = this.accId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['tel'] = this.tel; - data['email'] = this.email; - data['type'] = this.type; - data['designation'] = this.designation; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['acc_id'] = accId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['tel'] = tel; + data['email'] = email; + data['type'] = type; + data['designation'] = designation; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/SubmitProspectListFilterResponse.dart b/lib/Models/crmModels/SubmitProspectListFilterResponse.dart index fbf4028..a8fd00e 100644 --- a/lib/Models/crmModels/SubmitProspectListFilterResponse.dart +++ b/lib/Models/crmModels/SubmitProspectListFilterResponse.dart @@ -3,14 +3,17 @@ class SubmitProspectListFilterResponse { String? error; String? message; - SubmitProspectListFilterResponse( - {this.accountsList, this.error, this.message}); + SubmitProspectListFilterResponse({ + this.accountsList, + this.error, + this.message, + }); SubmitProspectListFilterResponse.fromJson(Map json) { if (json['accounts_list'] != null) { accountsList = []; json['accounts_list'].forEach((v) { - accountsList!.add(new AccountsList.fromJson(v)); + accountsList!.add(AccountsList.fromJson(v)); }); } error = json['error']; @@ -18,13 +21,12 @@ class SubmitProspectListFilterResponse { } Map toJson() { - final Map data = new Map(); - if (this.accountsList != null) { - data['accounts_list'] = - this.accountsList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accountsList != null) { + data['accounts_list'] = accountsList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -40,16 +42,17 @@ class AccountsList { String? aname; String? age; - AccountsList( - {this.gstNumber, - this.adate, - this.accman, - this.mob1, - this.cname, - this.address, - this.aid, - this.aname, - this.age}); + AccountsList({ + this.gstNumber, + this.adate, + this.accman, + this.mob1, + this.cname, + this.address, + this.aid, + this.aname, + this.age, + }); AccountsList.fromJson(Map json) { gstNumber = json['gst_number']; @@ -64,16 +67,16 @@ class AccountsList { } Map toJson() { - final Map data = new Map(); - data['gst_number'] = this.gstNumber; - data['adate'] = this.adate; - data['accman'] = this.accman; - data['mob1'] = this.mob1; - data['cname'] = this.cname; - data['address'] = this.address; - data['aid'] = this.aid; - data['aname'] = this.aname; - data['age'] = this.age; + final Map data = {}; + data['gst_number'] = gstNumber; + data['adate'] = adate; + data['accman'] = accman; + data['mob1'] = mob1; + data['cname'] = cname; + data['address'] = address; + data['aid'] = aid; + data['aname'] = aname; + data['age'] = age; return data; } } diff --git a/lib/Models/crmModels/appointmentCalendarResponse.dart b/lib/Models/crmModels/appointmentCalendarResponse.dart index 24cacae..ae91808 100644 --- a/lib/Models/crmModels/appointmentCalendarResponse.dart +++ b/lib/Models/crmModels/appointmentCalendarResponse.dart @@ -15,7 +15,7 @@ class appointmentCalendarResponse { if (json['appointments'] != null) { appointments = []; json['appointments'].forEach((v) { - appointments!.add(new Appointments.fromJson(v)); + appointments!.add(Appointments.fromJson(v)); }); } error = json['error']; @@ -24,13 +24,13 @@ class appointmentCalendarResponse { } Map toJson() { - final Map data = new Map(); - if (this.appointments != null) { - data['appointments'] = this.appointments!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (appointments != null) { + data['appointments'] = appointments!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -65,14 +65,14 @@ class Appointments { } Map toJson() { - final Map data = new Map(); - data['emp_id'] = this.empId; - data['id'] = this.id; - data['lead_id'] = this.leadId; - data['app_date'] = this.appDate; - data['name'] = this.name; - data['product'] = this.product; - data['mob1'] = this.mob1; + final Map data = {}; + data['emp_id'] = empId; + data['id'] = id; + data['lead_id'] = leadId; + data['app_date'] = appDate; + data['name'] = name; + data['product'] = product; + data['mob1'] = mob1; return data; } } diff --git a/lib/Models/crmModels/crmAddFollowUpResponse.dart b/lib/Models/crmModels/crmAddFollowUpResponse.dart index 68b7d51..2c00762 100644 --- a/lib/Models/crmModels/crmAddFollowUpResponse.dart +++ b/lib/Models/crmModels/crmAddFollowUpResponse.dart @@ -4,8 +4,12 @@ class crmAddFollowUpResponse { String? message; int? sessionExists; - crmAddFollowUpResponse( - {this.redirectTo, this.error, this.message, this.sessionExists}); + crmAddFollowUpResponse({ + this.redirectTo, + this.error, + this.message, + this.sessionExists, + }); crmAddFollowUpResponse.fromJson(Map json) { redirectTo = json['redirect_to']; @@ -15,11 +19,11 @@ class crmAddFollowUpResponse { } Map toJson() { - final Map data = new Map(); - data['redirect_to'] = this.redirectTo; - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['redirect_to'] = redirectTo; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/crmModels/crmDashboardFollowUpResponse.dart b/lib/Models/crmModels/crmDashboardFollowUpResponse.dart index b09601b..5de5acf 100644 --- a/lib/Models/crmModels/crmDashboardFollowUpResponse.dart +++ b/lib/Models/crmModels/crmDashboardFollowUpResponse.dart @@ -4,15 +4,19 @@ class crmDashboardFollowUpResponse { String? message; int? sessionExists; - crmDashboardFollowUpResponse( - {this.error, this.followupLists, this.message, this.sessionExists}); + crmDashboardFollowUpResponse({ + this.error, + this.followupLists, + this.message, + this.sessionExists, + }); crmDashboardFollowUpResponse.fromJson(Map json) { error = json['error']; if (json['followup_lists'] != null) { followupLists = []; json['followup_lists'].forEach((v) { - followupLists!.add(new FollowupLists.fromJson(v)); + followupLists!.add(FollowupLists.fromJson(v)); }); } message = json['message']; @@ -20,14 +24,13 @@ class crmDashboardFollowUpResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.followupLists != null) { - data['followup_lists'] = - this.followupLists!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (followupLists != null) { + data['followup_lists'] = followupLists!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -42,15 +45,16 @@ class FollowupLists { String? lempid; String? aid; - FollowupLists( - {this.aname, - this.appdate, - this.atype, - this.anote, - this.leadid, - this.lstatus, - this.lempid, - this.aid}); + FollowupLists({ + this.aname, + this.appdate, + this.atype, + this.anote, + this.leadid, + this.lstatus, + this.lempid, + this.aid, + }); FollowupLists.fromJson(Map json) { aname = json['aname']; @@ -64,15 +68,15 @@ class FollowupLists { } Map toJson() { - final Map data = new Map(); - data['aname'] = this.aname; - data['appdate'] = this.appdate; - data['atype'] = this.atype; - data['anote'] = this.anote; - data['leadid'] = this.leadid; - data['lstatus'] = this.lstatus; - data['lempid'] = this.lempid; - data['aid'] = this.aid; + final Map data = {}; + data['aname'] = aname; + data['appdate'] = appdate; + data['atype'] = atype; + data['anote'] = anote; + data['leadid'] = leadid; + data['lstatus'] = lstatus; + data['lempid'] = lempid; + data['aid'] = aid; return data; } } diff --git a/lib/Models/crmModels/crmDashboardQuotationResponse.dart b/lib/Models/crmModels/crmDashboardQuotationResponse.dart index 2e2f787..33863d6 100644 --- a/lib/Models/crmModels/crmDashboardQuotationResponse.dart +++ b/lib/Models/crmModels/crmDashboardQuotationResponse.dart @@ -4,15 +4,19 @@ class crmDashboardQuotationResponse { String? message; int? sessionExists; - crmDashboardQuotationResponse( - {this.error, this.quotationLists, this.message, this.sessionExists}); + crmDashboardQuotationResponse({ + this.error, + this.quotationLists, + this.message, + this.sessionExists, + }); crmDashboardQuotationResponse.fromJson(Map json) { error = json['error']; if (json['quotation_lists'] != null) { quotationLists = []; json['quotation_lists'].forEach((v) { - quotationLists!.add(new QuotationLists.fromJson(v)); + quotationLists!.add(QuotationLists.fromJson(v)); }); } message = json['message']; @@ -20,14 +24,13 @@ class crmDashboardQuotationResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.quotationLists != null) { - data['quotation_lists'] = - this.quotationLists!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (quotationLists != null) { + data['quotation_lists'] = quotationLists!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -39,8 +42,13 @@ class QuotationLists { String? lempid; String? quotationId; - QuotationLists( - {this.aname, this.leadid, this.lstatus, this.lempid, this.quotationId}); + QuotationLists({ + this.aname, + this.leadid, + this.lstatus, + this.lempid, + this.quotationId, + }); QuotationLists.fromJson(Map json) { aname = json['aname']; @@ -51,12 +59,12 @@ class QuotationLists { } Map toJson() { - final Map data = new Map(); - data['aname'] = this.aname; - data['leadid'] = this.leadid; - data['lstatus'] = this.lstatus; - data['lempid'] = this.lempid; - data['quotation_id'] = this.quotationId; + final Map data = {}; + data['aname'] = aname; + data['leadid'] = leadid; + data['lstatus'] = lstatus; + data['lempid'] = lempid; + data['quotation_id'] = quotationId; return data; } } diff --git a/lib/Models/crmModels/crmDashboardResponse.dart b/lib/Models/crmModels/crmDashboardResponse.dart index 600c105..22fe5f4 100644 --- a/lib/Models/crmModels/crmDashboardResponse.dart +++ b/lib/Models/crmModels/crmDashboardResponse.dart @@ -16,60 +16,59 @@ class crmDashboardResponse { String? message; int? sessionExists; - crmDashboardResponse( - {this.hotleads, - this.pendingTasks, - this.coldleads, - this.warmleads, - this.totalleads, - this.openleads, - this.visits, - this.calls, - this.quote, - this.orderlost, - this.norequirement, - this.openEnquiries, - this.nearbyLeads, - this.error, - this.message, - this.sessionExists}); + crmDashboardResponse({ + this.hotleads, + this.pendingTasks, + this.coldleads, + this.warmleads, + this.totalleads, + this.openleads, + this.visits, + this.calls, + this.quote, + this.orderlost, + this.norequirement, + this.openEnquiries, + this.nearbyLeads, + this.error, + this.message, + this.sessionExists, + }); crmDashboardResponse.fromJson(Map json) { - hotleads = json['hotleads'] != null - ? new Hotleads.fromJson(json['hotleads']) - : null; - pendingTasks = json['pending_tasks'] != null - ? new Hotleads.fromJson(json['pending_tasks']) - : null; - coldleads = json['coldleads'] != null - ? new Hotleads.fromJson(json['coldleads']) - : null; - warmleads = json['warmleads'] != null - ? new Hotleads.fromJson(json['warmleads']) - : null; - totalleads = json['totalleads'] != null - ? new Hotleads.fromJson(json['totalleads']) - : null; - openleads = json['openleads'] != null - ? new Hotleads.fromJson(json['openleads']) - : null; - visits = - json['visits'] != null ? new Hotleads.fromJson(json['visits']) : null; - calls = json['calls'] != null ? new Hotleads.fromJson(json['calls']) : null; - quote = json['quote'] != null ? new Hotleads.fromJson(json['quote']) : null; - orderlost = json['orderlost'] != null - ? new Hotleads.fromJson(json['orderlost']) - : null; - norequirement = json['norequirement'] != null - ? new Hotleads.fromJson(json['norequirement']) - : null; - openEnquiries = json['open_enquiries'] != null - ? new Hotleads.fromJson(json['open_enquiries']) - : null; + hotleads = + json['hotleads'] != null ? Hotleads.fromJson(json['hotleads']) : null; + pendingTasks = + json['pending_tasks'] != null + ? Hotleads.fromJson(json['pending_tasks']) + : null; + coldleads = + json['coldleads'] != null ? Hotleads.fromJson(json['coldleads']) : null; + warmleads = + json['warmleads'] != null ? Hotleads.fromJson(json['warmleads']) : null; + totalleads = + json['totalleads'] != null + ? Hotleads.fromJson(json['totalleads']) + : null; + openleads = + json['openleads'] != null ? Hotleads.fromJson(json['openleads']) : null; + visits = json['visits'] != null ? Hotleads.fromJson(json['visits']) : null; + calls = json['calls'] != null ? Hotleads.fromJson(json['calls']) : null; + quote = json['quote'] != null ? Hotleads.fromJson(json['quote']) : null; + orderlost = + json['orderlost'] != null ? Hotleads.fromJson(json['orderlost']) : null; + norequirement = + json['norequirement'] != null + ? Hotleads.fromJson(json['norequirement']) + : null; + openEnquiries = + json['open_enquiries'] != null + ? Hotleads.fromJson(json['open_enquiries']) + : null; if (json['nearby_leads'] != null) { nearbyLeads = []; json['nearby_leads'].forEach((v) { - nearbyLeads!.add(new NearbyLeads.fromJson(v)); + nearbyLeads!.add(NearbyLeads.fromJson(v)); }); } error = json['error']; @@ -78,49 +77,49 @@ class crmDashboardResponse { } Map toJson() { - final Map data = new Map(); - if (this.hotleads != null) { - data['hotleads'] = this.hotleads!.toJson(); + final Map data = {}; + if (hotleads != null) { + data['hotleads'] = hotleads!.toJson(); } - if (this.pendingTasks != null) { - data['pending_tasks'] = this.pendingTasks!.toJson(); + if (pendingTasks != null) { + data['pending_tasks'] = pendingTasks!.toJson(); } - if (this.coldleads != null) { - data['coldleads'] = this.coldleads!.toJson(); + if (coldleads != null) { + data['coldleads'] = coldleads!.toJson(); } - if (this.warmleads != null) { - data['warmleads'] = this.warmleads!.toJson(); + if (warmleads != null) { + data['warmleads'] = warmleads!.toJson(); } - if (this.totalleads != null) { - data['totalleads'] = this.totalleads!.toJson(); + if (totalleads != null) { + data['totalleads'] = totalleads!.toJson(); } - if (this.openleads != null) { - data['openleads'] = this.openleads!.toJson(); + if (openleads != null) { + data['openleads'] = openleads!.toJson(); } - if (this.visits != null) { - data['visits'] = this.visits!.toJson(); + if (visits != null) { + data['visits'] = visits!.toJson(); } - if (this.calls != null) { - data['calls'] = this.calls!.toJson(); + if (calls != null) { + data['calls'] = calls!.toJson(); } - if (this.quote != null) { - data['quote'] = this.quote!.toJson(); + if (quote != null) { + data['quote'] = quote!.toJson(); } - if (this.orderlost != null) { - data['orderlost'] = this.orderlost!.toJson(); + if (orderlost != null) { + data['orderlost'] = orderlost!.toJson(); } - if (this.norequirement != null) { - data['norequirement'] = this.norequirement!.toJson(); + if (norequirement != null) { + data['norequirement'] = norequirement!.toJson(); } - if (this.openEnquiries != null) { - data['open_enquiries'] = this.openEnquiries!.toJson(); + if (openEnquiries != null) { + data['open_enquiries'] = openEnquiries!.toJson(); } - if (this.nearbyLeads != null) { - data['nearby_leads'] = this.nearbyLeads!.map((v) => v.toJson()).toList(); + if (nearbyLeads != null) { + data['nearby_leads'] = nearbyLeads!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -133,15 +132,14 @@ class Hotleads { Hotleads.fromJson(Map json) { count = json['count']; - filter = - json['filter'] != null ? new Filter.fromJson(json['filter']) : null; + filter = json['filter'] != null ? Filter.fromJson(json['filter']) : null; } Map toJson() { - final Map data = new Map(); - data['count'] = this.count; - if (this.filter != null) { - data['filter'] = this.filter!.toJson(); + final Map data = {}; + data['count'] = count; + if (filter != null) { + data['filter'] = filter!.toJson(); } return data; } @@ -165,12 +163,12 @@ class Filter { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['page_name'] = this.pageName; - data['mode'] = this.mode; - data['open_status'] = this.openStatus; - data['status'] = this.status; + final Map data = {}; + data['id'] = id; + data['page_name'] = pageName; + data['mode'] = mode; + data['open_status'] = openStatus; + data['status'] = status; return data; } } @@ -202,32 +200,33 @@ class NearbyLeads { String? email; String? distance; - NearbyLeads( - {this.id, - this.ownerId, - this.accId, - this.accManagerId, - this.status, - this.openStatus, - this.date, - this.closeDate, - this.closereason, - this.competitor, - this.orderGainId, - this.loc, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.followupFunction, - this.name, - this.product, - this.contName, - this.address, - this.mob1, - this.mob2, - this.tel, - this.email, - this.distance}); + NearbyLeads({ + this.id, + this.ownerId, + this.accId, + this.accManagerId, + this.status, + this.openStatus, + this.date, + this.closeDate, + this.closereason, + this.competitor, + this.orderGainId, + this.loc, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.followupFunction, + this.name, + this.product, + this.contName, + this.address, + this.mob1, + this.mob2, + this.tel, + this.email, + this.distance, + }); NearbyLeads.fromJson(Map json) { id = json['id']; @@ -258,32 +257,32 @@ class NearbyLeads { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['owner_id'] = this.ownerId; - data['acc_id'] = this.accId; - data['acc_manager_id'] = this.accManagerId; - data['status'] = this.status; - data['open_status'] = this.openStatus; - data['date'] = this.date; - data['close_date'] = this.closeDate; - data['closereason'] = this.closereason; - data['competitor'] = this.competitor; - data['order_gain_id'] = this.orderGainId; - data['loc'] = this.loc; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['followup_function'] = this.followupFunction; - data['name'] = this.name; - data['product'] = this.product; - data['cont_name'] = this.contName; - data['address'] = this.address; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['tel'] = this.tel; - data['email'] = this.email; - data['distance'] = this.distance; + final Map data = {}; + data['id'] = id; + data['owner_id'] = ownerId; + data['acc_id'] = accId; + data['acc_manager_id'] = accManagerId; + data['status'] = status; + data['open_status'] = openStatus; + data['date'] = date; + data['close_date'] = closeDate; + data['closereason'] = closereason; + data['competitor'] = competitor; + data['order_gain_id'] = orderGainId; + data['loc'] = loc; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['followup_function'] = followupFunction; + data['name'] = name; + data['product'] = product; + data['cont_name'] = contName; + data['address'] = address; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['tel'] = tel; + data['email'] = email; + data['distance'] = distance; return data; } } diff --git a/lib/Models/crmModels/crmDownloadGenQuoteResponse.dart b/lib/Models/crmModels/crmDownloadGenQuoteResponse.dart index faafeb1..67315d6 100644 --- a/lib/Models/crmModels/crmDownloadGenQuoteResponse.dart +++ b/lib/Models/crmModels/crmDownloadGenQuoteResponse.dart @@ -4,8 +4,12 @@ class crmDownloadGenQuoteResponse { String? message; int? sessionExists; - crmDownloadGenQuoteResponse( - {this.error, this.quoteFilepath, this.message, this.sessionExists}); + crmDownloadGenQuoteResponse({ + this.error, + this.quoteFilepath, + this.message, + this.sessionExists, + }); crmDownloadGenQuoteResponse.fromJson(Map json) { error = json['error']; @@ -15,11 +19,11 @@ class crmDownloadGenQuoteResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['quote_filepath'] = this.quoteFilepath; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['quote_filepath'] = quoteFilepath; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/crmModels/crmLeadDetailsEditAccountViewResponse.dart b/lib/Models/crmModels/crmLeadDetailsEditAccountViewResponse.dart index aab7b1c..d1ee529 100644 --- a/lib/Models/crmModels/crmLeadDetailsEditAccountViewResponse.dart +++ b/lib/Models/crmModels/crmLeadDetailsEditAccountViewResponse.dart @@ -4,33 +4,38 @@ class crmLeadDetailsEditAccountViewResponse { String? error; String? message; - crmLeadDetailsEditAccountViewResponse( - {this.teams, this.accountDetails, this.error, this.message}); + crmLeadDetailsEditAccountViewResponse({ + this.teams, + this.accountDetails, + this.error, + this.message, + }); crmLeadDetailsEditAccountViewResponse.fromJson(Map json) { if (json['teams'] != null) { teams = []; json['teams'].forEach((v) { - teams!.add(new Teams.fromJson(v)); + teams!.add(Teams.fromJson(v)); }); } - accountDetails = json['account_details'] != null - ? new AccountDetails.fromJson(json['account_details']) - : null; + accountDetails = + json['account_details'] != null + ? AccountDetails.fromJson(json['account_details']) + : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.teams != null) { - data['teams'] = this.teams!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (teams != null) { + data['teams'] = teams!.map((v) => v.toJson()).toList(); } - if (this.accountDetails != null) { - data['account_details'] = this.accountDetails!.toJson(); + if (accountDetails != null) { + data['account_details'] = accountDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -47,9 +52,9 @@ class Teams { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -68,10 +73,10 @@ class AccountDetails { } Map toJson() { - final Map data = new Map(); - data['team'] = this.team; - data['segment'] = this.segment; - data['name'] = this.name; + final Map data = {}; + data['team'] = team; + data['segment'] = segment; + data['name'] = name; return data; } } diff --git a/lib/Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart b/lib/Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart index 40d774d..3e91e61 100644 --- a/lib/Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart +++ b/lib/Models/crmModels/crmLeadDetailsEditProductsViewResponse.dart @@ -5,20 +5,25 @@ class crmLeadDetailsEditProductsViewResponse { String? message; int? sessionExists; - crmLeadDetailsEditProductsViewResponse( - {this.products, this.leadProducts, this.error, this.message, this.sessionExists}); + crmLeadDetailsEditProductsViewResponse({ + this.products, + this.leadProducts, + this.error, + this.message, + this.sessionExists, + }); crmLeadDetailsEditProductsViewResponse.fromJson(Map json) { if (json['products'] != null) { products = []; json['products'].forEach((v) { - products!.add(new Products.fromJson(v)); + products!.add(Products.fromJson(v)); }); } if (json['lead_products'] != null) { leadProducts = []; json['lead_products'].forEach((v) { - leadProducts!.add(new LeadProducts.fromJson(v)); + leadProducts!.add(LeadProducts.fromJson(v)); }); } error = json['error']; @@ -27,17 +32,16 @@ class crmLeadDetailsEditProductsViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.products != null) { - data['products'] = this.products!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (products != null) { + data['products'] = products!.map((v) => v.toJson()).toList(); } - if (this.leadProducts != null) { - data['lead_products'] = - this.leadProducts!.map((v) => v.toJson()).toList(); + if (leadProducts != null) { + data['lead_products'] = leadProducts!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -54,9 +58,9 @@ class Products { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -74,18 +78,19 @@ class LeadProducts { String? updatedDatetime; String? productName; - LeadProducts( - {this.id, - this.leadId, - this.productId, - this.qty, - this.price, - this.date, - this.isDel, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.productName}); + LeadProducts({ + this.id, + this.leadId, + this.productId, + this.qty, + this.price, + this.date, + this.isDel, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.productName, + }); LeadProducts.fromJson(Map json) { id = json['id']; @@ -102,18 +107,18 @@ class LeadProducts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['lead_id'] = this.leadId; - data['product_id'] = this.productId; - data['qty'] = this.qty; - data['price'] = this.price; - data['date'] = this.date; - data['is_del'] = this.isDel; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['product_name'] = this.productName; + final Map data = {}; + data['id'] = id; + data['lead_id'] = leadId; + data['product_id'] = productId; + data['qty'] = qty; + data['price'] = price; + data['date'] = date; + data['is_del'] = isDel; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['product_name'] = productName; return data; } } diff --git a/lib/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart b/lib/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart index 34337c7..b4ec686 100644 --- a/lib/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart +++ b/lib/Models/crmModels/crmLeadDetailsGenerateQuotationSubmitResponse.dart @@ -3,21 +3,25 @@ class crmLeadDetailsGenerateQuotationSubmitResponse { String? error; String? quoteFilepath; - crmLeadDetailsGenerateQuotationSubmitResponse( - {this.message, this.error, this.quoteFilepath}); + crmLeadDetailsGenerateQuotationSubmitResponse({ + this.message, + this.error, + this.quoteFilepath, + }); crmLeadDetailsGenerateQuotationSubmitResponse.fromJson( - Map json) { + Map json, + ) { message = json['message']; error = json['error']; quoteFilepath = json['quote_filepath']; } Map toJson() { - final Map data = new Map(); - data['message'] = this.message; - data['error'] = this.error; - data['quote_filepath'] = this.quoteFilepath; + final Map data = {}; + data['message'] = message; + data['error'] = error; + data['quote_filepath'] = quoteFilepath; return data; } } diff --git a/lib/Models/crmModels/crmLeadDetailsGenerateQuotationViewResponse.dart b/lib/Models/crmModels/crmLeadDetailsGenerateQuotationViewResponse.dart index 66a919d..3181ea1 100644 --- a/lib/Models/crmModels/crmLeadDetailsGenerateQuotationViewResponse.dart +++ b/lib/Models/crmModels/crmLeadDetailsGenerateQuotationViewResponse.dart @@ -6,29 +6,32 @@ class crmLeadDetailsGenerateQuotationViewResponse { String? message; int? sessionExists; - crmLeadDetailsGenerateQuotationViewResponse( - {this.quoteDetails, - this.leadProducts, - this.products, - this.error, - this.message, - this.sessionExists}); + crmLeadDetailsGenerateQuotationViewResponse({ + this.quoteDetails, + this.leadProducts, + this.products, + this.error, + this.message, + this.sessionExists, + }); crmLeadDetailsGenerateQuotationViewResponse.fromJson( - Map json) { - quoteDetails = json['quote_details'] != null - ? new QuoteDetails.fromJson(json['quote_details']) - : null; + Map json, + ) { + quoteDetails = + json['quote_details'] != null + ? QuoteDetails.fromJson(json['quote_details']) + : null; if (json['lead_products'] != null) { leadProducts = []; json['lead_products'].forEach((v) { - leadProducts!.add(new LeadProducts.fromJson(v)); + leadProducts!.add(LeadProducts.fromJson(v)); }); } if (json['products'] != null) { products = []; json['products'].forEach((v) { - products!.add(new Products.fromJson(v)); + products!.add(Products.fromJson(v)); }); } error = json['error']; @@ -37,20 +40,19 @@ class crmLeadDetailsGenerateQuotationViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.quoteDetails != null) { - data['quote_details'] = this.quoteDetails!.toJson(); + final Map data = {}; + if (quoteDetails != null) { + data['quote_details'] = quoteDetails!.toJson(); } - if (this.leadProducts != null) { - data['lead_products'] = - this.leadProducts!.map((v) => v.toJson()).toList(); + if (leadProducts != null) { + data['lead_products'] = leadProducts!.map((v) => v.toJson()).toList(); } - if (this.products != null) { - data['products'] = this.products!.map((v) => v.toJson()).toList(); + if (products != null) { + data['products'] = products!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -64,14 +66,15 @@ class QuoteDetails { String? forText; String? paymentTerms; - QuoteDetails( - {this.accountId, - this.name, - this.email, - this.mobile, - this.subject, - this.forText, - this.paymentTerms}); + QuoteDetails({ + this.accountId, + this.name, + this.email, + this.mobile, + this.subject, + this.forText, + this.paymentTerms, + }); QuoteDetails.fromJson(Map json) { accountId = json['account_id']; @@ -84,14 +87,14 @@ class QuoteDetails { } Map toJson() { - final Map data = new Map(); - data['account_id'] = this.accountId; - data['name'] = this.name; - data['email'] = this.email; - data['mobile'] = this.mobile; - data['subject'] = this.subject; - data['for_text'] = this.forText; - data['payment_terms'] = this.paymentTerms; + final Map data = {}; + data['account_id'] = accountId; + data['name'] = name; + data['email'] = email; + data['mobile'] = mobile; + data['subject'] = subject; + data['for_text'] = forText; + data['payment_terms'] = paymentTerms; return data; } } @@ -110,19 +113,20 @@ class LeadProducts { String? prodTotalPrice; String? productName; - LeadProducts( - {this.id, - this.leadId, - this.productId, - this.qty, - this.price, - this.date, - this.isDel, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.prodTotalPrice, - this.productName}); + LeadProducts({ + this.id, + this.leadId, + this.productId, + this.qty, + this.price, + this.date, + this.isDel, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.prodTotalPrice, + this.productName, + }); LeadProducts.fromJson(Map json) { id = json['id']; @@ -140,19 +144,19 @@ class LeadProducts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['lead_id'] = this.leadId; - data['product_id'] = this.productId; - data['qty'] = this.qty; - data['price'] = this.price; - data['date'] = this.date; - data['is_del'] = this.isDel; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['prod_total_price'] = this.prodTotalPrice; - data['product_name'] = this.productName; + final Map data = {}; + data['id'] = id; + data['lead_id'] = leadId; + data['product_id'] = productId; + data['qty'] = qty; + data['price'] = price; + data['date'] = date; + data['is_del'] = isDel; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['prod_total_price'] = prodTotalPrice; + data['product_name'] = productName; return data; } } @@ -169,9 +173,9 @@ class Products { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/crmModels/crmNewLeadsProspectsSubmitResponse.dart b/lib/Models/crmModels/crmNewLeadsProspectsSubmitResponse.dart index d69c6cf..96e2e5a 100644 --- a/lib/Models/crmModels/crmNewLeadsProspectsSubmitResponse.dart +++ b/lib/Models/crmModels/crmNewLeadsProspectsSubmitResponse.dart @@ -12,10 +12,10 @@ class crmNewLeadsProspectsSubmitResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['lead_id'] = this.leadId; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['lead_id'] = leadId; return data; } } diff --git a/lib/Models/crmModels/crmNewLeadsProspectsViewResponse.dart b/lib/Models/crmModels/crmNewLeadsProspectsViewResponse.dart index 5cd15d3..8a4092b 100644 --- a/lib/Models/crmModels/crmNewLeadsProspectsViewResponse.dart +++ b/lib/Models/crmModels/crmNewLeadsProspectsViewResponse.dart @@ -9,46 +9,47 @@ class crmNewLeadsProspectsViewResponse { String? message; int? sessionExists; - crmNewLeadsProspectsViewResponse( - {this.employees, - this.sources, - this.teams, - this.states, - this.products, - this.salutation, - this.error, - this.message, - this.sessionExists}); + crmNewLeadsProspectsViewResponse({ + this.employees, + this.sources, + this.teams, + this.states, + this.products, + this.salutation, + this.error, + this.message, + this.sessionExists, + }); crmNewLeadsProspectsViewResponse.fromJson(Map json) { if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new Employees.fromJson(v)); + employees!.add(Employees.fromJson(v)); }); } if (json['sources'] != null) { sources = []; json['sources'].forEach((v) { - sources!.add(new Sources.fromJson(v)); + sources!.add(Sources.fromJson(v)); }); } if (json['teams'] != null) { teams = []; json['teams'].forEach((v) { - teams!.add(new Teams.fromJson(v)); + teams!.add(Teams.fromJson(v)); }); } if (json['states'] != null) { states = []; json['states'].forEach((v) { - states!.add(new States.fromJson(v)); + states!.add(States.fromJson(v)); }); } if (json['products'] != null) { products = []; json['products'].forEach((v) { - products!.add(new Products.fromJson(v)); + products!.add(Products.fromJson(v)); }); } salutation = json['salutation'].cast(); @@ -58,26 +59,26 @@ class crmNewLeadsProspectsViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } - if (this.sources != null) { - data['sources'] = this.sources!.map((v) => v.toJson()).toList(); + if (sources != null) { + data['sources'] = sources!.map((v) => v.toJson()).toList(); } - if (this.teams != null) { - data['teams'] = this.teams!.map((v) => v.toJson()).toList(); + if (teams != null) { + data['teams'] = teams!.map((v) => v.toJson()).toList(); } - if (this.states != null) { - data['states'] = this.states!.map((v) => v.toJson()).toList(); + if (states != null) { + data['states'] = states!.map((v) => v.toJson()).toList(); } - if (this.products != null) { - data['products'] = this.products!.map((v) => v.toJson()).toList(); + if (products != null) { + data['products'] = products!.map((v) => v.toJson()).toList(); } - data['salutation'] = this.salutation; - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['salutation'] = salutation; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -94,12 +95,13 @@ class Employees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class Sources { String? id; String? name; @@ -112,9 +114,9 @@ class Sources { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -131,9 +133,9 @@ class Teams { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -150,9 +152,9 @@ class States { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -169,9 +171,9 @@ class Products { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/crmModels/crmPendingTasksResponse.dart b/lib/Models/crmModels/crmPendingTasksResponse.dart index a81fa9c..7253ab6 100644 --- a/lib/Models/crmModels/crmPendingTasksResponse.dart +++ b/lib/Models/crmModels/crmPendingTasksResponse.dart @@ -9,7 +9,7 @@ class crmPendingTasksResponse { if (json['pending_tasks'] != null) { pendingTasks = []; json['pending_tasks'].forEach((v) { - pendingTasks!.add(new PendingTasks.fromJson(v)); + pendingTasks!.add(PendingTasks.fromJson(v)); }); } error = json['error']; @@ -17,13 +17,12 @@ class crmPendingTasksResponse { } Map toJson() { - final Map data = new Map(); - if (this.pendingTasks != null) { - data['pending_tasks'] = - this.pendingTasks!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (pendingTasks != null) { + data['pending_tasks'] = pendingTasks!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -39,16 +38,17 @@ class PendingTasks { String? lempid; String? aid; - PendingTasks( - {this.conmob, - this.aname, - this.appdate, - this.atype, - this.anote, - this.leadid, - this.lstatus, - this.lempid, - this.aid}); + PendingTasks({ + this.conmob, + this.aname, + this.appdate, + this.atype, + this.anote, + this.leadid, + this.lstatus, + this.lempid, + this.aid, + }); PendingTasks.fromJson(Map json) { conmob = json['conmob']; @@ -63,16 +63,16 @@ class PendingTasks { } Map toJson() { - final Map data = new Map(); - data['conmob'] = this.conmob; - data['aname'] = this.aname; - data['appdate'] = this.appdate; - data['atype'] = this.atype; - data['anote'] = this.anote; - data['leadid'] = this.leadid; - data['lstatus'] = this.lstatus; - data['lempid'] = this.lempid; - data['aid'] = this.aid; + final Map data = {}; + data['conmob'] = conmob; + data['aname'] = aname; + data['appdate'] = appdate; + data['atype'] = atype; + data['anote'] = anote; + data['leadid'] = leadid; + data['lstatus'] = lstatus; + data['lempid'] = lempid; + data['aid'] = aid; return data; } } diff --git a/lib/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart b/lib/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart index b9eefe2..81e4274 100644 --- a/lib/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart +++ b/lib/Models/crmModels/crmProspectDetailsAddFollowUpAppointmentResponse.dart @@ -3,21 +3,25 @@ class crmProspectDetailsAddFollowUpAppointmentResponse { String? error; String? message; - crmProspectDetailsAddFollowUpAppointmentResponse( - {this.redirectTo, this.error, this.message}); + crmProspectDetailsAddFollowUpAppointmentResponse({ + this.redirectTo, + this.error, + this.message, + }); crmProspectDetailsAddFollowUpAppointmentResponse.fromJson( - Map json) { + Map json, + ) { redirectTo = json['redirect_to']; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - data['redirect_to'] = this.redirectTo; - data['error'] = this.error; - data['message'] = this.message; + final Map data = {}; + data['redirect_to'] = redirectTo; + data['error'] = error; + data['message'] = message; return data; } } diff --git a/lib/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart b/lib/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart index 0f2b786..66fdf69 100644 --- a/lib/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart +++ b/lib/Models/crmModels/crmProspectDetailsAddLeadsResponse.dart @@ -5,20 +5,25 @@ class crmProspectDetailsAddLeadsResponse { String? error; String? message; - crmProspectDetailsAddLeadsResponse( - {this.employees, this.products, this.status, this.error, this.message}); + crmProspectDetailsAddLeadsResponse({ + this.employees, + this.products, + this.status, + this.error, + this.message, + }); crmProspectDetailsAddLeadsResponse.fromJson(Map json) { if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new LeadEmployees.fromJson(v)); + employees!.add(LeadEmployees.fromJson(v)); }); } if (json['products'] != null) { products = []; json['products'].forEach((v) { - products!.add(new Products.fromJson(v)); + products!.add(Products.fromJson(v)); }); } status = json['status'].cast(); @@ -27,16 +32,16 @@ class crmProspectDetailsAddLeadsResponse { } Map toJson() { - final Map data = new Map(); - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } - if (this.products != null) { - data['products'] = this.products!.map((v) => v.toJson()).toList(); + if (products != null) { + data['products'] = products!.map((v) => v.toJson()).toList(); } - data['status'] = this.status; - data['error'] = this.error; - data['message'] = this.message; + data['status'] = status; + data['error'] = error; + data['message'] = message; return data; } } @@ -53,12 +58,13 @@ class LeadEmployees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class Products { String? id; String? name; @@ -71,9 +77,9 @@ class Products { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart b/lib/Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart index 6d318b5..3c921eb 100644 --- a/lib/Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart +++ b/lib/Models/crmModels/crmProspectDetailsEditAccountViewResponse.dart @@ -5,40 +5,43 @@ class crmProspectDetailsEditAccountViewResponse { AccountDetails? accountDetails; String? message; - crmProspectDetailsEditAccountViewResponse( - {this.salutations, - this.states, - this.error, - this.accountDetails, - this.message}); + crmProspectDetailsEditAccountViewResponse({ + this.salutations, + this.states, + this.error, + this.accountDetails, + this.message, + }); crmProspectDetailsEditAccountViewResponse.fromJson( - Map json) { + Map json, + ) { salutations = json['salutations'].cast(); if (json['states'] != null) { states = []; json['states'].forEach((v) { - states!.add(new States.fromJson(v)); + states!.add(States.fromJson(v)); }); } error = json['error']; - accountDetails = json['account_details'] != null - ? new AccountDetails.fromJson(json['account_details']) - : null; + accountDetails = + json['account_details'] != null + ? AccountDetails.fromJson(json['account_details']) + : null; message = json['message']; } Map toJson() { - final Map data = new Map(); - data['salutations'] = this.salutations; - if (this.states != null) { - data['states'] = this.states!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['salutations'] = salutations; + if (states != null) { + data['states'] = states!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - if (this.accountDetails != null) { - data['account_details'] = this.accountDetails!.toJson(); + data['error'] = error; + if (accountDetails != null) { + data['account_details'] = accountDetails!.toJson(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -55,9 +58,9 @@ class States { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -84,27 +87,28 @@ class AccountDetails { String? createdDatetime; String? updatedDatetime; - AccountDetails( - {this.id, - this.tempId, - this.ownerId, - this.accManagerId, - this.name, - this.salutationName, - this.subLocality, - this.district, - this.state, - this.pincode, - this.address, - this.date, - this.source, - this.reference, - this.segment, - this.team, - this.gstNumber, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + AccountDetails({ + this.id, + this.tempId, + this.ownerId, + this.accManagerId, + this.name, + this.salutationName, + this.subLocality, + this.district, + this.state, + this.pincode, + this.address, + this.date, + this.source, + this.reference, + this.segment, + this.team, + this.gstNumber, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); AccountDetails.fromJson(Map json) { id = json['id']; @@ -130,27 +134,27 @@ class AccountDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['temp_id'] = this.tempId; - data['owner_id'] = this.ownerId; - data['acc_manager_id'] = this.accManagerId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['sub_locality'] = this.subLocality; - data['district'] = this.district; - data['state'] = this.state; - data['pincode'] = this.pincode; - data['address'] = this.address; - data['date'] = this.date; - data['source'] = this.source; - data['reference'] = this.reference; - data['segment'] = this.segment; - data['team'] = this.team; - data['gst_number'] = this.gstNumber; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['temp_id'] = tempId; + data['owner_id'] = ownerId; + data['acc_manager_id'] = accManagerId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['sub_locality'] = subLocality; + data['district'] = district; + data['state'] = state; + data['pincode'] = pincode; + data['address'] = address; + data['date'] = date; + data['source'] = source; + data['reference'] = reference; + data['segment'] = segment; + data['team'] = team; + data['gst_number'] = gstNumber; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/crmProspectDetailsResponse.dart b/lib/Models/crmModels/crmProspectDetailsResponse.dart index f8227c9..5dda81d 100644 --- a/lib/Models/crmModels/crmProspectDetailsResponse.dart +++ b/lib/Models/crmModels/crmProspectDetailsResponse.dart @@ -8,69 +8,71 @@ class crmProspectDetailsResponse { String? message; String? showTransfeLeadButton; - crmProspectDetailsResponse( - {this.leads, - this.contacts, - this.orders, - this.payments, - this.error, - this.accountDetails, - this.message, - this.showTransfeLeadButton}); + crmProspectDetailsResponse({ + this.leads, + this.contacts, + this.orders, + this.payments, + this.error, + this.accountDetails, + this.message, + this.showTransfeLeadButton, + }); crmProspectDetailsResponse.fromJson(Map json) { if (json['leads'] != null) { leads = []; json['leads'].forEach((v) { - leads!.add(new Leads.fromJson(v)); + leads!.add(Leads.fromJson(v)); }); } if (json['contacts'] != null) { contacts = []; json['contacts'].forEach((v) { - contacts!.add(new Contacts.fromJson(v)); + contacts!.add(Contacts.fromJson(v)); }); } if (json['orders'] != null) { orders = []; json['orders'].forEach((v) { - orders!.add(new Orders.fromJson(v)); + orders!.add(Orders.fromJson(v)); }); } if (json['payments'] != null) { payments = []; json['payments'].forEach((v) { - payments!.add(new Payments.fromJson(v)); + payments!.add(Payments.fromJson(v)); }); } error = json['error']; showTransfeLeadButton = json['show_transfer_lead_button']; - accountDetails = json['account_details'] != null - ? new AccountDetails.fromJson(json['account_details']) - : null; + accountDetails = + json['account_details'] != null + ? AccountDetails.fromJson(json['account_details']) + : null; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.leads != null) { - data['leads'] = this.leads!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (leads != null) { + data['leads'] = leads!.map((v) => v.toJson()).toList(); } - if (this.contacts != null) { - data['contacts'] = this.contacts!.map((v) => v.toJson()).toList(); + if (contacts != null) { + data['contacts'] = contacts!.map((v) => v.toJson()).toList(); } - if (this.orders != null) { - data['orders'] = this.orders!.map((v) => v.toJson()).toList(); + if (orders != null) { + data['orders'] = orders!.map((v) => v.toJson()).toList(); } - if (this.payments != null) { - data['payments'] = this.payments!.map((v) => v.toJson()).toList(); + if (payments != null) { + data['payments'] = payments!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - if (this.accountDetails != null) { - data['account_details'] = this.accountDetails!.toJson(); + data['error'] = error; + if (accountDetails != null) { + data['account_details'] = accountDetails!.toJson(); } - data['message'] = this.message; - data['show_transfer_lead_button'] = this.showTransfeLeadButton; + data['message'] = message; + data['show_transfer_lead_button'] = showTransfeLeadButton; return data; } } @@ -92,22 +94,23 @@ class Leads { String? createdDatetime; String? updatedDatetime; - Leads( - {this.id, - this.ownerId, - this.accId, - this.accManagerId, - this.status, - this.openStatus, - this.date, - this.closeDate, - this.closereason, - this.competitor, - this.orderGainId, - this.loc, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + Leads({ + this.id, + this.ownerId, + this.accId, + this.accManagerId, + this.status, + this.openStatus, + this.date, + this.closeDate, + this.closereason, + this.competitor, + this.orderGainId, + this.loc, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); Leads.fromJson(Map json) { id = json['id']; @@ -128,22 +131,22 @@ class Leads { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['owner_id'] = this.ownerId; - data['acc_id'] = this.accId; - data['acc_manager_id'] = this.accManagerId; - data['status'] = this.status; - data['open_status'] = this.openStatus; - data['date'] = this.date; - data['close_date'] = this.closeDate; - data['closereason'] = this.closereason; - data['competitor'] = this.competitor; - data['order_gain_id'] = this.orderGainId; - data['loc'] = this.loc; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['owner_id'] = ownerId; + data['acc_id'] = accId; + data['acc_manager_id'] = accManagerId; + data['status'] = status; + data['open_status'] = openStatus; + data['date'] = date; + data['close_date'] = closeDate; + data['closereason'] = closereason; + data['competitor'] = competitor; + data['order_gain_id'] = orderGainId; + data['loc'] = loc; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } @@ -164,21 +167,22 @@ class Contacts { String? createdDatetime; String? updatedDatetime; - Contacts( - {this.id, - this.accId, - this.name, - this.salutationName, - this.mob1, - this.mob2, - this.tel, - this.email, - this.type, - this.designation, - this.date, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + Contacts({ + this.id, + this.accId, + this.name, + this.salutationName, + this.mob1, + this.mob2, + this.tel, + this.email, + this.type, + this.designation, + this.date, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); Contacts.fromJson(Map json) { id = json['id']; @@ -198,21 +202,21 @@ class Contacts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['acc_id'] = this.accId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['tel'] = this.tel; - data['email'] = this.email; - data['type'] = this.type; - data['designation'] = this.designation; - data['date'] = this.date; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['acc_id'] = accId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['tel'] = tel; + data['email'] = email; + data['type'] = type; + data['designation'] = designation; + data['date'] = date; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } @@ -266,54 +270,55 @@ class Orders { String? createdDatetime; String? updatedDatetime; - Orders( - {this.id, - this.orderNumber, - this.orderNumberHash, - this.accId, - this.refType, - this.refId, - this.salesPersonEmpId, - this.enteredEmpId, - this.dispatchStateId, - this.dispatchDistrictId, - this.dispatchSubLocationId, - this.dispatchPincode, - this.dispatchAddress, - this.basicAmount, - this.cgstAmount, - this.sgstAmount, - this.igstAmount, - this.paidAmount, - this.totalAmount, - this.status, - this.orderReceivedDate, - this.scheduledDispatchDate, - this.otp, - this.note, - this.poViewFileName, - this.poDirFilePath, - this.unloadingScope, - this.freightScope, - this.erectionScope, - this.saleOrderNumber, - this.invoiceNumber, - this.vehicleNumber, - this.driverName, - this.driverMobileNumber, - this.tpcApplicable, - this.requestedTpcAmount, - this.level1TpcApprovedAmount, - this.level2TpcApprovedAmount, - this.tpcPaymentMode, - this.tpcPaymentReferenceNo, - this.tpcPaymentAttachmentDirFilePath, - this.tpcPaymentAttachementViewFileName, - this.tpcStatus, - this.tpcAgentId, - this.isExist, - this.createdDatetime, - this.updatedDatetime}); + Orders({ + this.id, + this.orderNumber, + this.orderNumberHash, + this.accId, + this.refType, + this.refId, + this.salesPersonEmpId, + this.enteredEmpId, + this.dispatchStateId, + this.dispatchDistrictId, + this.dispatchSubLocationId, + this.dispatchPincode, + this.dispatchAddress, + this.basicAmount, + this.cgstAmount, + this.sgstAmount, + this.igstAmount, + this.paidAmount, + this.totalAmount, + this.status, + this.orderReceivedDate, + this.scheduledDispatchDate, + this.otp, + this.note, + this.poViewFileName, + this.poDirFilePath, + this.unloadingScope, + this.freightScope, + this.erectionScope, + this.saleOrderNumber, + this.invoiceNumber, + this.vehicleNumber, + this.driverName, + this.driverMobileNumber, + this.tpcApplicable, + this.requestedTpcAmount, + this.level1TpcApprovedAmount, + this.level2TpcApprovedAmount, + this.tpcPaymentMode, + this.tpcPaymentReferenceNo, + this.tpcPaymentAttachmentDirFilePath, + this.tpcPaymentAttachementViewFileName, + this.tpcStatus, + this.tpcAgentId, + this.isExist, + this.createdDatetime, + this.updatedDatetime, + }); Orders.fromJson(Map json) { id = json['id']; @@ -357,9 +362,9 @@ class Orders { tpcPaymentMode = json['tpc_payment_mode']; tpcPaymentReferenceNo = json['tpc_payment_reference_no']; tpcPaymentAttachmentDirFilePath = - json['tpc_payment_attachment_dir_file_path']; + json['tpc_payment_attachment_dir_file_path']; tpcPaymentAttachementViewFileName = - json['tpc_payment_attachement_view_file_name']; + json['tpc_payment_attachement_view_file_name']; tpcStatus = json['tpc_status']; tpcAgentId = json['tpc_agent_id']; isExist = json['is_exist']; @@ -368,56 +373,56 @@ class Orders { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['order_number'] = this.orderNumber; - data['order_number_hash'] = this.orderNumberHash; - data['acc_id'] = this.accId; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['sales_person_emp_id'] = this.salesPersonEmpId; - data['entered_emp_id'] = this.enteredEmpId; - data['dispatch_state_id'] = this.dispatchStateId; - data['dispatch_district_id'] = this.dispatchDistrictId; - data['dispatch_sub_location_id'] = this.dispatchSubLocationId; - data['dispatch_pincode'] = this.dispatchPincode; - data['dispatch_address'] = this.dispatchAddress; - data['basic_amount'] = this.basicAmount; - data['cgst_amount'] = this.cgstAmount; - data['sgst_amount'] = this.sgstAmount; - data['igst_amount'] = this.igstAmount; - data['paid_amount'] = this.paidAmount; - data['total_amount'] = this.totalAmount; - data['status'] = this.status; - data['order_received_date'] = this.orderReceivedDate; - data['scheduled_dispatch_date'] = this.scheduledDispatchDate; - data['otp'] = this.otp; - data['note'] = this.note; - data['po_view_file_name'] = this.poViewFileName; - data['po_dir_file_path'] = this.poDirFilePath; - data['unloading_scope'] = this.unloadingScope; - data['freight_scope'] = this.freightScope; - data['erection_scope'] = this.erectionScope; - data['sale_order_number'] = this.saleOrderNumber; - data['invoice_number'] = this.invoiceNumber; - data['vehicle_number'] = this.vehicleNumber; - data['driver_name'] = this.driverName; - data['driver_mobile_number'] = this.driverMobileNumber; - data['tpc_applicable'] = this.tpcApplicable; - data['requested_tpc_amount'] = this.requestedTpcAmount; - data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount; - data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount; - data['tpc_payment_mode'] = this.tpcPaymentMode; - data['tpc_payment_reference_no'] = this.tpcPaymentReferenceNo; + final Map data = {}; + data['id'] = id; + data['order_number'] = orderNumber; + data['order_number_hash'] = orderNumberHash; + data['acc_id'] = accId; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['sales_person_emp_id'] = salesPersonEmpId; + data['entered_emp_id'] = enteredEmpId; + data['dispatch_state_id'] = dispatchStateId; + data['dispatch_district_id'] = dispatchDistrictId; + data['dispatch_sub_location_id'] = dispatchSubLocationId; + data['dispatch_pincode'] = dispatchPincode; + data['dispatch_address'] = dispatchAddress; + data['basic_amount'] = basicAmount; + data['cgst_amount'] = cgstAmount; + data['sgst_amount'] = sgstAmount; + data['igst_amount'] = igstAmount; + data['paid_amount'] = paidAmount; + data['total_amount'] = totalAmount; + data['status'] = status; + data['order_received_date'] = orderReceivedDate; + data['scheduled_dispatch_date'] = scheduledDispatchDate; + data['otp'] = otp; + data['note'] = note; + data['po_view_file_name'] = poViewFileName; + data['po_dir_file_path'] = poDirFilePath; + data['unloading_scope'] = unloadingScope; + data['freight_scope'] = freightScope; + data['erection_scope'] = erectionScope; + data['sale_order_number'] = saleOrderNumber; + data['invoice_number'] = invoiceNumber; + data['vehicle_number'] = vehicleNumber; + data['driver_name'] = driverName; + data['driver_mobile_number'] = driverMobileNumber; + data['tpc_applicable'] = tpcApplicable; + data['requested_tpc_amount'] = requestedTpcAmount; + data['level1_tpc_approved_amount'] = level1TpcApprovedAmount; + data['level2_tpc_approved_amount'] = level2TpcApprovedAmount; + data['tpc_payment_mode'] = tpcPaymentMode; + data['tpc_payment_reference_no'] = tpcPaymentReferenceNo; data['tpc_payment_attachment_dir_file_path'] = - this.tpcPaymentAttachmentDirFilePath; + tpcPaymentAttachmentDirFilePath; data['tpc_payment_attachement_view_file_name'] = - this.tpcPaymentAttachementViewFileName; - data['tpc_status'] = this.tpcStatus; - data['tpc_agent_id'] = this.tpcAgentId; - data['is_exist'] = this.isExist; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + tpcPaymentAttachementViewFileName; + data['tpc_status'] = tpcStatus; + data['tpc_agent_id'] = tpcAgentId; + data['is_exist'] = isExist; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } @@ -448,31 +453,32 @@ class Payments { String? datetime; String? employeeName; - Payments( - {this.id, - this.accId, - this.refType, - this.refId, - this.description, - this.amount, - this.paymentDate, - this.paymentType, - this.refNo, - this.empId, - this.otp, - this.attachment, - this.attachmentDirFilePath, - this.attachmentViewFileName, - this.approvalRemarks, - this.approvalStatus, - this.approvalEmpId, - this.approvalDatetime, - this.status, - this.isExist, - this.delEmpId, - this.delDatetime, - this.datetime, - this.employeeName}); + Payments({ + this.id, + this.accId, + this.refType, + this.refId, + this.description, + this.amount, + this.paymentDate, + this.paymentType, + this.refNo, + this.empId, + this.otp, + this.attachment, + this.attachmentDirFilePath, + this.attachmentViewFileName, + this.approvalRemarks, + this.approvalStatus, + this.approvalEmpId, + this.approvalDatetime, + this.status, + this.isExist, + this.delEmpId, + this.delDatetime, + this.datetime, + this.employeeName, + }); Payments.fromJson(Map json) { id = json['id']; @@ -502,31 +508,31 @@ class Payments { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['acc_id'] = this.accId; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['description'] = this.description; - data['amount'] = this.amount; - data['payment_date'] = this.paymentDate; - data['payment_type'] = this.paymentType; - data['ref_no'] = this.refNo; - data['emp_id'] = this.empId; - data['otp'] = this.otp; - data['attachment'] = this.attachment; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['approval_remarks'] = this.approvalRemarks; - data['approval_status'] = this.approvalStatus; - data['approval_emp_id'] = this.approvalEmpId; - data['approval_datetime'] = this.approvalDatetime; - data['status'] = this.status; - data['is_exist'] = this.isExist; - data['del_emp_id'] = this.delEmpId; - data['del_datetime'] = this.delDatetime; - data['datetime'] = this.datetime; - data['employee_name'] = this.employeeName; + final Map data = {}; + data['id'] = id; + data['acc_id'] = accId; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['description'] = description; + data['amount'] = amount; + data['payment_date'] = paymentDate; + data['payment_type'] = paymentType; + data['ref_no'] = refNo; + data['emp_id'] = empId; + data['otp'] = otp; + data['attachment'] = attachment; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['approval_remarks'] = approvalRemarks; + data['approval_status'] = approvalStatus; + data['approval_emp_id'] = approvalEmpId; + data['approval_datetime'] = approvalDatetime; + data['status'] = status; + data['is_exist'] = isExist; + data['del_emp_id'] = delEmpId; + data['del_datetime'] = delDatetime; + data['datetime'] = datetime; + data['employee_name'] = employeeName; return data; } } @@ -556,30 +562,31 @@ class AccountDetails { String? accManager; String? owner; - AccountDetails( - {this.id, - this.tempId, - this.ownerId, - this.accManagerId, - this.name, - this.salutationName, - this.subLocality, - this.district, - this.state, - this.pincode, - this.address, - this.date, - this.source, - this.reference, - this.segment, - this.team, - this.gstNumber, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.aage, - this.accManager, - this.owner}); + AccountDetails({ + this.id, + this.tempId, + this.ownerId, + this.accManagerId, + this.name, + this.salutationName, + this.subLocality, + this.district, + this.state, + this.pincode, + this.address, + this.date, + this.source, + this.reference, + this.segment, + this.team, + this.gstNumber, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.aage, + this.accManager, + this.owner, + }); AccountDetails.fromJson(Map json) { id = json['id']; @@ -608,30 +615,30 @@ class AccountDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['temp_id'] = this.tempId; - data['owner_id'] = this.ownerId; - data['acc_manager_id'] = this.accManagerId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['sub_locality'] = this.subLocality; - data['district'] = this.district; - data['state'] = this.state; - data['pincode'] = this.pincode; - data['address'] = this.address; - data['date'] = this.date; - data['source'] = this.source; - data['reference'] = this.reference; - data['segment'] = this.segment; - data['team'] = this.team; - data['gst_number'] = this.gstNumber; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['aage'] = this.aage; - data['acc_manager'] = this.accManager; - data['owner'] = this.owner; + final Map data = {}; + data['id'] = id; + data['temp_id'] = tempId; + data['owner_id'] = ownerId; + data['acc_manager_id'] = accManagerId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['sub_locality'] = subLocality; + data['district'] = district; + data['state'] = state; + data['pincode'] = pincode; + data['address'] = address; + data['date'] = date; + data['source'] = source; + data['reference'] = reference; + data['segment'] = segment; + data['team'] = team; + data['gst_number'] = gstNumber; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['aage'] = aage; + data['acc_manager'] = accManager; + data['owner'] = owner; return data; } } diff --git a/lib/Models/crmModels/crmSelectedProductDetailsResponse.dart b/lib/Models/crmModels/crmSelectedProductDetailsResponse.dart index 41b8177..c981b00 100644 --- a/lib/Models/crmModels/crmSelectedProductDetailsResponse.dart +++ b/lib/Models/crmModels/crmSelectedProductDetailsResponse.dart @@ -3,21 +3,26 @@ class crmSelectedProductDetailsResponse { String? error; String? message; - crmSelectedProductDetailsResponse({this.productsData, this.error, this.message}); + crmSelectedProductDetailsResponse({ + this.productsData, + this.error, + this.message, + }); crmSelectedProductDetailsResponse.fromJson(Map json) { - productsData = json['data'] != null ? new ProductsData.fromJson(json['data']) : null; + productsData = + json['data'] != null ? ProductsData.fromJson(json['data']) : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.productsData != null) { - data['data'] = this.productsData!.toJson(); + final Map data = {}; + if (productsData != null) { + data['data'] = productsData!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -39,22 +44,23 @@ class ProductsData { String? createdDatetime; String? updatedDatetime; - ProductsData( - {this.id, - this.name, - this.application, - this.rating, - this.ratingKw, - this.ordStatus, - this.description, - this.price, - this.createdOn, - this.empId, - this.materialMasterId, - this.isGenerator, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + ProductsData({ + this.id, + this.name, + this.application, + this.rating, + this.ratingKw, + this.ordStatus, + this.description, + this.price, + this.createdOn, + this.empId, + this.materialMasterId, + this.isGenerator, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); ProductsData.fromJson(Map json) { id = json['id']; @@ -75,22 +81,22 @@ class ProductsData { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['application'] = this.application; - data['rating'] = this.rating; - data['rating_kw'] = this.ratingKw; - data['ord_status'] = this.ordStatus; - data['description'] = this.description; - data['price'] = this.price; - data['created_on'] = this.createdOn; - data['emp_id'] = this.empId; - data['material_master_id'] = this.materialMasterId; - data['is_generator'] = this.isGenerator; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['application'] = application; + data['rating'] = rating; + data['rating_kw'] = ratingKw; + data['ord_status'] = ordStatus; + data['description'] = description; + data['price'] = price; + data['created_on'] = createdOn; + data['emp_id'] = empId; + data['material_master_id'] = materialMasterId; + data['is_generator'] = isGenerator; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/crmModels/crmUniversalSearchResponse.dart b/lib/Models/crmModels/crmUniversalSearchResponse.dart index c193268..42d26c4 100644 --- a/lib/Models/crmModels/crmUniversalSearchResponse.dart +++ b/lib/Models/crmModels/crmUniversalSearchResponse.dart @@ -5,26 +5,31 @@ class crmUniversalSearchResponse { String? error; String? message; - crmUniversalSearchResponse( - {this.accounts, this.enquires, this.leads, this.error, this.message}); + crmUniversalSearchResponse({ + this.accounts, + this.enquires, + this.leads, + this.error, + this.message, + }); crmUniversalSearchResponse.fromJson(Map json) { if (json['accounts'] != null) { accounts = []; json['accounts'].forEach((v) { - accounts!.add(new Accounts.fromJson(v)); + accounts!.add(Accounts.fromJson(v)); }); } if (json['enquires'] != null) { enquires = []; json['enquires'].forEach((v) { - enquires!.add(new Enquires.fromJson(v)); + enquires!.add(Enquires.fromJson(v)); }); } if (json['leads'] != null) { leads = []; json['leads'].forEach((v) { - leads!.add(new Leads.fromJson(v)); + leads!.add(Leads.fromJson(v)); }); } error = json['error']; @@ -32,18 +37,18 @@ class crmUniversalSearchResponse { } Map toJson() { - final Map data = new Map(); - if (this.accounts != null) { - data['accounts'] = this.accounts!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accounts != null) { + data['accounts'] = accounts!.map((v) => v.toJson()).toList(); } - if (this.enquires != null) { - data['enquires'] = this.enquires!.map((v) => v.toJson()).toList(); + if (enquires != null) { + data['enquires'] = enquires!.map((v) => v.toJson()).toList(); } - if (this.leads != null) { - data['leads'] = this.leads!.map((v) => v.toJson()).toList(); + if (leads != null) { + data['leads'] = leads!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -56,13 +61,14 @@ class Accounts { String? conmob; String? aaddress; - Accounts( - {this.aid, - this.aname, - this.accman, - this.conper, - this.conmob, - this.aaddress}); + Accounts({ + this.aid, + this.aname, + this.accman, + this.conper, + this.conmob, + this.aaddress, + }); Accounts.fromJson(Map json) { aid = json['aid']; @@ -74,13 +80,13 @@ class Accounts { } Map toJson() { - final Map data = new Map(); - data['aid'] = this.aid; - data['aname'] = this.aname; - data['accman'] = this.accman; - data['conper'] = this.conper; - data['conmob'] = this.conmob; - data['aaddress'] = this.aaddress; + final Map data = {}; + data['aid'] = aid; + data['aname'] = aname; + data['accman'] = accman; + data['conper'] = conper; + data['conmob'] = conmob; + data['aaddress'] = aaddress; return data; } } @@ -118,38 +124,39 @@ class Enquires { String? updatedDatetime; String? refName; - Enquires( - {this.id, - this.refType, - this.refId, - this.sourceId, - this.referenceId, - this.companyId, - this.name, - this.companyName, - this.mobile, - this.altMobile, - this.emailId, - this.country, - this.state, - this.district, - this.subLocation, - this.address, - this.product, - this.requirement, - this.extraInfo, - this.feedbackStatus, - this.enquiryManagerEmpId, - this.openStatus, - this.closingReasonId, - this.closingLeadId, - this.closingEmpId, - this.closingDatetime, - this.enteredEmpId, - this.isExist, - this.createdDatetime, - this.updatedDatetime, - this.refName}); + Enquires({ + this.id, + this.refType, + this.refId, + this.sourceId, + this.referenceId, + this.companyId, + this.name, + this.companyName, + this.mobile, + this.altMobile, + this.emailId, + this.country, + this.state, + this.district, + this.subLocation, + this.address, + this.product, + this.requirement, + this.extraInfo, + this.feedbackStatus, + this.enquiryManagerEmpId, + this.openStatus, + this.closingReasonId, + this.closingLeadId, + this.closingEmpId, + this.closingDatetime, + this.enteredEmpId, + this.isExist, + this.createdDatetime, + this.updatedDatetime, + this.refName, + }); Enquires.fromJson(Map json) { id = json['id']; @@ -186,38 +193,38 @@ class Enquires { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['source_id'] = this.sourceId; - data['reference_id'] = this.referenceId; - data['company_id'] = this.companyId; - data['name'] = this.name; - data['company_name'] = this.companyName; - data['mobile'] = this.mobile; - data['alt_mobile'] = this.altMobile; - data['email_id'] = this.emailId; - data['country'] = this.country; - data['state'] = this.state; - data['district'] = this.district; - data['sub_location'] = this.subLocation; - data['address'] = this.address; - data['product'] = this.product; - data['requirement'] = this.requirement; - data['extra_info'] = this.extraInfo; - data['feedback_status'] = this.feedbackStatus; - data['enquiry_manager_emp_id'] = this.enquiryManagerEmpId; - data['open_status'] = this.openStatus; - data['closing_reason_id'] = this.closingReasonId; - data['closing_lead_id'] = this.closingLeadId; - data['closing_emp_id'] = this.closingEmpId; - data['closing_datetime'] = this.closingDatetime; - data['entered_emp_id'] = this.enteredEmpId; - data['is_exist'] = this.isExist; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['ref_name'] = this.refName; + final Map data = {}; + data['id'] = id; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['source_id'] = sourceId; + data['reference_id'] = referenceId; + data['company_id'] = companyId; + data['name'] = name; + data['company_name'] = companyName; + data['mobile'] = mobile; + data['alt_mobile'] = altMobile; + data['email_id'] = emailId; + data['country'] = country; + data['state'] = state; + data['district'] = district; + data['sub_location'] = subLocation; + data['address'] = address; + data['product'] = product; + data['requirement'] = requirement; + data['extra_info'] = extraInfo; + data['feedback_status'] = feedbackStatus; + data['enquiry_manager_emp_id'] = enquiryManagerEmpId; + data['open_status'] = openStatus; + data['closing_reason_id'] = closingReasonId; + data['closing_lead_id'] = closingLeadId; + data['closing_emp_id'] = closingEmpId; + data['closing_datetime'] = closingDatetime; + data['entered_emp_id'] = enteredEmpId; + data['is_exist'] = isExist; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['ref_name'] = refName; return data; } } @@ -230,13 +237,14 @@ class Leads { String? conmob; String? aaddress; - Leads( - {this.lid, - this.aname, - this.accman, - this.conper, - this.conmob, - this.aaddress}); + Leads({ + this.lid, + this.aname, + this.accman, + this.conper, + this.conmob, + this.aaddress, + }); Leads.fromJson(Map json) { lid = json['lid']; @@ -248,13 +256,13 @@ class Leads { } Map toJson() { - final Map data = new Map(); - data['lid'] = this.lid; - data['aname'] = this.aname; - data['accman'] = this.accman; - data['conper'] = this.conper; - data['conmob'] = this.conmob; - data['aaddress'] = this.aaddress; + final Map data = {}; + data['lid'] = lid; + data['aname'] = aname; + data['accman'] = accman; + data['conper'] = conper; + data['conmob'] = conmob; + data['aaddress'] = aaddress; return data; } } diff --git a/lib/Models/financeModels/addDirectPaymentResponse.dart b/lib/Models/financeModels/addDirectPaymentResponse.dart index 491003a..5865431 100644 --- a/lib/Models/financeModels/addDirectPaymentResponse.dart +++ b/lib/Models/financeModels/addDirectPaymentResponse.dart @@ -5,30 +5,31 @@ class addDirectPaymentResponse { String? error; String? message; - addDirectPaymentResponse( - {this.accounts, - this.paymentAccounts, - this.paymentModes, - this.error, - this.message}); + addDirectPaymentResponse({ + this.accounts, + this.paymentAccounts, + this.paymentModes, + this.error, + this.message, + }); addDirectPaymentResponse.fromJson(Map json) { if (json['accounts'] != null) { accounts = []; json['accounts'].forEach((v) { - accounts!.add(new DirectAccounts.fromJson(v)); + accounts!.add(DirectAccounts.fromJson(v)); }); } if (json['payment_accounts'] != null) { paymentAccounts = []; json['payment_accounts'].forEach((v) { - paymentAccounts!.add(new DirectPaymentAccounts.fromJson(v)); + paymentAccounts!.add(DirectPaymentAccounts.fromJson(v)); }); } if (json['payment_modes'] != null) { paymentModes = []; json['payment_modes'].forEach((v) { - paymentModes!.add(new DirectPaymentModes.fromJson(v)); + paymentModes!.add(DirectPaymentModes.fromJson(v)); }); } error = json['error']; @@ -36,20 +37,19 @@ class addDirectPaymentResponse { } Map toJson() { - final Map data = new Map(); - if (this.accounts != null) { - data['accounts'] = this.accounts!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accounts != null) { + data['accounts'] = accounts!.map((v) => v.toJson()).toList(); } - if (this.paymentAccounts != null) { + if (paymentAccounts != null) { data['payment_accounts'] = - this.paymentAccounts!.map((v) => v.toJson()).toList(); + paymentAccounts!.map((v) => v.toJson()).toList(); } - if (this.paymentModes != null) { - data['payment_modes'] = - this.paymentModes!.map((v) => v.toJson()).toList(); + if (paymentModes != null) { + data['payment_modes'] = paymentModes!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -66,12 +66,13 @@ class DirectAccounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class DirectPaymentAccounts { String? id; String? name; @@ -84,12 +85,13 @@ class DirectPaymentAccounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class DirectPaymentModes { String? id; String? name; @@ -102,9 +104,9 @@ class DirectPaymentModes { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/financeModels/addPaymentRequestionResponse.dart b/lib/Models/financeModels/addPaymentRequestionResponse.dart index e1e0e25..34890b4 100644 --- a/lib/Models/financeModels/addPaymentRequestionResponse.dart +++ b/lib/Models/financeModels/addPaymentRequestionResponse.dart @@ -6,60 +6,55 @@ class addPaymentRequestionResponse { List? requestingPurposes; List? employees; - - - addPaymentRequestionResponse( - { this.error, - this.message, - this.accounts, - this.paymentModes, - this.requestingPurposes, - this.employees - }); + addPaymentRequestionResponse({ + this.error, + this.message, + this.accounts, + this.paymentModes, + this.requestingPurposes, + this.employees, + }); addPaymentRequestionResponse.fromJson(Map json) { - if (json['accounts'] != null) { accounts = []; json['accounts'].forEach((v) { - accounts!.add(new Accounts.fromJson(v)); + accounts!.add(Accounts.fromJson(v)); }); } if (json['payment_modes'] != null) { paymentModes = []; json['payment_modes'].forEach((v) { - paymentModes!.add(new PaymentModes.fromJson(v)); + paymentModes!.add(PaymentModes.fromJson(v)); }); } error = json['error']; message = json['message']; - if(json['requesting_purposes']!=null){ + if (json['requesting_purposes'] != null) { requestingPurposes = json['requesting_purposes'].cast(); } if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new Employees.fromJson(v)); + employees!.add(Employees.fromJson(v)); }); } - } Map toJson() { - final Map data = new Map(); + final Map data = {}; - if (this.accounts != null) { - data['accounts'] = this.accounts!.map((v) => v.toJson()).toList(); + if (accounts != null) { + data['accounts'] = accounts!.map((v) => v.toJson()).toList(); } - if (this.paymentModes != null) { - data['payment_modes'] = - this.paymentModes!.map((v) => v.toJson()).toList(); + if (paymentModes != null) { + data['payment_modes'] = paymentModes!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['requesting_purposes'] = this.requestingPurposes; - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + data['error'] = error; + data['message'] = message; + data['requesting_purposes'] = requestingPurposes; + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } return data; } @@ -77,12 +72,13 @@ class Accounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class PaymentModes { String? id; String? name; @@ -95,12 +91,13 @@ class PaymentModes { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class Employees { String? id; String? name; @@ -113,9 +110,9 @@ class Employees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/financeModels/addReceiptPaymentResponse.dart b/lib/Models/financeModels/addReceiptPaymentResponse.dart index 726f2ea..7f9f066 100644 --- a/lib/Models/financeModels/addReceiptPaymentResponse.dart +++ b/lib/Models/financeModels/addReceiptPaymentResponse.dart @@ -5,30 +5,31 @@ class addReceiptPaymentResponse { String? error; String? message; - addReceiptPaymentResponse( - {this.accounts, - this.receiptAccounts, - this.paymentModes, - this.error, - this.message}); + addReceiptPaymentResponse({ + this.accounts, + this.receiptAccounts, + this.paymentModes, + this.error, + this.message, + }); addReceiptPaymentResponse.fromJson(Map json) { if (json['accounts'] != null) { accounts = []; json['accounts'].forEach((v) { - accounts!.add(new Accounts.fromJson(v)); + accounts!.add(Accounts.fromJson(v)); }); } if (json['receipt_accounts'] != null) { receiptAccounts = []; json['receipt_accounts'].forEach((v) { - receiptAccounts!.add(new ReceiptAccounts.fromJson(v)); + receiptAccounts!.add(ReceiptAccounts.fromJson(v)); }); } if (json['payment_modes'] != null) { paymentModes = []; json['payment_modes'].forEach((v) { - paymentModes!.add(new PaymentModes.fromJson(v)); + paymentModes!.add(PaymentModes.fromJson(v)); }); } error = json['error']; @@ -36,20 +37,19 @@ class addReceiptPaymentResponse { } Map toJson() { - final Map data = new Map(); - if (this.accounts != null) { - data['accounts'] = this.accounts!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accounts != null) { + data['accounts'] = accounts!.map((v) => v.toJson()).toList(); } - if (this.receiptAccounts != null) { + if (receiptAccounts != null) { data['receipt_accounts'] = - this.receiptAccounts!.map((v) => v.toJson()).toList(); + receiptAccounts!.map((v) => v.toJson()).toList(); } - if (this.paymentModes != null) { - data['payment_modes'] = - this.paymentModes!.map((v) => v.toJson()).toList(); + if (paymentModes != null) { + data['payment_modes'] = paymentModes!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -66,12 +66,13 @@ class Accounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class ReceiptAccounts { String? id; String? name; @@ -84,12 +85,13 @@ class ReceiptAccounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class PaymentModes { String? id; String? name; @@ -102,9 +104,9 @@ class PaymentModes { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/financeModels/financeDashboardPagesResponse.dart b/lib/Models/financeModels/financeDashboardPagesResponse.dart index 2a15428..87d6230 100644 --- a/lib/Models/financeModels/financeDashboardPagesResponse.dart +++ b/lib/Models/financeModels/financeDashboardPagesResponse.dart @@ -3,28 +3,31 @@ class financeDashboardPagesResponse { List? pagesAccessible; String? message; - financeDashboardPagesResponse( - {this.error, this.pagesAccessible, this.message}); + financeDashboardPagesResponse({ + this.error, + this.pagesAccessible, + this.message, + }); financeDashboardPagesResponse.fromJson(Map json) { error = json['error']; if (json['pages_accessible'] != null) { pagesAccessible = []; json['pages_accessible'].forEach((v) { - pagesAccessible!.add(new PagesAccessible.fromJson(v)); + pagesAccessible!.add(PagesAccessible.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.pagesAccessible != null) { + final Map data = {}; + data['error'] = error; + if (pagesAccessible != null) { data['pages_accessible'] = - this.pagesAccessible!.map((v) => v.toJson()).toList(); + pagesAccessible!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -43,10 +46,10 @@ class PagesAccessible { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['page_name'] = this.pageName; - data['mode'] = this.mode; + final Map data = {}; + data['id'] = id; + data['page_name'] = pageName; + data['mode'] = mode; return data; } } diff --git a/lib/Models/financeModels/paymentRequesitionListsResponse.dart b/lib/Models/financeModels/paymentRequesitionListsResponse.dart index 0ba032a..307a476 100644 --- a/lib/Models/financeModels/paymentRequesitionListsResponse.dart +++ b/lib/Models/financeModels/paymentRequesitionListsResponse.dart @@ -3,14 +3,17 @@ class paymentRequesitionListsResponse { String? error; String? message; - paymentRequesitionListsResponse( - {this.requistionList, this.error, this.message}); + paymentRequesitionListsResponse({ + this.requistionList, + this.error, + this.message, + }); paymentRequesitionListsResponse.fromJson(Map json) { if (json['requistion_list'] != null) { requistionList = []; json['requistion_list'].forEach((v) { - requistionList!.add(new RequistionList.fromJson(v)); + requistionList!.add(RequistionList.fromJson(v)); }); } error = json['error']; @@ -18,13 +21,12 @@ class paymentRequesitionListsResponse { } Map toJson() { - final Map data = new Map(); - if (this.requistionList != null) { - data['requistion_list'] = - this.requistionList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (requistionList != null) { + data['requistion_list'] = requistionList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -53,29 +55,30 @@ class RequistionList { String? proposedAccount; String? proposedAccountId; - RequistionList( - {this.id, - this.isProcessedPaymentRequest, - this.accountId, - this.accountName, - this.branch, - this.requestingPurpose, - this.transDis, - this.description, - this.amount, - this.requestMode, - this.status, - this.createdEmployee, - this.level1Employee, - this.level2Employee, - this.level1ApprovalRemarks, - this.level2ApprovalRemarks, - this.attachmentViewFileName, - this.attachmentDirFilePath, - this.date, - this.createdDatetime, - this.proposedAccount, - this.proposedAccountId}); + RequistionList({ + this.id, + this.isProcessedPaymentRequest, + this.accountId, + this.accountName, + this.branch, + this.requestingPurpose, + this.transDis, + this.description, + this.amount, + this.requestMode, + this.status, + this.createdEmployee, + this.level1Employee, + this.level2Employee, + this.level1ApprovalRemarks, + this.level2ApprovalRemarks, + this.attachmentViewFileName, + this.attachmentDirFilePath, + this.date, + this.createdDatetime, + this.proposedAccount, + this.proposedAccountId, + }); RequistionList.fromJson(Map json) { id = json['id']; @@ -103,29 +106,29 @@ class RequistionList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['is_processed_payment_request'] = this.isProcessedPaymentRequest; - data['account_id'] = this.accountId; - data['account_name'] = this.accountName; - data['branch'] = this.branch; - data['requesting_purpose'] = this.requestingPurpose; - data['trans_dis'] = this.transDis; - data['description'] = this.description; - data['amount'] = this.amount; - data['request_mode'] = this.requestMode; - data['status'] = this.status; - data['created_employee'] = this.createdEmployee; - data['level1_employee'] = this.level1Employee; - data['level2_employee'] = this.level2Employee; - data['level_1_approval_remarks'] = this.level1ApprovalRemarks; - data['level_2_approval_remarks'] = this.level2ApprovalRemarks; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['date'] = this.date; - data['created_datetime'] = this.createdDatetime; - data['proposed_account'] = this.proposedAccount; - data['proposed_account_id'] = this.proposedAccountId; + final Map data = {}; + data['id'] = id; + data['is_processed_payment_request'] = isProcessedPaymentRequest; + data['account_id'] = accountId; + data['account_name'] = accountName; + data['branch'] = branch; + data['requesting_purpose'] = requestingPurpose; + data['trans_dis'] = transDis; + data['description'] = description; + data['amount'] = amount; + data['request_mode'] = requestMode; + data['status'] = status; + data['created_employee'] = createdEmployee; + data['level1_employee'] = level1Employee; + data['level2_employee'] = level2Employee; + data['level_1_approval_remarks'] = level1ApprovalRemarks; + data['level_2_approval_remarks'] = level2ApprovalRemarks; + data['attachment_view_file_name'] = attachmentViewFileName; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['date'] = date; + data['created_datetime'] = createdDatetime; + data['proposed_account'] = proposedAccount; + data['proposed_account_id'] = proposedAccountId; return data; } } diff --git a/lib/Models/financeModels/paymentRequestionBankDetailsResponse.dart b/lib/Models/financeModels/paymentRequestionBankDetailsResponse.dart index e2c69e2..98ddc91 100644 --- a/lib/Models/financeModels/paymentRequestionBankDetailsResponse.dart +++ b/lib/Models/financeModels/paymentRequestionBankDetailsResponse.dart @@ -3,23 +3,28 @@ class paymentRequestionBankDetailsResponse { String? error; String? message; - paymentRequestionBankDetailsResponse({this.getDetails, this.error, this.message}); + paymentRequestionBankDetailsResponse({ + this.getDetails, + this.error, + this.message, + }); paymentRequestionBankDetailsResponse.fromJson(Map json) { - getDetails = json['get_details'] != null - ? new GetDetails.fromJson(json['get_details']) - : null; + getDetails = + json['get_details'] != null + ? GetDetails.fromJson(json['get_details']) + : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.getDetails != null) { - data['get_details'] = this.getDetails!.toJson(); + final Map data = {}; + if (getDetails != null) { + data['get_details'] = getDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -34,15 +39,16 @@ class GetDetails { String? bankAccountNumber; String? bankUpiId; - GetDetails( - {this.id, - this.name, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.bankUpiId}); + GetDetails({ + this.id, + this.name, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.bankUpiId, + }); GetDetails.fromJson(Map json) { id = json['id']; @@ -56,15 +62,15 @@ class GetDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; return data; } } diff --git a/lib/Models/financeModels/paymentRequisitionDetailsResponse.dart b/lib/Models/financeModels/paymentRequisitionDetailsResponse.dart index 5d8b682..cdb7827 100644 --- a/lib/Models/financeModels/paymentRequisitionDetailsResponse.dart +++ b/lib/Models/financeModels/paymentRequisitionDetailsResponse.dart @@ -4,30 +4,36 @@ class paymentRequisitionDetailsResponse { String? error; String? message; - paymentRequisitionDetailsResponse( - {this.requestDetails, this.paymentDetails, this.error, this.message}); + paymentRequisitionDetailsResponse({ + this.requestDetails, + this.paymentDetails, + this.error, + this.message, + }); paymentRequisitionDetailsResponse.fromJson(Map json) { - requestDetails = json['request_details'] != null - ? new RequestDetails.fromJson(json['request_details']) - : null; - paymentDetails = json['payment_details'] != null - ? new PaymentDetails.fromJson(json['payment_details']) - : null; + requestDetails = + json['request_details'] != null + ? RequestDetails.fromJson(json['request_details']) + : null; + paymentDetails = + json['payment_details'] != null + ? PaymentDetails.fromJson(json['payment_details']) + : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.requestDetails != null) { - data['request_details'] = this.requestDetails!.toJson(); + final Map data = {}; + if (requestDetails != null) { + data['request_details'] = requestDetails!.toJson(); } - if (this.paymentDetails != null) { - data['payment_details'] = this.paymentDetails!.toJson(); + if (paymentDetails != null) { + data['payment_details'] = paymentDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -65,7 +71,8 @@ class RequestDetails { String? bankAccountNumber; String? bankUpiId; - RequestDetails({this.id, + RequestDetails({ + this.id, this.isProcessedPaymentRequest, this.accountId, this.accountName, @@ -133,38 +140,38 @@ class RequestDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['is_processed_payment_request'] = this.isProcessedPaymentRequest; - data['account_id'] = this.accountId; - data['account_name'] = this.accountName; - data['branch'] = this.branch; - data['requesting_purpose'] = this.requestingPurpose; - data['trans_dis'] = this.transDis; - data['description'] = this.description; - data['amount'] = this.amount; - data['formatted_amount'] = this.formattedAmount; - data['requested_amount'] = this.requestedAmount; - data['request_mode'] = this.requestMode; - data['status'] = this.status; - data['created_employee'] = this.createdEmployee; - data['level1_employee'] = this.level1Employee; - data['level2_employee'] = this.level2Employee; - data['level_1_approval_remarks'] = this.level1ApprovalRemarks; - data['level_2_approval_remarks'] = this.level2ApprovalRemarks; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['date'] = this.date; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['proposed_account'] = this.proposedAccount; - data['proposed_account_id'] = this.proposedAccountId; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchname; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; + final Map data = {}; + data['id'] = id; + data['is_processed_payment_request'] = isProcessedPaymentRequest; + data['account_id'] = accountId; + data['account_name'] = accountName; + data['branch'] = branch; + data['requesting_purpose'] = requestingPurpose; + data['trans_dis'] = transDis; + data['description'] = description; + data['amount'] = amount; + data['formatted_amount'] = formattedAmount; + data['requested_amount'] = requestedAmount; + data['request_mode'] = requestMode; + data['status'] = status; + data['created_employee'] = createdEmployee; + data['level1_employee'] = level1Employee; + data['level2_employee'] = level2Employee; + data['level_1_approval_remarks'] = level1ApprovalRemarks; + data['level_2_approval_remarks'] = level2ApprovalRemarks; + data['attachment_view_file_name'] = attachmentViewFileName; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['date'] = date; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['proposed_account'] = proposedAccount; + data['proposed_account_id'] = proposedAccountId; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchname; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; return data; } } @@ -199,7 +206,8 @@ class PaymentDetails { String? paymentEmployeeName; String? mode; - PaymentDetails({this.id, + PaymentDetails({ + this.id, this.refType, this.refId, this.paymentAccountId, @@ -226,7 +234,8 @@ class PaymentDetails { this.accountName, this.paymentAccountName, this.paymentEmployeeName, - this.mode}); + this.mode, + }); PaymentDetails.fromJson(Map json) { id = json['id']; @@ -260,34 +269,34 @@ class PaymentDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['payment_account_id'] = this.paymentAccountId; - data['account_id'] = this.accountId; - data['payment_mode_id'] = this.paymentModeId; - data['amount'] = this.amount; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['description'] = this.description; - data['payment_reference_number'] = this.paymentReferenceNumber; - data['created_employee_id'] = this.createdEmployeeId; - data['payment_date'] = this.paymentDate; - data['payment_remarks'] = this.paymentRemarks; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['account_name'] = this.accountName; - data['payment_account_name'] = this.paymentAccountName; - data['payment_employee_name'] = this.paymentEmployeeName; - data['mode'] = this.mode; + final Map data = {}; + data['id'] = id; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['payment_account_id'] = paymentAccountId; + data['account_id'] = accountId; + data['payment_mode_id'] = paymentModeId; + data['amount'] = amount; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['description'] = description; + data['payment_reference_number'] = paymentReferenceNumber; + data['created_employee_id'] = createdEmployeeId; + data['payment_date'] = paymentDate; + data['payment_remarks'] = paymentRemarks; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['account_name'] = accountName; + data['payment_account_name'] = paymentAccountName; + data['payment_employee_name'] = paymentEmployeeName; + data['mode'] = mode; return data; } } diff --git a/lib/Models/financeModels/paymentRequisitionPaymentsDetailsResponse.dart b/lib/Models/financeModels/paymentRequisitionPaymentsDetailsResponse.dart index b4b05a9..aa8d3ad 100644 --- a/lib/Models/financeModels/paymentRequisitionPaymentsDetailsResponse.dart +++ b/lib/Models/financeModels/paymentRequisitionPaymentsDetailsResponse.dart @@ -3,25 +3,30 @@ class paymentRequisitionPaymentsDetailsResponse { String? error; String? message; - paymentRequisitionPaymentsDetailsResponse( - {this.paymentDetails, this.error, this.message}); + paymentRequisitionPaymentsDetailsResponse({ + this.paymentDetails, + this.error, + this.message, + }); paymentRequisitionPaymentsDetailsResponse.fromJson( - Map json) { - paymentDetails = json['payment_details'] != null - ? new PaymentDetails.fromJson(json['payment_details']) - : null; + Map json, + ) { + paymentDetails = + json['payment_details'] != null + ? PaymentDetails.fromJson(json['payment_details']) + : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.paymentDetails != null) { - data['payment_details'] = this.paymentDetails!.toJson(); + final Map data = {}; + if (paymentDetails != null) { + data['payment_details'] = paymentDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -55,34 +60,35 @@ class PaymentDetails { String? paymentEmployeeName; String? mode; - PaymentDetails( - {this.id, - this.refType, - this.refId, - this.paymentAccountId, - this.accountId, - this.paymentModeId, - this.amount, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.bankUpiId, - this.attachmentDirFilePath, - this.attachmentViewFileName, - this.description, - this.paymentReferenceNumber, - this.createdEmployeeId, - this.paymentDate, - this.paymentRemarks, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.accountName, - this.paymentAccountName, - this.paymentEmployeeName, - this.mode}); + PaymentDetails({ + this.id, + this.refType, + this.refId, + this.paymentAccountId, + this.accountId, + this.paymentModeId, + this.amount, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.bankUpiId, + this.attachmentDirFilePath, + this.attachmentViewFileName, + this.description, + this.paymentReferenceNumber, + this.createdEmployeeId, + this.paymentDate, + this.paymentRemarks, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.accountName, + this.paymentAccountName, + this.paymentEmployeeName, + this.mode, + }); PaymentDetails.fromJson(Map json) { id = json['id']; @@ -115,34 +121,34 @@ class PaymentDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['payment_account_id'] = this.paymentAccountId; - data['account_id'] = this.accountId; - data['payment_mode_id'] = this.paymentModeId; - data['amount'] = this.amount; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['description'] = this.description; - data['payment_reference_number'] = this.paymentReferenceNumber; - data['created_employee_id'] = this.createdEmployeeId; - data['payment_date'] = this.paymentDate; - data['payment_remarks'] = this.paymentRemarks; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['account_name'] = this.accountName; - data['payment_account_name'] = this.paymentAccountName; - data['payment_employee_name'] = this.paymentEmployeeName; - data['mode'] = this.mode; + final Map data = {}; + data['id'] = id; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['payment_account_id'] = paymentAccountId; + data['account_id'] = accountId; + data['payment_mode_id'] = paymentModeId; + data['amount'] = amount; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['description'] = description; + data['payment_reference_number'] = paymentReferenceNumber; + data['created_employee_id'] = createdEmployeeId; + data['payment_date'] = paymentDate; + data['payment_remarks'] = paymentRemarks; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['account_name'] = accountName; + data['payment_account_name'] = paymentAccountName; + data['payment_employee_name'] = paymentEmployeeName; + data['mode'] = mode; return data; } } diff --git a/lib/Models/financeModels/paymentRequisitionPaymentsListResponse.dart b/lib/Models/financeModels/paymentRequisitionPaymentsListResponse.dart index a5a55cd..4b9a82a 100644 --- a/lib/Models/financeModels/paymentRequisitionPaymentsListResponse.dart +++ b/lib/Models/financeModels/paymentRequisitionPaymentsListResponse.dart @@ -3,14 +3,17 @@ class paymentRequisitionPaymentsListResponse { String? error; String? message; - paymentRequisitionPaymentsListResponse( - {this.paymentsList, this.error, this.message}); + paymentRequisitionPaymentsListResponse({ + this.paymentsList, + this.error, + this.message, + }); paymentRequisitionPaymentsListResponse.fromJson(Map json) { if (json['payments_list'] != null) { paymentsList = []; json['payments_list'].forEach((v) { - paymentsList!.add(new PaymentsList.fromJson(v)); + paymentsList!.add(PaymentsList.fromJson(v)); }); } error = json['error']; @@ -18,13 +21,12 @@ class paymentRequisitionPaymentsListResponse { } Map toJson() { - final Map data = new Map(); - if (this.paymentsList != null) { - data['payments_list'] = - this.paymentsList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (paymentsList != null) { + data['payments_list'] = paymentsList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -52,28 +54,29 @@ class PaymentsList { String? accountId; String? paymentAccountId; - PaymentsList( - {this.id, - this.refType, - this.amount, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.bankUpiId, - this.attachmentDirFilePath, - this.attachmentViewFileName, - this.description, - this.paymentReferenceNumber, - this.paymentDate, - this.receipientAccount, - this.payAccount, - this.requestMode, - this.createdEmployee, - this.createdDatetime, - this.accountId, - this.paymentAccountId}); + PaymentsList({ + this.id, + this.refType, + this.amount, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.bankUpiId, + this.attachmentDirFilePath, + this.attachmentViewFileName, + this.description, + this.paymentReferenceNumber, + this.paymentDate, + this.receipientAccount, + this.payAccount, + this.requestMode, + this.createdEmployee, + this.createdDatetime, + this.accountId, + this.paymentAccountId, + }); PaymentsList.fromJson(Map json) { id = json['id']; @@ -100,28 +103,28 @@ class PaymentsList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['ref_type'] = this.refType; - data['amount'] = this.amount; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['description'] = this.description; - data['payment_reference_number'] = this.paymentReferenceNumber; - data['payment_date'] = this.paymentDate; - data['receipient_account'] = this.receipientAccount; - data['pay_account'] = this.payAccount; - data['request_mode'] = this.requestMode; - data['created_employee'] = this.createdEmployee; - data['created_datetime'] = this.createdDatetime; - data['account_id'] = this.accountId; - data['payment_account_id'] = this.paymentAccountId; + final Map data = {}; + data['id'] = id; + data['ref_type'] = refType; + data['amount'] = amount; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['description'] = description; + data['payment_reference_number'] = paymentReferenceNumber; + data['payment_date'] = paymentDate; + data['receipient_account'] = receipientAccount; + data['pay_account'] = payAccount; + data['request_mode'] = requestMode; + data['created_employee'] = createdEmployee; + data['created_datetime'] = createdDatetime; + data['account_id'] = accountId; + data['payment_account_id'] = paymentAccountId; return data; } } diff --git a/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsDetailsResponse.dart b/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsDetailsResponse.dart index 2201ba3..d48027d 100644 --- a/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsDetailsResponse.dart +++ b/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsDetailsResponse.dart @@ -3,25 +3,30 @@ class paymentRequisitionPaymentsReceiptsDetailsResponse { String? error; String? message; - paymentRequisitionPaymentsReceiptsDetailsResponse( - {this.receiptDetails, this.error, this.message}); + paymentRequisitionPaymentsReceiptsDetailsResponse({ + this.receiptDetails, + this.error, + this.message, + }); paymentRequisitionPaymentsReceiptsDetailsResponse.fromJson( - Map json) { - receiptDetails = json['receipt_details'] != null - ? new ReceiptDetails.fromJson(json['receipt_details']) - : null; + Map json, + ) { + receiptDetails = + json['receipt_details'] != null + ? ReceiptDetails.fromJson(json['receipt_details']) + : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.receiptDetails != null) { - data['receipt_details'] = this.receiptDetails!.toJson(); + final Map data = {}; + if (receiptDetails != null) { + data['receipt_details'] = receiptDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -49,28 +54,29 @@ class ReceiptDetails { String? receiptAccountId; String? bankUpiId; - ReceiptDetails( - {this.id, - this.amount, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.attachmentDirFilePath, - this.attachmentViewFileName, - this.accountId, - this.description, - this.paymentReferenceNumber, - this.receiptDate, - this.receipientAccount, - this.payAccount, - this.requestMode, - this.createdEmployee, - this.createdDatetime, - this.updatedDatetime, - this.receiptAccountId, - this.bankUpiId}); + ReceiptDetails({ + this.id, + this.amount, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.attachmentDirFilePath, + this.attachmentViewFileName, + this.accountId, + this.description, + this.paymentReferenceNumber, + this.receiptDate, + this.receipientAccount, + this.payAccount, + this.requestMode, + this.createdEmployee, + this.createdDatetime, + this.updatedDatetime, + this.receiptAccountId, + this.bankUpiId, + }); ReceiptDetails.fromJson(Map json) { id = json['id']; @@ -97,28 +103,28 @@ class ReceiptDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['amount'] = this.amount; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['account_id'] = this.accountId; - data['description'] = this.description; - data['payment_reference_number'] = this.paymentReferenceNumber; - data['receipt_date'] = this.receiptDate; - data['receipient_account'] = this.receipientAccount; - data['pay_account'] = this.payAccount; - data['request_mode'] = this.requestMode; - data['created_employee'] = this.createdEmployee; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['receipt_account_id'] = this.receiptAccountId; - data['bank_upi_id'] =this.bankUpiId; + final Map data = {}; + data['id'] = id; + data['amount'] = amount; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['account_id'] = accountId; + data['description'] = description; + data['payment_reference_number'] = paymentReferenceNumber; + data['receipt_date'] = receiptDate; + data['receipient_account'] = receipientAccount; + data['pay_account'] = payAccount; + data['request_mode'] = requestMode; + data['created_employee'] = createdEmployee; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['receipt_account_id'] = receiptAccountId; + data['bank_upi_id'] = bankUpiId; return data; } } diff --git a/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsListResponse.dart b/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsListResponse.dart index b8dbfb8..aeead19 100644 --- a/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsListResponse.dart +++ b/lib/Models/financeModels/paymentRequisitionPaymentsReceiptsListResponse.dart @@ -3,15 +3,19 @@ class paymentRequisitionPaymentsReceiptsListResponse { String? error; String? message; - paymentRequisitionPaymentsReceiptsListResponse( - {this.receiptsList, this.error, this.message}); + paymentRequisitionPaymentsReceiptsListResponse({ + this.receiptsList, + this.error, + this.message, + }); paymentRequisitionPaymentsReceiptsListResponse.fromJson( - Map json) { + Map json, + ) { if (json['receipts_list'] != null) { receiptsList = []; json['receipts_list'].forEach((v) { - receiptsList!.add(new ReceiptsList.fromJson(v)); + receiptsList!.add(ReceiptsList.fromJson(v)); }); } error = json['error']; @@ -19,13 +23,12 @@ class paymentRequisitionPaymentsReceiptsListResponse { } Map toJson() { - final Map data = new Map(); - if (this.receiptsList != null) { - data['receipts_list'] = - this.receiptsList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (receiptsList != null) { + data['receipts_list'] = receiptsList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -52,27 +55,28 @@ class ReceiptsList { String? updatedDatetime; String? receiptAccountId; - ReceiptsList( - {this.id, - this.amount, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.attachmentDirFilePath, - this.attachmentViewFileName, - this.accountId, - this.description, - this.paymentReferenceNumber, - this.receiptDate, - this.receipientAccount, - this.payAccount, - this.requestMode, - this.createdEmployee, - this.createdDatetime, - this.updatedDatetime, - this.receiptAccountId}); + ReceiptsList({ + this.id, + this.amount, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.attachmentDirFilePath, + this.attachmentViewFileName, + this.accountId, + this.description, + this.paymentReferenceNumber, + this.receiptDate, + this.receipientAccount, + this.payAccount, + this.requestMode, + this.createdEmployee, + this.createdDatetime, + this.updatedDatetime, + this.receiptAccountId, + }); ReceiptsList.fromJson(Map json) { id = json['id']; @@ -98,27 +102,27 @@ class ReceiptsList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['amount'] = this.amount; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['account_id'] = this.accountId; - data['description'] = this.description; - data['payment_reference_number'] = this.paymentReferenceNumber; - data['receipt_date'] = this.receiptDate; - data['receipient_account'] = this.receipientAccount; - data['pay_account'] = this.payAccount; - data['request_mode'] = this.requestMode; - data['created_employee'] = this.createdEmployee; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['receipt_account_id'] = this.receiptAccountId; + final Map data = {}; + data['id'] = id; + data['amount'] = amount; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['account_id'] = accountId; + data['description'] = description; + data['payment_reference_number'] = paymentReferenceNumber; + data['receipt_date'] = receiptDate; + data['receipient_account'] = receipientAccount; + data['pay_account'] = payAccount; + data['request_mode'] = requestMode; + data['created_employee'] = createdEmployee; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['receipt_account_id'] = receiptAccountId; return data; } } diff --git a/lib/Models/generatorComplaintResponse.dart b/lib/Models/generatorComplaintResponse.dart index a5032e7..28b0c83 100644 --- a/lib/Models/generatorComplaintResponse.dart +++ b/lib/Models/generatorComplaintResponse.dart @@ -10,19 +10,19 @@ class generatorComplaintResponse { if (json['list'] != null) { list = []; json['list'].forEach((v) { - list!.add(new C_List.fromJson(v)); + list!.add(C_List.fromJson(v)); }); } sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.list != null) { - data['list'] = this.list!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (list != null) { + data['list'] = list!.map((v) => v.toJson()).toList(); } - data['session_exists'] = this.sessionExists; + data['session_exists'] = sessionExists; return data; } } @@ -36,14 +36,15 @@ class C_List { String? techName; String? createdBy; - C_List( - {this.compId, - this.compType, - this.compStatus, - this.compRegdate, - this.complaintNote, - this.techName, - this.createdBy}); + C_List({ + this.compId, + this.compType, + this.compStatus, + this.compRegdate, + this.complaintNote, + this.techName, + this.createdBy, + }); C_List.fromJson(Map json) { compId = json['comp_id']; @@ -56,14 +57,14 @@ class C_List { } Map toJson() { - final Map data = new Map(); - data['comp_id'] = this.compId; - data['comp_type'] = this.compType; - data['comp_status'] = this.compStatus; - data['comp_regdate'] = this.compRegdate; - data['complaint_note'] = this.complaintNote; - data['tech_name'] = this.techName; - data['created_by'] = this.createdBy; + final Map data = {}; + data['comp_id'] = compId; + data['comp_type'] = compType; + data['comp_status'] = compStatus; + data['comp_regdate'] = compRegdate; + data['complaint_note'] = complaintNote; + data['tech_name'] = techName; + data['created_by'] = createdBy; return data; } } diff --git a/lib/Models/hrmModels/attendanceRequestDetailsResponse.dart b/lib/Models/hrmModels/attendanceRequestDetailsResponse.dart index d59cb4c..a23e67d 100644 --- a/lib/Models/hrmModels/attendanceRequestDetailsResponse.dart +++ b/lib/Models/hrmModels/attendanceRequestDetailsResponse.dart @@ -4,26 +4,31 @@ class attendanceRequestDetailsResponse { String? message; int? sessionExists; - attendanceRequestDetailsResponse( - {this.requestDetails, this.error, this.message, this.sessionExists}); + attendanceRequestDetailsResponse({ + this.requestDetails, + this.error, + this.message, + this.sessionExists, + }); attendanceRequestDetailsResponse.fromJson(Map json) { - requestDetails = json['request_details'] != null - ? new RequestDetails.fromJson(json['request_details']) - : null; + requestDetails = + json['request_details'] != null + ? RequestDetails.fromJson(json['request_details']) + : null; error = json['error']; message = json['message']; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - if (this.requestDetails != null) { - data['request_details'] = this.requestDetails!.toJson(); + final Map data = {}; + if (requestDetails != null) { + data['request_details'] = requestDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -52,30 +57,30 @@ class RequestDetails { String? checkOutLocation; String? location; - RequestDetails( - {this.id, - this.attendanceType, - this.type, - this.date, - this.checkInType, - this.checkInTime, - this.chechOutType, - this.checkOutTime, - this.status, - this.requestedDatetime, - this.createdEmpName, - this.employeeName, - this.level1Remarks, - this.level1EmpName, - this.level2Remarks, - this.checkInProofDirFilePath, - this.checkOutProofDirFilePath, - this.level2EmpName, - this.note, - this.checkInLocation, - this.checkOutLocation, - this.location - }); + RequestDetails({ + this.id, + this.attendanceType, + this.type, + this.date, + this.checkInType, + this.checkInTime, + this.chechOutType, + this.checkOutTime, + this.status, + this.requestedDatetime, + this.createdEmpName, + this.employeeName, + this.level1Remarks, + this.level1EmpName, + this.level2Remarks, + this.checkInProofDirFilePath, + this.checkOutProofDirFilePath, + this.level2EmpName, + this.note, + this.checkInLocation, + this.checkOutLocation, + this.location, + }); RequestDetails.fromJson(Map json) { id = json['id']; @@ -103,29 +108,29 @@ class RequestDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['attendance_type'] = this.attendanceType; - data['type'] = this.type; - data['date'] = this.date; - data['check_in_type'] = this.checkInType; - data['check_in_time'] = this.checkInTime; - data['chech_out_type'] = this.chechOutType; - data['check_out_time'] = this.checkOutTime; - data['status'] = this.status; - data['requested_datetime'] = this.requestedDatetime; - data['created_emp_name'] = this.createdEmpName; - data['employee_name'] = this.employeeName; - data['level1_remarks'] = this.level1Remarks; - data['level1_emp_name'] = this.level1EmpName; - data['level2_remarks'] = this.level2Remarks; - data['check_in_proof_dir_file_path'] = this.checkInProofDirFilePath; - data['check_out_proof_dir_file_path'] = this.checkOutProofDirFilePath; - data['level2_emp_name'] = this.level2EmpName; - data['note'] = this.note; - data['check_in_location'] = this.checkInLocation; - data['check_out_location'] = this.location; - data['location'] = this.location; + final Map data = Map(); + data['id'] = id; + data['attendance_type'] = attendanceType; + data['type'] = type; + data['date'] = date; + data['check_in_type'] = checkInType; + data['check_in_time'] = checkInTime; + data['chech_out_type'] = chechOutType; + data['check_out_time'] = checkOutTime; + data['status'] = status; + data['requested_datetime'] = requestedDatetime; + data['created_emp_name'] = createdEmpName; + data['employee_name'] = employeeName; + data['level1_remarks'] = level1Remarks; + data['level1_emp_name'] = level1EmpName; + data['level2_remarks'] = level2Remarks; + data['check_in_proof_dir_file_path'] = checkInProofDirFilePath; + data['check_out_proof_dir_file_path'] = checkOutProofDirFilePath; + data['level2_emp_name'] = level2EmpName; + data['note'] = note; + data['check_in_location'] = checkInLocation; + data['check_out_location'] = location; + data['location'] = location; return data; } } diff --git a/lib/Models/hrmModels/attendanceRequestListResponse.dart b/lib/Models/hrmModels/attendanceRequestListResponse.dart index 55cc1f1..32bb224 100644 --- a/lib/Models/hrmModels/attendanceRequestListResponse.dart +++ b/lib/Models/hrmModels/attendanceRequestListResponse.dart @@ -4,14 +4,18 @@ class attendanceRequestListResponse { String? message; int? sessionExists; - attendanceRequestListResponse( - {this.requestList, this.error, this.message, this.sessionExists}); + attendanceRequestListResponse({ + this.requestList, + this.error, + this.message, + this.sessionExists, + }); attendanceRequestListResponse.fromJson(Map json) { if (json['request_list'] != null) { requestList = []; json['request_list'].forEach((v) { - requestList!.add(new RequestList.fromJson(v)); + requestList!.add(RequestList.fromJson(v)); }); } error = json['error']; @@ -20,13 +24,13 @@ class attendanceRequestListResponse { } Map toJson() { - final Map data = new Map(); - if (this.requestList != null) { - data['request_list'] = this.requestList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (requestList != null) { + data['request_list'] = requestList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -44,19 +48,19 @@ class RequestList { String? requestedDatetime; String? employeeName; - RequestList( - {this.id, - this.attendanceType, - this.type, - this.date, - this.checkInType, - this.checkInTime, - this.chechOutType, - this.checkOutTime, - this.status, - this.requestedDatetime, - this.employeeName, - }); + RequestList({ + this.id, + this.attendanceType, + this.type, + this.date, + this.checkInType, + this.checkInTime, + this.chechOutType, + this.checkOutTime, + this.status, + this.requestedDatetime, + this.employeeName, + }); RequestList.fromJson(Map json) { id = json['id']; @@ -73,18 +77,18 @@ class RequestList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['attendance_type'] = this.attendanceType; - data['type'] = this.type; - data['date'] = this.date; - data['check_in_type'] = this.checkInType; - data['check_in_time'] = this.checkInTime; - data['chech_out_type'] = this.chechOutType; - data['check_out_time'] = this.checkOutTime; - data['status'] = this.status; - data['requested_datetime'] = this.requestedDatetime; - data['employee_name'] = this.employeeName; + final Map data = {}; + data['id'] = id; + data['attendance_type'] = attendanceType; + data['type'] = type; + data['date'] = date; + data['check_in_type'] = checkInType; + data['check_in_time'] = checkInTime; + data['chech_out_type'] = chechOutType; + data['check_out_time'] = checkOutTime; + data['status'] = status; + data['requested_datetime'] = requestedDatetime; + data['employee_name'] = employeeName; return data; } } diff --git a/lib/Models/hrmModels/hrmAccessiblePagesResponse.dart b/lib/Models/hrmModels/hrmAccessiblePagesResponse.dart index 01aded0..f9401b4 100644 --- a/lib/Models/hrmModels/hrmAccessiblePagesResponse.dart +++ b/lib/Models/hrmModels/hrmAccessiblePagesResponse.dart @@ -4,15 +4,19 @@ class hrmAccessiblePagesResponse { String? message; int? sessionExists; - hrmAccessiblePagesResponse( - {this.error, this.pagesAccessible, this.message, this.sessionExists}); + hrmAccessiblePagesResponse({ + this.error, + this.pagesAccessible, + this.message, + this.sessionExists, + }); hrmAccessiblePagesResponse.fromJson(Map json) { error = json['error']; if (json['pages_accessible'] != null) { pagesAccessible = []; json['pages_accessible'].forEach((v) { - pagesAccessible!.add(new PagesAccessible.fromJson(v)); + pagesAccessible!.add(PagesAccessible.fromJson(v)); }); } message = json['message']; @@ -20,14 +24,14 @@ class hrmAccessiblePagesResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.pagesAccessible != null) { + final Map data = {}; + data['error'] = error; + if (pagesAccessible != null) { data['pages_accessible'] = - this.pagesAccessible!.map((v) => v.toJson()).toList(); + pagesAccessible!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -46,10 +50,10 @@ class PagesAccessible { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['page_name'] = this.pageName; - data['mode'] = this.mode; + final Map data = {}; + data['id'] = id; + data['page_name'] = pageName; + data['mode'] = mode; return data; } } diff --git a/lib/Models/hrmModels/jobDescriptionResponse.dart b/lib/Models/hrmModels/jobDescriptionResponse.dart index ad1c5f3..b279f25 100644 --- a/lib/Models/hrmModels/jobDescriptionResponse.dart +++ b/lib/Models/hrmModels/jobDescriptionResponse.dart @@ -4,26 +4,31 @@ class jobDescriptionResponse { String? message; int? sessionExists; - jobDescriptionResponse( - {this.jobDescription, this.error, this.message, this.sessionExists}); + jobDescriptionResponse({ + this.jobDescription, + this.error, + this.message, + this.sessionExists, + }); jobDescriptionResponse.fromJson(Map json) { - jobDescription = json['job_description'] != null - ? new JobDescription.fromJson(json['job_description']) - : null; + jobDescription = + json['job_description'] != null + ? JobDescription.fromJson(json['job_description']) + : null; error = json['error']; message = json['message']; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - if (this.jobDescription != null) { - data['job_description'] = this.jobDescription!.toJson(); + final Map data = {}; + if (jobDescription != null) { + data['job_description'] = jobDescription!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -42,10 +47,10 @@ class JobDescription { } Map toJson() { - final Map data = new Map(); - data['name'] = this.name; - data['job_description'] = this.jobDescription; - data['id'] = this.id; + final Map data = {}; + data['name'] = name; + data['job_description'] = jobDescription; + data['id'] = id; return data; } } diff --git a/lib/Models/hrmModels/leaveApplicationDetailsResponse.dart b/lib/Models/hrmModels/leaveApplicationDetailsResponse.dart index ad6c0d6..c684008 100644 --- a/lib/Models/hrmModels/leaveApplicationDetailsResponse.dart +++ b/lib/Models/hrmModels/leaveApplicationDetailsResponse.dart @@ -4,26 +4,31 @@ class leaveApplicationDetailsResponse { String? message; int? sessionExists; - leaveApplicationDetailsResponse( - {this.requestDetails, this.error, this.message, this.sessionExists}); + leaveApplicationDetailsResponse({ + this.requestDetails, + this.error, + this.message, + this.sessionExists, + }); leaveApplicationDetailsResponse.fromJson(Map json) { - requestDetails = json['request_details'] != null - ? new RequestDetails.fromJson(json['request_details']) - : null; + requestDetails = + json['request_details'] != null + ? RequestDetails.fromJson(json['request_details']) + : null; error = json['error']; message = json['message']; sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - if (this.requestDetails != null) { - data['request_details'] = this.requestDetails!.toJson(); + final Map data = {}; + if (requestDetails != null) { + data['request_details'] = requestDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -43,20 +48,21 @@ class RequestDetails { String? approvedDate; String? approvalRemarks; - RequestDetails( - {this.id, - this.appliedDate, - this.fromDate, - this.toDate, - this.fromTime, - this.toTime, - this.reason, - this.leaveType, - this.status, - this.requestedTo, - this.approvedBy, - this.approvedDate, - this.approvalRemarks}); + RequestDetails({ + this.id, + this.appliedDate, + this.fromDate, + this.toDate, + this.fromTime, + this.toTime, + this.reason, + this.leaveType, + this.status, + this.requestedTo, + this.approvedBy, + this.approvedDate, + this.approvalRemarks, + }); RequestDetails.fromJson(Map json) { id = json['id']; @@ -75,20 +81,20 @@ class RequestDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['applied_date'] = this.appliedDate; - data['from_date'] = this.fromDate; - data['to_date'] = this.toDate; - data['from_time'] = this.fromTime; - data['to_time'] = this.toTime; - data['reason'] = this.reason; - data['leave_type'] = this.leaveType; - data['status'] = this.status; - data['requested_to'] = this.requestedTo; - data['approved_by'] = this.approvedBy; - data['approved_date'] = this.approvedDate; - data['approval_remarks'] = this.approvalRemarks; + final Map data = {}; + data['id'] = id; + data['applied_date'] = appliedDate; + data['from_date'] = fromDate; + data['to_date'] = toDate; + data['from_time'] = fromTime; + data['to_time'] = toTime; + data['reason'] = reason; + data['leave_type'] = leaveType; + data['status'] = status; + data['requested_to'] = requestedTo; + data['approved_by'] = approvedBy; + data['approved_date'] = approvedDate; + data['approval_remarks'] = approvalRemarks; return data; } } diff --git a/lib/Models/hrmModels/leaveApplicationLIstResponse.dart b/lib/Models/hrmModels/leaveApplicationLIstResponse.dart index a5bdf21..8eaf7c6 100644 --- a/lib/Models/hrmModels/leaveApplicationLIstResponse.dart +++ b/lib/Models/hrmModels/leaveApplicationLIstResponse.dart @@ -4,14 +4,18 @@ class leaveApplicationLIstResponse { String? message; int? sessionExists; - leaveApplicationLIstResponse( - {this.requestList, this.error, this.message, this.sessionExists}); + leaveApplicationLIstResponse({ + this.requestList, + this.error, + this.message, + this.sessionExists, + }); leaveApplicationLIstResponse.fromJson(Map json) { if (json['request_list'] != null) { requestList = []; json['request_list'].forEach((v) { - requestList!.add(new RequestList.fromJson(v)); + requestList!.add(RequestList.fromJson(v)); }); } error = json['error']; @@ -20,13 +24,13 @@ class leaveApplicationLIstResponse { } Map toJson() { - final Map data = new Map(); - if (this.requestList != null) { - data['request_list'] = this.requestList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (requestList != null) { + data['request_list'] = requestList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -41,9 +45,13 @@ class RequestList { String? rowColor; String? employeeName; - - RequestList( - {this.id, this.appliedDate, this.fromPeriod, this.toPeriod, this.status}); + RequestList({ + this.id, + this.appliedDate, + this.fromPeriod, + this.toPeriod, + this.status, + }); RequestList.fromJson(Map json) { id = json['id']; @@ -57,15 +65,15 @@ class RequestList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['applied_date'] = this.appliedDate; - data['from_period'] = this.fromPeriod; - data['to_period'] = this.toPeriod; - data['status'] = this.status; - data["leave_type"] = this.leaveType; - data["row_colur"] = this.rowColor; - data["employee_name"] = this.employeeName; + final Map data = {}; + data['id'] = id; + data['applied_date'] = appliedDate; + data['from_period'] = fromPeriod; + data['to_period'] = toPeriod; + data['status'] = status; + data["leave_type"] = leaveType; + data["row_colur"] = rowColor; + data["employee_name"] = employeeName; return data; } } diff --git a/lib/Models/hrmModels/rewardListResponse.dart b/lib/Models/hrmModels/rewardListResponse.dart index 5b30806..7cd90a3 100644 --- a/lib/Models/hrmModels/rewardListResponse.dart +++ b/lib/Models/hrmModels/rewardListResponse.dart @@ -7,19 +7,21 @@ class rewardListResponse { String? message; int? sessionExists; - rewardListResponse( - {this.rewardsList, - this.achievedAmount, - this.disbursedAmount, - this.balanceAmount, - this.error, - this.message, - this.sessionExists}); + rewardListResponse({ + this.rewardsList, + this.achievedAmount, + this.disbursedAmount, + this.balanceAmount, + this.error, + this.message, + this.sessionExists, + }); rewardListResponse.fromJson(Map json) { - rewardsList = json['rewards_list'] != null - ? new RewardsList.fromJson(json['rewards_list']) - : null; + rewardsList = + json['rewards_list'] != null + ? RewardsList.fromJson(json['rewards_list']) + : null; achievedAmount = json['achieved_amount']; disbursedAmount = json['disbursed_amount']; balanceAmount = json['balance_amount']; @@ -29,16 +31,16 @@ class rewardListResponse { } Map toJson() { - final Map data = new Map(); - if (this.rewardsList != null) { - data['rewards_list'] = this.rewardsList!.toJson(); + final Map data = {}; + if (rewardsList != null) { + data['rewards_list'] = rewardsList!.toJson(); } - data['achieved_amount'] = this.achievedAmount; - data['disbursed_amount'] = this.disbursedAmount; - data['balance_amount'] = this.balanceAmount; - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['achieved_amount'] = achievedAmount; + data['disbursed_amount'] = disbursedAmount; + data['balance_amount'] = balanceAmount; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -60,22 +62,23 @@ class RewardsList { String? employeeName; String? entryName; - RewardsList( - {this.id, - this.empId, - this.description, - this.type, - this.cAmount, - this.dAmount, - this.enteredBy, - this.isApproved, - this.approvedBy, - this.approvedDatetime, - this.updatedDatetime, - this.isExist, - this.dateTime, - this.employeeName, - this.entryName}); + RewardsList({ + this.id, + this.empId, + this.description, + this.type, + this.cAmount, + this.dAmount, + this.enteredBy, + this.isApproved, + this.approvedBy, + this.approvedDatetime, + this.updatedDatetime, + this.isExist, + this.dateTime, + this.employeeName, + this.entryName, + }); RewardsList.fromJson(Map json) { id = json['id']; @@ -96,22 +99,22 @@ class RewardsList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['emp_id'] = this.empId; - data['description'] = this.description; - data['type'] = this.type; - data['c_amount'] = this.cAmount; - data['d_amount'] = this.dAmount; - data['entered_by'] = this.enteredBy; - data['is_approved'] = this.isApproved; - data['approved_by'] = this.approvedBy; - data['approved_datetime'] = this.approvedDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['is_exist'] = this.isExist; - data['date_time'] = this.dateTime; - data['employee_name'] = this.employeeName; - data['entry_name'] = this.entryName; + final Map data = {}; + data['id'] = id; + data['emp_id'] = empId; + data['description'] = description; + data['type'] = type; + data['c_amount'] = cAmount; + data['d_amount'] = dAmount; + data['entered_by'] = enteredBy; + data['is_approved'] = isApproved; + data['approved_by'] = approvedBy; + data['approved_datetime'] = approvedDatetime; + data['updated_datetime'] = updatedDatetime; + data['is_exist'] = isExist; + data['date_time'] = dateTime; + data['employee_name'] = employeeName; + data['entry_name'] = entryName; return data; } } diff --git a/lib/Models/hrmModels/tourExpensesAddViewResponse.dart b/lib/Models/hrmModels/tourExpensesAddViewResponse.dart index f167004..4051c1d 100644 --- a/lib/Models/hrmModels/tourExpensesAddViewResponse.dart +++ b/lib/Models/hrmModels/tourExpensesAddViewResponse.dart @@ -6,13 +6,14 @@ class tourExpensesAddViewResponse { String? message; int? sessionExists; - tourExpensesAddViewResponse( - {this.daAmount, - this.tourType, - this.travelType, - this.error, - this.message, - this.sessionExists}); + tourExpensesAddViewResponse({ + this.daAmount, + this.tourType, + this.travelType, + this.error, + this.message, + this.sessionExists, + }); tourExpensesAddViewResponse.fromJson(Map json) { daAmount = json['da_amount'].cast(); @@ -24,13 +25,13 @@ class tourExpensesAddViewResponse { } Map toJson() { - final Map data = new Map(); - data['da_amount'] = this.daAmount; - data['tour_type'] = this.tourType; - data['travel_type'] = this.travelType; - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['da_amount'] = daAmount; + data['tour_type'] = tourType; + data['travel_type'] = travelType; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/hrmModels/tourExpensesDetailsResponse.dart b/lib/Models/hrmModels/tourExpensesDetailsResponse.dart index 4510b19..0c7720c 100644 --- a/lib/Models/hrmModels/tourExpensesDetailsResponse.dart +++ b/lib/Models/hrmModels/tourExpensesDetailsResponse.dart @@ -8,39 +8,42 @@ class tourExpensesDetailsResponse { String? message; int? sessionExists; - tourExpensesDetailsResponse( - {this.requestDetails, - this.tourExpenses, - this.travelExpenses, - this.hotelExpenses, - this.otherExpenses, - this.error, - this.message, - this.sessionExists}); + tourExpensesDetailsResponse({ + this.requestDetails, + this.tourExpenses, + this.travelExpenses, + this.hotelExpenses, + this.otherExpenses, + this.error, + this.message, + this.sessionExists, + }); tourExpensesDetailsResponse.fromJson(Map json) { - requestDetails = json['request_details'] != null - ? new RequestDetails.fromJson(json['request_details']) - : null; - tourExpenses = json['tour_expenses'] != null - ? new TourExpenses.fromJson(json['tour_expenses']) - : null; + requestDetails = + json['request_details'] != null + ? RequestDetails.fromJson(json['request_details']) + : null; + tourExpenses = + json['tour_expenses'] != null + ? TourExpenses.fromJson(json['tour_expenses']) + : null; if (json['travel_expenses'] != null) { travelExpenses = []; json['travel_expenses'].forEach((v) { - travelExpenses!.add(new TravelExpenses.fromJson(v)); + travelExpenses!.add(TravelExpenses.fromJson(v)); }); } if (json['hotel_expenses'] != null) { hotelExpenses = []; json['hotel_expenses'].forEach((v) { - hotelExpenses!.add(new HotelExpenses.fromJson(v)); + hotelExpenses!.add(HotelExpenses.fromJson(v)); }); } if (json['other_expenses'] != null) { otherExpenses = []; json['other_expenses'].forEach((v) { - otherExpenses!.add(new OtherExpenses.fromJson(v)); + otherExpenses!.add(OtherExpenses.fromJson(v)); }); } error = json['error']; @@ -49,28 +52,25 @@ class tourExpensesDetailsResponse { } Map toJson() { - final Map data = new Map(); - if (this.requestDetails != null) { - data['request_details'] = this.requestDetails!.toJson(); + final Map data = {}; + if (requestDetails != null) { + data['request_details'] = requestDetails!.toJson(); } - if (this.tourExpenses != null) { - data['tour_expenses'] = this.tourExpenses!.toJson(); + if (tourExpenses != null) { + data['tour_expenses'] = tourExpenses!.toJson(); } - if (this.travelExpenses != null) { - data['travel_expenses'] = - this.travelExpenses!.map((v) => v.toJson()).toList(); + if (travelExpenses != null) { + data['travel_expenses'] = travelExpenses!.map((v) => v.toJson()).toList(); } - if (this.hotelExpenses != null) { - data['hotel_expenses'] = - this.hotelExpenses!.map((v) => v.toJson()).toList(); + if (hotelExpenses != null) { + data['hotel_expenses'] = hotelExpenses!.map((v) => v.toJson()).toList(); } - if (this.otherExpenses != null) { - data['other_expenses'] = - this.otherExpenses!.map((v) => v.toJson()).toList(); + if (otherExpenses != null) { + data['other_expenses'] = otherExpenses!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -93,27 +93,28 @@ class RequestDetails { String? hrApprovedBy; String? hrApprovedAmount; String? hrRemarks; - Null? hrApprovedDate; + Null hrApprovedDate; - RequestDetails( - {this.id, - this.employeeName, - this.placeOfVisit, - this.appliedDate, - this.fromDate, - this.toDate, - this.type, - this.appliedAmount, - this.approvedAmount, - this.approvalStatus, - this.tlApprovedBy, - this.tlApprovedAmount, - this.tlRemarks, - this.tlApprovedDate, - this.hrApprovedBy, - this.hrApprovedAmount, - this.hrRemarks, - this.hrApprovedDate}); + RequestDetails({ + this.id, + this.employeeName, + this.placeOfVisit, + this.appliedDate, + this.fromDate, + this.toDate, + this.type, + this.appliedAmount, + this.approvedAmount, + this.approvalStatus, + this.tlApprovedBy, + this.tlApprovedAmount, + this.tlRemarks, + this.tlApprovedDate, + this.hrApprovedBy, + this.hrApprovedAmount, + this.hrRemarks, + this.hrApprovedDate, + }); RequestDetails.fromJson(Map json) { id = json['id']; @@ -137,25 +138,25 @@ class RequestDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['employee_name'] = this.employeeName; - data['place_of_visit'] = this.placeOfVisit; - data['applied_date'] = this.appliedDate; - data['from_date'] = this.fromDate; - data['to_date'] = this.toDate; - data['type'] = this.type; - data['applied_amount'] = this.appliedAmount; - data['approved_amount'] = this.approvedAmount; - data['approval_status'] = this.approvalStatus; - data['tl_approved_by'] = this.tlApprovedBy; - data['tl_approved_amount'] = this.tlApprovedAmount; - data['tl_remarks'] = this.tlRemarks; - data['tl_approved_date'] = this.tlApprovedDate; - data['hr_approved_by'] = this.hrApprovedBy; - data['hr_approved_amount'] = this.hrApprovedAmount; - data['hr_remarks'] = this.hrRemarks; - data['hr_approved_date'] = this.hrApprovedDate; + final Map data = Map(); + data['id'] = id; + data['employee_name'] = employeeName; + data['place_of_visit'] = placeOfVisit; + data['applied_date'] = appliedDate; + data['from_date'] = fromDate; + data['to_date'] = toDate; + data['type'] = type; + data['applied_amount'] = appliedAmount; + data['approved_amount'] = approvedAmount; + data['approval_status'] = approvalStatus; + data['tl_approved_by'] = tlApprovedBy; + data['tl_approved_amount'] = tlApprovedAmount; + data['tl_remarks'] = tlRemarks; + data['tl_approved_date'] = tlApprovedDate; + data['hr_approved_by'] = hrApprovedBy; + data['hr_approved_amount'] = hrApprovedAmount; + data['hr_remarks'] = hrRemarks; + data['hr_approved_date'] = hrApprovedDate; return data; } } @@ -169,14 +170,15 @@ class TourExpenses { String? toDate; String? extraNote; - TourExpenses( - {this.placeOfVisit, - this.da, - this.type, - this.appliedAmount, - this.fromDate, - this.toDate, - this.extraNote}); + TourExpenses({ + this.placeOfVisit, + this.da, + this.type, + this.appliedAmount, + this.fromDate, + this.toDate, + this.extraNote, + }); TourExpenses.fromJson(Map json) { placeOfVisit = json['place_of_visit']; @@ -189,14 +191,14 @@ class TourExpenses { } Map toJson() { - final Map data = new Map(); - data['place_of_visit'] = this.placeOfVisit; - data['da'] = this.da; - data['type'] = this.type; - data['applied_amount'] = this.appliedAmount; - data['from_date'] = this.fromDate; - data['to_date'] = this.toDate; - data['extra_note'] = this.extraNote; + final Map data = {}; + data['place_of_visit'] = placeOfVisit; + data['da'] = da; + data['type'] = type; + data['applied_amount'] = appliedAmount; + data['from_date'] = fromDate; + data['to_date'] = toDate; + data['extra_note'] = extraNote; return data; } } @@ -209,13 +211,14 @@ class TravelExpenses { String? travelBill; String? imageDirFilePath; - TravelExpenses( - {this.froma, - this.toa, - this.travelType, - this.fare, - this.travelBill, - this.imageDirFilePath}); + TravelExpenses({ + this.froma, + this.toa, + this.travelType, + this.fare, + this.travelBill, + this.imageDirFilePath, + }); TravelExpenses.fromJson(Map json) { froma = json['froma']; @@ -227,13 +230,13 @@ class TravelExpenses { } Map toJson() { - final Map data = new Map(); - data['froma'] = this.froma; - data['toa'] = this.toa; - data['travel_type'] = this.travelType; - data['fare'] = this.fare; - data['travel_bill'] = this.travelBill; - data['image_dir_file_path'] = this.imageDirFilePath; + final Map data = {}; + data['froma'] = froma; + data['toa'] = toa; + data['travel_type'] = travelType; + data['fare'] = fare; + data['travel_bill'] = travelBill; + data['image_dir_file_path'] = imageDirFilePath; return data; } } @@ -245,12 +248,13 @@ class HotelExpenses { String? amount; String? imageDirFilePath; - HotelExpenses( - {this.hotelName, - this.fromDate, - this.toDate, - this.amount, - this.imageDirFilePath}); + HotelExpenses({ + this.hotelName, + this.fromDate, + this.toDate, + this.amount, + this.imageDirFilePath, + }); HotelExpenses.fromJson(Map json) { hotelName = json['hotel_name']; @@ -261,12 +265,12 @@ class HotelExpenses { } Map toJson() { - final Map data = new Map(); - data['hotel_name'] = this.hotelName; - data['from_date'] = this.fromDate; - data['to_date'] = this.toDate; - data['amount'] = this.amount; - data['image_dir_file_path'] = this.imageDirFilePath; + final Map data = {}; + data['hotel_name'] = hotelName; + data['from_date'] = fromDate; + data['to_date'] = toDate; + data['amount'] = amount; + data['image_dir_file_path'] = imageDirFilePath; return data; } } @@ -277,11 +281,12 @@ class OtherExpenses { String? otherDesc; String? imageDirFilePath; - OtherExpenses( - {this.otherAmount, - this.otherDate, - this.otherDesc, - this.imageDirFilePath}); + OtherExpenses({ + this.otherAmount, + this.otherDate, + this.otherDesc, + this.imageDirFilePath, + }); OtherExpenses.fromJson(Map json) { otherAmount = json['other_amount']; @@ -291,11 +296,11 @@ class OtherExpenses { } Map toJson() { - final Map data = new Map(); - data['other_amount'] = this.otherAmount; - data['other_date'] = this.otherDate; - data['other_desc'] = this.otherDesc; - data['image_dir_file_path'] = this.imageDirFilePath; + final Map data = {}; + data['other_amount'] = otherAmount; + data['other_date'] = otherDate; + data['other_desc'] = otherDesc; + data['image_dir_file_path'] = imageDirFilePath; return data; } } diff --git a/lib/Models/hrmModels/tourExpensesListResponse.dart b/lib/Models/hrmModels/tourExpensesListResponse.dart index 9ac66c0..95ced4b 100644 --- a/lib/Models/hrmModels/tourExpensesListResponse.dart +++ b/lib/Models/hrmModels/tourExpensesListResponse.dart @@ -4,14 +4,18 @@ class tourExpensesListResponse { String? message; int? sessionExists; - tourExpensesListResponse( - {this.tourList, this.error, this.message, this.sessionExists}); + tourExpensesListResponse({ + this.tourList, + this.error, + this.message, + this.sessionExists, + }); tourExpensesListResponse.fromJson(Map json) { if (json['tour_list'] != null) { tourList = []; json['tour_list'].forEach((v) { - tourList!.add(new TourList.fromJson(v)); + tourList!.add(TourList.fromJson(v)); }); } error = json['error']; @@ -20,13 +24,13 @@ class tourExpensesListResponse { } Map toJson() { - final Map data = new Map(); - if (this.tourList != null) { - data['tour_list'] = this.tourList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (tourList != null) { + data['tour_list'] = tourList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -42,16 +46,17 @@ class TourList { String? approvedAmount; String? approvalStatus; - TourList( - {this.id, - this.placeOfVisit, - this.appliedDate, - this.fromDate, - this.toDate, - this.type, - this.appliedAmount, - this.approvedAmount, - this.approvalStatus}); + TourList({ + this.id, + this.placeOfVisit, + this.appliedDate, + this.fromDate, + this.toDate, + this.type, + this.appliedAmount, + this.approvedAmount, + this.approvalStatus, + }); TourList.fromJson(Map json) { id = json['id']; @@ -66,16 +71,16 @@ class TourList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['place_of_visit'] = this.placeOfVisit; - data['applied_date'] = this.appliedDate; - data['from_date'] = this.fromDate; - data['to_date'] = this.toDate; - data['type'] = this.type; - data['applied_amount'] = this.appliedAmount; - data['approved_amount'] = this.approvedAmount; - data['approval_status'] = this.approvalStatus; + final Map data = {}; + data['id'] = id; + data['place_of_visit'] = placeOfVisit; + data['applied_date'] = appliedDate; + data['from_date'] = fromDate; + data['to_date'] = toDate; + data['type'] = type; + data['applied_amount'] = appliedAmount; + data['approved_amount'] = approvedAmount; + data['approval_status'] = approvalStatus; return data; } } diff --git a/lib/Models/hrmmodels/ogresponse.dart b/lib/Models/hrmmodels/ogresponse.dart index 460ca07..68f47a2 100644 --- a/lib/Models/hrmmodels/ogresponse.dart +++ b/lib/Models/hrmmodels/ogresponse.dart @@ -8,15 +8,16 @@ class ogresponse { String? message; int? sessionExists; - ogresponse( - {this.id, - this.name, - this.title, - this.profile, - this.children, - this.error, - this.message, - this.sessionExists}); + ogresponse({ + this.id, + this.name, + this.title, + this.profile, + this.children, + this.error, + this.message, + this.sessionExists, + }); ogresponse.fromJson(Map json) { id = json['id']; @@ -26,7 +27,7 @@ class ogresponse { if (json['children'] != null) { children = []; json['children'].forEach((v) { - children!.add(new Children.fromJson(v)); + children!.add(Children.fromJson(v)); }); } error = json['error']; @@ -35,17 +36,17 @@ class ogresponse { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['title'] = this.title; - data['profile'] = this.profile; - if (this.children != null) { - data['children'] = this.children!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['title'] = title; + data['profile'] = profile; + if (children != null) { + data['children'] = children!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } @@ -67,21 +68,20 @@ class Children { if (json['children'] != null) { children = []; json['children'].forEach((v) { - children!.add(new Children.fromJson(v)); + children!.add(Children.fromJson(v)); }); } } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['title'] = this.title; - data['profile'] = this.profile; - if (this.children != null) { - data['children'] = this.children!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['title'] = title; + data['profile'] = profile; + if (children != null) { + data['children'] = children!.map((v) => v.toJson()).toList(); } return data; } } - diff --git a/lib/Models/loadGeneratorDetailsResponse.dart b/lib/Models/loadGeneratorDetailsResponse.dart index 1978e08..95720b2 100644 --- a/lib/Models/loadGeneratorDetailsResponse.dart +++ b/lib/Models/loadGeneratorDetailsResponse.dart @@ -30,37 +30,38 @@ class loadGeneratorDetailsResponse { List? scheduleList; int? sessionExists; - loadGeneratorDetailsResponse( - {this.error, - this.genId, - this.genHashId, - this.aname, - this.emodel, - this.spname, - this.mob1, - this.mob2, - this.mail, - this.cname, - this.engineNo, - this.dateOfEngineSale, - this.altNo, - this.btryNo, - this.dgSetNo, - this.state, - this.district, - this.address, - this.loc, - this.dispDate, - this.cmsngDate, - this.status, - this.complaintCategoryList, - this.complaintTypeList, - this.complaintDescriptionList, - this.nextService, - this.contactList, - this.complaintList, - this.scheduleList, - this.sessionExists}); + loadGeneratorDetailsResponse({ + this.error, + this.genId, + this.genHashId, + this.aname, + this.emodel, + this.spname, + this.mob1, + this.mob2, + this.mail, + this.cname, + this.engineNo, + this.dateOfEngineSale, + this.altNo, + this.btryNo, + this.dgSetNo, + this.state, + this.district, + this.address, + this.loc, + this.dispDate, + this.cmsngDate, + this.status, + this.complaintCategoryList, + this.complaintTypeList, + this.complaintDescriptionList, + this.nextService, + this.contactList, + this.complaintList, + this.scheduleList, + this.sessionExists, + }); loadGeneratorDetailsResponse.fromJson(Map json) { error = json['error']; @@ -88,92 +89,90 @@ class loadGeneratorDetailsResponse { if (json['complaint_category_list'] != null) { complaintCategoryList = []; json['complaint_category_list'].forEach((v) { - complaintCategoryList!.add(new ComplaintCategoryList.fromJson(v)); + complaintCategoryList!.add(ComplaintCategoryList.fromJson(v)); }); } if (json['complaint_type_list'] != null) { complaintTypeList = []; json['complaint_type_list'].forEach((v) { - complaintTypeList!.add(new ComplaintTypeList.fromJson(v)); + complaintTypeList!.add(ComplaintTypeList.fromJson(v)); }); } if (json['complaint_description_list'] != null) { complaintDescriptionList = []; json['complaint_description_list'].forEach((v) { - complaintDescriptionList!.add(new ComplaintDescriptionList.fromJson(v)); + complaintDescriptionList!.add(ComplaintDescriptionList.fromJson(v)); }); } nextService = json['next_service']; if (json['contact_list'] != null) { contactList = []; json['contact_list'].forEach((v) { - contactList!.add(new ContactList.fromJson(v)); + contactList!.add(ContactList.fromJson(v)); }); } if (json['complaint_list'] != null) { complaintList = []; json['complaint_list'].forEach((v) { - complaintList!.add(new ComplaintList.fromJson(v)); + complaintList!.add(ComplaintList.fromJson(v)); }); } if (json['schedule_list'] != null) { scheduleList = []; json['schedule_list'].forEach((v) { - scheduleList!.add(new ScheduleList.fromJson(v)); + scheduleList!.add(ScheduleList.fromJson(v)); }); } sessionExists = json['session_exists']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['gen_id'] = this.genId; - data['gen_hash_id'] = this.genHashId; - data['aname'] = this.aname; - data['emodel'] = this.emodel; - data['spname'] = this.spname; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['mail'] = this.mail; - data['cname'] = this.cname; - data['engine_no'] = this.engineNo; - data['date_of_engine_sale'] = this.dateOfEngineSale; - data['alt_no'] = this.altNo; - data['btry_no'] = this.btryNo; - data['dg_set_no'] = this.dgSetNo; - data['state'] = this.state; - data['district'] = this.district; - data['address'] = this.address; - data['loc'] = this.loc; - data['disp_date'] = this.dispDate; - data['cmsng_date'] = this.cmsngDate; - data['status'] = this.status; - if (this.complaintCategoryList != null) { + final Map data = {}; + data['error'] = error; + data['gen_id'] = genId; + data['gen_hash_id'] = genHashId; + data['aname'] = aname; + data['emodel'] = emodel; + data['spname'] = spname; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['mail'] = mail; + data['cname'] = cname; + data['engine_no'] = engineNo; + data['date_of_engine_sale'] = dateOfEngineSale; + data['alt_no'] = altNo; + data['btry_no'] = btryNo; + data['dg_set_no'] = dgSetNo; + data['state'] = state; + data['district'] = district; + data['address'] = address; + data['loc'] = loc; + data['disp_date'] = dispDate; + data['cmsng_date'] = cmsngDate; + data['status'] = status; + if (complaintCategoryList != null) { data['complaint_category_list'] = - this.complaintCategoryList!.map((v) => v.toJson()).toList(); + complaintCategoryList!.map((v) => v.toJson()).toList(); } - if (this.complaintTypeList != null) { + if (complaintTypeList != null) { data['complaint_type_list'] = - this.complaintTypeList!.map((v) => v.toJson()).toList(); + complaintTypeList!.map((v) => v.toJson()).toList(); } - if (this.complaintDescriptionList != null) { + if (complaintDescriptionList != null) { data['complaint_description_list'] = - this.complaintDescriptionList!.map((v) => v.toJson()).toList(); + complaintDescriptionList!.map((v) => v.toJson()).toList(); } - data['next_service'] = this.nextService; - if (this.contactList != null) { - data['contact_list'] = this.contactList!.map((v) => v.toJson()).toList(); + data['next_service'] = nextService; + if (contactList != null) { + data['contact_list'] = contactList!.map((v) => v.toJson()).toList(); } - if (this.complaintList != null) { - data['complaint_list'] = - this.complaintList!.map((v) => v.toJson()).toList(); + if (complaintList != null) { + data['complaint_list'] = complaintList!.map((v) => v.toJson()).toList(); } - if (this.scheduleList != null) { - data['schedule_list'] = - this.scheduleList!.map((v) => v.toJson()).toList(); + if (scheduleList != null) { + data['schedule_list'] = scheduleList!.map((v) => v.toJson()).toList(); } - data['session_exists'] = this.sessionExists; + data['session_exists'] = sessionExists; return data; } } @@ -190,9 +189,9 @@ class ComplaintCategoryList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -205,13 +204,14 @@ class ContactList { String? mail; String? type; - ContactList( - {this.name, - this.designation, - this.mob1, - this.mob2, - this.mail, - this.type}); + ContactList({ + this.name, + this.designation, + this.mob1, + this.mob2, + this.mail, + this.type, + }); ContactList.fromJson(Map json) { name = json['name']; @@ -223,13 +223,13 @@ class ContactList { } Map toJson() { - final Map data = new Map(); - data['name'] = this.name; - data['designation'] = this.designation; - data['mob1'] = this.mob1; - data['mob2'] = this.mob2; - data['mail'] = this.mail; - data['type'] = this.type; + final Map data = {}; + data['name'] = name; + data['designation'] = designation; + data['mob1'] = mob1; + data['mob2'] = mob2; + data['mail'] = mail; + data['type'] = type; return data; } } @@ -243,14 +243,15 @@ class ComplaintList { String? openStatus; String? createdDate; - ComplaintList( - {this.complaintId, - this.createdBy, - this.complaintTypeName, - this.technicianName, - this.complaintCategoryName, - this.openStatus, - this.createdDate}); + ComplaintList({ + this.complaintId, + this.createdBy, + this.complaintTypeName, + this.technicianName, + this.complaintCategoryName, + this.openStatus, + this.createdDate, + }); ComplaintList.fromJson(Map json) { complaintId = json['complaint_id']; @@ -263,14 +264,14 @@ class ComplaintList { } Map toJson() { - final Map data = new Map(); - data['complaint_id'] = this.complaintId; - data['created_by'] = this.createdBy; - data['complaint_type_name'] = this.complaintTypeName; - data['technician_name'] = this.technicianName; - data['complaint_category_name'] = this.complaintCategoryName; - data['open_status'] = this.openStatus; - data['created_date'] = this.createdDate; + final Map data = {}; + data['complaint_id'] = complaintId; + data['created_by'] = createdBy; + data['complaint_type_name'] = complaintTypeName; + data['technician_name'] = technicianName; + data['complaint_category_name'] = complaintCategoryName; + data['open_status'] = openStatus; + data['created_date'] = createdDate; return data; } } @@ -288,18 +289,19 @@ class ScheduleList { String? feedbackStatus; String? createdDatetime; - ScheduleList( - {this.serviceScheduleId, - this.name, - this.complaintType, - this.complaintCategory, - this.complaintDescription, - this.scheduleManagerName, - this.complaintId, - this.dueDate, - this.status, - this.feedbackStatus, - this.createdDatetime}); + ScheduleList({ + this.serviceScheduleId, + this.name, + this.complaintType, + this.complaintCategory, + this.complaintDescription, + this.scheduleManagerName, + this.complaintId, + this.dueDate, + this.status, + this.feedbackStatus, + this.createdDatetime, + }); ScheduleList.fromJson(Map json) { serviceScheduleId = json['service_schedule_id']; @@ -316,21 +318,22 @@ class ScheduleList { } Map toJson() { - final Map data = new Map(); - data['service_schedule_id'] = this.serviceScheduleId; - data['name'] = this.name; - data['complaint_type'] = this.complaintType; - data['complaint_category'] = this.complaintCategory; - data['complaint_description'] = this.complaintDescription; - data['schedule_manager_name'] = this.scheduleManagerName; - data['complaint_id'] = this.complaintId; - data['due_date'] = this.dueDate; - data['status'] = this.status; - data['feedback_status'] = this.feedbackStatus; - data['created_datetime'] = this.createdDatetime; + final Map data = {}; + data['service_schedule_id'] = serviceScheduleId; + data['name'] = name; + data['complaint_type'] = complaintType; + data['complaint_category'] = complaintCategory; + data['complaint_description'] = complaintDescription; + data['schedule_manager_name'] = scheduleManagerName; + data['complaint_id'] = complaintId; + data['due_date'] = dueDate; + data['status'] = status; + data['feedback_status'] = feedbackStatus; + data['created_datetime'] = createdDatetime; return data; } } + class ComplaintTypeList { String? id; String? name; @@ -343,12 +346,13 @@ class ComplaintTypeList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } + class ComplaintDescriptionList { String? id; String? name; @@ -361,9 +365,9 @@ class ComplaintDescriptionList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/ordersModels/AddOrderPaymentSelectAccountResponse.dart b/lib/Models/ordersModels/AddOrderPaymentSelectAccountResponse.dart index e20bd70..42803d7 100644 --- a/lib/Models/ordersModels/AddOrderPaymentSelectAccountResponse.dart +++ b/lib/Models/ordersModels/AddOrderPaymentSelectAccountResponse.dart @@ -3,14 +3,17 @@ class AddOrderPaymentSelectAccountResponse { String? error; String? message; - AddOrderPaymentSelectAccountResponse( - {this.accountList, this.error, this.message}); + AddOrderPaymentSelectAccountResponse({ + this.accountList, + this.error, + this.message, + }); AddOrderPaymentSelectAccountResponse.fromJson(Map json) { if (json['account_list'] != null) { accountList = []; json['account_list'].forEach((v) { - accountList!.add(new AccountList.fromJson(v)); + accountList!.add(AccountList.fromJson(v)); }); } error = json['error']; @@ -18,12 +21,12 @@ class AddOrderPaymentSelectAccountResponse { } Map toJson() { - final Map data = new Map(); - if (this.accountList != null) { - data['account_list'] = this.accountList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (accountList != null) { + data['account_list'] = accountList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -40,9 +43,9 @@ class AccountList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['text'] = this.text; + final Map data = {}; + data['id'] = id; + data['text'] = text; return data; } } diff --git a/lib/Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart b/lib/Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart index 5e3e0b7..3d96fd4 100644 --- a/lib/Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart +++ b/lib/Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart @@ -3,27 +3,30 @@ class AddOrderPaymentSelectOrderResponse { List? orderList; String? message; - AddOrderPaymentSelectOrderResponse( - {this.error, this.orderList, this.message}); + AddOrderPaymentSelectOrderResponse({ + this.error, + this.orderList, + this.message, + }); AddOrderPaymentSelectOrderResponse.fromJson(Map json) { error = json['error']; if (json['order_list'] != null) { orderList = []; json['order_list'].forEach((v) { - orderList!.add(new OrderList.fromJson(v)); + orderList!.add(OrderList.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.orderList != null) { - data['order_list'] = this.orderList!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (orderList != null) { + data['order_list'] = orderList!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -35,12 +38,13 @@ class OrderList { String? balanceAmount; String? createdDatetime; - OrderList( - {this.orderId, - this.orderNumber, - this.totalAmount, - this.balanceAmount, - this.createdDatetime}); + OrderList({ + this.orderId, + this.orderNumber, + this.totalAmount, + this.balanceAmount, + this.createdDatetime, + }); OrderList.fromJson(Map json) { orderId = json['order_id']; @@ -51,12 +55,12 @@ class OrderList { } Map toJson() { - final Map data = new Map(); - data['order_id'] = this.orderId; - data['order_number'] = this.orderNumber; - data['total_amount'] = this.totalAmount; - data['balance_amount'] = this.balanceAmount; - data['created_datetime'] = this.createdDatetime; + final Map data = {}; + data['order_id'] = orderId; + data['order_number'] = orderNumber; + data['total_amount'] = totalAmount; + data['balance_amount'] = balanceAmount; + data['created_datetime'] = createdDatetime; return data; } } diff --git a/lib/Models/ordersModels/AddOrderViewResponse.dart b/lib/Models/ordersModels/AddOrderViewResponse.dart index b3c989f..8c03397 100644 --- a/lib/Models/ordersModels/AddOrderViewResponse.dart +++ b/lib/Models/ordersModels/AddOrderViewResponse.dart @@ -8,33 +8,34 @@ class AddOrderViewResponse { String? error; String? message; - AddOrderViewResponse( - {this.employees, - this.states, - this.saleProducts, - this.unloadingScope, - this.freightScope, - this.erectionScope, - this.error, - this.message}); + AddOrderViewResponse({ + this.employees, + this.states, + this.saleProducts, + this.unloadingScope, + this.freightScope, + this.erectionScope, + this.error, + this.message, + }); AddOrderViewResponse.fromJson(Map json) { if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new Employees.fromJson(v)); + employees!.add(Employees.fromJson(v)); }); } if (json['states'] != null) { states = []; json['states'].forEach((v) { - states!.add(new States.fromJson(v)); + states!.add(States.fromJson(v)); }); } if (json['sale_products'] != null) { saleProducts = []; json['sale_products'].forEach((v) { - saleProducts!.add(new SaleProducts.fromJson(v)); + saleProducts!.add(SaleProducts.fromJson(v)); }); } unloadingScope = json['unloading_scope'].cast(); @@ -45,22 +46,21 @@ class AddOrderViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } - if (this.states != null) { - data['states'] = this.states!.map((v) => v.toJson()).toList(); + if (states != null) { + data['states'] = states!.map((v) => v.toJson()).toList(); } - if (this.saleProducts != null) { - data['sale_products'] = - this.saleProducts!.map((v) => v.toJson()).toList(); + if (saleProducts != null) { + data['sale_products'] = saleProducts!.map((v) => v.toJson()).toList(); } - data['unloading_scope'] = this.unloadingScope; - data['freight_scope'] = this.freightScope; - data['erection_scope'] = this.erectionScope; - data['error'] = this.error; - data['message'] = this.message; + data['unloading_scope'] = unloadingScope; + data['freight_scope'] = freightScope; + data['erection_scope'] = erectionScope; + data['error'] = error; + data['message'] = message; return data; } } @@ -77,9 +77,9 @@ class Employees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } @@ -111,32 +111,33 @@ class SaleProducts { String? isExists; String? updatedDatetime; - SaleProducts( - {this.id, - this.productCode, - this.project, - this.subGroup, - this.vendor1, - this.vendor2, - this.vendorCode, - this.prodName, - this.brand, - this.imageDirFilePath, - this.imageViewFileName, - this.prodDesc, - this.hsnCode, - this.units, - this.unitsId, - this.worksMsl, - this.refType, - this.refId, - this.price, - this.type, - this.productionProcessId, - this.createdBy, - this.datetime, - this.isExists, - this.updatedDatetime}); + SaleProducts({ + this.id, + this.productCode, + this.project, + this.subGroup, + this.vendor1, + this.vendor2, + this.vendorCode, + this.prodName, + this.brand, + this.imageDirFilePath, + this.imageViewFileName, + this.prodDesc, + this.hsnCode, + this.units, + this.unitsId, + this.worksMsl, + this.refType, + this.refId, + this.price, + this.type, + this.productionProcessId, + this.createdBy, + this.datetime, + this.isExists, + this.updatedDatetime, + }); SaleProducts.fromJson(Map json) { id = json['id']; @@ -167,32 +168,32 @@ class SaleProducts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['product_code'] = this.productCode; - data['project'] = this.project; - data['sub_group'] = this.subGroup; - data['vendor_1'] = this.vendor1; - data['vendor_2'] = this.vendor2; - data['vendor_code'] = this.vendorCode; - data['prod_name'] = this.prodName; - data['brand'] = this.brand; - data['image_dir_file_path'] = this.imageDirFilePath; - data['image_view_file_name'] = this.imageViewFileName; - data['prod_desc'] = this.prodDesc; - data['hsn_code'] = this.hsnCode; - data['units'] = this.units; - data['units_id'] = this.unitsId; - data['works_msl'] = this.worksMsl; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['price'] = this.price; - data['type'] = this.type; - data['production_process_id'] = this.productionProcessId; - data['created_by'] = this.createdBy; - data['datetime'] = this.datetime; - data['is_exists'] = this.isExists; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['product_code'] = productCode; + data['project'] = project; + data['sub_group'] = subGroup; + data['vendor_1'] = vendor1; + data['vendor_2'] = vendor2; + data['vendor_code'] = vendorCode; + data['prod_name'] = prodName; + data['brand'] = brand; + data['image_dir_file_path'] = imageDirFilePath; + data['image_view_file_name'] = imageViewFileName; + data['prod_desc'] = prodDesc; + data['hsn_code'] = hsnCode; + data['units'] = units; + data['units_id'] = unitsId; + data['works_msl'] = worksMsl; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['price'] = price; + data['type'] = type; + data['production_process_id'] = productionProcessId; + data['created_by'] = createdBy; + data['datetime'] = datetime; + data['is_exists'] = isExists; + data['updated_datetime'] = updatedDatetime; return data; } } @@ -209,9 +210,9 @@ class States { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } -} \ No newline at end of file +} diff --git a/lib/Models/ordersModels/EditPaymentDetailsAdjustedOrdersViewResponse.dart b/lib/Models/ordersModels/EditPaymentDetailsAdjustedOrdersViewResponse.dart index adf9332..65cea69 100644 --- a/lib/Models/ordersModels/EditPaymentDetailsAdjustedOrdersViewResponse.dart +++ b/lib/Models/ordersModels/EditPaymentDetailsAdjustedOrdersViewResponse.dart @@ -4,21 +4,26 @@ class EditPaymentDetailsAdjustedOrdersViewResponse { String? error; String? message; - EditPaymentDetailsAdjustedOrdersViewResponse( - {this.paidList, this.editOrderList, this.error, this.message}); + EditPaymentDetailsAdjustedOrdersViewResponse({ + this.paidList, + this.editOrderList, + this.error, + this.message, + }); EditPaymentDetailsAdjustedOrdersViewResponse.fromJson( - Map json) { + Map json, + ) { if (json['paid_list'] != null) { paidList = []; json['paid_list'].forEach((v) { - paidList!.add(new EditPaidList.fromJson(v)); + paidList!.add(EditPaidList.fromJson(v)); }); } if (json['order_list'] != null) { editOrderList = []; json['order_list'].forEach((v) { - editOrderList!.add(new EditOrderList.fromJson(v)); + editOrderList!.add(EditOrderList.fromJson(v)); }); } error = json['error']; @@ -26,15 +31,15 @@ class EditPaymentDetailsAdjustedOrdersViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.paidList != null) { - data['paid_list'] = this.paidList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (paidList != null) { + data['paid_list'] = paidList!.map((v) => v.toJson()).toList(); } - if (this.editOrderList != null) { - data['order_list'] = this.editOrderList!.map((v) => v.toJson()).toList(); + if (editOrderList != null) { + data['order_list'] = editOrderList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -49,15 +54,16 @@ class EditPaidList { String? balanceAmount; String? adjustedAmount; - EditPaidList( - {this.accId, - this.orderId, - this.orderPaymentId, - this.orderNumber, - this.orderAmount, - this.paidAmount, - this.balanceAmount, - this.adjustedAmount}); + EditPaidList({ + this.accId, + this.orderId, + this.orderPaymentId, + this.orderNumber, + this.orderAmount, + this.paidAmount, + this.balanceAmount, + this.adjustedAmount, + }); EditPaidList.fromJson(Map json) { accId = json['acc_id']; @@ -71,15 +77,15 @@ class EditPaidList { } Map toJson() { - final Map data = new Map(); - data['acc_id'] = this.accId; - data['order_id'] = this.orderId; - data['order_payment_id'] = this.orderPaymentId; - data['order_number'] = this.orderNumber; - data['order_amount'] = this.orderAmount; - data['paid_amount'] = this.paidAmount; - data['balance_amount'] = this.balanceAmount; - data['adjusted_amount'] = this.adjustedAmount; + final Map data = {}; + data['acc_id'] = accId; + data['order_id'] = orderId; + data['order_payment_id'] = orderPaymentId; + data['order_number'] = orderNumber; + data['order_amount'] = orderAmount; + data['paid_amount'] = paidAmount; + data['balance_amount'] = balanceAmount; + data['adjusted_amount'] = adjustedAmount; return data; } } @@ -91,12 +97,13 @@ class EditOrderList { String? balanceAmount; String? createdDatetime; - EditOrderList( - {this.orderId, - this.orderNumber, - this.totalAmount, - this.balanceAmount, - this.createdDatetime}); + EditOrderList({ + this.orderId, + this.orderNumber, + this.totalAmount, + this.balanceAmount, + this.createdDatetime, + }); EditOrderList.fromJson(Map json) { orderId = json['order_id']; @@ -107,12 +114,12 @@ class EditOrderList { } Map toJson() { - final Map data = new Map(); - data['order_id'] = this.orderId; - data['order_number'] = this.orderNumber; - data['total_amount'] = this.totalAmount; - data['balance_amount'] = this.balanceAmount; - data['created_datetime'] = this.createdDatetime; + final Map data = {}; + data['order_id'] = orderId; + data['order_number'] = orderNumber; + data['total_amount'] = totalAmount; + data['balance_amount'] = balanceAmount; + data['created_datetime'] = createdDatetime; return data; } } diff --git a/lib/Models/ordersModels/PendingTPCAgentListResponse.dart b/lib/Models/ordersModels/PendingTPCAgentListResponse.dart index 738199d..21252f0 100644 --- a/lib/Models/ordersModels/PendingTPCAgentListResponse.dart +++ b/lib/Models/ordersModels/PendingTPCAgentListResponse.dart @@ -3,14 +3,17 @@ class PendingTPCAgentListResponse { String? error; String? message; - PendingTPCAgentListResponse( - {this.pendingTpcIssueList, this.error, this.message}); + PendingTPCAgentListResponse({ + this.pendingTpcIssueList, + this.error, + this.message, + }); PendingTPCAgentListResponse.fromJson(Map json) { if (json['pending_tpc_issue_list'] != null) { pendingTpcIssueList = []; json['pending_tpc_issue_list'].forEach((v) { - pendingTpcIssueList!.add(new PendingTpcIssueList.fromJson(v)); + pendingTpcIssueList!.add(PendingTpcIssueList.fromJson(v)); }); } error = json['error']; @@ -18,13 +21,13 @@ class PendingTPCAgentListResponse { } Map toJson() { - final Map data = new Map(); - if (this.pendingTpcIssueList != null) { + final Map data = {}; + if (pendingTpcIssueList != null) { data['pending_tpc_issue_list'] = - this.pendingTpcIssueList!.map((v) => v.toJson()).toList(); + pendingTpcIssueList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -57,33 +60,34 @@ class PendingTpcIssueList { String? tpcStatus; String? requestedTpcAmount; - PendingTpcIssueList( - {this.id, - this.name, - this.mobileNumber, - this.idProofDirFilePath, - this.idProofViewFileName, - this.bankName, - this.bankBeneficiaryName, - this.bankAccountNo, - this.bankIfscCode, - this.note, - this.enteredEmpId, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.tpcAgentId, - this.aname, - this.ename, - this.orderId, - this.totalAmount, - this.paidAmount, - this.orderNumber, - this.level1TpcApprovedAmount, - this.level2TpcApprovedAmount, - this.status, - this.tpcStatus, - this.requestedTpcAmount}); + PendingTpcIssueList({ + this.id, + this.name, + this.mobileNumber, + this.idProofDirFilePath, + this.idProofViewFileName, + this.bankName, + this.bankBeneficiaryName, + this.bankAccountNo, + this.bankIfscCode, + this.note, + this.enteredEmpId, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.tpcAgentId, + this.aname, + this.ename, + this.orderId, + this.totalAmount, + this.paidAmount, + this.orderNumber, + this.level1TpcApprovedAmount, + this.level2TpcApprovedAmount, + this.status, + this.tpcStatus, + this.requestedTpcAmount, + }); PendingTpcIssueList.fromJson(Map json) { id = json['id']; @@ -115,33 +119,33 @@ class PendingTpcIssueList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['mobile_number'] = this.mobileNumber; - data['id_proof_dir_file_path'] = this.idProofDirFilePath; - data['id_proof_view_file_name'] = this.idProofViewFileName; - data['bank_name'] = this.bankName; - data['bank_beneficiary_name'] = this.bankBeneficiaryName; - data['bank_account_no'] = this.bankAccountNo; - data['bank_ifsc_code'] = this.bankIfscCode; - data['note'] = this.note; - data['entered_emp_id'] = this.enteredEmpId; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['tpc_agent_id'] = this.tpcAgentId; - data['aname'] = this.aname; - data['ename'] = this.ename; - data['order_id'] = this.orderId; - data['total_amount'] = this.totalAmount; - data['paid_amount'] = this.paidAmount; - data['order_number'] = this.orderNumber; - data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount; - data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount; - data['status'] = this.status; - data['tpc_status'] = this.tpcStatus; - data['requested_tpc_amount'] = this.requestedTpcAmount; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['mobile_number'] = mobileNumber; + data['id_proof_dir_file_path'] = idProofDirFilePath; + data['id_proof_view_file_name'] = idProofViewFileName; + data['bank_name'] = bankName; + data['bank_beneficiary_name'] = bankBeneficiaryName; + data['bank_account_no'] = bankAccountNo; + data['bank_ifsc_code'] = bankIfscCode; + data['note'] = note; + data['entered_emp_id'] = enteredEmpId; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['tpc_agent_id'] = tpcAgentId; + data['aname'] = aname; + data['ename'] = ename; + data['order_id'] = orderId; + data['total_amount'] = totalAmount; + data['paid_amount'] = paidAmount; + data['order_number'] = orderNumber; + data['level1_tpc_approved_amount'] = level1TpcApprovedAmount; + data['level2_tpc_approved_amount'] = level2TpcApprovedAmount; + data['status'] = status; + data['tpc_status'] = tpcStatus; + data['requested_tpc_amount'] = requestedTpcAmount; return data; } } diff --git a/lib/Models/ordersModels/TPCAgentDetailsResponse.dart b/lib/Models/ordersModels/TPCAgentDetailsResponse.dart index 6941d07..7c60952 100644 --- a/lib/Models/ordersModels/TPCAgentDetailsResponse.dart +++ b/lib/Models/ordersModels/TPCAgentDetailsResponse.dart @@ -4,20 +4,22 @@ class TPCAgentDetailsResponse { String? error; String? message; - TPCAgentDetailsResponse( - {this.tpcAgentDetails, - this.tpcRequestedAmounts, - this.error, - this.message}); + TPCAgentDetailsResponse({ + this.tpcAgentDetails, + this.tpcRequestedAmounts, + this.error, + this.message, + }); TPCAgentDetailsResponse.fromJson(Map json) { - tpcAgentDetails = json['tpc_agent_details'] != null - ? new TpcAgentDetails.fromJson(json['tpc_agent_details']) - : null; + tpcAgentDetails = + json['tpc_agent_details'] != null + ? TpcAgentDetails.fromJson(json['tpc_agent_details']) + : null; if (json['tpc_requested_amounts'] != null) { tpcRequestedAmounts = []; json['tpc_requested_amounts'].forEach((v) { - tpcRequestedAmounts!.add(new TpcRequestedAmounts.fromJson(v)); + tpcRequestedAmounts!.add(TpcRequestedAmounts.fromJson(v)); }); } error = json['error']; @@ -25,16 +27,16 @@ class TPCAgentDetailsResponse { } Map toJson() { - final Map data = new Map(); - if (this.tpcAgentDetails != null) { - data['tpc_agent_details'] = this.tpcAgentDetails!.toJson(); + final Map data = {}; + if (tpcAgentDetails != null) { + data['tpc_agent_details'] = tpcAgentDetails!.toJson(); } - if (this.tpcRequestedAmounts != null) { + if (tpcRequestedAmounts != null) { data['tpc_requested_amounts'] = - this.tpcRequestedAmounts!.map((v) => v.toJson()).toList(); + tpcRequestedAmounts!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -57,23 +59,24 @@ class TpcAgentDetails { String? tpcAgentId; String? enteredEmployee; - TpcAgentDetails( - {this.id, - this.name, - this.mobileNumber, - this.idProofDirFilePath, - this.idProofViewFileName, - this.bankName, - this.bankBeneficiaryName, - this.bankAccountNo, - this.bankIfscCode, - this.note, - this.enteredEmpId, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.tpcAgentId, - this.enteredEmployee}); + TpcAgentDetails({ + this.id, + this.name, + this.mobileNumber, + this.idProofDirFilePath, + this.idProofViewFileName, + this.bankName, + this.bankBeneficiaryName, + this.bankAccountNo, + this.bankIfscCode, + this.note, + this.enteredEmpId, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.tpcAgentId, + this.enteredEmployee, + }); TpcAgentDetails.fromJson(Map json) { id = json['id']; @@ -95,23 +98,23 @@ class TpcAgentDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['mobile_number'] = this.mobileNumber; - data['id_proof_dir_file_path'] = this.idProofDirFilePath; - data['id_proof_view_file_name'] = this.idProofViewFileName; - data['bank_name'] = this.bankName; - data['bank_beneficiary_name'] = this.bankBeneficiaryName; - data['bank_account_no'] = this.bankAccountNo; - data['bank_ifsc_code'] = this.bankIfscCode; - data['note'] = this.note; - data['entered_emp_id'] = this.enteredEmpId; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['tpc_agent_id'] = this.tpcAgentId; - data['entered_employee'] = this.enteredEmployee; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['mobile_number'] = mobileNumber; + data['id_proof_dir_file_path'] = idProofDirFilePath; + data['id_proof_view_file_name'] = idProofViewFileName; + data['bank_name'] = bankName; + data['bank_beneficiary_name'] = bankBeneficiaryName; + data['bank_account_no'] = bankAccountNo; + data['bank_ifsc_code'] = bankIfscCode; + data['note'] = note; + data['entered_emp_id'] = enteredEmpId; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['tpc_agent_id'] = tpcAgentId; + data['entered_employee'] = enteredEmployee; return data; } } @@ -142,31 +145,32 @@ class TpcRequestedAmounts { String? requestedTpcAmount; String? totalAmount; - TpcRequestedAmounts( - {this.id, - this.name, - this.mobileNumber, - this.idProofDirFilePath, - this.idProofViewFileName, - this.bankName, - this.bankBeneficiaryName, - this.bankAccountNo, - this.bankIfscCode, - this.note, - this.enteredEmpId, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.tpcAgentId, - this.customerName, - this.ename, - this.orderId, - this.orderNumber, - this.level1TpcApprovedAmount, - this.level2TpcApprovedAmount, - this.tpcStatus, - this.requestedTpcAmount, - this.totalAmount}); + TpcRequestedAmounts({ + this.id, + this.name, + this.mobileNumber, + this.idProofDirFilePath, + this.idProofViewFileName, + this.bankName, + this.bankBeneficiaryName, + this.bankAccountNo, + this.bankIfscCode, + this.note, + this.enteredEmpId, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.tpcAgentId, + this.customerName, + this.ename, + this.orderId, + this.orderNumber, + this.level1TpcApprovedAmount, + this.level2TpcApprovedAmount, + this.tpcStatus, + this.requestedTpcAmount, + this.totalAmount, + }); TpcRequestedAmounts.fromJson(Map json) { id = json['id']; @@ -196,31 +200,31 @@ class TpcRequestedAmounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['mobile_number'] = this.mobileNumber; - data['id_proof_dir_file_path'] = this.idProofDirFilePath; - data['id_proof_view_file_name'] = this.idProofViewFileName; - data['bank_name'] = this.bankName; - data['bank_beneficiary_name'] = this.bankBeneficiaryName; - data['bank_account_no'] = this.bankAccountNo; - data['bank_ifsc_code'] = this.bankIfscCode; - data['note'] = this.note; - data['entered_emp_id'] = this.enteredEmpId; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['tpc_agent_id'] = this.tpcAgentId; - data['customer_name'] = this.customerName; - data['ename'] = this.ename; - data['order_id'] = this.orderId; - data['order_number'] = this.orderNumber; - data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount; - data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount; - data['tpc_status'] = this.tpcStatus; - data['requested_tpc_amount'] = this.requestedTpcAmount; - data['total_amount'] = this.totalAmount; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['mobile_number'] = mobileNumber; + data['id_proof_dir_file_path'] = idProofDirFilePath; + data['id_proof_view_file_name'] = idProofViewFileName; + data['bank_name'] = bankName; + data['bank_beneficiary_name'] = bankBeneficiaryName; + data['bank_account_no'] = bankAccountNo; + data['bank_ifsc_code'] = bankIfscCode; + data['note'] = note; + data['entered_emp_id'] = enteredEmpId; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['tpc_agent_id'] = tpcAgentId; + data['customer_name'] = customerName; + data['ename'] = ename; + data['order_id'] = orderId; + data['order_number'] = orderNumber; + data['level1_tpc_approved_amount'] = level1TpcApprovedAmount; + data['level2_tpc_approved_amount'] = level2TpcApprovedAmount; + data['tpc_status'] = tpcStatus; + data['requested_tpc_amount'] = requestedTpcAmount; + data['total_amount'] = totalAmount; return data; } } diff --git a/lib/Models/ordersModels/TPCListResponse.dart b/lib/Models/ordersModels/TPCListResponse.dart index d9a9f8e..c975bc9 100644 --- a/lib/Models/ordersModels/TPCListResponse.dart +++ b/lib/Models/ordersModels/TPCListResponse.dart @@ -9,7 +9,7 @@ class TPCListResponse { if (json['tpc_agent_list'] != null) { tpcAgentList = []; json['tpc_agent_list'].forEach((v) { - tpcAgentList!.add(new TpcAgentList.fromJson(v)); + tpcAgentList!.add(TpcAgentList.fromJson(v)); }); } error = json['error']; @@ -17,13 +17,12 @@ class TPCListResponse { } Map toJson() { - final Map data = new Map(); - if (this.tpcAgentList != null) { - data['tpc_agent_list'] = - this.tpcAgentList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (tpcAgentList != null) { + data['tpc_agent_list'] = tpcAgentList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -47,24 +46,25 @@ class TpcAgentList { String? enteredEmpName; String? issuedAmount; - TpcAgentList( - {this.id, - this.name, - this.mobileNumber, - this.idProofDirFilePath, - this.idProofViewFileName, - this.bankName, - this.bankBeneficiaryName, - this.bankAccountNo, - this.bankIfscCode, - this.note, - this.enteredEmpId, - this.isExists, - this.createdDatetime, - this.updatedDatetime, - this.tpcAgentId, - this.enteredEmpName, - this.issuedAmount}); + TpcAgentList({ + this.id, + this.name, + this.mobileNumber, + this.idProofDirFilePath, + this.idProofViewFileName, + this.bankName, + this.bankBeneficiaryName, + this.bankAccountNo, + this.bankIfscCode, + this.note, + this.enteredEmpId, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + this.tpcAgentId, + this.enteredEmpName, + this.issuedAmount, + }); TpcAgentList.fromJson(Map json) { id = json['id']; @@ -87,24 +87,24 @@ class TpcAgentList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['mobile_number'] = this.mobileNumber; - data['id_proof_dir_file_path'] = this.idProofDirFilePath; - data['id_proof_view_file_name'] = this.idProofViewFileName; - data['bank_name'] = this.bankName; - data['bank_beneficiary_name'] = this.bankBeneficiaryName; - data['bank_account_no'] = this.bankAccountNo; - data['bank_ifsc_code'] = this.bankIfscCode; - data['note'] = this.note; - data['entered_emp_id'] = this.enteredEmpId; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['tpc_agent_id'] = this.tpcAgentId; - data['entered_emp_name'] = this.enteredEmpName; - data['issued_amount'] = this.issuedAmount; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['mobile_number'] = mobileNumber; + data['id_proof_dir_file_path'] = idProofDirFilePath; + data['id_proof_view_file_name'] = idProofViewFileName; + data['bank_name'] = bankName; + data['bank_beneficiary_name'] = bankBeneficiaryName; + data['bank_account_no'] = bankAccountNo; + data['bank_ifsc_code'] = bankIfscCode; + data['note'] = note; + data['entered_emp_id'] = enteredEmpId; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['tpc_agent_id'] = tpcAgentId; + data['entered_emp_name'] = enteredEmpName; + data['issued_amount'] = issuedAmount; return data; } } diff --git a/lib/Models/ordersModels/addOrderAccontDetailsResponse.dart b/lib/Models/ordersModels/addOrderAccontDetailsResponse.dart index 823ff83..5d8c551 100644 --- a/lib/Models/ordersModels/addOrderAccontDetailsResponse.dart +++ b/lib/Models/ordersModels/addOrderAccontDetailsResponse.dart @@ -3,24 +3,28 @@ class addOrderAccontDetailsResponse { String? error; String? message; - addOrderAccontDetailsResponse( - {this.accountDetails, this.error, this.message}); + addOrderAccontDetailsResponse({ + this.accountDetails, + this.error, + this.message, + }); addOrderAccontDetailsResponse.fromJson(Map json) { - accountDetails = json['account_details'] != null - ? new AccountDetails.fromJson(json['account_details']) - : null; + accountDetails = + json['account_details'] != null + ? AccountDetails.fromJson(json['account_details']) + : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.accountDetails != null) { - data['account_details'] = this.accountDetails!.toJson(); + final Map data = {}; + if (accountDetails != null) { + data['account_details'] = accountDetails!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -47,27 +51,28 @@ class AccountDetails { String? createdDatetime; String? updatedDatetime; - AccountDetails( - {this.id, - this.tempId, - this.ownerId, - this.accManagerId, - this.name, - this.salutationName, - this.subLocality, - this.district, - this.state, - this.pincode, - this.address, - this.date, - this.source, - this.reference, - this.segment, - this.team, - this.gstNumber, - this.isExists, - this.createdDatetime, - this.updatedDatetime}); + AccountDetails({ + this.id, + this.tempId, + this.ownerId, + this.accManagerId, + this.name, + this.salutationName, + this.subLocality, + this.district, + this.state, + this.pincode, + this.address, + this.date, + this.source, + this.reference, + this.segment, + this.team, + this.gstNumber, + this.isExists, + this.createdDatetime, + this.updatedDatetime, + }); AccountDetails.fromJson(Map json) { id = json['id']; @@ -93,27 +98,27 @@ class AccountDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['temp_id'] = this.tempId; - data['owner_id'] = this.ownerId; - data['acc_manager_id'] = this.accManagerId; - data['name'] = this.name; - data['salutation_name'] = this.salutationName; - data['sub_locality'] = this.subLocality; - data['district'] = this.district; - data['state'] = this.state; - data['pincode'] = this.pincode; - data['address'] = this.address; - data['date'] = this.date; - data['source'] = this.source; - data['reference'] = this.reference; - data['segment'] = this.segment; - data['team'] = this.team; - data['gst_number'] = this.gstNumber; - data['is_exists'] = this.isExists; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; + final Map data = {}; + data['id'] = id; + data['temp_id'] = tempId; + data['owner_id'] = ownerId; + data['acc_manager_id'] = accManagerId; + data['name'] = name; + data['salutation_name'] = salutationName; + data['sub_locality'] = subLocality; + data['district'] = district; + data['state'] = state; + data['pincode'] = pincode; + data['address'] = address; + data['date'] = date; + data['source'] = source; + data['reference'] = reference; + data['segment'] = segment; + data['team'] = team; + data['gst_number'] = gstNumber; + data['is_exists'] = isExists; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; return data; } } diff --git a/lib/Models/ordersModels/addOrderPaymentViewResponse.dart b/lib/Models/ordersModels/addOrderPaymentViewResponse.dart index e5182c0..51810c0 100644 --- a/lib/Models/ordersModels/addOrderPaymentViewResponse.dart +++ b/lib/Models/ordersModels/addOrderPaymentViewResponse.dart @@ -4,8 +4,12 @@ class addOrderPaymentViewResponse { String? error; String? message; - addOrderPaymentViewResponse( - {this.paymentMode, this.description, this.error, this.message}); + addOrderPaymentViewResponse({ + this.paymentMode, + this.description, + this.error, + this.message, + }); addOrderPaymentViewResponse.fromJson(Map json) { paymentMode = json['payment_mode'].cast(); @@ -15,11 +19,11 @@ class addOrderPaymentViewResponse { } Map toJson() { - final Map data = new Map(); - data['payment_mode'] = this.paymentMode; - data['description'] = this.description; - data['error'] = this.error; - data['message'] = this.message; + final Map data = {}; + data['payment_mode'] = paymentMode; + data['description'] = description; + data['error'] = error; + data['message'] = message; return data; } } diff --git a/lib/Models/ordersModels/addOrderTpcAgentListResponse.dart b/lib/Models/ordersModels/addOrderTpcAgentListResponse.dart index 9a01eaf..689ce13 100644 --- a/lib/Models/ordersModels/addOrderTpcAgentListResponse.dart +++ b/lib/Models/ordersModels/addOrderTpcAgentListResponse.dart @@ -9,7 +9,7 @@ class addOrderTpcAgentListResponse { if (json['tpc_list'] != null) { tpcList = []; json['tpc_list'].forEach((v) { - tpcList!.add(new TpcList.fromJson(v)); + tpcList!.add(TpcList.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class addOrderTpcAgentListResponse { } Map toJson() { - final Map data = new Map(); - if (this.tpcList != null) { - data['tpc_list'] = this.tpcList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (tpcList != null) { + data['tpc_list'] = tpcList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -39,9 +39,9 @@ class TpcList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['text'] = this.text; + final Map data = {}; + data['id'] = id; + data['text'] = text; return data; } } diff --git a/lib/Models/ordersModels/commonResponse.dart b/lib/Models/ordersModels/commonResponse.dart index a67574d..5a6d9ba 100644 --- a/lib/Models/ordersModels/commonResponse.dart +++ b/lib/Models/ordersModels/commonResponse.dart @@ -13,10 +13,10 @@ class CommonResponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Models/ordersModels/orderDashboardResponse.dart b/lib/Models/ordersModels/orderDashboardResponse.dart index 17fcd47..20694ef 100644 --- a/lib/Models/ordersModels/orderDashboardResponse.dart +++ b/lib/Models/ordersModels/orderDashboardResponse.dart @@ -6,46 +6,49 @@ class orderDashboardResponse { String? error; String? message; - orderDashboardResponse( - {this.ordergain, - this.dispatches, - this.pendingTasks, - this.quote, - this.error, - this.message}); + orderDashboardResponse({ + this.ordergain, + this.dispatches, + this.pendingTasks, + this.quote, + this.error, + this.message, + }); orderDashboardResponse.fromJson(Map json) { - ordergain = json['ordergain'] != null - ? new Ordergain.fromJson(json['ordergain']) - : null; - dispatches = json['dispatches'] != null - ? new Ordergain.fromJson(json['dispatches']) - : null; - pendingTasks = json['pending_tasks'] != null - ? new Ordergain.fromJson(json['pending_tasks']) - : null; - quote = - json['quote'] != null ? new Ordergain.fromJson(json['quote']) : null; + ordergain = + json['ordergain'] != null + ? Ordergain.fromJson(json['ordergain']) + : null; + dispatches = + json['dispatches'] != null + ? Ordergain.fromJson(json['dispatches']) + : null; + pendingTasks = + json['pending_tasks'] != null + ? Ordergain.fromJson(json['pending_tasks']) + : null; + quote = json['quote'] != null ? Ordergain.fromJson(json['quote']) : null; error = json['error']; message = json['message']; } Map toJson() { - final Map data = new Map(); - if (this.ordergain != null) { - data['ordergain'] = this.ordergain!.toJson(); + final Map data = {}; + if (ordergain != null) { + data['ordergain'] = ordergain!.toJson(); } - if (this.dispatches != null) { - data['dispatches'] = this.dispatches!.toJson(); + if (dispatches != null) { + data['dispatches'] = dispatches!.toJson(); } - if (this.pendingTasks != null) { - data['pending_tasks'] = this.pendingTasks!.toJson(); + if (pendingTasks != null) { + data['pending_tasks'] = pendingTasks!.toJson(); } - if (this.quote != null) { - data['quote'] = this.quote!.toJson(); + if (quote != null) { + data['quote'] = quote!.toJson(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -58,15 +61,14 @@ class Ordergain { Ordergain.fromJson(Map json) { count = json['count']; - filter = - json['filter'] != null ? new Filter.fromJson(json['filter']) : null; + filter = json['filter'] != null ? Filter.fromJson(json['filter']) : null; } Map toJson() { - final Map data = new Map(); - data['count'] = this.count; - if (this.filter != null) { - data['filter'] = this.filter!.toJson(); + final Map data = {}; + data['count'] = count; + if (filter != null) { + data['filter'] = filter!.toJson(); } return data; } @@ -90,12 +92,12 @@ class Filter { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['page_name'] = this.pageName; - data['mode'] = this.mode; - data['open_status'] = this.openStatus; - data['status'] = this.status; + final Map data = {}; + data['id'] = id; + data['page_name'] = pageName; + data['mode'] = mode; + data['open_status'] = openStatus; + data['status'] = status; return data; } } diff --git a/lib/Models/ordersModels/orderPendingTasksListResponse.dart b/lib/Models/ordersModels/orderPendingTasksListResponse.dart index 817dbe7..519737a 100644 --- a/lib/Models/ordersModels/orderPendingTasksListResponse.dart +++ b/lib/Models/ordersModels/orderPendingTasksListResponse.dart @@ -9,7 +9,7 @@ class orderPendingTasksListResponse { if (json['pending_tasks'] != null) { pendingTasks = []; json['pending_tasks'].forEach((v) { - pendingTasks!.add(new PendingTasks.fromJson(v)); + pendingTasks!.add(PendingTasks.fromJson(v)); }); } error = json['error']; @@ -17,13 +17,12 @@ class orderPendingTasksListResponse { } Map toJson() { - final Map data = new Map(); - if (this.pendingTasks != null) { - data['pending_tasks'] = - this.pendingTasks!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (pendingTasks != null) { + data['pending_tasks'] = pendingTasks!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -39,16 +38,17 @@ class PendingTasks { String? lempid; String? aid; - PendingTasks( - {this.conmob, - this.aname, - this.appdate, - this.atype, - this.anote, - this.leadid, - this.lstatus, - this.lempid, - this.aid}); + PendingTasks({ + this.conmob, + this.aname, + this.appdate, + this.atype, + this.anote, + this.leadid, + this.lstatus, + this.lempid, + this.aid, + }); PendingTasks.fromJson(Map json) { conmob = json['conmob']; @@ -63,16 +63,16 @@ class PendingTasks { } Map toJson() { - final Map data = new Map(); - data['conmob'] = this.conmob; - data['aname'] = this.aname; - data['appdate'] = this.appdate; - data['atype'] = this.atype; - data['anote'] = this.anote; - data['leadid'] = this.leadid; - data['lstatus'] = this.lstatus; - data['lempid'] = this.lempid; - data['aid'] = this.aid; + final Map data = {}; + data['conmob'] = conmob; + data['aname'] = aname; + data['appdate'] = appdate; + data['atype'] = atype; + data['anote'] = anote; + data['leadid'] = leadid; + data['lstatus'] = lstatus; + data['lempid'] = lempid; + data['aid'] = aid; return data; } } diff --git a/lib/Models/ordersModels/ordersAccessiblePagesResponse.dart b/lib/Models/ordersModels/ordersAccessiblePagesResponse.dart index 33eb682..43e2719 100644 --- a/lib/Models/ordersModels/ordersAccessiblePagesResponse.dart +++ b/lib/Models/ordersModels/ordersAccessiblePagesResponse.dart @@ -3,28 +3,31 @@ class ordersAccessiblePagesResponse { List? pagesAccessible; String? message; - ordersAccessiblePagesResponse( - {this.error, this.pagesAccessible, this.message}); + ordersAccessiblePagesResponse({ + this.error, + this.pagesAccessible, + this.message, + }); ordersAccessiblePagesResponse.fromJson(Map json) { error = json['error']; if (json['pages_accessible'] != null) { pagesAccessible = []; json['pages_accessible'].forEach((v) { - pagesAccessible!.add(new PagesAccessible.fromJson(v)); + pagesAccessible!.add(PagesAccessible.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.pagesAccessible != null) { + final Map data = {}; + data['error'] = error; + if (pagesAccessible != null) { data['pages_accessible'] = - this.pagesAccessible!.map((v) => v.toJson()).toList(); + pagesAccessible!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -43,10 +46,10 @@ class PagesAccessible { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['page_name'] = this.pageName; - data['mode'] = this.mode; + final Map data = {}; + data['id'] = id; + data['page_name'] = pageName; + data['mode'] = mode; return data; } } diff --git a/lib/Models/ordersModels/ordersDetailsByModeResponse.dart b/lib/Models/ordersModels/ordersDetailsByModeResponse.dart index 2ed5cc9..7dada63 100644 --- a/lib/Models/ordersModels/ordersDetailsByModeResponse.dart +++ b/lib/Models/ordersModels/ordersDetailsByModeResponse.dart @@ -6,34 +6,36 @@ class ordersDetailsByModeResponse { String? error; String? message; - ordersDetailsByModeResponse( - {this.orderDetails, - this.products, - this.feedbackHistory, - this.paymentHistory, - this.error, - this.message}); + ordersDetailsByModeResponse({ + this.orderDetails, + this.products, + this.feedbackHistory, + this.paymentHistory, + this.error, + this.message, + }); ordersDetailsByModeResponse.fromJson(Map json) { - orderDetails = json['order_details'] != null - ? new OrderDetails.fromJson(json['order_details']) - : null; + orderDetails = + json['order_details'] != null + ? OrderDetails.fromJson(json['order_details']) + : null; if (json['products'] != null) { products = []; json['products'].forEach((v) { - products!.add(new Products.fromJson(v)); + products!.add(Products.fromJson(v)); }); } if (json['feedback_history'] != null) { feedbackHistory = []; json['feedback_history'].forEach((v) { - feedbackHistory!.add(new FeedbackHistory.fromJson(v)); + feedbackHistory!.add(FeedbackHistory.fromJson(v)); }); } if (json['payment_history'] != null) { paymentHistory = []; json['payment_history'].forEach((v) { - paymentHistory!.add(new PaymentHistory.fromJson(v)); + paymentHistory!.add(PaymentHistory.fromJson(v)); }); } error = json['error']; @@ -41,23 +43,22 @@ class ordersDetailsByModeResponse { } Map toJson() { - final Map data = new Map(); - if (this.orderDetails != null) { - data['order_details'] = this.orderDetails!.toJson(); + final Map data = {}; + if (orderDetails != null) { + data['order_details'] = orderDetails!.toJson(); } - if (this.products != null) { - data['products'] = this.products!.map((v) => v.toJson()).toList(); + if (products != null) { + data['products'] = products!.map((v) => v.toJson()).toList(); } - if (this.feedbackHistory != null) { + if (feedbackHistory != null) { data['feedback_history'] = - this.feedbackHistory!.map((v) => v.toJson()).toList(); + feedbackHistory!.map((v) => v.toJson()).toList(); } - if (this.paymentHistory != null) { - data['payment_history'] = - this.paymentHistory!.map((v) => v.toJson()).toList(); + if (paymentHistory != null) { + data['payment_history'] = paymentHistory!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -126,69 +127,70 @@ class OrderDetails { String? salesPersonEmpName; String? tpcaAgentName; - OrderDetails( - { this.id, - this.orderNumber, - this.orderNumberHash, - this.balanceAmount, - this.accId, - this.refType, - this.refId, - this.salesPersonEmpId, - this.enteredEmpId, - this.dispatchStateId, - this.dispatchDistrictId, - this.dispatchSubLocationId, - this.dispatchPincode, - this.dispatchAddress, - this.basicAmount, - this.cgstAmount, - this.sgstAmount, - this.igstAmount, - this.paidAmount, - this.totalAmount, - this.status, - this.orderReceivedDate, - this.scheduledDispatchDate, - this.otp, - this.note, - this.poViewFileName, - this.poDirFilePath, - this.unloadingScope, - this.freightScope, - this.erectionScope, - this.saleOrderNumber, - this.invoiceNumber, - this.vehicleNumber, - this.driverName, - this.driverMobileNumber, - this.tpcApplicable, - this.requestedTpcAmount, - this.level1TpcApprovedAmount, - this.level2TpcApprovedAmount, - this.tpcPaymentMode, - this.tpcPaymentReferenceNo, - this.tpcPaymentAttachmentDirFilePath, - this.tpcPaymentAttachementViewFileName, - this.tpcStatus, - this.tpcAgentId, - this.isExist, - this.createdDatetime, - this.updatedDatetime, - this.accountName, - this.gstNumber, - this.billingAddress, - this.billingDistrict, - this.billingState, - this.billingSubLocality, - this.billingPincode, - this.stateName, - this.districtName, - this.subLocationName, - this.adjustedAmount, - this.enteredEmpName, - this.salesPersonEmpName, - this.tpcaAgentName}); + OrderDetails({ + this.id, + this.orderNumber, + this.orderNumberHash, + this.balanceAmount, + this.accId, + this.refType, + this.refId, + this.salesPersonEmpId, + this.enteredEmpId, + this.dispatchStateId, + this.dispatchDistrictId, + this.dispatchSubLocationId, + this.dispatchPincode, + this.dispatchAddress, + this.basicAmount, + this.cgstAmount, + this.sgstAmount, + this.igstAmount, + this.paidAmount, + this.totalAmount, + this.status, + this.orderReceivedDate, + this.scheduledDispatchDate, + this.otp, + this.note, + this.poViewFileName, + this.poDirFilePath, + this.unloadingScope, + this.freightScope, + this.erectionScope, + this.saleOrderNumber, + this.invoiceNumber, + this.vehicleNumber, + this.driverName, + this.driverMobileNumber, + this.tpcApplicable, + this.requestedTpcAmount, + this.level1TpcApprovedAmount, + this.level2TpcApprovedAmount, + this.tpcPaymentMode, + this.tpcPaymentReferenceNo, + this.tpcPaymentAttachmentDirFilePath, + this.tpcPaymentAttachementViewFileName, + this.tpcStatus, + this.tpcAgentId, + this.isExist, + this.createdDatetime, + this.updatedDatetime, + this.accountName, + this.gstNumber, + this.billingAddress, + this.billingDistrict, + this.billingState, + this.billingSubLocality, + this.billingPincode, + this.stateName, + this.districtName, + this.subLocationName, + this.adjustedAmount, + this.enteredEmpName, + this.salesPersonEmpName, + this.tpcaAgentName, + }); OrderDetails.fromJson(Map json) { id = json['id']; @@ -233,9 +235,9 @@ class OrderDetails { tpcPaymentMode = json['tpc_payment_mode']; tpcPaymentReferenceNo = json['tpc_payment_reference_no']; tpcPaymentAttachmentDirFilePath = - json['tpc_payment_attachment_dir_file_path']; + json['tpc_payment_attachment_dir_file_path']; tpcPaymentAttachementViewFileName = - json['tpc_payment_attachement_view_file_name']; + json['tpc_payment_attachement_view_file_name']; tpcStatus = json['tpc_status']; tpcAgentId = json['tpc_agent_id']; isExist = json['is_exist']; @@ -258,71 +260,71 @@ class OrderDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['order_number'] = this.orderNumber; - data['order_number_hash'] = this.orderNumberHash; - data['balance_amount'] = this.balanceAmount; - data['acc_id'] = this.accId; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['sales_person_emp_id'] = this.salesPersonEmpId; - data['entered_emp_id'] = this.enteredEmpId; - data['dispatch_state_id'] = this.dispatchStateId; - data['dispatch_district_id'] = this.dispatchDistrictId; - data['dispatch_sub_location_id'] = this.dispatchSubLocationId; - data['dispatch_pincode'] = this.dispatchPincode; - data['dispatch_address'] = this.dispatchAddress; - data['basic_amount'] = this.basicAmount; - data['cgst_amount'] = this.cgstAmount; - data['sgst_amount'] = this.sgstAmount; - data['igst_amount'] = this.igstAmount; - data['paid_amount'] = this.paidAmount; - data['total_amount'] = this.totalAmount; - data['status'] = this.status; - data['order_received_date'] = this.orderReceivedDate; - data['scheduled_dispatch_date'] = this.scheduledDispatchDate; - data['otp'] = this.otp; - data['note'] = this.note; - data['po_view_file_name'] = this.poViewFileName; - data['po_dir_file_path'] = this.poDirFilePath; - data['unloading_scope'] = this.unloadingScope; - data['freight_scope'] = this.freightScope; - data['erection_scope'] = this.erectionScope; - data['sale_order_number'] = this.saleOrderNumber; - data['invoice_number'] = this.invoiceNumber; - data['vehicle_number'] = this.vehicleNumber; - data['driver_name'] = this.driverName; - data['driver_mobile_number'] = this.driverMobileNumber; - data['tpc_applicable'] = this.tpcApplicable; - data['requested_tpc_amount'] = this.requestedTpcAmount; - data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount; - data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount; - data['tpc_payment_mode'] = this.tpcPaymentMode; - data['tpc_payment_reference_no'] = this.tpcPaymentReferenceNo; + final Map data = {}; + data['id'] = id; + data['order_number'] = orderNumber; + data['order_number_hash'] = orderNumberHash; + data['balance_amount'] = balanceAmount; + data['acc_id'] = accId; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['sales_person_emp_id'] = salesPersonEmpId; + data['entered_emp_id'] = enteredEmpId; + data['dispatch_state_id'] = dispatchStateId; + data['dispatch_district_id'] = dispatchDistrictId; + data['dispatch_sub_location_id'] = dispatchSubLocationId; + data['dispatch_pincode'] = dispatchPincode; + data['dispatch_address'] = dispatchAddress; + data['basic_amount'] = basicAmount; + data['cgst_amount'] = cgstAmount; + data['sgst_amount'] = sgstAmount; + data['igst_amount'] = igstAmount; + data['paid_amount'] = paidAmount; + data['total_amount'] = totalAmount; + data['status'] = status; + data['order_received_date'] = orderReceivedDate; + data['scheduled_dispatch_date'] = scheduledDispatchDate; + data['otp'] = otp; + data['note'] = note; + data['po_view_file_name'] = poViewFileName; + data['po_dir_file_path'] = poDirFilePath; + data['unloading_scope'] = unloadingScope; + data['freight_scope'] = freightScope; + data['erection_scope'] = erectionScope; + data['sale_order_number'] = saleOrderNumber; + data['invoice_number'] = invoiceNumber; + data['vehicle_number'] = vehicleNumber; + data['driver_name'] = driverName; + data['driver_mobile_number'] = driverMobileNumber; + data['tpc_applicable'] = tpcApplicable; + data['requested_tpc_amount'] = requestedTpcAmount; + data['level1_tpc_approved_amount'] = level1TpcApprovedAmount; + data['level2_tpc_approved_amount'] = level2TpcApprovedAmount; + data['tpc_payment_mode'] = tpcPaymentMode; + data['tpc_payment_reference_no'] = tpcPaymentReferenceNo; data['tpc_payment_attachment_dir_file_path'] = - this.tpcPaymentAttachmentDirFilePath; + tpcPaymentAttachmentDirFilePath; data['tpc_payment_attachement_view_file_name'] = - this.tpcPaymentAttachementViewFileName; - data['tpc_status'] = this.tpcStatus; - data['tpc_agent_id'] = this.tpcAgentId; - data['is_exist'] = this.isExist; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['account_name'] = this.accountName; - data['gst_number'] = this.gstNumber; - data['billing_address'] = this.billingAddress; - data['billing_district'] = this.billingDistrict; - data['billing_state'] = this.billingState; - data['billing_sub_locality'] = this.billingSubLocality; - data['billing_pincode'] = this.billingPincode; - data['state_name'] = this.stateName; - data['district_name'] = this.districtName; - data['sub_location_name'] = this.subLocationName; - data['adjusted_amount'] = this.adjustedAmount; - data['entered_emp_name'] = this.enteredEmpName; - data['sales_person_emp_name'] = this.salesPersonEmpName; - data['tpca_agent_name'] = this.tpcaAgentName; + tpcPaymentAttachementViewFileName; + data['tpc_status'] = tpcStatus; + data['tpc_agent_id'] = tpcAgentId; + data['is_exist'] = isExist; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['account_name'] = accountName; + data['gst_number'] = gstNumber; + data['billing_address'] = billingAddress; + data['billing_district'] = billingDistrict; + data['billing_state'] = billingState; + data['billing_sub_locality'] = billingSubLocality; + data['billing_pincode'] = billingPincode; + data['state_name'] = stateName; + data['district_name'] = districtName; + data['sub_location_name'] = subLocationName; + data['adjusted_amount'] = adjustedAmount; + data['entered_emp_name'] = enteredEmpName; + data['sales_person_emp_name'] = salesPersonEmpName; + data['tpca_agent_name'] = tpcaAgentName; return data; } } @@ -346,24 +348,25 @@ class Products { String? sgstAmount; String? igstAmount; - Products( - {this.id, - this.orderId, - this.productId, - this.pdiId, - this.qty, - this.unitPrice, - this.cgstPercentage, - this.sgstPercentage, - this.igstPercentage, - this.totalPrice, - this.isExist, - this.createdDatetime, - this.updatedDatetime, - this.productName, - this.cgstAmount, - this.sgstAmount, - this.igstAmount}); + Products({ + this.id, + this.orderId, + this.productId, + this.pdiId, + this.qty, + this.unitPrice, + this.cgstPercentage, + this.sgstPercentage, + this.igstPercentage, + this.totalPrice, + this.isExist, + this.createdDatetime, + this.updatedDatetime, + this.productName, + this.cgstAmount, + this.sgstAmount, + this.igstAmount, + }); Products.fromJson(Map json) { id = json['id']; @@ -386,24 +389,24 @@ class Products { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['order_id'] = this.orderId; - data['product_id'] = this.productId; - data['pdi_id'] = this.pdiId; - data['qty'] = this.qty; - data['unit_price'] = this.unitPrice; - data['cgst_percentage'] = this.cgstPercentage; - data['sgst_percentage'] = this.sgstPercentage; - data['igst_percentage'] = this.igstPercentage; - data['total_price'] = this.totalPrice; - data['is_exist'] = this.isExist; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['product_name'] = this.productName; - data['cgst_amount'] = this.cgstAmount; - data['sgst_amount'] = this.sgstAmount; - data['igst_amount'] = this.igstAmount; + final Map data = {}; + data['id'] = id; + data['order_id'] = orderId; + data['product_id'] = productId; + data['pdi_id'] = pdiId; + data['qty'] = qty; + data['unit_price'] = unitPrice; + data['cgst_percentage'] = cgstPercentage; + data['sgst_percentage'] = sgstPercentage; + data['igst_percentage'] = igstPercentage; + data['total_price'] = totalPrice; + data['is_exist'] = isExist; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['product_name'] = productName; + data['cgst_amount'] = cgstAmount; + data['sgst_amount'] = sgstAmount; + data['igst_amount'] = igstAmount; return data; } } @@ -421,18 +424,19 @@ class FeedbackHistory { String? updatedDatetime; String? attachImage; - FeedbackHistory( - {this.employeNaem, - this.feedback, - this.createdDatetime, - this.status, - this.feedbackId, - this.id, - this.attachmentDirFilePath, - this.attachmentViewFileName, - this.isExists, - this.updatedDatetime, - this.attachImage}); + FeedbackHistory({ + this.employeNaem, + this.feedback, + this.createdDatetime, + this.status, + this.feedbackId, + this.id, + this.attachmentDirFilePath, + this.attachmentViewFileName, + this.isExists, + this.updatedDatetime, + this.attachImage, + }); FeedbackHistory.fromJson(Map json) { employeNaem = json['employe_naem']; @@ -449,18 +453,18 @@ class FeedbackHistory { } Map toJson() { - final Map data = new Map(); - data['employe_naem'] = this.employeNaem; - data['feedback'] = this.feedback; - data['created_datetime'] = this.createdDatetime; - data['status'] = this.status; - data['feedback_id'] = this.feedbackId; - data['id'] = this.id; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['is_exists'] = this.isExists; - data['updated_datetime'] = this.updatedDatetime; - data['attach_image'] = this.attachImage; + final Map data = Map(); + data['employe_naem'] = employeNaem; + data['feedback'] = feedback; + data['created_datetime'] = createdDatetime; + data['status'] = status; + data['feedback_id'] = feedbackId; + data['id'] = id; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['is_exists'] = isExists; + data['updated_datetime'] = updatedDatetime; + data['attach_image'] = attachImage; return data; } } @@ -483,23 +487,24 @@ class PaymentHistory { String? datetime; String? status; - PaymentHistory( - {this.paymentId, - this.ename, - this.accountName, - this.adjustedAmount, - this.enteredEmployee, - this.paymentType, - this.refId, - this.refType, - this.refNo, - this.approvalStatus, - this.paymentDate, - this.approvalEmpId, - this.description, - this.amount, - this.datetime, - this.status}); + PaymentHistory({ + this.paymentId, + this.ename, + this.accountName, + this.adjustedAmount, + this.enteredEmployee, + this.paymentType, + this.refId, + this.refType, + this.refNo, + this.approvalStatus, + this.paymentDate, + this.approvalEmpId, + this.description, + this.amount, + this.datetime, + this.status, + }); PaymentHistory.fromJson(Map json) { paymentId = json['payment_id']; @@ -521,23 +526,23 @@ class PaymentHistory { } Map toJson() { - final Map data = new Map(); - data['payment_id'] = this.paymentId; - data['ename'] = this.ename; - data['account_name'] = this.accountName; - data['adjusted_amount'] = this.adjustedAmount; - data['entered_employee'] = this.enteredEmployee; - data['payment_type'] = this.paymentType; - data['ref_id'] = this.refId; - data['ref_type'] = this.refType; - data['ref_no'] = this.refNo; - data['approval_status'] = this.approvalStatus; - data['payment_date'] = this.paymentDate; - data['approval_emp_id'] = this.approvalEmpId; - data['description'] = this.description; - data['amount'] = this.amount; - data['datetime'] = this.datetime; - data['status'] = this.status; + final Map data = {}; + data['payment_id'] = paymentId; + data['ename'] = ename; + data['account_name'] = accountName; + data['adjusted_amount'] = adjustedAmount; + data['entered_employee'] = enteredEmployee; + data['payment_type'] = paymentType; + data['ref_id'] = refId; + data['ref_type'] = refType; + data['ref_no'] = refNo; + data['approval_status'] = approvalStatus; + data['payment_date'] = paymentDate; + data['approval_emp_id'] = approvalEmpId; + data['description'] = description; + data['amount'] = amount; + data['datetime'] = datetime; + data['status'] = status; return data; } } diff --git a/lib/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart b/lib/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart index 446f42f..2419393 100644 --- a/lib/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart +++ b/lib/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart @@ -3,14 +3,17 @@ class ordersDetailsDispatchOrderViewResponse { String? error; String? message; - ordersDetailsDispatchOrderViewResponse( - {this.products, this.error, this.message}); + ordersDetailsDispatchOrderViewResponse({ + this.products, + this.error, + this.message, + }); ordersDetailsDispatchOrderViewResponse.fromJson(Map json) { if (json['products'] != null) { products = []; json['products'].forEach((v) { - products!.add(new Products.fromJson(v)); + products!.add(Products.fromJson(v)); }); } error = json['error']; @@ -18,12 +21,12 @@ class ordersDetailsDispatchOrderViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.products != null) { - data['products'] = this.products!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (products != null) { + data['products'] = products!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -45,22 +48,23 @@ class Products { String? productName; String? crmOrderPId; - Products( - {this.id, - this.orderId, - this.productId, - this.pdiId, - this.qty, - this.unitPrice, - this.cgstPercentage, - this.sgstPercentage, - this.igstPercentage, - this.totalPrice, - this.isExist, - this.createdDatetime, - this.updatedDatetime, - this.productName, - this.crmOrderPId}); + Products({ + this.id, + this.orderId, + this.productId, + this.pdiId, + this.qty, + this.unitPrice, + this.cgstPercentage, + this.sgstPercentage, + this.igstPercentage, + this.totalPrice, + this.isExist, + this.createdDatetime, + this.updatedDatetime, + this.productName, + this.crmOrderPId, + }); Products.fromJson(Map json) { id = json['id']; @@ -81,22 +85,22 @@ class Products { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['order_id'] = this.orderId; - data['product_id'] = this.productId; - data['pdi_id'] = this.pdiId; - data['qty'] = this.qty; - data['unit_price'] = this.unitPrice; - data['cgst_percentage'] = this.cgstPercentage; - data['sgst_percentage'] = this.sgstPercentage; - data['igst_percentage'] = this.igstPercentage; - data['total_price'] = this.totalPrice; - data['is_exist'] = this.isExist; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['product_name'] = this.productName; - data['crm_order_p_id'] = this.crmOrderPId; + final Map data = {}; + data['id'] = id; + data['order_id'] = orderId; + data['product_id'] = productId; + data['pdi_id'] = pdiId; + data['qty'] = qty; + data['unit_price'] = unitPrice; + data['cgst_percentage'] = cgstPercentage; + data['sgst_percentage'] = sgstPercentage; + data['igst_percentage'] = igstPercentage; + data['total_price'] = totalPrice; + data['is_exist'] = isExist; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['product_name'] = productName; + data['crm_order_p_id'] = crmOrderPId; return data; } } diff --git a/lib/Models/ordersModels/ordersDetailsEditOrderViewResponse.dart b/lib/Models/ordersModels/ordersDetailsEditOrderViewResponse.dart index 9c909f1..15a405e 100644 --- a/lib/Models/ordersModels/ordersDetailsEditOrderViewResponse.dart +++ b/lib/Models/ordersModels/ordersDetailsEditOrderViewResponse.dart @@ -4,17 +4,22 @@ class ordersDetailsEditOrderViewResponse { String? error; String? message; - ordersDetailsEditOrderViewResponse( - {this.orderDetails, this.states, this.error, this.message}); + ordersDetailsEditOrderViewResponse({ + this.orderDetails, + this.states, + this.error, + this.message, + }); ordersDetailsEditOrderViewResponse.fromJson(Map json) { - orderDetails = json['order_details'] != null - ? new OrderDetails.fromJson(json['order_details']) - : null; + orderDetails = + json['order_details'] != null + ? OrderDetails.fromJson(json['order_details']) + : null; if (json['states'] != null) { states = []; json['states'].forEach((v) { - states!.add(new States.fromJson(v)); + states!.add(States.fromJson(v)); }); } error = json['error']; @@ -22,15 +27,15 @@ class ordersDetailsEditOrderViewResponse { } Map toJson() { - final Map data = new Map(); - if (this.orderDetails != null) { - data['order_details'] = this.orderDetails!.toJson(); + final Map data = {}; + if (orderDetails != null) { + data['order_details'] = orderDetails!.toJson(); } - if (this.states != null) { - data['states'] = this.states!.map((v) => v.toJson()).toList(); + if (states != null) { + data['states'] = states!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -97,71 +102,72 @@ class OrderDetails { String? adjustedAmount; String? enteredEmpName; String? salesPersonEmpName; - Null? tpcaAgentName; + Null tpcaAgentName; - OrderDetails( - {this.id, - this.orderNumber, - this.orderNumberHash, - this.accId, - this.refType, - this.refId, - this.salesPersonEmpId, - this.enteredEmpId, - this.dispatchStateId, - this.dispatchDistrictId, - this.dispatchSubLocationId, - this.dispatchPincode, - this.dispatchAddress, - this.basicAmount, - this.cgstAmount, - this.sgstAmount, - this.igstAmount, - this.paidAmount, - this.totalAmount, - this.status, - this.orderReceivedDate, - this.scheduledDispatchDate, - this.otp, - this.note, - this.poViewFileName, - this.poDirFilePath, - this.unloadingScope, - this.freightScope, - this.erectionScope, - this.saleOrderNumber, - this.invoiceNumber, - this.vehicleNumber, - this.driverName, - this.driverMobileNumber, - this.tpcApplicable, - this.requestedTpcAmount, - this.level1TpcApprovedAmount, - this.level2TpcApprovedAmount, - this.tpcPaymentMode, - this.tpcPaymentReferenceNo, - this.tpcPaymentAttachmentDirFilePath, - this.tpcPaymentAttachementViewFileName, - this.tpcStatus, - this.tpcAgentId, - this.isExist, - this.createdDatetime, - this.updatedDatetime, - this.accountName, - this.gstNumber, - this.billingAddress, - this.district, - this.state, - this.subLocality, - this.billingPincode, - this.stateName, - this.balanceAmount, - this.districtName, - this.subLocationName, - this.adjustedAmount, - this.enteredEmpName, - this.salesPersonEmpName, - this.tpcaAgentName}); + OrderDetails({ + this.id, + this.orderNumber, + this.orderNumberHash, + this.accId, + this.refType, + this.refId, + this.salesPersonEmpId, + this.enteredEmpId, + this.dispatchStateId, + this.dispatchDistrictId, + this.dispatchSubLocationId, + this.dispatchPincode, + this.dispatchAddress, + this.basicAmount, + this.cgstAmount, + this.sgstAmount, + this.igstAmount, + this.paidAmount, + this.totalAmount, + this.status, + this.orderReceivedDate, + this.scheduledDispatchDate, + this.otp, + this.note, + this.poViewFileName, + this.poDirFilePath, + this.unloadingScope, + this.freightScope, + this.erectionScope, + this.saleOrderNumber, + this.invoiceNumber, + this.vehicleNumber, + this.driverName, + this.driverMobileNumber, + this.tpcApplicable, + this.requestedTpcAmount, + this.level1TpcApprovedAmount, + this.level2TpcApprovedAmount, + this.tpcPaymentMode, + this.tpcPaymentReferenceNo, + this.tpcPaymentAttachmentDirFilePath, + this.tpcPaymentAttachementViewFileName, + this.tpcStatus, + this.tpcAgentId, + this.isExist, + this.createdDatetime, + this.updatedDatetime, + this.accountName, + this.gstNumber, + this.billingAddress, + this.district, + this.state, + this.subLocality, + this.billingPincode, + this.stateName, + this.balanceAmount, + this.districtName, + this.subLocationName, + this.adjustedAmount, + this.enteredEmpName, + this.salesPersonEmpName, + this.tpcaAgentName, + }); OrderDetails.fromJson(Map json) { id = json['id']; @@ -205,9 +211,9 @@ class OrderDetails { tpcPaymentMode = json['tpc_payment_mode']; tpcPaymentReferenceNo = json['tpc_payment_reference_no']; tpcPaymentAttachmentDirFilePath = - json['tpc_payment_attachment_dir_file_path']; + json['tpc_payment_attachment_dir_file_path']; tpcPaymentAttachementViewFileName = - json['tpc_payment_attachement_view_file_name']; + json['tpc_payment_attachement_view_file_name']; tpcStatus = json['tpc_status']; tpcAgentId = json['tpc_agent_id']; isExist = json['is_exist']; @@ -231,71 +237,71 @@ class OrderDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['order_number'] = this.orderNumber; - data['order_number_hash'] = this.orderNumberHash; - data['acc_id'] = this.accId; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['sales_person_emp_id'] = this.salesPersonEmpId; - data['entered_emp_id'] = this.enteredEmpId; - data['dispatch_state_id'] = this.dispatchStateId; - data['dispatch_district_id'] = this.dispatchDistrictId; - data['dispatch_sub_location_id'] = this.dispatchSubLocationId; - data['dispatch_pincode'] = this.dispatchPincode; - data['dispatch_address'] = this.dispatchAddress; - data['basic_amount'] = this.basicAmount; - data['cgst_amount'] = this.cgstAmount; - data['sgst_amount'] = this.sgstAmount; - data['igst_amount'] = this.igstAmount; - data['paid_amount'] = this.paidAmount; - data['total_amount'] = this.totalAmount; - data['status'] = this.status; - data['order_received_date'] = this.orderReceivedDate; - data['scheduled_dispatch_date'] = this.scheduledDispatchDate; - data['otp'] = this.otp; - data['note'] = this.note; - data['po_view_file_name'] = this.poViewFileName; - data['po_dir_file_path'] = this.poDirFilePath; - data['unloading_scope'] = this.unloadingScope; - data['freight_scope'] = this.freightScope; - data['erection_scope'] = this.erectionScope; - data['sale_order_number'] = this.saleOrderNumber; - data['invoice_number'] = this.invoiceNumber; - data['vehicle_number'] = this.vehicleNumber; - data['driver_name'] = this.driverName; - data['driver_mobile_number'] = this.driverMobileNumber; - data['tpc_applicable'] = this.tpcApplicable; - data['requested_tpc_amount'] = this.requestedTpcAmount; - data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount; - data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount; - data['tpc_payment_mode'] = this.tpcPaymentMode; - data['tpc_payment_reference_no'] = this.tpcPaymentReferenceNo; + final Map data = {}; + data['id'] = id; + data['order_number'] = orderNumber; + data['order_number_hash'] = orderNumberHash; + data['acc_id'] = accId; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['sales_person_emp_id'] = salesPersonEmpId; + data['entered_emp_id'] = enteredEmpId; + data['dispatch_state_id'] = dispatchStateId; + data['dispatch_district_id'] = dispatchDistrictId; + data['dispatch_sub_location_id'] = dispatchSubLocationId; + data['dispatch_pincode'] = dispatchPincode; + data['dispatch_address'] = dispatchAddress; + data['basic_amount'] = basicAmount; + data['cgst_amount'] = cgstAmount; + data['sgst_amount'] = sgstAmount; + data['igst_amount'] = igstAmount; + data['paid_amount'] = paidAmount; + data['total_amount'] = totalAmount; + data['status'] = status; + data['order_received_date'] = orderReceivedDate; + data['scheduled_dispatch_date'] = scheduledDispatchDate; + data['otp'] = otp; + data['note'] = note; + data['po_view_file_name'] = poViewFileName; + data['po_dir_file_path'] = poDirFilePath; + data['unloading_scope'] = unloadingScope; + data['freight_scope'] = freightScope; + data['erection_scope'] = erectionScope; + data['sale_order_number'] = saleOrderNumber; + data['invoice_number'] = invoiceNumber; + data['vehicle_number'] = vehicleNumber; + data['driver_name'] = driverName; + data['driver_mobile_number'] = driverMobileNumber; + data['tpc_applicable'] = tpcApplicable; + data['requested_tpc_amount'] = requestedTpcAmount; + data['level1_tpc_approved_amount'] = level1TpcApprovedAmount; + data['level2_tpc_approved_amount'] = level2TpcApprovedAmount; + data['tpc_payment_mode'] = tpcPaymentMode; + data['tpc_payment_reference_no'] = tpcPaymentReferenceNo; data['tpc_payment_attachment_dir_file_path'] = - this.tpcPaymentAttachmentDirFilePath; + tpcPaymentAttachmentDirFilePath; data['tpc_payment_attachement_view_file_name'] = - this.tpcPaymentAttachementViewFileName; - data['tpc_status'] = this.tpcStatus; - data['tpc_agent_id'] = this.tpcAgentId; - data['is_exist'] = this.isExist; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['account_name'] = this.accountName; - data['gst_number'] = this.gstNumber; - data['billing_address'] = this.billingAddress; - data['district'] = this.district; - data['state'] = this.state; - data['sub_locality'] = this.subLocality; - data['billing_pincode'] = this.billingPincode; - data['state_name'] = this.stateName; - data['balance_amount'] = this.balanceAmount; - data['district_name'] = this.districtName; - data['sub_location_name'] = this.subLocationName; - data['adjusted_amount'] = this.adjustedAmount; - data['entered_emp_name'] = this.enteredEmpName; - data['sales_person_emp_name'] = this.salesPersonEmpName; - data['tpca_agent_name'] = this.tpcaAgentName; + tpcPaymentAttachementViewFileName; + data['tpc_status'] = tpcStatus; + data['tpc_agent_id'] = tpcAgentId; + data['is_exist'] = isExist; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['account_name'] = accountName; + data['gst_number'] = gstNumber; + data['billing_address'] = billingAddress; + data['district'] = district; + data['state'] = state; + data['sub_locality'] = subLocality; + data['billing_pincode'] = billingPincode; + data['state_name'] = stateName; + data['balance_amount'] = balanceAmount; + data['district_name'] = districtName; + data['sub_location_name'] = subLocationName; + data['adjusted_amount'] = adjustedAmount; + data['entered_emp_name'] = enteredEmpName; + data['sales_person_emp_name'] = salesPersonEmpName; + data['tpca_agent_name'] = tpcaAgentName; return data; } } @@ -312,9 +318,9 @@ class States { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/ordersModels/ordersListByModeFilterResponse.dart b/lib/Models/ordersModels/ordersListByModeFilterResponse.dart index 2dab993..926b6b7 100644 --- a/lib/Models/ordersModels/ordersListByModeFilterResponse.dart +++ b/lib/Models/ordersModels/ordersListByModeFilterResponse.dart @@ -4,14 +4,18 @@ class ordersListByModeFilterResponse { String? error; String? message; - ordersListByModeFilterResponse( - {this.employees, this.leadStatus, this.error, this.message}); + ordersListByModeFilterResponse({ + this.employees, + this.leadStatus, + this.error, + this.message, + }); ordersListByModeFilterResponse.fromJson(Map json) { if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new Employees.fromJson(v)); + employees!.add(Employees.fromJson(v)); }); } leadStatus = json['lead_status'].cast(); @@ -20,13 +24,13 @@ class ordersListByModeFilterResponse { } Map toJson() { - final Map data = new Map(); - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } - data['lead_status'] = this.leadStatus; - data['error'] = this.error; - data['message'] = this.message; + data['lead_status'] = leadStatus; + data['error'] = error; + data['message'] = message; return data; } } @@ -43,9 +47,9 @@ class Employees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/ordersModels/ordersListByModeResponse.dart b/lib/Models/ordersModels/ordersListByModeResponse.dart index 8aa1d35..5580370 100644 --- a/lib/Models/ordersModels/ordersListByModeResponse.dart +++ b/lib/Models/ordersModels/ordersListByModeResponse.dart @@ -9,7 +9,7 @@ class ordersListByModeResponse { if (json['order_list'] != null) { orderList = []; json['order_list'].forEach((v) { - orderList!.add(new OrderList.fromJson(v)); + orderList!.add(OrderList.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class ordersListByModeResponse { } Map toJson() { - final Map data = new Map(); - if (this.orderList != null) { - data['order_list'] = this.orderList!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (orderList != null) { + data['order_list'] = orderList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -54,32 +54,33 @@ class OrderList { String? feedbackDate; String? feedbackEmpName; - OrderList( - {this.orderId, - this.orderNumber, - this.refType, - this.totalAmount, - this.paidAmount, - this.balanceAmount, - this.otp, - this.orderReceivedDate, - this.scheduledDispatchDate, - this.status, - this.createdDatetime, - this.updatedDatetime, - this.accountName, - this.paymentAmount, - this.enteredEmpName, - this.salesPersonEmpName, - this.tpcAgentName, - this.requestedTpcAmount, - this.tpcApplicable, - this.level1TpcApprovedAmount, - this.level2TpcApprovedAmount, - this.tpcStatus, - this.latestFeedback, - this.feedbackDate, - this.feedbackEmpName}); + OrderList({ + this.orderId, + this.orderNumber, + this.refType, + this.totalAmount, + this.paidAmount, + this.balanceAmount, + this.otp, + this.orderReceivedDate, + this.scheduledDispatchDate, + this.status, + this.createdDatetime, + this.updatedDatetime, + this.accountName, + this.paymentAmount, + this.enteredEmpName, + this.salesPersonEmpName, + this.tpcAgentName, + this.requestedTpcAmount, + this.tpcApplicable, + this.level1TpcApprovedAmount, + this.level2TpcApprovedAmount, + this.tpcStatus, + this.latestFeedback, + this.feedbackDate, + this.feedbackEmpName, + }); OrderList.fromJson(Map json) { orderId = json['order_id']; @@ -110,32 +111,32 @@ class OrderList { } Map toJson() { - final Map data = new Map(); - data['order_id'] = this.orderId; - data['order_number'] = this.orderNumber; - data['ref_type'] = this.refType; - data['total_amount'] = this.totalAmount; - data['paid_amount'] = this.paidAmount; - data['balance_amount'] = this.balanceAmount; - data['otp'] = this.otp; - data['order_received_date'] = this.orderReceivedDate; - data['scheduled_dispatch_date'] = this.scheduledDispatchDate; - data['status'] = this.status; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['account_name'] = this.accountName; - data['payment_amount'] = this.paymentAmount; - data['entered_emp_name'] = this.enteredEmpName; - data['sales_person_emp_name'] = this.salesPersonEmpName; - data['tpc_agent_name'] = this.tpcAgentName; - data['requested_tpc_amount'] = this.requestedTpcAmount; - data['tpc_applicable'] = this.tpcApplicable; - data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount; - data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount; - data['tpc_status'] = this.tpcStatus; - data['latest_feedback'] = this.latestFeedback; - data['feedback_date'] = this.feedbackDate; - data['feedback_emp_name'] = this.feedbackEmpName; + final Map data = {}; + data['order_id'] = orderId; + data['order_number'] = orderNumber; + data['ref_type'] = refType; + data['total_amount'] = totalAmount; + data['paid_amount'] = paidAmount; + data['balance_amount'] = balanceAmount; + data['otp'] = otp; + data['order_received_date'] = orderReceivedDate; + data['scheduled_dispatch_date'] = scheduledDispatchDate; + data['status'] = status; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['account_name'] = accountName; + data['payment_amount'] = paymentAmount; + data['entered_emp_name'] = enteredEmpName; + data['sales_person_emp_name'] = salesPersonEmpName; + data['tpc_agent_name'] = tpcAgentName; + data['requested_tpc_amount'] = requestedTpcAmount; + data['tpc_applicable'] = tpcApplicable; + data['level1_tpc_approved_amount'] = level1TpcApprovedAmount; + data['level2_tpc_approved_amount'] = level2TpcApprovedAmount; + data['tpc_status'] = tpcStatus; + data['latest_feedback'] = latestFeedback; + data['feedback_date'] = feedbackDate; + data['feedback_emp_name'] = feedbackEmpName; return data; } } diff --git a/lib/Models/ordersModels/ordersPdiIdByEngNumberResponse.dart b/lib/Models/ordersModels/ordersPdiIdByEngNumberResponse.dart index 07d4ca2..da3379c 100644 --- a/lib/Models/ordersModels/ordersPdiIdByEngNumberResponse.dart +++ b/lib/Models/ordersModels/ordersPdiIdByEngNumberResponse.dart @@ -12,10 +12,10 @@ class ordersPdiIdByEngNumberResponse { } Map toJson() { - final Map data = new Map(); - data['pdi_id'] = this.pdiId; - data['error'] = this.error; - data['message'] = this.message; + final Map data = {}; + data['pdi_id'] = pdiId; + data['error'] = error; + data['message'] = message; return data; } } diff --git a/lib/Models/ordersModels/paymentDetailsByModeFilterResponse.dart b/lib/Models/ordersModels/paymentDetailsByModeFilterResponse.dart index 285b985..f5be78e 100644 --- a/lib/Models/ordersModels/paymentDetailsByModeFilterResponse.dart +++ b/lib/Models/ordersModels/paymentDetailsByModeFilterResponse.dart @@ -4,17 +4,22 @@ class paymentDetailsByModeFilterResponse { String? error; String? message; - paymentDetailsByModeFilterResponse( - {this.paymentDetails, this.paidList, this.error, this.message}); + paymentDetailsByModeFilterResponse({ + this.paymentDetails, + this.paidList, + this.error, + this.message, + }); paymentDetailsByModeFilterResponse.fromJson(Map json) { - paymentDetails = json['payment_details'] != null - ? new PaymentDetails.fromJson(json['payment_details']) - : null; + paymentDetails = + json['payment_details'] != null + ? PaymentDetails.fromJson(json['payment_details']) + : null; if (json['paid_list'] != null) { paidList = []; json['paid_list'].forEach((v) { - paidList!.add(new PaidList.fromJson(v)); + paidList!.add(PaidList.fromJson(v)); }); } error = json['error']; @@ -22,15 +27,15 @@ class paymentDetailsByModeFilterResponse { } Map toJson() { - final Map data = new Map(); - if (this.paymentDetails != null) { - data['payment_details'] = this.paymentDetails!.toJson(); + final Map data = {}; + if (paymentDetails != null) { + data['payment_details'] = paymentDetails!.toJson(); } - if (this.paidList != null) { - data['paid_list'] = this.paidList!.map((v) => v.toJson()).toList(); + if (paidList != null) { + data['paid_list'] = paidList!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -57,27 +62,28 @@ class PaymentDetails { String? description; String? amount; - PaymentDetails( - {this.attachment, - this.attachmentDirFilePath, - this.attachmentViewFileName, - this.paymentId, - this.status, - this.enteredEmpName, - this.accId, - this.accountName, - this.approvalEmployee, - this.paymentType, - this.refType, - this.refId, - this.refNo, - this.datetime, - this.approvalStatus, - this.paymentDate, - this.adjustedAmount, - this.approvalEmpId, - this.description, - this.amount}); + PaymentDetails({ + this.attachment, + this.attachmentDirFilePath, + this.attachmentViewFileName, + this.paymentId, + this.status, + this.enteredEmpName, + this.accId, + this.accountName, + this.approvalEmployee, + this.paymentType, + this.refType, + this.refId, + this.refNo, + this.datetime, + this.approvalStatus, + this.paymentDate, + this.adjustedAmount, + this.approvalEmpId, + this.description, + this.amount, + }); PaymentDetails.fromJson(Map json) { attachment = json['attachment']; @@ -103,27 +109,27 @@ class PaymentDetails { } Map toJson() { - final Map data = new Map(); - data['attachment'] = this.attachment; - data['attachment_dir_file_path'] = this.attachmentDirFilePath; - data['attachment_view_file_name'] = this.attachmentViewFileName; - data['payment_id'] = this.paymentId; - data['status'] = this.status; - data['entered_emp_name'] = this.enteredEmpName; - data['acc_id'] = this.accId; - data['account_name'] = this.accountName; - data['approval_employee'] = this.approvalEmployee; - data['payment_type'] = this.paymentType; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['ref_no'] = this.refNo; - data['datetime'] = this.datetime; - data['approval_status'] = this.approvalStatus; - data['payment_date'] = this.paymentDate; - data['adjusted_amount'] = this.adjustedAmount; - data['approval_emp_id'] = this.approvalEmpId; - data['description'] = this.description; - data['amount'] = this.amount; + final Map data = {}; + data['attachment'] = attachment; + data['attachment_dir_file_path'] = attachmentDirFilePath; + data['attachment_view_file_name'] = attachmentViewFileName; + data['payment_id'] = paymentId; + data['status'] = status; + data['entered_emp_name'] = enteredEmpName; + data['acc_id'] = accId; + data['account_name'] = accountName; + data['approval_employee'] = approvalEmployee; + data['payment_type'] = paymentType; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['ref_no'] = refNo; + data['datetime'] = datetime; + data['approval_status'] = approvalStatus; + data['payment_date'] = paymentDate; + data['adjusted_amount'] = adjustedAmount; + data['approval_emp_id'] = approvalEmpId; + data['description'] = description; + data['amount'] = amount; return data; } } @@ -181,58 +187,59 @@ class PaidList { String? orderPaymentId; String? datetime; - PaidList( - {this.id, - this.orderNumber, - this.orderNumberHash, - this.accId, - this.refType, - this.refId, - this.salesPersonEmpId, - this.enteredEmpId, - this.dispatchStateId, - this.dispatchDistrictId, - this.dispatchSubLocationId, - this.dispatchPincode, - this.dispatchAddress, - this.basicAmount, - this.cgstAmount, - this.sgstAmount, - this.igstAmount, - this.paidAmount, - this.balanceAmount, - this.totalAmount, - this.status, - this.orderReceivedDate, - this.scheduledDispatchDate, - this.otp, - this.note, - this.poViewFileName, - this.poDirFilePath, - this.unloadingScope, - this.freightScope, - this.erectionScope, - this.saleOrderNumber, - this.invoiceNumber, - this.vehicleNumber, - this.driverName, - this.driverMobileNumber, - this.tpcApplicable, - this.requestedTpcAmount, - this.level1TpcApprovedAmount, - this.level2TpcApprovedAmount, - this.tpcPaymentMode, - this.tpcPaymentReferenceNo, - this.tpcPaymentAttachmentDirFilePath, - this.tpcPaymentAttachementViewFileName, - this.tpcStatus, - this.tpcAgentId, - this.isExist, - this.createdDatetime, - this.updatedDatetime, - this.adjustedAmount, - this.orderPaymentId, - this.datetime}); + PaidList({ + this.id, + this.orderNumber, + this.orderNumberHash, + this.accId, + this.refType, + this.refId, + this.salesPersonEmpId, + this.enteredEmpId, + this.dispatchStateId, + this.dispatchDistrictId, + this.dispatchSubLocationId, + this.dispatchPincode, + this.dispatchAddress, + this.basicAmount, + this.cgstAmount, + this.sgstAmount, + this.igstAmount, + this.paidAmount, + this.balanceAmount, + this.totalAmount, + this.status, + this.orderReceivedDate, + this.scheduledDispatchDate, + this.otp, + this.note, + this.poViewFileName, + this.poDirFilePath, + this.unloadingScope, + this.freightScope, + this.erectionScope, + this.saleOrderNumber, + this.invoiceNumber, + this.vehicleNumber, + this.driverName, + this.driverMobileNumber, + this.tpcApplicable, + this.requestedTpcAmount, + this.level1TpcApprovedAmount, + this.level2TpcApprovedAmount, + this.tpcPaymentMode, + this.tpcPaymentReferenceNo, + this.tpcPaymentAttachmentDirFilePath, + this.tpcPaymentAttachementViewFileName, + this.tpcStatus, + this.tpcAgentId, + this.isExist, + this.createdDatetime, + this.updatedDatetime, + this.adjustedAmount, + this.orderPaymentId, + this.datetime, + }); PaidList.fromJson(Map json) { id = json['id']; @@ -277,9 +284,9 @@ class PaidList { tpcPaymentMode = json['tpc_payment_mode']; tpcPaymentReferenceNo = json['tpc_payment_reference_no']; tpcPaymentAttachmentDirFilePath = - json['tpc_payment_attachment_dir_file_path']; + json['tpc_payment_attachment_dir_file_path']; tpcPaymentAttachementViewFileName = - json['tpc_payment_attachement_view_file_name']; + json['tpc_payment_attachement_view_file_name']; tpcStatus = json['tpc_status']; tpcAgentId = json['tpc_agent_id']; isExist = json['is_exist']; @@ -291,60 +298,60 @@ class PaidList { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['order_number'] = this.orderNumber; - data['order_number_hash'] = this.orderNumberHash; - data['acc_id'] = this.accId; - data['ref_type'] = this.refType; - data['ref_id'] = this.refId; - data['sales_person_emp_id'] = this.salesPersonEmpId; - data['entered_emp_id'] = this.enteredEmpId; - data['dispatch_state_id'] = this.dispatchStateId; - data['dispatch_district_id'] = this.dispatchDistrictId; - data['dispatch_sub_location_id'] = this.dispatchSubLocationId; - data['dispatch_pincode'] = this.dispatchPincode; - data['dispatch_address'] = this.dispatchAddress; - data['basic_amount'] = this.basicAmount; - data['cgst_amount'] = this.cgstAmount; - data['sgst_amount'] = this.sgstAmount; - data['igst_amount'] = this.igstAmount; - data['paid_amount'] = this.paidAmount; - data['balance_amount'] = this.balanceAmount; - data['total_amount'] = this.totalAmount; - data['status'] = this.status; - data['order_received_date'] = this.orderReceivedDate; - data['scheduled_dispatch_date'] = this.scheduledDispatchDate; - data['otp'] = this.otp; - data['note'] = this.note; - data['po_view_file_name'] = this.poViewFileName; - data['po_dir_file_path'] = this.poDirFilePath; - data['unloading_scope'] = this.unloadingScope; - data['freight_scope'] = this.freightScope; - data['erection_scope'] = this.erectionScope; - data['sale_order_number'] = this.saleOrderNumber; - data['invoice_number'] = this.invoiceNumber; - data['vehicle_number'] = this.vehicleNumber; - data['driver_name'] = this.driverName; - data['driver_mobile_number'] = this.driverMobileNumber; - data['tpc_applicable'] = this.tpcApplicable; - data['requested_tpc_amount'] = this.requestedTpcAmount; - data['level1_tpc_approved_amount'] = this.level1TpcApprovedAmount; - data['level2_tpc_approved_amount'] = this.level2TpcApprovedAmount; - data['tpc_payment_mode'] = this.tpcPaymentMode; - data['tpc_payment_reference_no'] = this.tpcPaymentReferenceNo; + final Map data = {}; + data['id'] = id; + data['order_number'] = orderNumber; + data['order_number_hash'] = orderNumberHash; + data['acc_id'] = accId; + data['ref_type'] = refType; + data['ref_id'] = refId; + data['sales_person_emp_id'] = salesPersonEmpId; + data['entered_emp_id'] = enteredEmpId; + data['dispatch_state_id'] = dispatchStateId; + data['dispatch_district_id'] = dispatchDistrictId; + data['dispatch_sub_location_id'] = dispatchSubLocationId; + data['dispatch_pincode'] = dispatchPincode; + data['dispatch_address'] = dispatchAddress; + data['basic_amount'] = basicAmount; + data['cgst_amount'] = cgstAmount; + data['sgst_amount'] = sgstAmount; + data['igst_amount'] = igstAmount; + data['paid_amount'] = paidAmount; + data['balance_amount'] = balanceAmount; + data['total_amount'] = totalAmount; + data['status'] = status; + data['order_received_date'] = orderReceivedDate; + data['scheduled_dispatch_date'] = scheduledDispatchDate; + data['otp'] = otp; + data['note'] = note; + data['po_view_file_name'] = poViewFileName; + data['po_dir_file_path'] = poDirFilePath; + data['unloading_scope'] = unloadingScope; + data['freight_scope'] = freightScope; + data['erection_scope'] = erectionScope; + data['sale_order_number'] = saleOrderNumber; + data['invoice_number'] = invoiceNumber; + data['vehicle_number'] = vehicleNumber; + data['driver_name'] = driverName; + data['driver_mobile_number'] = driverMobileNumber; + data['tpc_applicable'] = tpcApplicable; + data['requested_tpc_amount'] = requestedTpcAmount; + data['level1_tpc_approved_amount'] = level1TpcApprovedAmount; + data['level2_tpc_approved_amount'] = level2TpcApprovedAmount; + data['tpc_payment_mode'] = tpcPaymentMode; + data['tpc_payment_reference_no'] = tpcPaymentReferenceNo; data['tpc_payment_attachment_dir_file_path'] = - this.tpcPaymentAttachmentDirFilePath; + tpcPaymentAttachmentDirFilePath; data['tpc_payment_attachement_view_file_name'] = - this.tpcPaymentAttachementViewFileName; - data['tpc_status'] = this.tpcStatus; - data['tpc_agent_id'] = this.tpcAgentId; - data['is_exist'] = this.isExist; - data['created_datetime'] = this.createdDatetime; - data['updated_datetime'] = this.updatedDatetime; - data['adjusted_amount'] = this.adjustedAmount; - data['order_payment_id'] = this.orderPaymentId; - data['datetime'] = this.datetime; + tpcPaymentAttachementViewFileName; + data['tpc_status'] = tpcStatus; + data['tpc_agent_id'] = tpcAgentId; + data['is_exist'] = isExist; + data['created_datetime'] = createdDatetime; + data['updated_datetime'] = updatedDatetime; + data['adjusted_amount'] = adjustedAmount; + data['order_payment_id'] = orderPaymentId; + data['datetime'] = datetime; return data; } } diff --git a/lib/Models/ordersModels/paymentListByModeFilterResponse.dart b/lib/Models/ordersModels/paymentListByModeFilterResponse.dart index 788819e..59d71f8 100644 --- a/lib/Models/ordersModels/paymentListByModeFilterResponse.dart +++ b/lib/Models/ordersModels/paymentListByModeFilterResponse.dart @@ -9,7 +9,7 @@ class paymentListByModeFilterResponse { if (json['employees'] != null) { employees = []; json['employees'].forEach((v) { - employees!.add(new Employees.fromJson(v)); + employees!.add(Employees.fromJson(v)); }); } error = json['error']; @@ -17,12 +17,12 @@ class paymentListByModeFilterResponse { } Map toJson() { - final Map data = new Map(); - if (this.employees != null) { - data['employees'] = this.employees!.map((v) => v.toJson()).toList(); + final Map data = {}; + if (employees != null) { + data['employees'] = employees!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -39,9 +39,9 @@ class Employees { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Models/ordersModels/paymentListByModeResponse.dart b/lib/Models/ordersModels/paymentListByModeResponse.dart index 7624e48..82b03db 100644 --- a/lib/Models/ordersModels/paymentListByModeResponse.dart +++ b/lib/Models/ordersModels/paymentListByModeResponse.dart @@ -10,19 +10,19 @@ class paymentListByModeResponse { if (json['order_list'] != null) { orderList = []; json['order_list'].forEach((v) { - orderList!.add(new OrderList.fromJson(v)); + orderList!.add(OrderList.fromJson(v)); }); } message = json['message']; } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - if (this.orderList != null) { - data['order_list'] = this.orderList!.map((v) => v.toJson()).toList(); + final Map data = {}; + data['error'] = error; + if (orderList != null) { + data['order_list'] = orderList!.map((v) => v.toJson()).toList(); } - data['message'] = this.message; + data['message'] = message; return data; } } @@ -47,25 +47,26 @@ class OrderList { String? amount; String? datetime; - OrderList( - {this.attachment, - this.paymentId, - this.orderNumber, - this.status, - this.ename, - this.aname, - this.approvalEmployee, - this.paymentType, - this.refId, - this.refType, - this.refNo, - this.approvalStatus, - this.paymentDate, - this.approvalEmpId, - this.adjustedAmount, - this.description, - this.amount, - this.datetime}); + OrderList({ + this.attachment, + this.paymentId, + this.orderNumber, + this.status, + this.ename, + this.aname, + this.approvalEmployee, + this.paymentType, + this.refId, + this.refType, + this.refNo, + this.approvalStatus, + this.paymentDate, + this.approvalEmpId, + this.adjustedAmount, + this.description, + this.amount, + this.datetime, + }); OrderList.fromJson(Map json) { attachment = json['attachment']; @@ -89,25 +90,25 @@ class OrderList { } Map toJson() { - final Map data = new Map(); - data['attachment'] = this.attachment; - data['payment_id'] = this.paymentId; - data['order_number'] = this.orderNumber; - data['status'] = this.status; - data['ename'] = this.ename; - data['aname'] = this.aname; - data['approval_employee'] = this.approvalEmployee; - data['payment_type'] = this.paymentType; - data['ref_id'] = this.refId; - data['ref_type'] = this.refType; - data['ref_no'] = this.refNo; - data['approval_status'] = this.approvalStatus; - data['payment_date'] = this.paymentDate; - data['approval_emp_id'] = this.approvalEmpId; - data['adjusted_amount'] = this.adjustedAmount; - data['description'] = this.description; - data['amount'] = this.amount; - data['datetime'] = this.datetime; + final Map data = {}; + data['attachment'] = attachment; + data['payment_id'] = paymentId; + data['order_number'] = orderNumber; + data['status'] = status; + data['ename'] = ename; + data['aname'] = aname; + data['approval_employee'] = approvalEmployee; + data['payment_type'] = paymentType; + data['ref_id'] = refId; + data['ref_type'] = refType; + data['ref_no'] = refNo; + data['approval_status'] = approvalStatus; + data['payment_date'] = paymentDate; + data['approval_emp_id'] = approvalEmpId; + data['adjusted_amount'] = adjustedAmount; + data['description'] = description; + data['amount'] = amount; + data['datetime'] = datetime; return data; } } diff --git a/lib/Models/ordersModels/technicianAddPaymentResendOTPResponse.dart b/lib/Models/ordersModels/technicianAddPaymentResendOTPResponse.dart index fe61bde..ae1eb22 100644 --- a/lib/Models/ordersModels/technicianAddPaymentResendOTPResponse.dart +++ b/lib/Models/ordersModels/technicianAddPaymentResendOTPResponse.dart @@ -3,8 +3,11 @@ class Technicianaddpaymentresendotpresponse { String? message; int? sessionExists; - Technicianaddpaymentresendotpresponse( - {this.error, this.message, this.sessionExists}); + Technicianaddpaymentresendotpresponse({ + this.error, + this.message, + this.sessionExists, + }); Technicianaddpaymentresendotpresponse.fromJson(Map json) { error = json['error']; @@ -13,10 +16,10 @@ class Technicianaddpaymentresendotpresponse { } Map toJson() { - final Map data = new Map(); - data['error'] = this.error; - data['message'] = this.message; - data['session_exists'] = this.sessionExists; + final Map data = {}; + data['error'] = error; + data['message'] = message; + data['session_exists'] = sessionExists; return data; } } diff --git a/lib/Notifiers/AttendanceNotifier.dart b/lib/Notifiers/AttendanceNotifier.dart index 54fd146..2abe5db 100644 --- a/lib/Notifiers/AttendanceNotifier.dart +++ b/lib/Notifiers/AttendanceNotifier.dart @@ -1,14 +1,10 @@ import 'dart:convert'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:generp/Utils/SharedpreferencesService.dart'; -import 'package:generp/screens/LoginScreen.dart'; import 'package:generp/services/api_calling.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; -import '../Models/AttendanceListResponse.dart'; import '../Utils/commonServices.dart'; import 'HomeScreenNotifier.dart'; @@ -98,7 +94,7 @@ class AttendanceNotifier extends ChangeNotifier { Future init(context) async { _month = DateTime.now(); _present_month = _month; - await getMonth(DateFormat('MMMM').format(_month), context); + await getMonth(DateFormat('MMMM').format(_month), context); String formattedDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); dateWiseAttendance(formattedDate, context); } @@ -114,10 +110,10 @@ class AttendanceNotifier extends ChangeNotifier { if (data.sessionExists == 1) { // _attHistory = data.attHistory!; _attendanceStatus = data.attStatus!; - Future.delayed(Duration(milliseconds: 400),() { + Future.delayed(Duration(milliseconds: 400), () { _isLoading = false; notifyListeners(); - },); + }); notifyListeners(); } else { _isLoading = true; @@ -135,10 +131,7 @@ class AttendanceNotifier extends ChangeNotifier { } } - Future dateWiseAttendance( - Selecteddate, - BuildContext context, - ) async { + Future dateWiseAttendance(Selecteddate, BuildContext context) async { try { final homeprov = Provider.of(context, listen: false); final data = await ApiCalling.DateWiseAttendanceApi( @@ -211,10 +204,10 @@ class AttendanceNotifier extends ChangeNotifier { } // print(_dateArrayList); // print(_penalityArrayList); - Future.delayed(Duration(milliseconds: 400),() { + Future.delayed(Duration(milliseconds: 400), () { _isLoading = false; notifyListeners(); - },); + }); notifyListeners(); } else { toast(context, "Null response from server."); diff --git a/lib/Notifiers/CheckInProvider.dart b/lib/Notifiers/CheckInProvider.dart index e698c3d..9f74070 100644 --- a/lib/Notifiers/CheckInProvider.dart +++ b/lib/Notifiers/CheckInProvider.dart @@ -41,7 +41,7 @@ class CheckInOutProvider with ChangeNotifier { File? get image => _image; int get imagePicked => _imagePicked; - set imagePicked(int value){ + set imagePicked(int value) { _imagePicked = value; notifyListeners(); } @@ -94,8 +94,8 @@ class CheckInOutProvider with ChangeNotifier { actions: [ TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white), + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white), ), onPressed: () async { // await openAppSettings(); @@ -116,25 +116,23 @@ class CheckInOutProvider with ChangeNotifier { } final Location.LocationData locData = await location.getLocation(); - if (locData != null) { - currentLocation = locData; - currentLocationLatLng = LatLng(locData.latitude!, locData.longitude!); - isLoading = false; - markers.clear(); - markers.add( - Marker( - markerId: MarkerId('current_location'), - position: LatLng(locData.latitude!, locData.longitude!), - infoWindow: InfoWindow(title: 'Current Location'), - icon: BitmapDescriptor.defaultMarker, - ), - ); - latlongs = '${locData.latitude},${locData.longitude}'; - mapController?.animateCamera( - CameraUpdate.newLatLng(LatLng(locData.latitude!, locData.longitude!)), - ); - notifyListeners(); - } + currentLocation = locData; + currentLocationLatLng = LatLng(locData.latitude!, locData.longitude!); + isLoading = false; + markers.clear(); + markers.add( + Marker( + markerId: MarkerId('current_location'), + position: LatLng(locData.latitude!, locData.longitude!), + infoWindow: InfoWindow(title: 'Current Location'), + icon: BitmapDescriptor.defaultMarker, + ), + ); + latlongs = '${locData.latitude},${locData.longitude}'; + mapController?.animateCamera( + CameraUpdate.newLatLng(LatLng(locData.latitude!, locData.longitude!)), + ); + notifyListeners(); } void onCameraMove(CameraPosition position, context) { @@ -143,6 +141,7 @@ class CheckInOutProvider with ChangeNotifier { getLocationPermission(context); }); } + // Future getavailableCameras(context,attendanceStatus) async { // try { // _cameras = await availableCameras(); @@ -286,6 +285,7 @@ class CheckInOutProvider with ChangeNotifier { } } + @override void dispose() { validateLocation = null; // locationController.dispose(); diff --git a/lib/Notifiers/GeneratorDetailsProvider.dart b/lib/Notifiers/GeneratorDetailsProvider.dart index f62a474..ac1a0fe 100644 --- a/lib/Notifiers/GeneratorDetailsProvider.dart +++ b/lib/Notifiers/GeneratorDetailsProvider.dart @@ -19,7 +19,6 @@ import '../Utils/app_colors.dart'; import 'HomeScreenNotifier.dart'; class Generatordetailsprovider extends ChangeNotifier { - bool _showMoreDetails = false; bool _submitLoading = false; bool _showMoreScheduleDetails = false; @@ -319,7 +318,8 @@ class Generatordetailsprovider extends ChangeNotifier { case "Generator Details": _title = "Generator Details"; _subTitle = "to open Generator Details"; - _note = "Note*: 'Tag Location' and 'Register Complaint' are moved to 'Generator Details'."; + _note = + "Note*: 'Tag Location' and 'Register Complaint' are moved to 'Generator Details'."; notifyListeners(); break; case "Register Complaint": @@ -359,7 +359,7 @@ class Generatordetailsprovider extends ChangeNotifier { _hasPermission = false; } } - } catch (e, s) {} + } catch (e) {} } Future checkLocationPermission1() async { @@ -378,7 +378,7 @@ class Generatordetailsprovider extends ChangeNotifier { _hasLocationPermission = false; } } - } catch (e, s) {} + } catch (e) {} } Future requestCameraPermission() async { @@ -396,7 +396,7 @@ class Generatordetailsprovider extends ChangeNotifier { _hasPermission = false; await Permission.camera.request(); } - } catch (e, s) {} + } catch (e) {} } Future requestLocationPermission() async { @@ -414,7 +414,7 @@ class Generatordetailsprovider extends ChangeNotifier { _hasLocationPermission = false; await Permission.location.request(); } - } catch (e, s) {} + } catch (e) {} } Future getLocationPermission(BuildContext context) async { @@ -441,8 +441,8 @@ class Generatordetailsprovider extends ChangeNotifier { actions: [ TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white), + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white), ), onPressed: () async { // await openAppSettings(); @@ -463,13 +463,11 @@ class Generatordetailsprovider extends ChangeNotifier { } final Location.LocationData locData = await location.getLocation(); - if (locData != null) { - currentLocationLatLng = LatLng(locData.latitude!, locData.longitude!); + currentLocationLatLng = LatLng(locData.latitude!, locData.longitude!); - latlongs = '${locData.latitude},${locData.longitude}'; + latlongs = '${locData.latitude},${locData.longitude}'; - notifyListeners(); - } + notifyListeners(); } Future getCurrentLocation() async { @@ -487,9 +485,9 @@ class Generatordetailsprovider extends ChangeNotifier { void onQRViewCreated(QRViewController controller, from, context) { // print("QRVIEW"); var HomeProvider = Provider.of(context, listen: false); - this._qrViewController = controller; + _qrViewController = controller; controller.scannedDataStream.listen((scanData) { - controller!.pauseCamera(); + controller.pauseCamera(); if (from == "Generator Details") { _genID = scanData.code; _genHashID = scanData.code; @@ -597,7 +595,7 @@ class Generatordetailsprovider extends ChangeNotifier { notifyListeners(); // Navigator.pop(context); if (from == "Generator Details") { - this._qrViewController!.pauseCamera(); + _qrViewController!.pauseCamera(); Navigator.pushAndRemoveUntil( context, MaterialPageRoute( @@ -612,7 +610,7 @@ class Generatordetailsprovider extends ChangeNotifier { }, ); } else if (from == "Register Complaint") { - this._qrViewController!.pauseCamera(); + _qrViewController!.pauseCamera(); Navigator.push( context, MaterialPageRoute(builder: (context) => Registercomplaint()), @@ -699,7 +697,7 @@ class Generatordetailsprovider extends ChangeNotifier { } notifyListeners(); if (from == "Generator Details") { - this._qrViewController!.pauseCamera(); + _qrViewController!.pauseCamera(); Navigator.push( context, MaterialPageRoute( @@ -707,7 +705,7 @@ class Generatordetailsprovider extends ChangeNotifier { ), ); } else if (from == "Register Complaint") { - this._qrViewController!.pauseCamera(); + _qrViewController!.pauseCamera(); Navigator.push( context, MaterialPageRoute(builder: (context) => Registercomplaint()), @@ -738,7 +736,7 @@ class Generatordetailsprovider extends ChangeNotifier { if (data != null) { if (data.sessionExists == 1) { if (data.error == 0) { - _complaintListOther = data.list??[]; + _complaintListOther = data.list ?? []; notifyListeners(); _isLoading = false; } else { @@ -770,22 +768,22 @@ class Generatordetailsprovider extends ChangeNotifier { genID, selectedTypeId, selectedDescriptionId, - running_hrs, - Complaint_Note, + runningHrs, + complaintNote, ) async { try { - print("selectedTypeId:${selectedTypeId}"); - print("selectedDescriptionId:${selectedDescriptionId}"); - print("selectedDescriptionId:${selectedDescriptionId}"); + print("selectedTypeId:$selectedTypeId"); + print("selectedDescriptionId:$selectedDescriptionId"); + print("selectedDescriptionId:$selectedDescriptionId"); final data = await ApiCalling.SubmitGeneratorComplaintAPI( homeProvider.empId, homeProvider.session, selectedTypeId, selectedDescriptionId, selectedDescriptionId, - running_hrs, + runningHrs, genID, - Complaint_Note, + complaintNote, ); if (data != null) { if (data.sessionExists == 1) { @@ -1049,7 +1047,7 @@ class Generatordetailsprovider extends ChangeNotifier { debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _imagePicked = 1; _imageError = null; notifyListeners(); @@ -1095,7 +1093,7 @@ class Generatordetailsprovider extends ChangeNotifier { Container( alignment: Alignment.topLeft, child: Text( - "#${genID}", + "#$genID", style: TextStyle( color: AppColors.semi_black, fontSize: 12, diff --git a/lib/Notifiers/HomeScreenNotifier.dart b/lib/Notifiers/HomeScreenNotifier.dart index 2a16795..afe117c 100644 --- a/lib/Notifiers/HomeScreenNotifier.dart +++ b/lib/Notifiers/HomeScreenNotifier.dart @@ -14,7 +14,7 @@ class HomescreenNotifier extends ChangeNotifier { String isBatterIgnoredText = 'Unknown'; String _username = ""; String _email = ""; - String _curdate = ""; + final String _curdate = ""; String _empId = ""; String _session = ""; String _requestId = ""; @@ -72,13 +72,14 @@ class HomescreenNotifier extends ChangeNotifier { _email = await SharedpreferencesService().getString("UserEmail") ?? ""; _session = await SharedpreferencesService().getString("Session_id") ?? ""; _roleStatus = await SharedpreferencesService().getString("roles") ?? ""; - _requestId = await SharedpreferencesService().getString("attendRequestId") ?? ""; + _requestId = + await SharedpreferencesService().getString("attendRequestId") ?? ""; var lastLocationTime = await SharedpreferencesService().getString( "lastLocationTime", ); notifyListeners(); - print("lastLocationTime:${lastLocationTime}"); + print("lastLocationTime:$lastLocationTime"); if (await SharedpreferencesService().getString("redirectUrl") == null) { _webPageUrl = "https://erp.gengroup.in/ci/app/home/web_erp?emp_id=$empId&session_id=$session"; @@ -86,14 +87,14 @@ class HomescreenNotifier extends ChangeNotifier { "https://erp.gengroup.in/ci/app/home/web_erp?emp_id=$empId&session_id=$session&login_type=whizzdom&redirect_url=https://whizzdom.gengroup.in"; } else { _webPageUrl = - "https://erp.gengroup.in/ci/app/home/web_erp?emp_id=$empId&session_id=$session&redirect_url=${await SharedpreferencesService().getString("redirectUrl").toString()}"; + "https://erp.gengroup.in/ci/app/home/web_erp?emp_id=$empId&session_id=$session&redirect_url=${SharedpreferencesService().getString("redirectUrl").toString()}"; _whizzdomPageUrl = - "https://erp.gengroup.in/ci/app/home/web_erp?emp_id=$empId&session_id=$session&login_type=whizzdom&redirect_url=${await SharedpreferencesService().getString("redirectUrl").toString()}"; + "https://erp.gengroup.in/ci/app/home/web_erp?emp_id=$empId&session_id=$session&login_type=whizzdom&redirect_url=${SharedpreferencesService().getString("redirectUrl").toString()}"; } notifyListeners(); if (kDebugMode) { - print("s:" + session); - print("r:" + roleStatus); + print("s:$session"); + print("r:$roleStatus"); print(roleStatus.length); } @@ -177,5 +178,4 @@ class HomescreenNotifier extends ChangeNotifier { print("$e"); } } - } diff --git a/lib/Notifiers/InventoryProvider.dart b/lib/Notifiers/InventoryProvider.dart index e46e9e2..1494fd2 100644 --- a/lib/Notifiers/InventoryProvider.dart +++ b/lib/Notifiers/InventoryProvider.dart @@ -29,18 +29,17 @@ class InventoryProvider extends ChangeNotifier { String _issuetype = ""; String get issuetype => _issuetype; - set issuetype(value){ + set issuetype(value) { _issuetype = value; } + String get quantityError => _quantityError; String get descriptionError => _descriptionError; - bool get isButtonEnabled => - _quantity.isNotEmpty && - _description.isNotEmpty; + bool get isButtonEnabled => _quantity.isNotEmpty && _description.isNotEmpty; String? get partID => _partID; PartData get partData => _partData; - Listget complaintList => _complaintList; + List get complaintList => _complaintList; bool get hasPermission => _hasPermission; @@ -62,7 +61,7 @@ class InventoryProvider extends ChangeNotifier { _hasPermission = false; } } - } catch (e, s) {} + } catch (e) {} } Future requestCameraPermission() async { @@ -80,14 +79,14 @@ class InventoryProvider extends ChangeNotifier { _hasPermission = false; await Permission.camera.request(); } - } catch (e, s) {} + } catch (e) {} } void onQRViewCreated(QRViewController controller, from, context) { // print("QRVIEW"); - this._qrViewController = controller; + _qrViewController = controller; controller.scannedDataStream.listen((scanData) { - controller!.pauseCamera(); + controller.pauseCamera(); if (from == "inventory") { _partID = scanData.code; notifyListeners(); @@ -95,12 +94,14 @@ class InventoryProvider extends ChangeNotifier { context, MaterialPageRoute(builder: (context) => GeneratorPartDetailsScreen()), ); - }else if(from == "pendingComplaints"){ + } else if (from == "pendingComplaints") { _partID = scanData.code; notifyListeners(); Navigator.push( context, - MaterialPageRoute(builder: (context) => Complainthistory(genHashID: scanData.code,)), + MaterialPageRoute( + builder: (context) => Complainthistory(genHashID: scanData.code), + ), ); } }); @@ -124,7 +125,7 @@ class InventoryProvider extends ChangeNotifier { _partData = data.partData!; _partID = partId; if (from == "inventory") { - this._qrViewController!.pauseCamera(); + _qrViewController!.pauseCamera(); Navigator.push( context, MaterialPageRoute( @@ -132,7 +133,6 @@ class InventoryProvider extends ChangeNotifier { ), ); } - } else if (data.error == 1) { toast(context, "Enter Correct ID"); } else {} @@ -145,11 +145,11 @@ class InventoryProvider extends ChangeNotifier { } Future LoadgeneratorComplaintHistoryApifunction( - homeProvider, - BuildContext context, - from, - genID, - ) async { + homeProvider, + BuildContext context, + from, + genID, + ) async { try { final data = await ApiCalling.LoadGeneratorComplaintListAPI( homeProvider.empId, @@ -164,10 +164,12 @@ class InventoryProvider extends ChangeNotifier { _complaintList = data.list!; _isLoading = false; - this._qrViewController!.pauseCamera(); + _qrViewController!.pauseCamera(); Navigator.push( context, - MaterialPageRoute(builder: (context) => Complainthistory(genHashID: genID,)), + MaterialPageRoute( + builder: (context) => Complainthistory(genHashID: genID), + ), ); notifyListeners(); } else { @@ -192,6 +194,7 @@ class InventoryProvider extends ChangeNotifier { print(e.toString()); } } + void updateQuantity(String issueQuantity) { _quantity = issueQuantity; _quantityError = ''; @@ -203,6 +206,7 @@ class InventoryProvider extends ChangeNotifier { _descriptionError = ''; notifyListeners(); } + bool _validate(String issueQuantity, String issueDescription) { _quantityError = ''; _descriptionError = ''; @@ -219,29 +223,36 @@ class InventoryProvider extends ChangeNotifier { return _quantityError.isEmpty && _descriptionError.isEmpty; } - Future StockRecieveIssueAPI(homeProvider,context,issueQuantity,issueDescription,partID,type) async { + Future StockRecieveIssueAPI( + homeProvider, + context, + issueQuantity, + issueDescription, + partID, + type, + ) async { try { - if (!_validate(issueQuantity, issueDescription)) return; - final data = await ApiCalling.InventoryUpdateStockAPI( homeProvider.empId, - homeProvider.session, issueQuantity, - issueDescription, partID, type); - - if (data != null) - { - - if (data.error == 0) { - toast(context, "Updated Successfully!"); - Navigator.pop(context); - - LoadPartDetailsApifunction(homeProvider,context,"",partID); + final data = await ApiCalling.InventoryUpdateStockAPI( + homeProvider.empId, + homeProvider.session, + issueQuantity, + issueDescription, + partID, + type, + ); - } else { - toast(context, "Updated Failed!"); - } - notifyListeners(); - } + if (data != null) { + if (data.error == 0) { + toast(context, "Updated Successfully!"); + Navigator.pop(context); + LoadPartDetailsApifunction(homeProvider, context, "", partID); + } else { + toast(context, "Updated Failed!"); + } + notifyListeners(); + } } on Error catch (e) { print(e.toString()); } diff --git a/lib/Notifiers/LogoutNotifier.dart b/lib/Notifiers/LogoutNotifier.dart index fc4868b..692ec0c 100644 --- a/lib/Notifiers/LogoutNotifier.dart +++ b/lib/Notifiers/LogoutNotifier.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/Utils/SharedpreferencesService.dart'; @@ -7,45 +6,46 @@ import 'package:generp/services/api_calling.dart'; import '../Utils/BackgroundLocationService.dart'; -class LogoutNotifier extends ChangeNotifier{ - +class LogoutNotifier extends ChangeNotifier { bool _logoutButtonClicked = false; bool _isLoading = false; bool get isLoading => _isLoading; - bool get logoutButtonClicked => _logoutButtonClicked; + bool get logoutButtonClicked => _logoutButtonClicked; - set logoutButtonClicked(bool val){ + set logoutButtonClicked(bool val) { _logoutButtonClicked = val; notifyListeners(); } - Future LogoutApiFunction(HomescreenNotifier prov,BuildContext context) async { + Future LogoutApiFunction( + HomescreenNotifier prov, + BuildContext context, + ) async { // print("lohi"); try { - final data = await ApiCalling.LogoutFunctionApi(prov.empId ?? "", prov.session ?? ""); - if (data != null) - { - - if (data.error == 0) { - _isLoading = false; - _logoutButtonClicked = false; - await BackgroundLocationService.stopLocationService(); - SharedpreferencesService().clearPreferences(); - Navigator.push(context, - MaterialPageRoute(builder: (context) => LoginScreen())); - notifyListeners(); - } else { - // print(data.toString()); - } - - } - else{} - // {print("Something went wrong, Please try again.")} - + final data = await ApiCalling.LogoutFunctionApi( + prov.empId ?? "", + prov.session ?? "", + ); + if (data != null) { + if (data.error == 0) { + _isLoading = false; + _logoutButtonClicked = false; + await BackgroundLocationService.stopLocationService(); + SharedpreferencesService().clearPreferences(); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LoginScreen()), + ); + notifyListeners(); + } else { + // print(data.toString()); + } + } else {} + // {print("Something went wrong, Please try again.")} } on Exception catch (e) { print("$e"); } } - -} \ No newline at end of file +} diff --git a/lib/Notifiers/NearByGeneratorsProvider.dart b/lib/Notifiers/NearByGeneratorsProvider.dart index f53953c..57e558f 100644 --- a/lib/Notifiers/NearByGeneratorsProvider.dart +++ b/lib/Notifiers/NearByGeneratorsProvider.dart @@ -25,13 +25,15 @@ import '../Utils/commonServices.dart'; class Nearbygeneratorsprovider extends ChangeNotifier { final ImagePicker _picker = ImagePicker(); - List _generatorslist = []; - TextEditingController _locationController = TextEditingController(); - String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"; + final TextEditingController _locationController = TextEditingController(); + final String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"; GoogleMapController? _mapController; CameraPosition? _cameraPosition; - LatLng _startLocation = const LatLng(17.439112226708446, 78.43292499146135); + final LatLng _startLocation = const LatLng( + 17.439112226708446, + 78.43292499146135, + ); String _latlongs = ""; List _markers = []; List _addresses = []; @@ -45,7 +47,6 @@ class Nearbygeneratorsprovider extends ChangeNotifier { double _currentValue = 1.0; Timer? _debounceTimer; - List get generatorsList => _generatorslist; TextEditingController get LocationController => _locationController; String get googleAPIKey => _googleApikey; @@ -64,28 +65,30 @@ class Nearbygeneratorsprovider extends ChangeNotifier { String get selectedItem => _selectedItem; double get currentValue => _currentValue; - set currentValue(value){ + set currentValue(value) { _currentValue = value; notifyListeners(); } -set selectedItem(String value){ + + set selectedItem(String value) { _selectedItem = value; notifyListeners(); -} + } -set markers(List value){ + set markers(List value) { _markers = value; notifyListeners(); -} - set mapController(value){ + } + + set mapController(value) { _mapController = value; notifyListeners(); } - void resetAll(){ + void resetAll() { _currentValue = 1.0; _selectedItem = ""; - _markers= []; + _markers = []; _addresses = []; } @@ -130,7 +133,7 @@ set markers(List value){ final lat = _currentLocation!.latitude; final lang = _currentLocation!.longitude!; _latlongs = '$lat,$lang'; - LoadNearbyGeneratorsAPI(context,_currentValue); + LoadNearbyGeneratorsAPI(context, _currentValue); } } @@ -140,15 +143,17 @@ set markers(List value){ getLocationPermission(context); }); } + void debounce(VoidCallback callback, Duration duration) { _debounceTimer?.cancel(); _debounceTimer = Timer(duration, callback); } - - Future LoadNearbyGeneratorsAPI(BuildContext context,radius) async { + Future LoadNearbyGeneratorsAPI(BuildContext context, radius) async { if (_latlongs.isEmpty || _currentValue <= 0) { - print("Invalid parameters: latlongs=$_latlongs, currentValue=$_currentValue"); + print( + "Invalid parameters: latlongs=$_latlongs, currentValue=$_currentValue", + ); return; } try { @@ -194,7 +199,6 @@ set markers(List value){ await Future.forEach(generatorslist, (store) async { String address = await _getAddressFromLatLng(store.loc); _addresses.add(address); - }); notifyListeners(); // for (int i = 0; i < _addresses.length; i++) { @@ -236,17 +240,17 @@ set markers(List value){ Navigator.push( context, // Use the widget's BuildContext, which is valid here MaterialPageRoute( - builder: (context) => Generatordetails( - activityName: "NearByGenerators", - genLocation: generator.loc, - generatorId: generator.generatorId, - ), + builder: + (context) => Generatordetails( + activityName: "NearByGenerators", + genLocation: generator.loc, + generatorId: generator.generatorId, + ), ), ); }, title: "Customer Name: ${generator.accName}", snippet: "Product Name: ${generator.productName}", - ), zIndex: 100, @@ -273,29 +277,33 @@ set markers(List value){ // ), // ), // ); - }, ), ); }); return markers; } - Future onMarkerTap(context,activityName, genLocation, generatorId) async { - Navigator.push( - context, // Use the widget's BuildContext, which is valid here - MaterialPageRoute( - builder: (context) => Generatordetails( + Future onMarkerTap( + context, + activityName, + genLocation, + generatorId, + ) async { + Navigator.push( + context, // Use the widget's BuildContext, which is valid here + MaterialPageRoute( + builder: + (context) => Generatordetails( activityName: activityName, genLocation: genLocation, generatorId: generatorId, ), - ), - ); - - _markers = markers; - notifyListeners(); + ), + ); + _markers = markers; + notifyListeners(); } LatLng _parseLatLng(String? location) { @@ -339,5 +347,4 @@ set markers(List value){ } return "Address not found"; } - } diff --git a/lib/Notifiers/PCWalletProvider.dart b/lib/Notifiers/PCWalletProvider.dart index 77bc8d8..f95386a 100644 --- a/lib/Notifiers/PCWalletProvider.dart +++ b/lib/Notifiers/PCWalletProvider.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:generp/services/api_calling.dart'; import 'package:provider/provider.dart'; @@ -7,8 +6,6 @@ import '../Models/PaymentCollectionWalletResponse.dart'; import 'HomeScreenNotifier.dart'; class Pcwalletprovider extends ChangeNotifier { - - List _historyList = []; TotalDet _totalDet = TotalDet(); bool _isLoading = false; @@ -24,7 +21,9 @@ class Pcwalletprovider extends ChangeNotifier { listen: false, ); final data = await ApiCalling.loadTransactionsListAPI( - HomeProvider.empId, HomeProvider.session); + HomeProvider.empId, + HomeProvider.session, + ); if (data != null) { if (data.error == 0) { @@ -35,8 +34,7 @@ class Pcwalletprovider extends ChangeNotifier { _isLoading = false; } notifyListeners(); - } - else { + } else { print("Something went wrong, Please try again."); } } on Exception catch (e) { @@ -57,4 +55,4 @@ class Pcwalletprovider extends ChangeNotifier { return grouped; } -} \ No newline at end of file +} diff --git a/lib/Notifiers/PaymentCollectionProvider.dart b/lib/Notifiers/PaymentCollectionProvider.dart index c8d605a..54dda38 100644 --- a/lib/Notifiers/PaymentCollectionProvider.dart +++ b/lib/Notifiers/PaymentCollectionProvider.dart @@ -1,15 +1,10 @@ import 'package:flutter/material.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; import 'package:generp/Models/PaymentCollectionResponse.dart'; import 'package:generp/Notifiers/HomeScreenNotifier.dart'; -import 'package:generp/Utils/SharedpreferencesService.dart'; -import 'package:generp/screens/LoginScreen.dart'; import 'package:generp/services/api_calling.dart'; import 'package:provider/provider.dart'; import '../Models/AccountSuggestionResponse.dart'; -import '../screens/splash.dart'; class Paymentcollectionprovider extends ChangeNotifier { List _paymentCollectionList = []; @@ -20,11 +15,11 @@ class Paymentcollectionprovider extends ChangeNotifier { List get accountList => _accountList; bool get isLoading => _isLoading; - - void resetAll(){ + void resetAll() { _accountList = []; _paymentCollectionList = []; } + Future PaymentCollectionAPI(BuildContext context) async { try { var HomeProvider = Provider.of( diff --git a/lib/Notifiers/PaymentDetailsProvider.dart b/lib/Notifiers/PaymentDetailsProvider.dart index 41f7b73..234a0b0 100644 --- a/lib/Notifiers/PaymentDetailsProvider.dart +++ b/lib/Notifiers/PaymentDetailsProvider.dart @@ -25,7 +25,6 @@ class Paymentdetailsprovider extends ChangeNotifier { TextEditingController telController = TextEditingController(); TextEditingController emailController = TextEditingController(); - String? nameError; String? designationError; String? mobError; @@ -51,13 +50,13 @@ class Paymentdetailsprovider extends ChangeNotifier { var _type = ""; var _refType = ""; var _refId = ""; - var _account_id = ""; + final _account_id = ""; var _CollectionId = 0; var _image_picked = 0; final ImagePicker _picker = ImagePicker(); File? _image; File? _imageName; - bool _isLoading = true; + final bool _isLoading = true; List get paymentModeDropDown => _payment_mode_drop_down; @@ -229,7 +228,7 @@ class Paymentdetailsprovider extends ChangeNotifier { // if(!CheckValidations(context,reference, amount)){ // return; // } - if(!validateSubmit(context)){ + if (!validateSubmit(context)) { return; } print("came here"); @@ -275,7 +274,6 @@ class Paymentdetailsprovider extends ChangeNotifier { } } - Future showOTPSheetSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, @@ -292,9 +290,9 @@ class Paymentdetailsprovider extends ChangeNotifier { child: Padding( padding: EdgeInsets.only( bottom: - MediaQuery.of( - context, - ).viewInsets.bottom, // This handles keyboard + MediaQuery.of( + context, + ).viewInsets.bottom, // This handles keyboard ), child: Container( margin: EdgeInsets.only( @@ -326,10 +324,7 @@ class Paymentdetailsprovider extends ChangeNotifier { alignment: Alignment.center, height: 50, - margin: EdgeInsets.only( - left: 5.0, - right: 5.0, - ), + margin: EdgeInsets.only(left: 5.0, right: 5.0), child: PinCodeTextField( appContext: context, pastedTextStyle: TextStyle( @@ -351,14 +346,11 @@ class Paymentdetailsprovider extends ChangeNotifier { borderRadius: BorderRadius.circular(16), fieldHeight: 60, fieldWidth: 60, - activeFillColor: - AppColors.text_field_color, + activeFillColor: AppColors.text_field_color, activeColor: AppColors.app_blue, selectedColor: AppColors.text_field_color, - selectedFillColor: - AppColors.text_field_color, - inactiveFillColor: - AppColors.text_field_color, + selectedFillColor: AppColors.text_field_color, + inactiveFillColor: AppColors.text_field_color, inactiveColor: AppColors.text_field_color, fieldOuterPadding: EdgeInsets.only( left: 5, @@ -476,8 +468,7 @@ class Paymentdetailsprovider extends ChangeNotifier { ); } - - bool validateSubmit(context){ + bool validateSubmit(context) { selectContactError = null; selectPaymentError = null; selectAmountError = null; @@ -491,15 +482,15 @@ class Paymentdetailsprovider extends ChangeNotifier { isValid = false; } - if (_selectPaymentModeList==null||_paymentModeID == null) { + if (_selectPaymentModeList == null) { selectPaymentError = "Please Select Payment Type"; isValid = false; } - if(Amountcontroller.text.trim().isEmpty){ + if (Amountcontroller.text.trim().isEmpty) { selectAmountError = "Please Enter Amount"; isValid = false; } - if(Referencecontroller.text.trim().isEmpty){ + if (Referencecontroller.text.trim().isEmpty) { ReferenceError = "Please Enter Reference Number"; isValid = false; } @@ -510,6 +501,7 @@ class Paymentdetailsprovider extends ChangeNotifier { notifyListeners(); return isValid; } + Future OTPVerifyAPI(BuildContext context) async { try { var homeProvider = Provider.of( @@ -611,7 +603,7 @@ class Paymentdetailsprovider extends ChangeNotifier { debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; imageError = null; notifyListeners(); @@ -633,7 +625,7 @@ class Paymentdetailsprovider extends ChangeNotifier { debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; imageError = null; @@ -645,11 +637,11 @@ class Paymentdetailsprovider extends ChangeNotifier { bool CheckValidations(BuildContext context, reference, amount) { bool isValid = true; - if (_contactID == null || _contactID == "") { + if (_contactID == "") { toast(context, "Select Phone Number"); isValid = false; } - if (_paymentModeID == null || _paymentModeID == "") { + if (_paymentModeID == "") { toast(context, "Select Payment Mode"); isValid = false; } @@ -693,20 +685,19 @@ class Paymentdetailsprovider extends ChangeNotifier { BuildContext context, actName, generatorID, - accountName, - referenceID, - genId, + accountName, + referenceID, + genId, ) async { if (actName == "Generator") { _saveAgainst = "generator"; _genId = generatorID; - } else { _saveAgainst = "account"; _accountId = generatorID; } notifyListeners(); - if(!validAddContact(context)){ + if (!validAddContact(context)) { return; } try { @@ -733,12 +724,7 @@ class Paymentdetailsprovider extends ChangeNotifier { if (data.error == 0) { toast(context, "Added Successfully"); resetAddContect(); - LoadNumbersAPI( - context, - _saveAgainst, - referenceID, - genId, - ); + LoadNumbersAPI(context, _saveAgainst, referenceID, genId); Navigator.pop(context, true); } else if (data.error == 1) { toast(context, data.message); @@ -756,7 +742,7 @@ class Paymentdetailsprovider extends ChangeNotifier { } } - resetAddContect(){ + resetAddContect() { Amountcontroller.clear(); Referencecontroller.clear(); nameController.clear(); @@ -774,7 +760,7 @@ class Paymentdetailsprovider extends ChangeNotifier { notifyListeners(); } - bool validAddContact(context){ + bool validAddContact(context) { bool isValid = true; nameError = null; @@ -784,11 +770,11 @@ class Paymentdetailsprovider extends ChangeNotifier { telError = null; emailError = null; - if(nameController.text.trim().toString().isEmpty){ + if (nameController.text.trim().toString().isEmpty) { nameError = "Please Enter Name"; isValid = false; } - if(mobController.text.trim().toString().isEmpty){ + if (mobController.text.trim().toString().isEmpty) { mobError = "Please Enter Mobile Number"; isValid = false; } diff --git a/lib/Notifiers/PendingComplaintsProvider.dart b/lib/Notifiers/PendingComplaintsProvider.dart index e59425d..3875359 100644 --- a/lib/Notifiers/PendingComplaintsProvider.dart +++ b/lib/Notifiers/PendingComplaintsProvider.dart @@ -17,7 +17,6 @@ import '../Utils/commonServices.dart'; import '../screens/splash.dart'; class Pendingcomplaintsprovider extends ChangeNotifier { - TextEditingController fsrNumberController = TextEditingController(); TextEditingController runningHoursController = TextEditingController(); TextEditingController feedbackController = TextEditingController(); @@ -48,38 +47,39 @@ class Pendingcomplaintsprovider extends ChangeNotifier { String? get runningHoursError => _runningHoursError; final List> CompletedStatus = [ {"id": "1", "name": "Pending"}, - {"id": "2", "name": "Completed"} + {"id": "2", "name": "Completed"}, ]; - set runningHoursError(String? values){ - _runningHoursError =values; + set runningHoursError(String? values) { + _runningHoursError = values; notifyListeners(); } - set imagePicked(int value){ + + set imagePicked(int value) { _image_picked = value; notifyListeners(); } - set imagePath(File? value){ + set imagePath(File? value) { _imageName = value; notifyListeners(); } - set imageFilePath(File? value){ + set imageFilePath(File? value) { _image = value; notifyListeners(); } - set statusID(String? value){ + set statusID(String? value) { _statusId = value; notifyListeners(); } - set submitLoading(bool value){ + set submitLoading(bool value) { _submitLoading = value; notifyListeners(); } - void resetAll(){ + void resetAll() { _submitLoading = false; _statusId = ""; _image_picked = 0; @@ -94,15 +94,13 @@ class Pendingcomplaintsprovider extends ChangeNotifier { _selectedTime = TimeOfDay.now(); checkDropDownSelected(); notifyListeners(); - } - void checkDropDownSelected(){ - if (_statusId != null && - !CompletedStatus.contains(_statusId)) { + + void checkDropDownSelected() { + if (_statusId != null && !CompletedStatus.contains(_statusId)) { _statusId = null; } notifyListeners(); - } Future TechnicianPendingComplaints(BuildContext context) async { @@ -153,11 +151,9 @@ class Pendingcomplaintsprovider extends ChangeNotifier { final TimeOfDay? picked = await showTimePicker( context: context, initialTime: _selectedTime, - ); if (picked != null && picked != _selectedTime) _selectedTime = picked; - _formattedTime = - _selectedTime.hour.toString() + ":" + _selectedTime.minute.toString(); + _formattedTime = "${_selectedTime.hour}:${_selectedTime.minute}"; notifyListeners(); } @@ -178,23 +174,22 @@ class Pendingcomplaintsprovider extends ChangeNotifier { Future UpdateComplaintAPIFunction( BuildContext context, - complaint_id, + complaintId, feedback, fsrNumber, runningHr, statusId, ) async { - - var HomeProvider = Provider.of(context,listen: false); + var HomeProvider = Provider.of(context, listen: false); try { - if(!validatereceiptForm(context)){ + if (!validatereceiptForm(context)) { return; } final data = await ApiCalling.UpdateComplaintAPI( HomeProvider.empId, HomeProvider.session, - complaint_id, - _selectedTime.hour.toString() + ":" + _selectedTime.minute.toString(), + complaintId, + "${_selectedTime.hour}:${_selectedTime.minute}", feedback, fsrNumber, runningHr, @@ -209,8 +204,6 @@ class Pendingcomplaintsprovider extends ChangeNotifier { toast(context, "Complaint Status Updated!"); resetAll(); Navigator.pop(context); - - } else if (data.error == 1) { toast(context, "Something Went Wrong, please try again later!"); } else if (data.error == 2) { @@ -227,7 +220,7 @@ class Pendingcomplaintsprovider extends ChangeNotifier { // MaterialPageRoute(builder: (context) => Splash()), // ); } - }else{ + } else { _submitLoading = false; notifyListeners(); } @@ -249,7 +242,7 @@ class Pendingcomplaintsprovider extends ChangeNotifier { _submitLoading = false; isValid = false; } - if(_statusId!="Pending"){ + if (_statusId != "Pending") { if (fsrNumberController.text.trim().isEmpty) { fsrError = "Please Enter FSR number"; _submitLoading = false; @@ -257,20 +250,17 @@ class Pendingcomplaintsprovider extends ChangeNotifier { } } - if(runningHoursController.text.trim().isEmpty){ + if (runningHoursController.text.trim().isEmpty) { _runningHoursError = "Enter Running Hours"; _submitLoading = false; isValid = false; } - notifyListeners(); return isValid; } - Future SelectAttachmentDialogue( - BuildContext context - ) async { + Future SelectAttachmentDialogue(BuildContext context) async { return await showDialog( context: context, builder: @@ -291,7 +281,7 @@ class Pendingcomplaintsprovider extends ChangeNotifier { ), ), ), - content: Container( + content: SizedBox( height: 85, child: Column( children: [ @@ -300,7 +290,7 @@ class Pendingcomplaintsprovider extends ChangeNotifier { Navigator.of(context).pop(false); imgFromGallery(); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -309,10 +299,9 @@ class Pendingcomplaintsprovider extends ChangeNotifier { InkWell( onTap: () { Navigator.of(context).pop(false); - imgFromCamera( - ); + imgFromCamera(); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), @@ -326,8 +315,7 @@ class Pendingcomplaintsprovider extends ChangeNotifier { false; } - imgFromCamera( - ) async { + imgFromCamera() async { // Capture a photo try { final XFile? galleryImage = await _picker.pickImage( @@ -336,19 +324,16 @@ class Pendingcomplaintsprovider extends ChangeNotifier { ); print("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; notifyListeners(); - } catch (e) { debugPrint("mmmm: ${e.toString()}"); } } - imgFromGallery( - - ) async { + imgFromGallery() async { // Pick an image try { final XFile? galleryImage = await _picker.pickImage( @@ -361,7 +346,7 @@ class Pendingcomplaintsprovider extends ChangeNotifier { debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; notifyListeners(); } catch (e) { diff --git a/lib/Notifiers/ProfileNotifier.dart b/lib/Notifiers/ProfileNotifier.dart index b5742ab..15ae747 100644 --- a/lib/Notifiers/ProfileNotifier.dart +++ b/lib/Notifiers/ProfileNotifier.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/Utils/SharedpreferencesService.dart'; @@ -10,20 +9,20 @@ import 'package:provider/provider.dart'; import '../Models/hrmModels/jobDescriptionResponse.dart'; -class ProfileNotifer extends ChangeNotifier{ +class ProfileNotifer extends ChangeNotifier { var _profileImage = ""; var _company = ""; var _branch = ""; var _designation; var _mobile_num = ""; - var _isLoading =false; - var _secretKey =""; - var _latestversion =""; - var _releaseNotes =""; - var _employeeName =""; - var _employerID =""; - var _employeeDesignation =""; - var _employeeEmail =""; + var _isLoading = false; + var _secretKey = ""; + var _latestversion = ""; + var _releaseNotes = ""; + var _employeeName = ""; + var _employerID = ""; + var _employeeDesignation = ""; + var _employeeEmail = ""; get profileImage => _profileImage; get company => _company; @@ -39,80 +38,77 @@ class ProfileNotifer extends ChangeNotifier{ get employeeDesignation => _employeeDesignation; get employeeEmail => _employeeEmail; - - Future ProfileApiFunction(HomescreenNotifier prov, BuildContext context) async { + Future ProfileApiFunction( + HomescreenNotifier prov, + BuildContext context, + ) async { try { + final data = await ApiCalling.ProfileFunctionApi( + prov.empId ?? "", + prov.session ?? "", + ); - final data = await ApiCalling.ProfileFunctionApi(prov.empId ?? "", prov.session ?? ""); - - if (data != null) - { - - if (data.sessionExists == 1) { - _profileImage = data.profilePic ?? ""; - _company = data.company ?? ""; - _branch = data.branchName ?? ""; - _designation = data.designation ?? ""; - _mobile_num = data.mobileNo ?? ""; - _isLoading = false; - _secretKey = data.totpSecret!; - _employeeName = data.empName??""; - _employerID = data.empId??""; - _employeeDesignation = data.designation??""; - _employeeEmail = data.emailId??""; - - notifyListeners(); - } else if (data.sessionExists == 0) { - SharedpreferencesService().clearPreferences(); - Navigator.push(context, - MaterialPageRoute(builder: (context) => LoginScreen())); - notifyListeners(); - // print(data.toString()); - } - - } - else - {print("Something went wrong, Please try again.");} - + if (data != null) { + if (data.sessionExists == 1) { + _profileImage = data.profilePic ?? ""; + _company = data.company ?? ""; + _branch = data.branchName ?? ""; + _designation = data.designation ?? ""; + _mobile_num = data.mobileNo ?? ""; + _isLoading = false; + _secretKey = data.totpSecret!; + _employeeName = data.empName ?? ""; + _employerID = data.empId ?? ""; + _employeeDesignation = data.designation ?? ""; + _employeeEmail = data.emailId ?? ""; + + notifyListeners(); + } else if (data.sessionExists == 0) { + SharedpreferencesService().clearPreferences(); + Navigator.push( + context, + MaterialPageRoute(builder: (context) => LoginScreen()), + ); + notifyListeners(); + // print(data.toString()); + } + } else { + print("Something went wrong, Please try again."); + } } on Exception catch (e) { print("$e"); } } - Future VersionApiFunction() async { try { - final data = await ApiCalling.checkAppVersionApi(); - if (data != null) - { - - _latestversion = data.latestVersion ?? ""; - if (Platform.isAndroid) { - _releaseNotes = data.releaseNotes ?? ""; - } else if (Platform.isIOS) { - _releaseNotes = data.iosReleaseNotes ?? ""; - } - notifyListeners(); - - } - else - {print("Something went wrong, Please try again.");} - + final data = await ApiCalling.checkAppVersionApi(); + if (data != null) { + _latestversion = data.latestVersion ?? ""; + if (Platform.isAndroid) { + _releaseNotes = data.releaseNotes ?? ""; + } else if (Platform.isIOS) { + _releaseNotes = data.iosReleaseNotes ?? ""; + } + notifyListeners(); + } else { + print("Something went wrong, Please try again."); + } } on Exception catch (e) { print("$e"); } } - - String? _errorMessage; jobDescriptionResponse? _response; - String? get errorMessage => _errorMessage; jobDescriptionResponse? get response => _response; - Future fetchJobDescription(HomescreenNotifier prov, BuildContext context) async { + Future fetchJobDescription( + HomescreenNotifier prov, + BuildContext context, + ) async { _isLoading = true; _errorMessage = null; _response = null; @@ -138,5 +134,4 @@ class ProfileNotifer extends ChangeNotifier{ _isLoading = false; notifyListeners(); } - -} \ No newline at end of file +} diff --git a/lib/Notifiers/ServiceEngineerDashboardProvider.dart b/lib/Notifiers/ServiceEngineerDashboardProvider.dart index 757dd82..4527fb1 100644 --- a/lib/Notifiers/ServiceEngineerDashboardProvider.dart +++ b/lib/Notifiers/ServiceEngineerDashboardProvider.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter/foundation.dart'; import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/Utils/SharedpreferencesService.dart'; import 'package:generp/screens/LoginScreen.dart'; @@ -19,12 +18,13 @@ class Serviceengineerdashboardprovider extends ChangeNotifier { int get pendingComplaints => _pendingComplaints; int get todayVisits => _todayVisits; int get thisMonthsVisits => _thisMonthsVisits; - String get paymentCollectionWalletBalanceAmount => _paymentCollectionWalletBalanceAmount; + String get paymentCollectionWalletBalanceAmount => + _paymentCollectionWalletBalanceAmount; String get monthlyPaymentCollectionAmount => _monthlyPaymentCollectionAmount; bool get isLoading => _isLoading; Future LoadTechnicianDashboard(BuildContext context) async { - var HomeProvider = Provider.of(context,listen: false); + var HomeProvider = Provider.of(context, listen: false); try { final data = await ApiCalling.loadTechnicianDashboardApi( HomeProvider.empId, @@ -38,8 +38,10 @@ class Serviceengineerdashboardprovider extends ChangeNotifier { _pendingComplaints = data.pendingComplaints!; _todayVisits = data.todayVisits!; _thisMonthsVisits = data.thisMonthsVisits!; - _paymentCollectionWalletBalanceAmount = data.paymentCollectionWalletBalanceAmount!; - _monthlyPaymentCollectionAmount = data.monthlyPaymentCollectionAmount!; + _paymentCollectionWalletBalanceAmount = + data.paymentCollectionWalletBalanceAmount!; + _monthlyPaymentCollectionAmount = + data.monthlyPaymentCollectionAmount!; _isLoading = false; notifyListeners(); } else {} diff --git a/lib/Notifiers/TodayMontlyVisitsProvider.dart b/lib/Notifiers/TodayMontlyVisitsProvider.dart index db15bc8..53af418 100644 --- a/lib/Notifiers/TodayMontlyVisitsProvider.dart +++ b/lib/Notifiers/TodayMontlyVisitsProvider.dart @@ -1,8 +1,5 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:generp/Notifiers/HomeScreenNotifier.dart'; -import 'package:generp/Utils/SharedpreferencesService.dart'; -import 'package:generp/screens/LoginScreen.dart'; import 'package:generp/services/api_calling.dart'; import 'package:provider/provider.dart'; @@ -18,7 +15,7 @@ class Todaymontlyvisitsprovider extends ChangeNotifier { bool get isLoading => _isLoading; String get title => _title; - set title(String value){ + set title(String value) { _title = value; } @@ -37,7 +34,6 @@ class Todaymontlyvisitsprovider extends ChangeNotifier { if (data.error == 0) { _visitsList = data.list!; _isLoading = false; - } else { _isLoading = false; } diff --git a/lib/Notifiers/UpdatePasswordProvider.dart b/lib/Notifiers/UpdatePasswordProvider.dart index 6bd856a..1908c2a 100644 --- a/lib/Notifiers/UpdatePasswordProvider.dart +++ b/lib/Notifiers/UpdatePasswordProvider.dart @@ -1,11 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/Utils/SharedpreferencesService.dart'; import 'package:generp/screens/HomeScreen.dart'; import 'package:generp/services/api_calling.dart'; import 'package:generp/screens/LoginScreen.dart'; -import 'package:provider/provider.dart'; import '../Utils/commonServices.dart'; @@ -21,19 +18,20 @@ class UpdatePasswordProvider with ChangeNotifier { bool get pwdVisible => _pwdVisible; bool get confPwdVisible => _confPwdVisible; - bool pwdVisibility(){ + bool pwdVisibility() { _pwdVisible = !_pwdVisible; print(_pwdVisible); notifyListeners(); return _pwdVisible; } - bool confPwdVisibility(){ + bool confPwdVisibility() { _confPwdVisible = !_confPwdVisible; print(_confPwdVisible); notifyListeners(); return _confPwdVisible; } + Future updatePassword(BuildContext context) async { passwordError = null; confirmPasswordError = null; @@ -66,7 +64,6 @@ class UpdatePasswordProvider with ChangeNotifier { notifyListeners(); try { - var session = await SharedpreferencesService().getString("Session_id"); var empId = await SharedpreferencesService().getString("UserId"); print("Okay ${password.text}"); @@ -84,8 +81,9 @@ class UpdatePasswordProvider with ChangeNotifier { toast(context, data.message); Navigator.push( context, - MaterialPageRoute(builder: (context) => MyHomePage(), - settings: RouteSettings(name: "MyHomePage") + MaterialPageRoute( + builder: (context) => MyHomePage(), + settings: RouteSettings(name: "MyHomePage"), ), ); } else { @@ -96,8 +94,10 @@ class UpdatePasswordProvider with ChangeNotifier { SharedpreferencesService().clearPreferences(); Navigator.push( context, - MaterialPageRoute(builder: (context) => LoginScreen(), - settings: RouteSettings(name:"LoginScreen" )), + MaterialPageRoute( + builder: (context) => LoginScreen(), + settings: RouteSettings(name: "LoginScreen"), + ), ); } } @@ -113,6 +113,7 @@ class UpdatePasswordProvider with ChangeNotifier { passwordError = null; notifyListeners(); } + void onChangeConfPassword(String value) { confirmPasswordError = null; notifyListeners(); diff --git a/lib/Notifiers/VisitDetailsProvider.dart b/lib/Notifiers/VisitDetailsProvider.dart index 28b4f7c..a34eb99 100644 --- a/lib/Notifiers/VisitDetailsProvider.dart +++ b/lib/Notifiers/VisitDetailsProvider.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/services/api_calling.dart'; import 'package:provider/provider.dart'; @@ -8,15 +7,14 @@ import '../Models/FollowUpResponse.dart'; import '../Models/ViewVisitDetailsResponseNew.dart'; import '../Utils/commonServices.dart'; -class Visitdetailsprovider extends ChangeNotifier{ - +class Visitdetailsprovider extends ChangeNotifier { bool _showMoreDetails = false; CustomerDetails _customerDetails = CustomerDetails(); GeneratorDetails _generatorDetails = GeneratorDetails(); ComplaintDetailsNew _complaintDetailsNew = ComplaintDetailsNew(); List _followupList = []; - bool _isLoading = false; + bool _isLoading = false; CustomerDetails get customerDetails => _customerDetails; GeneratorDetails get generatorDetails => _generatorDetails; @@ -25,74 +23,72 @@ class Visitdetailsprovider extends ChangeNotifier{ bool get isLoading => _isLoading; bool get showMoreDetails => _showMoreDetails; - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } - Future LoadVisitDetailsAPI(BuildContext context,ComplaintID) async { + Future LoadVisitDetailsAPI(BuildContext context, ComplaintID) async { try { - var HomeProvider = Provider.of(context,listen: false); - final data = await ApiCalling.loadVisitDetailsAPI(HomeProvider.empId, HomeProvider.session, ComplaintID); - - if (data != null) - { - - if (data.error == 0) { - // complaintdetails = data.complaintDetails!; - _customerDetails = data.customerDetails!; - _generatorDetails = data.generatorDetails!; - _complaintDetailsNew = data.complaintDetailsNew!; - _isLoading = false; - notifyListeners(); - } else { - toast( - context, "Something Went Wrong, Please try again!"); - print("error"); - } - - } - else - { - toast(context, - "No response From the server, Please try Again!"); - print("error2"); - } - + var HomeProvider = Provider.of( + context, + listen: false, + ); + final data = await ApiCalling.loadVisitDetailsAPI( + HomeProvider.empId, + HomeProvider.session, + ComplaintID, + ); + + if (data != null) { + if (data.error == 0) { + // complaintdetails = data.complaintDetails!; + _customerDetails = data.customerDetails!; + _generatorDetails = data.generatorDetails!; + _complaintDetailsNew = data.complaintDetailsNew!; + _isLoading = false; + notifyListeners(); + } else { + toast(context, "Something Went Wrong, Please try again!"); + print("error"); + } + } else { + toast(context, "No response From the server, Please try Again!"); + print("error2"); + } } on Error catch (e) { print(e.toString()); } } - Future LoadFollowupListAPI(BuildContext context,ComplaintID) async { + Future LoadFollowupListAPI(BuildContext context, ComplaintID) async { try { - var HomeProvider = Provider.of(context,listen: false); - final data = await ApiCalling.loadFollowupListAPI(HomeProvider.empId, HomeProvider.session, ComplaintID); - - if (data != null) - { - - if (data.error == 0) { - // complaintdetails = data.complaintDetails!; - _followupList = data.list??[]; - _isLoading = false; - notifyListeners(); - } else { - toast( - context, "Something Went Wrong, Please try again!"); - print("error"); - } - - } - else - { - toast(context, - "No response From the server, Please try Again!"); - print("error2"); - } - + var HomeProvider = Provider.of( + context, + listen: false, + ); + final data = await ApiCalling.loadFollowupListAPI( + HomeProvider.empId, + HomeProvider.session, + ComplaintID, + ); + + if (data != null) { + if (data.error == 0) { + // complaintdetails = data.complaintDetails!; + _followupList = data.list ?? []; + _isLoading = false; + notifyListeners(); + } else { + toast(context, "Something Went Wrong, Please try again!"); + print("error"); + } + } else { + toast(context, "No response From the server, Please try Again!"); + print("error2"); + } } on Error catch (e) { print(e.toString()); } } -} \ No newline at end of file +} diff --git a/lib/Notifiers/commonProvider/accountDetailsProvider.dart b/lib/Notifiers/commonProvider/accountDetailsProvider.dart index 6dfda72..ec83588 100644 --- a/lib/Notifiers/commonProvider/accountDetailsProvider.dart +++ b/lib/Notifiers/commonProvider/accountDetailsProvider.dart @@ -5,9 +5,7 @@ import 'package:provider/provider.dart'; import '../../Models/commonModels/commonAccountdetailsResponse.dart'; -class Accountdetailsprovider extends ChangeNotifier{ - - +class Accountdetailsprovider extends ChangeNotifier { bool _showMoreDetails = false; AccountDetails _accountDetails = AccountDetails(); @@ -23,39 +21,41 @@ class Accountdetailsprovider extends ChangeNotifier{ double totalRunningBalance = 0.0; List runningBalances = []; - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } - Future accountdetailsAPIFunction(context,accountID) async { - try{ - var prov = Provider.of(context,listen: false); - final data = await ApiCalling.commonAccountDetailsAPI(prov.empId, prov.session, accountID); - if(data!=null){ - if(data.error=="0"){ - _accountDetails = data.accountDetails!; - _balanceDetails = data.balanceDetails!; - _ledgerList = data.ledgerList!; - for (var item in _ledgerList) { - double credit = double.tryParse(item.creditAmount.toString()) ?? 0; - double debit = double.tryParse(item.debitAmount.toString()) ?? 0; - totalCredit = 0.0; - totalDebit = 0.0; - totalRunningBalance = 0.0; - runningBalances = []; + Future accountdetailsAPIFunction(context, accountID) async { + try { + var prov = Provider.of(context, listen: false); + final data = await ApiCalling.commonAccountDetailsAPI( + prov.empId, + prov.session, + accountID, + ); + if (data != null) { + if (data.error == "0") { + _accountDetails = data.accountDetails!; + _balanceDetails = data.balanceDetails!; + _ledgerList = data.ledgerList!; + for (var item in _ledgerList) { + double credit = double.tryParse(item.creditAmount.toString()) ?? 0; + double debit = double.tryParse(item.debitAmount.toString()) ?? 0; + totalCredit = 0.0; + totalDebit = 0.0; + totalRunningBalance = 0.0; + runningBalances = []; - totalCredit += credit; - totalDebit += debit; - totalRunningBalance += (debit - credit); - runningBalances.add(totalRunningBalance); - } - notifyListeners(); + totalCredit += credit; + totalDebit += debit; + totalRunningBalance += (debit - credit); + runningBalances.add(totalRunningBalance); + } + notifyListeners(); } } - }catch (e,s){ - - } + } catch (e) {} } Map> groupByDate(List list) { @@ -72,10 +72,10 @@ class Accountdetailsprovider extends ChangeNotifier{ return grouped; } - void resetValues(){ + void resetValues() { totalCredit = 0.0; totalDebit = 0.0; totalRunningBalance = 0.0; runningBalances = []; } -} \ No newline at end of file +} diff --git a/lib/Notifiers/commonProvider/accountLedgerProvider.dart b/lib/Notifiers/commonProvider/accountLedgerProvider.dart index 38669c5..ba56e8a 100644 --- a/lib/Notifiers/commonProvider/accountLedgerProvider.dart +++ b/lib/Notifiers/commonProvider/accountLedgerProvider.dart @@ -6,8 +6,7 @@ import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/services/api_calling.dart'; import 'package:provider/provider.dart'; -class Accountledgerprovider extends ChangeNotifier{ - +class Accountledgerprovider extends ChangeNotifier { TextEditingController searchAccountController = TextEditingController(); List _accounts = []; @@ -29,30 +28,33 @@ class Accountledgerprovider extends ChangeNotifier{ String get selectedAcId => _selectedAcID; String get selectedAcVal => _selectedAcVal; - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } - set accounts(List value){ + + set accounts(List value) { _accounts = value; notifyListeners(); } - set selectedAccount(Accounts? value){ + + set selectedAccount(Accounts? value) { _selectedAccount = value; _selectedAcID = value!.id!; - _selectedAcVal = value!.name!; + _selectedAcVal = value.name!; notifyListeners(); } - set selectedAcId(String value){ + set selectedAcId(String value) { _selectedAcID = value; notifyListeners(); } - set selectedAcVal(String value){ + set selectedAcVal(String value) { _selectedAcVal = value; notifyListeners(); } + // Reset all values void resetAll() { _selectedAccount = null; @@ -63,8 +65,9 @@ class Accountledgerprovider extends ChangeNotifier{ checkDropdownReset(); notifyListeners(); // Notify UI to update } - void checkDropdownReset(){ - if(!_accounts.contains(_selectedAccount)&&_selectedAccount!=null){ + + void checkDropdownReset() { + if (!_accounts.contains(_selectedAccount) && _selectedAccount != null) { _selectedAcID = ""; _selectedAcVal = ""; } @@ -72,50 +75,53 @@ class Accountledgerprovider extends ChangeNotifier{ } Future dropDownAPI(context) async { - try{ - var prov = Provider.of(context,listen: false); - final data = await ApiCalling.commonAccountLedgerDropDownAPI(prov.empId,prov.session); - if(data!=null){ - if(data.error=="0"){ + try { + var prov = Provider.of(context, listen: false); + final data = await ApiCalling.commonAccountLedgerDropDownAPI( + prov.empId, + prov.session, + ); + if (data != null) { + if (data.error == "0") { checkDropdownReset(); _accounts = data.accounts!; notifyListeners(); } } - }catch (e,s){ - - } + } catch (e) {} } Future ledgerlistAPI(context) async { - try{ - var prov = Provider.of(context,listen: false); + try { + var prov = Provider.of(context, listen: false); _ledgerList.clear(); _isLoading = true; notifyListeners(); - final data = await ApiCalling.commonAccountLedgerListAPI(prov.empId,prov.session,selectedAcId); - if(data!=null){ - if(data.error=="0"){ + final data = await ApiCalling.commonAccountLedgerListAPI( + prov.empId, + prov.session, + selectedAcId, + ); + if (data != null) { + if (data.error == "0") { _isLoading = false; - _ledgerList= data.ledgerList!; + _ledgerList = data.ledgerList!; _balanceDetails = data.balanceDetails!; - _accountDetails= data.accountDetails!; + _accountDetails = data.accountDetails!; if (_selectedAccount != null && !_accounts.contains(_selectedAccount)) { _selectedAccount = null; _selectedAcID = ""; } - notifyListeners(); - } else if(data.error=="1"){ + notifyListeners(); + } else if (data.error == "1") { _isLoading = false; notifyListeners(); } - } - }catch (e,s){ - - } + } catch (e) {} } + Map> groupByDate(List list) { Map> grouped = {}; @@ -129,4 +135,4 @@ class Accountledgerprovider extends ChangeNotifier{ return grouped; } -} \ No newline at end of file +} diff --git a/lib/Notifiers/commonProvider/accountsListProvider.dart b/lib/Notifiers/commonProvider/accountsListProvider.dart index 23e2a69..08e6efb 100644 --- a/lib/Notifiers/commonProvider/accountsListProvider.dart +++ b/lib/Notifiers/commonProvider/accountsListProvider.dart @@ -141,7 +141,7 @@ class Accountslistprovider extends ChangeNotifier { set selectedState(States? value) { _selectedState = value; _selectedStateID = value!.id; - _selectedStateValue = value!.name; + _selectedStateValue = value.name; stateError = null; notifyListeners(); } @@ -149,7 +149,7 @@ class Accountslistprovider extends ChangeNotifier { set selectedDistricts(Districts? value) { _selectedDistricts = value; _selectedDistrictID = value!.id; - _selectedDistrictValue = value!.district; + _selectedDistrictValue = value.district; districtError = null; notifyListeners(); } @@ -157,7 +157,7 @@ class Accountslistprovider extends ChangeNotifier { set selectedSubLocations(SubLocations? value) { _selectedSubLocations = value; _selectedSubLocID = value!.id; - _selectedSubLocValue = value!.subLocality!; + _selectedSubLocValue = value.subLocality!; localityError = null; notifyListeners(); } @@ -210,7 +210,7 @@ class Accountslistprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future getDistrictAPI(context, stateID) async { @@ -229,7 +229,7 @@ class Accountslistprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future getSubLocationAPI(context, districtID) async { @@ -248,7 +248,7 @@ class Accountslistprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future checkInputsAPI(context, type, value) async { @@ -275,7 +275,7 @@ class Accountslistprovider extends ChangeNotifier { // toast(context, data.message); } } - } catch (e, s) {} + } catch (e) {} } bool hasFilledAdditionalDetails = false; @@ -354,14 +354,13 @@ class Accountslistprovider extends ChangeNotifier { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } } - - bool validateStep1(){ + bool validateStep1() { accountError = null; nameError = null; mobileError = null; @@ -375,7 +374,8 @@ class Accountslistprovider extends ChangeNotifier { nameError = "Please Enter a Name"; isValid = false; } - if(mobileController.text.trim().isNotEmpty&&mobileController.text.length<10){ + if (mobileController.text.trim().isNotEmpty && + mobileController.text.length < 10) { mobileError = "Mobile Number should be 10 digits"; isValid = false; } @@ -391,33 +391,35 @@ class Accountslistprovider extends ChangeNotifier { notifyListeners(); return isValid; } - bool validateStep2(){ + + bool validateStep2() { stateError = null; districtError = null; localityError = null; addressError = null; bool isValid = true; - // if (_selectedState == null || _selectedStateID!.isEmpty) { - // stateError = "Please select a State"; - // isValid = false; - // } - // if (_selectedDistricts == null || _selectedDistrictID!.isEmpty) { - // districtError = "Please select a District"; - // isValid = false; - // } - // if (_selectedSubLocations == null || _selectedSubLocID!.isEmpty) { - // localityError = "Please select a Locality"; - // isValid = false; - // } - // if (addressController.text.trim().isEmpty) { - // addressError = "Please Enter an Address"; - // isValid = false; - // } + // if (_selectedState == null || _selectedStateID!.isEmpty) { + // stateError = "Please select a State"; + // isValid = false; + // } + // if (_selectedDistricts == null || _selectedDistrictID!.isEmpty) { + // districtError = "Please select a District"; + // isValid = false; + // } + // if (_selectedSubLocations == null || _selectedSubLocID!.isEmpty) { + // localityError = "Please select a Locality"; + // isValid = false; + // } + // if (addressController.text.trim().isEmpty) { + // addressError = "Please Enter an Address"; + // isValid = false; + // } _submitClicked = false; notifyListeners(); return isValid; } - bool validateStep3(){ + + bool validateStep3() { banknameError = null; bankBranchError = null; bankIFSCError = null; @@ -425,48 +427,49 @@ class Accountslistprovider extends ChangeNotifier { bankAcNumberError = null; upiError = null; bool isValid = true; - // if (bankNameController.text - // .trim() - // .isEmpty) { - // banknameError = "Please Enter a Bank Name"; - // isValid = false; - // } - // - // if (branchNameController.text - // .trim() - // .isEmpty) { - // bankBranchError = "Please Enter Branch Name"; - // isValid = false; - // } - // if (bankIfscCotroller.text - // .trim() - // .isEmpty) { - // bankIFSCError = "Please Enter Bank IFSC"; - // isValid = false; - // } - // if (bankHolderNameController.text - // .trim() - // .isEmpty) { - // bankHolderNameError = "Please Enter Account Holder Name"; - // isValid = false; - // } - // if (bankAcNumberController.text - // .trim() - // .isEmpty) { - // bankAcNumberError = "Please Enter Bank Account Number"; - // isValid = false; - // } - // if (bankUpiController.text - // .trim() - // .isEmpty) { - // upiError = "Please Enter UPI ID"; - // isValid = false; - // } + // if (bankNameController.text + // .trim() + // .isEmpty) { + // banknameError = "Please Enter a Bank Name"; + // isValid = false; + // } + // + // if (branchNameController.text + // .trim() + // .isEmpty) { + // bankBranchError = "Please Enter Branch Name"; + // isValid = false; + // } + // if (bankIfscCotroller.text + // .trim() + // .isEmpty) { + // bankIFSCError = "Please Enter Bank IFSC"; + // isValid = false; + // } + // if (bankHolderNameController.text + // .trim() + // .isEmpty) { + // bankHolderNameError = "Please Enter Account Holder Name"; + // isValid = false; + // } + // if (bankAcNumberController.text + // .trim() + // .isEmpty) { + // bankAcNumberError = "Please Enter Bank Account Number"; + // isValid = false; + // } + // if (bankUpiController.text + // .trim() + // .isEmpty) { + // upiError = "Please Enter UPI ID"; + // isValid = false; + // } _submitClicked = false; notifyListeners(); return isValid; } - bool validateStep4(){ + + bool validateStep4() { bool isValid = true; // if (contectPersonDesignationController.text // .trim() @@ -706,26 +709,22 @@ class Accountslistprovider extends ChangeNotifier { notifyListeners(); } - - void onChangedMobileNum(value){ + void onChangedMobileNum(value) { notifyListeners(); } - void onChangedCompanyName(value){ + void onChangedCompanyName(value) { notifyListeners(); } - - - String? _errorMessage; String? get errorMessage => _errorMessage; // Common Account list provider Future commonAccountListAPIFunction( - BuildContext context, { - bool append = false, - }) async { + BuildContext context, { + bool append = false, + }) async { try { var prov = Provider.of(context, listen: false); @@ -748,16 +747,19 @@ class Accountslistprovider extends ChangeNotifier { companyNameController.text, mobileNumberController.text, ); - debugPrint('empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_pageNum'); + debugPrint( + 'empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_pageNum', + ); if (data != null && data.error == "0") { if (data.accountList != null) { if (append) { // Append with deduplication final existingIds = _accountsList.map((e) => e.id).toSet(); - final newItems = data.accountList! - .where((item) => !existingIds.contains(item.id)) - .toList(); + final newItems = + data.accountList! + .where((item) => !existingIds.contains(item.id)) + .toList(); _accountsList.addAll(newItems); } else { _accountsList = data.accountList!; @@ -768,7 +770,7 @@ class Accountslistprovider extends ChangeNotifier { if (_hasMoreData) _pageNum++; } } - } catch (e, s) { + } catch (e) { debugPrint("Error in commonAccountListAPIFunction: $e"); } finally { _isLoading = false; @@ -776,10 +778,6 @@ class Accountslistprovider extends ChangeNotifier { } } - - - - resetValues() { print("rv"); _selectedAccountType = null; diff --git a/lib/Notifiers/commonProvider/commonPagesProvider.dart b/lib/Notifiers/commonProvider/commonPagesProvider.dart index 93a5f4c..e6419e2 100644 --- a/lib/Notifiers/commonProvider/commonPagesProvider.dart +++ b/lib/Notifiers/commonProvider/commonPagesProvider.dart @@ -5,25 +5,23 @@ import 'package:provider/provider.dart'; import '../../Models/commonModels/commonAccessiblePagesResponse.dart'; -class Commonpagesprovider extends ChangeNotifier{ - +class Commonpagesprovider extends ChangeNotifier { List _accessPages = []; List get accessPages => _accessPages; Future commonAccessPagesAPIFunction(context) async { - try{ - var HomeProv = Provider.of(context,listen: false); - final data = await ApiCalling.commonDashboardPagesAPI(HomeProv.empId, HomeProv.session); - if(data!=null){ - if(data.error=="0"){ + try { + var HomeProv = Provider.of(context, listen: false); + final data = await ApiCalling.commonDashboardPagesAPI( + HomeProv.empId, + HomeProv.session, + ); + if (data != null) { + if (data.error == "0") { _accessPages = data.pagesAccessible!; notifyListeners(); } } - - }catch (e,s){ - - } + } catch (e) {} } - -} \ No newline at end of file +} diff --git a/lib/Notifiers/crmProvider/LeadListProvider.dart b/lib/Notifiers/crmProvider/LeadListProvider.dart index 9048de8..3215add 100644 --- a/lib/Notifiers/crmProvider/LeadListProvider.dart +++ b/lib/Notifiers/crmProvider/LeadListProvider.dart @@ -796,7 +796,9 @@ class Leadlistprovider extends ChangeNotifier { _selectedSources = value; _selectedSourceId = value?.id; _selectedSourceValue = value?.name; - print('Setting selectedSource: $value, id: ${_selectedSourceId}, name: ${_selectedSourceValue}'); + print( + 'Setting selectedSource: $value, id: $_selectedSourceId, name: $_selectedSourceValue', + ); notifyListeners(); } @@ -965,7 +967,9 @@ class Leadlistprovider extends ChangeNotifier { mode, ); if (data != null) { - print('crmLeadListViewAPI error: ${data.error}, sources: ${data.sources}'); + print( + 'crmLeadListViewAPI error: ${data.error}, sources: ${data.sources}', + ); if (data.error == "0") { _leadStatusList = [ "all", @@ -975,12 +979,33 @@ class Leadlistprovider extends ChangeNotifier { "Order Gain", "Order Lost", ]; - _alphabetList = List.generate(26, (index) => String.fromCharCode(index + 65)); + _alphabetList = List.generate( + 26, + (index) => String.fromCharCode(index + 65), + ); _openStatusList = ["open", "Closed", "All"]; - _sourcesList = data.sources?.where((source) => source != null && source.id != null && source.name != null).toList() ?? []; - _teamsList = data.teams?.where((team) => team != null && team.id != null && team.name != null).toList() ?? []; - _statesList = data.states?.where((state) => state != null && state.id != null && state.name != null).toList() ?? []; - _employeesList = data.employees?.where((employee) => employee != null && employee.id != null && employee.name != null).toList() ?? []; + _sourcesList = + data.sources + ?.where((source) => source.id != null && source.name != null) + .toList() ?? + []; + _teamsList = + data.teams + ?.where((team) => team.id != null && team.name != null) + .toList() ?? + []; + _statesList = + data.states + ?.where((state) => state.id != null && state.name != null) + .toList() ?? + []; + _employeesList = + data.employees + ?.where( + (employee) => employee.id != null && employee.name != null, + ) + .toList() ?? + []; checkDropDownValues(); notifyListeners(); } @@ -991,10 +1016,10 @@ class Leadlistprovider extends ChangeNotifier { } Future crmLeadListSourceOnReferenceAPIFunction( - context, - mode, - String? sourceID, - ) async { + context, + mode, + String? sourceID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmLeadListSourceOnReferenceAPI( @@ -1004,7 +1029,11 @@ class Leadlistprovider extends ChangeNotifier { ); if (data != null) { if (data.error == "0") { - _referencesList = data.references?.where((ref) => ref != null && ref.id != null && ref.name != null).toList() ?? []; + _referencesList = + data.references + ?.where((ref) => ref.id != null && ref.name != null) + .toList() ?? + []; notifyListeners(); } else { _referencesList.clear(); @@ -1017,10 +1046,10 @@ class Leadlistprovider extends ChangeNotifier { } Future crmLeadListSegmentOnTeamAPIFunction( - context, - mode, - String? teamID, - ) async { + context, + mode, + String? teamID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmLeadListSegmentOnTeamAPI( @@ -1030,7 +1059,13 @@ class Leadlistprovider extends ChangeNotifier { ); if (data != null) { if (data.error == "0") { - _segmentsList = data.segments?.where((segment) => segment != null && segment.id != null && segment.name != null).toList() ?? []; + _segmentsList = + data.segments + ?.where( + (segment) => segment.id != null && segment.name != null, + ) + .toList() ?? + []; notifyListeners(); } else { _segmentsList.clear(); @@ -1043,10 +1078,10 @@ class Leadlistprovider extends ChangeNotifier { } Future crmLeadListDistrictsOnStateAPIFunction( - context, - mode, - String? stateID, - ) async { + context, + mode, + String? stateID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmDistrictsOnStateAPI( @@ -1056,7 +1091,14 @@ class Leadlistprovider extends ChangeNotifier { ); if (data != null) { if (data.error == "0") { - _districtsList = data.districts?.where((district) => district != null && district.id != null && district.district != null).toList() ?? []; + _districtsList = + data.districts + ?.where( + (district) => + district.id != null && district.district != null, + ) + .toList() ?? + []; notifyListeners(); } else { _districtsList.clear(); @@ -1069,10 +1111,10 @@ class Leadlistprovider extends ChangeNotifier { } Future crmLeadListSubLocOnDistrictAPIFunction( - context, - mode, - String? districtID, - ) async { + context, + mode, + String? districtID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmSubLocOnDistrictAPI( @@ -1082,7 +1124,13 @@ class Leadlistprovider extends ChangeNotifier { ); if (data != null) { if (data.error == "0") { - _subLocationsList = data.subLocations?.where((subLoc) => subLoc != null && subLoc.id != null && subLoc.subLocality != null).toList() ?? []; + _subLocationsList = + data.subLocations + ?.where( + (subLoc) => subLoc.id != null && subLoc.subLocality != null, + ) + .toList() ?? + []; notifyListeners(); } else { _subLocationsList.clear(); @@ -1095,10 +1143,10 @@ class Leadlistprovider extends ChangeNotifier { } Future crmLeadListContactPopUpAPIFunction( - context, - mode, - String? accountID, - ) async { + context, + mode, + String? accountID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmLeadListContactPopUpAPI( @@ -1108,7 +1156,13 @@ class Leadlistprovider extends ChangeNotifier { ); if (data != null) { if (data.error == "0") { - _contactsList = data.contacts?.where((contact) => contact != null && contact.id != null && contact.name != null).toList() ?? []; + _contactsList = + data.contacts + ?.where( + (contact) => contact.id != null && contact.name != null, + ) + .toList() ?? + []; notifyListeners(); } else { _contactsList.clear(); @@ -1139,17 +1193,17 @@ class Leadlistprovider extends ChangeNotifier { } Future crmLeadListAPIFunction( - BuildContext context, - String? mode, - String? leadStatus, - String? openStatus, - String? sourceID, - String? referenceID, - String? teamID, - String? segmentID, - String? alphabet, { - bool append = false, - }) async { + BuildContext context, + String? mode, + String? leadStatus, + String? openStatus, + String? sourceID, + String? referenceID, + String? teamID, + String? segmentID, + String? alphabet, { + bool append = false, + }) async { try { var HomeProv = Provider.of(context, listen: false); @@ -1177,7 +1231,9 @@ class Leadlistprovider extends ChangeNotifier { alphabet, _currentPage.toString(), // ); - debugPrint('empId: ${HomeProv.empId}, session: ${HomeProv.session}, pageNumber: $_currentPage'); + debugPrint( + 'empId: ${HomeProv.empId}, session: ${HomeProv.session}, pageNumber: $_currentPage', + ); if (data != null && data.error == "0") { if (append) { @@ -1193,7 +1249,7 @@ class Leadlistprovider extends ChangeNotifier { if (!append) _errorMessage = "No leads found!"; _hasMoreData = false; } - } catch (e, s) { + } catch (e) { _errorMessage = "Error: $e"; } @@ -1204,16 +1260,16 @@ class Leadlistprovider extends ChangeNotifier { /// Load next page Future loadMore( - BuildContext context, - String? mode, - String? leadStatus, - String? openStatus, - String? sourceID, - String? referenceID, - String? teamID, - String? segmentID, - String? alphabet, - ) async { + BuildContext context, + String? mode, + String? leadStatus, + String? openStatus, + String? sourceID, + String? referenceID, + String? teamID, + String? segmentID, + String? alphabet, + ) async { if (_isLoadingMore || !_hasMoreData) return; _currentPage++; await crmLeadListAPIFunction( @@ -1280,7 +1336,8 @@ class Leadlistprovider extends ChangeNotifier { } void checkDropDownValues() { - if (_selectedEmployees != null && !_employeesList.contains(_selectedEmployees)) { + if (_selectedEmployees != null && + !_employeesList.contains(_selectedEmployees)) { _selectedEmployees = null; _selectedEmployeeId = null; _selectedEmployeeValue = null; @@ -1290,12 +1347,14 @@ class Leadlistprovider extends ChangeNotifier { _selectedSourceId = null; _selectedSourceValue = null; } - if (_selectedReferences != null && !_referencesList.contains(_selectedReferences)) { + if (_selectedReferences != null && + !_referencesList.contains(_selectedReferences)) { _selectedReferences = null; _selectedReferenceId = null; _selectedReferenceValue = null; } - if (_selectedSegments != null && !_segmentsList.contains(_selectedSegments)) { + if (_selectedSegments != null && + !_segmentsList.contains(_selectedSegments)) { _selectedSegments = null; _selectedSegmentId = null; _selectedSegmentValue = null; @@ -1305,7 +1364,8 @@ class Leadlistprovider extends ChangeNotifier { _selectedTeamId = null; _selectedTeamValue = null; } - if (_selectedDistricts != null && !_districtsList.contains(_selectedDistricts)) { + if (_selectedDistricts != null && + !_districtsList.contains(_selectedDistricts)) { _selectedDistricts = null; _selectedDistrictId = null; _selectedDistrictValue = null; @@ -1315,11 +1375,12 @@ class Leadlistprovider extends ChangeNotifier { _selectedStateId = null; _selectedStateValue = null; } - if (_selectedSubLocations != null && !_subLocationsList.contains(_selectedSubLocations)) { + if (_selectedSubLocations != null && + !_subLocationsList.contains(_selectedSubLocations)) { _selectedSubLocations = null; _selectedSubLocationId = null; _selectedSubLocationValue = null; } notifyListeners(); } -} \ No newline at end of file +} diff --git a/lib/Notifiers/crmProvider/ProspectListProvider.dart b/lib/Notifiers/crmProvider/ProspectListProvider.dart index 647f8b2..9f6522e 100644 --- a/lib/Notifiers/crmProvider/ProspectListProvider.dart +++ b/lib/Notifiers/crmProvider/ProspectListProvider.dart @@ -1,4 +1,3 @@ - import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:provider/provider.dart'; @@ -7,7 +6,6 @@ import '../../Models/crmModels/SubmitProspectListFilterResponse.dart'; import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; - class ProspectListProvider extends ChangeNotifier { TextEditingController searchController = TextEditingController(); TextEditingController mobileNumberController = TextEditingController(); @@ -17,43 +15,30 @@ class ProspectListProvider extends ChangeNotifier { bool _isLoading = true; - List _employeesList = []; List _accountList = []; Employees? _selectedEmployees; - String? _selectedEmployeeId; String? _selectedEmployeeValue; - - bool get isLoading => _isLoading; - - List get employeesList => _employeesList; List get accountList => _accountList; - - Employees? get selectedEmployees => _selectedEmployees; - String? get selectedEmployeeId => _selectedEmployeeId; String? get selectedEmployeeValue => _selectedEmployeeValue; - - set isLoading(bool value) { _isLoading = value; notifyListeners(); } - - set selectedEmployees(Employees? value) { _selectedEmployees = value; _selectedEmployeeId = value!.id!; @@ -71,8 +56,6 @@ class ProspectListProvider extends ChangeNotifier { notifyListeners(); } - - Future crmProspectListViewAPIFunction(context, mode) async { try { var HomeProv = Provider.of(context, listen: false); @@ -90,15 +73,10 @@ class ProspectListProvider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } - - Future crmProspectListAPIFunction( - context, - mode, - employeeID, - ) async { + Future crmProspectListAPIFunction(context, mode, employeeID) async { try { _accountList.clear(); notifyListeners(); @@ -110,7 +88,7 @@ class ProspectListProvider extends ChangeNotifier { employeeID, mobileNumberController.text, companyNameController.text, - "1" + "1", ); if (data != null) { _isLoading = true; @@ -128,7 +106,7 @@ class ProspectListProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -156,7 +134,6 @@ class ProspectListProvider extends ChangeNotifier { _selectedEmployeeId = null; - _selectedEmployeeValue = null; checkDropDownValues(); diff --git a/lib/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart b/lib/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart index 762b971..76a0537 100644 --- a/lib/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart +++ b/lib/Notifiers/crmProvider/addNewLeadsandProspectsProvider.dart @@ -58,7 +58,6 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { List> _productRows = []; // For backend List> get productRows => _productRows; - ProductsData? _selectedProductsDeatilsData; List _employeesList = []; List _sourcesList = []; @@ -102,8 +101,6 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { String? _selectedSegmentValue; String? _selectedLeadStatus; - - ProductsData? get selectedProductsDetailsData => _selectedProductsDeatilsData; String? get selectedLeadStatus => _selectedLeadStatus; @@ -193,7 +190,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { set selectedEmployees(Employees? value) { _selectedEmployees = value; _selectedEmployeesId = value!.id; - _selectedEmployeesValue = value!.name; + _selectedEmployeesValue = value.name; notifyListeners(); } @@ -210,7 +207,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { set selectedSources(Sources? value) { _selectedSources = value; _selectedSourcesId = value!.id; - _selectedSourcesValue = value!.name; + _selectedSourcesValue = value.name; sourceError = null; notifyListeners(); } @@ -228,7 +225,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { set selectedTeams(Teams? value) { _selectedTeams = value; _selectedTeamsId = value!.id; - _selectedTeamsValue = value!.name; + _selectedTeamsValue = value.name; teamsError = null; notifyListeners(); } @@ -246,7 +243,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { set selectedStates(States? value) { _selectedStates = value; _selectedStatesId = value!.id; - _selectedStatesValue = value!.name; + _selectedStatesValue = value.name; statesError = null; notifyListeners(); } @@ -263,9 +260,9 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { set selectedProducts(Products? value) { _selectedProducts = value; - if(value!=null){ - _selectedProductsId = value!.id; - _selectedProductsValue = value!.name; + if (value != null) { + _selectedProductsId = value.id; + _selectedProductsValue = value.name; } notifyListeners(); @@ -392,7 +389,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { String? subLocError = ""; String? leadStatusError = ""; - bool _isLoading = true; + final bool _isLoading = true; bool _submitLoading = false; bool get isLoading => _isLoading; @@ -403,17 +400,19 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { _submitLoading = value; notifyListeners(); } + // New method to update an existing product void updateProduct(int index, Map updatedProduct) { productRows[index] = updatedProduct; notifyListeners(); } -// provider.productRows.add({ -// "product_id": provider.selectedProductsId!, -// "price": provider.addProductPriceController.text, -// "qty": provider.addQuantityController.text, -// "net_price": provider.addTotalAmountController.text, -// }); + + // provider.productRows.add({ + // "product_id": provider.selectedProductsId!, + // "price": provider.addProductPriceController.text, + // "qty": provider.addQuantityController.text, + // "net_price": provider.addTotalAmountController.text, + // }); // Existing method to add a new product void addProduct(Map product) { productRows.add(product); @@ -423,7 +422,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { void prefillProductForEdit(int index) { final product = productRows[index]; selectedProducts = productsList.firstWhere( - (p) => p.id == product['product_id'], + (p) => p.id == product['product_id'], orElse: () => Products(id: '', name: 'Unknown'), ); selectedProductsId = product['product_id']; @@ -461,7 +460,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { prov.session, ); if (data != null) { - if(data.sessionExists==1){ + if (data.sessionExists == 1) { if (data.error == "0") { _employeesList = data.employees!; _sourcesList = data.sources!; @@ -472,11 +471,10 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { notifyListeners(); } else {} } else {} - }else{ + } else { sessionDoesNotExist(context); } - - } catch (e, s) {} + } catch (e) {} } Future crmLeadListDistrictsOnStateAPIFunction( @@ -497,7 +495,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmLeadListSubLocOnDistrictAPIFunction( @@ -519,7 +517,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmLeadListSourceOnReferenceAPIFunction( @@ -540,7 +538,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmLeadListSegmentOnTeamAPIFunction( @@ -561,22 +559,22 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmAddNewLeadsAndProspectsAPIFunction( BuildContext context, mode, - acc_manager_id, - salutation_name, + accManagerId, + salutationName, district, state, segment, source, reference, team, - sub_locality, - lead_status, + subLocality, + leadStatus, products, ) async { try { @@ -585,8 +583,8 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { prov.session, prov.empId, mode, - acc_manager_id, - salutation_name, + accManagerId, + salutationName, companyNameController.text, contactPersonNameController.text, district, @@ -596,13 +594,13 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { source, reference, team, - sub_locality, + subLocality, mobileController.text, alternateMobileController.text, telephoneController.text, customerMailIdController.text, designationController.text, - lead_status, + leadStatus, products, ); if (data != null) { @@ -610,12 +608,15 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { Navigator.pushAndRemoveUntil( context, MaterialPageRoute( - builder: (context) => LeadDetailsByMode(mode: "executive", pageTitleName: "Lead Details", leadId: data.leadId??"-",), - settings: RouteSettings( - name: "LeadDetailsByMode" - ) + builder: + (context) => LeadDetailsByMode( + mode: "executive", + pageTitleName: "Lead Details", + leadId: data.leadId ?? "-", + ), + settings: RouteSettings(name: "LeadDetailsByMode"), ), - (Route route) { + (Route route) { return route.settings.name == 'CrmdashboardScreen'; }, ); @@ -630,9 +631,9 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { } Future crmSelectedProductDetailsApiFunction( - BuildContext context, - String productId, - ) async { + BuildContext context, + String productId, + ) async { try { final prov = Provider.of(context, listen: false); final data = await ApiCalling.crmSelectedProductDetailsApi( @@ -643,7 +644,7 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { if (data != null && data.error == "0") { _selectedProductsDeatilsData = data.productsData!; - addProductPriceController.text= data.productsData!.price!; + addProductPriceController.text = data.productsData!.price!; notifyListeners(); } } catch (e, s) { @@ -738,35 +739,35 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { taxesController.clear(); _productRows = []; _selectedProductsDeatilsData = null; - _selectedEmployees = null; - _selectedEmployeesId = null; - _selectedEmployeesValue = null; - _selectedSources = null; - _selectedSourcesId = null; - _selectedSourcesValue = null; + _selectedEmployees = null; + _selectedEmployeesId = null; + _selectedEmployeesValue = null; + _selectedSources = null; + _selectedSourcesId = null; + _selectedSourcesValue = null; _selectedTeams = null; - _selectedTeamsId = null; - _selectedTeamsValue = null; - _selectedStates = null; - _selectedStatesId = null; - _selectedStatesValue = null; - _selectedProducts = null; - _selectedProductsId = null; - _selectedProductsValue = null; - _selectedSalutation = null; - _selectedDistricts = null; - _selectedSubLocations = null; - _selectedReferences = null; - _selectedSegments = null; - _selectedDistrictId = null; - _selectedDistrictValue = null; - _selectedSubLocationId = null; - _selectedSubLocationValue = null; - _selectedReferenceId = null; - _selectedReferenceValue = null; - _selectedSegmentId = null; - _selectedSegmentValue = null; - _selectedLeadStatus = null; + _selectedTeamsId = null; + _selectedTeamsValue = null; + _selectedStates = null; + _selectedStatesId = null; + _selectedStatesValue = null; + _selectedProducts = null; + _selectedProductsId = null; + _selectedProductsValue = null; + _selectedSalutation = null; + _selectedDistricts = null; + _selectedSubLocations = null; + _selectedReferences = null; + _selectedSegments = null; + _selectedDistrictId = null; + _selectedDistrictValue = null; + _selectedSubLocationId = null; + _selectedSubLocationValue = null; + _selectedReferenceId = null; + _selectedReferenceValue = null; + _selectedSegmentId = null; + _selectedSegmentValue = null; + _selectedLeadStatus = null; mailIdError = ""; companynameError = ""; salutationError = ""; @@ -838,31 +839,32 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { notifyListeners(); } - bool validateStep1(){ + bool validateStep1() { bool isValid = true; - if(_selectedSalutation==null||_selectedSalutation==''){ + if (_selectedSalutation == null || _selectedSalutation == '') { isValid = false; salutationError = "Please Select Salutation"; } - if(companyNameController.text.trim().isEmpty){ + if (companyNameController.text.trim().isEmpty) { companynameError = "Please Enter Company Name"; isValid = false; } - if(contactPersonNameController.text.trim().isEmpty){ + if (contactPersonNameController.text.trim().isEmpty) { nameError = "Please Enter Name"; isValid = false; } - if(customerMailIdController.text.trim().isNotEmpty && !RegExp(r'\S+@\S+\.\S+').hasMatch(customerMailIdController.text)){ + if (customerMailIdController.text.trim().isNotEmpty && + !RegExp(r'\S+@\S+\.\S+').hasMatch(customerMailIdController.text)) { mailIdError = "Please enter a proper Email ID"; isValid = false; } - if(mobileController.text.trim().isEmpty){ + if (mobileController.text.trim().isEmpty) { mobileError = "Please enter Mobile Number"; isValid = false; - }else{ - if(mobileController.text.length<10){ + } else { + if (mobileController.text.length < 10) { mobileError = "Please enter 10 digits"; isValid = false; } @@ -873,36 +875,35 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { // isValid = false; // } - notifyListeners(); return isValid; } - bool validateStep2(){ + bool validateStep2() { bool isValid = true; - if(alternateMobileController.text.trim().isNotEmpty && alternateMobileController.text.length<10){ + if (alternateMobileController.text.trim().isNotEmpty && + alternateMobileController.text.length < 10) { AlternatemobileError = "Please enter 10 digits"; isValid = false; - } // if(telephoneController.text.trim().isEmpty){ // isValid = false; // // } - if(_selectedSources==null||_selectedSourcesId!.isEmpty){ + if (_selectedSources == null || _selectedSourcesId!.isEmpty) { sourceError = "Please Select Source"; isValid = false; } - if(_selectedReferences==null||_selectedReferenceId!.isEmpty){ - referenceError = "Please Select Reference"; + if (_selectedReferences == null || _selectedReferenceId!.isEmpty) { + referenceError = "Please Select Reference"; isValid = false; } - if(_selectedTeams==null||_selectedTeamsId!.isEmpty){ + if (_selectedTeams == null || _selectedTeamsId!.isEmpty) { teamsError = "Please Select Team"; isValid = false; } - if(_selectedSegments==null||_selectedSegmentId!.isEmpty){ + if (_selectedSegments == null || _selectedSegmentId!.isEmpty) { segmentsError = "Please Select Segement"; isValid = false; } @@ -911,13 +912,13 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { return isValid; } - bool validateStep3(){ + bool validateStep3() { bool isValid = true; - if(_selectedStates==null||_selectedStatesId!.isEmpty){ + if (_selectedStates == null || _selectedStatesId!.isEmpty) { statesError = "Please Select State"; isValid = false; } - if(_selectedDistricts==null||_selectedDistrictId!.isEmpty){ + if (_selectedDistricts == null || _selectedDistrictId!.isEmpty) { districtsError = "Please Select District"; isValid = false; } @@ -925,15 +926,15 @@ class Addnewleadsandprospectsprovider extends ChangeNotifier { // subLocError = "Please Select Sub Location"; // isValid = false; // } - if(_selectedLeadStatus==null||_selectedLeadStatus!.isEmpty){ + if (_selectedLeadStatus == null || _selectedLeadStatus!.isEmpty) { leadStatusError = "Please Select Lead Status"; isValid = false; } - if(addressController.text.trim().isEmpty){ + if (addressController.text.trim().isEmpty) { addressError = "Please Enter address"; isValid = false; } - if(productRows.isEmpty || _productRows.isEmpty){ + if (productRows.isEmpty || _productRows.isEmpty) { productsEmptyError = "Please Add min. one Product"; isValid = false; } diff --git a/lib/Notifiers/crmProvider/addProspectLeadsProvider.dart b/lib/Notifiers/crmProvider/addProspectLeadsProvider.dart index 5dc8a24..54ebcbe 100644 --- a/lib/Notifiers/crmProvider/addProspectLeadsProvider.dart +++ b/lib/Notifiers/crmProvider/addProspectLeadsProvider.dart @@ -36,8 +36,8 @@ class Addprospectleadsprovider extends ChangeNotifier { List editProductPriceControllers = []; List editQuantityControllers = []; List editTotalAmountControllers = []; - List _selectedProductIds = []; - List _selectedValues = []; + final List _selectedProductIds = []; + final List _selectedValues = []; bool _submitLoading = false; ProductsData? get selectedProductsDetailsData => _selectedProductsDeatilsData; @@ -70,7 +70,7 @@ class Addprospectleadsprovider extends ChangeNotifier { set selectedEmployee(LeadEmployees? value) { _selectedEmployees = value; _selectedEmployeeId = value!.id!; - _selectedEmployeeValue = value!.name!; + _selectedEmployeeValue = value.name!; notifyListeners(); } @@ -129,9 +129,9 @@ class Addprospectleadsprovider extends ChangeNotifier { } Future crmSelectedProductDetailsApiFunction( - BuildContext context, - String productId, - ) async { + BuildContext context, + String productId, + ) async { try { final prov = Provider.of(context, listen: false); final data = await ApiCalling.crmSelectedProductDetailsApi( @@ -142,7 +142,7 @@ class Addprospectleadsprovider extends ChangeNotifier { if (data != null && data.error == "0") { _selectedProductsDeatilsData = data.productsData!; - addLeadProductPriceController.text= data.productsData!.price!; + addLeadProductPriceController.text = data.productsData!.price!; notifyListeners(); } } catch (e, s) { @@ -225,10 +225,10 @@ class Addprospectleadsprovider extends ChangeNotifier { Future crmProspectDetailsAddLeadsSubmitAPIFunction( BuildContext context, mode, - account_id, - acc_manager_id, + accountId, + accManagerId, products, - lead_status, + leadStatus, ) async { try { _submitLoading = true; @@ -238,10 +238,10 @@ class Addprospectleadsprovider extends ChangeNotifier { prov.empId, prov.session, mode, - account_id, - acc_manager_id, + accountId, + accManagerId, products, - lead_status, + leadStatus, ); if (data != null && data.error == "0") { _submitLoading = false; @@ -259,9 +259,9 @@ class Addprospectleadsprovider extends ChangeNotifier { BuildContext context, mode, leadId, - account_id, + accountId, productId, - lead_status, + leadStatus, ) async { try { if (!validateform(context)) { @@ -277,11 +277,11 @@ class Addprospectleadsprovider extends ChangeNotifier { final data = await ApiCalling.crmProspectDetailsAddLeadAPI( prov.empId, prov.session, - account_id, + accountId, productId, addLeadProductQtyController.text, addLeadProductPriceController.text, - lead_status, + leadStatus, ); if (data != null) { if (data.error == "0") { diff --git a/lib/Notifiers/crmProvider/appointmentCalendarProvider.dart b/lib/Notifiers/crmProvider/appointmentCalendarProvider.dart index 1185e56..23e4952 100644 --- a/lib/Notifiers/crmProvider/appointmentCalendarProvider.dart +++ b/lib/Notifiers/crmProvider/appointmentCalendarProvider.dart @@ -6,8 +6,7 @@ import 'package:provider/provider.dart'; import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; -class Appointmentcalendarprovider extends ChangeNotifier{ - +class Appointmentcalendarprovider extends ChangeNotifier { bool _isLoading = false; List _appointmentsList = []; DateTime? _selectedDate; @@ -17,26 +16,29 @@ class Appointmentcalendarprovider extends ChangeNotifier{ String? get selectedFollowUpType => _selectedFollowUpType; List get appointmentList => _appointmentsList; DateTime? get selectedDate => _selectedDate; - set selectedFollowUpType(String? value){ + set selectedFollowUpType(String? value) { _selectedFollowUpType = value; notifyListeners(); } - set isLoading(bool value){ + + set isLoading(bool value) { _isLoading = value; notifyListeners(); } + void setSelectedDate(DateTime date) { _selectedDate = date; notifyListeners(); } - Future crmAppointmentCalendarAPIFunction(context, date,type) async { + + Future crmAppointmentCalendarAPIFunction(context, date, type) async { try { var HomeProv = Provider.of(context, listen: false); final data = await ApiCalling.crmAppointmentCalendarAPI( HomeProv.empId, HomeProv.session, date, - type + type, ); _isLoading = true; notifyListeners(); @@ -45,19 +47,18 @@ class Appointmentcalendarprovider extends ChangeNotifier{ _isLoading = false; _appointmentsList = data.appointments!; notifyListeners(); - }else{ + } else { toast(context, data.message); _isLoading = false; notifyListeners(); } - }else{ + } else { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } } } - diff --git a/lib/Notifiers/crmProvider/crmDashboardProvider.dart b/lib/Notifiers/crmProvider/crmDashboardProvider.dart index 4f37f56..7decb93 100644 --- a/lib/Notifiers/crmProvider/crmDashboardProvider.dart +++ b/lib/Notifiers/crmProvider/crmDashboardProvider.dart @@ -19,7 +19,7 @@ import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; class Crmdashboardprovider extends ChangeNotifier { - String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"; + final String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"; TextEditingController searchController = TextEditingController(); List _accessPages = []; @@ -31,11 +31,10 @@ class Crmdashboardprovider extends ChangeNotifier { List _leadsList = []; List _enquiresList = []; - List _dashboardFollowUps = []; List _dashboardQuotations = []; - List get dashboardFollowUps => _dashboardFollowUps; + List get dashboardFollowUps => _dashboardFollowUps; List get dashboardQuotations => _dashboardQuotations; LatLng? currentLocationLatLng; @@ -103,8 +102,6 @@ class Crmdashboardprovider extends ChangeNotifier { List get allLeads => _allLeads; - - Future accessPagesAPIFunction(context) async { try { var HomeProv = Provider.of(context, listen: false); @@ -121,7 +118,7 @@ class Crmdashboardprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future getCurrentLocation(context) async { @@ -130,9 +127,9 @@ class Crmdashboardprovider extends ChangeNotifier { desiredAccuracy: geo_location.LocationAccuracy.high, ); currentLocationLatLng = LatLng(position.latitude, position.longitude); - print("Current Loc: ${currentLocationLatLng}"); + print("Current Loc: $currentLocationLatLng"); latlongs = '${position.latitude},${position.longitude}'; - print("latlongs : ${latlongs}"); + print("latlongs : $latlongs"); notifyListeners(); crmDashboardAPIFunction(context); } catch (e) { @@ -176,7 +173,7 @@ class Crmdashboardprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } String getStaticMapUrl(double lat, double lng) { @@ -213,7 +210,7 @@ class Crmdashboardprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmUniversalSearchFunction(context) async { @@ -232,30 +229,30 @@ class Crmdashboardprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } - Future crmDashboardFollowUpAPIFunction(context,type) async { + Future crmDashboardFollowUpAPIFunction(context, type) async { try { var HomeProv = Provider.of(context, listen: false); final data = await ApiCalling.crmDashboardFollowUpAPI( HomeProv.empId, HomeProv.session, - type + type, ); if (data != null) { - if(data.sessionExists==1){ + if (data.sessionExists == 1) { if (data.error == "0") { _dashboardFollowUps = data.followupLists!; notifyListeners(); } - }else{ + } else { sessionDoesNotExist(context); } - } - } catch (e, s) {} + } catch (e) {} } + Future crmDashboardQuotationsAPIFunction(context) async { try { var HomeProv = Provider.of(context, listen: false); @@ -264,17 +261,15 @@ class Crmdashboardprovider extends ChangeNotifier { HomeProv.session, ); if (data != null) { - if(data.sessionExists==1){ + if (data.sessionExists == 1) { if (data.error == "0") { - _dashboardQuotations = data.quotationLists!; + _dashboardQuotations = data.quotationLists!; notifyListeners(); } - }else{ + } else { sessionDoesNotExist(context); } - } - } catch (e, s) {} + } catch (e) {} } - } diff --git a/lib/Notifiers/crmProvider/crmEditProspectAccountProvider.dart b/lib/Notifiers/crmProvider/crmEditProspectAccountProvider.dart index 396914a..006fd25 100644 --- a/lib/Notifiers/crmProvider/crmEditProspectAccountProvider.dart +++ b/lib/Notifiers/crmProvider/crmEditProspectAccountProvider.dart @@ -17,10 +17,9 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { TextEditingController addressController = TextEditingController(); TextEditingController searchController = TextEditingController(); - String? salutationError; - String? companyNameError; + String? companyNameError; String? pincodeError; @@ -88,7 +87,6 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { String? get selectedSubLocationValue => _selectedSubLocationValue; - set isLoading(bool value) { _isLoading = value; notifyListeners(); @@ -182,7 +180,7 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmProspectDetailsEditAccountViewAPIFunction( @@ -201,8 +199,8 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { if (data != null) { if (data.error == "0") { _accountDetails = data.accountDetails!; - _statesList = data.states??[]; - _salutationsList = data.salutations??[]; + _statesList = data.states ?? []; + _salutationsList = data.salutations ?? []; _isLoading = false; notifyListeners(); } else { @@ -213,7 +211,7 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -223,7 +221,7 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { context, accID, - salutation, + salutation, stateID, districtID, subLocalityID, @@ -260,17 +258,17 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } } Future crmLeadListDistrictsOnStateAPIFunction( - context, - mode, - stateID, - ) async { + context, + mode, + stateID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmDistrictsOnStateAPI( @@ -284,14 +282,14 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmLeadListSubLocOnDistrictAPIFunction( - context, - mode, - districtID, - ) async { + context, + mode, + districtID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmSubLocOnDistrictAPI( @@ -305,14 +303,13 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmProspectDetailsTransferAccountAPIFunction( context, accID, transferEmpID, - ) async { try { var prov = Provider.of(context, listen: false); @@ -340,30 +337,32 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } } - void onChangeSalutation(value){ + void onChangeSalutation(value) { salutationError = ""; notifyListeners(); } - void onChangeCompanyName(value){ + + void onChangeCompanyName(value) { companyNameError = ""; notifyListeners(); } - void onChangePincode(value){ + + void onChangePincode(value) { pincodeError = ""; notifyListeners(); } - void onChangeAddress(value){ + + void onChangeAddress(value) { addressError = ""; notifyListeners(); } - void resetAll() { editCompanyNameController.clear(); editSalutationNameController.clear(); @@ -378,7 +377,8 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { addressError = null; notifyListeners(); - _selectedEmployees = null; _selectedEmployeeId = null; + _selectedEmployees = null; + _selectedEmployeeId = null; _selectedEmployeeValue = null; _selectedStates = null; _selectedDistricts = null; @@ -393,6 +393,7 @@ class Crmeditprospectaccountprovider extends ChangeNotifier { checkDropDownValues(); notifyListeners(); } + void checkDropDownValues() { if (!_salutationsList.contains(_selectedSalutation) && _selectedSalutation != null) { diff --git a/lib/Notifiers/crmProvider/crmGenerateQuotationProvider.dart b/lib/Notifiers/crmProvider/crmGenerateQuotationProvider.dart index a28eb0c..d2975a6 100644 --- a/lib/Notifiers/crmProvider/crmGenerateQuotationProvider.dart +++ b/lib/Notifiers/crmProvider/crmGenerateQuotationProvider.dart @@ -45,7 +45,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { bool get buttonsLoading => _buttonsLoading; - set buttonsLoading(bool value){ + set buttonsLoading(bool value) { _buttonsLoading = value; notifyListeners(); } @@ -87,8 +87,8 @@ class Crmgeneratequotationprovider extends ChangeNotifier { String? get selectedTaxes => _selectedTaxes; - List _selectedProductIds = []; - List _selectedValues = []; + final List _selectedProductIds = []; + final List _selectedValues = []; bool _submitLoading = false; String? get quotationFilePath => _quotationFilePath; @@ -108,7 +108,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { notifyListeners(); } - set selectedTaxes(String? value){ + set selectedTaxes(String? value) { _selectedTaxes = value; taxesError = ""; notifyListeners(); @@ -140,20 +140,20 @@ class Crmgeneratequotationprovider extends ChangeNotifier { notifyListeners(); } - set selectedProducts(Products? value){ + set selectedProducts(Products? value) { _selectedProducts = value; - _selectedAddEditProductId = value!.id!; - _selectedAddEditProductName = value!.name; + _selectedAddEditProductId = value!.id!; + _selectedAddEditProductName = value.name; notifyListeners(); } - set selectedAddEditProductId(String? value){ + set selectedAddEditProductId(String? value) { _selectedAddEditProductId = value; notifyListeners(); } - set selectedAddEditProductName(String? value){ - _selectedAddEditProductName= value; + set selectedAddEditProductName(String? value) { + _selectedAddEditProductName = value; notifyListeners(); } @@ -203,10 +203,10 @@ class Crmgeneratequotationprovider extends ChangeNotifier { notifyListeners(); } - void preFillFormForEdit(LeadProducts product,int index) { + void preFillFormForEdit(LeadProducts product, int index) { final newprod = product; selectedProducts = productsList.firstWhere( - (p) => p.id == newprod.productId, + (p) => p.id == newprod.productId, orElse: () => Products(id: '', name: 'Unknown'), ); // selectedLeadProducts = product; @@ -214,7 +214,6 @@ class Crmgeneratequotationprovider extends ChangeNotifier { selectedAddEditProductId = product.productId; selectedAddEditProductName = product.productName; - addEditProductPriceController.text = product.price?.toString() ?? ''; addEditQuantityController.text = product.qty?.toString() ?? ''; addEditTotalAmountController.text = @@ -257,10 +256,11 @@ class Crmgeneratequotationprovider extends ChangeNotifier { notifyListeners(); } + Future crmSelectedProductDetailsApiFunction( - BuildContext context, - String productId, - ) async { + BuildContext context, + String productId, + ) async { try { final prov = Provider.of(context, listen: false); final data = await ApiCalling.crmSelectedProductDetailsApi( @@ -271,13 +271,14 @@ class Crmgeneratequotationprovider extends ChangeNotifier { if (data != null && data.error == "0") { _selectedProductsDeatilsData = data.productsData!; - addEditProductPriceController.text= data.productsData!.price!; + addEditProductPriceController.text = data.productsData!.price!; notifyListeners(); } } catch (e, s) { print("Error: $e, Stack: $s"); } } + void editAddNewRow() { editProductPriceControllers.add(TextEditingController()); editQuantityControllers.add(TextEditingController()); @@ -370,14 +371,14 @@ class Crmgeneratequotationprovider extends ChangeNotifier { data.quoteDetails!.paymentTerms ?? "-"; for (var product in data.leadProducts!) { - _productRows.add({ - "product_id": product.productId!, - "price": product.price, - "qty": product.qty, - "net_price": product.prodTotalPrice, - }); + _productRows.add({ + "product_id": product.productId!, + "price": product.price, + "qty": product.qty, + "net_price": product.prodTotalPrice, + }); } - print("_productRows : ${_productRows}"); + print("_productRows : $_productRows"); notifyListeners(); } else { _isLoading = false; @@ -398,11 +399,11 @@ class Crmgeneratequotationprovider extends ChangeNotifier { Future crmLeadDetailsGenerateQuoteSubmitAPIFunction( BuildContext context, String leadID, - quote_products, - quotation_type, + quoteProducts, + quotationType, ) async { try { - if(!validateform()){ + if (!validateform()) { return; } _buttonsLoading = true; @@ -419,14 +420,14 @@ class Crmgeneratequotationprovider extends ChangeNotifier { forController.text, paymentTermsController.text, mailIdController.text, - quote_products, - quotation_type, + quoteProducts, + quotationType, ); if (data != null) { if (data.error == "0") { _buttonsLoading = false; _quotationFilePath = data.quoteFilepath!; - if (quotation_type == "genquotedown") { + if (quotationType == "genquotedown") { String suggestedFilename = getUniqueFilename('quotation', 'pdf'); String contentDisposition = 'attachment; filename="$suggestedFilename"'; @@ -438,7 +439,7 @@ class Crmgeneratequotationprovider extends ChangeNotifier { 'application/octet-stream', '', ); - } else if (quotation_type == "genquotewhatsappbymynum") { + } else if (quotationType == "genquotewhatsappbymynum") { openWhatsApp(data.quoteFilepath!); } Navigator.pop(context, true); @@ -655,42 +656,42 @@ class Crmgeneratequotationprovider extends ChangeNotifier { notifyListeners(); } - bool validateform(){ + bool validateform() { bool isValid = true; - if(mailIdController.text.trim().isEmpty){ + if (mailIdController.text.trim().isEmpty) { mailIdError = "Please Enter Email ID"; isValid = false; } - if(mobileController.text.trim().isEmpty){ + if (mobileController.text.trim().isEmpty) { mobileError = "Please Enter Mobile Number"; isValid = false; - }else{ - if(mobileController.text.length<10){ + } else { + if (mobileController.text.length < 10) { mobileError = "Mobile Number should be 10 digits"; isValid = false; } } - if(subjectsController.text.isEmpty){ + if (subjectsController.text.isEmpty) { subjectsError = "Please Enter Subject"; isValid = false; } - if(productRows.isEmpty||_productRows.isEmpty){ + if (productRows.isEmpty || _productRows.isEmpty) { productRowsError = "Please Add Min. 1 Product"; isValid = false; } - if(_selectedTaxes==null||_selectedTaxes==""){ + if (_selectedTaxes == null || _selectedTaxes == "") { taxesError = "Please select a value"; isValid = false; } - if(SpecialNoteController.text.trim().isEmpty){ + if (SpecialNoteController.text.trim().isEmpty) { SpecialNoteError = "Please Enter a Note"; isValid = false; } - if(forController.text.trim().isEmpty){ + if (forController.text.trim().isEmpty) { forError = "Please Enter FOR"; isValid = false; } - if(paymentTermsController.text.trim().isEmpty){ + if (paymentTermsController.text.trim().isEmpty) { paymentTermsError = "Please Enter Terms"; isValid = false; } diff --git a/lib/Notifiers/crmProvider/crmLeadDetailsProvider.dart b/lib/Notifiers/crmProvider/crmLeadDetailsProvider.dart index 6b21844..a325ba8 100644 --- a/lib/Notifiers/crmProvider/crmLeadDetailsProvider.dart +++ b/lib/Notifiers/crmProvider/crmLeadDetailsProvider.dart @@ -19,9 +19,10 @@ import '../../Utils/app_colors.dart'; import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; import 'package:http/http.dart' as http; + class crmLeadDetailsProvider extends ChangeNotifier { final FlutterLocalNotificationsPlugin _notificationsPlugin = - FlutterLocalNotificationsPlugin(); + FlutterLocalNotificationsPlugin(); static const platform = MethodChannel('in.webgrid.generp/download'); final GlobalKey webViewKey = GlobalKey(); @@ -63,8 +64,6 @@ class crmLeadDetailsProvider extends ChangeNotifier { String? _editTeleError; String? _editEmailError; - - String? _dateError; LeadDetails _leadDetails = LeadDetails(); @@ -76,14 +75,13 @@ class crmLeadDetailsProvider extends ChangeNotifier { List _quotationsDetails = []; List _visitTypes = []; String? _selectedVisitType; - List _headings = []; - List _subHeadings = []; + final List _headings = []; + final List _subHeadings = []; DateTime? _date; String? _formattedDate; String? _formattedDateToSend; String? _visitTypeError = ""; - String? get formattedDateToSend => _formattedDateToSend; get showEditButton => _showEditButton; @@ -223,7 +221,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { notifyListeners(); } - set leadDetailsLoading(bool value){ + set leadDetailsLoading(bool value) { _leadDetailsLoading = value; notifyListeners(); } @@ -291,7 +289,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { _leadDetailsLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _leadDetailsLoading = false; notifyListeners(); } @@ -299,7 +297,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { Future crmLeadDetailsAddContactAPIFunction(context, accID) async { try { - if(!AddContactValidation()){ + if (!AddContactValidation()) { return; } _isLoading = true; @@ -337,17 +335,15 @@ class crmLeadDetailsProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } } - - Future crmLeadDetailsEditContactAPIFunction(context, contactID) async { try { - if(!editContactValidation()){ + if (!editContactValidation()) { return; } _isLoading = true; @@ -384,7 +380,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -430,7 +426,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { } else { notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -465,7 +461,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { } else { notifyListeners(); } - } catch (e, s) { + } catch (e) { notifyListeners(); } } @@ -477,7 +473,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { appointmentType, note, ) async { - if(!validAppointment()){ + if (!validAppointment()) { return; } _isLoading = true; @@ -513,7 +509,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -575,7 +571,11 @@ class crmLeadDetailsProvider extends ChangeNotifier { child: CupertinoDatePicker( dateOrder: DatePickerDateOrder.dmy, initialDateTime: _date ?? DateTime.now(), - minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), + minimumDate: DateTime( + DateTime.now().year, + DateTime.now().month, + DateTime.now().day, + ), mode: CupertinoDatePickerMode.date, use24hFormat: true, showDayOfWeek: true, @@ -620,12 +620,6 @@ class crmLeadDetailsProvider extends ChangeNotifier { void copyToClipboard(BuildContext context) async { try { - if (leadDetails == null) { - ScaffoldMessenger.of( - context, - ).showSnackBar(SnackBar(content: Text("No data to copy"))); - return; - } final data = prepareExportData(); // if (data.isEmpty || data[1].every((element) => element == "-")) { // ScaffoldMessenger.of(context).showSnackBar( @@ -647,14 +641,13 @@ class crmLeadDetailsProvider extends ChangeNotifier { } } - Future _handleDownload( - context, - String url, - String contentDisposition, - String mimeType, - String suggestedFilename, - ) async { + context, + String url, + String contentDisposition, + String mimeType, + String suggestedFilename, + ) async { // Request notification permission for Android 13+ if (Platform.isIOS) { _handleIOSDownload(context, url, suggestedFilename); @@ -690,10 +683,10 @@ class crmLeadDetailsProvider extends ChangeNotifier { } Future _handleIOSDownload( - context, - String url, - String suggestedFilename, - ) async { + context, + String url, + String suggestedFilename, + ) async { try { // Show initial download notification await _showDownloadNotification(0, suggestedFilename, isComplete: false); @@ -701,9 +694,9 @@ class crmLeadDetailsProvider extends ChangeNotifier { // Get the temporary directory for iOS final tempDir = await getTemporaryDirectory(); final fileName = - suggestedFilename.isNotEmpty - ? suggestedFilename - : url.split('/').last; + suggestedFilename.isNotEmpty + ? suggestedFilename + : url.split('/').last; final filePath = '${tempDir.path}/$fileName'; // Download the file using http @@ -732,6 +725,7 @@ class crmLeadDetailsProvider extends ChangeNotifier { toast(context, "Failed to download file: $e"); } } + String getUniqueFilename(String baseName, [String ext = 'pdf']) { final now = DateTime.now(); final formattedDate = DateFormat('yyyyMMdd_HHmmss').format(now); @@ -739,11 +733,11 @@ class crmLeadDetailsProvider extends ChangeNotifier { } Future _showDownloadNotification( - int progress, - String fileName, { - bool isComplete = false, - bool isError = false, - }) async { + int progress, + String fileName, { + bool isComplete = false, + bool isError = false, + }) async { final androidDetails = AndroidNotificationDetails( 'download_channel', 'Downloads', @@ -769,11 +763,11 @@ class crmLeadDetailsProvider extends ChangeNotifier { presentBadge: true, presentSound: isComplete || isError, subtitle: - isError - ? 'Download failed' - : isComplete - ? 'Download complete' - : 'Downloading...', + isError + ? 'Download failed' + : isComplete + ? 'Download complete' + : 'Downloading...', threadIdentifier: 'download_thread', ); @@ -814,10 +808,11 @@ class crmLeadDetailsProvider extends ChangeNotifier { } void onChangeAltMobile(value) { - - if(mobileNumberController.text.trim() == alternativeMobileController.text.trim()){ - _altMobError = "Mobile Number and Alternate Mobile Number Should not be same"; - }else{ + if (mobileNumberController.text.trim() == + alternativeMobileController.text.trim()) { + _altMobError = + "Mobile Number and Alternate Mobile Number Should not be same"; + } else { _altMobError = ""; } notifyListeners(); @@ -849,9 +844,11 @@ class crmLeadDetailsProvider extends ChangeNotifier { } void onChangeEditAltMobile(value) { - if(editMobileNumberController.text.trim() == editAlternativeMobileController.text.trim()){ - _editAltMobError = "Mobile Number and Alternate Mobile Number Should not be same"; - }else{ + if (editMobileNumberController.text.trim() == + editAlternativeMobileController.text.trim()) { + _editAltMobError = + "Mobile Number and Alternate Mobile Number Should not be same"; + } else { _editAltMobError = ""; } notifyListeners(); @@ -872,8 +869,8 @@ class crmLeadDetailsProvider extends ChangeNotifier { notifyListeners(); } - bool AddContactValidation(){ - bool isValid = true; + bool AddContactValidation() { + bool isValid = true; _nameError = null; _designationError = null; _mobileNumError = null; @@ -881,31 +878,34 @@ class crmLeadDetailsProvider extends ChangeNotifier { _teleError = null; _emailError = null; _noteError = null; - if(nameController.text.trim().isEmpty){ + if (nameController.text.trim().isEmpty) { _nameError = "Please Enter Name"; isValid = false; } - if(mobileNumberController.text.trim().isEmpty || mobileNumberController.text.length<10){ + if (mobileNumberController.text.trim().isEmpty || + mobileNumberController.text.length < 10) { _mobileNumError = "Please Enter Mobile Number 10 Digits"; isValid = false; } - if(alternativeMobileController.text.trim().isNotEmpty){ - if(alternativeMobileController.text.length<10){ + if (alternativeMobileController.text.trim().isNotEmpty) { + if (alternativeMobileController.text.length < 10) { _altMobError = "Please Enter Mobile Number 10 Digits"; isValid = false; } } - if(mobileNumberController.text.trim() == alternativeMobileController.text.trim()){ - _altMobError = "Mobile Number and Alternate Mobile Number Should not be same"; + if (mobileNumberController.text.trim() == + alternativeMobileController.text.trim()) { + _altMobError = + "Mobile Number and Alternate Mobile Number Should not be same"; isValid = false; } - if(emailController.text.isNotEmpty){ + if (emailController.text.isNotEmpty) { final RegExp emailRegex = RegExp( r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', ); isValid = emailRegex.hasMatch(emailController.text.trim()); - if(!isValid){ + if (!isValid) { _emailError = "Please Enter Proper Email ID"; } } @@ -915,8 +915,8 @@ class crmLeadDetailsProvider extends ChangeNotifier { return isValid; } - bool editContactValidation(){ - bool isValid = true; + bool editContactValidation() { + bool isValid = true; _editNameError = null; _editDesignationError = null; _editMobileNumError = null; @@ -924,31 +924,34 @@ class crmLeadDetailsProvider extends ChangeNotifier { _editTeleError = null; _editEmailError = null; _noteError = null; - if(editNameController.text.trim().isEmpty){ + if (editNameController.text.trim().isEmpty) { _editNameError = "Please Enter Name"; isValid = false; } - if(editMobileNumberController.text.trim().isEmpty || editMobileNumberController.text.length<10){ + if (editMobileNumberController.text.trim().isEmpty || + editMobileNumberController.text.length < 10) { _editMobileNumError = "Please Enter Mobile Number 10 Digits"; isValid = false; } - if(editAlternativeMobileController.text.trim().isNotEmpty){ - if(editAlternativeMobileController.text.length<10){ + if (editAlternativeMobileController.text.trim().isNotEmpty) { + if (editAlternativeMobileController.text.length < 10) { _editAltMobError = "Please Enter Mobile Number 10 Digits"; isValid = false; } } - if(editMobileNumberController.text.trim() == editAlternativeMobileController.text.trim()){ - _editAltMobError = "Mobile Number and Alternate Mobile Number Should not be same"; + if (editMobileNumberController.text.trim() == + editAlternativeMobileController.text.trim()) { + _editAltMobError = + "Mobile Number and Alternate Mobile Number Should not be same"; isValid = false; } - if(editEmailController.text.isNotEmpty){ + if (editEmailController.text.isNotEmpty) { final RegExp emailRegex = RegExp( r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$', ); isValid = emailRegex.hasMatch(editEmailController.text.trim()); - if(!isValid){ + if (!isValid) { _editEmailError = "Please Enter Proper Email ID"; } } @@ -958,24 +961,24 @@ class crmLeadDetailsProvider extends ChangeNotifier { return isValid; } - bool validAppointment(){ - bool isValid = true; + bool validAppointment() { + bool isValid = true; _dateError = null; _visitTypeError = null; _noteError = null; - if(dateController.text.trim().isEmpty){ + if (dateController.text.trim().isEmpty) { _dateError = "Please Enter Name"; isValid = false; } - if(_selectedVisitType==null || _selectedVisitType == ""){ + if (_selectedVisitType == null || _selectedVisitType == "") { _visitTypeError = "Please Select Appointment Type"; isValid = false; } - if(noteController.text.trim().isEmpty){ + if (noteController.text.trim().isEmpty) { _noteError = "Please Enter Note"; isValid = false; } @@ -986,8 +989,6 @@ class crmLeadDetailsProvider extends ChangeNotifier { return isValid; } - - void resetAll() { _formattedDateToSend = null; _formattedDate = null; diff --git a/lib/Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart b/lib/Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart index 1484ac8..5b0ae65 100644 --- a/lib/Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart +++ b/lib/Notifiers/crmProvider/crmNearbyOpenLeadsProvider.dart @@ -352,11 +352,14 @@ import '../../Utils/commonServices.dart'; class crmNearbyOpenLeadsProvider extends ChangeNotifier { List _leadslist = []; - TextEditingController _locationController = TextEditingController(); - String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"; + final TextEditingController _locationController = TextEditingController(); + final String _googleApikey = "AIzaSyBGzvgMMKwPBAANTwaoRsAnrCpiWCj8wVs"; GoogleMapController? _mapController; CameraPosition? _cameraPosition; - LatLng _startLocation = const LatLng(17.439112226708446, 78.43292499146135); + final LatLng _startLocation = const LatLng( + 17.439112226708446, + 78.43292499146135, + ); String _latlongs = ""; List _markers = []; List _addresses = []; @@ -434,7 +437,7 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { LocationPermission permission = await Geolocator.checkPermission(); _hasLocationPermission = permission == LocationPermission.always || - permission == LocationPermission.whileInUse; + permission == LocationPermission.whileInUse; final Location.Location location = Location.Location(); bool serviceEnabled; @@ -462,11 +465,13 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { _currentLocation = locData; if (_currentLocation != null && _mapCenter == null) { - _mapCenter = LatLng(_currentLocation!.latitude!, _currentLocation!.longitude!); - _latlongs = '${_currentLocation!.latitude},${_currentLocation!.longitude}'; - _mapController?.animateCamera( - CameraUpdate.newLatLng(_mapCenter!), + _mapCenter = LatLng( + _currentLocation!.latitude!, + _currentLocation!.longitude!, ); + _latlongs = + '${_currentLocation!.latitude},${_currentLocation!.longitude}'; + _mapController?.animateCamera(CameraUpdate.newLatLng(_mapCenter!)); await LoadNearbyOpenLeadsAPI(context, _currentValue); } notifyListeners(); @@ -494,7 +499,10 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { await LoadNearbyOpenLeadsAPI(context, radius); } - Future LoadNearbyOpenLeadsAPI(BuildContext context, double radius) async { + Future LoadNearbyOpenLeadsAPI( + BuildContext context, + double radius, + ) async { if (_latlongs.isEmpty || radius <= 0) { print("Invalid parameters: latlongs=$_latlongs, radius=$radius"); toast(context, 'Invalid location or radius.'); @@ -514,7 +522,8 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { if (data != null) { if (data.error == 0) { _isLoading = false; - _leadslist = data.leadList?.where((lead) => lead != null).toList() ?? []; + _leadslist = + data.leadList?.where((lead) => lead != null).toList() ?? []; await updateMarkersFromApiResponse(context, _leadslist); if (_leadslist.isEmpty) { toast(context, 'No leads found within the selected radius.'); @@ -538,9 +547,9 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { } Future updateMarkersFromApiResponse( - BuildContext context, - List leadsList, - ) async { + BuildContext context, + List leadsList, + ) async { _markers = await createMarkersFromApiResponse(context, leadsList); _addresses.clear(); await Future.forEach(leadsList, (store) async { @@ -551,24 +560,27 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { } Future> createMarkersFromApiResponse( - BuildContext context, - List leadsList, - ) async { + BuildContext context, + List leadsList, + ) async { List markers = []; ByteData data = await rootBundle.load("assets/images/maps_ic.png"); Uint8List bytes = data.buffer.asUint8List(); await Future.forEach(leadsList, (leads) async { if (leads.loc == null || leads.id == null || leads.name == null) { - print('Skipping invalid lead: id=${leads.id}, name=${leads.name}, loc=${leads.loc}'); + print( + 'Skipping invalid lead: id=${leads.id}, name=${leads.name}, loc=${leads.loc}', + ); return; } ui.Codec codec = await ui.instantiateImageCodec(bytes); ui.FrameInfo fi = await codec.getNextFrame(); - Uint8List resizedBytes = (await fi.image.toByteData( - format: ui.ImageByteFormat.png, - ))!.buffer.asUint8List(); + Uint8List resizedBytes = + (await fi.image.toByteData( + format: ui.ImageByteFormat.png, + ))!.buffer.asUint8List(); markers.add( Marker( @@ -582,11 +594,12 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { Navigator.push( context, MaterialPageRoute( - builder: (context) => LeadDetailsByMode( - mode: "", - pageTitleName: "Lead Details", - leadId: leads.id, - ), + builder: + (context) => LeadDetailsByMode( + mode: "", + pageTitleName: "Lead Details", + leadId: leads.id, + ), ), ); }, @@ -607,11 +620,12 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { Navigator.push( context, MaterialPageRoute( - builder: (context) => LeadDetailsByMode( - mode: "", - pageTitleName: "Lead Details", - leadId: leadID, - ), + builder: + (context) => LeadDetailsByMode( + mode: "", + pageTitleName: "Lead Details", + leadId: leadID, + ), ), ); notifyListeners(); @@ -640,8 +654,8 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { double lng = double.tryParse(parts[1]) ?? 0.0; if (lat != 0.0 && lng != 0.0) { try { - List placemarks = - await geocoding.placemarkFromCoordinates(lat, lng); + List placemarks = await geocoding + .placemarkFromCoordinates(lat, lng); if (placemarks.isNotEmpty) { final placemark = placemarks.first; String address = @@ -663,4 +677,4 @@ class crmNearbyOpenLeadsProvider extends ChangeNotifier { } return "Address not found"; } -} \ No newline at end of file +} diff --git a/lib/Notifiers/crmProvider/crmProspectDetailsProvider.dart b/lib/Notifiers/crmProvider/crmProspectDetailsProvider.dart index 376a6da..e1b3d96 100644 --- a/lib/Notifiers/crmProvider/crmProspectDetailsProvider.dart +++ b/lib/Notifiers/crmProvider/crmProspectDetailsProvider.dart @@ -24,7 +24,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { bool get addContactSelected => _addContactSelected; - set addContactSelected(bool value){ + set addContactSelected(bool value) { _addContactSelected = value; notifyListeners(); } @@ -281,7 +281,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -316,7 +316,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { } else { notifyListeners(); } - } catch (e, s) { + } catch (e) { notifyListeners(); } } @@ -356,7 +356,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -403,7 +403,7 @@ class crmProspectDetailsProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } @@ -465,7 +465,11 @@ class crmProspectDetailsProvider extends ChangeNotifier { child: CupertinoDatePicker( dateOrder: DatePickerDateOrder.dmy, initialDateTime: _date ?? DateTime.now(), - minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), + minimumDate: DateTime( + DateTime.now().year, + DateTime.now().month, + DateTime.now().day, + ), mode: CupertinoDatePickerMode.date, use24hFormat: true, showDayOfWeek: true, diff --git a/lib/Notifiers/crmProvider/editCrmAccountDetailsProvider.dart b/lib/Notifiers/crmProvider/editCrmAccountDetailsProvider.dart index 4203bed..c877511 100644 --- a/lib/Notifiers/crmProvider/editCrmAccountDetailsProvider.dart +++ b/lib/Notifiers/crmProvider/editCrmAccountDetailsProvider.dart @@ -55,10 +55,12 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { _companyNameError = value; notifyListeners(); } + set selectedTeamError(String? value) { _selectedTeamError = value; notifyListeners(); } + set selectedSegmentError(String? value) { _selectedSegmentError = value; notifyListeners(); @@ -70,12 +72,14 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { _selectedTeamValue = value.name; notifyListeners(); } + set selectedSegments(Segments? value) { _selectedSegments = value; _selectedSegmentId = value!.id!; _selectedSegmentValue = value.name; notifyListeners(); } + set selectedTeamId(String? value) { _selectedTeamId = value; notifyListeners(); @@ -85,6 +89,7 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { _selectedTeamValue = value; notifyListeners(); } + set selectedSegmentId(String? value) { _selectedSegmentId = value; notifyListeners(); @@ -124,17 +129,17 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } } Future crmLeadListSegmentOnTeamAPIFunction( - context, - mode, - teamID, - ) async { + context, + mode, + teamID, + ) async { try { var prov = Provider.of(context, listen: false); final data = await ApiCalling.crmLeadListSegmentOnTeamAPI( @@ -148,7 +153,7 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future crmLeadDetailsEditAccountSubmitAPIFunction( @@ -158,7 +163,7 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { teamId, ) async { try { - if(!validateForm(context)){ + if (!validateForm(context)) { return; } var HomeProv = Provider.of(context, listen: false); @@ -186,16 +191,16 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _isLoading = false; notifyListeners(); } } + bool validateForm(BuildContext context) { // Reset all errors _companyNameError = null; - bool isValid = true; if (_selectedTeams == null || _selectedTeamId!.isEmpty) { @@ -208,7 +213,6 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { isValid = false; } - if (editCompanyNameController.text.trim().isEmpty) { _companyNameError = "Please enter Company name"; isValid = false; @@ -234,7 +238,7 @@ class Editcrmaccountdetailsprovider extends ChangeNotifier { _selectedSegmentValue = null; } - void checkDropDownValues(){ + void checkDropDownValues() { if (!_segmentsList.contains(_selectedSegments) && _selectedSegments != null) { _selectedTeamId = null; diff --git a/lib/Notifiers/crmProvider/editProductListProvider.dart b/lib/Notifiers/crmProvider/editProductListProvider.dart index 205aef1..d1248e6 100644 --- a/lib/Notifiers/crmProvider/editProductListProvider.dart +++ b/lib/Notifiers/crmProvider/editProductListProvider.dart @@ -150,18 +150,16 @@ class Editproductlistprovider extends ChangeNotifier { List editProductPriceControllers = []; List editQuantityControllers = []; List editTotalAmountControllers = []; - List _selectedProductIds = []; - List _selectedValues = []; + final List _selectedProductIds = []; + final List _selectedValues = []; bool _submitLoading = false; String? qtyError; String? priceError; String? productError; - bool get editProductDetailsClicked => _editProductDetailsClicked; bool get editContactDetailsClicked => _editContactDetailsClicked; - bool get followupDetailsClicked => _followupDetailsClicked; bool get appointmentDetailsClicked => _appointmentDetailsClicked; bool get quotationDetailsClicked => _quotationDetailsClicked; @@ -183,26 +181,27 @@ class Editproductlistprovider extends ChangeNotifier { bool get submitLoading => _submitLoading; - set editProductDetailsClicked(bool value){ + set editProductDetailsClicked(bool value) { _editProductDetailsClicked = value; notifyListeners(); } - set editContactDetailsClicked(bool value){ + + set editContactDetailsClicked(bool value) { _editContactDetailsClicked = value; notifyListeners(); } - - - set followupDetailsClicked(bool value){ + set followupDetailsClicked(bool value) { _followupDetailsClicked = value; notifyListeners(); } - set appointmentDetailsClicked(bool value){ + + set appointmentDetailsClicked(bool value) { _appointmentDetailsClicked = value; notifyListeners(); } - set quotationDetailsClicked(bool value){ + + set quotationDetailsClicked(bool value) { _quotationDetailsClicked = value; notifyListeners(); } @@ -334,19 +333,17 @@ class Editproductlistprovider extends ChangeNotifier { leadID, ); - if (data != null){ - if(data.sessionExists==1){ - if( data.error == "0") { + if (data != null) { + if (data.sessionExists == 1) { + if (data.error == "0") { _leadProductsList = data.leadProducts ?? []; _productsList = data.products ?? []; notifyListeners(); } - }else{ + } else { sessionDoesNotExist(context); } - } - } catch (e, s) { print("Error: $e, Stack: $s"); } @@ -366,7 +363,7 @@ class Editproductlistprovider extends ChangeNotifier { if (data != null && data.error == "0") { _selectedProductsDeatilsData = data.productsData!; - addEditProductPriceController.text= data.productsData!.price!; + addEditProductPriceController.text = data.productsData!.price!; notifyListeners(); } } catch (e, s) { @@ -374,9 +371,6 @@ class Editproductlistprovider extends ChangeNotifier { } } - - - Future crmLeadDetailsEditProductsSubmitAPIFunction( BuildContext context, products, @@ -402,14 +396,14 @@ class Editproductlistprovider extends ChangeNotifier { Future crmLeadDetailsAddEditProductsSubmitAPIFunction( BuildContext context, - mode, + mode, String leadID, type, leadProductId, productId, ) async { try { - if(!validateform(context)){ + if (!validateform(context)) { return; } _submitLoading = true; @@ -432,7 +426,7 @@ class Editproductlistprovider extends ChangeNotifier { Navigator.pop(context, true); prov2.crmLeadDetailsAPIFunction(context, leadID, mode); notifyListeners(); - }else{ + } else { _submitLoading = false; notifyListeners(); } @@ -443,16 +437,16 @@ class Editproductlistprovider extends ChangeNotifier { } } - bool validateform(context){ + bool validateform(context) { bool isValid = true; qtyError = null; priceError = null; productError = null; - if(addEditQuantityController.text.trim().isEmpty){ + if (addEditQuantityController.text.trim().isEmpty) { qtyError = "Please Enter Quantity"; - isValid = false; + isValid = false; } - if(addEditTotalAmountController.text.trim().isEmpty){ + if (addEditTotalAmountController.text.trim().isEmpty) { priceError = "Please Enter Price"; isValid = false; } @@ -497,8 +491,9 @@ class Editproductlistprovider extends ChangeNotifier { notifyListeners(); } - void checkDropdownReset(){ - if(!_productsList.contains(_selectedProducts)&&_selectedProducts!=null){ + void checkDropdownReset() { + if (!_productsList.contains(_selectedProducts) && + _selectedProducts != null) { _selectedAddEditProductId = null; _selectedAddEditProductName = null; } diff --git a/lib/Notifiers/crmProvider/followUpUpdateProvider.dart b/lib/Notifiers/crmProvider/followUpUpdateProvider.dart index 4ff5a7b..376ca65 100644 --- a/lib/Notifiers/crmProvider/followUpUpdateProvider.dart +++ b/lib/Notifiers/crmProvider/followUpUpdateProvider.dart @@ -68,7 +68,7 @@ class followUpUpdateProvider extends ChangeNotifier { String? get selectedCompetitor => _selectedCompetitor; - set submitLoading(bool value){ + set submitLoading(bool value) { _submitLoading = value; notifyListeners(); } @@ -146,9 +146,9 @@ class followUpUpdateProvider extends ChangeNotifier { desiredAccuracy: geo_location.LocationAccuracy.high, ); currentLocationLatLng = LatLng(position.latitude, position.longitude); - print("Current Loc: ${currentLocationLatLng}"); + print("Current Loc: $currentLocationLatLng"); latlongs = '${position.latitude},${position.longitude}'; - print("latlongs : ${latlongs}"); + print("latlongs : $latlongs"); notifyListeners(); } catch (e) { print("Error getting current location: $e"); @@ -159,18 +159,17 @@ class followUpUpdateProvider extends ChangeNotifier { BuildContext context, fromScreen, nextAppointmentStatus, - orderStatus, - leadID, - followupType, - competitor, - leadStatus, - appointmentType, - sms, - [mode] - ) async { + orderStatus, + leadID, + followupType, + competitor, + leadStatus, + appointmentType, + sms, [ + mode, + ]) async { try { - - if(!valid()){ + if (!valid()) { return; } _submitLoading = true; @@ -185,7 +184,7 @@ class followUpUpdateProvider extends ChangeNotifier { leadID, followUpFeedbackController.text, followupType, - _selectedTime.hour.toString() + ":" + _selectedTime.minute.toString(), + "${_selectedTime.hour}:${_selectedTime.minute}", latlongs, competitor, reasonController.text, @@ -198,24 +197,27 @@ class followUpUpdateProvider extends ChangeNotifier { if (data != null && data.error == "0") { _submitLoading = false; resetForm(); - if(fromScreen=="Pending Tasks"){ + if (fromScreen == "Pending Tasks") { Navigator.pushAndRemoveUntil( context, MaterialPageRoute( - builder: (context) => LeadDetailsByMode(mode: "executive", pageTitleName: "Lead Details", leadId: leadID??"-",), - settings: RouteSettings( - name: "LeadDetailsByMode" - ) + builder: + (context) => LeadDetailsByMode( + mode: "executive", + pageTitleName: "Lead Details", + leadId: leadID ?? "-", + ), + settings: RouteSettings(name: "LeadDetailsByMode"), ), - (Route route) { + (Route route) { return route.settings.name == 'CrmdashboardScreen'; }, ); - }else{ + } else { Navigator.pop(context); } - if(mode.isNotEmpty){ + if (mode.isNotEmpty) { prov2.crmLeadDetailsAPIFunction(context, leadID, mode); } @@ -231,8 +233,7 @@ class followUpUpdateProvider extends ChangeNotifier { } } - - bool valid(){ + bool valid() { followupError = null; followupFeedbackError = null; leadStatusError = null; @@ -244,60 +245,60 @@ class followUpUpdateProvider extends ChangeNotifier { competitorError = null; reasonError = null; bool isValid = true; - if(_selectedFollowupType==null||_selectedFollowupType==""){ + if (_selectedFollowupType == null || _selectedFollowupType == "") { followupError = "Please select Followup Type"; isValid = false; } - if(followUpFeedbackController.text.trim().isEmpty){ + if (followUpFeedbackController.text.trim().isEmpty) { followupFeedbackError = "Please enter Feedback"; isValid = false; } - if(_selectedLeadStatus==null||_selectedLeadStatus==""){ + if (_selectedLeadStatus == null || _selectedLeadStatus == "") { leadStatusError = "Please Select Lead Status"; isValid = false; } - if(_nextAppointmentStatus==null||_nextAppointmentStatus==""){ + if (_nextAppointmentStatus == null || _nextAppointmentStatus == "") { appStatusError = "Please select a value"; isValid = false; } - if(nextAppointmentStatus=="Next Appointment"){ - if(nextAppointmentDateController.text.trim().isEmpty){ + if (nextAppointmentStatus == "Next Appointment") { + if (nextAppointmentDateController.text.trim().isEmpty) { nextAppDateError = "Please Enter Date"; isValid = false; } - if(_selectNextAppointmentType==null||_selectNextAppointmentType==""){ + if (_selectNextAppointmentType == null || + _selectNextAppointmentType == "") { nextAppType = "Please select Appointment Type"; isValid = false; } - - if(noteController.text.trim().isEmpty){ + if (noteController.text.trim().isEmpty) { noteError = "Enter Note"; isValid = false; } - }else if(nextAppointmentStatus=="Update Order Status"){ - if(_selectOrderStatus==null||_selectOrderStatus==""){ + } else if (nextAppointmentStatus == "Update Order Status") { + if (_selectOrderStatus == null || _selectOrderStatus == "") { orderStatusError = "Please Select Order Status"; isValid = false; } - if(selectOrderStatus=="Order Lost"){ - if(_selectedCompetitor==null||_selectedCompetitor==""){ + if (selectOrderStatus == "Order Lost") { + if (_selectedCompetitor == null || _selectedCompetitor == "") { competitorError = "Please Select Competitor"; isValid = false; } - }else if(selectOrderStatus=="No Requirement"){ - if(reasonController.text.trim().isEmpty){ + } else if (selectOrderStatus == "No Requirement") { + if (reasonController.text.trim().isEmpty) { reasonError = "Please Enter reason"; isValid = false; } } - } _submitLoading = false; notifyListeners(); return isValid; } + void setDate(DateTime newDate) { _date = newDate; // _formattedDate = DateFormat('yyyy-MM-dd').format(newDate); @@ -314,8 +315,7 @@ class followUpUpdateProvider extends ChangeNotifier { initialTime: _selectedTime, ); if (picked != null && picked != _selectedTime) _selectedTime = picked; - _formattedTime = - _selectedTime.hour.toString() + ":" + _selectedTime.minute.toString(); + _formattedTime = "${_selectedTime.hour}:${_selectedTime.minute}"; notifyListeners(); } @@ -377,7 +377,7 @@ class followUpUpdateProvider extends ChangeNotifier { ), ), onPressed: () { - setDate(_date ?? DateTime.now() ); + setDate(_date ?? DateTime.now()); Navigator.pop(context); }, ), @@ -390,7 +390,11 @@ class followUpUpdateProvider extends ChangeNotifier { flex: 4, child: CupertinoDatePicker( initialDateTime: _date ?? DateTime.now(), - minimumDate: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), + minimumDate: DateTime( + DateTime.now().year, + DateTime.now().month, + DateTime.now().day, + ), dateOrder: DatePickerDateOrder.dmy, mode: CupertinoDatePickerMode.date, use24hFormat: true, @@ -408,7 +412,6 @@ class followUpUpdateProvider extends ChangeNotifier { } onFollowUpChanged(value) { - followupFeedbackError = null; notifyListeners(); } @@ -423,7 +426,7 @@ class followUpUpdateProvider extends ChangeNotifier { notifyListeners(); } - void resetForm(){ + void resetForm() { nextAppointmentDateController.clear(); _formattedDateToSend = null; _formattedDate = null; diff --git a/lib/Notifiers/financeProvider/DashboardProvider.dart b/lib/Notifiers/financeProvider/DashboardProvider.dart index f2a7d53..7838481 100644 --- a/lib/Notifiers/financeProvider/DashboardProvider.dart +++ b/lib/Notifiers/financeProvider/DashboardProvider.dart @@ -4,8 +4,7 @@ import 'package:generp/Notifiers/HomeScreenNotifier.dart'; import 'package:generp/services/api_calling.dart'; import 'package:provider/provider.dart'; -class Dashboardprovider extends ChangeNotifier{ - +class Dashboardprovider extends ChangeNotifier { List _accessiblePagesList = []; List _accessiblePagesList2 = []; @@ -13,36 +12,34 @@ class Dashboardprovider extends ChangeNotifier{ List get accessiblePagesList2 => _accessiblePagesList2; Future DashboardPagesAPIFunction(context) async { - try{ - var provider = Provider.of(context,listen: false); - final data = await ApiCalling.financeDashboardPagesAPI(provider.empId, provider.session); - if(data!=null){ - if(data.error=="0"){ + try { + var provider = Provider.of(context, listen: false); + final data = await ApiCalling.financeDashboardPagesAPI( + provider.empId, + provider.session, + ); + if (data != null) { + if (data.error == "0") { _accessiblePagesList = data.pagesAccessible!; notifyListeners(); - }else{ - - } + } else {} } - }catch(e,s){ - - } + } catch (e) {} } Future addFormfinanceFormAccessPagesAPIFunction(context) async { - try{ - var provider = Provider.of(context,listen: false); - final data = await ApiCalling.addFormfinanceFormAccessPagesAPI(provider.empId, provider.session); - if(data!=null){ - if(data.error=="0"){ + try { + var provider = Provider.of(context, listen: false); + final data = await ApiCalling.addFormfinanceFormAccessPagesAPI( + provider.empId, + provider.session, + ); + if (data != null) { + if (data.error == "0") { _accessiblePagesList2 = data.pagesAccessible!; notifyListeners(); - }else{ - - } + } else {} } - }catch(e,s){ - - } + } catch (e) {} } -} \ No newline at end of file +} diff --git a/lib/Notifiers/financeProvider/RequesitionLidtDetailsProvider.dart b/lib/Notifiers/financeProvider/RequesitionLidtDetailsProvider.dart index 10cb82c..a1b327e 100644 --- a/lib/Notifiers/financeProvider/RequesitionLidtDetailsProvider.dart +++ b/lib/Notifiers/financeProvider/RequesitionLidtDetailsProvider.dart @@ -14,7 +14,6 @@ import 'package:provider/provider.dart'; import 'approveRejectPaymentRequestResponse.dart'; class Requesitionlidtdetailsprovider extends ChangeNotifier { - bool _showMoreDetails = false; final numberFormat = NumberFormat.decimalPattern(); TextEditingController requestedAmount = TextEditingController(); @@ -34,15 +33,16 @@ class Requesitionlidtdetailsprovider extends ChangeNotifier { TextEditingController bankIfscCode = TextEditingController(); TextEditingController bankHolderName = TextEditingController(); TextEditingController paymentAccountSearchController = - TextEditingController(); - + TextEditingController(); - TextEditingController editPaymentRequestedAmountController = TextEditingController(); - TextEditingController editPaymentRequestedEditableAmountController = TextEditingController(); + TextEditingController editPaymentRequestedAmountController = + TextEditingController(); + TextEditingController editPaymentRequestedEditableAmountController = + TextEditingController(); bool _editPaymentProcessLoading = false; String? editableAmountError; -String? proposedAmountError; + String? proposedAmountError; PaymentDetails _paymentDetails = PaymentDetails(); RequestDetails _requestDetails = RequestDetails(); PaymentRequestDetails _paymentRequestDetails = PaymentRequestDetails(); @@ -76,7 +76,7 @@ String? proposedAmountError; File? get imageFilePath => _image; - set editPaymentProcessLoading(bool value){ + set editPaymentProcessLoading(bool value) { _editPaymentProcessLoading = value; notifyListeners(); } @@ -96,7 +96,7 @@ String? proposedAmountError; notifyListeners(); } - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } @@ -129,7 +129,7 @@ String? proposedAmountError; set selectedPaymentAccounts(PaymentAccounts? value) { _selectedPaymentAccounts = value; _selectedValue = value!.name!; - _selectedID = value!.id; + _selectedID = value.id; selectpaymentAccountError = null; notifyListeners(); } @@ -154,7 +154,7 @@ String? proposedAmountError; debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; FileError = null; notifyListeners(); @@ -176,7 +176,7 @@ String? proposedAmountError; debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; FileError = null; notifyListeners(); @@ -186,13 +186,13 @@ String? proposedAmountError; } } - Future paymentRequesitionDetails(context, payment_request_id) async { + Future paymentRequesitionDetails(context, paymentRequestId) async { try { var provider = Provider.of(context, listen: false); final data = await ApiCalling.paymentRequestionDetailsAPI( provider.empId, provider.session, - payment_request_id, + paymentRequestId, ); if (data != null) { if (data.error == "0") { @@ -216,64 +216,64 @@ String? proposedAmountError; ]; _paymentDetails = data.paymentDetails ?? - PaymentDetails( - accountId: "-", - accountName: "-", - amount: "-", - attachmentDirFilePath: "-", - attachmentViewFileName: "-", - bankAccountHolderName: "-", - bankAccountNumber: "-", - bankBranchName: "-", - bankIfscCode: "-", - bankName: "-", - bankUpiId: "-", - createdDatetime: "-", - createdEmployeeId: "-", - description: "-", - id: "-", - isExists: "-", - mode: "-", - paymentAccountId: "-", - paymentAccountName: "-", - paymentDate: "-", - paymentEmployeeName: "-", - paymentModeId: "-", - paymentReferenceNumber: "-", - paymentRemarks: "-", - refId: "-", - refType: "-", - updatedDatetime: "-", - ); + PaymentDetails( + accountId: "-", + accountName: "-", + amount: "-", + attachmentDirFilePath: "-", + attachmentViewFileName: "-", + bankAccountHolderName: "-", + bankAccountNumber: "-", + bankBranchName: "-", + bankIfscCode: "-", + bankName: "-", + bankUpiId: "-", + createdDatetime: "-", + createdEmployeeId: "-", + description: "-", + id: "-", + isExists: "-", + mode: "-", + paymentAccountId: "-", + paymentAccountName: "-", + paymentDate: "-", + paymentEmployeeName: "-", + paymentModeId: "-", + paymentReferenceNumber: "-", + paymentRemarks: "-", + refId: "-", + refType: "-", + updatedDatetime: "-", + ); _requestDetails = data.requestDetails ?? - RequestDetails( - updatedDatetime: "-", - id: "-", - description: "-", - createdDatetime: "-", - attachmentViewFileName: "-", - attachmentDirFilePath: "-", - amount: "-", - accountName: "-", - accountId: "-", - branch: "-", - createdEmployee: "-", - date: "-", - isProcessedPaymentRequest: "-", - level1ApprovalRemarks: "-", - level1Employee: "-", - level2ApprovalRemarks: "-", - level2Employee: "-", - proposedAccount: "-", - proposedAccountId: "-", - requestedAmount: "-", - requestingPurpose: "-", - requestMode: "-", - status: "-", - transDis: "-", - ); + RequestDetails( + updatedDatetime: "-", + id: "-", + description: "-", + createdDatetime: "-", + attachmentViewFileName: "-", + attachmentDirFilePath: "-", + amount: "-", + accountName: "-", + accountId: "-", + branch: "-", + createdEmployee: "-", + date: "-", + isProcessedPaymentRequest: "-", + level1ApprovalRemarks: "-", + level1Employee: "-", + level2ApprovalRemarks: "-", + level2Employee: "-", + proposedAccount: "-", + proposedAccountId: "-", + requestedAmount: "-", + requestingPurpose: "-", + requestMode: "-", + status: "-", + transDis: "-", + ); _subHeadings = [ _requestDetails.accountName ?? "-", @@ -299,7 +299,7 @@ String? proposedAmountError; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } preValues() { @@ -323,14 +323,16 @@ String? proposedAmountError; notifyListeners(); } - Future approveRejectPaymentRequestAPIFunction(context, - payment_request_id,) async { + Future approveRejectPaymentRequestAPIFunction( + context, + paymentRequestId, + ) async { try { var provider = Provider.of(context, listen: false); final data = await ApiCalling.approveRejectPaymentRequestAPI( provider.empId, provider.session, - payment_request_id, + paymentRequestId, ); if (data != null) { if (data.error == "0") { @@ -340,12 +342,9 @@ String? proposedAmountError; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } - - - String? remarksError; String? ApprovedAmountError; String? selectpaymentAccountError; @@ -353,17 +352,19 @@ String? proposedAmountError; bool get submitClicked => _submitClicked; - set submitClicked(bool value){ + set submitClicked(bool value) { _submitClicked = value; notifyListeners(); } - Future paymentrequisitionRejectSubmitAPIFunction(context, - mode, - payment_request_id, - approve_remarks,) async { + Future paymentrequisitionRejectSubmitAPIFunction( + context, + mode, + paymentRequestId, + approveRemarks, + ) async { try { - if(approve_remarks.toString().trim().isEmpty) { + if (approveRemarks.toString().trim().isEmpty) { remarksError = "Please Enter Remarks"; notifyListeners(); // toast(context,"Enter Remarks"); @@ -374,30 +375,34 @@ String? proposedAmountError; provider.empId, provider.session, mode, - payment_request_id, - approve_remarks, + paymentRequestId, + approveRemarks, ); if (data != null) { if (data.error == "0") { - paymentRequesitionDetails(context, payment_request_id); + paymentRequesitionDetails(context, paymentRequestId); resetAll(); toast(context, data.message); Navigator.pop(context); } } - } catch (e, s) {} + } catch (e) {} } - Future paymentrequisitionApproveSubmitAPIFunction(context, - mode, - payment_request_id, - approved_amount, - approve_remarks, - proposed_payment_account_id,) async { + Future paymentrequisitionApproveSubmitAPIFunction( + context, + mode, + paymentRequestId, + approvedAmount, + approveRemarks, + proposedPaymentAccountId, + ) async { try { - if(!validateApproval(approved_amount, - approve_remarks, - proposed_payment_account_id,)){ + if (!validateApproval( + approvedAmount, + approveRemarks, + proposedPaymentAccountId, + )) { return; } @@ -406,42 +411,46 @@ String? proposedAmountError; provider.empId, provider.session, mode, - payment_request_id, - approved_amount, - approve_remarks, - proposed_payment_account_id, + paymentRequestId, + approvedAmount, + approveRemarks, + proposedPaymentAccountId, ); if (data != null) { if (data.error == "0") { - paymentRequesitionDetails(context, payment_request_id); + paymentRequesitionDetails(context, paymentRequestId); resetAll(); toast(context, data.message); - Navigator.pop(context,true); + Navigator.pop(context, true); notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } - editPrevalues(){ - editPaymentRequestedAmountController.text = _requestDetails.requestedAmount ?? "-"; - editPaymentRequestedEditableAmountController.text = _requestDetails.requestedAmount ?? "-"; + editPrevalues() { + editPaymentRequestedAmountController.text = + _requestDetails.requestedAmount ?? "-"; + editPaymentRequestedEditableAmountController.text = + _requestDetails.requestedAmount ?? "-"; notifyListeners(); } - onChangeEditableAmount(value,context){ - - + onChangeEditableAmount(value, context) { var provider = Provider.of(context, listen: false); - if(provider.empId=="5" || provider.empId=="130" || provider.empId=="131"||provider.empId =="6"){ - editableAmountError = - ""; - }else{ + if (provider.empId == "5" || + provider.empId == "130" || + provider.empId == "131" || + provider.empId == "6") { + editableAmountError = ""; + } else { if (numberFormat.parse(editPaymentRequestedAmountController.text) < - numberFormat.parse(editPaymentRequestedEditableAmountController.text)) { + numberFormat.parse( + editPaymentRequestedEditableAmountController.text, + )) { editableAmountError = - "Approved Amount should not be greater than amount"; + "Approved Amount should not be greater than amount"; } else { editableAmountError = null; } @@ -450,23 +459,27 @@ String? proposedAmountError; notifyListeners(); } - bool validateEditprocessPayment(context){ + bool validateEditprocessPayment(context) { bool isValid = true; editableAmountError = null; var provider = Provider.of(context, listen: false); - if(editPaymentRequestedEditableAmountController.text.isNotEmpty){ - if(provider.empId=="5" || provider.empId=="130" || provider.empId=="131" ||provider.empId =="6"){ + if (editPaymentRequestedEditableAmountController.text.isNotEmpty) { + if (provider.empId == "5" || + provider.empId == "130" || + provider.empId == "131" || + provider.empId == "6") { editableAmountError = null; - }else{ + } else { if (numberFormat.parse(editPaymentRequestedAmountController.text) < - numberFormat.parse(editPaymentRequestedEditableAmountController.text)) { + numberFormat.parse( + editPaymentRequestedEditableAmountController.text, + )) { editableAmountError = - "Approved Amount should not be greater than amount"; + "Approved Amount should not be greater than amount"; isValid = false; } else { editableAmountError = null; - } } } @@ -476,108 +489,113 @@ String? proposedAmountError; return isValid; } - Future editProcessedPaymentAmountAPIFunction(context, - payment_request_id,approval_amount) async { + Future editProcessedPaymentAmountAPIFunction( + context, + paymentRequestId, + approvalAmount, + ) async { try { _editPaymentProcessLoading = true; notifyListeners(); - if(!validateEditprocessPayment(context)){ + if (!validateEditprocessPayment(context)) { return; } var provider = Provider.of(context, listen: false); final data = await ApiCalling.editProcessedRequestAmountAPI( - provider.empId, - provider.session, - payment_request_id, - approval_amount + provider.empId, + provider.session, + paymentRequestId, + approvalAmount, ); if (data != null) { if (data.error == "0") { _editPaymentProcessLoading = false; - paymentRequesitionDetails(context, payment_request_id); + paymentRequesitionDetails(context, paymentRequestId); resetAll(); toast(context, data.message); - Navigator.pop(context,true); + Navigator.pop(context, true); notifyListeners(); - }else{ + } else { _editPaymentProcessLoading = false; notifyListeners(); } - }else{ + } else { _editPaymentProcessLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _editPaymentProcessLoading = false; notifyListeners(); } } - bool validateApproval(approved_amount, - approve_remarks, - proposed_payment_account_id,){ - + bool validateApproval( + approvedAmount, + approveRemarks, + proposedPaymentAccountId, + ) { remarksError = null; ApprovedAmountError = null; selectpaymentAccountError = null; bool isValid = true; - if(approved_amount.toString().trim().isEmpty){ + if (approvedAmount.toString().trim().isEmpty) { ApprovedAmountError = "Enter Amount"; - isValid = false; + isValid = false; } - if(approve_remarks.toString().trim().isEmpty) { + if (approveRemarks.toString().trim().isEmpty) { remarksError = "Please Enter Remarks"; isValid = false; } final numberFormat = NumberFormat.decimalPattern(); - if(numberFormat.parse(approvedAmount.text) > numberFormat.parse(requestedAmount.text)){ - ApprovedAmountError = "Approved Amount should not be greater than requested amount"; + if (numberFormat.parse(approvedAmount.text) > + numberFormat.parse(requestedAmount.text)) { + ApprovedAmountError = + "Approved Amount should not be greater than requested amount"; isValid = false; } if (_selectedPaymentAccounts == null || _selectedID.isEmpty) { selectpaymentAccountError = "Please select an account"; isValid = false; - } _submitClicked = false; notifyListeners(); return isValid; } - checkApprovalDropDown(){ - - } - - Future paymentrequisitionProcessSubmitAPIFunction(context, - mode, - reference_num, - payment_amount, - payment_request_id, - payment_account_id, - processing_remarks, - attachment,) async { + checkApprovalDropDown() {} + + Future paymentrequisitionProcessSubmitAPIFunction( + context, + mode, + referenceNum, + paymentAmount, + paymentRequestId, + paymentAccountId, + processingRemarks, + attachment, + ) async { try { var provider = Provider.of(context, listen: false); final data = await ApiCalling.processApproveRejectPaymentRequestSubmitAPI( provider.empId, provider.session, mode, - reference_num, - payment_amount, - payment_request_id, - payment_account_id, - processing_remarks, + referenceNum, + paymentAmount, + paymentRequestId, + paymentAccountId, + processingRemarks, attachment, ); if (data != null) { if (data.error == "0") { - paymentRequesitionDetails(context, payment_request_id); + paymentRequesitionDetails(context, paymentRequestId); resetAll(); toast(context, data.message); Navigator.pop(context); } } - } catch (e, s) {} + } catch (e) {} } resetAll() { @@ -612,16 +630,16 @@ String? proposedAmountError; selectpaymentAccountError = null; notifyListeners(); - } - onChangeApprov(value){ + onChangeApprov(value) { final numberFormat = NumberFormat.decimalPattern(); - if(numberFormat.parse(approvedAmount.text) > numberFormat.parse(requestedAmount.text)){ - ApprovedAmountError = "Approved Amount should not be greater than requested amount"; - }else{ + if (numberFormat.parse(approvedAmount.text) > + numberFormat.parse(requestedAmount.text)) { + ApprovedAmountError = + "Approved Amount should not be greater than requested amount"; + } else { ApprovedAmountError = null; - } notifyListeners(); } @@ -631,7 +649,7 @@ String? proposedAmountError; _selectedPaymentAccounts != null) { _selectedPaymentAccounts = null; _selectedID = null; - _selectedValue =""; + _selectedValue = ""; } notifyListeners(); } diff --git a/lib/Notifiers/financeProvider/RequestionListProvider.dart b/lib/Notifiers/financeProvider/RequestionListProvider.dart index cfd18d5..31b1f45 100644 --- a/lib/Notifiers/financeProvider/RequestionListProvider.dart +++ b/lib/Notifiers/financeProvider/RequestionListProvider.dart @@ -122,7 +122,7 @@ class Requestionlistprovider extends ChangeNotifier { set selectedApprovalEmployee(Employees? value) { _selectedApprovalEmployee = value; _selectedApprovalEmployeeID = value!.id!; - _selectedApprovalEmployeeValue = value!.name!; + _selectedApprovalEmployeeValue = value.name!; notifyListeners(); } @@ -154,7 +154,7 @@ class Requestionlistprovider extends ChangeNotifier { set selectDirectAccounts(DirectAccounts? value) { _selectedDirectAccounts = value; _directAccountID = value!.id!; - _directAccountValue = value!.name!; + _directAccountValue = value.name!; selectDirectAccountError = null; notifyListeners(); } @@ -162,7 +162,7 @@ class Requestionlistprovider extends ChangeNotifier { set selectDirectPaymentAccounts(DirectPaymentAccounts? value) { _selectDirectPaymentAccounts = value; _directPaymentAccountsID = value!.id!; - _directPaymentAccountsValue = value!.name!; + _directPaymentAccountsValue = value.name!; selectDirectPaymentAccountError = null; notifyListeners(); } @@ -170,7 +170,7 @@ class Requestionlistprovider extends ChangeNotifier { set selectDirectPaymentModes(DirectPaymentModes? value) { _selectDirectPaymentModes = value; _directPaymentModesID = value!.id!; - _directPaymentModesValues = value!.name!; + _directPaymentModesValues = value.name!; selectDirectPaymentError = null; notifyListeners(); } @@ -303,7 +303,7 @@ class Requestionlistprovider extends ChangeNotifier { set selectedAccount(Accounts? value) { _selectedAccounts = value; _accountId = value!.id!; - _accountValue = value!.name!; + _accountValue = value.name!; selectAccountError = null; notifyListeners(); @@ -312,7 +312,7 @@ class Requestionlistprovider extends ChangeNotifier { set selectedPayment(PaymentModes? value) { _selectedPayment = value; _paymentModeId = value!.id!; - _paymentModeValue = value!.name!; + _paymentModeValue = value.name!; selectPaymentError = null; notifyListeners(); @@ -360,7 +360,7 @@ class Requestionlistprovider extends ChangeNotifier { debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; FileError = null; notifyListeners(); @@ -382,7 +382,7 @@ class Requestionlistprovider extends ChangeNotifier { debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; FileError = null; notifyListeners(); @@ -440,12 +440,12 @@ class Requestionlistprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } Future paymentRequestionBankDetailsAPIFunction( context, - account_id, + accountId, ) async { try { var homeProvider = Provider.of( @@ -455,7 +455,7 @@ class Requestionlistprovider extends ChangeNotifier { final data = await ApiCalling.paymentRequestionBankDetailsAPI( homeProvider.empId, homeProvider.session, - account_id, + accountId, ); notifyListeners(); @@ -474,7 +474,7 @@ class Requestionlistprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } Future addPaymentRequestionSubmitAPI( @@ -530,7 +530,7 @@ class Requestionlistprovider extends ChangeNotifier { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -568,15 +568,11 @@ class Requestionlistprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } - Future addDirectPaymentRequestionSubmitAPI( - context, - payment_date, - ) async { + Future addDirectPaymentRequestionSubmitAPI(context, paymentDate) async { try { - if (!validateDirectForm(context)) { return; } @@ -594,7 +590,7 @@ class Requestionlistprovider extends ChangeNotifier { descController.text, _directPaymentModesID, amountController.text, - payment_date, + paymentDate, paymentReferenceController.text, bankNameController.text, bankBranchController.text, @@ -619,7 +615,7 @@ class Requestionlistprovider extends ChangeNotifier { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -644,12 +640,12 @@ class Requestionlistprovider extends ChangeNotifier { } Future paymentRequestionListsAPIFunction( - BuildContext context, - String mode, - String from, - String to, { - bool append = false, - }) async { + BuildContext context, + String mode, + String from, + String to, { + bool append = false, + }) async { try { var homeProvider = Provider.of( context, @@ -675,14 +671,17 @@ class Requestionlistprovider extends ChangeNotifier { to, _pageNum.toString(), ); - debugPrint('empId: ${homeProvider.empId}, session: ${homeProvider.session}, pageNumber: $_pageNum'); + debugPrint( + 'empId: ${homeProvider.empId}, session: ${homeProvider.session}, pageNumber: $_pageNum', + ); if (data != null && data.error == "0") { if (append) { final existingIds = _requisitionList.map((e) => e.id).toSet(); - final newItems = data.requistionList! - .where((item) => !existingIds.contains(item.id)) - .toList(); + final newItems = + data.requistionList! + .where((item) => !existingIds.contains(item.id)) + .toList(); _requisitionList.addAll(newItems); } else { _requisitionList = data.requistionList ?? []; @@ -706,7 +705,6 @@ class Requestionlistprovider extends ChangeNotifier { } } - void showDatePickerDialog(BuildContext context) { showCupertinoModalPopup( context: context, @@ -750,7 +748,7 @@ class Requestionlistprovider extends ChangeNotifier { ), ), onPressed: () { - setDate(_date ?? DateTime.now() ); + setDate(_date ?? DateTime.now()); Navigator.pop(context); }, ), @@ -838,10 +836,8 @@ class Requestionlistprovider extends ChangeNotifier { if (await Permission.storage.request().isGranted || await Permission.manageExternalStorage.request().isGranted) { final dir = await getApplicationDocumentsDirectory(); - if (dir != null) { - print('Using Downloads directory: ${dir.path}'); - return dir.path; - } + print('Using Downloads directory: ${dir.path}'); + return dir.path; } } } catch (e) { @@ -1180,9 +1176,7 @@ class Requestionlistprovider extends ChangeNotifier { _submitClicked = false; } - if (["Cheque", "RTGS", "IMPS", "NEFT"].contains(_paymentModeValue)) { - if (bankNameController.text.trim().isEmpty) { bankNameError = "Please enter bank name"; isValid = false; @@ -1212,13 +1206,14 @@ class Requestionlistprovider extends ChangeNotifier { } if (_paymentModeValue == "UPI") { - if (bankUpiController.text.trim().isEmpty) { UPIError = "Please enter UPI ID"; isValid = false; _submitClicked = false; } - if(!RegExp(r"^[a-zA-Z0-9.-]{2,256}@[a-zA-Z][a-zA-Z]{2,64}$").hasMatch(bankUpiController.text)){ + if (!RegExp( + r"^[a-zA-Z0-9.-]{2,256}@[a-zA-Z][a-zA-Z]{2,64}$", + ).hasMatch(bankUpiController.text)) { UPIError = "Please enter UPI ID correctly."; isValid = false; _submitClicked = false; diff --git a/lib/Notifiers/financeProvider/approveRejectPaymentRequestResponse.dart b/lib/Notifiers/financeProvider/approveRejectPaymentRequestResponse.dart index ff5f53f..fee564f 100644 --- a/lib/Notifiers/financeProvider/approveRejectPaymentRequestResponse.dart +++ b/lib/Notifiers/financeProvider/approveRejectPaymentRequestResponse.dart @@ -5,27 +5,29 @@ class approveRejectPaymentRequestResponse { String? error; String? message; - approveRejectPaymentRequestResponse( - {this.paymentAccounts, - this.paymentRequestDetails, - this.paymentModes, - this.error, - this.message}); + approveRejectPaymentRequestResponse({ + this.paymentAccounts, + this.paymentRequestDetails, + this.paymentModes, + this.error, + this.message, + }); approveRejectPaymentRequestResponse.fromJson(Map json) { if (json['payment_accounts'] != null) { paymentAccounts = []; json['payment_accounts'].forEach((v) { - paymentAccounts!.add(new PaymentAccounts.fromJson(v)); + paymentAccounts!.add(PaymentAccounts.fromJson(v)); }); } - paymentRequestDetails = json['payment_request_details'] != null - ? new PaymentRequestDetails.fromJson(json['payment_request_details']) - : null; + paymentRequestDetails = + json['payment_request_details'] != null + ? PaymentRequestDetails.fromJson(json['payment_request_details']) + : null; if (json['payment_modes'] != null) { paymentModes = []; json['payment_modes'].forEach((v) { - paymentModes!.add(new PaymentModes.fromJson(v)); + paymentModes!.add(PaymentModes.fromJson(v)); }); } error = json['error']; @@ -33,20 +35,19 @@ class approveRejectPaymentRequestResponse { } Map toJson() { - final Map data = new Map(); - if (this.paymentAccounts != null) { + final Map data = {}; + if (paymentAccounts != null) { data['payment_accounts'] = - this.paymentAccounts!.map((v) => v.toJson()).toList(); + paymentAccounts!.map((v) => v.toJson()).toList(); } - if (this.paymentRequestDetails != null) { - data['payment_request_details'] = this.paymentRequestDetails!.toJson(); + if (paymentRequestDetails != null) { + data['payment_request_details'] = paymentRequestDetails!.toJson(); } - if (this.paymentModes != null) { - data['payment_modes'] = - this.paymentModes!.map((v) => v.toJson()).toList(); + if (paymentModes != null) { + data['payment_modes'] = paymentModes!.map((v) => v.toJson()).toList(); } - data['error'] = this.error; - data['message'] = this.message; + data['error'] = error; + data['message'] = message; return data; } } @@ -65,10 +66,10 @@ class PaymentAccounts { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; - data['account_balance'] = this.accountBalance; + final Map data = {}; + data['id'] = id; + data['name'] = name; + data['account_balance'] = accountBalance; return data; } } @@ -88,20 +89,21 @@ class PaymentRequestDetails { String? bankAccountNumber; String? bankUpiId; - PaymentRequestDetails( - {this.id, - this.accountId, - this.requestingPurpose, - this.description, - this.amount, - this.requestedAmount, - this.paymentRequestModeId, - this.bankName, - this.bankBranchName, - this.bankIfscCode, - this.bankAccountHolderName, - this.bankAccountNumber, - this.bankUpiId}); + PaymentRequestDetails({ + this.id, + this.accountId, + this.requestingPurpose, + this.description, + this.amount, + this.requestedAmount, + this.paymentRequestModeId, + this.bankName, + this.bankBranchName, + this.bankIfscCode, + this.bankAccountHolderName, + this.bankAccountNumber, + this.bankUpiId, + }); PaymentRequestDetails.fromJson(Map json) { id = json['id']; @@ -120,20 +122,20 @@ class PaymentRequestDetails { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['account_id'] = this.accountId; - data['requesting_purpose'] = this.requestingPurpose; - data['description'] = this.description; - data['amount'] = this.amount; - data['requested_amount'] = this.requestedAmount; - data['payment_request_mode_id'] = this.paymentRequestModeId; - data['bank_name'] = this.bankName; - data['bank_branch_name'] = this.bankBranchName; - data['bank_ifsc_code'] = this.bankIfscCode; - data['bank_account_holder_name'] = this.bankAccountHolderName; - data['bank_account_number'] = this.bankAccountNumber; - data['bank_upi_id'] = this.bankUpiId; + final Map data = {}; + data['id'] = id; + data['account_id'] = accountId; + data['requesting_purpose'] = requestingPurpose; + data['description'] = description; + data['amount'] = amount; + data['requested_amount'] = requestedAmount; + data['payment_request_mode_id'] = paymentRequestModeId; + data['bank_name'] = bankName; + data['bank_branch_name'] = bankBranchName; + data['bank_ifsc_code'] = bankIfscCode; + data['bank_account_holder_name'] = bankAccountHolderName; + data['bank_account_number'] = bankAccountNumber; + data['bank_upi_id'] = bankUpiId; return data; } } @@ -150,9 +152,9 @@ class PaymentModes { } Map toJson() { - final Map data = new Map(); - data['id'] = this.id; - data['name'] = this.name; + final Map data = {}; + data['id'] = id; + data['name'] = name; return data; } } diff --git a/lib/Notifiers/financeProvider/paymentReceiptsProvider.dart b/lib/Notifiers/financeProvider/paymentReceiptsProvider.dart index 0287ccb..c51fa07 100644 --- a/lib/Notifiers/financeProvider/paymentReceiptsProvider.dart +++ b/lib/Notifiers/financeProvider/paymentReceiptsProvider.dart @@ -29,7 +29,6 @@ import 'package:share_plus/share_plus.dart'; import 'package:printing/printing.dart'; class Paymentreceiptsprovider extends ChangeNotifier { - bool _showMoreDetails = false; List _receiptsList = []; ReceiptDetails _receiptDetails = ReceiptDetails(); @@ -63,9 +62,9 @@ class Paymentreceiptsprovider extends ChangeNotifier { DateTime? _date; String? _formattedDate; String? _formattedDateToSend; - List _accounts = []; - List _paymentModes = []; - List _requestingPurposes = []; + final List _accounts = []; + final List _paymentModes = []; + final List _requestingPurposes = []; List _receiptAccounts = []; @@ -114,14 +113,15 @@ class Paymentreceiptsprovider extends ChangeNotifier { // Date picker methods - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } + set selectreceiptAccounts(Accounts? value) { _selectedreceiptAccounts = value; _receiptAccountID = value!.id!; - _receiptAccountValue = value!.name!; + _receiptAccountValue = value.name!; selectAccountError = null; notifyListeners(); } @@ -129,7 +129,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { set selectreceiptPaymentAccounts(ReceiptAccounts? value) { _selectreceiptPaymentAccounts = value; _receiptPaymentAccountsID = value!.id!; - _receiptPaymentAccountsValue = value!.name!; + _receiptPaymentAccountsValue = value.name!; selectPaymentAccountError = null; notifyListeners(); } @@ -137,7 +137,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { set selectreceiptPaymentModes(PaymentModes? value) { _selectreceiptPaymentModes = value; _receiptPaymentModesID = value!.id!; - _receiptPaymentModesValues = value!.name!; + _receiptPaymentModesValues = value.name!; paymentModeError = null; notifyListeners(); } @@ -291,7 +291,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { set selectedPayment(PaymentModes? value) { _selectedPayment = value; _paymentModeId = value!.id!; - _paymentModeValue = value!.name!; + _paymentModeValue = value.name!; selectPaymentError = null; notifyListeners(); @@ -334,7 +334,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; FileError = null; notifyListeners(); @@ -356,7 +356,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; FileError = null; notifyListeners(); @@ -366,7 +366,6 @@ class Paymentreceiptsprovider extends ChangeNotifier { } } - bool _isLoadingMore = false; bool get isLoadingMore => _isLoadingMore; @@ -386,11 +385,11 @@ class Paymentreceiptsprovider extends ChangeNotifier { } Future paymentsListAPI( - BuildContext context, - String from, - String to, { - bool append = false, - }) async { + BuildContext context, + String from, + String to, { + bool append = false, + }) async { try { var prov = Provider.of(context, listen: false); @@ -410,7 +409,9 @@ class Paymentreceiptsprovider extends ChangeNotifier { to, _currentPage.toString(), ); - debugPrint('empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_currentPage'); + debugPrint( + 'empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_currentPage', + ); if (data != null && data.error == "0") { if (append) { @@ -488,7 +489,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future addReceiptPaymentRequestionViewAPI(context) async { @@ -523,15 +524,14 @@ class Paymentreceiptsprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } Future addReceiptPaymentRequestionSubmitAPI( context, - receipt_date, + receiptDate, ) async { try { - if (!validatereceiptForm(context)) { return; } @@ -550,7 +550,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { descController.text, _receiptPaymentModesID, amountController.text, - receipt_date, + receiptDate, paymentReferenceController.text, bankNameController.text, bankBranchController.text, @@ -575,7 +575,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -643,10 +643,8 @@ class Paymentreceiptsprovider extends ChangeNotifier { if (await Permission.storage.request().isGranted || await Permission.manageExternalStorage.request().isGranted) { final dir = await getApplicationDocumentsDirectory(); - if (dir != null) { - print('Using Downloads receiptory: ${dir.path}'); - return dir.path; - } + print('Using Downloads receiptory: ${dir.path}'); + return dir.path; } } } catch (e) { @@ -1013,7 +1011,6 @@ class Paymentreceiptsprovider extends ChangeNotifier { ), ), onPressed: () { - Navigator.pop(context); }, ), @@ -1026,7 +1023,7 @@ class Paymentreceiptsprovider extends ChangeNotifier { ), ), onPressed: () { - setDate(_date ?? DateTime.now() ); + setDate(_date ?? DateTime.now()); Navigator.pop(context); }, ), diff --git a/lib/Notifiers/financeProvider/paymentRequisitionPaymentsListProvider.dart b/lib/Notifiers/financeProvider/paymentRequisitionPaymentsListProvider.dart index e896811..414743f 100644 --- a/lib/Notifiers/financeProvider/paymentRequisitionPaymentsListProvider.dart +++ b/lib/Notifiers/financeProvider/paymentRequisitionPaymentsListProvider.dart @@ -18,8 +18,7 @@ import 'package:provider/provider.dart'; import '../../Utils/commonServices.dart'; -class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ - +class Paymentrequisitionpaymentslistprovider extends ChangeNotifier { bool _showMoreDetails = false; List _paymentsList = []; PaymentDetails _paymentDetails = PaymentDetails(); @@ -33,7 +32,7 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ bool get isLoading => _isLoading; bool get showMoreDetails => _showMoreDetails; - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } @@ -57,11 +56,11 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ } Future paymentsListAPI( - BuildContext context, - String from, - String to, { - bool append = false, - }) async { + BuildContext context, + String from, + String to, { + bool append = false, + }) async { try { var prov = Provider.of(context, listen: false); @@ -81,7 +80,9 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ to, _currentPage.toString(), // pass page number ); - debugPrint('empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_currentPage'); + debugPrint( + 'empId: ${prov.empId}, session: ${prov.session}, pageNumber: $_currentPage', + ); if (data != null && data.error == "0") { if (append) { @@ -113,24 +114,47 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ await paymentsListAPI(context, from, to, append: true); } - Future paymentsListDetailsAPI(context,paymentId) async { - try{ - var prov = Provider.of(context,listen: false); - final data = await ApiCalling.paymentRequisitionPaymentDetailsAPI(prov.empId, prov.session,paymentId); - if(data!=null){ - if(data.error=="0"){ - _paymentDetails = data.paymentDetails??PaymentDetails( - accountId: "-", - accountName: "-", - amount: "-", - attachmentDirFilePath: "-", - attachmentViewFileName: "-", - createdDatetime: "-", - description: "-", - id: "-", - updatedDatetime: "-", - refType: "-",refId: "-",paymentRemarks: "-",paymentReferenceNumber: "-",paymentModeId: "-",paymentEmployeeName: "-",paymentDate: "-",paymentAccountName: "-",paymentAccountId: "-",mode: "-",isExists: "-",createdEmployeeId: "-",bankUpiId: "-",bankName: "-",bankIfscCode:"-",bankBranchName: "-",bankAccountNumber: "-",bankAccountHolderName:"-" , - ); + Future paymentsListDetailsAPI(context, paymentId) async { + try { + var prov = Provider.of(context, listen: false); + final data = await ApiCalling.paymentRequisitionPaymentDetailsAPI( + prov.empId, + prov.session, + paymentId, + ); + if (data != null) { + if (data.error == "0") { + _paymentDetails = + data.paymentDetails ?? + PaymentDetails( + accountId: "-", + accountName: "-", + amount: "-", + attachmentDirFilePath: "-", + attachmentViewFileName: "-", + createdDatetime: "-", + description: "-", + id: "-", + updatedDatetime: "-", + refType: "-", + refId: "-", + paymentRemarks: "-", + paymentReferenceNumber: "-", + paymentModeId: "-", + paymentEmployeeName: "-", + paymentDate: "-", + paymentAccountName: "-", + paymentAccountId: "-", + mode: "-", + isExists: "-", + createdEmployeeId: "-", + bankUpiId: "-", + bankName: "-", + bankIfscCode: "-", + bankBranchName: "-", + bankAccountNumber: "-", + bankAccountHolderName: "-", + ); _headings = [ "From Account", "Payment Mode", @@ -146,31 +170,29 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ "Bank UPI ID", "Payment Reference Number", "Created Date Time", - "Updated Date Time" + "Updated Date Time", ]; _subHeadings = [ - _paymentDetails.paymentAccountName??"-", - _paymentDetails.mode??"-", - _paymentDetails.paymentEmployeeName??"-", - _paymentDetails.attachmentDirFilePath??"-", - _paymentDetails.paymentDate??"-", - _paymentDetails.paymentRemarks??"-", - _paymentDetails.bankName??"-", - _paymentDetails.bankBranchName??"-", - _paymentDetails.bankIfscCode??"-", - _paymentDetails.bankAccountHolderName??"-", - _paymentDetails.bankAccountNumber??"-", - _paymentDetails.bankUpiId??"-", - _paymentDetails.paymentReferenceNumber??"-", - _paymentDetails.createdDatetime??"-", - _paymentDetails.updatedDatetime??"-" + _paymentDetails.paymentAccountName ?? "-", + _paymentDetails.mode ?? "-", + _paymentDetails.paymentEmployeeName ?? "-", + _paymentDetails.attachmentDirFilePath ?? "-", + _paymentDetails.paymentDate ?? "-", + _paymentDetails.paymentRemarks ?? "-", + _paymentDetails.bankName ?? "-", + _paymentDetails.bankBranchName ?? "-", + _paymentDetails.bankIfscCode ?? "-", + _paymentDetails.bankAccountHolderName ?? "-", + _paymentDetails.bankAccountNumber ?? "-", + _paymentDetails.bankUpiId ?? "-", + _paymentDetails.paymentReferenceNumber ?? "-", + _paymentDetails.createdDatetime ?? "-", + _paymentDetails.updatedDatetime ?? "-", ]; notifyListeners(); } } - }catch(e,s){ - - } + } catch (e) {} } List> prepareExportData() { @@ -188,24 +210,23 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ ]; final rows = - paymentsList - .map( - (item) => - [ - item.id ?? '', - item.payAccount ?? '', - item.amount ?? '', - item.bankName??"", - item.bankBranchName ?? '', - item.bankAccountNumber ?? '', - item.description ?? '', - item.requestMode ?? '', - item.paymentReferenceNumber ?? '', - item.createdEmployee ?? '', - item.createdDatetime ?? '', - ], - ) - .toList(); + paymentsList + .map( + (item) => [ + item.id ?? '', + item.payAccount ?? '', + item.amount ?? '', + item.bankName ?? "", + item.bankBranchName ?? '', + item.bankAccountNumber ?? '', + item.description ?? '', + item.requestMode ?? '', + item.paymentReferenceNumber ?? '', + item.createdEmployee ?? '', + item.createdDatetime ?? '', + ], + ) + .toList(); return [headers, ...rows]; } @@ -233,17 +254,11 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ try { if (Platform.isAndroid) { // Request storage permission for Android - if (await Permission.storage - .request() - .isGranted || - await Permission.manageExternalStorage - .request() - .isGranted) { + if (await Permission.storage.request().isGranted || + await Permission.manageExternalStorage.request().isGranted) { final dir = await getApplicationDocumentsDirectory(); - if (dir != null) { - print('Using Downloads directory: ${dir.path}'); - return dir.path; - } + print('Using Downloads directory: ${dir.path}'); + return dir.path; } } } catch (e) { @@ -373,4 +388,4 @@ class Paymentrequisitionpaymentslistprovider extends ChangeNotifier{ _headings = []; _subHeadings = []; } -} \ No newline at end of file +} diff --git a/lib/Notifiers/hrmProvider/LeaveApplicationDetailsProvider.dart b/lib/Notifiers/hrmProvider/LeaveApplicationDetailsProvider.dart index c670b3b..1e87517 100644 --- a/lib/Notifiers/hrmProvider/LeaveApplicationDetailsProvider.dart +++ b/lib/Notifiers/hrmProvider/LeaveApplicationDetailsProvider.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -22,7 +21,10 @@ class LeaveApplicationDetailsProvider extends ChangeNotifier { String? get errorMessage => _errorMessage; /// Fetch leave application details - Future fetchLeaveApplicationDetails(BuildContext context, String leaveRequestId) async { + Future fetchLeaveApplicationDetails( + BuildContext context, + String leaveRequestId, + ) async { _isLoading = true; _errorMessage = null; _response = null; @@ -51,19 +53,22 @@ class LeaveApplicationDetailsProvider extends ChangeNotifier { } Future leaveRequestRejectApprove( - BuildContext context, { - required String mode, - required String type, - required String remarks, - required String id, - }) async { + BuildContext context, { + required String mode, + required String type, + required String remarks, + required String id, + }) async { _isSubmitting = true; _errorMessage = null; _StatusResponse = null; notifyListeners(); try { - final homeProvider = Provider.of(context, listen: false); + final homeProvider = Provider.of( + context, + listen: false, + ); final result = await ApiCalling.leaveRequestRejectApproveAPI( homeProvider.session, @@ -80,7 +85,6 @@ class LeaveApplicationDetailsProvider extends ChangeNotifier { if (result.error != null && result.error!.isNotEmpty) { _errorMessage = result.error; } else { - // Show success snack bar ScaffoldMessenger.of(context).showSnackBar( SnackBar( @@ -103,11 +107,10 @@ class LeaveApplicationDetailsProvider extends ChangeNotifier { notifyListeners(); } - /// Clear the current response data void clearData() { _response = null; _errorMessage = null; notifyListeners(); } -} \ No newline at end of file +} diff --git a/lib/Notifiers/hrmProvider/attendanceDetailsProvider.dart b/lib/Notifiers/hrmProvider/attendanceDetailsProvider.dart index 9e0686e..6e4d261 100644 --- a/lib/Notifiers/hrmProvider/attendanceDetailsProvider.dart +++ b/lib/Notifiers/hrmProvider/attendanceDetailsProvider.dart @@ -1,15 +1,11 @@ - -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:generp/Models/hrmModels/attendanceRequestDetailsResponse.dart'; import 'package:provider/provider.dart'; -import '../../Models/hrmModels/attendanceRequestListResponse.dart'; import '../../Models/ordersModels/commonResponse.dart'; import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; - class AttendanceDetailsProvider extends ChangeNotifier { attendanceRequestDetailsResponse? _response; bool _isLoading = false; @@ -24,7 +20,7 @@ class AttendanceDetailsProvider extends ChangeNotifier { bool get isLoading => _isLoading; String? get errorMessage => _errorMessage; - Future fetchAttendanceRequestDetail(context,String requestId) async { + Future fetchAttendanceRequestDetail(context, String requestId) async { _isLoading = true; _errorMessage = null; _response = null; @@ -32,7 +28,11 @@ class AttendanceDetailsProvider extends ChangeNotifier { try { final provider = Provider.of(context, listen: false); - final result = await ApiCalling.attendanceRequestDetailAPI(provider.empId, provider.session, requestId); + final result = await ApiCalling.attendanceRequestDetailAPI( + provider.empId, + provider.session, + requestId, + ); if (result != null) { _response = result; @@ -46,20 +46,24 @@ class AttendanceDetailsProvider extends ChangeNotifier { _isLoading = false; notifyListeners(); } + Future rejectApproveAttendanceRequest( - BuildContext context, { - required String mode, - required String type, - required String remarks, - required String id, - }) async { + BuildContext context, { + required String mode, + required String type, + required String remarks, + required String id, + }) async { _isSubmitting = true; _errorMessage = null; _RejectResponse = null; notifyListeners(); try { - final homeProvider = Provider.of(context, listen: false); + final homeProvider = Provider.of( + context, + listen: false, + ); print("############################+++++++++++++++++##########"); final result = await ApiCalling.attendanceRequestApproveRejectAPI( @@ -92,5 +96,4 @@ class AttendanceDetailsProvider extends ChangeNotifier { _isSubmitting = false; notifyListeners(); } - } diff --git a/lib/Notifiers/hrmProvider/attendanceListProvider.dart b/lib/Notifiers/hrmProvider/attendanceListProvider.dart index c6e4a8e..ddd0465 100644 --- a/lib/Notifiers/hrmProvider/attendanceListProvider.dart +++ b/lib/Notifiers/hrmProvider/attendanceListProvider.dart @@ -1,6 +1,5 @@ import 'dart:io'; import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; @@ -46,7 +45,12 @@ class Attendancelistprovider extends ChangeNotifier { DateTime? get selectedDate => _selectedDate; // Type options for filter - final List typeOptions = ["All", "Check In", "Check Out", "Check In/Out"]; + final List typeOptions = [ + "All", + "Check In", + "Check Out", + "Check In/Out", + ]; // Date range options for filter final List dateRangeOptions = [ @@ -66,14 +70,24 @@ class Attendancelistprovider extends ChangeNotifier { DateTime yesterday = today.subtract(const Duration(days: 1)); // normalize (remove time part) - DateTime normalizedSelected = DateTime(_selectedDate!.year, _selectedDate!.month, _selectedDate!.day); + DateTime normalizedSelected = DateTime( + _selectedDate!.year, + _selectedDate!.month, + _selectedDate!.day, + ); DateTime normalizedToday = DateTime(today.year, today.month, today.day); - DateTime normalizedYesterday = DateTime(yesterday.year, yesterday.month, yesterday.day); + DateTime normalizedYesterday = DateTime( + yesterday.year, + yesterday.month, + yesterday.day, + ); - return normalizedSelected == normalizedToday || normalizedSelected == normalizedYesterday; + return normalizedSelected == normalizedToday || + normalizedSelected == normalizedYesterday; } - String? validateManualAttendance({//its working or not + String? validateManualAttendance({ + //its working or not required String type, required String? checkInTime, required String? checkInLoc, @@ -123,13 +137,18 @@ class Attendancelistprovider extends ChangeNotifier { return null; // everything ok } + CommonResponse? _RejectResponse; CommonResponse? get RejectResponse => _RejectResponse; - /// Fetch attendance request list with filters - Future fetchAttendanceRequests(BuildContext context, mode, - {String? type, String? dateRange, DateTimeRange? customRange}) async { + Future fetchAttendanceRequests( + BuildContext context, + mode, { + String? type, + String? dateRange, + DateTimeRange? customRange, + }) async { _isLoading = true; _errorMessage = null; notifyListeners(); @@ -143,7 +162,10 @@ class Attendancelistprovider extends ChangeNotifier { if (customRange != null) _customDateRange = customRange; // Calculate date range based on selection - final dateParams = _getDateRangeParams(_selectedDateRange, _customDateRange); + final dateParams = _getDateRangeParams( + _selectedDateRange, + _customDateRange, + ); // Convert "All" type to empty string for API final apiType = _selectedType == "All" ? "" : _selectedType; @@ -154,10 +176,12 @@ class Attendancelistprovider extends ChangeNotifier { apiType, dateParams['from']!, dateParams['to']!, - mode + mode, ); - debugPrint('Fetching attendance from: ${dateParams['from']} to: ${dateParams['to']}'); + debugPrint( + 'Fetching attendance from: ${dateParams['from']} to: ${dateParams['to']}', + ); if (result != null) { _response = result; @@ -178,26 +202,29 @@ class Attendancelistprovider extends ChangeNotifier { /// --- Add Attendance Request --- Future addAttendanceRequest( - BuildContext context, { - required String process, - required String type, - required String loc, - required String checkDate, - String? checkInTime, - String? checkInLoc, - File? checkInProof, - String? checkOutTime, - String? checkOutLoc, - File? checkOutProof, - String? note, - }) async { + BuildContext context, { + required String process, + required String type, + required String loc, + required String checkDate, + String? checkInTime, + String? checkInLoc, + File? checkInProof, + String? checkOutTime, + String? checkOutLoc, + File? checkOutProof, + String? note, + }) async { _isSubmitting = true; _errorMessage = null; _addResponse = null; notifyListeners(); try { - final homeProvider = Provider.of(context, listen: false); + final homeProvider = Provider.of( + context, + listen: false, + ); final result = await ApiCalling.addAttendanceRequestAPI( sessionId: homeProvider.session, @@ -275,15 +302,14 @@ class Attendancelistprovider extends ChangeNotifier { notifyListeners(); } - /// Apply filters coming from bottom sheet void updateFiltersFromSheet( - mode, - BuildContext context, { - required String type, - required String selectedValue, - DateTimeRange? customRange, - }) { + mode, + BuildContext context, { + required String type, + required String selectedValue, + DateTimeRange? customRange, + }) { _selectedType = type; _selectedDateRange = selectedValue; _customDateRange = customRange; @@ -304,8 +330,12 @@ class Attendancelistprovider extends ChangeNotifier { } /// Set date range filter and refresh data - void setDateRangeFilter(BuildContext context, String dateRange, mode, - {DateTimeRange? customRange}) { + void setDateRangeFilter( + BuildContext context, + String dateRange, + mode, { + DateTimeRange? customRange, + }) { _selectedDateRange = dateRange; if (customRange != null) { _customDateRange = customRange; @@ -334,7 +364,10 @@ class Attendancelistprovider extends ChangeNotifier { } /// Get date range parameters for API - Map _getDateRangeParams(String dateRange, DateTimeRange? customRange) { + Map _getDateRangeParams( + String dateRange, + DateTimeRange? customRange, + ) { final now = DateTime.now(); final formatter = DateFormat("dd MMM yyyy"); late DateTime from; @@ -379,10 +412,7 @@ class Attendancelistprovider extends ChangeNotifier { to = now; } - return { - "from": formatter.format(from), - "to": formatter.format(to), - }; + return {"from": formatter.format(from), "to": formatter.format(to)}; } /// Format date for display @@ -429,76 +459,80 @@ class Attendancelistprovider extends ChangeNotifier { showCupertinoModalPopup( context: context, - builder: (BuildContext context) => Container( - height: 250, - padding: const EdgeInsets.only(top: 6.0), - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.bottom, - ), - color: CupertinoColors.systemBackground.resolveFrom(context), - child: SafeArea( - top: false, - child: Column( - children: [ - // Cancel + Done Buttons - SizedBox( - height: 55, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CupertinoButton( - child: Text( - 'Cancel', - style: TextStyle( - fontFamily: "JakartaMedium", - color: AppColors.app_blue, + builder: + (BuildContext context) => Container( + height: 250, + padding: const EdgeInsets.only(top: 6.0), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + color: CupertinoColors.systemBackground.resolveFrom(context), + child: SafeArea( + top: false, + child: Column( + children: [ + // Cancel + Done Buttons + SizedBox( + height: 55, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CupertinoButton( + child: Text( + 'Cancel', + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), + ), + onPressed: () => Navigator.pop(context), ), - ), - onPressed: () => Navigator.pop(context), - ), - CupertinoButton( - child: Text( - 'Done', - style: TextStyle( - fontFamily: "JakartaMedium", - color: AppColors.app_blue, + CupertinoButton( + child: Text( + 'Done', + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), + ), + onPressed: () { + // Ensure we save only date without time + final pickedDate = _selectedDate ?? today; + setSelectedDate( + DateTime( + pickedDate.year, + pickedDate.month, + pickedDate.day, + ), + ); + Navigator.pop(context); + }, ), - ), - onPressed: () { - // Ensure we save only date without time - final pickedDate = _selectedDate ?? today; - setSelectedDate(DateTime( - pickedDate.year, - pickedDate.month, - pickedDate.day, - )); - Navigator.pop(context); + ], + ), + ), + // Cupertino Date Picker + Expanded( + child: CupertinoDatePicker( + dateOrder: DatePickerDateOrder.dmy, + initialDateTime: _selectedDate ?? today, + minimumDate: today.subtract(const Duration(days: 2)), + maximumDate: today, + mode: CupertinoDatePickerMode.date, + use24hFormat: true, + showDayOfWeek: true, + onDateTimeChanged: (DateTime newDate) { + // Always normalize new date to midnight + setSelectedDate( + DateTime(newDate.year, newDate.month, newDate.day), + ); }, ), - ], - ), + ), + ], ), - // Cupertino Date Picker - Expanded( - child: CupertinoDatePicker( - dateOrder: DatePickerDateOrder.dmy, - initialDateTime: _selectedDate ?? today, - minimumDate: today.subtract(const Duration(days: 2)), - maximumDate: today, - mode: CupertinoDatePickerMode.date, - use24hFormat: true, - showDayOfWeek: true, - onDateTimeChanged: (DateTime newDate) { - // Always normalize new date to midnight - setSelectedDate(DateTime(newDate.year, newDate.month, newDate.day)); - }, - ), - ), - ], + ), ), - ), - ), ); } - } diff --git a/lib/Notifiers/hrmProvider/hrmAccessiblePagesProvider.dart b/lib/Notifiers/hrmProvider/hrmAccessiblePagesProvider.dart index 118b918..2f224bf 100644 --- a/lib/Notifiers/hrmProvider/hrmAccessiblePagesProvider.dart +++ b/lib/Notifiers/hrmProvider/hrmAccessiblePagesProvider.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -32,7 +31,8 @@ class HrmAccessiblePagesProvider extends ChangeNotifier { if (result != null) { _response = result; - if (_response?.pagesAccessible == null || _response!.pagesAccessible!.isEmpty) { + if (_response?.pagesAccessible == null || + _response!.pagesAccessible!.isEmpty) { _errorMessage = "No accessible pages found!"; } } else { diff --git a/lib/Notifiers/hrmProvider/leaveApplicationListProvider.dart b/lib/Notifiers/hrmProvider/leaveApplicationListProvider.dart index 242ec0f..6ac3f90 100644 --- a/lib/Notifiers/hrmProvider/leaveApplicationListProvider.dart +++ b/lib/Notifiers/hrmProvider/leaveApplicationListProvider.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:generp/Models/ordersModels/commonResponse.dart'; import 'package:intl/intl.dart'; @@ -39,7 +38,12 @@ class LeaveApplicationListProvider extends ChangeNotifier { final TextEditingController reasonController = TextEditingController(); // Status options for filter - final List statusOptions = ["All", "Requested", "Approved", "Rejected"]; + final List statusOptions = [ + "All", + "Requested", + "Approved", + "Rejected", + ]; // Date range options for filter final List dateRangeOptions = [ @@ -63,8 +67,13 @@ class LeaveApplicationListProvider extends ChangeNotifier { DateTime? get selectedDate => _selectedDate; /// Fetch leave application list with filters - Future fetchLeaveApplications(BuildContext context, mode, - {String? status, String? dateRange, DateTimeRange? customRange}) async { + Future fetchLeaveApplications( + BuildContext context, + mode, { + String? status, + String? dateRange, + DateTimeRange? customRange, + }) async { _isLoading = true; _errorMessage = null; notifyListeners(); @@ -76,31 +85,38 @@ class LeaveApplicationListProvider extends ChangeNotifier { final filterDateRange = dateRange ?? _selectedDateRange; final filterCustomRange = customRange ?? _customDateRange; - final dateParams = _getDateRangeParams(filterDateRange, filterCustomRange); + final dateParams = _getDateRangeParams( + filterDateRange, + filterCustomRange, + ); final result = await ApiCalling.leaveApplicationListAPI( provider.session, provider.empId, dateParams['from']!, dateParams['to']!, - mode + mode, ); debugPrint( - 'Fetching leave applications from: ${dateParams['from']} to: ${dateParams['to']}'); + 'Fetching leave applications from: ${dateParams['from']} to: ${dateParams['to']}', + ); if (result != null) { _response = result; if (filterStatus != "All" && _response?.requestList != null) { - _response!.requestList = _response!.requestList! - .where((item) => - item.status?.toLowerCase() == filterStatus.toLowerCase()) - .toList(); + _response!.requestList = + _response!.requestList! + .where( + (item) => + item.status?.toLowerCase() == + filterStatus.toLowerCase(), + ) + .toList(); } - if (_response?.requestList == null || - _response!.requestList!.isEmpty) { + if (_response?.requestList == null || _response!.requestList!.isEmpty) { _errorMessage = "No leave applications found!"; } } else { @@ -117,21 +133,24 @@ class LeaveApplicationListProvider extends ChangeNotifier { /// --- Add Leave Request --- Future addLeaveRequest( - BuildContext context, { - required String fromDate, - required String fromTime, - required String toDate, - required String toTime, - required String leaveType, - required String reason, - }) async { + BuildContext context, { + required String fromDate, + required String fromTime, + required String toDate, + required String toTime, + required String leaveType, + required String reason, + }) async { _isSubmitting = true; _errorMessage = null; _addResponse = null; notifyListeners(); try { - final homeProvider = Provider.of(context, listen: false); + final homeProvider = Provider.of( + context, + listen: false, + ); final result = await ApiCalling.leaveRequestAddAPI( homeProvider.session, @@ -197,7 +216,9 @@ class LeaveApplicationListProvider extends ChangeNotifier { /// Get date range parameters for API Map _getDateRangeParams( - String dateRange, DateTimeRange? customRange) { + String dateRange, + DateTimeRange? customRange, + ) { final now = DateTime.now(); final formatter = DateFormat("dd MMM yyyy"); late DateTime from; @@ -242,10 +263,7 @@ class LeaveApplicationListProvider extends ChangeNotifier { to = now; } - return { - "from": formatter.format(from), - "to": formatter.format(to), - }; + return {"from": formatter.format(from), "to": formatter.format(to)}; } /// Format date @@ -260,65 +278,72 @@ class LeaveApplicationListProvider extends ChangeNotifier { showCupertinoModalPopup( context: context, - builder: (BuildContext context) => Container( - height: 250, - padding: const EdgeInsets.only(top: 6.0), - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.bottom, - ), - color: CupertinoColors.systemBackground.resolveFrom(context), - child: SafeArea( - top: false, - child: Column( - children: [ - SizedBox( - height: 55, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CupertinoButton( - child: const Text("Cancel", - style: TextStyle(color: Colors.blue)), - onPressed: () => Navigator.pop(context), + builder: + (BuildContext context) => Container( + height: 250, + padding: const EdgeInsets.only(top: 6.0), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + color: CupertinoColors.systemBackground.resolveFrom(context), + child: SafeArea( + top: false, + child: Column( + children: [ + SizedBox( + height: 55, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CupertinoButton( + child: const Text( + "Cancel", + style: TextStyle(color: Colors.blue), + ), + onPressed: () => Navigator.pop(context), + ), + CupertinoButton( + child: const Text( + "Done", + style: TextStyle(color: Colors.blue), + ), + onPressed: () { + if (isFromDate) { + fromDateField.text = _formatDate( + currentDate ?? now, + ); + } else { + toDateField.text = _formatDate( + currentDate ?? now, + ); + } + Navigator.pop(context); + }, + ), + ], ), - CupertinoButton( - child: const Text("Done", - style: TextStyle(color: Colors.blue)), - onPressed: () { - if (isFromDate) { - fromDateField.text = - _formatDate(currentDate ?? now); - } else { - toDateField.text = - _formatDate(currentDate ?? now); - } - Navigator.pop(context); + ), + Expanded( + child: CupertinoDatePicker( + dateOrder: DatePickerDateOrder.dmy, + initialDateTime: now, + minimumDate: DateTime(now.year, now.month, now.day), + maximumDate: DateTime(now.year + 5), // limit + mode: CupertinoDatePickerMode.date, + onDateTimeChanged: (DateTime newDate) { + currentDate = newDate; }, ), - ], - ), - ), - Expanded( - child: CupertinoDatePicker( - dateOrder: DatePickerDateOrder.dmy, - initialDateTime: now, - minimumDate: DateTime(now.year, now.month, now.day), - maximumDate: DateTime(now.year + 5), // limit - mode: CupertinoDatePickerMode.date, - onDateTimeChanged: (DateTime newDate) { - currentDate = newDate; - }, - ), + ), + ], ), - ], + ), ), - ), - ), ); } /// Apply filters - void applyFilters(BuildContext context,mode) { + void applyFilters(BuildContext context, mode) { fetchLeaveApplications( context, mode, @@ -344,15 +369,20 @@ class LeaveApplicationListProvider extends ChangeNotifier { return [headers]; } - final rows = _response!.requestList!.map((item) => [ - item.id ?? '', - item.appliedDate ?? '', - item.fromPeriod ?? '', - item.toPeriod ?? '', - '', // leave type if available - item.status ?? '', - '', // reason if available - ]).toList(); + final rows = + _response!.requestList! + .map( + (item) => [ + item.id ?? '', + item.appliedDate ?? '', + item.fromPeriod ?? '', + item.toPeriod ?? '', + '', // leave type if available + item.status ?? '', + '', // reason if available + ], + ) + .toList(); return [headers, ...rows]; } diff --git a/lib/Notifiers/hrmProvider/tourExpensesDetailsProvider.dart b/lib/Notifiers/hrmProvider/tourExpensesDetailsProvider.dart index 3c1bb04..23c441c 100644 --- a/lib/Notifiers/hrmProvider/tourExpensesDetailsProvider.dart +++ b/lib/Notifiers/hrmProvider/tourExpensesDetailsProvider.dart @@ -14,7 +14,10 @@ class TourExpensesDetailsProvider extends ChangeNotifier { bool get isLoading => _isLoading; String? get errorMessage => _errorMessage; - Future fetchTourExpensesDetails(BuildContext context, String tourBillId) async { + Future fetchTourExpensesDetails( + BuildContext context, + String tourBillId, + ) async { _isLoading = true; _errorMessage = null; _response = null; @@ -28,7 +31,7 @@ class TourExpensesDetailsProvider extends ChangeNotifier { tourBillId, ); print("==== Tour Submitted ===="); - print("empId: "+provider.empId); + print("empId: ${provider.empId}"); print("Session: ${provider.session}"); print(": $result."); print("finish"); diff --git a/lib/Notifiers/hrmprovider/orgprovider.dart b/lib/Notifiers/hrmprovider/orgprovider.dart index 8e9c2b0..3caf1a7 100644 --- a/lib/Notifiers/hrmprovider/orgprovider.dart +++ b/lib/Notifiers/hrmprovider/orgprovider.dart @@ -5,41 +5,41 @@ import '../../Models/hrmmodels/ogresponse.dart'; import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; -class Orgprovider extends ChangeNotifier{ - - List _employees=[]; +class Orgprovider extends ChangeNotifier { + List _employees = []; String? _rootName; String? _rootId; String? _rootTitle; String? _rootProfile; - List get employees => _employees; + List get employees => _employees; String? get rootName => _rootName; String? get rootID => _rootId; String? get rootTitle => _rootTitle; String? get rootProfile => _rootProfile; - Future ogChart(context) async{ - try{ + Future ogChart(context) async { + try { var homeProvider = Provider.of( context, listen: false, ); - final data = await ApiCalling.ogChartAPI(homeProvider.empId, homeProvider.session); - if(data!=null){ - if(data.error=="0"){ - _rootName = data.name!; - _rootId = data.id!; - _rootProfile = data.profile!; - _rootTitle = data.title!; - _employees = data.children!; + final data = await ApiCalling.ogChartAPI( + homeProvider.empId, + homeProvider.session, + ); + if (data != null) { + if (data.error == "0") { + _rootName = data.name!; + _rootId = data.id!; + _rootProfile = data.profile!; + _rootTitle = data.title!; + _employees = data.children!; notifyListeners(); } } - }catch(e,s){ - - } + } catch (e) {} } -} \ No newline at end of file +} diff --git a/lib/Notifiers/loginNotifier.dart b/lib/Notifiers/loginNotifier.dart index 69a6899..1fce166 100644 --- a/lib/Notifiers/loginNotifier.dart +++ b/lib/Notifiers/loginNotifier.dart @@ -11,6 +11,7 @@ import 'package:android_id/android_id.dart'; import 'package:device_info_plus/device_info_plus.dart'; import '../Utils/commonServices.dart'; + class Loginnotifier extends ChangeNotifier { // Private variables String _emailError = ''; @@ -27,8 +28,8 @@ class Loginnotifier extends ChangeNotifier { static const _androidIdPlugin = AndroidId(); bool get isButtonEnabled => _email.isNotEmpty && - _password.isNotEmpty && - RegExp(r'\S+@\S+\.\S+').hasMatch(_email); + _password.isNotEmpty && + RegExp(r'\S+@\S+\.\S+').hasMatch(_email); // Public getters String get emailError => _emailError; @@ -39,19 +40,19 @@ class Loginnotifier extends ChangeNotifier { String get deviceId => _deviceId; String get deviceDetails => _deviceDetails; String get AndroidDevId => _androidId; -int get loginStatus => _loginStatus; + int get loginStatus => _loginStatus; -set isLoading(bool value){ - _isLoading = value; - notifyListeners(); -} + set isLoading(bool value) { + _isLoading = value; + notifyListeners(); + } Future initAndroidId() async { - String androidId; var deviceInfo = DeviceInfoPlugin(); // import 'dart:io' var androidDeviceInfo = await deviceInfo.androidInfo; - _deviceDetails = await "Version Name: " + + _deviceDetails = + "Version Name: " + androidDeviceInfo.version.baseOS.toString().trim() + ", " + "Version Code: " + @@ -96,12 +97,12 @@ set isLoading(bool value){ try { androidId = await _androidIdPlugin.getId() ?? 'Unknown ID'; _deviceId = androidId; - debugPrint("testing" + deviceId); + debugPrint("testing$deviceId"); debugPrint(_deviceDetails.toString()); } on PlatformException { androidId = 'Failed to get Android ID.'; } - _androidId = androidId; + _androidId = androidId; print(_deviceDetails); print(_deviceId); print(_androidId); @@ -114,11 +115,10 @@ set isLoading(bool value){ _deviceId = iosDeviceInfo.identifierForVendor!; _deviceDetails = iosDeviceInfo.toString(); notifyListeners(); + return null; } - - - bool visibility_ov(){ + bool visibility_ov() { _pwdVisible = !_pwdVisible; print(_pwdVisible); notifyListeners(); @@ -155,14 +155,8 @@ set isLoading(bool value){ return _emailError.isEmpty && _passwordError.isEmpty; } - - Future LoginApiFunction( - context, - email, - password, - ) async { + Future LoginApiFunction(context, email, password) async { try { - if (!_validate(email, password)) return; _isLoading = true; @@ -178,7 +172,7 @@ set isLoading(bool value){ if (data != null) { _isLoading = false; - _loginErrorCode = data?.error; + _loginErrorCode = data.error; notifyListeners(); debugPrint("${data.error} login error here"); @@ -195,15 +189,16 @@ set isLoading(bool value){ Navigator.push( context, - MaterialPageRoute(builder: (context) => MyHomePage(), - settings: RouteSettings(name: "MyHomePage")), + MaterialPageRoute( + builder: (context) => MyHomePage(), + settings: RouteSettings(name: "MyHomePage"), + ), ); notifyListeners(); } else if (data.error == 1) { _isLoading = false; notifyListeners(); - toast(context, - "You are not authorized to login in this device !"); + toast(context, "You are not authorized to login in this device !"); } else if (data.error == 2) { _isLoading = false; notifyListeners(); diff --git a/lib/Notifiers/ordersProvider/addOrderProvider.dart b/lib/Notifiers/ordersProvider/addOrderProvider.dart index 7dfa9e5..aa21d3a 100644 --- a/lib/Notifiers/ordersProvider/addOrderProvider.dart +++ b/lib/Notifiers/ordersProvider/addOrderProvider.dart @@ -55,10 +55,6 @@ class Addorderprovider extends ChangeNotifier { List TotalPriceControllers = []; List TaxableValueControllers = []; - - - - TextEditingController ProductController = TextEditingController(); TextEditingController PriceController = TextEditingController(); TextEditingController QuantityController = TextEditingController(text: "1"); @@ -180,7 +176,7 @@ class Addorderprovider extends ChangeNotifier { String? _formattedDate; Timer? _debounce; List> _selectedOrders = []; -String? productsEmptyError ; + String? productsEmptyError; List> get selectedOrders => _selectedOrders; bool _submitClicked = false; @@ -196,11 +192,13 @@ String? productsEmptyError ; _selectedOrders = selectedOrders; notifyListeners(); } + set productRows(value) { _productRows = value; productsEmptyError = ""; notifyListeners(); } + bool get isLoading => _isLoading; String? get formattedDate => _formattedDate; @@ -321,7 +319,7 @@ String? productsEmptyError ; set selectedAccountList(AccountList? value) { _selectedAccountList = value; _selectedAccountID = value!.id; - _selectedAccountName = value!.text!; + _selectedAccountName = value.text!; notifyListeners(); } @@ -338,7 +336,7 @@ String? productsEmptyError ; set selectedEmployees(Employees? value) { _selectedEmployees = value; _selectedEmployeeID = value!.id; - _selectedEmployeeName = value!.name!; + _selectedEmployeeName = value.name!; notifyListeners(); } @@ -355,7 +353,7 @@ String? productsEmptyError ; set selecetdBillingStates(States? value) { _selectedBillingStates = value; _selectedBillingStateID = value!.id; - _selectedBillingStateName = value!.name!; + _selectedBillingStateName = value.name!; selectedBillingStateError = ""; notifyListeners(); } @@ -375,7 +373,7 @@ String? productsEmptyError ; set selectedBillingDistricts(Districts? value) { _selectedBillingDistricts = value; _selectedBillingDistrictID = value!.id; - _selectedBillingDistrictValue = value!.district; + _selectedBillingDistrictValue = value.district; selectedBillingDistrictError = ""; // districtError = null; notifyListeners(); @@ -384,7 +382,7 @@ String? productsEmptyError ; set selectedBillingSubLocations(SubLocations? value) { _selectedBillingSubLocations = value; _selectedBillingSubLocID = value!.id; - _selectedBillingSubLocValue = value!.subLocality!; + _selectedBillingSubLocValue = value.subLocality!; selectedBillingSubLocError = ""; // localityError = null; notifyListeners(); @@ -478,7 +476,8 @@ String? productsEmptyError ; _selectedSaleProductID = value; notifyListeners(); } - set selectedSingleSaleProductID(String? value){ + + set selectedSingleSaleProductID(String? value) { _selectedSingleSaleProductID = value; notifyListeners(); } @@ -515,8 +514,8 @@ String? productsEmptyError ; set selectedTpcAgent(TpcList? value) { _selectedTpcAgent = value; _selectedTpcAgentID = value!.id; - _selectedTpcAgentValue = value!.text; - selectedTPCAgentError =null; + _selectedTpcAgentValue = value.text; + selectedTPCAgentError = null; notifyListeners(); } @@ -620,30 +619,26 @@ String? productsEmptyError ; updateSummaryCalculations(); notifyListeners(); } + void updateProduct(int index, Map updatedProduct) { productRows[index] = updatedProduct; updateSummaryCalculations(); notifyListeners(); } - void updateProductCalculations() { - - final inclusivePrice = - double.tryParse(PriceController.text) ?? 0.0; - final quantity = double.tryParse(QuantityController.text) ?? 1.0; - final cgst = double.tryParse(CGSTController.text) ?? 0.0; - final sgst = double.tryParse(SGSTController.text) ?? 0.0; - final igst = double.tryParse(IGSTController.text) ?? 0.0; - final totalTaxRate = (cgst + sgst + igst) / 100; - // Calculate taxable value per unit - final taxableValuePerUnit = inclusivePrice / (1 + totalTaxRate); - // Total taxable value = taxable value per unit * quantity - final totalTaxableValue = taxableValuePerUnit * quantity; - TaxableValueController.text = totalTaxableValue.toStringAsFixed( - 0, - ); - notifyListeners(); + final inclusivePrice = double.tryParse(PriceController.text) ?? 0.0; + final quantity = double.tryParse(QuantityController.text) ?? 1.0; + final cgst = double.tryParse(CGSTController.text) ?? 0.0; + final sgst = double.tryParse(SGSTController.text) ?? 0.0; + final igst = double.tryParse(IGSTController.text) ?? 0.0; + final totalTaxRate = (cgst + sgst + igst) / 100; + // Calculate taxable value per unit + final taxableValuePerUnit = inclusivePrice / (1 + totalTaxRate); + // Total taxable value = taxable value per unit * quantity + final totalTaxableValue = taxableValuePerUnit * quantity; + TaxableValueController.text = totalTaxableValue.toStringAsFixed(0); + notifyListeners(); } void updateSummaryCalculations() { @@ -702,18 +697,17 @@ String? productsEmptyError ; } void updateSelectedSingleProduct(SaleProducts? product) { - _selectedSaleProducts = product; - _selectedSingleSaleProductID= product!.id; - PriceController.text = product!.price!; - updateProductCalculations(); - notifyListeners(); - + _selectedSaleProducts = product; + _selectedSingleSaleProductID = product!.id; + PriceController.text = product.price!; + updateProductCalculations(); + notifyListeners(); } void prefillProductForEdit(int index) { final product = productRows[index]; selectedSaleProducts = saleProducts.firstWhere( - (p) => p.id == product['product_id'], + (p) => p.id == product['product_id'], orElse: () => SaleProducts(id: '', prodName: 'Unknown'), ); selectedSingleSaleProductID = product['product_id']; @@ -727,9 +721,6 @@ String? productsEmptyError ; notifyListeners(); } - - - // void addNewRow() { // ProductControllers.add(TextEditingController()); // PriceControllers.add(TextEditingController()); @@ -845,7 +836,7 @@ String? productsEmptyError ; notifyListeners(); } else {} } else {} - } catch (e, s) {} + } catch (e) {} } void checkDropdownselected() { @@ -916,44 +907,47 @@ String? productsEmptyError ; Future ordersAddOrderAccountDetailsAPIFunction( context, - account_id, + accountId, ) async { try { final provider = Provider.of(context, listen: false); final data = await ApiCalling.addOrderAccountDetailsAPI( provider.empId, provider.session, - account_id, + accountId, ); if (data != null) { if (data.error == "0") { _accountDetails = data.accountDetails!; data.accountDetails!.accManagerId!; billingNameController.text = data.accountDetails!.name!; - _selectedBillingStates = billingStates!.firstWhere((e) => e.id == data.accountDetails!.state!); + _selectedBillingStates = billingStates.firstWhere( + (e) => e.id == data.accountDetails!.state!, + ); _selectedBillingStateID = data.accountDetails!.state!; - _selectedBillingStateName = billingStates!.firstWhere((e) => e.id == data.accountDetails!.state!).name; + _selectedBillingStateName = + billingStates + .firstWhere((e) => e.id == data.accountDetails!.state!) + .name; _selectedBillingDistrictID = data.accountDetails!.district!; _selectedBillingSubLocID = data.accountDetails!.subLocality!; print("data.accountDetails!.state ${data.accountDetails!.state}"); - if(_selectedBillingStateID!=null){ - getDistrictAPI(context,data.accountDetails!.state); + if (_selectedBillingStateID != null) { + getDistrictAPI(context, data.accountDetails!.state); } - if(_selectedBillingDistrictID!=null){ - getSubLocationAPI(context,data.accountDetails!.district); + if (_selectedBillingDistrictID != null) { + getSubLocationAPI(context, data.accountDetails!.district); } - - billingPincodeController.text = data.accountDetails!.pincode!; billingAddressController.text = data.accountDetails!.address!; orderReceivedDateController.text = data.accountDetails!.date!; gstController.text = data.accountDetails!.gstNumber!; orderDateError = null; billingNameError = null; - billingPincodeError =null; + billingPincodeError = null; billingAddressError = null; selectedBillingStateError = null; selectedBillingDistrictError = null; @@ -961,7 +955,7 @@ String? productsEmptyError ; notifyListeners(); } else {} } else {} - } catch (e, s) {} + } catch (e) {} } Future getDistrictAPI(context, stateID) async { @@ -977,14 +971,19 @@ String? productsEmptyError ; if (data != null) { if (data.error == "0") { _billingDistricts = data.districts!; - _selectedBillingDistricts = data.districts!.firstWhere((e) => e.id == accountDetails!.district!); + _selectedBillingDistricts = data.districts!.firstWhere( + (e) => e.id == accountDetails.district!, + ); - _selectedBillingDistrictValue = data.districts!.firstWhere((e) => e.id == accountDetails!.district!).district; + _selectedBillingDistrictValue = + data.districts! + .firstWhere((e) => e.id == accountDetails.district!) + .district; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future getDispatchDistrictAPI(context, stateID) async { @@ -1004,7 +1003,7 @@ String? productsEmptyError ; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future getSubLocationAPI(context, districtID) async { @@ -1020,14 +1019,19 @@ String? productsEmptyError ; if (data != null) { if (data.error == "0") { _billingSubLocations = data.subLocations!; - _selectedBillingSubLocations = data.subLocations!.firstWhere((e) => e.id == accountDetails!.subLocality!); + _selectedBillingSubLocations = data.subLocations!.firstWhere( + (e) => e.id == accountDetails.subLocality!, + ); - _selectedBillingSubLocValue = data.subLocations!.firstWhere((e) => e.id == accountDetails!.subLocality!).subLocality; + _selectedBillingSubLocValue = + data.subLocations! + .firstWhere((e) => e.id == accountDetails.subLocality!) + .subLocality; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future getDispatchSubLocationAPI(context, districtID) async { @@ -1047,7 +1051,7 @@ String? productsEmptyError ; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future ordersAddOrderTPCAgentFunction(context, mode, text) async { @@ -1065,7 +1069,7 @@ String? productsEmptyError ; notifyListeners(); } else {} } else {} - } catch (e, s) {} + } catch (e) {} } Future> fetchTPCAccountsfromAPI(context, mode, text) async { @@ -1088,7 +1092,7 @@ String? productsEmptyError ; } else { return []; } - } catch (e, s) { + } catch (e) { return []; } } @@ -1096,20 +1100,20 @@ String? productsEmptyError ; Future ordersAddOrderAPISubmitFunction( context, mode, - selected_empid, - selected_acid, - selected_dis_stateId, - selected_dis_districtId, - selected_dis_subLocId, - unloading_scope, - frieght_scope, - erection_scope, - tpc_status, - selected_bil_stateId, - selected_bil_districtId, - selected_bil_subLocId, - tpc_agent_id, - order_products, + selectedEmpid, + selectedAcid, + selectedDisStateid, + selectedDisDistrictid, + selectedDisSublocid, + unloadingScope, + frieghtScope, + erectionScope, + tpcStatus, + selectedBilStateid, + selectedBilDistrictid, + selectedBilSublocid, + tpcAgentId, + orderProducts, ) async { try { if (!validateAddOrder()) { @@ -1121,11 +1125,11 @@ String? productsEmptyError ; provider.empId, provider.session, mode, - selected_empid, - selected_acid, - selected_dis_stateId, - selected_dis_districtId, - selected_dis_subLocId, + selectedEmpid, + selectedAcid, + selectedDisStateid, + selectedDisDistrictid, + selectedDisSublocid, dispatchPincodeController.text, dispatchAddressController.text, basicAmount, @@ -1135,24 +1139,24 @@ String? productsEmptyError ; totalAmount, formattedDate, noteController.text, - unloading_scope, - frieght_scope, - erection_scope, - tpc_status, + unloadingScope, + frieghtScope, + erectionScope, + tpcStatus, billingNameController.text, gstController.text, billingPincodeController.text, billingAddressController.text, - selected_bil_stateId, - selected_bil_districtId, - selected_bil_subLocId, - order_products, + selectedBilStateid, + selectedBilDistrictid, + selectedBilSublocid, + orderProducts, "", "", "", latlongs, tpcAmountController.text, - tpc_agent_id, + tpcAgentId, _image, ); if (data != null) { @@ -1170,7 +1174,7 @@ String? productsEmptyError ; _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -1220,8 +1224,8 @@ String? productsEmptyError ; actions: [ TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white), + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white), ), onPressed: () async { // await openAppSettings(); @@ -1242,23 +1246,21 @@ String? productsEmptyError ; } final Location.LocationData locData = await location.getLocation(); - if (locData != null) { - currentLocation = locData; - currentLocationLatLng = LatLng(locData.latitude!, locData.longitude!); - latlongs = "${locData.latitude}, ${locData.longitude}"; - markers.clear(); - markers.add( - Marker( - markerId: MarkerId('current_location'), - position: LatLng(locData.latitude!, locData.longitude!), - infoWindow: InfoWindow(title: 'Current Location'), - icon: BitmapDescriptor.defaultMarker, - ), - ); - latlongs = '${locData.latitude},${locData.longitude}'; + currentLocation = locData; + currentLocationLatLng = LatLng(locData.latitude!, locData.longitude!); + latlongs = "${locData.latitude}, ${locData.longitude}"; + markers.clear(); + markers.add( + Marker( + markerId: MarkerId('current_location'), + position: LatLng(locData.latitude!, locData.longitude!), + infoWindow: InfoWindow(title: 'Current Location'), + icon: BitmapDescriptor.defaultMarker, + ), + ); + latlongs = '${locData.latitude},${locData.longitude}'; - notifyListeners(); - } + notifyListeners(); } Future ordersAddOrderSelectAccountAPIFunction( @@ -1269,7 +1271,7 @@ String? productsEmptyError ; ) async { print(search); try { - if (search==null) { + if (search == null) { _accountList = []; _isLoading = false; notifyListeners(); @@ -1297,7 +1299,7 @@ String? productsEmptyError ; notifyListeners(); } else { - selectAccountError = data?.message ?? "Failed to load accounts"; + selectAccountError = data.message ?? "Failed to load accounts"; _isLoading = false; notifyListeners(); } @@ -1306,23 +1308,22 @@ String? productsEmptyError ; _isLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { selectAccountError = "An error occurred while fetching accounts"; _isLoading = false; notifyListeners(); } } - Future> fetchAccountsFromApi( - context, - mode, - accountId, - search, - ) async { + context, + mode, + accountId, + search, + ) async { print(search); try { - if (search==null) { + if (search == null) { _accountList = []; _isLoading = false; notifyListeners(); @@ -1351,7 +1352,7 @@ String? productsEmptyError ; notifyListeners(); return _accountList; } else { - selectAccountError = data?.message ?? "Failed to load accounts"; + selectAccountError = data.message ?? "Failed to load accounts"; _isLoading = false; notifyListeners(); @@ -1363,8 +1364,7 @@ String? productsEmptyError ; notifyListeners(); return []; } - } catch (e, s) { - + } catch (e) { selectAccountError = "An error occurred while fetching accounts"; _isLoading = false; notifyListeners(); @@ -1382,9 +1382,9 @@ String? productsEmptyError ; debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _imagePicked = 1; - if(_imagePicked==0){ + if (_imagePicked == 0) { FileError = "Please Select Attachment"; } FileError = null; @@ -1407,9 +1407,9 @@ String? productsEmptyError ; debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _imagePicked = 1; - if(_imagePicked==0){ + if (_imagePicked == 0) { FileError = "Please Select Attachment"; } FileError = null; @@ -1421,7 +1421,7 @@ String? productsEmptyError ; } void onChangedBillingName(value) { - billingNameError =null; + billingNameError = null; notifyListeners(); } @@ -1464,7 +1464,7 @@ String? productsEmptyError ; bool isValid = true; selectAccountError = null; billingNameError = null; - orderDateError =null; + orderDateError = null; billingAddressError = null; billingPincodeError = null; dispatchAddressError = null; @@ -1483,51 +1483,53 @@ String? productsEmptyError ; selectedTPCApplicableError = null; selectedTPCAgentError = null; - if (_selectedAccountList == null || _selectedAccountID==null) { + if (_selectedAccountList == null || _selectedAccountID == null) { selectAccountError = "Please select an Account"; isValid = false; } - if (_selectedAccountList == null || _selectedAccountID==null) { + if (_selectedAccountList == null || _selectedAccountID == null) { selectAccountError = "Please select an Account"; isValid = false; } - if (_selectedBillingStates == null || _selectedBillingStateID==null) { + if (_selectedBillingStates == null || _selectedBillingStateID == null) { selectedBillingStateError = "Please select a State"; isValid = false; } - if (_selectedBillingDistricts == null || _selectedBillingDistrictID==null) { + if (_selectedBillingDistricts == null || + _selectedBillingDistrictID == null) { selectedBillingDistrictError = "Please select a District"; isValid = false; } - if (_selectedBillingSubLocations == null || _selectedBillingSubLocID==null) { + if (_selectedBillingSubLocations == null || + _selectedBillingSubLocID == null) { selectedBillingSubLocError = "Please select a Location"; isValid = false; } - if (_selectedDispatchStates == null || _selectedDispatchStateID==null) { + if (_selectedDispatchStates == null || _selectedDispatchStateID == null) { selectedDispatchStateError = "Please select a State"; isValid = false; } - if (_selectedDispatchDistricts == null || _selectedDispatchDistrictID==null) { + if (_selectedDispatchDistricts == null || + _selectedDispatchDistrictID == null) { selectedDispatchDistrictError = "Please select a District"; isValid = false; } - if (_selectedDispatchSubLocations == null || _selectedDispatchSubLocID==null) { + if (_selectedDispatchSubLocations == null || + _selectedDispatchSubLocID == null) { selectedDispatchSubLocError = "Please select a Location"; isValid = false; } - if (orderReceivedDateController.text.trim().isEmpty) { orderDateError = "Please Enter Received Date"; isValid = false; - } if (billingNameController.text.trim().isEmpty) { isValid = false; @@ -1570,7 +1572,7 @@ String? productsEmptyError ; isValid = false; } if (_selectedTpcStatus == "Yes") { - if (_selectedTpcAgent == null || _selectedTpcAgentID==null) { + if (_selectedTpcAgent == null || _selectedTpcAgentID == null) { selectedTPCAgentError = "Please select an Agent"; isValid = false; } @@ -1595,29 +1597,29 @@ String? productsEmptyError ; selectedBillingDistrictError = null; selectedBillingSubLocError = null; - - if (_selectedAccountList == null || _selectedAccountID==null) { + if (_selectedAccountList == null || _selectedAccountID == null) { selectAccountError = "Please select an Account"; isValid = false; } - if (_selectedBillingStates == null || _selectedBillingStateID==null) { + if (_selectedBillingStates == null || _selectedBillingStateID == null) { selectedBillingStateError = "Please select a State"; isValid = false; } - if (_selectedBillingDistricts == null || _selectedBillingDistrictID==null) { + if (_selectedBillingDistricts == null || + _selectedBillingDistrictID == null) { selectedBillingDistrictError = "Please select a District"; isValid = false; } - if (_selectedBillingSubLocations == null || _selectedBillingSubLocID==null) { + if (_selectedBillingSubLocations == null || + _selectedBillingSubLocID == null) { selectedBillingSubLocError = "Please select a Location"; isValid = false; } if (orderReceivedDateController.text.trim().isEmpty) { - isValid = false; orderDateError = "Please Enter Received Date"; } @@ -1633,7 +1635,7 @@ String? productsEmptyError ; isValid = false; billingPincodeError = "Please Enter Pin Code"; } - if(billingPincodeController.text.length<6){ + if (billingPincodeController.text.length < 6) { isValid = false; billingPincodeError = "Please Enter a valid Pin Code"; } @@ -1641,6 +1643,7 @@ String? productsEmptyError ; notifyListeners(); return isValid; } + bool validateForm2() { bool isValid = true; dispatchAddressError = null; @@ -1651,17 +1654,19 @@ String? productsEmptyError ; selectedDispatchSubLocError = null; FileError = null; - if (_selectedDispatchStates == null || _selectedDispatchStateID==null) { + if (_selectedDispatchStates == null || _selectedDispatchStateID == null) { selectedDispatchStateError = "Please select a State"; isValid = false; } - if (_selectedDispatchDistricts == null || _selectedDispatchDistrictID==null) { + if (_selectedDispatchDistricts == null || + _selectedDispatchDistrictID == null) { selectedDispatchDistrictError = "Please select a District"; isValid = false; } - if (_selectedDispatchSubLocations == null || _selectedDispatchSubLocID==null) { + if (_selectedDispatchSubLocations == null || + _selectedDispatchSubLocID == null) { selectedDispatchSubLocError = "Please select a Location"; isValid = false; } @@ -1671,11 +1676,10 @@ String? productsEmptyError ; isValid = false; } if (dispatchPincodeController.text.trim().isEmpty) { - dispatchPincodeError = "Please Enter Dispatch Pin Code"; isValid = false; } - if(dispatchPincodeController.text.length<6){ + if (dispatchPincodeController.text.length < 6) { isValid = false; dispatchPincodeError = "Please Enter a valid Pin Code"; } @@ -1683,7 +1687,7 @@ String? productsEmptyError ; gstError = "Please Enter GST Number"; isValid = false; } - if(_imagePicked==0){ + if (_imagePicked == 0) { FileError = "Please provide an Attachment"; isValid = false; } @@ -1720,7 +1724,7 @@ String? productsEmptyError ; } if (_selectedTpcStatus == "Yes") { - if (_selectedTpcAgent == null || _selectedTpcAgentID==null) { + if (_selectedTpcAgent == null || _selectedTpcAgentID == null) { selectedTPCAgentError = "Please select an Agent"; isValid = false; } @@ -1736,7 +1740,7 @@ String? productsEmptyError ; bool validateForm4() { bool isValid = true; - if(productRows.isEmpty || _productRows.isEmpty){ + if (productRows.isEmpty || _productRows.isEmpty) { productsEmptyError = "Please Add min. one Product"; isValid = false; } @@ -1781,21 +1785,37 @@ String? productsEmptyError ; orderReceivedDateController.clear(); noteController.clear(); selectedSingleSaleProductID = null; - ProductControllers.forEach((action) => action.dispose()); + for (var action in ProductControllers) { + action.dispose(); + } ProductControllers.clear(); - PriceControllers.forEach((action) => action.dispose()); + for (var action in PriceControllers) { + action.dispose(); + } PriceControllers.clear(); - QuantityControllers.forEach((action) => action.dispose()); + for (var action in QuantityControllers) { + action.dispose(); + } QuantityControllers.clear(); - CGSTControllers.forEach((action) => action.dispose()); + for (var action in CGSTControllers) { + action.dispose(); + } CGSTControllers.clear(); - SGSTControllers.forEach((action) => action.dispose()); + for (var action in SGSTControllers) { + action.dispose(); + } SGSTControllers.clear(); - IGSTControllers.forEach((action) => action.dispose()); + for (var action in IGSTControllers) { + action.dispose(); + } IGSTControllers.clear(); - TotalPriceControllers.forEach((action) => action.dispose()); + for (var action in TotalPriceControllers) { + action.dispose(); + } TotalPriceControllers.clear(); - TaxableValueControllers.forEach((action) => action.dispose()); + for (var action in TaxableValueControllers) { + action.dispose(); + } TaxableValueControllers.clear(); basicAmountReadOnlyController.clear(); cgstReadOnlyController.clear(); @@ -1894,7 +1914,10 @@ String? productsEmptyError ; CupertinoButton( child: Text( 'Cancel', - style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), ), onPressed: () { Navigator.pop(context); @@ -1903,10 +1926,13 @@ String? productsEmptyError ; CupertinoButton( child: Text( 'Done', - style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), ), onPressed: () { - setDate(_date ?? DateTime.now() ); + setDate(_date ?? DateTime.now()); Navigator.pop(context); }, diff --git a/lib/Notifiers/ordersProvider/addPaymentProvider.dart b/lib/Notifiers/ordersProvider/addPaymentProvider.dart index 275a36a..cbe240c 100644 --- a/lib/Notifiers/ordersProvider/addPaymentProvider.dart +++ b/lib/Notifiers/ordersProvider/addPaymentProvider.dart @@ -16,8 +16,7 @@ import '../../Models/ordersModels/AddOrderPaymentSelectAccountResponse.dart'; import '../../Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart'; import '../../Utils/app_colors.dart'; -class Addpaymentprovider extends ChangeNotifier{ - +class Addpaymentprovider extends ChangeNotifier { bool _submitClicked = false; TextEditingController dropDownSearchController = TextEditingController(); @@ -34,8 +33,6 @@ class Addpaymentprovider extends ChangeNotifier{ String paymentModeError = ""; String paymentRefError = ""; - - List orderAmountControllers = []; String? FileError; @@ -53,7 +50,7 @@ class Addpaymentprovider extends ChangeNotifier{ List _paymentMode = []; List _description = []; List _accountList = []; - List _orderList= []; + List _orderList = []; List> _selectedOrders = []; String? _selectedPaymentMode; @@ -68,9 +65,7 @@ class Addpaymentprovider extends ChangeNotifier{ List _selectedBalanceAmounts = []; List _selectedCreatedDatetimes = []; - - - bool get submitClicked =>_submitClicked; + bool get submitClicked => _submitClicked; List get paymentMode => _paymentMode; List get description => _description; bool get isLoading => _isLoading; @@ -97,54 +92,60 @@ class Addpaymentprovider extends ChangeNotifier{ File? get imageFilePath => _image; int get imagePicked => _imagePicked; - set submitClicked(bool value){ + set submitClicked(bool value) { _submitClicked = value; notifyListeners(); } - set accountList(List value){ - _accountList = value; - notifyListeners(); - } + set accountList(List value) { + _accountList = value; + notifyListeners(); + } - set selectedPaymentMode(String? value){ + set selectedPaymentMode(String? value) { _selectedPaymentMode = value; paymentModeError = ""; notifyListeners(); } - set selectedOrders(value){ + set selectedOrders(value) { _selectedOrders = selectedOrders; notifyListeners(); } - set selectedDescription(String? value){ + + set selectedDescription(String? value) { _selectedDescription = value; descriptionError = ""; notifyListeners(); } - set selectedAccountList(AccountList? value){ + + set selectedAccountList(AccountList? value) { _selectedAccountList = value; _selectedAccountID = value?.id!; _selectedAccountName = value!.text!; selectAccountError = ""; notifyListeners(); } - set selectedAccountID(String? value){ + + set selectedAccountID(String? value) { _selectedAccountID = value; notifyListeners(); } - set selectedAccountName(String? value){ + + set selectedAccountName(String? value) { _selectedAccountName = value; notifyListeners(); } - set selectedOrderLists(OrderList? value){ + + set selectedOrderLists(OrderList? value) { _selectedOrderLists = value; notifyListeners(); } + void updateSelectedOrderId(int index, OrderList? value) { _selectedOrderLists = value!; _updateAdjustedAmount(); - _selectedOrderIds[index] = value!.orderId; + _selectedOrderIds[index] = value.orderId; print(_selectedOrderIds[index]); notifyListeners(); } @@ -153,14 +154,17 @@ class Addpaymentprovider extends ChangeNotifier{ _selectedOrderNumbers = value; notifyListeners(); } + set selectedTotalAmounts(List value) { _selectedTotalAmounts = value; notifyListeners(); } + set selectedBalanceAmounts(List value) { _selectedBalanceAmounts = value; notifyListeners(); } + set selectedCreatedDatetimes(List value) { _selectedCreatedDatetimes = value; notifyListeners(); @@ -180,6 +184,7 @@ class Addpaymentprovider extends ChangeNotifier{ _imagePicked = value; notifyListeners(); } + set formattedDate(String? value) { _formattedDate = value; paymentReceivedDateController.text = _formattedDate!; @@ -195,18 +200,18 @@ class Addpaymentprovider extends ChangeNotifier{ dateError = null; notifyListeners(); } + void addNewRow() { // if (_selectedOrderIds.length < _orderList.length ) { - final controller = TextEditingController(); - - // Add a listener to recalculate the total when the text changes - controller.addListener(_updateAdjustedAmount); + final controller = TextEditingController(); - orderAmountControllers.add(TextEditingController()); - _selectedOrderIds.add(null); + // Add a listener to recalculate the total when the text changes + controller.addListener(_updateAdjustedAmount); - notifyListeners(); + orderAmountControllers.add(TextEditingController()); + _selectedOrderIds.add(null); + notifyListeners(); } void removeRow(int index) { @@ -217,6 +222,7 @@ class Addpaymentprovider extends ChangeNotifier{ _updateAdjustedAmount(); notifyListeners(); } + void _updateAdjustedAmount() { int tempAdjustAmount = 0; @@ -227,9 +233,10 @@ class Addpaymentprovider extends ChangeNotifier{ } } int amountControllerAmount = int.parse(amountController.text.toString()); - if(tempAdjustAmount>amountControllerAmount){ - orderAdjustedAmountError = "Amount Should not be greater than Total Amount"; - }else{ + if (tempAdjustAmount > amountControllerAmount) { + orderAdjustedAmountError = + "Amount Should not be greater than Total Amount"; + } else { orderAdjustedAmountError = ""; } @@ -237,7 +244,7 @@ class Addpaymentprovider extends ChangeNotifier{ notifyListeners(); } - void updateAdjustedAmount() => _updateAdjustedAmount(); + void updateAdjustedAmount() => _updateAdjustedAmount(); List> getFormData() { _selectedOrders = []; @@ -251,13 +258,14 @@ class Addpaymentprovider extends ChangeNotifier{ "order_id": _selectedOrderIds[i]!, "amount": orderAmountControllers[i].text, }); - tempAdjustAmount = tempAdjustAmount+int.parse(double.parse(orderAmountControllers[i].text).round().toString()); + tempAdjustAmount = + tempAdjustAmount + + int.parse( + double.parse(orderAmountControllers[i].text).round().toString(), + ); } } - - - print("Form Data: $_selectedOrders"); orderAdjustedAmountController.text = tempAdjustAmount.toString(); print(tempAdjustAmount); @@ -265,14 +273,15 @@ class Addpaymentprovider extends ChangeNotifier{ return _selectedOrders; } - - Future ordersAddPaymentAPIViewFunction(context) async { - try{ - final provider = Provider.of(context,listen: false); - final data = await ApiCalling.addOrderpaymentListViewAPI(provider.empId, provider.session); - if(data!=null){ - if(data.error=="0"){ + try { + final provider = Provider.of(context, listen: false); + final data = await ApiCalling.addOrderpaymentListViewAPI( + provider.empId, + provider.session, + ); + if (data != null) { + if (data.error == "0") { _paymentMode = data.paymentMode!; _description = data.description!; checkDropdownselected(); @@ -285,24 +294,26 @@ class Addpaymentprovider extends ChangeNotifier{ // } notifyListeners(); - }else{ - - } - - }else{ - - } - - }catch(e,s){ - - } + } else {} + } else {} + } catch (e) {} } - void onSearchChanged(BuildContext context, String mode, String? accountId, String search) { + void onSearchChanged( + BuildContext context, + String mode, + String? accountId, + String search, + ) { if (_debounce?.isActive ?? false) _debounce!.cancel(); _debounce = Timer(const Duration(milliseconds: 300), () { // if (search.isNotEmpty) { // Only call API for non-empty search - ordersAddPaymentSelectAccountAPIFunction(context, mode, accountId, search); + ordersAddPaymentSelectAccountAPIFunction( + context, + mode, + accountId, + search, + ); // } else { // _accountList = []; // Clear list for empty search // _isLoading = false; @@ -311,12 +322,14 @@ class Addpaymentprovider extends ChangeNotifier{ }); } - - - Future ordersAddPaymentSelectAccountAPIFunction(context,mode,accountId,search) async { + Future ordersAddPaymentSelectAccountAPIFunction( + context, + mode, + accountId, + search, + ) async { print(search); - try{ - + try { if (search.isEmpty) { _accountList = []; _isLoading = false; @@ -325,12 +338,18 @@ class Addpaymentprovider extends ChangeNotifier{ } _isLoading = true; notifyListeners(); - final provider = Provider.of(context,listen: false); - final data = await ApiCalling.AddOrderPaymentSelectAccountAPI(provider.empId, provider.session, mode, search); - if(data!=null){ - if(data.error=="0"){ + final provider = Provider.of(context, listen: false); + final data = await ApiCalling.AddOrderPaymentSelectAccountAPI( + provider.empId, + provider.session, + mode, + search, + ); + if (data != null) { + if (data.error == "0") { _accountList = data.accountList!; - if (_selectedAccountList != null && !_accountList.contains(_selectedAccountList)) { + if (_selectedAccountList != null && + !_accountList.contains(_selectedAccountList)) { _selectedAccountList = null; _selectedAccountID = null; _selectedAccountName = null; @@ -339,88 +358,94 @@ class Addpaymentprovider extends ChangeNotifier{ notifyListeners(); - if (_accountList.isNotEmpty && _selectedAccountID != null) { - await ordersAddPaymentSelectOrderAPIFunction(context, _selectedAccountID); + await ordersAddPaymentSelectOrderAPIFunction( + context, + _selectedAccountID, + ); } - - }else{ - selectAccountError = data?.message ?? "Failed to load accounts"; + } else { + selectAccountError = data.message ?? "Failed to load accounts"; _isLoading = false; notifyListeners(); } - - }else{ + } else { selectAccountError = "No data received from server"; _isLoading = false; notifyListeners(); } - - }catch(e,s){ + } catch (e) { selectAccountError = "An error occurred while fetching accounts"; _isLoading = false; notifyListeners(); } } - Future ordersAddPaymentSelectOrderAPIFunction(context,accountID) async { - try{ - print("ACID:${accountID}"); - final provider = Provider.of(context,listen: false); - final data = await ApiCalling.AddOrderPaymentSelectOrderAPI(provider.empId, provider.session, accountID); - if(data!=null){ - if(data.error=="0"){ + Future ordersAddPaymentSelectOrderAPIFunction( + context, + accountID, + ) async { + try { + print("ACID:$accountID"); + final provider = Provider.of(context, listen: false); + final data = await ApiCalling.AddOrderPaymentSelectOrderAPI( + provider.empId, + provider.session, + accountID, + ); + if (data != null) { + if (data.error == "0") { _orderList = data.orderList!; notifyListeners(); - }else{ - - } - - }else{ - - } - - }catch(e,s){ - - } - } - - Future ordersAddPaymentAPISubmitFunction(context, - accountId,selDescription, selectedOrders, - paymentMode,) async { - try{ + } else {} + } else {} + } catch (e) {} + } + + Future ordersAddPaymentAPISubmitFunction( + context, + accountId, + selDescription, + selectedOrders, + paymentMode, + ) async { + try { if (!validateAddPayment()) { return; } _submitClicked = true; notifyListeners(); - final provider = Provider.of(context,listen: false); - final data = await ApiCalling.addOrderpaymentListSubmitAPI(provider.empId, provider.session, - accountId, selDescription, - selectedOrders, amountController.text, - paymentReceivedDateController.text, - paymentMode, paymentRefController.text, _image); - if(data!=null){ - if(data.error=="0"){ + final provider = Provider.of(context, listen: false); + final data = await ApiCalling.addOrderpaymentListSubmitAPI( + provider.empId, + provider.session, + accountId, + selDescription, + selectedOrders, + amountController.text, + paymentReceivedDateController.text, + paymentMode, + paymentRefController.text, + _image, + ); + if (data != null) { + if (data.error == "0") { _submitClicked = false; resetForm(); Navigator.pop(context); toast(context, data.message); notifyListeners(); - - }else{ + } else { _submitClicked = false; notifyListeners(); toast(context, data.message); } - - }else{ + } else { submitClicked = false; notifyListeners(); } - - }catch(e,s){ + } catch (e) { submitClicked = false; notifyListeners(); } @@ -436,7 +461,7 @@ class Addpaymentprovider extends ChangeNotifier{ debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _imagePicked = 1; FileError = null; notifyListeners(); @@ -458,7 +483,7 @@ class Addpaymentprovider extends ChangeNotifier{ debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _imagePicked = 1; FileError = null; notifyListeners(); @@ -468,26 +493,28 @@ class Addpaymentprovider extends ChangeNotifier{ } } - void onChangeAmount(value){ + void onChangeAmount(value) { _updateAdjustedAmount(); amountError = ""; notifyListeners(); } - void onChangeorderAdjustedAmount(value){ + void onChangeorderAdjustedAmount(value) { _updateAdjustedAmount(); notifyListeners(); } - void onChangeDescription(value){ + + void onChangeDescription(value) { descriptionError = ""; notifyListeners(); } - void onChangepaymentRef(value){ + void onChangepaymentRef(value) { paymentRefError = ""; notifyListeners(); } - bool validateAddPayment(){ + + bool validateAddPayment() { bool isValid = true; selectAccountError = ""; amountError = ""; @@ -495,32 +522,32 @@ class Addpaymentprovider extends ChangeNotifier{ descriptionError = ""; paymentModeError = ""; paymentRefError = ""; - if (_selectedAccountList == null || _selectedAccountID==null) { + if (_selectedAccountList == null || _selectedAccountID == null) { selectAccountError = "Please select an Account"; isValid = false; } - if(amountController.text.trim().isEmpty){ + if (amountController.text.trim().isEmpty) { isValid = false; amountError = "Please Enter the Amount"; } - if(orderAdjustedAmountController.text.trim().isEmpty){ + if (orderAdjustedAmountController.text.trim().isEmpty) { isValid = false; orderAdjustedAmountError = "Please Enter the Amount"; } - if (_description == null || _selectedDescription==null) { + if (_selectedDescription == null) { descriptionError = "Please select"; isValid = false; } - if(paymentReceivedDateController.text.trim().isEmpty){ + if (paymentReceivedDateController.text.trim().isEmpty) { isValid = false; paymentModeError = "Please Enter the Amount"; } - if (_paymentMode == null || _selectedPaymentMode==null) { + if (_selectedPaymentMode == null) { paymentModeError = "Please select an Account"; isValid = false; } - if(paymentRefController.text.trim().isEmpty){ + if (paymentRefController.text.trim().isEmpty) { isValid = false; paymentRefError = "Please Enter the Payment reference"; } @@ -529,7 +556,6 @@ class Addpaymentprovider extends ChangeNotifier{ return isValid; } - void resetForm() { dropDownSearchController.clear(); amountController.clear(); @@ -549,7 +575,9 @@ class Addpaymentprovider extends ChangeNotifier{ _imageName = null; _imagePicked = 0; _selectedOrders.clear(); - orderAmountControllers.forEach((controller) => controller.dispose()); + for (var controller in orderAmountControllers) { + controller.dispose(); + } orderAmountControllers.clear(); selectAccountError = ""; amountError = ""; @@ -574,8 +602,8 @@ class Addpaymentprovider extends ChangeNotifier{ _selectedAccountName = ""; } - - if(_selectedOrderLists!=null && !_orderList.contains(_selectedOrderLists)){ + if (_selectedOrderLists != null && + !_orderList.contains(_selectedOrderLists)) { _selectedOrderLists = null; _selectedOrderIds.clear(); _selectedOrderIds = []; @@ -590,69 +618,77 @@ class Addpaymentprovider extends ChangeNotifier{ void showDatePickerDialog(BuildContext context) { if (_date == null) { - setDate(DateTime.now()); // Ensure current date is set before opening the picker + setDate( + DateTime.now(), + ); // Ensure current date is set before opening the picker } showCupertinoModalPopup( context: context, builder: (BuildContext context) => Container( - height: 250, - padding: const EdgeInsets.only(top: 6.0), - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).viewInsets.bottom, - ), - color: CupertinoColors.systemBackground.resolveFrom(context), - child: SafeArea( - top: false, - child: Column( - children: [ - Expanded( - flex: 2, - child: SizedBox( - height: 40, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CupertinoButton( - child: Text( - 'Cancel', - style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), - ), - onPressed: () { - Navigator.pop(context); - }, - ), - CupertinoButton( - child: Text( - 'Done', - style: TextStyle(fontFamily: "JakartaMedium",color: AppColors.app_blue), - ), - onPressed: () { - setDate(_date ?? DateTime.now() ); - Navigator.pop(context); - }, + height: 250, + padding: const EdgeInsets.only(top: 6.0), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + color: CupertinoColors.systemBackground.resolveFrom(context), + child: SafeArea( + top: false, + child: Column( + children: [ + Expanded( + flex: 2, + child: SizedBox( + height: 40, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CupertinoButton( + child: Text( + 'Cancel', + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), + ), + onPressed: () { + Navigator.pop(context); + }, + ), + CupertinoButton( + child: Text( + 'Done', + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), + ), + onPressed: () { + setDate(_date ?? DateTime.now()); + Navigator.pop(context); + }, + ), + ], ), - ], + ), ), - ), - ), - Expanded( - flex: 4, - child: CupertinoDatePicker( - dateOrder: DatePickerDateOrder.dmy, - initialDateTime: _date ?? DateTime.now(), - mode: CupertinoDatePickerMode.date, - use24hFormat: true, - showDayOfWeek: true, - onDateTimeChanged: (DateTime newDate) { - setDate(newDate); - }, - ), + Expanded( + flex: 4, + child: CupertinoDatePicker( + dateOrder: DatePickerDateOrder.dmy, + initialDateTime: _date ?? DateTime.now(), + mode: CupertinoDatePickerMode.date, + use24hFormat: true, + showDayOfWeek: true, + onDateTimeChanged: (DateTime newDate) { + setDate(newDate); + }, + ), + ), + ], ), - ], + ), ), - ), - ), ); } -} \ No newline at end of file +} diff --git a/lib/Notifiers/ordersProvider/dispatchOrderProvider.dart b/lib/Notifiers/ordersProvider/dispatchOrderProvider.dart index 37c141c..c99e3f9 100644 --- a/lib/Notifiers/ordersProvider/dispatchOrderProvider.dart +++ b/lib/Notifiers/ordersProvider/dispatchOrderProvider.dart @@ -7,29 +7,28 @@ import '../../Utils/commonServices.dart'; import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; import 'package:generp/Models/ordersModels/ordersDetailsDispatchOrderViewResponse.dart'; -class Dispatchorderprovider extends ChangeNotifier{ -bool _submitClicked = false; + +class Dispatchorderprovider extends ChangeNotifier { + bool _submitClicked = false; TextEditingController invoiceNumberController = TextEditingController(); TextEditingController vehicleNumberController = TextEditingController(); TextEditingController driverNameController = TextEditingController(); TextEditingController driverMobileNumberController = TextEditingController(); - -String? invoiceNumberError; -String? vehicleNumberError; -String? driverNameError; -String? driverMobileNumberError; + String? invoiceNumberError; + String? vehicleNumberError; + String? driverNameError; + String? driverMobileNumberError; List _leadProductsList = []; Products? _selectedProducts; - List engineNumberControllers = []; List pdiIDControllers = []; - List _selectedProductIds = []; - List _selectedProductValues = []; - + final List _selectedProductIds = []; + final List _selectedProductValues = []; + List get productsList => _leadProductsList; List get leadProductsList => _leadProductsList; Products? get selectedProducts => _selectedProducts; @@ -38,11 +37,11 @@ String? driverMobileNumberError; bool get submitClicked => _submitClicked; - set submitClicked(bool value){ + set submitClicked(bool value) { _submitClicked = value; notifyListeners(); } - + void initializeForm(BuildContext context) { // Clear existing controllers engineNumberControllers.clear(); @@ -52,7 +51,9 @@ String? driverMobileNumberError; // Initialize controllers for each lead product for (var product in _leadProductsList) { engineNumberControllers.add(TextEditingController()); - pdiIDControllers.add(TextEditingController(text: product.pdiId?.toString() ?? '')); + pdiIDControllers.add( + TextEditingController(text: product.pdiId?.toString() ?? ''), + ); _selectedProductIds.add(product.id); _selectedProductValues.add(product.productName); @@ -112,8 +113,7 @@ String? driverMobileNumberError; return insertData; } - - Future ordersPDIIDByEngineNumberFunction(context,index) async { + Future ordersPDIIDByEngineNumberFunction(context, index) async { try { final provider = Provider.of(context, listen: false); final data = await ApiCalling.ordersPdiIdByEngNumberUrlAPI( @@ -128,7 +128,7 @@ String? driverMobileNumberError; notifyListeners(); } else {} } else {} - } catch (e, s) {} + } catch (e) {} } Future ordersDetailsDispatchOrderViewFunction(context, orderID) async { @@ -145,22 +145,22 @@ String? driverMobileNumberError; notifyListeners(); } else {} } else {} - } catch (e, s) {} + } catch (e) {} } Future approvalRejectionAPIFunction( - context, - status, - orderId, - type, - feedback, - tpc_applicable, - tpc_approved_amount, - sale_order_number, - edit_company_name, - crm_order_p_id, - mode - ) async { + context, + status, + orderId, + type, + feedback, + tpcApplicable, + tpcApprovedAmount, + saleOrderNumber, + editCompanyName, + crmOrderPId, + mode, + ) async { try { if (!validateApproveRejectForm()) { // _submitClicked = false; @@ -169,7 +169,10 @@ String? driverMobileNumberError; _submitClicked = true; notifyListeners(); var provider = Provider.of(context, listen: false); - final detProvider = Provider.of(context,listen: false); + final detProvider = Provider.of( + context, + listen: false, + ); final data = await ApiCalling.ordersDetailsApproveRejectAPI( provider.empId, provider.session, @@ -177,95 +180,95 @@ String? driverMobileNumberError; type, orderId, feedback, - tpc_applicable, - tpc_approved_amount, - sale_order_number, - edit_company_name, + tpcApplicable, + tpcApprovedAmount, + saleOrderNumber, + editCompanyName, invoiceNumberController.text, vehicleNumberController.text, driverNameController.text, driverMobileNumberController.text, - crm_order_p_id, + crmOrderPId, ); if (data != null) { if (data.error == "0") { _submitClicked = false; toast(context, "${data.message}"); resetForm(); - detProvider.ordersDetailsByModeAPIFunction( - context, - orderId, - mode, - ); + detProvider.ordersDetailsByModeAPIFunction(context, orderId, mode); Navigator.pop(context, true); notifyListeners(); } else { _submitClicked = false; notifyListeners(); } - }else{ + } else { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } } -bool validateApproveRejectForm(){ + bool validateApproveRejectForm() { bool isValid = true; - if(invoiceNumberController.text.trim().isEmpty){ + if (invoiceNumberController.text.trim().isEmpty) { invoiceNumberError = "Enter Invoice Number"; isValid = false; } - if(vehicleNumberController.text.trim().isEmpty){ + if (vehicleNumberController.text.trim().isEmpty) { vehicleNumberError = "Enter Vehicle Number"; isValid = false; } - if(driverNameController.text.trim().isEmpty){ + if (driverNameController.text.trim().isEmpty) { driverNameError = "Enter Driver Name"; isValid = false; } - if(driverMobileNumberController.text.trim().isEmpty){ + if (driverMobileNumberController.text.trim().isEmpty) { driverMobileNumberError = "Enter Driver Number"; isValid = false; } notifyListeners(); return isValid; -} -resetForm(){ - invoiceNumberController.clear(); - vehicleNumberController.clear(); - driverNameController.clear(); - driverMobileNumberController.clear(); - engineNumberControllers.clear(); - pdiIDControllers.clear(); - _selectedProductIds.clear(); - _selectedProductValues.clear(); - _leadProductsList.clear(); - invoiceNumberError = null; - vehicleNumberError = null; - driverNameError = null; - driverMobileNumberError = null; - notifyListeners(); -} + } + + resetForm() { + invoiceNumberController.clear(); + vehicleNumberController.clear(); + driverNameController.clear(); + driverMobileNumberController.clear(); + engineNumberControllers.clear(); + pdiIDControllers.clear(); + _selectedProductIds.clear(); + _selectedProductValues.clear(); + _leadProductsList.clear(); + invoiceNumberError = null; + vehicleNumberError = null; + driverNameError = null; + driverMobileNumberError = null; + notifyListeners(); + } - onChangedinvoiceNumber(value){ + onChangedinvoiceNumber(value) { invoiceNumberError = null; notifyListeners(); } - onChangedvehicleNumber(value){ + + onChangedvehicleNumber(value) { vehicleNumberError = null; notifyListeners(); } - onChangeddriverName(value){ + + onChangeddriverName(value) { driverNameError = null; notifyListeners(); } - onChangeddriverMobileNumber(value){ + + onChangeddriverMobileNumber(value) { driverMobileNumberError = null; notifyListeners(); } diff --git a/lib/Notifiers/ordersProvider/editOrderProvider.dart b/lib/Notifiers/ordersProvider/editOrderProvider.dart index d40c004..ccfdeb1 100644 --- a/lib/Notifiers/ordersProvider/editOrderProvider.dart +++ b/lib/Notifiers/ordersProvider/editOrderProvider.dart @@ -45,7 +45,7 @@ class Editorderprovider extends ChangeNotifier { int image_picked = 0; String? FileError; String? dateError; - bool _isLoading = false; + final bool _isLoading = false; int _imagePicked = 0; File? _image; File? _imageName; @@ -117,7 +117,7 @@ class Editorderprovider extends ChangeNotifier { set selecetdDispatchStates(States? value) { _selectedDispatchStates = value; _selectedDispatchStateID = value!.id; - _selectedDispatchStateName = value!.name!; + _selectedDispatchStateName = value.name!; notifyListeners(); } @@ -134,7 +134,7 @@ class Editorderprovider extends ChangeNotifier { set selectedDispatchDistricts(Districts? value) { _selectedDispatchDistricts = value; _selectedDispatchDistrictID = value!.id; - _selectedDispatchDistrictValue = value!.district; + _selectedDispatchDistrictValue = value.district; // districtError = null; notifyListeners(); } @@ -142,7 +142,7 @@ class Editorderprovider extends ChangeNotifier { set selectedDispatchSubLocations(SubLocations? value) { _selectedDispatchSubLocations = value; _selectedDispatchSubLocID = value!.id; - _selectedDispatchSubLocValue = value!.subLocality!; + _selectedDispatchSubLocValue = value.subLocality!; // localityError = null; notifyListeners(); } @@ -202,16 +202,29 @@ class Editorderprovider extends ChangeNotifier { _erectionScope = ["Included", "Excluded"]; _unloadingScope = ["Included", "Excluded"]; _freightScope = ["Included", "Excluded"]; - if(data.orderDetails!.dispatchStateId!=null){ - getDispatchDistrictAPI(context,data.orderDetails!.dispatchStateId!); + if (data.orderDetails!.dispatchStateId != null) { + getDispatchDistrictAPI( + context, + data.orderDetails!.dispatchStateId!, + ); } - if(data.orderDetails!.dispatchDistrictId!=null){ - getDispatchSubLocationAPI(context,data.orderDetails!.dispatchDistrictId!); + if (data.orderDetails!.dispatchDistrictId != null) { + getDispatchSubLocationAPI( + context, + data.orderDetails!.dispatchDistrictId!, + ); } - _selectedDispatchStates = data.states!.firstWhere((e) => e.id == data.orderDetails!.dispatchStateId!); + _selectedDispatchStates = data.states!.firstWhere( + (e) => e.id == data.orderDetails!.dispatchStateId!, + ); _selectedDispatchStateID = data.orderDetails!.dispatchStateId!; - _selectedDispatchStateName = data.states!.firstWhere((e) => e.id == data.orderDetails!.dispatchStateId!).name; + _selectedDispatchStateName = + data.states! + .firstWhere( + (e) => e.id == data.orderDetails!.dispatchStateId!, + ) + .name; _selectedDispatchDistrictID = data.orderDetails!.dispatchDistrictId!; _selectedDispatchSubLocID = data.orderDetails!.dispatchSubLocationId!; dispatchAddressController.text = data.orderDetails!.dispatchAddress!; @@ -224,7 +237,7 @@ class Editorderprovider extends ChangeNotifier { notifyListeners(); } else {} } else {} - } catch (e, s) {} + } catch (e) {} } Future getDispatchDistrictAPI(context, stateID) async { @@ -240,12 +253,17 @@ class Editorderprovider extends ChangeNotifier { if (data != null) { if (data.error == "0") { _dispatchDistricts = data.districts!; - _selectedDispatchDistricts = data.districts!.firstWhere((e) => e.id == orderDetails!.dispatchDistrictId!); - _selectedDispatchDistrictValue = data.districts!.firstWhere((e) => e.id == orderDetails!.dispatchDistrictId!).district; + _selectedDispatchDistricts = data.districts!.firstWhere( + (e) => e.id == orderDetails.dispatchDistrictId!, + ); + _selectedDispatchDistrictValue = + data.districts! + .firstWhere((e) => e.id == orderDetails.dispatchDistrictId!) + .district; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future getDispatchSubLocationAPI(context, districtID) async { @@ -261,13 +279,20 @@ class Editorderprovider extends ChangeNotifier { if (data != null) { if (data.error == "0") { _dispatchSubLocations = data.subLocations!; - _selectedDispatchSubLocations = data.subLocations!.firstWhere((e) => e.id == orderDetails!.dispatchSubLocationId!); - _selectedDispatchSubLocValue = data.subLocations!.firstWhere((e) => e.id == orderDetails!.dispatchSubLocationId!).subLocality; + _selectedDispatchSubLocations = data.subLocations!.firstWhere( + (e) => e.id == orderDetails.dispatchSubLocationId!, + ); + _selectedDispatchSubLocValue = + data.subLocations! + .firstWhere( + (e) => e.id == orderDetails.dispatchSubLocationId!, + ) + .subLocality; notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future ordersEditOrderAPISubmitFunction( @@ -313,7 +338,7 @@ class Editorderprovider extends ChangeNotifier { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -329,7 +354,7 @@ class Editorderprovider extends ChangeNotifier { debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _imagePicked = 1; FileError = null; notifyListeners(); @@ -351,7 +376,7 @@ class Editorderprovider extends ChangeNotifier { debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _imagePicked = 1; FileError = null; notifyListeners(); diff --git a/lib/Notifiers/ordersProvider/editPaymentProvider.dart b/lib/Notifiers/ordersProvider/editPaymentProvider.dart index 64edc33..61fdb97 100644 --- a/lib/Notifiers/ordersProvider/editPaymentProvider.dart +++ b/lib/Notifiers/ordersProvider/editPaymentProvider.dart @@ -16,7 +16,7 @@ class Editpaymentprovider extends ChangeNotifier { String? adjustedAddAmountError; String? selectedAccountError; List _paidList = []; - List _editOrderList = []; + final List _editOrderList = []; EditPaidList? _selectedPaidLists; EditOrderList? _selectedOrderList; @@ -42,31 +42,32 @@ class Editpaymentprovider extends ChangeNotifier { List get selectedOrderIDs => _selectedOrderIDs; bool get submitLoading => _submitLoading; - List _editpaidLists = []; + final List _editpaidLists = []; List get editpaidLists => _editpaidLists; EditPaidList? _editselectedPaidList; String? _editselectedPaidOrderId; String? _editselectedPaidOrderValue; EditPaidList? get editselectedPaidList => _editselectedPaidList; - String? get editselectedPaidOrderId =>_editselectedPaidOrderId; - String? get editselectedPaidOrderValue =>_editselectedPaidOrderValue; + String? get editselectedPaidOrderId => _editselectedPaidOrderId; + String? get editselectedPaidOrderValue => _editselectedPaidOrderValue; - set editselectedPaidList(EditPaidList? value){ + set editselectedPaidList(EditPaidList? value) { _editselectedPaidList = value; _editselectedPaidOrderId = value!.orderId; - _editselectedPaidOrderValue = value!.orderNumber; + _editselectedPaidOrderValue = value.orderNumber; notifyListeners(); } - set editselectedPaidOrderId(String? value){ + set editselectedPaidOrderId(String? value) { _editselectedPaidOrderId = value; notifyListeners(); } - set editselectedPaidOrderValue(String? value){ + set editselectedPaidOrderValue(String? value) { _editselectedPaidOrderValue = value; notifyListeners(); } + set selectedPaidOrderIDs(List value) { _selectedPaidOrderIDs = value; notifyListeners(); @@ -95,7 +96,7 @@ class Editpaymentprovider extends ChangeNotifier { void updateSelectedPaidOrderId(int index, EditPaidList? value) { _selectedPaidLists = value!; - _selectedPaidOrderIDs[index] = value!.orderId; + _selectedPaidOrderIDs[index] = value.orderId; print(_selectedPaidOrderIDs[index]); notifyListeners(); } @@ -104,12 +105,12 @@ class Editpaymentprovider extends ChangeNotifier { _selectedOrderList = value!; print(index); print(value); - print(value!.orderId); + print(value.orderId); if (index > 0) { - _selectedOrderIDs[index] = value!.orderId; + _selectedOrderIDs[index] = value.orderId; print(_selectedOrderIDs[index]); } else { - _selectedOrderIDs[0] = value!.orderId; + _selectedOrderIDs[0] = value.orderId; print(_selectedOrderIDs[0]); } @@ -215,10 +216,10 @@ class Editpaymentprovider extends ChangeNotifier { _updateAmounts = []; for (int i = 0; i < _paidList.length; i++) { final rowData = { - "order_id": _paidList[i]!.orderId.toString(), - "order_payment_id": _paidList[i]!.orderPaymentId.toString(), - "selected_order_id": _paidList[i]!.orderId.toString(), - "updateable_payment_amount": _paidList[i]!.adjustedAmount.toString(), + "order_id": _paidList[i].orderId.toString(), + "order_payment_id": _paidList[i].orderPaymentId.toString(), + "selected_order_id": _paidList[i].orderId.toString(), + "updateable_payment_amount": _paidList[i].adjustedAmount.toString(), }; _updateAmounts.add(rowData); } @@ -229,11 +230,11 @@ class Editpaymentprovider extends ChangeNotifier { Future editPaymentDetailsAPIFunction( context, - payment_id, + paymentId, description, - payment_type, - ref_no, - payment_date, + paymentType, + refNo, + paymentDate, amount, ) async { try { @@ -247,18 +248,18 @@ class Editpaymentprovider extends ChangeNotifier { final data = await ApiCalling.ordersEditPaymentDetailsAPI( provider.empId, provider.session, - payment_id, + paymentId, description, - payment_type, - ref_no, - payment_date, + paymentType, + refNo, + paymentDate, amount, ); if (data != null) { if (data.error == "0") { _submitLoading = false; addOrderProvider.resetForm(); - Navigator.pop(context,true); + Navigator.pop(context, true); toast(context, data.message); notifyListeners(); } else if (data.error == "1") { @@ -269,7 +270,7 @@ class Editpaymentprovider extends ChangeNotifier { _submitLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitLoading = false; notifyListeners(); } @@ -277,22 +278,24 @@ class Editpaymentprovider extends ChangeNotifier { Future editPaymentDetailsAdjustedOrdersViewAPIFunction( context, - payment_id,[index] - ) async { + paymentId, [ + index, + ]) async { try { - print("payment_id: ${payment_id}"); + print("payment_id: $paymentId"); final provider = Provider.of(context, listen: false); final data = await ApiCalling.ordersEditPaymentDetailsAdjustedOrdersViewAPI( provider.empId, provider.session, - payment_id, + paymentId, ); if (data != null) { if (data.error == "0") { _paidList = data.paidList!; - if(index!=null){ - adjustedAddAmountController.text = data.paidList![index].orderAmount!; + if (index != null) { + adjustedAddAmountController.text = + data.paidList![index].orderAmount!; _editselectedPaidList = data.paidList![index]; _editselectedPaidOrderId = data.paidList![index].orderId; } @@ -300,14 +303,14 @@ class Editpaymentprovider extends ChangeNotifier { notifyListeners(); } else if (data.error == "1") {} } else {} - } catch (e, s) {} + } catch (e) {} } Future editPaymentDetailsAdjustedOrdersUpdateAPIFunction( context, - payment_id, - update_amounts, - insert_amounts, + paymentId, + updateAmounts, + insertAmounts, ) async { try { _submitLoading = true; @@ -318,15 +321,15 @@ class Editpaymentprovider extends ChangeNotifier { await ApiCalling.ordersEditPaymentDetailsAdjustedOrdersUpdateAPI( provider.empId, provider.session, - payment_id, - update_amounts, - insert_amounts, + paymentId, + updateAmounts, + insertAmounts, ); if (data != null) { if (data.error == "0") { _submitLoading = false; resetForm(); - Navigator.pop(context,true); + Navigator.pop(context, true); toast(context, data.message); notifyListeners(); } else if (data.error == "1") { @@ -337,20 +340,20 @@ class Editpaymentprovider extends ChangeNotifier { _submitLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitLoading = false; notifyListeners(); } } Future paymentsDetailsAddAdjustedOrderModeAPIFunction( - context, - paymentId, - selectedOrderId, - mode, - ) async { + context, + paymentId, + selectedOrderId, + mode, + ) async { try { - if(!validate()){ + if (!validate()) { return; } _submitLoading = true; @@ -380,23 +383,24 @@ class Editpaymentprovider extends ChangeNotifier { _submitLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitLoading = false; notifyListeners(); } } - Future paymentsDetailsEditAdjustedOrderModeAPIFunction( - context, - orderPaymentId, - selectedOrderId, - mode, - paymentId, - ) async { + context, + orderPaymentId, + selectedOrderId, + mode, + paymentId, + ) async { try { - print("$selectedOrderId , ${adjustedAddAmountController.text} , $orderPaymentId,"); - if(!validate()){ + print( + "$selectedOrderId , ${adjustedAddAmountController.text} , $orderPaymentId,", + ); + if (!validate()) { return; } _submitLoading = true; @@ -418,7 +422,7 @@ class Editpaymentprovider extends ChangeNotifier { Navigator.pop(context, true); pprovider.paymentsDetailsByModeAPIFunction(context, paymentId, mode); notifyListeners(); - }else { + } else { _submitLoading = false; notifyListeners(); } @@ -426,27 +430,28 @@ class Editpaymentprovider extends ChangeNotifier { _submitLoading = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitLoading = false; } } + onChnageAmountController(value) { adjustedAddAmountError = null; notifyListeners(); } - bool validate(){ + bool validate() { bool isValid = true; adjustedAddAmountError = null; selectedAccountError = null; - if(_editselectedPaidList==null||_editselectedPaidOrderId==null){ + if (_editselectedPaidList == null || _editselectedPaidOrderId == null) { selectedAccountError = "Please Select a Value"; - isValid =false; + isValid = false; } - if(adjustedAddAmountController.text.trim().isEmpty){ + if (adjustedAddAmountController.text.trim().isEmpty) { adjustedAddAmountError = "Please enter Amount"; - isValid =false; + isValid = false; } _submitLoading = false; notifyListeners(); @@ -466,8 +471,9 @@ class Editpaymentprovider extends ChangeNotifier { notifyListeners(); } - checkdropDownReset(){ - if (_editselectedPaidList != null && !_editpaidLists.contains(_editselectedPaidList)) { + checkdropDownReset() { + if (_editselectedPaidList != null && + !_editpaidLists.contains(_editselectedPaidList)) { _editselectedPaidList = null; _editselectedPaidOrderId = null; _editselectedPaidOrderValue = null; @@ -481,21 +487,26 @@ class Editpaymentprovider extends ChangeNotifier { selectedOrderList = null; _selectedOrderIDs.clear(); } - if (_editselectedPaidList != null && !_paidList.contains(_editselectedPaidList)) { + if (_editselectedPaidList != null && + !_paidList.contains(_editselectedPaidList)) { _editselectedPaidList = null; _selectedPaidOrderIDs.clear(); } } void resetForm() { - _submitLoading =false; + _submitLoading = false; checkDropdownselected(); _editselectedPaidList = null; _selectedOrderList = null; _selectedOrderIDs.clear(); _selectedPaidOrderIDs.clear(); - editOrderAmountControllers.forEach((controller) => controller.dispose()); - editOrderAmountControllers2.forEach((controller) => controller.dispose()); + for (var controller in editOrderAmountControllers) { + controller.dispose(); + } + for (var controller in editOrderAmountControllers2) { + controller.dispose(); + } editOrderAmountControllers.clear(); editOrderAmountControllers2.clear(); } diff --git a/lib/Notifiers/ordersProvider/pagesDashboardProvider.dart b/lib/Notifiers/ordersProvider/pagesDashboardProvider.dart index 9deaba3..cb809c8 100644 --- a/lib/Notifiers/ordersProvider/pagesDashboardProvider.dart +++ b/lib/Notifiers/ordersProvider/pagesDashboardProvider.dart @@ -64,10 +64,11 @@ class Pagesdashboardprovider extends ChangeNotifier { List _ordersgain = []; List get ordersgain => _ordersgain; bool get showMoreDetails => _showMoreDetails; - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } + File? _image; File? _imageName; @@ -75,17 +76,18 @@ class Pagesdashboardprovider extends ChangeNotifier { bool get submitClicked => _submitClicked; - set submitClicked(bool value){ + set submitClicked(bool value) { _submitClicked = value; notifyListeners(); } + String get approvalSheetHeading => _approvalSheetHeading; String get rejecetionSheetHeading => _rejecetionSheetHeading; String get deletionSheetHeading => _deletionSheetHeading; - set enteredOtp(String value){ + set enteredOtp(String value) { _enteredOTP = value; notifyListeners(); } @@ -215,7 +217,7 @@ class Pagesdashboardprovider extends ChangeNotifier { debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; notifyListeners(); } catch (e) { @@ -236,7 +238,7 @@ class Pagesdashboardprovider extends ChangeNotifier { debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; notifyListeners(); // var file = FlutterImageCompress.compressWithFile(galleryImage!.path); @@ -245,32 +247,34 @@ class Pagesdashboardprovider extends ChangeNotifier { } } - - Future orderDashboardAPIFunction(context, mode, - from,to,teamemployee) async { - try{ - var HomeProv = Provider.of(context,listen: false); - final data = await ApiCalling.ordersDashboardAPI(HomeProv.empId, HomeProv.session, mode, - from,to,teamemployee); - if(data!=null){ - if(data.error=="0"){ + Future orderDashboardAPIFunction( + context, + mode, + from, + to, + teamemployee, + ) async { + try { + var HomeProv = Provider.of(context, listen: false); + final data = await ApiCalling.ordersDashboardAPI( + HomeProv.empId, + HomeProv.session, + mode, + from, + to, + teamemployee, + ); + if (data != null) { + if (data.error == "0") { _ordergain = data.ordergain!; _dispatches = data.dispatches!; _pendingTasks = data.pendingTasks!; _quote = data.quote!; - _ordersgain = [ - _ordergain, - _dispatches, - _pendingTasks, - _quote, - ]; + _ordersgain = [_ordergain, _dispatches, _pendingTasks, _quote]; notifyListeners(); } } - - }catch (e,s){ - - } + } catch (e) {} } Future ordersAccessiblePagesAPIFunction(context) async { @@ -283,11 +287,11 @@ class Pagesdashboardprovider extends ChangeNotifier { if (data != null) { if (data.error == "0") { _ordersAccessiblePagesList = data.pagesAccessible!; - print(data.pagesAccessible!.map((e) => e.pageName,)); + print(data.pagesAccessible!.map((e) => e.pageName)); notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } Future ordersAccessibleAddPagesAPIFunction(context) async { @@ -303,7 +307,7 @@ class Pagesdashboardprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } Future ordersListByModeFilterAPIFunction(context, mode) async { @@ -321,11 +325,9 @@ class Pagesdashboardprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } - - bool _isLoadingMore = false; bool get isLoadingMore => _isLoadingMore; @@ -349,12 +351,12 @@ class Pagesdashboardprovider extends ChangeNotifier { } Future ordersListByModeAPIFunction( - BuildContext context, - String mode, - String teamEmployee, - String status, { - bool append = false, - }) async { + BuildContext context, + String mode, + String teamEmployee, + String status, { + bool append = false, + }) async { try { var provider = Provider.of(context, listen: false); @@ -375,7 +377,9 @@ class Pagesdashboardprovider extends ChangeNotifier { status, _currentPage.toString(), ); - debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage'); + debugPrint( + 'empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage', + ); if (data != null && data.error == "0") { if (append) { @@ -390,7 +394,6 @@ class Pagesdashboardprovider extends ChangeNotifier { } } - if (data.orderList == null || data.orderList!.length < 10) { _hasMoreData = false; } @@ -398,7 +401,7 @@ class Pagesdashboardprovider extends ChangeNotifier { if (!append) _errorMessage = "No orders found!"; _hasMoreData = false; } - } catch (e, s) { + } catch (e) { _errorMessage = "Error: $e"; } if (_selectedEmployee != null && @@ -411,16 +414,15 @@ class Pagesdashboardprovider extends ChangeNotifier { _isLoading = false; _isLoadingMore = false; notifyListeners(); - } /// Load next page Future loadMore( - BuildContext context, - String mode, - String teamEmployee, - String status, - ) async { + BuildContext context, + String mode, + String teamEmployee, + String status, + ) async { if (_isLoadingMore || !_hasMoreData) return; _currentPage++; await ordersListByModeAPIFunction( @@ -444,70 +446,72 @@ class Pagesdashboardprovider extends ChangeNotifier { // _isLoading = true; notifyListeners(); if (data.error == "0") { - _orderDetails = data.orderDetails??OrderDetails( - id:"", - orderNumber:"", - orderNumberHash:"", - balanceAmount:"", - accId:"", - refType:"", - refId:"", - salesPersonEmpId:"", - enteredEmpId:"", - dispatchStateId:"", - dispatchDistrictId:"", - dispatchSubLocationId:"", - dispatchPincode:"", - dispatchAddress:"", - basicAmount:"", - cgstAmount:"", - sgstAmount:"", - igstAmount:"", - paidAmount:"", - totalAmount:"", - status:"", - orderReceivedDate:"", - scheduledDispatchDate:"", - otp:"", - note:"", - poViewFileName:"", - poDirFilePath:"", - unloadingScope:"", - freightScope:"", - erectionScope:"", - saleOrderNumber:"", - invoiceNumber:"", - vehicleNumber:"", - driverName:"", - driverMobileNumber:"", - tpcApplicable:"", - requestedTpcAmount:"", - level1TpcApprovedAmount:"", - level2TpcApprovedAmount:"", - tpcPaymentMode:"", - tpcPaymentReferenceNo:"", - tpcPaymentAttachmentDirFilePath:"", - tpcPaymentAttachementViewFileName:"", - tpcStatus:"", - tpcAgentId:"", - isExist:"", - createdDatetime:"", - updatedDatetime:"", - accountName:"", - gstNumber:"", - billingAddress:"", - billingDistrict:"", - billingState:"", - billingSubLocality:"", - billingPincode:"", - stateName:"", - districtName:"", - subLocationName:"", - adjustedAmount:"", - enteredEmpName:"", - salesPersonEmpName:"", - tpcaAgentName: "" - ); + _orderDetails = + data.orderDetails ?? + OrderDetails( + id: "", + orderNumber: "", + orderNumberHash: "", + balanceAmount: "", + accId: "", + refType: "", + refId: "", + salesPersonEmpId: "", + enteredEmpId: "", + dispatchStateId: "", + dispatchDistrictId: "", + dispatchSubLocationId: "", + dispatchPincode: "", + dispatchAddress: "", + basicAmount: "", + cgstAmount: "", + sgstAmount: "", + igstAmount: "", + paidAmount: "", + totalAmount: "", + status: "", + orderReceivedDate: "", + scheduledDispatchDate: "", + otp: "", + note: "", + poViewFileName: "", + poDirFilePath: "", + unloadingScope: "", + freightScope: "", + erectionScope: "", + saleOrderNumber: "", + invoiceNumber: "", + vehicleNumber: "", + driverName: "", + driverMobileNumber: "", + tpcApplicable: "", + requestedTpcAmount: "", + level1TpcApprovedAmount: "", + level2TpcApprovedAmount: "", + tpcPaymentMode: "", + tpcPaymentReferenceNo: "", + tpcPaymentAttachmentDirFilePath: "", + tpcPaymentAttachementViewFileName: "", + tpcStatus: "", + tpcAgentId: "", + isExist: "", + createdDatetime: "", + updatedDatetime: "", + accountName: "", + gstNumber: "", + billingAddress: "", + billingDistrict: "", + billingState: "", + billingSubLocality: "", + billingPincode: "", + stateName: "", + districtName: "", + subLocationName: "", + adjustedAmount: "", + enteredEmpName: "", + salesPersonEmpName: "", + tpcaAgentName: "", + ); _productsHistory = data.products!; _feedbackHistory = data.feedbackHistory!; _paymentHistory = data.paymentHistory!; @@ -663,7 +667,7 @@ class Pagesdashboardprovider extends ChangeNotifier { } notifyListeners(); } - } catch (e, s) {} + } catch (e) {} } Future ordersDetailsFeedbackSubmissionAPIFunction( @@ -698,11 +702,11 @@ class Pagesdashboardprovider extends ChangeNotifier { _submitClicked = false; notifyListeners(); } - }else{ + } else { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -713,13 +717,13 @@ class Pagesdashboardprovider extends ChangeNotifier { status, orderId, type, - tpc_applicable, - tpc_approved_amount, - invoice_number, - vehicle_number, - driver_name, - driver_mobile_no, - crm_order_p_id, + tpcApplicable, + tpcApprovedAmount, + invoiceNumber, + vehicleNumber, + driverName, + driverMobileNo, + crmOrderPId, mode, ) async { try { @@ -737,15 +741,15 @@ class Pagesdashboardprovider extends ChangeNotifier { type, orderId, approveRejectFeedbackController.text, - tpc_applicable, - tpc_approved_amount, + tpcApplicable, + tpcApprovedAmount, saleOrderNumberController.text, editCompanyController.text, - invoice_number, - vehicle_number, - driver_name, - driver_mobile_no, - crm_order_p_id, + invoiceNumber, + vehicleNumber, + driverName, + driverMobileNo, + crmOrderPId, ); if (data != null) { if (data.error == "0") { @@ -756,7 +760,7 @@ class Pagesdashboardprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } Future delectionAPIFunction(context, orderId) async { @@ -778,33 +782,33 @@ class Pagesdashboardprovider extends ChangeNotifier { resetForm(); Navigator.pop(context, true); notifyListeners(); - } else { + } else { _submitClicked = false; notifyListeners(); } - }else{ + } else { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } } - Future verifyOrderAPIFunction(context, orderId,otp) async { + Future verifyOrderAPIFunction(context, orderId, otp) async { try { - if(otp.isEmpty){ - toast(context, "Please Enter OTP"); - _submitClicked = false; - return; - } + if (otp.isEmpty) { + toast(context, "Please Enter OTP"); + _submitClicked = false; + return; + } final provider = Provider.of(context, listen: false); final data = await ApiCalling.verifyOrderAPI( provider.empId, provider.session, orderId, - otp + otp, ); if (data != null) { if (data.error == "0") { @@ -812,16 +816,16 @@ class Pagesdashboardprovider extends ChangeNotifier { // otpController.clear(); Navigator.pop(context, true); notifyListeners(); - } else { + } else { toast(context, data.message!); _submitClicked = false; notifyListeners(); } - }else{ + } else { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -846,8 +850,7 @@ class Pagesdashboardprovider extends ChangeNotifier { } else { toast(context, data.message); } - } else { - } + } else {} } else {} } on Error catch (e) { debugPrint(e.toString()); diff --git a/lib/Notifiers/ordersProvider/paymentsProvider.dart b/lib/Notifiers/ordersProvider/paymentsProvider.dart index a40e908..1fc0f14 100644 --- a/lib/Notifiers/ordersProvider/paymentsProvider.dart +++ b/lib/Notifiers/ordersProvider/paymentsProvider.dart @@ -37,22 +37,22 @@ class Paymentsprovider extends ChangeNotifier { String? _selectedPaidOrderId; String? _selectedPaidOrderValue; PaidList? get selectedPaidList => _selectedPaidList; - String? get selectedPaidOrderId =>_selectedPaidOrderId; - String? get selectedPaidOrderValue =>_selectedPaidOrderValue; + String? get selectedPaidOrderId => _selectedPaidOrderId; + String? get selectedPaidOrderValue => _selectedPaidOrderValue; - set selectedPaidList(PaidList? value){ + set selectedPaidList(PaidList? value) { _selectedPaidList = value; _selectedPaidOrderId = value!.id; - _selectedPaidOrderValue = value!.orderNumber; + _selectedPaidOrderValue = value.orderNumber; notifyListeners(); } - set selectedPaidOrderId(String? value){ + set selectedPaidOrderId(String? value) { _selectedPaidOrderId = value; notifyListeners(); } - set selectedPaidOrderValue(String? value){ + set selectedPaidOrderValue(String? value) { _selectedPaidOrderValue = value; notifyListeners(); } @@ -76,7 +76,7 @@ class Paymentsprovider extends ChangeNotifier { bool get isLoading => _isLoading; - set submitLoading(bool value){ + set submitLoading(bool value) { _submitLoading = value; notifyListeners(); } @@ -117,7 +117,7 @@ class Paymentsprovider extends ChangeNotifier { notifyListeners(); } else {} } - } catch (e, s) {} + } catch (e) {} } bool _isLoadingMore = false; @@ -141,11 +141,11 @@ class Paymentsprovider extends ChangeNotifier { } Future paymentsListsByModeAPIFunction( - BuildContext context, - String mode, - String teamEmployee, { - bool append = false, - }) async { + BuildContext context, + String mode, + String teamEmployee, { + bool append = false, + }) async { try { var provider = Provider.of(context, listen: false); @@ -165,7 +165,9 @@ class Paymentsprovider extends ChangeNotifier { teamEmployee, _currentPage.toString(), ); - debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage'); + debugPrint( + 'empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage', + ); if (data != null && data.error == "0") { if (append) { @@ -181,7 +183,7 @@ class Paymentsprovider extends ChangeNotifier { if (!append) _errorMessage = "No payments found!"; _hasMoreData = false; } - } catch (e, s) { + } catch (e) { _errorMessage = "Error: $e"; } @@ -191,10 +193,10 @@ class Paymentsprovider extends ChangeNotifier { } Future loadMore( - BuildContext context, - String mode, - String teamEmployee, - ) async { + BuildContext context, + String mode, + String teamEmployee, + ) async { if (_isLoadingMore || !_hasMoreData) return; _currentPage++; await paymentsListsByModeAPIFunction( @@ -261,7 +263,7 @@ class Paymentsprovider extends ChangeNotifier { } notifyListeners(); } - } catch (e, s) {} + } catch (e) {} } Future paymentApprovalRejectionAPIFunction( @@ -289,7 +291,7 @@ class Paymentsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } Future paymentDeletionAPIFunction(context, paymentId) async { @@ -309,25 +311,21 @@ class Paymentsprovider extends ChangeNotifier { notifyListeners(); } } - } catch (e, s) {} + } catch (e) {} } - - - - - bool validate(){ + bool validate() { bool isValid = true; adjustedAddAmountError = null; selectedAccountError = null; - if(_selectedPaidList==null||_selectedPaidOrderId==null){ + if (_selectedPaidList == null || _selectedPaidOrderId == null) { selectedAccountError = "Please Select a Value"; - isValid =false; + isValid = false; } - if(adjustedAddAmountController.text.trim().isEmpty){ + if (adjustedAddAmountController.text.trim().isEmpty) { adjustedAddAmountError = "Please enter Amount"; - isValid =false; + isValid = false; } _submitLoading = false; notifyListeners(); @@ -356,7 +354,6 @@ class Paymentsprovider extends ChangeNotifier { } void resetForm() { - _submitLoading = false; adjustedAddAmountController.clear(); approvalRejectionController.clear(); @@ -382,7 +379,7 @@ class Paymentsprovider extends ChangeNotifier { notifyListeners(); } - checkdropDownReset(){ + checkdropDownReset() { if (_selectedPaidList != null && !_paidLists.contains(_selectedPaidList)) { _selectedPaidList = null; _selectedPaidOrderId = null; diff --git a/lib/Notifiers/ordersProvider/tpcAgentsProvider.dart b/lib/Notifiers/ordersProvider/tpcAgentsProvider.dart index 2960301..f3d630c 100644 --- a/lib/Notifiers/ordersProvider/tpcAgentsProvider.dart +++ b/lib/Notifiers/ordersProvider/tpcAgentsProvider.dart @@ -14,20 +14,23 @@ import '../../Utils/commonServices.dart'; import '../../services/api_calling.dart'; import '../HomeScreenNotifier.dart'; -class Tpcagentsprovider extends ChangeNotifier{ +class Tpcagentsprovider extends ChangeNotifier { bool _submitClicked = false; bool _showMoreDetails = false; TextEditingController tpcNameController = TextEditingController(); TextEditingController tpcMobileNumberController = TextEditingController(); TextEditingController tpcBankNameController = TextEditingController(); - TextEditingController tpcBankBeneficiaryNameController = TextEditingController(); - TextEditingController tpcBankAccountNumberController = TextEditingController(); + TextEditingController tpcBankBeneficiaryNameController = + TextEditingController(); + TextEditingController tpcBankAccountNumberController = + TextEditingController(); TextEditingController tpcBankIFSCController = TextEditingController(); TextEditingController tpcNoteController = TextEditingController(); TextEditingController tpcPaymentModeController = TextEditingController(); - TextEditingController tpcPaymentReferenceNoController = TextEditingController(); + TextEditingController tpcPaymentReferenceNoController = + TextEditingController(); TextEditingController orderTpcFeedbackController = TextEditingController(); String? tpcNameError = ""; @@ -75,12 +78,12 @@ class Tpcagentsprovider extends ChangeNotifier{ get imagePicked => _image_picked; - set submitClicked(bool value){ + set submitClicked(bool value) { _submitClicked = value; notifyListeners(); } - set showMoreDetails(bool value){ + set showMoreDetails(bool value) { _showMoreDetails = value; notifyListeners(); } @@ -100,7 +103,6 @@ class Tpcagentsprovider extends ChangeNotifier{ notifyListeners(); } - bool _isLoadingMore = false; bool get isLoadingMore => _isLoadingMore; @@ -122,10 +124,10 @@ class Tpcagentsprovider extends ChangeNotifier{ } Future TPCAgentsListAPIFunction( - BuildContext context, - String mode, { - bool append = false, - }) async { + BuildContext context, + String mode, { + bool append = false, + }) async { try { var provider = Provider.of(context, listen: false); @@ -144,7 +146,9 @@ class Tpcagentsprovider extends ChangeNotifier{ mode, _currentPage.toString(), // page number ); - debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage'); + debugPrint( + 'empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage', + ); if (data != null && data.error == "0") { if (append) { @@ -161,7 +165,7 @@ class Tpcagentsprovider extends ChangeNotifier{ if (!append) _errorMessage = "No agents found!"; _hasMoreData = false; } - } catch (e, s) { + } catch (e) { _errorMessage = "Error: $e"; } @@ -176,12 +180,10 @@ class Tpcagentsprovider extends ChangeNotifier{ await TPCAgentsListAPIFunction(context, mode, append: true); } - - Future TPCAgentsIssueListAPIFunction( - BuildContext context, { - bool append = false, - }) async { + BuildContext context, { + bool append = false, + }) async { try { var provider = Provider.of(context, listen: false); @@ -200,7 +202,9 @@ class Tpcagentsprovider extends ChangeNotifier{ provider.session, _currentPage.toString(), // page number ); - debugPrint('empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage'); + debugPrint( + 'empId: ${provider.empId}, session: ${provider.session}, pageNumber: $_currentPage', + ); if (data != null && data.error == "0") { if (append) { @@ -233,14 +237,13 @@ class Tpcagentsprovider extends ChangeNotifier{ await TPCAgentsIssueListAPIFunction(context, append: true); } - - Future TPCAgentsDetailsAPIFunction(context, tpc_agent_id) async { + Future TPCAgentsDetailsAPIFunction(context, tpcAgentId) async { try { var provider = Provider.of(context, listen: false); final data = await ApiCalling.TPCAgentDetailsAPI( provider.empId, provider.session, - tpc_agent_id, + tpcAgentId, ); if (data != null) { _tpcRequestedAmounts.clear(); @@ -250,7 +253,8 @@ class Tpcagentsprovider extends ChangeNotifier{ _tpcAgentDetails = data.tpcAgentDetails!; _tpcRequestedAmounts = data.tpcRequestedAmounts!; _isLoading = false; - _headings = ["Agent Name", + _headings = [ + "Agent Name", "Mobile Number", "TPC Agent Bank Name", "Bank Beneficiary Name", @@ -260,17 +264,17 @@ class Tpcagentsprovider extends ChangeNotifier{ "Order Received Date", "Created Date", "Note", - ]; + ]; _subHeadings = [ - _tpcAgentDetails.name??"-", - _tpcAgentDetails.mobileNumber??"-", - _tpcAgentDetails.bankName??"-", - _tpcAgentDetails.bankBeneficiaryName??"-", - _tpcAgentDetails.bankAccountNo??"-", - _tpcAgentDetails.bankIfscCode??"-", - _tpcAgentDetails.idProofViewFileName??"-", - _tpcAgentDetails.createdDatetime??"-", - _tpcAgentDetails.note??"-" + _tpcAgentDetails.name ?? "-", + _tpcAgentDetails.mobileNumber ?? "-", + _tpcAgentDetails.bankName ?? "-", + _tpcAgentDetails.bankBeneficiaryName ?? "-", + _tpcAgentDetails.bankAccountNo ?? "-", + _tpcAgentDetails.bankIfscCode ?? "-", + _tpcAgentDetails.idProofViewFileName ?? "-", + _tpcAgentDetails.createdDatetime ?? "-", + _tpcAgentDetails.note ?? "-", ]; notifyListeners(); @@ -279,10 +283,10 @@ class Tpcagentsprovider extends ChangeNotifier{ } notifyListeners(); } - } catch (e, s) {} + } catch (e) {} } - Future TPCAgentsIssueApprovalAPIFunction(context, orderID,) async { + Future TPCAgentsIssueApprovalAPIFunction(context, orderID) async { try { if (!validateApproveForm(context)) { // _submitClicked = false; @@ -294,14 +298,13 @@ class Tpcagentsprovider extends ChangeNotifier{ final data = await ApiCalling.TpcIssueListApprovalAPI( provider.empId, provider.session, - tpcPaymentModeController.text, - tpcPaymentReferenceNoController.text, - orderID, - orderTpcFeedbackController.text, - _image + tpcPaymentModeController.text, + tpcPaymentReferenceNoController.text, + orderID, + orderTpcFeedbackController.text, + _image, ); if (data != null) { - if (data.error == "0") { _submitClicked = false; toast(context, "Submitted Successfully"); @@ -309,19 +312,17 @@ class Tpcagentsprovider extends ChangeNotifier{ resetApprovalForm(); Navigator.pop(context, true); notifyListeners(); - }else{ + } else { _submitClicked = false; notifyListeners(); } - }else{ + } else { _submitClicked = false; notifyListeners(); } - } catch (e, s) { - - _submitClicked = false; - notifyListeners(); - + } catch (e) { + _submitClicked = false; + notifyListeners(); } } @@ -337,18 +338,16 @@ class Tpcagentsprovider extends ChangeNotifier{ final data = await ApiCalling.ordersAddTPCAgentAPI( provider.empId, provider.session, - tpcNameController.text, - tpcMobileNumberController.text, - tpcBankNameController.text, - tpcBankBeneficiaryNameController.text, - tpcBankAccountNumberController.text, - tpcBankIFSCController.text, - tpcNoteController.text, - _image - + tpcNameController.text, + tpcMobileNumberController.text, + tpcBankNameController.text, + tpcBankBeneficiaryNameController.text, + tpcBankAccountNumberController.text, + tpcBankIFSCController.text, + tpcNoteController.text, + _image, ); if (data != null) { - if (data.error == "0") { _submitClicked = false; toast(context, "Submitted Successfully"); @@ -356,15 +355,15 @@ class Tpcagentsprovider extends ChangeNotifier{ resetAddTPCAgentForm(); Navigator.pop(context, true); notifyListeners(); - }else{ + } else { _submitClicked = false; notifyListeners(); } - }else{ + } else { _submitClicked = false; notifyListeners(); } - } catch (e, s) { + } catch (e) { _submitClicked = false; notifyListeners(); } @@ -382,36 +381,37 @@ class Tpcagentsprovider extends ChangeNotifier{ bool isValid = true; - if(tpcNameController.text.trim().isEmpty){ + if (tpcNameController.text.trim().isEmpty) { tpcNameError = "Please Enter Your Name"; isValid = false; } - if(tpcMobileNumberController.text.trim().isEmpty){ + if (tpcMobileNumberController.text.trim().isEmpty) { tpcMobileNumberError = "PLease Enter Your Mobile Number"; isValid = false; } - if(tpcMobileNumberController.text.trim().isNotEmpty && tpcMobileNumberController.text.length<10){ + if (tpcMobileNumberController.text.trim().isNotEmpty && + tpcMobileNumberController.text.length < 10) { tpcMobileNumberError = "Please Enter a Valid Mobile Number"; isValid = false; } - if(_image_picked==0){ + if (_image_picked == 0) { imageError = "Please select ID Proof"; isValid = false; } - if(tpcBankNameController.text.trim().isEmpty){ + if (tpcBankNameController.text.trim().isEmpty) { tpcBankNameError = "Please Enter Bank Name"; isValid = false; } - if(tpcBankBeneficiaryNameController.text.trim().isEmpty){ + if (tpcBankBeneficiaryNameController.text.trim().isEmpty) { tpcBankBeneficiaryNameError = "Please Enter Beneficiery Name"; isValid = false; } - if(tpcBankAccountNumberController.text.trim().isEmpty){ + if (tpcBankAccountNumberController.text.trim().isEmpty) { tpcBankAccountNumberError = "Please Enter Account Number"; isValid = false; } - if(tpcBankIFSCController.text.trim().isEmpty){ + if (tpcBankIFSCController.text.trim().isEmpty) { tpcBankIFSCError = "Please Enter IFSC"; isValid = false; } @@ -434,65 +434,71 @@ class Tpcagentsprovider extends ChangeNotifier{ isValid = false; } - if (tpcPaymentReferenceNoController.text.trim().isEmpty) { - tpcPaymentReferenceNoError = "Please enter a description"; - isValid = false; - } - if (orderTpcFeedbackController.text.trim().isEmpty) { - orderTpcFeedbackError = "Please enter a description"; - isValid = false; - } + if (tpcPaymentReferenceNoController.text.trim().isEmpty) { + tpcPaymentReferenceNoError = "Please enter a description"; + isValid = false; + } + if (orderTpcFeedbackController.text.trim().isEmpty) { + orderTpcFeedbackError = "Please enter a description"; + isValid = false; + } _submitClicked = false; notifyListeners(); return isValid; } - void onChangeTPCPayment(value){ + void onChangeTPCPayment(value) { tpcPaymentModeError = ""; notifyListeners(); } - void onChangeTPCPaymentReference(value){ + void onChangeTPCPaymentReference(value) { tpcPaymentReferenceNoError = ""; notifyListeners(); } - void onChangeTpcFeedback(value){ + void onChangeTpcFeedback(value) { orderTpcFeedbackError = ""; notifyListeners(); } - void onChangetpcName(value){ + void onChangetpcName(value) { tpcNameError = ""; notifyListeners(); } - void onChangetpcMobileNumber(value){ + + void onChangetpcMobileNumber(value) { tpcMobileNumberError = ""; notifyListeners(); } - void onChangetpcBankName(value){ + + void onChangetpcBankName(value) { tpcBankNameError = ""; notifyListeners(); } - void onChangetpcBankBeneficiaryName(value){ + + void onChangetpcBankBeneficiaryName(value) { tpcBankBeneficiaryNameError = ""; notifyListeners(); } - void onChangetpcBankAccountNumber(value){ + + void onChangetpcBankAccountNumber(value) { tpcBankAccountNumberError = ""; notifyListeners(); } - void onChangetpcBankIFSC(value){ + + void onChangetpcBankIFSC(value) { tpcBankIFSCError = ""; notifyListeners(); } - void onChangetpcNote(value){ + + void onChangetpcNote(value) { tpcNoteError = ""; notifyListeners(); } @@ -536,7 +542,7 @@ class Tpcagentsprovider extends ChangeNotifier{ notifyListeners(); } - void resetAll(){ + void resetAll() { tpcNameController.clear(); tpcMobileNumberController.clear(); tpcBankNameController.clear(); @@ -562,8 +568,8 @@ class Tpcagentsprovider extends ChangeNotifier{ _image_picked = 0; imageError = null; notifyListeners(); - } + imgFromCamera(context) async { // Capture a photo try { @@ -574,7 +580,7 @@ class Tpcagentsprovider extends ChangeNotifier{ debugPrint("added"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; imageError = null; notifyListeners(); @@ -596,7 +602,7 @@ class Tpcagentsprovider extends ChangeNotifier{ debugPrint("Jenny: bytes:$bytes, kb:$kb, mb: $mb"); _image = File(galleryImage!.path); - _imageName = File(galleryImage!.name); + _imageName = File(galleryImage.name); _image_picked = 1; imageError = null; notifyListeners(); @@ -605,4 +611,4 @@ class Tpcagentsprovider extends ChangeNotifier{ debugPrint("mmmm: ${e.toString()}"); } } -} \ No newline at end of file +} diff --git a/lib/Notifiers/scanLoginProvider.dart b/lib/Notifiers/scanLoginProvider.dart index 6c1384a..c1abb20 100644 --- a/lib/Notifiers/scanLoginProvider.dart +++ b/lib/Notifiers/scanLoginProvider.dart @@ -9,8 +9,7 @@ import 'package:qr_code_scanner/qr_code_scanner.dart'; import '../Utils/commonServices.dart'; import 'HomeScreenNotifier.dart'; -class Scanloginprovider extends ChangeNotifier{ - +class Scanloginprovider extends ChangeNotifier { PermissionStatus _cameraPermissionStatus = PermissionStatus.denied; QRViewController? _qrViewController; bool _hasPermission = false; @@ -32,8 +31,9 @@ class Scanloginprovider extends ChangeNotifier{ _hasPermission = false; } } - } catch (e, s) {} + } catch (e) {} } + Future requestCameraPermission() async { PermissionStatus status = await Permission.camera.request(); @@ -49,63 +49,62 @@ class Scanloginprovider extends ChangeNotifier{ _hasPermission = false; await Permission.camera.request(); } - } catch (e, s) {} + } catch (e) {} } + void onQRViewCreated(QRViewController controller, context) { // print("QRVIEW"); var HomeProvider = Provider.of(context, listen: false); - this._qrViewController = controller; + _qrViewController = controller; controller.scannedDataStream.listen((scanData) { - controller!.pauseCamera(); + controller.pauseCamera(); Map obj = jsonDecode(scanData.code!); if (obj["type"] == "login") { - if(kDebugMode){ + if (kDebugMode) { print("type:" + obj["type"]); print("token:" + (obj["data"]["token"])); } - controller!.pauseCamera(); + controller.pauseCamera(); - LoadQRAPIFunction(context,obj["type"], (obj["data"]["token"])); + LoadQRAPIFunction(context, obj["type"], (obj["data"]["token"])); } }); } - Future LoadQRAPIFunction(context,type, token) async { - - + Future LoadQRAPIFunction(context, type, token) async { try { - var homeProvider = Provider.of(context,listen: false); - final data = await ApiCalling.QRLoginRequestAPI(homeProvider.empId, homeProvider.session, type, token); - - if (data != null) - { - - if (data.sessionExists == 1) { - if (data.error == 0) { - Navigator.pop(context); - toast(context, "Login Successful!!"); - } else if (data.error == 1) { - toast(context, data.message); - toast(context, "Session Expired, Please Try Again!!"); - } else if (data.error == 2) { - toast(context, data.message); - toast(context, "Something Went wrong, Please Try Again!!"); - } else { - toast(context, - "Something Went wrong, Please Try Again!"); - } - } else { - toast(context, - "Your session has expired, please login again!"); - } + var homeProvider = Provider.of( + context, + listen: false, + ); + final data = await ApiCalling.QRLoginRequestAPI( + homeProvider.empId, + homeProvider.session, + type, + token, + ); + if (data != null) { + if (data.sessionExists == 1) { + if (data.error == 0) { + Navigator.pop(context); + toast(context, "Login Successful!!"); + } else if (data.error == 1) { + toast(context, data.message); + toast(context, "Session Expired, Please Try Again!!"); + } else if (data.error == 2) { + toast(context, data.message); + toast(context, "Something Went wrong, Please Try Again!!"); + } else { + toast(context, "Something Went wrong, Please Try Again!"); } - else - {} - + } else { + toast(context, "Your session has expired, please login again!"); + } + } else {} } on Error catch (e) { print(e.toString()); } } -} \ No newline at end of file +} diff --git a/lib/Notifiers/splashVersionNotifier.dart b/lib/Notifiers/splashVersionNotifier.dart index e6c2265..e1c58df 100644 --- a/lib/Notifiers/splashVersionNotifier.dart +++ b/lib/Notifiers/splashVersionNotifier.dart @@ -53,7 +53,6 @@ class SplashVersionNotifier extends ChangeNotifier { final data = await ApiCalling.checkAppVersionApi(); if (data != null) { - if (kDebugMode) { print("Current Build: $currentBuild"); print("Server Response: $data"); @@ -99,22 +98,28 @@ class SplashVersionNotifier extends ChangeNotifier { if (data.updatePasswordRequired == 0) { Navigator.push( context, - MaterialPageRoute(builder: (context) => MyHomePage(), - settings: RouteSettings(name: "MyHomePage")), + MaterialPageRoute( + builder: (context) => MyHomePage(), + settings: RouteSettings(name: "MyHomePage"), + ), ); } else if (data.updatePasswordRequired == 1) { Navigator.push( context, - MaterialPageRoute(builder: (context) => UpdatePassword(), - settings: RouteSettings(name: "UpdatePassword")), + MaterialPageRoute( + builder: (context) => UpdatePassword(), + settings: RouteSettings(name: "UpdatePassword"), + ), ); } } else { // print("goes here"); Navigator.push( context, - MaterialPageRoute(builder: (context) => LoginScreen(), - settings: RouteSettings(name: "LoginScreen")), + MaterialPageRoute( + builder: (context) => LoginScreen(), + settings: RouteSettings(name: "LoginScreen"), + ), ); // toast(context, // "Your Session has been expired, Please Login Again"); @@ -142,8 +147,8 @@ class SplashVersionNotifier extends ChangeNotifier { const SizedBox(height: 16), TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white70), + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white70), ), onPressed: () async { if (await canLaunchUrl(Uri.parse(apkurl))) { diff --git a/lib/main.dart b/lib/main.dart index fc338c5..8fa095b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -226,7 +226,9 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider(create: (_) => Dispatchorderprovider()), ChangeNotifierProvider(create: (_) => followUpUpdateProvider()), ChangeNotifierProvider(create: (_) => Appointmentcalendarprovider()), - ChangeNotifierProvider(create: (_) => Addnewleadsandprospectsprovider()), + ChangeNotifierProvider( + create: (_) => Addnewleadsandprospectsprovider(), + ), ChangeNotifierProvider(create: (_) => HrmAccessiblePagesProvider()), ChangeNotifierProvider(create: (_) => Attendancelistprovider()), ChangeNotifierProvider(create: (_) => AttendanceDetailsProvider()), @@ -240,7 +242,7 @@ class MyApp extends StatelessWidget { builder: (BuildContext context) { return MaterialApp( scrollBehavior: const MaterialScrollBehavior().copyWith( - dragDevices: {PointerDeviceKind.touch,PointerDeviceKind.mouse}, + dragDevices: {PointerDeviceKind.touch, PointerDeviceKind.mouse}, ), navigatorObservers: [MyNavigatorObserver()], @@ -259,7 +261,6 @@ class MyApp extends StatelessWidget { highlightColor: Colors.transparent, hoverColor: Colors.transparent, scaffoldBackgroundColor: Colors.white, - dialogBackgroundColor: Colors.white, cardColor: Colors.white, shadowColor: Colors.white54, searchBarTheme: const SearchBarThemeData(), @@ -303,8 +304,8 @@ class MyApp extends StatelessWidget { dragHandleSize: Size(60.0, 6.0), ), colorScheme: const ColorScheme.light( - background: Colors.white, - ).copyWith(background: Colors.white), + surface: Colors.white, + ).copyWith(surface: Colors.white), scrollbarTheme: ScrollbarThemeData( minThumbLength: 20, interactive: true, @@ -315,10 +316,8 @@ class MyApp extends StatelessWidget { ), ), checkboxTheme: CheckboxThemeData( - side: BorderSide(width: 0.5), checkColor: WidgetStatePropertyAll(AppColors.white), - ), useMaterial3: true, // inputDecorationTheme: InputDecorationTheme( diff --git a/lib/screens/AttendanceScreen.dart b/lib/screens/AttendanceScreen.dart index ef85196..5da24d5 100644 --- a/lib/screens/AttendanceScreen.dart +++ b/lib/screens/AttendanceScreen.dart @@ -20,7 +20,6 @@ class AttendanceScreen extends StatefulWidget { } class _AttendanceScreenState extends State { - // var homeProvider; Map _source = {ConnectivityResult.mobile: true}; final MyConnectivity _connectivity = MyConnectivity.instance; @@ -32,11 +31,17 @@ class _AttendanceScreenState extends State { _connectivity.myStream.listen((source) { setState(() => _source = source); }); - final homeProvider = Provider.of(context, listen: false); + final homeProvider = Provider.of( + context, + listen: false, + ); WidgetsBinding.instance.addPostFrameCallback((_) { - final att_provider = Provider.of(context, listen: false); - att_provider.getAttendanceList(context); - att_provider.init(context); + final attProvider = Provider.of( + context, + listen: false, + ); + attProvider.getAttendanceList(context); + attProvider.init(context); }); } @@ -146,7 +151,7 @@ class _AttendanceScreenState extends State { resizeToAvoidBottomInset: true, backgroundColor: AppColors.scaffold_bg_color, appBar: appbarNew(context, "Attendance", 0xFFFFFFFF), - body:SingleChildScrollView( + body: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -189,12 +194,20 @@ class _AttendanceScreenState extends State { final times = [formattedTime, formattedTime2]; final periods = [period, period2]; final locations = [ - attendance.attendanceHistory.isNotEmpty? attendance - .attendanceHistory - .first['check_in_location'].toString()??"-":"-", - attendance.attendanceHistory.isNotEmpty? attendance - .attendanceHistory - .first['check_out_location'].toString()??"-":"-", + attendance.attendanceHistory.isNotEmpty + ? attendance + .attendanceHistory + .first['check_in_location'] + .toString() ?? + "-" + : "-", + attendance.attendanceHistory.isNotEmpty + ? attendance + .attendanceHistory + .first['check_out_location'] + .toString() ?? + "-" + : "-", ]; return Expanded( child: Container( @@ -325,8 +338,7 @@ class _AttendanceScreenState extends State { borderRadius: BorderRadius.circular(20), ), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( @@ -372,10 +384,7 @@ class _AttendanceScreenState extends State { ///calendar Container( // padding: EdgeInsets.symmetric(horizontal: 10,vertical: 5), - margin: EdgeInsets.symmetric( - horizontal: 15, - vertical: 10, - ), + margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), color: Colors.white, @@ -386,16 +395,14 @@ class _AttendanceScreenState extends State { padding: const EdgeInsets.fromLTRB(30, 10, 30, 0), child: Container( child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ SizedBox( child: Row( children: [ GestureDetector( onTap: () { - attendance.setPreviousMonth( - context, ); + attendance.setPreviousMonth(context); }, child: Padding( padding: const EdgeInsets.all(4.0), @@ -405,7 +412,9 @@ class _AttendanceScreenState extends State { ), ), Padding( - padding: const EdgeInsets.symmetric(horizontal: 5.0), + padding: const EdgeInsets.symmetric( + horizontal: 5.0, + ), child: Text( monthLabel, style: TextStyle( @@ -417,11 +426,9 @@ class _AttendanceScreenState extends State { ), GestureDetector( onTap: () { - attendance.setNextMonth( - context, - ); + attendance.setNextMonth(context); }, - child: Padding( + child: Padding( padding: const EdgeInsets.all(4.0), child: SvgPicture.asset( "assets/svg/crm/calendar_right.svg", @@ -568,9 +575,7 @@ class _AttendanceScreenState extends State { } attendance.selectedDate = currentDay.toString(); - _showAttDetailsBottomSheet( - context, - ); + _showAttDetailsBottomSheet(context); }, child: Card( elevation: 0, @@ -635,8 +640,7 @@ class _AttendanceScreenState extends State { fontWeight: FontWeight.w400, color: isFutureDate - ? AppColors - .semi_black + ? AppColors.semi_black : (isCurrentDay || (selectedIndex == index)) @@ -651,8 +655,7 @@ class _AttendanceScreenState extends State { ? Color(0xFF6B3A02) : dateColor == 'y' ? Color(0xFF605C00) - : Colors - .transparent, + : Colors.transparent, ), ), ), @@ -695,14 +698,9 @@ class _AttendanceScreenState extends State { ), ); if (res == true) { - attendance.getAttendanceList( - context, - ); - attendance.init( context); - attendance.loadAttendanceDetails( - - context, - ); + attendance.getAttendanceList(context); + attendance.init(context); + attendance.loadAttendanceDetails(context); } var f = FocusScope.of(context); @@ -806,14 +804,14 @@ class _AttendanceScreenState extends State { Color(0xFFFFE8D0), Color(0xFFFFF9B2), ]; - final text_colors = [ + final textColors = [ Color(0xFF493272), Color(0xFF0D9C00), Color(0xFFFF0000), Color(0xFF6B3A02), Color(0xFF605C00), ]; - final text_subs = ["24", "7", "13", "17", "2"]; + final textSubs = ["24", "7", "13", "17", "2"]; final text = [ "Holiday", "Present", @@ -835,9 +833,9 @@ class _AttendanceScreenState extends State { ), child: Center( child: Text( - text_subs[index], + textSubs[index], style: TextStyle( - color: text_colors[index], + color: textColors[index], fontSize: 10, ), ), diff --git a/lib/screens/CheckInScreen.dart b/lib/screens/CheckInScreen.dart index c2817e5..16e40fe 100644 --- a/lib/screens/CheckInScreen.dart +++ b/lib/screens/CheckInScreen.dart @@ -6,7 +6,6 @@ import 'package:flutter_image_compress/flutter_image_compress.dart'; import 'package:generp/Utils/app_colors.dart'; import 'package:generp/Utils/commonWidgets.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:image_picker/image_picker.dart'; import 'package:provider/provider.dart'; import '../Notifiers/CheckInProvider.dart'; @@ -15,7 +14,7 @@ import 'FrontCameraCapture.dart'; class CheckInOutScreen extends StatefulWidget { final int getAttendanceStatus; - const CheckInOutScreen({super.key,required this.getAttendanceStatus}); + const CheckInOutScreen({super.key, required this.getAttendanceStatus}); @override State createState() => _CheckInOutScreenState(); @@ -31,7 +30,7 @@ class _CheckInOutScreenState extends State { _connectivity.initialise(); _connectivity.myStream.listen((source) { setState(() => _source = source); - },); + }); WidgetsBinding.instance.addPostFrameCallback((_) { var prov = Provider.of(context, listen: false); prov.getLocationPermission(context); @@ -46,8 +45,6 @@ class _CheckInOutScreenState extends State { _connectivity.disposeStream(); } - - @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -64,244 +61,271 @@ class _CheckInOutScreenState extends State { Size size = MediaQuery.of(context).size; double screenWidth = MediaQuery.of(context).size.width; - return (connection=='Online')?Consumer( - builder: (context, provider, child) { - return WillPopScope( - onWillPop: () { - provider.dispose(); - return onBackPressed(context);}, - child: SafeArea( - top: false, - bottom: Platform.isIOS?false:true, - child: Scaffold( - resizeToAvoidBottomInset: true, - appBar: appbar2(context, widget.getAttendanceStatus==0? "Check In":"Check Out", provider.dispose,SizedBox(width: 0,)), - body:Container( - child: SafeArea( - child: Column( - children: [ - Expanded( - child: Stack( - children: [ - GoogleMap( - myLocationEnabled: true, - zoomGesturesEnabled: true, - scrollGesturesEnabled: false, - initialCameraPosition: CameraPosition( - target: provider.currentLocationLatLng ?? - provider.startLocation, - zoom: 20.0, - ), - markers: provider.markers.toSet(), - myLocationButtonEnabled: true, - mapType: MapType.normal, - onMapCreated: (controller) { - provider.mapController = controller; - provider.getCurrentLocation(); - provider.getLocationPermission(context); - }, - onCameraMove: (position) { - provider.onCameraMove(position,context); - }, - ), - Positioned( - left: 0, - right: 0, - bottom: 0, - child: Container( - height: size.height * 0.3, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30.0), - topRight: Radius.circular(30.0), + return (connection == 'Online') + ? Consumer( + builder: (context, provider, child) { + return WillPopScope( + onWillPop: () { + provider.dispose(); + return onBackPressed(context); + }, + child: SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + appBar: appbar2( + context, + widget.getAttendanceStatus == 0 ? "Check In" : "Check Out", + provider.dispose, + SizedBox(width: 0), + ), + body: Container( + child: SafeArea( + child: Column( + children: [ + Expanded( + child: Stack( + children: [ + GoogleMap( + myLocationEnabled: true, + zoomGesturesEnabled: true, + scrollGesturesEnabled: false, + initialCameraPosition: CameraPosition( + target: + provider.currentLocationLatLng ?? + provider.startLocation, + zoom: 20.0, ), + markers: provider.markers.toSet(), + myLocationButtonEnabled: true, + mapType: MapType.normal, + onMapCreated: (controller) { + provider.mapController = controller; + provider.getCurrentLocation(); + provider.getLocationPermission(context); + }, + onCameraMove: (position) { + provider.onCameraMove(position, context); + }, ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox(height: 25), - - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Share Your Details", - style: TextStyle( - color: AppColors.app_blue, - fontFamily: "JakartaSemiBold" - ), - ), - SizedBox(height: 10,), - Text( - "Location", - style: TextStyle( - fontFamily: "JakartaMedium", - color: AppColors.semi_black, - ), - ), - ], + Positioned( + left: 0, + right: 0, + bottom: 0, + child: Container( + height: size.height * 0.3, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30.0), + topRight: Radius.circular(30.0), ), ), - SizedBox(height: 5), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20.0), - child: Container( - height: 50, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox(height: 25), - alignment: Alignment.center, - decoration: BoxDecoration( - color: AppColors.text_field_color, - borderRadius: - BorderRadius.circular(14), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 20.0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + "Share Your Details", + style: TextStyle( + color: AppColors.app_blue, + fontFamily: "JakartaSemiBold", + ), + ), + SizedBox(height: 10), + Text( + "Location", + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.semi_black, + ), + ), + ], + ), ), - child: Padding( - padding: - const EdgeInsets.fromLTRB( - 10.0, 0.0, 10, 0), - child: TextFormField( - controller: - provider.locationController, - keyboardType: - TextInputType.text, - onChanged: (value) { - provider.validateLocation = ""; - provider.notifyListeners(); - }, - decoration: InputDecoration( + SizedBox(height: 5), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 20.0, + ), + child: Container( + height: 50, - hintText: - "Enter Check ${widget.getAttendanceStatus==0?"In":"Out"} Location", - hintStyle: TextStyle( - fontWeight: FontWeight.w400, - fontSize: 14, - color: Color(0xFF818181) + alignment: Alignment.center, + decoration: BoxDecoration( + color: AppColors.text_field_color, + borderRadius: + BorderRadius.circular(14), + ), + child: Padding( + padding: + const EdgeInsets.fromLTRB( + 10.0, + 0.0, + 10, + 0, + ), + child: TextFormField( + controller: + provider.locationController, + keyboardType: + TextInputType.text, + onChanged: (value) { + provider.validateLocation = + ""; + provider.notifyListeners(); + }, + decoration: InputDecoration( + hintText: + "Enter Check ${widget.getAttendanceStatus == 0 ? "In" : "Out"} Location", + hintStyle: TextStyle( + fontWeight: FontWeight.w400, + fontSize: 14, + color: Color(0xFF818181), + ), + enabledBorder: + InputBorder.none, + focusedBorder: + InputBorder.none, + ), ), - enabledBorder: - InputBorder.none, - focusedBorder: - InputBorder.none, ), - ), ), - ), - ), - if (provider.validateLocation != null) - Padding( - padding: - const EdgeInsets.symmetric( - horizontal: 20.0), - child: Container( - alignment: Alignment.topLeft, - margin: EdgeInsets.only( - top: 2.5, - bottom: 2.5, - left: 25), - child: Text( - provider.validateLocation!, - textAlign: TextAlign.start, - style: TextStyle( - color: Colors.red, + if (provider.validateLocation != null) + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 20.0, + ), + child: Container( + alignment: Alignment.topLeft, + margin: EdgeInsets.only( + top: 2.5, + bottom: 2.5, + left: 25, + ), + child: Text( + provider.validateLocation!, + textAlign: TextAlign.start, + style: TextStyle( + color: Colors.red, + ), + ), ), + ) + else + SizedBox(height: 5.0), + SizedBox(height: 20), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 20.0, ), - ), - ) - else - SizedBox(height: 5.0), - SizedBox(height: 20), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 20.0), - child: InkWell( - onTap: () async { - if (provider - .locationController - .text - .isEmpty) { - provider.validateLocation = - "Please Enter location"; - provider.notifyListeners(); - } else { - provider.validateLocation = ""; - if (Platform.isAndroid) { - provider.image = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - FrontCameraCapture())); - print("${provider.image}"); - if(provider.image!=null){ - provider.imagePicked = 1; - } - var file = await FlutterImageCompress.compressWithFile( - provider.image!.path, - ); - if (file != null) { - if (widget.getAttendanceStatus == 0) { - provider.checkIn(context); - } else if (widget.getAttendanceStatus == 1) { - provider.checkOut(context); + child: InkWell( + onTap: () async { + if (provider + .locationController + .text + .isEmpty) { + provider.validateLocation = + "Please Enter location"; + provider.notifyListeners(); + } else { + provider.validateLocation = ""; + if (Platform.isAndroid) { + provider + .image = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + FrontCameraCapture(), + ), + ); + print("${provider.image}"); + if (provider.image != null) { + provider.imagePicked = 1; + } + var file = + await FlutterImageCompress.compressWithFile( + provider.image!.path, + ); + if (file != null) { + if (widget + .getAttendanceStatus == + 0) { + provider.checkIn(context); + } else if (widget + .getAttendanceStatus == + 1) { + provider.checkOut( + context, + ); + } + } + } else if (Platform.isIOS) { + // BackgroundLocation.stopLocationService(); + provider.imgFromCamera( + context, + widget.getAttendanceStatus, + ); + // setState(() { + // isLoading = true; + // image_picked = 0; + // CheckIn(); + // }); } } + }, + child: Container( + alignment: Alignment.center, + height: 45, + width: screenWidth, - } else if (Platform.isIOS) { - // BackgroundLocation.stopLocationService(); - provider.imgFromCamera( - context,widget.getAttendanceStatus); - // setState(() { - // isLoading = true; - // image_picked = 0; - // CheckIn(); - // }); - } - - - } - }, - child: Container( - alignment: Alignment.center, - height: 45, - width: screenWidth, - - decoration: BoxDecoration( - color: AppColors.app_blue, - borderRadius: - BorderRadius.circular(15.0), - ), - child: Text( - widget.getAttendanceStatus==0? "Check In":"Check Out", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 16, - color: Colors.white + decoration: BoxDecoration( + color: AppColors.app_blue, + borderRadius: + BorderRadius.circular(15.0), + ), + child: Text( + widget.getAttendanceStatus == 0 + ? "Check In" + : "Check Out", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 16, + color: Colors.white, + ), + ), ), ), ), - ), + ], ), - ], + ), ), - ), + ], ), - ], - ), + ), + ], ), - ], + ), ), ), ), - ), - ), - ); - }, - ):NoNetwork(context); + ); + }, + ) + : NoNetwork(context); } } - - diff --git a/lib/screens/CommonFilter2.dart b/lib/screens/CommonFilter2.dart index cbeb3ad..baf5bad 100644 --- a/lib/screens/CommonFilter2.dart +++ b/lib/screens/CommonFilter2.dart @@ -75,15 +75,14 @@ class CommonFilter2 { // Get formatted date range as a list of strings List getFormattedDateRange(DateTimeRange? dateRange) { if (dateRange != null) { - return [ - formatDate(dateRange.start), - formatDate(dateRange.end), - ]; + return [formatDate(dateRange.start), formatDate(dateRange.end)]; } return []; } - Future?> showFilterBottomSheet(BuildContext context) async { + Future?> showFilterBottomSheet( + BuildContext context, + ) async { String? tempSelectedValue = selectedValue; DateTimeRange? tempSelectedDateRange = selectedDateRange; DateTime? tempStartDate; @@ -93,8 +92,16 @@ class CommonFilter2 { String? tempSelectedType = selectedType ?? "All"; Widget buildCalendar(StateSetter setState) { - final firstDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month, 1); - final lastDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month + 1, 0); + final firstDayOfMonth = DateTime( + displayedMonth.year, + displayedMonth.month, + 1, + ); + final lastDayOfMonth = DateTime( + displayedMonth.year, + displayedMonth.month + 1, + 0, + ); final firstDayOfWeek = firstDayOfMonth.weekday; final daysInMonth = lastDayOfMonth.day; final daysBefore = (firstDayOfWeek - 1) % 7; @@ -102,32 +109,43 @@ class CommonFilter2 { List dayWidgets = []; final weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; - dayWidgets.addAll(weekdays.map((day) => Center( - child: Text( - day, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Colors.grey[700], + dayWidgets.addAll( + weekdays.map( + (day) => Center( + child: Text( + day, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.grey[700], + ), + ), ), ), - ))); + ); for (int i = 0; i < daysBefore; i++) { dayWidgets.add(Container()); } for (int day = 1; day <= daysInMonth; day++) { - final currentDate = DateTime(displayedMonth.year, displayedMonth.month, day); + final currentDate = DateTime( + displayedMonth.year, + displayedMonth.month, + day, + ); bool isSelected = false; bool isInRange = false; bool isOutsideRange = - currentDate.isBefore(DateTime(2020)) || currentDate.isAfter(DateTime(2100)); + currentDate.isBefore(DateTime(2020)) || + currentDate.isAfter(DateTime(2100)); if (tempStartDate != null && tempEndDate != null) { - isSelected = currentDate.isAtSameMomentAs(tempStartDate!) || + isSelected = + currentDate.isAtSameMomentAs(tempStartDate!) || currentDate.isAtSameMomentAs(tempEndDate!); - isInRange = currentDate.isAfter(tempStartDate!) && + isInRange = + currentDate.isAfter(tempStartDate!) && currentDate.isBefore(tempEndDate!) && !isSelected; } else if (tempStartDate != null) { @@ -136,49 +154,55 @@ class CommonFilter2 { dayWidgets.add( GestureDetector( - onTap: isOutsideRange - ? null - : () { - setState(() { - if (tempStartDate == null) { - tempStartDate = currentDate; - tempSelectedDateRange = null; - } else if (tempEndDate == null) { - if (currentDate.isBefore(tempStartDate!)) { - tempEndDate = tempStartDate; - tempStartDate = currentDate; - } else { - tempEndDate = currentDate; - } - tempSelectedDateRange = - DateTimeRange(start: tempStartDate!, end: tempEndDate!); - } else { - tempStartDate = currentDate; - tempEndDate = null; - tempSelectedDateRange = null; - } - }); - }, + onTap: + isOutsideRange + ? null + : () { + setState(() { + if (tempStartDate == null) { + tempStartDate = currentDate; + tempSelectedDateRange = null; + } else if (tempEndDate == null) { + if (currentDate.isBefore(tempStartDate!)) { + tempEndDate = tempStartDate; + tempStartDate = currentDate; + } else { + tempEndDate = currentDate; + } + tempSelectedDateRange = DateTimeRange( + start: tempStartDate!, + end: tempEndDate!, + ); + } else { + tempStartDate = currentDate; + tempEndDate = null; + tempSelectedDateRange = null; + } + }); + }, child: Container( margin: const EdgeInsets.all(2), decoration: BoxDecoration( - color: isSelected - ? Colors.blue[600] - : isInRange - ? Colors.blue[100] - : null, + color: + isSelected + ? Colors.blue[600] + : isInRange + ? Colors.blue[100] + : null, shape: BoxShape.circle, ), child: Center( child: Text( '$day', style: TextStyle( - color: isOutsideRange - ? Colors.grey[400] - : isSelected - ? Colors.white - : Colors.black, - fontWeight: isSelected ? FontWeight.bold : FontWeight.normal, + color: + isOutsideRange + ? Colors.grey[400] + : isSelected + ? Colors.white + : Colors.black, + fontWeight: + isSelected ? FontWeight.bold : FontWeight.normal, ), ), ), @@ -193,29 +217,38 @@ class CommonFilter2 { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( - onTap: displayedMonth.isAfter(DateTime(2020)) - ? () { - setState(() { - displayedMonth = - DateTime(displayedMonth.year, displayedMonth.month - 1); - }); - } - : null, + onTap: + displayedMonth.isAfter(DateTime(2020)) + ? () { + setState(() { + displayedMonth = DateTime( + displayedMonth.year, + displayedMonth.month - 1, + ); + }); + } + : null, child: SvgPicture.asset("assets/svg/arrow_left.svg"), ), Text( '${_monthName(displayedMonth.month)} ${displayedMonth.year}', - style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600), + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + ), ), GestureDetector( - onTap: displayedMonth.isBefore(DateTime(2100)) - ? () { - setState(() { - displayedMonth = - DateTime(displayedMonth.year, displayedMonth.month + 1); - }); - } - : null, + onTap: + displayedMonth.isBefore(DateTime(2100)) + ? () { + setState(() { + displayedMonth = DateTime( + displayedMonth.year, + displayedMonth.month + 1, + ); + }); + } + : null, child: SvgPicture.asset("assets/svg/arrow_right_new.svg"), ), ], @@ -225,8 +258,8 @@ class CommonFilter2 { child: GridView.count( crossAxisCount: 7, childAspectRatio: 1.2, - children: dayWidgets, physics: const NeverScrollableScrollPhysics(), + children: dayWidgets, ), ), ], @@ -265,8 +298,13 @@ class CommonFilter2 { const SizedBox(height: 20), /// Type filter - const Text("Type", - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500)), + const Text( + "Type", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + ), + ), const SizedBox(height: 8), DropdownButtonHideUnderline( child: Row( @@ -275,10 +313,15 @@ class CommonFilter2 { child: DropdownButton2( isExpanded: true, value: tempSelectedType, - items: typeItems - .map((type) => - DropdownMenuItem(value: type, child: Text(type))) - .toList(), + items: + typeItems + .map( + (type) => DropdownMenuItem( + value: type, + child: Text(type), + ), + ) + .toList(), onChanged: (value) { setState(() { tempSelectedType = value; @@ -296,8 +339,13 @@ class CommonFilter2 { const SizedBox(height: 20), /// Date range filter - const Text("Date Range", - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500)), + const Text( + "Date Range", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w500, + ), + ), const SizedBox(height: 8), DropdownButtonHideUnderline( child: Row( @@ -313,27 +361,32 @@ class CommonFilter2 { color: Colors.black, ), ), - items: filterItems - .map((String item) => - DropdownMenuItem( - value: item, child: Text( - item, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Colors.black, - ), - ) - ) - ) - .toList(), + items: + filterItems + .map( + (String item) => + DropdownMenuItem( + value: item, + child: Text( + item, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ), + ), + ), + ) + .toList(), value: tempSelectedValue, onChanged: (String? value) { if (value == null) return; setState(() { tempSelectedValue = value; if (value != 'Custom') { - tempSelectedDateRange = getDateRange(value); + tempSelectedDateRange = getDateRange( + value, + ); tempStartDate = null; tempEndDate = null; } else { @@ -353,47 +406,56 @@ class CommonFilter2 { ), ), + if (tempSelectedValue == 'Custom') ...[ + const SizedBox(height: 16), + Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.grey[300]!), + borderRadius: BorderRadius.circular(12), + ), + padding: const EdgeInsets.all(12), + child: buildCalendar(setState), + ), + if (tempSelectedDateRange != null) + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + 'Selected: ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.start)} to ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.end)}', + style: TextStyle( + fontSize: 14, + color: Colors.grey[600], + ), + ), + ), + ], - if (tempSelectedValue == 'Custom') ...[ - const SizedBox(height: 16), - Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.grey[300]!), - borderRadius: BorderRadius.circular(12), - ), - padding: const EdgeInsets.all(12), - child: buildCalendar(setState), - ), - if (tempSelectedDateRange != null) - Padding( - padding: const EdgeInsets.only(top: 12.0), - child: Text( - 'Selected: ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.start)} to ${DateFormat("dd MMM yyyy").format(tempSelectedDateRange!.end)}', - style: TextStyle(fontSize: 14, color: Colors.grey[600]), - ), - ), - ], - - - const SizedBox(height: 20), + const SizedBox(height: 20), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ TextButton( onPressed: () => Navigator.pop(context), - child: Text('Cancel', - style: TextStyle(color: Colors.grey[600])), + child: Text( + 'Cancel', + style: TextStyle(color: Colors.grey[600]), + ), ), const SizedBox(width: 8), ElevatedButton( onPressed: () { Navigator.pop(context, { - 'type': tempSelectedType, // if you store type separately - 'selectedValue': tempSelectedValue, // could be null - 'dateRange': tempSelectedDateRange, // could be null - 'formatted': tempSelectedDateRange != null - ? getFormattedDateRange(tempSelectedDateRange) - : null, + 'type': + tempSelectedType, // if you store type separately + 'selectedValue': + tempSelectedValue, // could be null + 'dateRange': + tempSelectedDateRange, // could be null + 'formatted': + tempSelectedDateRange != null + ? getFormattedDateRange( + tempSelectedDateRange, + ) + : null, }); }, style: ElevatedButton.styleFrom( @@ -405,7 +467,6 @@ class CommonFilter2 { ), child: const Text('Apply'), ), - ], ), ], @@ -432,7 +493,7 @@ class CommonFilter2 { 'September', 'October', 'November', - 'December' + 'December', ]; return months[month - 1]; } diff --git a/lib/screens/FrontCameraCapture.dart b/lib/screens/FrontCameraCapture.dart index be1b4e0..2cae9ec 100644 --- a/lib/screens/FrontCameraCapture.dart +++ b/lib/screens/FrontCameraCapture.dart @@ -11,7 +11,7 @@ import 'package:permission_handler/permission_handler.dart'; import '../Utils/commonServices.dart'; class FrontCameraCapture extends StatefulWidget { - const FrontCameraCapture({Key? key}) : super(key: key); + const FrontCameraCapture({super.key}); @override State createState() => _CheckOutScreenState(); @@ -56,7 +56,7 @@ class _CheckOutScreenState extends State { (camera) => camera.lensDirection == CameraLensDirection.front, ); // final frontCamera = CameraLensDirection.front; - cam_controller = CameraController(frontCamera, ResolutionPreset.max,); + cam_controller = CameraController(frontCamera, ResolutionPreset.max); await cam_controller.initialize(); @@ -82,59 +82,63 @@ class _CheckOutScreenState extends State { return SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( // appBar: AppBar(automaticallyImplyLeading: false), - body: isLoading - ? Center(child: CircularProgressIndicator()) - : Row( - children: [ - Expanded( - child: SizedBox( - height: double.infinity, - child: - cam_controller.value.isInitialized - ? Transform( - alignment: Alignment.center, - transform: Matrix4.rotationY(math.pi), - child: CameraPreview( - cam_controller, - child: Align( - alignment: Alignment.bottomCenter, - child: GestureDetector( - onTap: () async { - if (!cam_controller - .value - .isInitialized) - return; - final image = - await cam_controller - .takePicture(); - _image = File(image.path); - Navigator.pop(context, _image); - - }, - child: Container( - height: 100, - width: double.infinity, - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.black26 - ), - child: Center( - child: SvgPicture.asset("assets/svg/check_in_cam.svg",width: 50,height: 50,) - + body: + isLoading + ? Center(child: CircularProgressIndicator()) + : Row( + children: [ + Expanded( + child: SizedBox( + height: double.infinity, + child: + cam_controller.value.isInitialized + ? Transform( + alignment: Alignment.center, + transform: Matrix4.rotationY(math.pi), + child: CameraPreview( + cam_controller, + child: Align( + alignment: Alignment.bottomCenter, + child: GestureDetector( + onTap: () async { + if (!cam_controller + .value + .isInitialized) { + return; + } + final image = + await cam_controller + .takePicture(); + _image = File(image.path); + Navigator.pop(context, _image); + }, + child: Container( + height: 100, + width: double.infinity, + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.black26, + ), + child: Center( + child: SvgPicture.asset( + "assets/svg/check_in_cam.svg", + width: 50, + height: 50, + ), + ), + ), ), ), ), - ), - ), - ) - : Center(child: Text("Camera not ready")), - ), + ) + : Center(child: Text("Camera not ready")), + ), + ), + ], ), - ], - ), ), ); } diff --git a/lib/screens/JobDescription.dart b/lib/screens/JobDescription.dart index e7ef7e5..65a74d3 100644 --- a/lib/screens/JobDescription.dart +++ b/lib/screens/JobDescription.dart @@ -9,17 +9,16 @@ class JobDescriptionScreen extends StatefulWidget { final String designation; const JobDescriptionScreen({ - Key? key, + super.key, required this.htmlData, this.title = "Job Description", required this.designation, - }) : super(key: key); + }); @override State createState() => _JobDescriptionScreenState(); } - class _JobDescriptionScreenState extends State { @override Widget build(BuildContext context) { diff --git a/lib/screens/LoginScreen.dart b/lib/screens/LoginScreen.dart index ac7d357..c321c98 100644 --- a/lib/screens/LoginScreen.dart +++ b/lib/screens/LoginScreen.dart @@ -42,7 +42,7 @@ class _LoginScreenState extends State late FocusNode _passwordFocusNode; bool _isTextFieldFocused = false; - KeyboardVisibilityController _keyboardVisibilityController = + final KeyboardVisibilityController _keyboardVisibilityController = KeyboardVisibilityController(); @override @@ -118,8 +118,8 @@ class _LoginScreenState extends State actions: [ TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white), + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white), ), onPressed: () => Navigator.of(context).pop(false), child: Text( @@ -130,8 +130,8 @@ class _LoginScreenState extends State const SizedBox(height: 16), TextButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white70), + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white70), ), onPressed: () => SystemChannels.platform.invokeMethod( @@ -259,7 +259,7 @@ class _LoginScreenState extends State ) : Column( children: [ - Container( + SizedBox( width: 180, height: 120, child: Image.asset( @@ -363,7 +363,7 @@ class _LoginScreenState extends State ), ), ), - if (loginProv.emailError != null) ...[ + ...[ Container( alignment: Alignment.topLeft, margin: EdgeInsets.only( @@ -374,11 +374,12 @@ class _LoginScreenState extends State child: Text( loginProv.emailError, textAlign: TextAlign.start, - style: TextStyle(color: Colors.red,fontSize: 10,), + style: TextStyle( + color: Colors.red, + fontSize: 10, + ), ), ), - ] else ...[ - SizedBox(height: 10.0), ], Container( padding: EdgeInsets.only( @@ -486,7 +487,7 @@ class _LoginScreenState extends State ), ), ), - if (loginProv.passwordError != null) ...[ + ...[ Container( alignment: Alignment.topLeft, margin: EdgeInsets.only( @@ -503,10 +504,8 @@ class _LoginScreenState extends State ), ), ), - ] else ...[ - SizedBox(height: 15.0), ], - SizedBox(height: 10,), + SizedBox(height: 10), InkWell( onTap: loginProv.isLoading @@ -519,9 +518,7 @@ class _LoginScreenState extends State email.text, password.text, ); - var f = FocusScope.of( - context, - ); + var f = FocusScope.of(context); if (!f.hasPrimaryFocus) { f.unfocus(); @@ -550,9 +547,7 @@ class _LoginScreenState extends State child: loginProv.isLoading ? CircularProgressIndicator.adaptive( - padding: EdgeInsets.all( - 5, - ), + padding: EdgeInsets.all(5), valueColor: AlwaysStoppedAnimation( Colors.white, @@ -560,8 +555,7 @@ class _LoginScreenState extends State ) : Text( "Login", - textAlign: - TextAlign.center, + textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontFamily: @@ -609,7 +603,7 @@ class _LoginScreenState extends State ), touchThroughAreaShape: ClipAreaShape.rectangle, touchThroughAreaCornerRadius: 30, - content: Container( + content: SizedBox( height: 100, child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -652,7 +646,7 @@ class _LoginScreenState extends State BorderRadius.circular(10.0), ), child: Text( - '${loginProv.deviceId}', + loginProv.deviceId, style: TextStyle( fontSize: 16, color: AppColors.semi_black, diff --git a/lib/screens/ScannerLogin.dart b/lib/screens/ScannerLogin.dart index d8c7b13..4512255 100644 --- a/lib/screens/ScannerLogin.dart +++ b/lib/screens/ScannerLogin.dart @@ -26,7 +26,6 @@ class _ScannerloginState extends State { // TODO: implement initState _connectivity.initialise(); _connectivity.myStream.listen((source) { - setState(() => _source = source); }); @@ -70,7 +69,7 @@ class _ScannerloginState extends State { child: Column( children: [ Spacer(), - Container( + SizedBox( height: 250, child: QRView( diff --git a/lib/screens/UpdatePasswordScreen.dart b/lib/screens/UpdatePasswordScreen.dart index 6a8b196..09c9a00 100644 --- a/lib/screens/UpdatePasswordScreen.dart +++ b/lib/screens/UpdatePasswordScreen.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:generp/Notifiers/UpdatePasswordProvider.dart'; @@ -19,7 +18,7 @@ class UpdatePassword extends StatelessWidget { onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar(context, "Update Password"), @@ -49,90 +48,97 @@ class UpdatePassword extends StatelessWidget { SizedBox(height: 10), Container( alignment: Alignment.topLeft, - padding: EdgeInsets.symmetric(horizontal: 10), - child: Text("New Password",style: TextStyle( - color: AppColors.semi_black - ),)), + padding: EdgeInsets.symmetric(horizontal: 10), + child: Text( + "New Password", + style: TextStyle(color: AppColors.semi_black), + ), + ), SizedBox(height: 5), _buildTextField( - controller: provider.password, hintText: "New Password*", errorText: provider.passwordError, - obscureText: !provider.pwdVisible, + obscureText: !provider.pwdVisible, suffixIcon: IconButton( icon: - provider.pwdVisible - ?SvgPicture.asset( - width: 35, - height: 35, - "assets/svg/password_visible.svg", - ) - : SvgPicture.asset( - width: 35, - height: 35, - "assets/svg/password_invisible.svg", - ), + provider.pwdVisible + ? SvgPicture.asset( + width: 35, + height: 35, + "assets/svg/password_visible.svg", + ) + : SvgPicture.asset( + width: 35, + height: 35, + "assets/svg/password_invisible.svg", + ), onPressed: () { provider.pwdVisibility(); }, ), - onChanged: provider.onChangePassword + onChanged: provider.onChangePassword, ), SizedBox(height: 10), Container( - alignment: Alignment.topLeft, - padding: EdgeInsets.symmetric(horizontal: 10), - child: Text("Confirm Password",style: TextStyle( - color: AppColors.semi_black - ),)), + alignment: Alignment.topLeft, + padding: EdgeInsets.symmetric(horizontal: 10), + child: Text( + "Confirm Password", + style: TextStyle(color: AppColors.semi_black), + ), + ), SizedBox(height: 5), _buildTextField( controller: provider.confPassword, hintText: "Confirm New Password*", errorText: provider.confirmPasswordError, - obscureText: !provider.confPwdVisible, - suffixIcon: IconButton( - iconSize: 30, - icon: provider.confPwdVisible?SvgPicture.asset( - width: 35, - height: 35, - "assets/svg/password_visible.svg", - ) - : SvgPicture.asset( - width: 35, - height: 35, - "assets/svg/password_invisible.svg", - ), - onPressed: () { - provider.confPwdVisibility(); - }, - ), - onChanged: provider.onChangeConfPassword + obscureText: !provider.confPwdVisible, + suffixIcon: IconButton( + iconSize: 30, + icon: + provider.confPwdVisible + ? SvgPicture.asset( + width: 35, + height: 35, + "assets/svg/password_visible.svg", + ) + : SvgPicture.asset( + width: 35, + height: 35, + "assets/svg/password_invisible.svg", + ), + onPressed: () { + provider.confPwdVisibility(); + }, + ), + onChanged: provider.onChangeConfPassword, ), Spacer(), - InkWell( - onTap: () => provider.updatePassword(context), - child: Container( - alignment: Alignment.center, - height: 45, - margin: EdgeInsets.symmetric(horizontal: 15), - decoration: BoxDecoration( - color: AppColors.app_blue, - borderRadius: BorderRadius.circular(15.0), - ), - child:provider.isLoading + InkWell( + onTap: () => provider.updatePassword(context), + child: Container( + alignment: Alignment.center, + height: 45, + margin: EdgeInsets.symmetric(horizontal: 15), + decoration: BoxDecoration( + color: AppColors.app_blue, + borderRadius: BorderRadius.circular(15.0), + ), + child: + provider.isLoading ? CircularProgressIndicator( - color: Colors.white, - padding: EdgeInsets.all(7.5), - - ) + color: Colors.white, + padding: EdgeInsets.all(7.5), + ) : Text( - "Update", - style: TextStyle(color: Colors.white), - ), - ), - ), + "Update", + style: TextStyle( + color: Colors.white, + ), + ), + ), + ), SizedBox(height: 10), ], ), @@ -175,12 +181,10 @@ class UpdatePassword extends StatelessWidget { obscureText: obscureText, decoration: InputDecoration( hintText: hintText, - hintStyle: TextStyle(color: Color(0xFF818181), - fontSize: 14), + hintStyle: TextStyle(color: Color(0xFF818181), fontSize: 14), border: InputBorder.none, suffixIcon: suffixIcon, ), - ), ), ), diff --git a/lib/screens/WebERPScreen.dart b/lib/screens/WebERPScreen.dart index c30b476..9698213 100644 --- a/lib/screens/WebERPScreen.dart +++ b/lib/screens/WebERPScreen.dart @@ -34,7 +34,6 @@ Future runErpScreenApp() async { class WebErpScreen extends StatefulWidget { final String erp_url; - const WebErpScreen({super.key, required this.erp_url}); @override @@ -42,7 +41,6 @@ class WebErpScreen extends StatefulWidget { } class _WebErpScreenState extends State { - Map _source = {ConnectivityResult.mobile: true}; final MyConnectivity _connectivity = MyConnectivity.instance; @@ -141,266 +139,282 @@ class _WebErpScreenState extends State { } return true; // Allow default back button behavior }, - child: connection=="Online"?SafeArea( - top: false, - bottom: Platform.isIOS?false:true, - child: Scaffold( - resizeToAvoidBottomInset: true, - appBar: appbar(context, "ERP"), - body: Container( - child: Column( - children: [ - Expanded( - child: Stack( - children: [ - InAppWebView( - initialUrlRequest: URLRequest( - url: WebUri(widget.erp_url), - allowsCellularAccess: true, - allowsConstrainedNetworkAccess: true, - allowsExpensiveNetworkAccess: true, - ), - androidOnGeolocationPermissionsShowPrompt: ( - InAppWebViewController controller, - String origin, - ) async { - return GeolocationPermissionShowPromptResponse( - origin: origin, - allow: true, - retain: true, - ); - }, - initialOptions: InAppWebViewGroupOptions( - android: AndroidInAppWebViewOptions( - useWideViewPort: true, - loadWithOverviewMode: true, - allowContentAccess: true, - geolocationEnabled: true, - allowFileAccess: true, - databaseEnabled: true, - // Enables the WebView database - domStorageEnabled: true, - // Enables DOM storage - builtInZoomControls: true, - // Enables the built-in zoom controls - displayZoomControls: false, - // Disables displaying zoom controls - safeBrowsingEnabled: true, - // Enables Safe Browsing - clearSessionCache: true, - loadsImagesAutomatically: true, - thirdPartyCookiesEnabled: true, - blockNetworkImage: false, - supportMultipleWindows: true, - blockNetworkLoads: false, - networkAvailable: true, - useShouldInterceptRequest: true, - hardwareAcceleration: true, - - // Enable camera access - ), - ios: IOSInAppWebViewOptions( - allowsInlineMediaPlayback: true, - allowsLinkPreview: true, - allowsBackForwardNavigationGestures: true, - ), - crossPlatform: InAppWebViewOptions( - javaScriptEnabled: true, - useOnDownloadStart: true, - allowFileAccessFromFileURLs: true, - allowUniversalAccessFromFileURLs: true, - mediaPlaybackRequiresUserGesture: true, - ), - ), + child: + connection == "Online" + ? SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + appBar: appbar(context, "ERP"), + body: Container( + child: Column( + children: [ + Expanded( + child: Stack( + children: [ + InAppWebView( + initialUrlRequest: URLRequest( + url: WebUri(widget.erp_url), + allowsCellularAccess: true, + allowsConstrainedNetworkAccess: true, + allowsExpensiveNetworkAccess: true, + ), + androidOnGeolocationPermissionsShowPrompt: ( + InAppWebViewController controller, + String origin, + ) async { + return GeolocationPermissionShowPromptResponse( + origin: origin, + allow: true, + retain: true, + ); + }, + initialOptions: InAppWebViewGroupOptions( + android: AndroidInAppWebViewOptions( + useWideViewPort: true, + loadWithOverviewMode: true, + allowContentAccess: true, + geolocationEnabled: true, + allowFileAccess: true, + databaseEnabled: true, + // Enables the WebView database + domStorageEnabled: true, + // Enables DOM storage + builtInZoomControls: true, + // Enables the built-in zoom controls + displayZoomControls: false, + // Disables displaying zoom controls + safeBrowsingEnabled: true, + // Enables Safe Browsing + clearSessionCache: true, + loadsImagesAutomatically: true, + thirdPartyCookiesEnabled: true, + blockNetworkImage: false, + supportMultipleWindows: true, + blockNetworkLoads: false, + networkAvailable: true, + useShouldInterceptRequest: true, + hardwareAcceleration: true, + + // Enable camera access + ), + ios: IOSInAppWebViewOptions( + allowsInlineMediaPlayback: true, + allowsLinkPreview: true, + allowsBackForwardNavigationGestures: true, + ), + crossPlatform: InAppWebViewOptions( + javaScriptEnabled: true, + useOnDownloadStart: true, + allowFileAccessFromFileURLs: true, + allowUniversalAccessFromFileURLs: true, + mediaPlaybackRequiresUserGesture: true, + ), + ), - androidOnPermissionRequest: ( - InAppWebViewController controller, - String origin, - List resources, - ) async { - return PermissionRequestResponse( - resources: resources, - action: PermissionRequestResponseAction.GRANT, - ); - }, - onPermissionRequest: (controller, request) async { - return PermissionResponse( - resources: request.resources, - action: PermissionResponseAction.GRANT, - ); - }, - keepAlive: InAppWebViewKeepAlive(), - - onWebViewCreated: (controller) { - _webViewController = controller; - _controller.complete(controller); - - // _webViewController!.addJavaScriptHandler( - // handlerName: 'downloadBlobHandler', - // callback: (args) async { - // String base64Data = args[0]; - // String mimeType = args[1]; - // String filename = args[2]; - // - // // Save the file - // await saveBase64File(base64Data, filename, mimeType); - // }, - // ); - _webViewController!.addJavaScriptHandler( - handlerName: 'MobileAppJavascriptInterface', - callback: (args) { - print( - "JavaScript called MobileAppJavascriptInterface with args: $args", - ); - return {'status': 'success'}; - }, - ); - _webViewController!.addJavaScriptHandler( - handlerName: 'downloadFile', - callback: (args) async { - if (Platform.isAndroid) { - final url = args[0] as String; - await _handleDownload( - url, - '', - 'application/octet-stream', - '', - // controller,context - ); - } - }, - ); - }, - pullToRefreshController: pullToRefreshController, - onLoadStart: (controller, url) { - return setState(() { - isLoading = true; - }); - }, - initialSettings: InAppWebViewSettings( - allowUniversalAccessFromFileURLs: true, - allowFileAccessFromFileURLs: true, - allowFileAccess: true, - allowsInlineMediaPlayback: true, - allowsPictureInPictureMediaPlayback: true, - allowsBackForwardNavigationGestures: true, - iframeAllow: "camera;microphone;files;media;", - domStorageEnabled: true, - allowContentAccess: true, - javaScriptEnabled: true, - supportZoom: true, - builtInZoomControls: true, - displayZoomControls: false, - textZoom: 125, - blockNetworkImage: false, - loadsImagesAutomatically: true, - safeBrowsingEnabled: true, - useWideViewPort: true, - loadWithOverviewMode: true, - javaScriptCanOpenWindowsAutomatically: true, - mediaPlaybackRequiresUserGesture: false, - geolocationEnabled: true, - useOnDownloadStart: true, - allowsLinkPreview: true, - databaseEnabled: true, - // Enables the WebView database - clearSessionCache: true, - mediaType: "image/*,application/pdf", - useShouldInterceptRequest: true, - hardwareAcceleration: true, - ), - shouldInterceptRequest: (controller, request) async { - final url = request.url.toString(); - print( - 'Intercepting request: $url, Headers: ${request.headers}', - ); - if (url.endsWith('.pdf')) { - final response = await http.get( - Uri.parse(url), - headers: {'Accept': 'application/pdf'}, - ); - if (response.statusCode == 200 && - response.headers['content-type']?.contains( - 'application/pdf', - ) == - true) { - return WebResourceResponse( - contentType: 'application/pdf', - data: response.bodyBytes, - ); - } else { - print( - 'Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}', - ); - } - } - return null; - }, - shouldOverrideUrlLoading: ( - controller, - navigationAction, - ) async { - var uri = navigationAction.request.url!; - print("urib scgefes"); - print(uri); - print(uri.scheme); - if (uri.toString().contains( - 'file_viewer_name.php', - ) && - uri.toString().contains('.pdf')) { - final pdfPath = - Uri.parse( - uri.toString(), - ).queryParameters['file_path']; - if (pdfPath != null) { - final pdfUrl = 'https://erp.gengroup.in/$pdfPath'; - await controller.loadUrl( - urlRequest: URLRequest(url: WebUri(pdfUrl)), - ); - return NavigationActionPolicy.CANCEL; - } - } - if (uri.scheme == "tel") { - // Launch the phone dialer app with the specified phone number - if (await canLaunch(uri.toString())) { - await launch(uri.toString()); - return NavigationActionPolicy.CANCEL; - } - } else if (uri.scheme == "mailto") { - if (await canLaunch(uri.toString())) { - await launch(uri.toString()); - return NavigationActionPolicy.CANCEL; - } - } else if (uri.scheme == "whatsapp") { - // Launch WhatsApp with the specified chat or phone number - if (await canLaunch(uri.toString())) { - await launch(uri.toString()); - return NavigationActionPolicy.CANCEL; - } - } - // // Check if the URL is trying to access the camera for image upload - // if (uri.scheme == 'camera' && uri.path.contains('/camera/')) { - // // Handle camera image upload here - // // You might want to display a custom UI for image selection or directly trigger the camera - // // You can use platform-specific plugins like image_picker for this purpose - // // Once the image is selected, you can pass it to the web view using JavaScript injection - // if (await canLaunch(uri.toString())) { - // await launch(uri.toString()); - // return NavigationActionPolicy.CANCEL; - // } - // } - return NavigationActionPolicy.ALLOW; - }, - - onLoadStop: (controller, url) async { - if (url.toString().contains('file_viewer_name.php') && - url.toString().contains('.pdf')) { - final uri = Uri.parse(url.toString()); - final pdfPath = uri.queryParameters['file_path']; - if (pdfPath != null) { - final pdfUrl = 'https://erp.gengroup.in/$pdfPath'; - await controller.evaluateJavascript( - source: ''' + androidOnPermissionRequest: ( + InAppWebViewController controller, + String origin, + List resources, + ) async { + return PermissionRequestResponse( + resources: resources, + action: + PermissionRequestResponseAction.GRANT, + ); + }, + onPermissionRequest: ( + controller, + request, + ) async { + return PermissionResponse( + resources: request.resources, + action: PermissionResponseAction.GRANT, + ); + }, + keepAlive: InAppWebViewKeepAlive(), + + onWebViewCreated: (controller) { + _webViewController = controller; + _controller.complete(controller); + + // _webViewController!.addJavaScriptHandler( + // handlerName: 'downloadBlobHandler', + // callback: (args) async { + // String base64Data = args[0]; + // String mimeType = args[1]; + // String filename = args[2]; + // + // // Save the file + // await saveBase64File(base64Data, filename, mimeType); + // }, + // ); + _webViewController!.addJavaScriptHandler( + handlerName: 'MobileAppJavascriptInterface', + callback: (args) { + print( + "JavaScript called MobileAppJavascriptInterface with args: $args", + ); + return {'status': 'success'}; + }, + ); + _webViewController!.addJavaScriptHandler( + handlerName: 'downloadFile', + callback: (args) async { + if (Platform.isAndroid) { + final url = args[0] as String; + await _handleDownload( + url, + '', + 'application/octet-stream', + '', + // controller,context + ); + } + }, + ); + }, + pullToRefreshController: + pullToRefreshController, + onLoadStart: (controller, url) { + return setState(() { + isLoading = true; + }); + }, + initialSettings: InAppWebViewSettings( + allowUniversalAccessFromFileURLs: true, + allowFileAccessFromFileURLs: true, + allowFileAccess: true, + allowsInlineMediaPlayback: true, + allowsPictureInPictureMediaPlayback: true, + allowsBackForwardNavigationGestures: true, + iframeAllow: "camera;microphone;files;media;", + domStorageEnabled: true, + allowContentAccess: true, + javaScriptEnabled: true, + supportZoom: true, + builtInZoomControls: true, + displayZoomControls: false, + textZoom: 125, + blockNetworkImage: false, + loadsImagesAutomatically: true, + safeBrowsingEnabled: true, + useWideViewPort: true, + loadWithOverviewMode: true, + javaScriptCanOpenWindowsAutomatically: true, + mediaPlaybackRequiresUserGesture: false, + geolocationEnabled: true, + useOnDownloadStart: true, + allowsLinkPreview: true, + databaseEnabled: true, + // Enables the WebView database + clearSessionCache: true, + mediaType: "image/*,application/pdf", + useShouldInterceptRequest: true, + hardwareAcceleration: true, + ), + shouldInterceptRequest: ( + controller, + request, + ) async { + final url = request.url.toString(); + print( + 'Intercepting request: $url, Headers: ${request.headers}', + ); + if (url.endsWith('.pdf')) { + final response = await http.get( + Uri.parse(url), + headers: {'Accept': 'application/pdf'}, + ); + if (response.statusCode == 200 && + response.headers['content-type'] + ?.contains('application/pdf') == + true) { + return WebResourceResponse( + contentType: 'application/pdf', + data: response.bodyBytes, + ); + } else { + print( + 'Failed to load PDF: Status ${response.statusCode}, Content-Type: ${response.headers['content-type']}', + ); + } + } + return null; + }, + shouldOverrideUrlLoading: ( + controller, + navigationAction, + ) async { + var uri = navigationAction.request.url!; + print("urib scgefes"); + print(uri); + print(uri.scheme); + if (uri.toString().contains( + 'file_viewer_name.php', + ) && + uri.toString().contains('.pdf')) { + final pdfPath = + Uri.parse( + uri.toString(), + ).queryParameters['file_path']; + if (pdfPath != null) { + final pdfUrl = + 'https://erp.gengroup.in/$pdfPath'; + await controller.loadUrl( + urlRequest: URLRequest( + url: WebUri(pdfUrl), + ), + ); + return NavigationActionPolicy.CANCEL; + } + } + if (uri.scheme == "tel") { + // Launch the phone dialer app with the specified phone number + if (await canLaunch(uri.toString())) { + await launch(uri.toString()); + return NavigationActionPolicy.CANCEL; + } + } else if (uri.scheme == "mailto") { + if (await canLaunch(uri.toString())) { + await launch(uri.toString()); + return NavigationActionPolicy.CANCEL; + } + } else if (uri.scheme == "whatsapp") { + // Launch WhatsApp with the specified chat or phone number + if (await canLaunch(uri.toString())) { + await launch(uri.toString()); + return NavigationActionPolicy.CANCEL; + } + } + // // Check if the URL is trying to access the camera for image upload + // if (uri.scheme == 'camera' && uri.path.contains('/camera/')) { + // // Handle camera image upload here + // // You might want to display a custom UI for image selection or directly trigger the camera + // // You can use platform-specific plugins like image_picker for this purpose + // // Once the image is selected, you can pass it to the web view using JavaScript injection + // if (await canLaunch(uri.toString())) { + // await launch(uri.toString()); + // return NavigationActionPolicy.CANCEL; + // } + // } + return NavigationActionPolicy.ALLOW; + }, + + onLoadStop: (controller, url) async { + if (url.toString().contains( + 'file_viewer_name.php', + ) && + url.toString().contains('.pdf')) { + final uri = Uri.parse(url.toString()); + final pdfPath = + uri.queryParameters['file_path']; + if (pdfPath != null) { + final pdfUrl = + 'https://erp.gengroup.in/$pdfPath'; + await controller.evaluateJavascript( + source: ''' var pdfjsLib = window.pdfjsLib || document.createElement('script'); pdfjsLib.src = 'https://mozilla.github.io/pdf.js/build/pdf.js'; document.head.appendChild(pdfjsLib); @@ -423,110 +437,113 @@ class _WebErpScreenState extends State { }); }; ''', - ); - } - } - pullToRefreshController?.endRefreshing(); - return setState(() { - isLoading = false; - }); - }, - onReceivedError: (controller, request, error) { - pullToRefreshController?.endRefreshing(); - return setState(() { - isLoading = false; - }); - }, - onProgressChanged: (controller, progress) { - if (progress == 100) { - pullToRefreshController?.endRefreshing(); - } - }, - onConsoleMessage: (controller, consoleMessage) { - if (kDebugMode) { - debugPrint("consoleMessage${consoleMessage}"); - } - debugPrint( - "JavaScript console message: ${consoleMessage.message}", - ); - }, - // onDownloadStartRequest: (controller, url) async { - // await ApiCalling.download_files( - // empId, sessionId, "${url.url}", context) - // .then((data) => {debugPrint(data)}); - // - // }, - - onDownloadStartRequest: ( - controller, - downloadStartRequest, - ) async { - // String url = downloadStartRequest.url.toString(); - // - // // Use url_launcher or another plugin to handle the download externally - // if (await canLaunchUrl(Uri.parse(url))) { - // await launchUrl( - // Uri.parse(url), - // mode: LaunchMode.externalApplication, - // ); - // } else { - // print("Could not launch $url"); - // } - if (Platform.isAndroid) { - - await _handleDownload( - downloadStartRequest.url.toString(), - downloadStartRequest.suggestedFilename!, - downloadStartRequest.mimeType!, - downloadStartRequest.suggestedFilename ?? '', - // controller,context - ); - } - }, - ), - if (isLoading) ...[ - Container( - color: Colors.white.withOpacity(0.7), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SpinKitRing( - color: AppColors.app_blue, - lineWidth: 4, - // duration: Duration(seconds: 2), - size: 50, + ); + } + } + pullToRefreshController?.endRefreshing(); + return setState(() { + isLoading = false; + }); + }, + onReceivedError: (controller, request, error) { + pullToRefreshController?.endRefreshing(); + return setState(() { + isLoading = false; + }); + }, + onProgressChanged: (controller, progress) { + if (progress == 100) { + pullToRefreshController?.endRefreshing(); + } + }, + onConsoleMessage: (controller, consoleMessage) { + if (kDebugMode) { + debugPrint("consoleMessage$consoleMessage"); + } + debugPrint( + "JavaScript console message: ${consoleMessage.message}", + ); + }, + + // onDownloadStartRequest: (controller, url) async { + // await ApiCalling.download_files( + // empId, sessionId, "${url.url}", context) + // .then((data) => {debugPrint(data)}); + // + // }, + onDownloadStartRequest: ( + controller, + downloadStartRequest, + ) async { + // String url = downloadStartRequest.url.toString(); + // + // // Use url_launcher or another plugin to handle the download externally + // if (await canLaunchUrl(Uri.parse(url))) { + // await launchUrl( + // Uri.parse(url), + // mode: LaunchMode.externalApplication, + // ); + // } else { + // print("Could not launch $url"); + // } + if (Platform.isAndroid) { + await _handleDownload( + downloadStartRequest.url.toString(), + downloadStartRequest.suggestedFilename!, + downloadStartRequest.mimeType!, + downloadStartRequest.suggestedFilename ?? + '', + // controller,context + ); + } + }, ), - const SizedBox(height: 15), - SizedBox( - width: 200, - child: Text( - "Please wait.......", - textAlign: TextAlign.center, - style: TextStyle( - decorationThickness: 0, - fontSize: 15, - fontWeight: FontWeight.normal, - color: AppColors.app_blue, + if (isLoading) ...[ + Container( + color: Colors.white.withOpacity(0.7), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SpinKitRing( + color: AppColors.app_blue, + lineWidth: 4, + // duration: Duration(seconds: 2), + size: 50, + ), + const SizedBox(height: 15), + SizedBox( + width: 200, + child: Text( + "Please wait.......", + textAlign: TextAlign.center, + style: TextStyle( + decorationThickness: 0, + fontSize: 15, + fontWeight: FontWeight.normal, + color: AppColors.app_blue, + ), + ), + ), + + // SvgPicture.asset("/assets/images/NutsLoader.gif") + ], ), ), - ), - - // SvgPicture.asset("/assets/images/NutsLoader.gif") + ], ], ), ), ], - ], + ), ), ), - ], - ), - ), - ), - ):NoNetwork(context), + ) + : NoNetwork(context), ); } + // Future saveBase64File(String base64Data, String filename, String mimeType) async { // // Ask for permission // if (await Permission.storage.request().isGranted) { @@ -663,6 +680,7 @@ class _WebErpScreenState extends State { _webViewController?.evaluateJavascript(source: js); } + Future _handleDownload( String url, String contentDisposition, @@ -804,13 +822,13 @@ class _WebErpScreenState extends State { class SpinKitRing extends StatefulWidget { const SpinKitRing({ - Key? key, + super.key, required this.color, this.lineWidth = 7.0, this.size = 50.0, this.duration = const Duration(milliseconds: 1200), this.controller, - }) : super(key: key); + }); final Color color; final double size; diff --git a/lib/screens/commom/accountLedger.dart b/lib/screens/commom/accountLedger.dart index 2607ff7..a249386 100644 --- a/lib/screens/commom/accountLedger.dart +++ b/lib/screens/commom/accountLedger.dart @@ -160,7 +160,7 @@ class _AccountledgerState extends State { SvgPicture.asset("assets/svg/fin_ic.svg", height: 12), SizedBox(width: 5), Text( - "${provider.balanceDetails.balance.toString()}" ?? "-", + provider.balanceDetails.balance.toString() ?? "-", style: TextStyle(fontSize: 12), ), ], @@ -204,8 +204,7 @@ class _AccountledgerState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Text( - "${provider.selectedAcVal ?? ""}" + - " " + + (provider.selectedAcVal ?? "") " " + "Account Ledger List", ), ), @@ -346,7 +345,7 @@ class _AccountledgerState extends State { children: [ Expanded( child: Text( - "${totalHeadings[index]}", + totalHeadings[index], style: TextStyle( fontFamily: "JakartaMedium", ), @@ -429,7 +428,7 @@ class _AccountledgerState extends State { ), ), ...items.map((item) { - double running_balance = 0; + double runningBalance = 0; int currentIndex = provider.ledgerList .indexOf(item); for ( @@ -451,7 +450,7 @@ class _AccountledgerState extends State { .toString(), ) ?? 0; - running_balance += (debit - credit); + runningBalance += (debit - credit); } return Container( @@ -651,7 +650,7 @@ class _AccountledgerState extends State { ], ), ); - }).toList(), + }), ], ), ); @@ -760,9 +759,7 @@ class _AccountledgerState extends State { provider.selectedAcId = value.id!; provider.selectedAcVal = value.name!; print( - "hfjkshfg" + - provider.selectedAcId - .toString(), + "hfjkshfg${provider.selectedAcId}", ); provider.ledgerlistAPI(context); diff --git a/lib/screens/commom/accountsList.dart b/lib/screens/commom/accountsList.dart index 42ee9b3..9b122a8 100644 --- a/lib/screens/commom/accountsList.dart +++ b/lib/screens/commom/accountsList.dart @@ -39,8 +39,10 @@ class _AccountslistState extends State { // fetch first page once Future.microtask(() { - final provider = - Provider.of(context, listen: false); + final provider = Provider.of( + context, + listen: false, + ); provider.commonAccountListAPIFunction(context); }); } @@ -70,21 +72,24 @@ class _AccountslistState extends State { _currentPage++; }); - provider.commonAccountListAPIFunction(context, append: true).then((_) { - setState(() { - _isLoadingMore = false; - final newItems = provider.accountsList; - if (newItems.length < _currentPage * 15) { - //api gives 15 records - _hasMoreItems = false; - } - }); - }).catchError((_) { - setState(() { - _isLoadingMore = false; - _currentPage--; // rollback - }); - }); + provider + .commonAccountListAPIFunction(context, append: true) + .then((_) { + setState(() { + _isLoadingMore = false; + final newItems = provider.accountsList; + if (newItems.length < _currentPage * 15) { + //api gives 15 records + _hasMoreItems = false; + } + }); + }) + .catchError((_) { + setState(() { + _isLoadingMore = false; + _currentPage--; // rollback + }); + }); } void _refreshList(BuildContext context) { @@ -111,15 +116,15 @@ class _AccountslistState extends State { return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -152,8 +157,10 @@ class _AccountslistState extends State { }, child: Padding( padding: const EdgeInsets.all(8.0), - child: - SvgPicture.asset("assets/svg/filter_ic.svg", height: 18), + child: SvgPicture.asset( + "assets/svg/filter_ic.svg", + height: 18, + ), ), ), ), @@ -171,13 +178,14 @@ class _AccountslistState extends State { return Padding( padding: const EdgeInsets.symmetric(vertical: 16), child: Center( - child: _isLoadingMore - ? const CircularProgressIndicator( - color: Colors.blue, - ) - : !_hasMoreItems - ? const Text("No more accounts to load") - : const SizedBox.shrink(), + child: + _isLoadingMore + ? const CircularProgressIndicator( + color: Colors.blue, + ) + : !_hasMoreItems + ? const Text("No more accounts to load") + : const SizedBox.shrink(), ), ); } @@ -185,31 +193,20 @@ class _AccountslistState extends State { final account = accountList[index]; return InkResponse( onTap: () async { - print( - "length, ${accountList.length}", - ); + print("length, ${accountList.length}"); Navigator.push( context, MaterialPageRoute( builder: - (context) => - Accountslistdetails( - accountID: - accountList[index] - .id, + (context) => Accountslistdetails( + accountID: accountList[index].id, ), ), ); }, child: Container( - padding: EdgeInsets.symmetric( - horizontal: 5, - vertical: 5, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), + padding: EdgeInsets.symmetric(horizontal: 5, vertical: 5), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), @@ -234,7 +231,7 @@ class _AccountslistState extends State { // ), Expanded( flex: 1, - child: Container( + child: SizedBox( height: 50, width: 35, child: SvgPicture.asset( @@ -247,29 +244,23 @@ class _AccountslistState extends State { flex: 7, child: SizedBox( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( accountList[index].name!, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, - color: - AppColors.semi_black, + color: AppColors.semi_black, ), ), Text( - accountList[index] - .type ?? - "-", + accountList[index].type ?? "-", maxLines: 1, style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 12, color: AppColors.grey_semi, ), @@ -289,10 +280,11 @@ class _AccountslistState extends State { }, ); } + Future _showFilterSheet1(BuildContext context) { List isSelected = List.generate( 2, - (index) => index == 0 ? true : false, + (index) => index == 0 ? true : false, ); return showModalBottomSheet( @@ -314,22 +306,16 @@ class _AccountslistState extends State { child: Consumer( builder: (context, provider, child) { int selectedIndex = isSelected.indexWhere( - (element) => element == true, + (element) => element == true, ); - List headings = [ - "Account Name", - "Mobile Number", - - ]; + List headings = ["Account Name", "Mobile Number"]; - return Container( - - height: MediaQuery.of(context).size.height*0.3, + return SizedBox( + height: MediaQuery.of(context).size.height * 0.3, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( padding: EdgeInsets.only(left: 15), child: Text( @@ -343,11 +329,13 @@ class _AccountslistState extends State { ), const SizedBox(height: 20), Expanded( - flex:4, + flex: 4, child: Container( decoration: BoxDecoration( border: Border( - top: BorderSide(color: const Color(0xFFA5DAF9)), + top: BorderSide( + color: const Color(0xFFA5DAF9), + ), bottom: BorderSide( color: const Color(0xFFA5DAF9), ), @@ -359,8 +347,9 @@ class _AccountslistState extends State { Expanded( flex: 3, child: Column( - children: List.generate(headings.length, (jj) { - + children: List.generate(headings.length, ( + jj, + ) { return Expanded( child: InkResponse( onTap: () { @@ -368,46 +357,45 @@ class _AccountslistState extends State { // Reset all to false isSelected = List.generate( headings.length, - (index) => false, + (index) => false, ); // Set the clicked item to true isSelected[jj] = true; }); }, child: Container( - padding: const EdgeInsets.symmetric( - vertical: 7.5, - horizontal: 10, - ), + padding: + const EdgeInsets.symmetric( + vertical: 7.5, + horizontal: 10, + ), decoration: BoxDecoration( border: Border( left: - isSelected[jj] - ? BorderSide( - - color: - AppColors - .app_blue, - width: 5.0, - - ) - : const BorderSide( - color: - Colors - .transparent, - ), + isSelected[jj] + ? BorderSide( + color: + AppColors + .app_blue, + width: 5.0, + ) + : const BorderSide( + color: + Colors + .transparent, + ), bottom: - jj == headings.length - 1 - ? const BorderSide( - color: - Colors - .transparent, - ) - : const BorderSide( - color: Color( - 0xFFA5DAF9, - ), - ), + jj == headings.length - 1 + ? const BorderSide( + color: + Colors + .transparent, + ) + : const BorderSide( + color: Color( + 0xFFA5DAF9, + ), + ), ), color: const Color(0xFFE6F6FF), ), @@ -417,7 +405,8 @@ class _AccountslistState extends State { textAlign: TextAlign.center, style: TextStyle( fontSize: 14, - fontFamily: "JakartaRegular", + fontFamily: + "JakartaRegular", color: AppColors.semi_black, ), ), @@ -437,12 +426,13 @@ class _AccountslistState extends State { ), child: Column( crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ if (selectedIndex == 0) ...[ - SizedBox(height: 10,), + SizedBox(height: 10), textControllerWidget( context, provider.companyNameController, @@ -453,9 +443,8 @@ class _AccountslistState extends State { false, null, ), - ] - else if (selectedIndex == 1) ...[ - SizedBox(height: 10,), + ] else if (selectedIndex == 1) ...[ + SizedBox(height: 10), textControllerWidget( context, provider.mobileNumberController, @@ -467,10 +456,7 @@ class _AccountslistState extends State { FilteringTextInputFormatter .digitsOnly, ), - ] - - - + ], ], ), ), @@ -522,7 +508,6 @@ class _AccountslistState extends State { } } - // Divider( // thickness: 0.5, // color: Color(0xFFD7D7D7), diff --git a/lib/screens/commom/accountsListDetails.dart b/lib/screens/commom/accountsListDetails.dart index 5a37b18..8f6bfe0 100644 --- a/lib/screens/commom/accountsListDetails.dart +++ b/lib/screens/commom/accountsListDetails.dart @@ -165,7 +165,7 @@ class _AccountslistdetailsState extends State { children: [ Expanded( flex: 1, - child: Container( + child: SizedBox( height: 50, width: 35, child: SvgPicture.asset( @@ -584,7 +584,7 @@ class _AccountslistdetailsState extends State { shrinkWrap: true, itemCount: provider.ledgerList.length, itemBuilder: (context, index) { - double running_balance = 0; + double runningBalance = 0; int currentIndex = provider.ledgerList.indexOf( provider.ledgerList[index], ); @@ -600,7 +600,7 @@ class _AccountslistdetailsState extends State { ledgerItem.debitAmount.toString(), ) ?? 0; - running_balance += (debit - credit); + runningBalance += (debit - credit); } return InkResponse( onTap: () async { @@ -658,7 +658,8 @@ class _AccountslistdetailsState extends State { child: Column( children: [ Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Expanded( flex: 5, @@ -701,8 +702,12 @@ class _AccountslistdetailsState extends State { .ledgerList[index] .type == "Credit" - ? Color(0xFFEF3739) - : Color(0xFF0D9C00), + ? Color( + 0xFFEF3739, + ) + : Color( + 0xFF0D9C00, + ), fontSize: 14, fontFamily: "JakartaRegular", @@ -712,12 +717,17 @@ class _AccountslistdetailsState extends State { text: "₹${provider.ledgerList[index].type == "Credit" ? "${provider.ledgerList[index].creditAmount}" : "${provider.ledgerList[index].debitAmount}"}", style: TextStyle( - color: provider - .ledgerList[index] - .type == - "Credit" - ? Color(0xFFEF3739) - : Color(0xFF0D9C00), + color: + provider + .ledgerList[index] + .type == + "Credit" + ? Color( + 0xFFEF3739, + ) + : Color( + 0xFF0D9C00, + ), fontSize: 14, fontFamily: "JakartaRegular", @@ -730,7 +740,7 @@ class _AccountslistdetailsState extends State { ), ], ), - SizedBox(height: 7,), + SizedBox(height: 7), Row( children: [ Expanded( @@ -773,7 +783,7 @@ class _AccountslistdetailsState extends State { ), ), TextSpan( - text: "₹$running_balance", + text: "₹$runningBalance", style: TextStyle( color: AppColors.grey_semi, diff --git a/lib/screens/commom/addCommonPayment.dart b/lib/screens/commom/addCommonPayment.dart index c53cb21..d13e8e0 100644 --- a/lib/screens/commom/addCommonPayment.dart +++ b/lib/screens/commom/addCommonPayment.dart @@ -75,13 +75,13 @@ class _AddcommonpaymentState extends State { ); } - @override void dispose() { focusNodes.map((e) => e.dispose()); super.dispose(); _connectivity.disposeStream(); } + Future onBackPressed(BuildContext context) async { if (_currentStep > 0) { _previousStep(); @@ -90,6 +90,7 @@ class _AddcommonpaymentState extends State { return true; } } + @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -127,7 +128,7 @@ class _AddcommonpaymentState extends State { "Add Account", provider.resetValues, SizedBox.shrink(), - 0xFFFFFFFF + 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, body: Form( @@ -161,9 +162,9 @@ class _AddcommonpaymentState extends State { return CircleAvatar( radius: 12, backgroundColor: - stepIndex <= _currentStep - ? AppColors.app_blue - : Colors.grey[300], + stepIndex <= _currentStep + ? AppColors.app_blue + : Colors.grey[300], ); }, steps: [ @@ -171,11 +172,11 @@ class _AddcommonpaymentState extends State { label: Text("Step 1", style: TextStyle(fontSize: 12)), title: const Text(''), isActive: _currentStep >= 0, - content: Column( + content: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin:EdgeInsets.only(bottom: 5), + margin: EdgeInsets.only(bottom: 5), child: Text( "Account Details", style: TextStyle( @@ -186,7 +187,10 @@ class _AddcommonpaymentState extends State { ), ), Container( - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), decoration: BoxDecoration( color: Colors.white, @@ -195,7 +199,6 @@ class _AddcommonpaymentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 10), Text("Account"), DropdownButtonHideUnderline( @@ -216,27 +219,30 @@ class _AddcommonpaymentState extends State { ], ), items: - provider.accountTypes - .map( - (act) => DropdownMenuItem( - value: act, - child: Text( - act, - style: const TextStyle( - fontSize: 14, - ), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), + provider.accountTypes + .map( + (act) => + DropdownMenuItem( + value: act, + child: Text( + act, + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow + .ellipsis, + ), + ), + ) + .toList(), // value: provider.selectedAccountType, value: - provider.accountTypes.contains( - provider.selectedAccountType, - ) - ? provider.selectedAccountType - : null, + provider.accountTypes.contains( + provider.selectedAccountType, + ) + ? provider.selectedAccountType + : null, onChanged: (value) { if (value != null) { provider.selectedAccountType = value; @@ -247,8 +253,10 @@ class _AddcommonpaymentState extends State { }, buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: ddtheme.menuItemStyleData, - dropdownStyleData: ddtheme.dropdownStyleData, + menuItemStyleData: + ddtheme.menuItemStyleData, + dropdownStyleData: + ddtheme.dropdownStyleData, ), ), ], @@ -260,7 +268,7 @@ class _AddcommonpaymentState extends State { provider.nameController, "Company Name", "Enter Company Name", - (p0) { + (p0) { provider.updateName(p0); provider.checkInputsAPI( context, @@ -281,7 +289,7 @@ class _AddcommonpaymentState extends State { provider.mobileController, "Mobile Number", "Enter Mobile", - (p0) { + (p0) { provider.updateMobile(p0); provider.checkInputsAPI( context, @@ -322,11 +330,11 @@ class _AddcommonpaymentState extends State { label: Text("Step 2", style: TextStyle(fontSize: 12)), title: const Text(''), isActive: _currentStep >= 1, - content:Column( + content: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin:EdgeInsets.only(bottom: 10), + margin: EdgeInsets.only(bottom: 10), child: Text( "Address Details", style: TextStyle( @@ -337,7 +345,6 @@ class _AddcommonpaymentState extends State { ), ), Container( - padding: EdgeInsets.symmetric( horizontal: 10, vertical: 10, @@ -349,7 +356,6 @@ class _AddcommonpaymentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("State"), DropdownButtonHideUnderline( child: Row( @@ -358,9 +364,7 @@ class _AddcommonpaymentState extends State { child: DropdownButton2( focusNode: focusNodes[2], autofocus: - focusNodes[2].hasFocus - ? true - : false, + focusNodes[2].hasFocus ? true : false, isExpanded: true, hint: Text( 'Select State', @@ -368,60 +372,50 @@ class _AddcommonpaymentState extends State { overflow: TextOverflow.ellipsis, ), items: - provider.states - .map( - ( - states, - ) => DropdownMenuItem< - States - >( - value: states, - child: Text( - states.name ?? '', - style: - const TextStyle( - fontSize: 14, - ), - overflow: - TextOverflow - .ellipsis, - ), - ), - ) - .toList(), + provider.states + .map( + (states) => + DropdownMenuItem( + value: states, + child: Text( + states.name ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow + .ellipsis, + ), + ), + ) + .toList(), value: - provider.states.contains( - provider.selectedState, - ) - ? provider.selectedState - : null, + provider.states.contains( + provider.selectedState, + ) + ? provider.selectedState + : null, // value: provider.selectedState, onChanged: (States? value) { if (value != null) { - if (provider - .states - .isNotEmpty) { - provider.selectedState = - value; + if (provider.states.isNotEmpty) { + provider.selectedState = value; print( "Selected Complaint Type: ${value.name}, ID: ${value.id}", ); provider.selectedStateID = - value.id!; + value.id!; print( - "hfjkshfg" + - provider.selectedStateID - .toString(), + "hfjkshfg${provider.selectedStateID}", ); - if (provider - .selectedDistricts != + if (provider.selectedDistricts != null) { provider.districts.clear(); // provider.selectedDistricts = null; provider.selectedDistrictId = - null; + null; provider.selectedDistrictValue = - null; + null; } provider.getDistrictAPI( @@ -435,44 +429,33 @@ class _AddcommonpaymentState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .stateSearchController, + provider.stateSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .stateSearchController, + provider.stateSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), - hintText: - 'Search States...', + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search States...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular(8), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), @@ -482,14 +465,12 @@ class _AddcommonpaymentState extends State { .clear(); } }, - buttonStyleData: - ddtheme.buttonStyleData, - iconStyleData: - ddtheme.iconStyleData, + buttonStyleData: ddtheme.buttonStyleData, + iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -510,65 +491,50 @@ class _AddcommonpaymentState extends State { overflow: TextOverflow.ellipsis, ), items: - provider.districts - .map( - ( - dist, - ) => DropdownMenuItem< - Districts - >( - value: dist, - child: Text( - dist.district ?? '', - style: - const TextStyle( - fontSize: 14, - ), - overflow: - TextOverflow - .ellipsis, - ), - ), - ) - .toList(), + provider.districts + .map( + (dist) => + DropdownMenuItem( + value: dist, + child: Text( + dist.district ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow + .ellipsis, + ), + ), + ) + .toList(), value: - provider.districts.contains( - provider - .selectedDistricts, - ) - ? provider.selectedDistricts - : null, + provider.districts.contains( + provider.selectedDistricts, + ) + ? provider.selectedDistricts + : null, // value: provider.selectedDistricts, onChanged: (Districts? value) { if (value != null) { - if (provider - .districts - .isNotEmpty) { - provider.selectedDistricts = - value; - print( - "Selected ID: ${value.id}", - ); + if (provider.districts.isNotEmpty) { + provider.selectedDistricts = value; + print("Selected ID: ${value.id}"); provider.selectedDistrictId = - value.id!; + value.id!; provider.selectedDistrictValue = - value.district!; + value.district!; print( - "hfjkshfg" + - provider - .selectedDistrictId - .toString(), + "hfjkshfg${provider.selectedDistrictId}", ); - if (provider - .selectedSubLocations != + if (provider.selectedSubLocations != null) { provider.subLocations.clear(); // provider.selectedSubLocations = // null; - provider.selectedSubLocID = - null; + provider.selectedSubLocID = null; provider.selectedSubLocValue = - null; + null; } provider.getSubLocationAPI( context, @@ -580,62 +546,49 @@ class _AddcommonpaymentState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .districtSearchController, + provider.districtSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .districtSearchController, + provider + .districtSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), - hintText: - 'Search Districts...', + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search Districts...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular(8), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.district - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), onMenuStateChange: (isOpen) { if (!isOpen) { - provider - .districtSearchController + provider.districtSearchController .clear(); } }, - buttonStyleData: - ddtheme.buttonStyleData, - iconStyleData: - ddtheme.iconStyleData, + buttonStyleData: ddtheme.buttonStyleData, + iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -656,37 +609,30 @@ class _AddcommonpaymentState extends State { overflow: TextOverflow.ellipsis, ), items: - provider.subLocations - .map( - ( - subloc, - ) => DropdownMenuItem< - SubLocations - >( - value: subloc, - child: Text( - subloc.subLocality ?? - '', - style: - const TextStyle( - fontSize: 14, - ), - overflow: - TextOverflow - .ellipsis, - ), - ), - ) - .toList(), + provider.subLocations + .map( + (subloc) => DropdownMenuItem< + SubLocations + >( + value: subloc, + child: Text( + subloc.subLocality ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow.ellipsis, + ), + ), + ) + .toList(), // value: provider.selectedSubLocations, value: - provider.subLocations.contains( - provider - .selectedSubLocations, - ) - ? provider - .selectedSubLocations - : null, + provider.subLocations.contains( + provider.selectedSubLocations, + ) + ? provider.selectedSubLocations + : null, onChanged: (SubLocations? value) { if (value != null) { if (provider @@ -694,18 +640,13 @@ class _AddcommonpaymentState extends State { .isNotEmpty) { provider.selectedSubLocations = value; - print( - "Selected ID: ${value.id}", - ); + print("Selected ID: ${value.id}"); provider.selectedSubLocID = - value.id!; + value.id!; provider.selectedSubLocValue = - value.subLocality!; + value.subLocality!; print( - "hfjkshfg" + - provider - .selectedSubLocID - .toString(), + "hfjkshfg${provider.selectedSubLocID}", ); } } @@ -713,44 +654,34 @@ class _AddcommonpaymentState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .subLocSearchController, + provider.subLocSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .subLocSearchController, + provider.subLocSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), hintText: - 'Search Sub Locality...', + 'Search Sub Locality...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular(8), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.subLocality - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), @@ -760,14 +691,12 @@ class _AddcommonpaymentState extends State { .clear(); } }, - buttonStyleData: - ddtheme.buttonStyleData, - iconStyleData: - ddtheme.iconStyleData, + buttonStyleData: ddtheme.buttonStyleData, + iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -788,7 +717,6 @@ class _AddcommonpaymentState extends State { TextInputAction.done, ), errorWidget(context, provider.addressError), - ], ), ), @@ -799,11 +727,12 @@ class _AddcommonpaymentState extends State { label: Text("Step 3", style: TextStyle(fontSize: 12)), title: const Text(''), isActive: _currentStep >= 1, - content:Column( crossAxisAlignment: CrossAxisAlignment.start, + content: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin:EdgeInsets.only(bottom: 10), + margin: EdgeInsets.only(bottom: 10), child: Text( "Bank Details", style: TextStyle( @@ -814,7 +743,6 @@ class _AddcommonpaymentState extends State { ), ), Container( - padding: EdgeInsets.symmetric( horizontal: 10, vertical: 10, @@ -826,8 +754,6 @@ class _AddcommonpaymentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - - textControllerWidget( context, provider.bankNameController, @@ -855,10 +781,7 @@ class _AddcommonpaymentState extends State { focusNodes[8], TextInputAction.next, ), - errorWidget( - context, - provider.bankBranchError, - ), + errorWidget(context, provider.bankBranchError), textControllerWidget( context, provider.bankIfscCotroller, @@ -886,10 +809,7 @@ class _AddcommonpaymentState extends State { focusNodes[10], TextInputAction.next, ), - errorWidget( - context, - provider.bankHolderNameError, - ), + errorWidget(context, provider.bankHolderNameError), textControllerWidget( context, provider.bankAcNumberController, @@ -903,10 +823,7 @@ class _AddcommonpaymentState extends State { focusNodes[11], TextInputAction.next, ), - errorWidget( - context, - provider.bankAcNumberError, - ), + errorWidget(context, provider.bankAcNumberError), textControllerWidget( context, provider.bankUpiController, @@ -931,11 +848,11 @@ class _AddcommonpaymentState extends State { label: Text("Step 4", style: TextStyle(fontSize: 12)), title: const Text(''), isActive: _currentStep >= 2, - content: Column( + content: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin:EdgeInsets.only(bottom: 10), + margin: EdgeInsets.only(bottom: 10), child: Text( "Contact Details", style: TextStyle( @@ -946,7 +863,6 @@ class _AddcommonpaymentState extends State { ), ), Container( - padding: EdgeInsets.symmetric( horizontal: 10, vertical: 10, @@ -958,7 +874,6 @@ class _AddcommonpaymentState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - textControllerWidget( context, provider.contectPersonDesignationController, @@ -972,23 +887,18 @@ class _AddcommonpaymentState extends State { focusNodes[14], TextInputAction.next, ), - errorWidget( - context, - provider.desigantionError, - ), + errorWidget(context, provider.desigantionError), textControllerWidget( context, provider.contectPersonAltMobController, "Alternative Mobile Number", "Enter Alternative Mobile Number", - (p0) { + (p0) { provider.updateAltMobile(p0); provider.checkInputsAPI( context, "mob2", - provider - .contectPersonAltMobController - .text, + provider.contectPersonAltMobController.text, ); }, TextInputType.number, @@ -1036,21 +946,24 @@ class _AddcommonpaymentState extends State { ), ], controlsBuilder: (context, details) { - return Column( children: [ if (_currentStep == 3) ...[ InkResponse( - onTap: provider.submitClickced - ? null: () { - if (provider.validateStep4()) { - provider.submitClickced = true; - provider.submitCommonAccountsAPI(context, widget.from); - - } + onTap: + provider.submitClickced + ? null + : () { + if (provider.validateStep4()) { + provider.submitClickced = true; + provider.submitCommonAccountsAPI( + context, + widget.from, + ); + } - details.onStepContinue; - }, + details.onStepContinue; + }, child: Container( height: 45, alignment: Alignment.center, @@ -1088,12 +1001,11 @@ class _AddcommonpaymentState extends State { if (provider.validateStep2()) { _currentStep = 2; } - }else if (_currentStep == 2) { + } else if (_currentStep == 2) { if (provider.validateStep3()) { _currentStep = 3; } - } - else { + } else { _currentStep = 0; } }); @@ -1157,12 +1069,11 @@ class _AddcommonpaymentState extends State { }, ), ), - - ); }, ); } + Widget _scaffold1(BuildContext context) { return Consumer( builder: (context, provider, child) { @@ -1431,9 +1342,7 @@ class _AddcommonpaymentState extends State { provider.selectedStateID = value.id!; print( - "hfjkshfg" + - provider.selectedStateID - .toString(), + "hfjkshfg${provider.selectedStateID}", ); if (provider .selectedDistricts != @@ -1576,10 +1485,7 @@ class _AddcommonpaymentState extends State { provider.selectedDistrictValue = value.district!; print( - "hfjkshfg" + - provider - .selectedDistrictId - .toString(), + "hfjkshfg${provider.selectedDistrictId}", ); if (provider .selectedSubLocations != @@ -1723,10 +1629,7 @@ class _AddcommonpaymentState extends State { provider.selectedSubLocValue = value.subLocality!; print( - "hfjkshfg" + - provider - .selectedSubLocID - .toString(), + "hfjkshfg${provider.selectedSubLocID}", ); } } diff --git a/lib/screens/commonDateRangeFilter.dart b/lib/screens/commonDateRangeFilter.dart index 9daaf82..2d09333 100644 --- a/lib/screens/commonDateRangeFilter.dart +++ b/lib/screens/commonDateRangeFilter.dart @@ -63,15 +63,14 @@ class Commondaterangefilter { // Get formatted date range as a list of strings List getFormattedDateRange(DateTimeRange? dateRange) { if (dateRange != null) { - return [ - formatDate(dateRange.start), - formatDate(dateRange.end), - ]; + return [formatDate(dateRange.start), formatDate(dateRange.end)]; } return []; } - Future?> showFilterBottomSheet(BuildContext context) async { + Future?> showFilterBottomSheet( + BuildContext context, + ) async { String? tempSelectedValue = selectedValue; DateTimeRange? tempSelectedDateRange = selectedDateRange; DateTime? tempStartDate; @@ -257,25 +256,45 @@ class Commondaterangefilter { // ); // } Widget buildCalendar() { - final firstDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month, 1); - final lastDayOfMonth = DateTime(displayedMonth.year, displayedMonth.month + 1, 0); + final firstDayOfMonth = DateTime( + displayedMonth.year, + displayedMonth.month, + 1, + ); + final lastDayOfMonth = DateTime( + displayedMonth.year, + displayedMonth.month + 1, + 0, + ); final firstDayOfWeek = firstDayOfMonth.weekday; final daysInMonth = lastDayOfMonth.day; final daysBefore = (firstDayOfWeek - 1) % 7; List dayWidgets = []; // Weekday headers - final weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; - dayWidgets.addAll(weekdays.map((day) => Center( - child: Text( - day, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: Colors.grey[700], + final weekdays = [ + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', + 'Sun', + ]; + dayWidgets.addAll( + weekdays.map( + (day) => Center( + child: Text( + day, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Colors.grey[700], + ), + ), ), ), - ))); + ); // Empty cells before the first day for (int i = 0; i < daysBefore; i++) { @@ -284,16 +303,23 @@ class Commondaterangefilter { // Days of the month for (int day = 1; day <= daysInMonth; day++) { - final currentDate = DateTime(displayedMonth.year, displayedMonth.month, day); + final currentDate = DateTime( + displayedMonth.year, + displayedMonth.month, + day, + ); bool isSelected = false; bool isInRange = false; - bool isOutsideRange = currentDate.isBefore(DateTime(2020)) || + bool isOutsideRange = + currentDate.isBefore(DateTime(2020)) || currentDate.isAfter(DateTime(2100)); if (tempStartDate != null && tempEndDate != null) { - isSelected = currentDate.isAtSameMomentAs(tempStartDate!) || + isSelected = + currentDate.isAtSameMomentAs(tempStartDate!) || currentDate.isAtSameMomentAs(tempEndDate!); - isInRange = currentDate.isAfter(tempStartDate!) && + isInRange = + currentDate.isAfter(tempStartDate!) && currentDate.isBefore(tempEndDate!) && !isSelected; } else if (tempStartDate != null) { @@ -302,55 +328,61 @@ class Commondaterangefilter { dayWidgets.add( GestureDetector( - onTap: isOutsideRange - ? null - : () { - setState(() { - if (tempStartDate == null) { - // No start date selected, set it - tempStartDate = currentDate; - tempSelectedDateRange = null; - } else if (tempEndDate == null) { - // Start date selected, set end date - if (currentDate.isBefore(tempStartDate!)) { - // If the new date is before start date, swap them - tempEndDate = tempStartDate; - tempStartDate = currentDate; - } else { - tempEndDate = currentDate; - } - tempSelectedDateRange = DateTimeRange( - start: tempStartDate!, - end: tempEndDate!, - ); - } else { - // Both dates selected, reset to start a new range - tempStartDate = currentDate; - tempEndDate = null; - tempSelectedDateRange = null; - } - }); - }, + onTap: + isOutsideRange + ? null + : () { + setState(() { + if (tempStartDate == null) { + // No start date selected, set it + tempStartDate = currentDate; + tempSelectedDateRange = null; + } else if (tempEndDate == null) { + // Start date selected, set end date + if (currentDate.isBefore(tempStartDate!)) { + // If the new date is before start date, swap them + tempEndDate = tempStartDate; + tempStartDate = currentDate; + } else { + tempEndDate = currentDate; + } + tempSelectedDateRange = DateTimeRange( + start: tempStartDate!, + end: tempEndDate!, + ); + } else { + // Both dates selected, reset to start a new range + tempStartDate = currentDate; + tempEndDate = null; + tempSelectedDateRange = null; + } + }); + }, child: Container( margin: EdgeInsets.all(2), decoration: BoxDecoration( - color: isSelected - ? Colors.blue[600] - : isInRange - ? Colors.blue[100] - : null, + color: + isSelected + ? Colors.blue[600] + : isInRange + ? Colors.blue[100] + : null, shape: BoxShape.circle, ), child: Center( child: Text( '$day', style: TextStyle( - color: isOutsideRange - ? Colors.grey[400] - : isSelected - ? Colors.white - : Colors.black, - fontWeight: isSelected ? FontWeight.bold : FontWeight.normal, + color: + isOutsideRange + ? Colors.grey[400] + : isSelected + ? Colors.white + : Colors.black, + fontWeight: + isSelected + ? FontWeight.bold + : FontWeight.normal, ), ), ), @@ -365,47 +397,57 @@ class Commondaterangefilter { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( - onTap: displayedMonth.isAfter(DateTime(2020)) - ? () { - setState(() { - displayedMonth = DateTime(displayedMonth.year, displayedMonth.month - 1); - }); - } - : null, - child: SvgPicture.asset( - "assets/svg/arrow_left.svg", - ), + onTap: + displayedMonth.isAfter(DateTime(2020)) + ? () { + setState(() { + displayedMonth = DateTime( + displayedMonth.year, + displayedMonth.month - 1, + ); + }); + } + : null, + child: SvgPicture.asset("assets/svg/arrow_left.svg"), ), Text( '${_monthName(displayedMonth.month)} ${displayedMonth.year}', - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + ), ), GestureDetector( - onTap: displayedMonth.isBefore(DateTime(2100)) - ? () { - setState(() { - displayedMonth = DateTime(displayedMonth.year, displayedMonth.month + 1); - }); - } - : null, + onTap: + displayedMonth.isBefore(DateTime(2100)) + ? () { + setState(() { + displayedMonth = DateTime( + displayedMonth.year, + displayedMonth.month + 1, + ); + }); + } + : null, child: SvgPicture.asset( "assets/svg/arrow_right_new.svg", ), ), ], ), - Container( + SizedBox( height: 280, child: GridView.count( crossAxisCount: 7, childAspectRatio: 1.2, - children: dayWidgets, physics: NeverScrollableScrollPhysics(), + children: dayWidgets, ), ), ], ); } + return SafeArea( child: Padding( padding: EdgeInsets.only( @@ -421,7 +463,10 @@ class Commondaterangefilter { children: [ Text( 'Select Date Range', - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), ), SizedBox(height: 16), DropdownButtonHideUnderline( @@ -438,26 +483,29 @@ class Commondaterangefilter { color: Colors.black, ), ), - items: filterItems.map((String item) { - return DropdownMenuItem( - value: item, - child: Text( - item, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Colors.black, - ), - ), - ); - }).toList(), + items: + filterItems.map((String item) { + return DropdownMenuItem( + value: item, + child: Text( + item, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.black, + ), + ), + ); + }).toList(), value: tempSelectedValue, onChanged: (String? value) { if (value == null) return; setState(() { tempSelectedValue = value; if (value != 'Custom') { - tempSelectedDateRange = getDateRange(value); + tempSelectedDateRange = getDateRange( + value, + ); tempStartDate = null; tempEndDate = null; } else { @@ -491,7 +539,10 @@ class Commondaterangefilter { padding: const EdgeInsets.only(top: 12.0), child: Text( 'Selected: ${formatDate(tempSelectedDateRange!.start)} to ${formatDate(tempSelectedDateRange!.end)}', - style: TextStyle(fontSize: 14, color: Colors.grey[600]), + style: TextStyle( + fontSize: 14, + color: Colors.grey[600], + ), ), ), ], @@ -508,17 +559,21 @@ class Commondaterangefilter { ), SizedBox(width: 8), ElevatedButton( - onPressed: tempSelectedDateRange != null && tempSelectedValue != null - ? () { - selectedValue = tempSelectedValue; - selectedDateRange = tempSelectedDateRange; - Navigator.pop(context, { - 'selectedValue': tempSelectedValue, - 'dateRange': tempSelectedDateRange, - 'formatted': getFormattedDateRange(tempSelectedDateRange), - }); - } - : null, + onPressed: + tempSelectedDateRange != null && + tempSelectedValue != null + ? () { + selectedValue = tempSelectedValue; + selectedDateRange = tempSelectedDateRange; + Navigator.pop(context, { + 'selectedValue': tempSelectedValue, + 'dateRange': tempSelectedDateRange, + 'formatted': getFormattedDateRange( + tempSelectedDateRange, + ), + }); + } + : null, style: ElevatedButton.styleFrom( backgroundColor: Colors.blue[600], foregroundColor: Colors.white, @@ -530,7 +585,9 @@ class Commondaterangefilter { ), ], ), - SizedBox(height: MediaQuery.of(context).viewInsets.bottom), + SizedBox( + height: MediaQuery.of(context).viewInsets.bottom, + ), ], ), ), @@ -556,7 +613,7 @@ class Commondaterangefilter { 'September', 'October', 'November', - 'December' + 'December', ]; return months[month - 1]; } @@ -596,4 +653,4 @@ class Commondaterangefilter { // ), // ); // } -// } \ No newline at end of file +// } diff --git a/lib/screens/crm/AppointmentDetails.dart b/lib/screens/crm/AppointmentDetails.dart index 061d3d1..ef768f1 100644 --- a/lib/screens/crm/AppointmentDetails.dart +++ b/lib/screens/crm/AppointmentDetails.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:generp/Utils/dropdownTheme.dart'; import 'package:provider/provider.dart'; @@ -19,7 +18,7 @@ class AppointmentDetails extends StatefulWidget { } class _AppointmentDetailsState extends State { -Dropdowntheme ddtheme = Dropdowntheme(); + Dropdowntheme ddtheme = Dropdowntheme(); @override Widget build(BuildContext context) { @@ -30,7 +29,7 @@ Dropdowntheme ddtheme = Dropdowntheme(); onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar(context, "Appointment Details"), @@ -61,7 +60,6 @@ Dropdowntheme ddtheme = Dropdowntheme(); child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...List.generate(5, (j) { final textheads = [ "Employee Name", @@ -86,7 +84,7 @@ Dropdowntheme ddtheme = Dropdowntheme(); ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( @@ -101,10 +99,16 @@ Dropdowntheme ddtheme = Dropdowntheme(); maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( - color: textSubheads[j]=="View File"?AppColors.app_blue: - Color(0xFF818181), - decoration:textSubheads[j]=="View File"? TextDecoration.underline:TextDecoration.none, - decorationColor: AppColors.app_blue + color: + textSubheads[j] == "View File" + ? AppColors.app_blue + : Color(0xFF818181), + decoration: + textSubheads[j] == "View File" + ? TextDecoration.underline + : TextDecoration.none, + decorationColor: + AppColors.app_blue, ), ), ), @@ -132,10 +136,7 @@ Dropdowntheme ddtheme = Dropdowntheme(); child: Container( alignment: Alignment.bottomCenter, height: 45, - width: MediaQuery - .of(context) - .size - .width, + width: MediaQuery.of(context).size.width, margin: EdgeInsets.symmetric(horizontal: 10), decoration: BoxDecoration( color: AppColors.app_blue, @@ -155,13 +156,14 @@ Dropdowntheme ddtheme = Dropdowntheme(); ), ), floatingActionButtonLocation: - FloatingActionButtonLocation.centerFloat, + FloatingActionButtonLocation.centerFloat, ), ), ); }, ); } + Future _showAddAppointmentSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, @@ -207,31 +209,32 @@ Dropdowntheme ddtheme = Dropdowntheme(); GestureDetector( onTap: () { provider.showDatePickerDialog(context); - }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Container( - - height: 50, + height: 50, alignment: Alignment.center, decoration: BoxDecoration( color: AppColors.text_field_color, borderRadius: BorderRadius.circular(14), ), child: Padding( - padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 0), + padding: const EdgeInsets.fromLTRB( + 10.0, + 0.0, + 10, + 0, + ), child: TextFormField( controller: provider.dateController, keyboardType: TextInputType.text, enabled: false, - maxLines: 1, + maxLines: 1, readOnly: true, - onChanged: (value) { - - }, + onChanged: (value) {}, decoration: InputDecoration( hintText: "Enter Date", hintStyle: TextStyle( @@ -271,20 +274,21 @@ Dropdowntheme ddtheme = Dropdowntheme(); ], ), items: - provider.visitTypes - .map( - (vt) => DropdownMenuItem( - value: vt, - child: Text( - vt, - style: const TextStyle( - fontSize: 14, - ), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), + provider.visitTypes + .map( + (vt) => DropdownMenuItem( + value: vt, + child: Text( + vt, + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow.ellipsis, + ), + ), + ) + .toList(), value: provider.selectedVisitType, onChanged: (value) { if (value != null) { @@ -296,14 +300,16 @@ Dropdowntheme ddtheme = Dropdowntheme(); }, buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: ddtheme.menuItemStyleData, - dropdownStyleData: ddtheme.dropdownStyleData, + menuItemStyleData: + ddtheme.menuItemStyleData, + dropdownStyleData: + ddtheme.dropdownStyleData, ), ), ], ), ), - errorWidget(context,provider.visitTypeError), + errorWidget(context, provider.visitTypeError), textControllerWidget( context, @@ -318,11 +324,20 @@ Dropdowntheme ddtheme = Dropdowntheme(); errorWidget(context, provider.noteError), InkWell( - onTap: provider.isLoading?null:(){ - provider.isLoading = true; - provider.crmLeadDetailsAddAppointmentAPIFunction(context, widget.leadID, provider.formattedDateToSend, provider.selectedVisitType, provider.noteController.text); - - }, + onTap: + provider.isLoading + ? null + : () { + provider.isLoading = true; + provider + .crmLeadDetailsAddAppointmentAPIFunction( + context, + widget.leadID, + provider.formattedDateToSend, + provider.selectedVisitType, + provider.noteController.text, + ); + }, child: Container( alignment: Alignment.center, height: 45, @@ -337,11 +352,18 @@ Dropdowntheme ddtheme = Dropdowntheme(); borderRadius: BorderRadius.circular(14.0), ), child: Center( - child: provider.isLoading?CircularProgressIndicator.adaptive(valueColor: AlwaysStoppedAnimation(AppColors.white),):Text( - "Submit", - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), - ), + child: + provider.isLoading + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.white, + ), + ) + : Text( + "Submit", + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), ), ), ), diff --git a/lib/screens/crm/FollowUpDetails.dart b/lib/screens/crm/FollowUpDetails.dart index 2bbb461..ceb44b0 100644 --- a/lib/screens/crm/FollowUpDetails.dart +++ b/lib/screens/crm/FollowUpDetails.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; import '../../Notifiers/crmProvider/crmLeadDetailsProvider.dart'; @@ -25,7 +24,7 @@ class _FollowUpDetailsState extends State { onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar(context, "Followup Details"), @@ -56,7 +55,6 @@ class _FollowUpDetailsState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - ...List.generate(4, (j) { final textheads = [ "Employee Name", @@ -111,7 +109,6 @@ class _FollowUpDetailsState extends State { ), ), ), - ), ), ); diff --git a/lib/screens/crm/LeadDetailsByMode.dart b/lib/screens/crm/LeadDetailsByMode.dart index 1024c25..1488392 100644 --- a/lib/screens/crm/LeadDetailsByMode.dart +++ b/lib/screens/crm/LeadDetailsByMode.dart @@ -253,7 +253,7 @@ class _LeadDetailsByModeState extends State { children: [ Expanded( flex: 1, - child: Container( + child: SizedBox( height: 50, width: 35, child: SvgPicture.asset( @@ -752,22 +752,30 @@ class _LeadDetailsByModeState extends State { if (productsNotEmpty) ...[ Expanded( child: InkResponse( - onTap:editProvider.editProductDetailsClicked?null: () async { - HapticFeedback.selectionClick(); - editProvider.editProductDetailsClicked = true; - editProvider.resetForm(); - await editProvider - .crmLeadDetailsEditProductsViewAPIFunction( - context, - provider.leadDetails.id!, - ); - _showAddEditProductsSheet( - context, - widget.mode, - "add", - "", - ); - }, + onTap: + editProvider + .editProductDetailsClicked + ? null + : () async { + HapticFeedback.selectionClick(); + editProvider + .editProductDetailsClicked = + true; + editProvider.resetForm(); + await editProvider + .crmLeadDetailsEditProductsViewAPIFunction( + context, + provider + .leadDetails + .id!, + ); + _showAddEditProductsSheet( + context, + widget.mode, + "add", + "", + ); + }, child: Padding( padding: const EdgeInsets.all(8.0), child: Text( @@ -801,66 +809,68 @@ class _LeadDetailsByModeState extends State { itemCount: provider.leadProducts.length, itemBuilder: (context, lp) { return InkResponse( - - onTap: - editProvider.editProductDetailsClicked - ? null : () async { - - // var res = await Navigator.push( - // context, - // MaterialPageRoute( - // builder: - // (context) => EditProductsList( - // leadID: provider.leadDetails.id ?? "", - // ), - // ), - // ); - editProvider.editProductDetailsClicked = true; - await editProvider - .crmLeadDetailsEditProductsViewAPIFunction( - context, - provider.leadDetails.id!, - ); - editProvider - .addEditProductPriceController - .text = - provider.leadProducts[lp].price!; - editProvider - .addEditQuantityController - .text = - provider.leadProducts[lp].qty!; - editProvider - .addEditTotalAmountController - .text = provider - .leadProducts[lp] - .prodTotalPrice!; - editProvider - .selectedProducts = editProvider - .productsList - .firstWhere( - (product) => - product.id == - provider - .leadProducts[lp] - .productId, - ); - editProvider.selectedAddEditProductId = - provider - .leadProducts[lp] - .productId!; - editProvider - .selectedAddEditProductName = - provider - .leadProducts[lp] - .productName!; - _showAddEditProductsSheet( - context, - widget.mode, - "edit", - provider.leadProducts[lp].id, - ); - }, + editProvider.editProductDetailsClicked + ? null + : () async { + // var res = await Navigator.push( + // context, + // MaterialPageRoute( + // builder: + // (context) => EditProductsList( + // leadID: provider.leadDetails.id ?? "", + // ), + // ), + // ); + editProvider + .editProductDetailsClicked = + true; + await editProvider + .crmLeadDetailsEditProductsViewAPIFunction( + context, + provider.leadDetails.id!, + ); + editProvider + .addEditProductPriceController + .text = provider + .leadProducts[lp] + .price!; + editProvider + .addEditQuantityController + .text = provider + .leadProducts[lp] + .qty!; + editProvider + .addEditTotalAmountController + .text = provider + .leadProducts[lp] + .prodTotalPrice!; + editProvider.selectedProducts = + editProvider.productsList + .firstWhere( + (product) => + product.id == + provider + .leadProducts[lp] + .productId, + ); + editProvider + .selectedAddEditProductId = + provider + .leadProducts[lp] + .productId!; + editProvider + .selectedAddEditProductName = + provider + .leadProducts[lp] + .productName!; + _showAddEditProductsSheet( + context, + widget.mode, + "edit", + provider.leadProducts[lp].id, + ); + }, child: Container( height: 130, width: @@ -991,22 +1001,26 @@ class _LeadDetailsByModeState extends State { ), ] else ...[ InkResponse( - onTap:editProvider.editProductDetailsClicked?null: () async { - HapticFeedback.selectionClick(); - editProvider.editProductDetailsClicked = true; - editProvider.resetForm(); - await editProvider - .crmLeadDetailsEditProductsViewAPIFunction( - context, - provider.leadDetails.id!, - ); - _showAddEditProductsSheet( - context, - widget.mode, - "add", - "", - ); - }, + onTap: + editProvider.editProductDetailsClicked + ? null + : () async { + HapticFeedback.selectionClick(); + editProvider + .editProductDetailsClicked = true; + editProvider.resetForm(); + await editProvider + .crmLeadDetailsEditProductsViewAPIFunction( + context, + provider.leadDetails.id!, + ); + _showAddEditProductsSheet( + context, + widget.mode, + "add", + "", + ); + }, child: Container( height: 50, margin: EdgeInsets.symmetric( @@ -1055,10 +1069,17 @@ class _LeadDetailsByModeState extends State { if (contactsNotEmpty) ...[ Expanded( child: InkResponse( - onTap: editProvider.editContactDetailsClicked?null: () {HapticFeedback.selectionClick(); - editProvider.editContactDetailsClicked = true; - _showAddContactSheet(context); - }, + onTap: + editProvider + .editContactDetailsClicked + ? null + : () { + HapticFeedback.selectionClick(); + editProvider + .editContactDetailsClicked = + true; + _showAddContactSheet(context); + }, child: Padding( padding: const EdgeInsets.all(8.0), child: Text( @@ -1088,31 +1109,54 @@ class _LeadDetailsByModeState extends State { itemCount: provider.contactDetails.length, itemBuilder: (context, lp) { return InkResponse( - onTap:editProvider.editContactDetailsClicked?null: () async {HapticFeedback.selectionClick(); - editProvider.editContactDetailsClicked = true; - provider.editNameController.text = - provider.contactDetails[lp].name ?? - ""; - provider.editDesignationController.text = - provider - .contactDetails[lp] - .designation ?? - ""; - provider.editMobileNumberController.text = - provider.contactDetails[lp].mob1 ?? - ""; - provider - .editAlternativeMobileController - .text = - provider.contactDetails[lp].mob2 ?? - ""; - provider.editTelephoneController.text = - provider.contactDetails[lp].tel ?? ""; - provider.editEmailController.text = - provider.contactDetails[lp].email ?? - ""; - _showEditContactSheet(context, lp); - }, + onTap: + editProvider.editContactDetailsClicked + ? null + : () async { + HapticFeedback.selectionClick(); + editProvider + .editContactDetailsClicked = + true; + provider.editNameController.text = + provider + .contactDetails[lp] + .name ?? + ""; + provider + .editDesignationController + .text = provider + .contactDetails[lp] + .designation ?? + ""; + provider + .editMobileNumberController + .text = provider + .contactDetails[lp] + .mob1 ?? + ""; + provider + .editAlternativeMobileController + .text = provider + .contactDetails[lp] + .mob2 ?? + ""; + provider + .editTelephoneController + .text = provider + .contactDetails[lp] + .tel ?? + ""; + provider + .editEmailController + .text = provider + .contactDetails[lp] + .email ?? + ""; + _showEditContactSheet( + context, + lp, + ); + }, child: Container( decoration: BoxDecoration( color: Colors.white, @@ -1169,7 +1213,8 @@ class _LeadDetailsByModeState extends State { Expanded( flex: 2, child: InkResponse( - onTap: () {HapticFeedback.selectionClick(); + onTap: () { + HapticFeedback.selectionClick(); launch( 'tel://${provider.contactDetails[lp].mob1}', ); @@ -1177,7 +1222,10 @@ class _LeadDetailsByModeState extends State { child: Text( textAlign: TextAlign.right, - "${provider.contactDetails[lp].mob1 ?? "-"}", + provider + .contactDetails[lp] + .mob1 ?? + "-", style: TextStyle( height: 1, decorationColor: @@ -1202,7 +1250,10 @@ class _LeadDetailsByModeState extends State { ], ), Text( - "${provider.contactDetails[lp].email ?? "-"}", + provider + .contactDetails[lp] + .email ?? + "-", style: TextStyle( fontFamily: "JakartaMedium", @@ -1223,10 +1274,15 @@ class _LeadDetailsByModeState extends State { ), ] else ...[ InkResponse( - onTap:editProvider.editContactDetailsClicked?null: () async {HapticFeedback.selectionClick(); - editProvider.editContactDetailsClicked = true; - _showAddContactSheet(context); - }, + onTap: + editProvider.editContactDetailsClicked + ? null + : () async { + HapticFeedback.selectionClick(); + editProvider + .editContactDetailsClicked = true; + _showAddContactSheet(context); + }, child: Container( height: 50, margin: EdgeInsets.symmetric( @@ -1275,7 +1331,8 @@ class _LeadDetailsByModeState extends State { if (followupNotEmpty) ...[ Expanded( child: InkResponse( - onTap: () async {HapticFeedback.selectionClick(); + onTap: () async { + HapticFeedback.selectionClick(); var res = await Navigator.push( context, MaterialPageRoute( @@ -1436,7 +1493,10 @@ class _LeadDetailsByModeState extends State { textAlign: TextAlign .right, - "${provider.followupDetails[lp].fstatus ?? "-"}", + provider + .followupDetails[lp] + .fstatus ?? + "-", style: TextStyle( fontFamily: "JakartaMedium", @@ -1629,7 +1689,8 @@ class _LeadDetailsByModeState extends State { ), ] else ...[ InkResponse( - onTap: () async {HapticFeedback.selectionClick(); + onTap: () async { + HapticFeedback.selectionClick(); var res = await Navigator.push( context, MaterialPageRoute( @@ -1692,10 +1753,19 @@ class _LeadDetailsByModeState extends State { if (appointmentNotEmpty) ...[ Expanded( child: InkResponse( - onTap:editProvider.appointmentDetailsClicked?null: () {HapticFeedback.selectionClick(); - editProvider.appointmentDetailsClicked = true; - _showAddAppointmentSheet(context); - }, + onTap: + editProvider + .appointmentDetailsClicked + ? null + : () { + HapticFeedback.selectionClick(); + editProvider + .appointmentDetailsClicked = + true; + _showAddAppointmentSheet( + context, + ); + }, child: Padding( padding: const EdgeInsets.all(8.0), child: Text( @@ -2025,10 +2095,15 @@ class _LeadDetailsByModeState extends State { ), ] else ...[ InkResponse( - onTap: editProvider.appointmentDetailsClicked?null:() {HapticFeedback.selectionClick(); - editProvider.appointmentDetailsClicked = true; - _showAddAppointmentSheet(context); - }, + onTap: + editProvider.appointmentDetailsClicked + ? null + : () { + HapticFeedback.selectionClick(); + editProvider + .appointmentDetailsClicked = true; + _showAddAppointmentSheet(context); + }, child: Container( height: 50, margin: EdgeInsets.symmetric( @@ -2355,7 +2430,8 @@ class _LeadDetailsByModeState extends State { ), ] else ...[ InkResponse( - onTap: () async {HapticFeedback.selectionClick(); + onTap: () async { + HapticFeedback.selectionClick(); var res = await Navigator.push( context, MaterialPageRoute( @@ -2421,8 +2497,8 @@ class _LeadDetailsByModeState extends State { return StatefulBuilder( builder: (context, setState) { return SafeArea( - child: Consumer2( - builder: (context, provider,editProvider, child) { + child: Consumer2( + builder: (context, provider, editProvider, child) { editProvider.appointmentDetailsClicked = false; return Container( margin: EdgeInsets.only( @@ -2452,7 +2528,8 @@ class _LeadDetailsByModeState extends State { ), TextWidget(context, "Appointment Date"), GestureDetector( - onTap: () {HapticFeedback.selectionClick(); + onTap: () { + HapticFeedback.selectionClick(); provider.showDatePickerDialog(context); }, child: Row( @@ -2572,7 +2649,8 @@ class _LeadDetailsByModeState extends State { onTap: provider.isLoading ? null - : () {HapticFeedback.selectionClick(); + : () { + HapticFeedback.selectionClick(); provider.isLoading = true; provider .crmLeadDetailsAddAppointmentAPIFunction( @@ -2645,8 +2723,8 @@ class _LeadDetailsByModeState extends State { return StatefulBuilder( builder: (context, setState) { return SafeArea( - child: Consumer2( - builder: (context, provider,editProvider, child) { + child: Consumer2( + builder: (context, provider, editProvider, child) { editProvider.editContactDetailsClicked = false; return Container( margin: EdgeInsets.only( @@ -2775,7 +2853,8 @@ class _LeadDetailsByModeState extends State { onTap: provider.isLoading ? null - : () {HapticFeedback.selectionClick(); + : () { + HapticFeedback.selectionClick(); provider.isLoading = true; provider .crmLeadDetailsAddContactAPIFunction( @@ -2850,10 +2929,9 @@ class _LeadDetailsByModeState extends State { builder: (context) { return StatefulBuilder( builder: (context, setState) { - return SafeArea( - child: Consumer2( - builder: (context, provider,editProvider, child) { + child: Consumer2( + builder: (context, provider, editProvider, child) { editProvider.editContactDetailsClicked = false; return Container( margin: EdgeInsets.only( @@ -2984,7 +3062,8 @@ class _LeadDetailsByModeState extends State { onTap: provider.isLoading ? null - : () {HapticFeedback.selectionClick(); + : () { + HapticFeedback.selectionClick(); provider.isLoading = true; provider .crmLeadDetailsEditContactAPIFunction( @@ -3097,7 +3176,8 @@ class _LeadDetailsByModeState extends State { ...List.generate(assetnames.length, (index) { return ListTile( - onTap: () {HapticFeedback.selectionClick(); + onTap: () { + HapticFeedback.selectionClick(); Navigator.pop(context, true); switch (index) { case 0: diff --git a/lib/screens/crm/LeadListByMode.dart b/lib/screens/crm/LeadListByMode.dart index 804ba80..275b15f 100644 --- a/lib/screens/crm/LeadListByMode.dart +++ b/lib/screens/crm/LeadListByMode.dart @@ -108,6 +108,7 @@ class _LeadlistbymodeState extends State { _connectivity.disposeStream(); super.dispose(); } + @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -162,142 +163,143 @@ class _LeadlistbymodeState extends State { 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: - AlwaysStoppedAnimation(AppColors.app_blue), - ), - ) - : crmLists.isNotEmpty - ? Scrollbar( - controller: _scrollController, - child: ListView.builder( - controller: _scrollController, - itemCount: crmLists.length + (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, index) { - if (index == crmLists.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center( - child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final lead = crmLists[index]; - return InkResponse( - onTap: () async { - HapticFeedback.selectionClick(); - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => LeadDetailsByMode( - pageTitleName: widget.pageTitleName, - mode: widget.mode, - leadId: - provider.crmLeadList[index].leadid, - ), + body: + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - ); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - child: SvgPicture.asset( - "assets/svg/crm/lead_details_list_ic.svg", + ) + : crmLists.isNotEmpty + ? Scrollbar( + controller: _scrollController, + child: ListView.builder( + controller: _scrollController, + itemCount: + crmLists.length + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, index) { + if (index == crmLists.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), + child: Center( + child: CircularProgressIndicator(), ), + ) + : const SizedBox.shrink(); + } + + final lead = crmLists[index]; + return InkResponse( + onTap: () async { + HapticFeedback.selectionClick(); + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => LeadDetailsByMode( + pageTitleName: widget.pageTitleName, + mode: widget.mode, + leadId: + provider.crmLeadList[index].leadid, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, ), - SizedBox(width: 10), - Expanded( - flex: 6, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - crmLists[index].company!, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: SizedBox( + height: 50, + width: 35, + child: SvgPicture.asset( + "assets/svg/crm/lead_details_list_ic.svg", + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 6, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + crmLists[index].company!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + crmLists[index].product ?? "-", + maxLines: 1, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 12, + color: AppColors.grey_semi, + ), + ), + ], + ), ), ), - Text( - crmLists[index].product ?? "-", - maxLines: 1, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 12, - color: AppColors.grey_semi, + SizedBox(width: 10), + Expanded( + flex: 1, + child: InkResponse( + onTap: () { + HapticFeedback.selectionClick(); + launch( + 'tel://${crmLists[index].mob1}', + ); + }, + child: SizedBox( + height: 35, + width: 35, + child: SvgPicture.asset( + "assets/svg/crm/lead_list_call_ic.svg", + ), + ), ), ), ], ), - ), - ), - SizedBox(width: 10), - Expanded( - flex: 1, - child: InkResponse( - onTap: () { - HapticFeedback.selectionClick(); - launch( - 'tel://${crmLists[index].mob1}', - ); - }, - child: SizedBox( - height: 35, - width: 35, - child: SvgPicture.asset( - "assets/svg/crm/lead_list_call_ic.svg", - ), - ), - ), + ], ), - ], - ), - ], + ), + ); + }, ), - ), - ); - }, - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); } - - - Future _showFilterSheetNew(BuildContext context) { List isSelected = List.generate( 9, @@ -338,7 +340,7 @@ class _LeadlistbymodeState extends State { if (widget.mode != "executive") { headings.add("Employee"); } - return Container( + return SizedBox( height: MediaQuery.of(context).size.height * 0.7, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -515,7 +517,7 @@ class _LeadlistbymodeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ] else if (selectedIndex == 1) ...[ ...provider.openStatusList.map(( status, @@ -555,7 +557,7 @@ class _LeadlistbymodeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ] else if (selectedIndex == 2) ...[ textControllerWidget( context, @@ -589,10 +591,10 @@ class _LeadlistbymodeState extends State { ...provider.sourcesList.map(( source, ) { - if (source == null || - source.id == null || - source.name == null) + if (source.id == null || + source.name == null) { return SizedBox.shrink(); + } return SizedBox( height: 35, child: CheckboxListTile( @@ -646,7 +648,7 @@ class _LeadlistbymodeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ] else if (selectedIndex == 5) ...[ if (provider .referencesList @@ -659,10 +661,10 @@ class _LeadlistbymodeState extends State { ...provider.referencesList.map(( reference, ) { - if (reference == null || - reference.id == null || - reference.name == null) + if (reference.id == null || + reference.name == null) { return SizedBox.shrink(); + } return SizedBox( height: 35, child: CheckboxListTile( @@ -698,7 +700,7 @@ class _LeadlistbymodeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ], ] else if (selectedIndex == 6) ...[ if (provider.teamsList.isEmpty) @@ -708,10 +710,10 @@ class _LeadlistbymodeState extends State { ) else ...provider.teamsList.map((team) { - if (team == null || - team.id == null || - team.name == null) + if (team.id == null || + team.name == null) { return SizedBox.shrink(); + } return SizedBox( height: 35, child: CheckboxListTile( @@ -764,7 +766,7 @@ class _LeadlistbymodeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ] else if (selectedIndex == 7) ...[ if (provider .segmentsList @@ -777,10 +779,10 @@ class _LeadlistbymodeState extends State { ...provider.segmentsList.map(( segment, ) { - if (segment == null || - segment.id == null || - segment.name == null) + if (segment.id == null || + segment.name == null) { return SizedBox.shrink(); + } return SizedBox( height: 35, child: CheckboxListTile( @@ -816,7 +818,7 @@ class _LeadlistbymodeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ], ] else if (widget.mode != "executive") ...[ @@ -829,10 +831,10 @@ class _LeadlistbymodeState extends State { ...provider.employeesList.map(( employee, ) { - if (employee == null || - employee.id == null || - employee.name == null) + if (employee.id == null || + employee.name == null) { return SizedBox.shrink(); + } return SizedBox( height: 35, child: CheckboxListTile( @@ -868,7 +870,7 @@ class _LeadlistbymodeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ], ], ), diff --git a/lib/screens/crm/NearbyOpenLeads.dart b/lib/screens/crm/NearbyOpenLeads.dart index 375e053..0111dbf 100644 --- a/lib/screens/crm/NearbyOpenLeads.dart +++ b/lib/screens/crm/NearbyOpenLeads.dart @@ -382,22 +382,21 @@ class _NearbyOpenLeadsState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _buildScreen(context), - ), - ) - : _buildScreen(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _buildScreen(context), + ), + ) + : _buildScreen(context) : NoNetwork(context); } Widget _buildScreen(BuildContext context) { return Consumer( builder: (context, provider, child) { - // { // return Scaffold( // backgroundColor: AppColors.scaffold_bg_color, @@ -446,7 +445,7 @@ class _NearbyOpenLeadsState extends State { topLeft: Radius.circular(30.0), topRight: Radius.circular(30.0), ), - child: Container( + child: SizedBox( height: MediaQuery.of(context).size.height, child: Stack( children: [ @@ -456,19 +455,24 @@ class _NearbyOpenLeadsState extends State { zoomControlsEnabled: true, gestureRecognizers: { Factory( - () => EagerGestureRecognizer(), + () => EagerGestureRecognizer(), ), Factory( - () => PanGestureRecognizer(), + () => PanGestureRecognizer(), ), Factory( - () => ScaleGestureRecognizer(), + () => ScaleGestureRecognizer(), ), }, initialCameraPosition: CameraPosition( - target: widget.latitude != null && widget.longitude != null - ? LatLng(widget.latitude!, widget.longitude!) - : provider.startLocation, + target: + widget.latitude != null && + widget.longitude != null + ? LatLng( + widget.latitude!, + widget.longitude!, + ) + : provider.startLocation, zoom: 14.0, ), markers: provider.markers.toSet(), @@ -480,11 +484,12 @@ class _NearbyOpenLeadsState extends State { provider.onCameraMove(context, position); }, onTap: (position) { - provider.mapController?.hideMarkerInfoWindow( - provider.markers.isNotEmpty - ? provider.markers.first.markerId - : MarkerId(''), - ); + provider.mapController + ?.hideMarkerInfoWindow( + provider.markers.isNotEmpty + ? provider.markers.first.markerId + : MarkerId(''), + ); }, ), ], @@ -495,11 +500,11 @@ class _NearbyOpenLeadsState extends State { ), ), ), - if (provider.isLoading || (provider.markers.isEmpty))...[ - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - color: Colors.white38, + if (provider.isLoading || (provider.markers.isEmpty)) ...[ + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height, + color: Colors.white38, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -507,12 +512,15 @@ class _NearbyOpenLeadsState extends State { SizedBox(height: 16), Text( 'Loading nearby leads...', - style: TextStyle(fontSize: 16, color: AppColors.app_blue), + style: TextStyle( + fontSize: 16, + color: AppColors.app_blue, + ), ), ], ), - ) - ] + ), + ], ], ), ), @@ -588,7 +596,7 @@ class _NearbyOpenLeadsState extends State { vertical: 0, ), iconSize: 0.0, - initialProgress: provider.currentValue/50, + initialProgress: provider.currentValue / 50, enabled: true, foregroundColor: AppColors.app_blue, segmentDividerColor: Color(0xFFF6F6F8), @@ -602,7 +610,10 @@ class _NearbyOpenLeadsState extends State { Container( child: InkWell( onTap: () { - provider.applyFilter(context, provider.currentValue); + provider.applyFilter( + context, + provider.currentValue, + ); Navigator.pop(context); }, child: Container( @@ -641,4 +652,4 @@ class _NearbyOpenLeadsState extends State { }, ); } -} \ No newline at end of file +} diff --git a/lib/screens/crm/ProspectDetailsByMode.dart b/lib/screens/crm/ProspectDetailsByMode.dart index 79b8f1a..acdf0de 100644 --- a/lib/screens/crm/ProspectDetailsByMode.dart +++ b/lib/screens/crm/ProspectDetailsByMode.dart @@ -74,7 +74,7 @@ class ProspectDetailsByModeState extends State { context, widget.leadId, ); - provider.showMoreDetails = false; + provider.showMoreDetails = false; provider.crmProspectDetailsAPIFunction(context, widget.leadId); }); } @@ -122,17 +122,15 @@ class ProspectDetailsByModeState extends State { element.id!.trim() == editProvider.accountDetails.state!.trim(), ); - if (selectedState != null) { - editProvider.selectedStates = selectedState; - editProvider.selectedStateId = selectedState.id; - editProvider.selectedStateValue = selectedState.name; + editProvider.selectedStates = selectedState; + editProvider.selectedStateId = selectedState.id; + editProvider.selectedStateValue = selectedState.name; - await editProvider.crmLeadListDistrictsOnStateAPIFunction( - context, - widget.mode, - editProvider.selectedStateId, - ); - } + await editProvider.crmLeadListDistrictsOnStateAPIFunction( + context, + widget.mode, + editProvider.selectedStateId, + ); } // Prefill district @@ -142,17 +140,15 @@ class ProspectDetailsByModeState extends State { (element) => element.id!.trim() == editProvider.accountDetails.district!.trim(), ); - if (selectedDistrict != null) { - editProvider.selectedDistricts = selectedDistrict; - editProvider.selectedDistrictId = selectedDistrict.id; - editProvider.selectedDistrictValue = selectedDistrict.district; + editProvider.selectedDistricts = selectedDistrict; + editProvider.selectedDistrictId = selectedDistrict.id; + editProvider.selectedDistrictValue = selectedDistrict.district; - await editProvider.crmLeadListSubLocOnDistrictAPIFunction( - context, - widget.mode, - editProvider.selectedDistrictId, - ); - } + await editProvider.crmLeadListSubLocOnDistrictAPIFunction( + context, + widget.mode, + editProvider.selectedDistrictId, + ); } if (editProvider.subLocationsList.isNotEmpty && @@ -160,11 +156,9 @@ class ProspectDetailsByModeState extends State { final selectedSubLocation = editProvider.subLocationsList.firstWhere( (element) => element.id == editProvider.accountDetails.subLocality, ); - if (selectedSubLocation != null) { - editProvider.selectedSubLocations = selectedSubLocation; - editProvider.selectedSubLocationId = selectedSubLocation.id; - editProvider.selectedSubLocationValue = selectedSubLocation.subLocality; - } + editProvider.selectedSubLocations = selectedSubLocation; + editProvider.selectedSubLocationId = selectedSubLocation.id; + editProvider.selectedSubLocationValue = selectedSubLocation.subLocality; } print("Company Name: ${editProvider.editCompanyNameController.text}"); @@ -240,7 +234,7 @@ class ProspectDetailsByModeState extends State { "PinCode", ]; var subHeadings2 = [ - leadDetails!.address ?? "-", + leadDetails.address ?? "-", leadDetails.state ?? "-", leadDetails.district ?? "-", leadDetails.subLocality ?? "-", @@ -254,7 +248,7 @@ class ProspectDetailsByModeState extends State { leadDetails.segment ?? "-", ]; var headings4 = ["Lead Age"]; - var subHeadings4 = ["${leadDetails!.aage ?? "-"} days old"]; + var subHeadings4 = ["${leadDetails.aage ?? "-"} days old"]; var leadListNotEmpty = leadsList.isNotEmpty; var contactNotEmpty = provider.contactList.isNotEmpty; @@ -346,10 +340,9 @@ class ProspectDetailsByModeState extends State { ), ), elevation: 2, - + child: Column( children: [ - Container( decoration: BoxDecoration( color: Colors.white, @@ -368,7 +361,7 @@ class ProspectDetailsByModeState extends State { children: [ Expanded( flex: 1, - child: Container( + child: SizedBox( height: 50, width: 35, child: SvgPicture.asset( @@ -396,7 +389,7 @@ class ProspectDetailsByModeState extends State { ), ), ), - + if (provider.showTransferAccount == "1") ...[ SizedBox(width: 5), Expanded( @@ -478,7 +471,9 @@ class ProspectDetailsByModeState extends State { ), ...List.generate(subHeadings1.length, (j) { return Container( - padding: EdgeInsets.symmetric(vertical: 7), + padding: EdgeInsets.symmetric( + vertical: 7, + ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -537,7 +532,9 @@ class ProspectDetailsByModeState extends State { ), ...List.generate(subHeadings2.length, (j) { return Container( - padding: EdgeInsets.symmetric(vertical: 7), + padding: EdgeInsets.symmetric( + vertical: 7, + ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -596,7 +593,9 @@ class ProspectDetailsByModeState extends State { ), ...List.generate(subHeadings3.length, (j) { return Container( - padding: EdgeInsets.symmetric(vertical: 7), + padding: EdgeInsets.symmetric( + vertical: 7, + ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -655,7 +654,9 @@ class ProspectDetailsByModeState extends State { ), ...List.generate(subHeadings4.length, (j) { return Container( - padding: EdgeInsets.symmetric(vertical: 7), + padding: EdgeInsets.symmetric( + vertical: 7, + ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -671,43 +672,44 @@ class ProspectDetailsByModeState extends State { ), ), Expanded( - child: subHeadings4[j] == "Lead Age" - ? Tooltip( - triggerMode: - TooltipTriggerMode - .tap, - - message: - "${leadDetails.createdDatetime}", - child: Text( - subHeadings4[j] == "" - ? "-" - : subHeadings4[j], - style: TextStyle( - fontSize: 14, - color: Color( - 0xFF818181, + child: + subHeadings4[j] == "Lead Age" + ? Tooltip( + triggerMode: + TooltipTriggerMode + .tap, + + message: + "${leadDetails.createdDatetime}", + child: Text( + subHeadings4[j] == "" + ? "-" + : subHeadings4[j], + style: TextStyle( + fontSize: 14, + color: Color( + 0xFF818181, + ), + decorationColor: + AppColors + .grey_semi, + decoration: + TextDecoration + .underline, + ), + ), + ) + : Text( + subHeadings4[j] == "" + ? "-" + : subHeadings4[j], + style: TextStyle( + fontSize: 14, + color: Color( + 0xFF818181, + ), ), - decorationColor: - AppColors - .grey_semi, - decoration: - TextDecoration - .underline, - ), - ), - ) - : Text( - subHeadings4[j] == "" - ? "-" - : subHeadings4[j], - style: TextStyle( - fontSize: 14, - color: Color( - 0xFF818181, ), - ), - ), ), ], ), @@ -716,7 +718,7 @@ class ProspectDetailsByModeState extends State { ], ), ), - + InkResponse( onTap: () async { HapticFeedback.selectionClick(); @@ -741,7 +743,9 @@ class ProspectDetailsByModeState extends State { ), Transform.flip( flipY: - provider.showMoreDetails ? true : false, + provider.showMoreDetails + ? true + : false, child: SvgPicture.asset( "assets/svg/arrow_dropdown.svg", height: 25, @@ -829,20 +833,15 @@ class ProspectDetailsByModeState extends State { context, MaterialPageRoute( builder: - ( - context, - ) => LeadDetailsByMode( - mode: "", - pageTitleName: - "Lead Details", - leadId: - widget.leadId, - ), + (context) => LeadDetailsByMode( + mode: "", + pageTitleName: "Lead Details", + leadId: widget.leadId, + ), ), ); if (res == true) { - provider - .crmProspectDetailsAPIFunction( + provider.crmProspectDetailsAPIFunction( context, widget.leadId, ); @@ -927,7 +926,7 @@ class ProspectDetailsByModeState extends State { child: Center( child: Text( textAlign: TextAlign.right, - "${leadsList[index].status ?? "-"}", + leadsList[index].status ?? "-", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -1041,9 +1040,7 @@ class ProspectDetailsByModeState extends State { ), ), ...List.generate(1, (j) { - final textheads = [ - "Lead Open / Close", - ]; + final textheads = ["Lead Open / Close"]; final textSubheads = [ leadsList[index].openStatus ?? "-", ]; @@ -1067,19 +1064,18 @@ class ProspectDetailsByModeState extends State { ), ), - Expanded( - child: Text( - textAlign: TextAlign.right, - textSubheads[j] == "" - ? "-" - : textSubheads[j], - style: TextStyle( - fontSize: 14, - color: Color(0xFF818181), - ), + Expanded( + child: Text( + textAlign: TextAlign.right, + textSubheads[j] == "" + ? "-" + : textSubheads[j], + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), ), ), - + ), ], ), ); @@ -1126,7 +1122,7 @@ class ProspectDetailsByModeState extends State { ), ), ], - + ///Contact Details Container( padding: EdgeInsets.only(left: 10, right: 10, top: 10), @@ -1146,14 +1142,17 @@ class ProspectDetailsByModeState extends State { if (contactNotEmpty) ...[ Expanded( child: InkResponse( - onTap:provider.addContactSelected?null: () { - HapticFeedback.selectionClick(); - provider.addContactSelected = true; - _showAddContactSheet( - context, - provider.accountDetails.id!, - ); - }, + onTap: + provider.addContactSelected + ? null + : () { + HapticFeedback.selectionClick(); + provider.addContactSelected = true; + _showAddContactSheet( + context, + provider.accountDetails.id!, + ); + }, child: Padding( padding: const EdgeInsets.all(8.0), child: Text( @@ -1183,27 +1182,35 @@ class ProspectDetailsByModeState extends State { itemCount: provider.contactList.length, itemBuilder: (context, lp) { return InkResponse( - onTap:provider.addContactSelected?null: () async { - provider.addContactSelected = true; - HapticFeedback.selectionClick(); - provider.editNameController.text = - provider.contactList[lp].name ?? ""; - provider.editDesignationController.text = - provider.contactList[lp].designation ?? ""; - provider.editMobileNumberController.text = - provider.contactList[lp].mob1 ?? ""; - provider.editAlternativeMobileController.text = - provider.contactList[lp].mob2 ?? ""; - provider.editTelephoneController.text = - provider.contactList[lp].tel ?? ""; - provider.editEmailController.text = - provider.contactList[lp].email ?? ""; - _showEditContactSheet( - context, - lp, - provider.accountDetails.id!, - ); - }, + onTap: + provider.addContactSelected + ? null + : () async { + provider.addContactSelected = true; + HapticFeedback.selectionClick(); + provider.editNameController.text = + provider.contactList[lp].name ?? ""; + provider.editDesignationController.text = + provider + .contactList[lp] + .designation ?? + ""; + provider.editMobileNumberController.text = + provider.contactList[lp].mob1 ?? ""; + provider + .editAlternativeMobileController + .text = + provider.contactList[lp].mob2 ?? ""; + provider.editTelephoneController.text = + provider.contactList[lp].tel ?? ""; + provider.editEmailController.text = + provider.contactList[lp].email ?? ""; + _showEditContactSheet( + context, + lp, + provider.accountDetails.id!, + ); + }, child: Container( decoration: BoxDecoration( color: Colors.white, @@ -1214,7 +1221,7 @@ class ProspectDetailsByModeState extends State { vertical: 10, ), margin: EdgeInsets.symmetric(vertical: 5), - + child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -1246,11 +1253,9 @@ class ProspectDetailsByModeState extends State { .name ?? "-", style: TextStyle( - fontFamily: - "JakartaMedium", + fontFamily: "JakartaMedium", fontSize: 14, - color: - AppColors.semi_black, + color: AppColors.semi_black, ), ), ), @@ -1264,12 +1269,20 @@ class ProspectDetailsByModeState extends State { }, child: Text( textAlign: TextAlign.right, - "${provider.contactList[lp].mob1 ?? "-"}", + provider + .contactList[lp] + .mob1 ?? + "-", style: TextStyle( height: 1, - decorationColor: AppColors.grey_thick, - decoration: TextDecoration.underline, - decorationStyle: TextDecorationStyle.dotted, + decorationColor: + AppColors.grey_thick, + decoration: + TextDecoration + .underline, + decorationStyle: + TextDecorationStyle + .dotted, fontFamily: "JakartaMedium", fontSize: 14, @@ -1282,8 +1295,7 @@ class ProspectDetailsByModeState extends State { ], ), Text( - provider.contactList[lp].email == - "" + provider.contactList[lp].email == "" ? "-" : provider .contactList[lp] @@ -1307,14 +1319,17 @@ class ProspectDetailsByModeState extends State { ), ] else ...[ InkResponse( - onTap:provider.addContactSelected?null: () { - HapticFeedback.selectionClick(); - provider.addContactSelected = true; - _showAddContactSheet( - context, - provider.accountDetails.id!, - ); - }, + onTap: + provider.addContactSelected + ? null + : () { + HapticFeedback.selectionClick(); + provider.addContactSelected = true; + _showAddContactSheet( + context, + provider.accountDetails.id!, + ); + }, child: Container( height: 50, margin: EdgeInsets.symmetric( @@ -1339,15 +1354,11 @@ class ProspectDetailsByModeState extends State { ), ), ], - + ///Order Details if (orderNotEmpty) ...[ Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -1380,7 +1391,7 @@ class ProspectDetailsByModeState extends State { return Container( height: 250, width: MediaQuery.of(context).size.width * 0.9, - + margin: EdgeInsets.symmetric(vertical: 5), padding: EdgeInsets.symmetric( horizontal: 15, @@ -1394,8 +1405,7 @@ class ProspectDetailsByModeState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1424,7 +1434,7 @@ class ProspectDetailsByModeState extends State { color: AppColors.semi_black, ), ), - + Text( "${orderList[index].id}", style: TextStyle( @@ -1442,8 +1452,9 @@ class ProspectDetailsByModeState extends State { flex: 2, child: Container( decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(8), + borderRadius: BorderRadius.circular( + 8, + ), color: Color(0xFFF3FFD5), ), padding: EdgeInsets.symmetric( @@ -1453,7 +1464,7 @@ class ProspectDetailsByModeState extends State { child: Center( child: Text( textAlign: TextAlign.right, - "${orderList[index].status ?? "-"}", + orderList[index].status ?? "-", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -1466,9 +1477,7 @@ class ProspectDetailsByModeState extends State { ], ), Container( - padding: EdgeInsets.symmetric( - vertical: 3, - ), + padding: EdgeInsets.symmetric(vertical: 3), child: Row( children: [ Expanded( @@ -1518,7 +1527,7 @@ class ProspectDetailsByModeState extends State { ), ), ), - + Expanded( child: Text( textAlign: TextAlign.right, @@ -1535,11 +1544,9 @@ class ProspectDetailsByModeState extends State { ), ); }), - + Container( - padding: EdgeInsets.symmetric( - vertical: 4, - ), + padding: EdgeInsets.symmetric(vertical: 4), child: Row( children: [ Expanded( @@ -1618,15 +1625,13 @@ class ProspectDetailsByModeState extends State { textSubheads[j] == "" ? "-" : textSubheads[j], - overflow: - TextOverflow.ellipsis, + overflow: TextOverflow.ellipsis, style: TextStyle( color: AppColors.app_blue, decorationColor: AppColors.app_blue, decoration: - TextDecoration - .underline, + TextDecoration.underline, ), ), ), @@ -1642,15 +1647,11 @@ class ProspectDetailsByModeState extends State { ), ), ], - + ///Payment Details if (paymentsNotEmpty) ...[ Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -1667,7 +1668,7 @@ class ProspectDetailsByModeState extends State { ], ), ), - + SizedBox( width: double.infinity, height: 200, @@ -1687,21 +1688,15 @@ class ProspectDetailsByModeState extends State { context, MaterialPageRoute( builder: - ( - context, - ) => Paymentdetailsbymode( - mode: "", - pageTitleName: - "Payment Details", - paymentId: - paymentList[index] - .id, - ), + (context) => Paymentdetailsbymode( + mode: "", + pageTitleName: "Payment Details", + paymentId: paymentList[index].id, + ), ), ); if (res == true) { - provider - .crmProspectDetailsAPIFunction( + provider.crmProspectDetailsAPIFunction( context, paymentList[index].id, ); @@ -1711,7 +1706,10 @@ class ProspectDetailsByModeState extends State { height: 200, width: MediaQuery.of(context).size.width * 0.9, - margin: EdgeInsets.symmetric(vertical: 5,horizontal: 7.5), + margin: EdgeInsets.symmetric( + vertical: 5, + horizontal: 7.5, + ), padding: EdgeInsets.symmetric( horizontal: 15, vertical: 10, @@ -1783,7 +1781,9 @@ class ProspectDetailsByModeState extends State { child: Center( child: Text( textAlign: TextAlign.right, - "${paymentList[index].paymentType ?? "-"}", + paymentList[index] + .paymentType ?? + "-", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -1871,9 +1871,6 @@ class ProspectDetailsByModeState extends State { ), ); }), - - - ], ), ), @@ -2099,7 +2096,7 @@ class ProspectDetailsByModeState extends State { ); provider.crmProspectDetailsAPIFunction(context, widget.leadId); }); - },); + }); } Future _showEditContactSheet(BuildContext context, index, accid) { @@ -2311,7 +2308,7 @@ class ProspectDetailsByModeState extends State { ); provider.crmProspectDetailsAPIFunction(context, widget.leadId); }); - },); + }); } Future _showTransferAccountSheet(BuildContext context, accID) { @@ -2397,10 +2394,10 @@ class ProspectDetailsByModeState extends State { editProsProvider.selectedEmployees = value; editProsProvider.selectedEmployeeId = - value!.id!; + value.id!; editProsProvider .selectedEmployeeValue = - value!.name!; + value.name!; } } }, @@ -2526,7 +2523,7 @@ class ProspectDetailsByModeState extends State { ); provider.crmProspectDetailsAPIFunction(context, widget.leadId); }); - },); + }); } Future _showEditAccountSheet(BuildContext context, accID) { @@ -2672,9 +2669,9 @@ class ProspectDetailsByModeState extends State { if (value != null) { if (provider.statesList.isNotEmpty) { provider.selectedStates = value; - provider.selectedStateId = value!.id!; + provider.selectedStateId = value.id!; provider.selectedStateValue = - value!.name!; + value.name!; if (provider .districtsList .isNotEmpty) { @@ -2742,9 +2739,9 @@ class ProspectDetailsByModeState extends State { if (provider.districtsList.isNotEmpty) { provider.selectedDistricts = value; provider.selectedDistrictId = - value!.id!; + value.id!; provider.selectedDistrictValue = - value!.district!; + value.district!; if (provider .subLocationsList .isNotEmpty) { @@ -2823,9 +2820,9 @@ class ProspectDetailsByModeState extends State { .isNotEmpty) { provider.selectedSubLocations = value; provider.selectedSubLocationId = - value!.id!; + value.id!; provider.selectedSubLocationValue = - value!.subLocality!; + value.subLocality!; } } }, @@ -2939,7 +2936,7 @@ class ProspectDetailsByModeState extends State { ); provider.crmProspectDetailsAPIFunction(context, widget.leadId); }); - },); + }); } Future _showOptionsSheet(BuildContext context) { @@ -3250,24 +3247,22 @@ class ProspectDetailsByModeState extends State { items: addleadProvider.leadProductsList .map( - ( - ord, - ) => DropdownMenuItem( - value: ord, - child: Text( - "${ord.name}", - style: const TextStyle( - fontSize: 14, + (ord) => + DropdownMenuItem( + value: ord, + child: Text( + "${ord.name}", + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow.ellipsis, + ), ), - overflow: - TextOverflow.ellipsis, - ), - ), ) .toList(), value: - addleadProvider.selectedProducts != - null + addleadProvider.selectedProducts != null ? addleadProvider.leadProductsList .firstWhere( (ord) => @@ -3296,12 +3291,11 @@ class ProspectDetailsByModeState extends State { value.id; addleadProvider.selectedProductsID = value.name; - addleadProvider - .crmSelectedProductDetailsApiFunction( - context, - value.id.toString(), - ); - + addleadProvider + .crmSelectedProductDetailsApiFunction( + context, + value.id.toString(), + ); } }, buttonStyleData: ddtheme.buttonStyleData, diff --git a/lib/screens/crm/ProspectListByMode.dart b/lib/screens/crm/ProspectListByMode.dart index e1cd5d7..87da745 100644 --- a/lib/screens/crm/ProspectListByMode.dart +++ b/lib/screens/crm/ProspectListByMode.dart @@ -170,7 +170,7 @@ class _ProspectListByModeState extends State { children: [ Expanded( flex: 1, - child: Container( + child: SizedBox( height: 50, width: 35, @@ -353,7 +353,7 @@ class _ProspectListByModeState extends State { if (widget.mode != "executive") { headings.add("Employee"); } - return Container( + return SizedBox( height: MediaQuery.of(context).size.height * 0.3, child: Column( mainAxisSize: MainAxisSize.min, @@ -550,7 +550,7 @@ class _ProspectListByModeState extends State { EdgeInsets.zero, ), ); - }).toList(), + }), ], ], ), diff --git a/lib/screens/crm/addLeadProductScreen.dart b/lib/screens/crm/addLeadProductScreen.dart index 97495e2..23aa989 100644 --- a/lib/screens/crm/addLeadProductScreen.dart +++ b/lib/screens/crm/addLeadProductScreen.dart @@ -40,14 +40,14 @@ class _AddleadproductscreenState extends State { context, listen: false, ); - if(widget.type == "Add"){ + if (widget.type == "Add") { provider.selectedProducts = null; provider.selectedProductsId = null; provider.selectedProductsValue = null; provider.addProductPriceController.clear(); provider.addQuantityController.clear(); provider.addTotalAmountController.clear(); - }else{ + } else { provider.prefillProductForEdit(widget.editIndex!); } @@ -165,7 +165,7 @@ class _AddleadproductscreenState extends State { onChanged: (Products? value) { if (value != null) { provider.selectedProducts = value; - provider.selectedProductsId = value!.id!; + provider.selectedProductsId = value.id!; provider.selectedProductsValue = value.name; } @@ -177,44 +177,34 @@ class _AddleadproductscreenState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .productSearchController, + provider.productSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .productSearchController, + provider.productSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), - hintText: - 'Search Product...', + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search Product...', border: OutlineInputBorder( - borderRadius: - BorderRadius.circular( + borderRadius: BorderRadius.circular( 8, ), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), @@ -292,24 +282,21 @@ class _AddleadproductscreenState extends State { floatingActionButton: InkWell( onTap: () { HapticFeedback.selectionClick(); - if (provider.selectedProducts != null) { - - final productData = { - "product_id": provider.selectedProductsId!, - "price": provider.addProductPriceController.text, - "qty": provider.addQuantityController.text, - "net_price": provider.addTotalAmountController.text, - }; - if (widget.editIndex != null) { - provider.updateProduct(widget.editIndex!, productData); - } else { - provider.addProduct(productData); - } - print(provider.getJsonEncodedProducts()); - Navigator.pop(context, provider.getJsonEncodedProducts()); + if (provider.selectedProducts != null) { + final productData = { + "product_id": provider.selectedProductsId!, + "price": provider.addProductPriceController.text, + "qty": provider.addQuantityController.text, + "net_price": provider.addTotalAmountController.text, + }; + if (widget.editIndex != null) { + provider.updateProduct(widget.editIndex!, productData); + } else { + provider.addProduct(productData); } - - + print(provider.getJsonEncodedProducts()); + Navigator.pop(context, provider.getJsonEncodedProducts()); + } }, child: Container( alignment: Alignment.center, diff --git a/lib/screens/crm/addLeadsProspectsScreen.dart b/lib/screens/crm/addLeadsProspectsScreen.dart index a6bba3b..d97dc61 100644 --- a/lib/screens/crm/addLeadsProspectsScreen.dart +++ b/lib/screens/crm/addLeadsProspectsScreen.dart @@ -45,7 +45,7 @@ class _AddleadsprospectsscreenState extends State { _nameController.dispose(); _emailController.dispose(); _addressController.dispose(); - focusNodes.map((e) => e.dispose(),); + focusNodes.map((e) => e.dispose()); super.dispose(); } @@ -80,6 +80,7 @@ class _AddleadsprospectsscreenState extends State { const SnackBar(content: Text('Form submitted successfully!')), ); } + Future onBackPressed(BuildContext context) async { if (_currentStep > 0) { _previousStep(); @@ -88,6 +89,7 @@ class _AddleadsprospectsscreenState extends State { return true; } } + @override void initState() { super.initState(); @@ -120,15 +122,15 @@ class _AddleadsprospectsscreenState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -257,8 +259,7 @@ class _AddleadsprospectsscreenState extends State { fontSize: 14, ), overflow: - TextOverflow - .ellipsis, + TextOverflow.ellipsis, ), ), ) @@ -292,9 +293,9 @@ class _AddleadsprospectsscreenState extends State { TextInputType.name, false, null, - focusNodes[0], - focusNodes[1], - TextInputAction.next + focusNodes[0], + focusNodes[1], + TextInputAction.next, ), errorWidget(context, provider.companynameError), @@ -307,9 +308,9 @@ class _AddleadsprospectsscreenState extends State { TextInputType.name, false, null, - focusNodes[1], - focusNodes[2], - TextInputAction.next + focusNodes[1], + focusNodes[2], + TextInputAction.next, ), errorWidget(context, provider.nameError), @@ -337,10 +338,10 @@ class _AddleadsprospectsscreenState extends State { provider.onChangemailId, TextInputType.emailAddress, false, - null,focusNodes[3], + null, + focusNodes[3], focusNodes[4], TextInputAction.next, - ), errorWidget(context, provider.mailIdError), @@ -406,7 +407,7 @@ class _AddleadsprospectsscreenState extends State { false, FilteringTextInputFormatter.digitsOnly, focusNodes[6], - null, + null, TextInputAction.done, ), errorWidget(context, provider.TelephoneError), @@ -436,23 +437,37 @@ class _AddleadsprospectsscreenState extends State { ) .toList(), // value: provider.selectedSources, - value: provider.sourcesList.isNotEmpty?provider.selectedSources!=null? - provider.sourcesList.firstWhere((element) => element.id==provider.selectedSourcesId, - orElse: () => provider.sourcesList[0], - ):null:null, + value: + provider.sourcesList.isNotEmpty + ? provider.selectedSources != null + ? provider.sourcesList.firstWhere( + (element) => + element.id == + provider + .selectedSourcesId, + orElse: + () => + provider + .sourcesList[0], + ) + : null + : null, onChanged: (Sources? value) { if (value != null) { if (provider.sourcesList.isNotEmpty) { provider.selectedSources = value; provider.selectedSourcesId = - value!.id!; + value.id!; provider.selectedSourcesValue = - value!.name!; + value.name!; - if(provider.referencesList.isNotEmpty){ + if (provider + .referencesList + .isNotEmpty) { provider.referencesList.clear(); provider.selectedReferenceId = null; - provider.selectedReferenceValue = null; + provider.selectedReferenceValue = + null; } provider @@ -468,44 +483,33 @@ class _AddleadsprospectsscreenState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .sourceSearchController, + provider.sourceSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .sourceSearchController, + provider.sourceSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), - hintText: - 'Search Source...', + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search Source...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular(8), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), @@ -539,24 +543,34 @@ class _AddleadsprospectsscreenState extends State { items: provider.referencesList .map( - (slist) => DropdownMenuItem< - References - >( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), ), - ), - ), ) .toList(), // value: provider.selectedReference, - value: provider.referencesList.isNotEmpty?provider.selectedReference!=null? - provider.referencesList.firstWhere((element) => element.id==provider.selectedReferenceId, - orElse: () => provider.referencesList[0], - ):null:null, + value: + provider.referencesList.isNotEmpty + ? provider.selectedReference != null + ? provider.referencesList.firstWhere( + (element) => + element.id == + provider + .selectedReferenceId, + orElse: + () => + provider + .referencesList[0], + ) + : null + : null, onChanged: (References? value) { if (value != null) { if (provider @@ -564,9 +578,9 @@ class _AddleadsprospectsscreenState extends State { .isNotEmpty) { provider.selectedReference = value; provider.selectedReferenceId = - value!.id!; + value.id!; provider.selectedReferenceValue = - value!.name!; + value.name!; } } }, @@ -574,50 +588,41 @@ class _AddleadsprospectsscreenState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .referenceSearchController, + provider.referenceSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .referenceSearchController, + provider + .referenceSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), - hintText: - 'Search Reference...', + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search Reference...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular(8), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), onMenuStateChange: (isOpen) { if (!isOpen) { - provider.referenceSearchController.clear(); + provider.referenceSearchController + .clear(); } }, buttonStyleData: ddtheme.buttonStyleData, @@ -658,23 +663,34 @@ class _AddleadsprospectsscreenState extends State { ) .toList(), // value: provider.selectedTeams, - value: provider.teamsList.isNotEmpty?provider.selectedTeams!=null? - provider.teamsList.firstWhere((element) => element.id==provider.selectedTeamsId, - orElse: () => provider.teamsList[0], - ):null:null, + value: + provider.teamsList.isNotEmpty + ? provider.selectedTeams != null + ? provider.teamsList.firstWhere( + (element) => + element.id == + provider.selectedTeamsId, + orElse: + () => + provider.teamsList[0], + ) + : null + : null, onChanged: (Teams? value) { if (value != null) { if (provider.teamsList.isNotEmpty) { provider.selectedTeams = value; - provider.selectedTeamsId = - value!.id!; + provider.selectedTeamsId = value.id!; provider.selectedTeamsValue = - value!.name!; + value.name!; - if(provider.segmentsList.isNotEmpty){ + if (provider + .segmentsList + .isNotEmpty) { provider.segmentsList.clear(); provider.selectedSegmentId = null; - provider.selectedSegmentValue = null; + provider.selectedSegmentValue = + null; } provider .crmLeadListSegmentOnTeamAPIFunction( @@ -689,44 +705,33 @@ class _AddleadsprospectsscreenState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .teamSearchController, + provider.teamSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .teamSearchController, + provider.teamSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), - hintText: - 'Search Team...', + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search Team...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular(8), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), @@ -773,20 +778,29 @@ class _AddleadsprospectsscreenState extends State { ) .toList(), // value: provider.selectedSegment, - value: provider.segmentsList.isNotEmpty?provider.selectedSegment!=null? - provider.segmentsList.firstWhere((element) => element.id==provider.selectedSegmentId, - orElse: () => provider.segmentsList[0], - ):null:null, + value: + provider.segmentsList.isNotEmpty + ? provider.selectedSegment != null + ? provider.segmentsList.firstWhere( + (element) => + element.id == + provider + .selectedSegmentId, + orElse: + () => + provider + .segmentsList[0], + ) + : null + : null, onChanged: (Segments? value) { if (value != null) { - if (provider - .segmentsList - .isNotEmpty) { + if (provider.segmentsList.isNotEmpty) { provider.selectedSegment = value; provider.selectedSegmentId = - value!.id!; + value.id!; provider.selectedSegmentValue = - value!.name!; + value.name!; } } }, @@ -794,50 +808,40 @@ class _AddleadsprospectsscreenState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider - .segmentSearchController, + provider.segmentSearchController, searchInnerWidget: Padding( - padding: const EdgeInsets.all( - 8, - ), + padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider - .segmentSearchController, + provider.segmentSearchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), - hintText: - 'Search Segment...', + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + hintText: 'Search Segment...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular(8), ), ), ), ), - searchMatchFn: ( - item, - searchValue, - ) { + searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue - .toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), onMenuStateChange: (isOpen) { if (!isOpen) { - provider.segmentSearchController.clear(); + provider.segmentSearchController + .clear(); } }, buttonStyleData: ddtheme.buttonStyleData, @@ -882,17 +886,15 @@ class _AddleadsprospectsscreenState extends State { context, MaterialPageRoute( builder: - (context) => Addleadproductscreen( - type: "Add", - ), + (context) => + Addleadproductscreen(type: "Add"), settings: RouteSettings( - name: - 'Generatequotationaddeditproduct', + name: 'Generatequotationaddeditproduct', ), ), ); if (res != null) { - print("result ${res}"); + print("result $res"); } }, child: Container( @@ -944,8 +946,7 @@ class _AddleadsprospectsscreenState extends State { ), ) .name; - final prodPrice = - product['price'] ?? '-'; + final prodPrice = product['price'] ?? '-'; final prodQty = product['qty'] ?? '-'; final totalPrice = product['net_price'] ?? '-'; @@ -968,7 +969,7 @@ class _AddleadsprospectsscreenState extends State { ), ); if (res != null) { - print("result ${res}"); + print("result $res"); } }, child: Container( @@ -995,8 +996,9 @@ class _AddleadsprospectsscreenState extends State { ), decoration: BoxDecoration( color: Color(0xFFE6F6FF), - borderRadius: - BorderRadius.circular(14), + borderRadius: BorderRadius.circular( + 14, + ), ), child: Row( mainAxisAlignment: @@ -1015,8 +1017,7 @@ class _AddleadsprospectsscreenState extends State { flex: 6, child: Column( crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ @@ -1025,8 +1026,7 @@ class _AddleadsprospectsscreenState extends State { Expanded( flex: 4, child: Text( - productName ?? - "-", + productName ?? "-", maxLines: 2, overflow: TextOverflow @@ -1045,8 +1045,7 @@ class _AddleadsprospectsscreenState extends State { flex: 3, child: Text( textAlign: - TextAlign - .right, + TextAlign.right, "₹$prodPrice", style: TextStyle( fontFamily: @@ -1067,8 +1066,7 @@ class _AddleadsprospectsscreenState extends State { "JakartaMedium", fontSize: 14, color: - AppColors - .grey_semi, + AppColors.grey_semi, ), ), SizedBox(height: 5), @@ -1112,11 +1110,14 @@ class _AddleadsprospectsscreenState extends State { ), ], - if(provider.productRows.isEmpty)...[ - if(provider.productsEmptyError!=null)...[ - errorWidget(context, provider.productsEmptyError) - ] - ] + if (provider.productRows.isEmpty) ...[ + if (provider.productsEmptyError != null) ...[ + errorWidget( + context, + provider.productsEmptyError, + ), + ], + ], ], ), ), @@ -1147,17 +1148,16 @@ class _AddleadsprospectsscreenState extends State { items: provider.statesList .map( - (slist) => DropdownMenuItem< - States - >( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), ), - ), - ), ) .toList(), @@ -1166,7 +1166,7 @@ class _AddleadsprospectsscreenState extends State { provider.statesList.isNotEmpty ? provider.selectedStates != null - ? provider.statesList!.firstWhere( + ? provider.statesList.firstWhere( (ord) => ord.id == provider @@ -1174,7 +1174,7 @@ class _AddleadsprospectsscreenState extends State { orElse: () => provider - .statesList![0]!, + .statesList[0], ) : null : null, @@ -1185,31 +1185,32 @@ class _AddleadsprospectsscreenState extends State { .isNotEmpty) { provider.selectedStates = value; provider.selectedStatesId = - value!.id!; + value.id!; provider.selectedStatesValue = - value!.name!; + value.name!; provider .crmLeadListDistrictsOnStateAPIFunction( - context, - "", - value!.id!, - ); + context, + "", + value.id!, + ); if (provider .districtsList .isNotEmpty) { - provider.districtsList + provider.districtsList.clear(); + provider.subLocationsList .clear(); - provider.subLocationsList.clear(); // provider.selectedDistricts = null; provider.selectedDistrictId = null; provider.selectedDistrictValue = ""; - provider.selectedSubLocationId = null; - provider.selectedSubLocationValue = ""; + provider.selectedSubLocationId = + null; + provider.selectedSubLocationValue = + ""; } - } } }, @@ -1259,17 +1260,16 @@ class _AddleadsprospectsscreenState extends State { provider.districtsList.isNotEmpty ? provider.selectedDistricts != null - ? provider.districtsList! - .firstWhere( - (ord) => - ord.id == + ? provider.districtsList.firstWhere( + (ord) => + ord.id == + provider + .selectedDistrictId, + orElse: + () => provider - .selectedDistrictId, - orElse: - () => - provider - .districtsList![0]!, - ) + .districtsList[0], + ) : null : null, onChanged: (Districts? value) { @@ -1280,15 +1280,15 @@ class _AddleadsprospectsscreenState extends State { provider.selectedDistricts = value; provider.selectedDistrictId = - value!.id!; + value.id!; provider.selectedDistrictValue = - value!.district!; + value.district!; provider .crmLeadListSubLocOnDistrictAPIFunction( - context, - "", - value!.id!, - ); + context, + "", + value.id!, + ); if (provider .subLocationsList .isNotEmpty) { @@ -1301,7 +1301,6 @@ class _AddleadsprospectsscreenState extends State { provider.selectedSubLocationValue = ""; } - } } }, @@ -1348,13 +1347,10 @@ class _AddleadsprospectsscreenState extends State { // value: provider.selectedSubLocations, value: - provider - .subLocationsList - .isNotEmpty + provider.subLocationsList.isNotEmpty ? provider.selectedSubLocations != null - ? provider - .subLocationsList! + ? provider.subLocationsList .firstWhere( (ord) => ord.id == @@ -1363,7 +1359,7 @@ class _AddleadsprospectsscreenState extends State { orElse: () => provider - .subLocationsList![0]!, + .subLocationsList[0], ) : null : null, @@ -1375,9 +1371,9 @@ class _AddleadsprospectsscreenState extends State { provider.selectedSubLocations = value; provider.selectedSubLocationId = - value!.id!; + value.id!; provider.selectedSubLocationValue = - value!.subLocality!; + value.subLocality!; } } }, @@ -1407,11 +1403,8 @@ class _AddleadsprospectsscreenState extends State { Expanded( child: Text( 'Select Lead Status', - style: TextStyle( - fontSize: 14, - ), - overflow: - TextOverflow.ellipsis, + style: TextStyle(fontSize: 14), + overflow: TextOverflow.ellipsis, ), ), ], @@ -1419,9 +1412,9 @@ class _AddleadsprospectsscreenState extends State { items: ['Cold', 'Hot', 'Warm'] .map( - (value) => DropdownMenuItem< - String - >( + ( + value, + ) => DropdownMenuItem( value: value, child: Text( value ?? '', @@ -1429,8 +1422,7 @@ class _AddleadsprospectsscreenState extends State { fontSize: 14, ), overflow: - TextOverflow - .ellipsis, + TextOverflow.ellipsis, ), ), ) @@ -1521,7 +1513,7 @@ class _AddleadsprospectsscreenState extends State { onTap: () { HapticFeedback.selectionClick(); if (provider.validateStep3()) { - if(provider.productRows.isNotEmpty){ + if (provider.productRows.isNotEmpty) { provider.crmAddNewLeadsAndProspectsAPIFunction( context, "", @@ -1537,10 +1529,9 @@ class _AddleadsprospectsscreenState extends State { provider.selectedLeadStatus, provider.getJsonEncodedProducts(), ); - }else{ + } else { toast(context, "Add min. 1 product"); } - } details.onStepContinue; diff --git a/lib/screens/crm/addProspectLeads.dart b/lib/screens/crm/addProspectLeads.dart index 106b1b4..537697f 100644 --- a/lib/screens/crm/addProspectLeads.dart +++ b/lib/screens/crm/addProspectLeads.dart @@ -114,13 +114,14 @@ class _AddProspectLeadsState extends State { items: editProvider.employeeList .map( - (slist) => DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle(fontSize: 14), - ), - ), + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle(fontSize: 14), + ), + ), ) .toList(), value: @@ -135,9 +136,9 @@ class _AddProspectLeadsState extends State { if (value != null) { if (editProvider.employeeList.isNotEmpty) { editProvider.selectedEmployee = value; - editProvider.selectedEmployeeId = value!.id!; + editProvider.selectedEmployeeId = value.id!; editProvider.selectedEmployeeValue = - value!.name!; + value.name!; } } }, diff --git a/lib/screens/crm/appointmentCalendar.dart b/lib/screens/crm/appointmentCalendar.dart index 781c9d0..441500b 100644 --- a/lib/screens/crm/appointmentCalendar.dart +++ b/lib/screens/crm/appointmentCalendar.dart @@ -261,7 +261,7 @@ class _AppointmentcalendarState extends State { children: [ Expanded( flex: 1, - child: Container( + child: SizedBox( height: 50, width: 35, child: SvgPicture.asset( @@ -341,9 +341,7 @@ class _AppointmentcalendarState extends State { decoration: BoxDecoration( color: AppColors.scaffold_bg_color, ), - child: Center( - child: Text("No Data Available"), - ), + child: Center(child: Text("No Data Available")), ), ), ], @@ -459,7 +457,7 @@ class _AppointmentcalendarState extends State { ), ), const SizedBox(height: 8), - Container( + SizedBox( height: 70, // Increased height to accommodate weekday text child: ListView.builder( controller: scrollController, diff --git a/lib/screens/crm/crmDashboard.dart b/lib/screens/crm/crmDashboard.dart index 5425ff4..25526b7 100644 --- a/lib/screens/crm/crmDashboard.dart +++ b/lib/screens/crm/crmDashboard.dart @@ -192,7 +192,7 @@ class _CrmdashboardScreenState extends State { physics: AlwaysScrollableScrollPhysics(), child: Column( children: [ - if (provider.allLeads.length > 0) ...[ + if (provider.allLeads.isNotEmpty) ...[ Container( padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), margin: EdgeInsets.only(bottom: 10), @@ -274,7 +274,7 @@ class _CrmdashboardScreenState extends State { MaterialPageRoute( builder: (context) => Leadlistbymode( - pageTitleName: "${leadTitles[jndex]}", + pageTitleName: leadTitles[jndex], mode: provider .allLeads[jndex] @@ -527,8 +527,7 @@ class _CrmdashboardScreenState extends State { builder: (context) => Leadlistbymode( mode: "executive", - pageTitleName: - "Lead List", + pageTitleName: "Lead List", ), ), ); @@ -948,7 +947,7 @@ class _CrmdashboardScreenState extends State { ), ], - if (provider.pendingTasksLists.length > 0) ...[ + if (provider.pendingTasksLists.isNotEmpty) ...[ Align( alignment: Alignment.centerLeft, child: Padding( @@ -1003,7 +1002,7 @@ class _CrmdashboardScreenState extends State { ), ), ), - Container( + SizedBox( width: double.infinity, child: ListView.builder( physics: NeverScrollableScrollPhysics(), diff --git a/lib/screens/crm/editAccountDetails.dart b/lib/screens/crm/editAccountDetails.dart index 187e9a7..1d05fc8 100644 --- a/lib/screens/crm/editAccountDetails.dart +++ b/lib/screens/crm/editAccountDetails.dart @@ -17,14 +17,19 @@ class EditAccountDetails extends StatefulWidget { final accountID; final companyName; - const EditAccountDetails({super.key,required this.leadID,required this.mode,required this.accountID,required this.companyName}); + const EditAccountDetails({ + super.key, + required this.leadID, + required this.mode, + required this.accountID, + required this.companyName, + }); @override State createState() => _EditAccountDetailsState(); } class _EditAccountDetailsState extends State { - Dropdowntheme ddtheme = Dropdowntheme(); @override void initState() { @@ -36,7 +41,11 @@ class _EditAccountDetailsState extends State { listen: false, ); provider.editCompanyNameController.text = widget.companyName!; - provider.crmLeadDetailsEditAccountAPIFunction(context, widget.leadID, widget.mode); + provider.crmLeadDetailsEditAccountAPIFunction( + context, + widget.leadID, + widget.mode, + ); }); } @@ -48,25 +57,23 @@ class _EditAccountDetailsState extends State { onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar(context, "Edit Account"), backgroundColor: AppColors.scaffold_bg_color, body: Container( - padding: EdgeInsets.symmetric(horizontal: 10,vertical: 10), - margin: EdgeInsets.symmetric(horizontal: 10,vertical: 5), + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), + margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12.0), - ), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - textControllerWidget( context, provider.editCompanyNameController, @@ -90,30 +97,31 @@ class _EditAccountDetailsState extends State { style: TextStyle(fontSize: 14), ), items: - provider.teamsList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, + provider.teamsList + .map( + (slist) => DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle(fontSize: 14), + ), ), - ), - ), - ) - .toList(), + ) + .toList(), value: provider.selectedTeams, onChanged: (Teams? value) { if (value != null) { - if(provider.teamsList.isNotEmpty){ + if (provider.teamsList.isNotEmpty) { provider.selectedTeams = value; - provider.selectedTeamId = value!.id!; - provider.selectedTeamValue = value!.name!; - provider.crmLeadListSegmentOnTeamAPIFunction(context, widget.mode, provider.selectedTeamId); + provider.selectedTeamId = value.id!; + provider.selectedTeamValue = value.name!; + provider + .crmLeadListSegmentOnTeamAPIFunction( + context, + widget.mode, + provider.selectedTeamId, + ); } - } }, isExpanded: true, @@ -138,29 +146,26 @@ class _EditAccountDetailsState extends State { style: TextStyle(fontSize: 14), ), items: - provider.segmentsList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, + provider.segmentsList + .map( + (slist) => DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle(fontSize: 14), + ), ), - ), - ), - ) - .toList(), + ) + .toList(), value: provider.selectedSegments, onChanged: (Segments? value) { if (value != null) { - if(provider.segmentsList.isNotEmpty){ + if (provider.segmentsList.isNotEmpty) { provider.selectedSegments = value; - provider.selectedSegmentId = value!.id!; - provider.selectedSegmentValue = value!.name!; + provider.selectedSegmentId = value.id!; + provider.selectedSegmentValue = + value.name!; } - } }, isExpanded: true, @@ -173,12 +178,21 @@ class _EditAccountDetailsState extends State { ], ), ), - SizedBox(height: 25,), + SizedBox(height: 25), InkWell( - onTap: provider.isLoading?null:(){ - provider.isLoading = true; - provider.crmLeadDetailsEditAccountSubmitAPIFunction(context, widget.accountID, provider.selectedSegmentId, provider.selectedTeamId); - }, + onTap: + provider.isLoading + ? null + : () { + provider.isLoading = true; + provider + .crmLeadDetailsEditAccountSubmitAPIFunction( + context, + widget.accountID, + provider.selectedSegmentId, + provider.selectedTeamId, + ); + }, child: Container( alignment: Alignment.center, height: 45, @@ -193,11 +207,18 @@ class _EditAccountDetailsState extends State { borderRadius: BorderRadius.circular(14.0), ), child: Center( - child: provider.isLoading?CircularProgressIndicator.adaptive(valueColor: AlwaysStoppedAnimation(AppColors.white),):Text( - "Submit", - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), - ), + child: + provider.isLoading + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.white, + ), + ) + : Text( + "Submit", + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), ), ), ), @@ -205,13 +226,10 @@ class _EditAccountDetailsState extends State { ), ), ), - ), ), ); }, ); } - - } diff --git a/lib/screens/crm/followUpListonType.dart b/lib/screens/crm/followUpListonType.dart index 713ef33..dfa557a 100644 --- a/lib/screens/crm/followUpListonType.dart +++ b/lib/screens/crm/followUpListonType.dart @@ -16,7 +16,7 @@ import 'followUpUpdateScreen.dart'; class Followuplistontype extends StatefulWidget { final type; - const Followuplistontype({super.key,required this.type}); + const Followuplistontype({super.key, required this.type}); @override State createState() => _FollowuplistontypeState(); @@ -62,22 +62,22 @@ class _FollowuplistontypeState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } Widget _scaffold(BuildContext context) { return Consumer( builder: (context, provider, child) { - var followUps = provider.dashboardFollowUps; + var followUps = provider.dashboardFollowUps; return Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.scaffold_bg_color, @@ -114,162 +114,186 @@ class _FollowuplistontypeState extends State { ), ), body: - (followUps.isNotEmpty) - ? SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: Column( - children: [ - Container( - width: double.infinity, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.symmetric( - vertical: 5, - horizontal: 10, - ), - itemCount: followUps.length, - itemBuilder: (context, index) { - final subHeadings = [ - followUps[index].aname ?? "-", - followUps[index].appdate ?? - "-", - followUps[index].anote ?? "-", - ]; - return InkResponse( - onTap: () async { - var res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Followupupdatescreen( - leadID: - followUps[index] - .leadid, - mode: "", - ), - settings: RouteSettings( - name: 'Followupupdatescreen', - ), + (followUps.isNotEmpty) + ? SingleChildScrollView( + physics: AlwaysScrollableScrollPhysics(), + child: Column( + children: [ + SizedBox( + width: double.infinity, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.symmetric( + vertical: 5, + horizontal: 10, ), - ); - if(routeSettingName=="Followupupdatescreen"){ - provider.crmDashboardFollowUpAPIFunction(context, widget.type); - } - }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - ), - margin: EdgeInsets.symmetric(vertical: 3), - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.symmetric( - vertical: 3, - horizontal: 0, - ), - - child: Column( - children: [ - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - "${followUps[index].aname}", - maxLines: 1, - overflow: TextOverflow.visible, - style: TextStyle( - decoration: TextDecoration.underline, - height: 1, - decorationStyle: TextDecorationStyle.dotted, - decorationColor: Color(0xFF676767), - color: AppColors.semi_black, - fontFamily: "JakartaRegular", - fontSize: 14, - ), + itemCount: followUps.length, + itemBuilder: (context, index) { + final subHeadings = [ + followUps[index].aname ?? "-", + followUps[index].appdate ?? "-", + followUps[index].anote ?? "-", + ]; + return InkResponse( + onTap: () async { + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Followupupdatescreen( + leadID: followUps[index].leadid, + mode: "", ), + settings: RouteSettings( + name: 'Followupupdatescreen', + ), + ), + ); + if (routeSettingName == + "Followupupdatescreen") { + provider.crmDashboardFollowUpAPIFunction( + context, + widget.type, + ); + } + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + ), + margin: EdgeInsets.symmetric(vertical: 3), + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.symmetric( + vertical: 3, + horizontal: 0, ), - Expanded( - child: Text( - "${followUps[index].appdate}", - textAlign: TextAlign.right, - maxLines: 1, - style: TextStyle( - color: AppColors.grey_semi, - fontFamily: "JakartaRegular", - fontSize: 14, + + child: Column( + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + "${followUps[index].aname}", + maxLines: 1, + overflow: + TextOverflow.visible, + style: TextStyle( + decoration: + TextDecoration + .underline, + height: 1, + decorationStyle: + TextDecorationStyle + .dotted, + decorationColor: Color( + 0xFF676767, + ), + color: + AppColors.semi_black, + fontFamily: + "JakartaRegular", + fontSize: 14, + ), + ), + ), + Expanded( + child: Text( + "${followUps[index].appdate}", + textAlign: TextAlign.right, + maxLines: 1, + style: TextStyle( + color: + AppColors.grey_semi, + fontFamily: + "JakartaRegular", + fontSize: 14, + ), + ), + ), + ], ), - ), - ), - ], - ), - SizedBox(height: 10,), - Container( - padding: EdgeInsets.symmetric(vertical: 10,horizontal: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - gradient: LinearGradient(colors: [ - Color(0xFFFFFFFF), - Color(0xFFE8F7FF) - ]) - ), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - "Remarks", - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: AppColors.app_blue, - fontFamily: "JakartaRegular", - fontSize: 14, + SizedBox(height: 10), + Container( + padding: EdgeInsets.symmetric( + vertical: 10, + horizontal: 10, ), - ), - ), - Expanded( - child: Text( - "${followUps[index].anote}", - textAlign: TextAlign.right, - maxLines: 1, - style: TextStyle( - color: AppColors.semi_black, - fontFamily: "JakartaRegular", - fontSize: 14, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(16), + gradient: LinearGradient( + colors: [ + Color(0xFFFFFFFF), + Color(0xFFE8F7FF), + ], + ), + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + "Remarks", + maxLines: 1, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + color: + AppColors.app_blue, + fontFamily: + "JakartaRegular", + fontSize: 14, + ), + ), + ), + Expanded( + child: Text( + "${followUps[index].anote}", + textAlign: + TextAlign.right, + maxLines: 1, + style: TextStyle( + color: + AppColors + .semi_black, + fontFamily: + "JakartaRegular", + fontSize: 14, + ), + ), + ), + ], ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), - ), - ], + ); + }, ), ), - ); - }, - ), - ), - SizedBox(height: 150), - ], - ), - ) - : Emptywidget(context), + SizedBox(height: 150), + ], + ), + ) + : Emptywidget(context), ); }, ); diff --git a/lib/screens/crm/followUpUpdateScreen.dart b/lib/screens/crm/followUpUpdateScreen.dart index 2a9b25f..982d98c 100644 --- a/lib/screens/crm/followUpUpdateScreen.dart +++ b/lib/screens/crm/followUpUpdateScreen.dart @@ -15,7 +15,12 @@ class Followupupdatescreen extends StatefulWidget { final leadID; final mode; final from; - const Followupupdatescreen({super.key,required this.leadID, this.mode, this.from}); + const Followupupdatescreen({ + super.key, + required this.leadID, + this.mode, + this.from, + }); @override State createState() => _FollowupupdatescreenState(); @@ -26,7 +31,6 @@ class _FollowupupdatescreenState extends State { Map _source = {ConnectivityResult.mobile: true}; final MyConnectivity _connectivity = MyConnectivity.instance; - @override void initState() { super.initState(); @@ -35,7 +39,10 @@ class _FollowupupdatescreenState extends State { setState(() => _source = event); }); WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - final provider = Provider.of(context,listen: false); + final provider = Provider.of( + context, + listen: false, + ); provider.getCurrentLocation(context); }); } @@ -62,15 +69,15 @@ class _FollowupupdatescreenState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -116,7 +123,7 @@ class _FollowupupdatescreenState extends State { child: Column( children: [ Container( - padding: EdgeInsets.only(left: 10,top: 10), + padding: EdgeInsets.only(left: 10, top: 10), alignment: Alignment.topLeft, child: Text( "Follow up Details", @@ -154,10 +161,7 @@ class _FollowupupdatescreenState extends State { child: Row( children: [ Text( - provider.selectedTime.hour.toString() + - ":" + - provider.selectedTime.minute - .toString() ?? + "${provider.selectedTime.hour}:${provider.selectedTime.minute}" ?? "Enter in Time", textAlign: TextAlign.center, style: TextStyle(fontWeight: FontWeight.w400), @@ -186,21 +190,20 @@ class _FollowupupdatescreenState extends State { ], ), items: - ['Phone', 'Visit'] - .map( - (value) => - DropdownMenuItem( - value: value, - child: Text( - value ?? '', - style: const TextStyle( - fontSize: 14, + ['Phone', 'Visit'] + .map( + (value) => DropdownMenuItem( + value: value, + child: Text( + value ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, + ), ), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), + ) + .toList(), value: provider.selectedFollowupType, onChanged: (String? newValue) { setState(() { @@ -216,8 +219,8 @@ class _FollowupupdatescreenState extends State { ], ), ), - if(provider.followupError!=null)...[ - errorWidget(context, provider.followupError) + if (provider.followupError != null) ...[ + errorWidget(context, provider.followupError), ], textControllerWidget( context, @@ -229,8 +232,8 @@ class _FollowupupdatescreenState extends State { false, null, ), - if(provider.followupFeedbackError!=null)...[ - errorWidget(context, provider.followupFeedbackError) + if (provider.followupFeedbackError != null) ...[ + errorWidget(context, provider.followupFeedbackError), ], TextWidget(context, "Lead Status"), DropdownButtonHideUnderline( @@ -251,21 +254,20 @@ class _FollowupupdatescreenState extends State { ], ), items: - ['All','Cold', 'Hot', 'Warm'] - .map( - (value) => - DropdownMenuItem( - value: value, - child: Text( - value ?? '', - style: const TextStyle( - fontSize: 14, + ['All', 'Cold', 'Hot', 'Warm'] + .map( + (value) => DropdownMenuItem( + value: value, + child: Text( + value ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, + ), ), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), + ) + .toList(), value: provider.selectedLeadStatus, onChanged: (String? newValue) { setState(() { @@ -281,8 +283,8 @@ class _FollowupupdatescreenState extends State { ], ), ), - if(provider.leadStatusError!=null)...[ - errorWidget(context, provider.leadStatusError) + if (provider.leadStatusError != null) ...[ + errorWidget(context, provider.leadStatusError), ], TextWidget( context, @@ -306,24 +308,23 @@ class _FollowupupdatescreenState extends State { ], ), items: - [ - 'Next Appointment', - 'Update Order Status', - ] - .map( - (value) => - DropdownMenuItem( - value: value, - child: Text( - value ?? '', - style: const TextStyle( - fontSize: 14, + [ + 'Next Appointment', + 'Update Order Status', + ] + .map( + (value) => DropdownMenuItem( + value: value, + child: Text( + value ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, + ), ), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), + ) + .toList(), value: provider.nextAppointmentStatus, onChanged: (String? newValue) { setState(() { @@ -339,9 +340,9 @@ class _FollowupupdatescreenState extends State { ], ), ), - if(provider.appStatusError!=null)...[ - errorWidget(context, provider.appStatusError) - ] + if (provider.appStatusError != null) ...[ + errorWidget(context, provider.appStatusError), + ], ], ), ), @@ -389,25 +390,24 @@ class _FollowupupdatescreenState extends State { ], ), items: - [ - // 'Order Gain', - 'Order Lost', - 'No Requirement', - ] - .map( - (value) => - DropdownMenuItem( - value: value, - child: Text( - value ?? '', - style: const TextStyle( - fontSize: 14, + [ + // 'Order Gain', + 'Order Lost', + 'No Requirement', + ] + .map( + (value) => DropdownMenuItem( + value: value, + child: Text( + value ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, + ), ), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), + ) + .toList(), value: provider.selectOrderStatus, onChanged: (String? newValue) { setState(() { @@ -423,301 +423,296 @@ class _FollowupupdatescreenState extends State { ], ), ), - if(provider.orderStatusError!=null)...[ - errorWidget(context, provider.orderStatusError) + if (provider.orderStatusError != null) ...[ + errorWidget(context, provider.orderStatusError), ], if (provider.selectOrderStatus == "Order Gain") ...[] - else - ...[ - if (provider.selectOrderStatus == "Order Lost") ...[ - TextWidget(context, "Select Competitor"), - DropdownButtonHideUnderline( - child: Row( - children: [ - Expanded( - child: DropdownButton2( - isExpanded: true, - hint: const Row( - children: [ - Expanded( - child: Text( - 'Select Competitor', - style: TextStyle(fontSize: 14), - overflow: TextOverflow.ellipsis, - ), + else ...[ + if (provider.selectOrderStatus == "Order Lost") ...[ + TextWidget(context, "Select Competitor"), + DropdownButtonHideUnderline( + child: Row( + children: [ + Expanded( + child: DropdownButton2( + isExpanded: true, + hint: const Row( + children: [ + Expanded( + child: Text( + 'Select Competitor', + style: TextStyle(fontSize: 14), + overflow: TextOverflow.ellipsis, ), - ], - ), - items: - [ - "Mahindra", - "Kirloskar", - "Cummins", - "Ashok Leyland", - "Escorts", - "Eicher", - "Eicher Volovo", - "Ecogen", - "Crompton Greaves", - "Caterpillar", - ] - .map( - (value) => - DropdownMenuItem( - value: value, - child: Text( - value ?? '', - style: const TextStyle( - fontSize: 14, - ), - overflow: - TextOverflow - .ellipsis, - ), - ), - ) - .toList(), - value: provider.selectedCompetitor, - onChanged: (String? newValue) { - setState(() { - provider.selectedCompetitor = - newValue!; - }); - }, - buttonStyleData: ddtheme - .buttonStyleData, - iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: - ddtheme.menuItemStyleData, - dropdownStyleData: - ddtheme.dropdownStyleData, + ), + ], ), + items: + [ + "Mahindra", + "Kirloskar", + "Cummins", + "Ashok Leyland", + "Escorts", + "Eicher", + "Eicher Volovo", + "Ecogen", + "Crompton Greaves", + "Caterpillar", + ] + .map( + (value) => + DropdownMenuItem( + value: value, + child: Text( + value ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow + .ellipsis, + ), + ), + ) + .toList(), + value: provider.selectedCompetitor, + onChanged: (String? newValue) { + setState(() { + provider.selectedCompetitor = + newValue!; + }); + }, + buttonStyleData: ddtheme.buttonStyleData, + iconStyleData: ddtheme.iconStyleData, + menuItemStyleData: + ddtheme.menuItemStyleData, + dropdownStyleData: + ddtheme.dropdownStyleData, ), - ], - ), + ), + ], ), - if(provider.competitorError!=null)...[ - errorWidget(context, provider.competitorError) - ] - ] else - if (provider.selectOrderStatus == - "No Requirement") - ...[], - textControllerWidget( - context, - provider.reasonController, - "Reason", - "Reason (Description)", - provider.onReasonChanged, - TextInputType.text, - false, - null, ), - if(provider.reasonError!=null)...[ - errorWidget(context, provider.reasonError) - ] + if (provider.competitorError != null) ...[ + errorWidget(context, provider.competitorError), + ], + ] else if (provider.selectOrderStatus == + "No Requirement") + ...[], + textControllerWidget( + context, + provider.reasonController, + "Reason", + "Reason (Description)", + provider.onReasonChanged, + TextInputType.text, + false, + null, + ), + if (provider.reasonError != null) ...[ + errorWidget(context, provider.reasonError), ], + ], ], ), ), SizedBox(height: 25), - ] else if(provider.nextAppointmentStatus == - "Next Appointment") - ...[ - Container( - padding: EdgeInsets.only(left: 10), - alignment: Alignment.topLeft, - child: Text( - "Next Appointment", - style: TextStyle( - color: AppColors.grey_thick, - fontSize: 16, - ), + ] else if (provider.nextAppointmentStatus == + "Next Appointment") ...[ + Container( + padding: EdgeInsets.only(left: 10), + alignment: Alignment.topLeft, + child: Text( + "Next Appointment", + style: TextStyle( + color: AppColors.grey_thick, + fontSize: 16, ), ), - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - ), - margin: EdgeInsets.symmetric(vertical: 5, horizontal: 10), - padding: EdgeInsets.symmetric( - horizontal: 10, vertical: 5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - TextWidget(context, "Next Appointment Date"), - GestureDetector( - onTap: () { - provider.showDatePickerDialog(context); - }, - child: Container( - height: 50, - alignment: Alignment.center, - decoration: BoxDecoration( - color: AppColors.text_field_color, - borderRadius: BorderRadius.circular(14), + ), + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(15), + ), + margin: EdgeInsets.symmetric(vertical: 5, horizontal: 10), + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + TextWidget(context, "Next Appointment Date"), + GestureDetector( + onTap: () { + provider.showDatePickerDialog(context); + }, + child: Container( + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: AppColors.text_field_color, + borderRadius: BorderRadius.circular(14), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB( + 10.0, + 0.0, + 10, + 0, ), - child: Padding( - padding: const EdgeInsets.fromLTRB( - 10.0, - 0.0, - 10, - 0, - ), - child: TextFormField( - controller: - provider.nextAppointmentDateController, - keyboardType: TextInputType.text, - enabled: false, - maxLines: 1, - readOnly: true, - onChanged: (value) {}, - decoration: InputDecoration( - hintText: "Enter Date", - hintStyle: TextStyle( - fontWeight: FontWeight.w400, - color: Color(0xFFB4BEC0), - fontSize: 14, - ), - - enabledBorder: InputBorder.none, - disabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, + child: TextFormField( + controller: + provider.nextAppointmentDateController, + keyboardType: TextInputType.text, + enabled: false, + maxLines: 1, + readOnly: true, + onChanged: (value) {}, + decoration: InputDecoration( + hintText: "Enter Date", + hintStyle: TextStyle( + fontWeight: FontWeight.w400, + color: Color(0xFFB4BEC0), + fontSize: 14, ), + + enabledBorder: InputBorder.none, + disabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, ), ), ), ), - if(provider.nextAppDateError!=null)...[ - errorWidget(context, provider.nextAppDateError) - ], - TextWidget(context, "Appointment Type"), - DropdownButtonHideUnderline( - child: Row( - children: [ - Expanded( - child: DropdownButton2( - isExpanded: true, - hint: const Row( - children: [ - Expanded( - child: Text( - 'Select Appointment Type', - style: TextStyle(fontSize: 14), - overflow: TextOverflow.ellipsis, - ), + ), + if (provider.nextAppDateError != null) ...[ + errorWidget(context, provider.nextAppDateError), + ], + TextWidget(context, "Appointment Type"), + DropdownButtonHideUnderline( + child: Row( + children: [ + Expanded( + child: DropdownButton2( + isExpanded: true, + hint: const Row( + children: [ + Expanded( + child: Text( + 'Select Appointment Type', + style: TextStyle(fontSize: 14), + overflow: TextOverflow.ellipsis, ), - ], - ), - items: - ['Phone', 'Visit'] - .map( - (value) => - DropdownMenuItem( - value: value, - child: Text( - value ?? '', - style: const TextStyle( - fontSize: 14, + ), + ], + ), + items: + ['Phone', 'Visit'] + .map( + (value) => DropdownMenuItem( + value: value, + child: Text( + value ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, ), - overflow: TextOverflow.ellipsis, ), - ), - ) - .toList(), - value: provider.selectNextAppointmentType, - onChanged: (String? newValue) { - setState(() { - provider.selectNextAppointmentType = - newValue!; - }); - }, - buttonStyleData: ddtheme.buttonStyleData, - iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: ddtheme - .menuItemStyleData, - dropdownStyleData: ddtheme - .dropdownStyleData, - ), + ) + .toList(), + value: provider.selectNextAppointmentType, + onChanged: (String? newValue) { + setState(() { + provider.selectNextAppointmentType = + newValue!; + }); + }, + buttonStyleData: ddtheme.buttonStyleData, + iconStyleData: ddtheme.iconStyleData, + menuItemStyleData: ddtheme.menuItemStyleData, + dropdownStyleData: ddtheme.dropdownStyleData, ), - ], - ), + ), + ], ), - if(provider.nextAppType!=null)...[ - errorWidget(context, provider.nextAppType) - ], + ), + if (provider.nextAppType != null) ...[ + errorWidget(context, provider.nextAppType), + ], - if (provider.selectNextAppointmentType == - "Visit") ...[ - CheckboxListTile( - activeColor: AppColors.app_blue, - checkboxShape: CircleBorder(), - controlAffinity: ListTileControlAffinity.leading, - value: provider.checked, - contentPadding: EdgeInsets.symmetric( - horizontal: 0), - title: Text( - "Send SMS reminder to Customer", - style: TextStyle( - fontSize: 14, - fontFamily: "JakartaRegular", - ), + if (provider.selectNextAppointmentType == "Visit") ...[ + CheckboxListTile( + activeColor: AppColors.app_blue, + checkboxShape: CircleBorder(), + controlAffinity: ListTileControlAffinity.leading, + value: provider.checked, + contentPadding: EdgeInsets.symmetric(horizontal: 0), + title: Text( + "Send SMS reminder to Customer", + style: TextStyle( + fontSize: 14, + fontFamily: "JakartaRegular", ), - onChanged: (value) { - provider.checked = !provider.checked; - if (value == true) { - provider.smsSent = "1"; - } else { - provider.smsSent = "0"; - } - print(provider.smsSent + - provider.checked.toString()); - }, ), - ], - textControllerWidget( - context, - provider.noteController, - "Note", - "Write Note", - provider.onNoteChanged, - TextInputType.text, - false, - null, + onChanged: (value) { + provider.checked = !provider.checked; + if (value == true) { + provider.smsSent = "1"; + } else { + provider.smsSent = "0"; + } + print( + provider.smsSent + provider.checked.toString(), + ); + }, ), - if(provider.noteError!=null)...[ - errorWidget(context, provider.noteError) - ], ], - ), + textControllerWidget( + context, + provider.noteController, + "Note", + "Write Note", + provider.onNoteChanged, + TextInputType.text, + false, + null, + ), + if (provider.noteError != null) ...[ + errorWidget(context, provider.noteError), + ], + ], ), - SizedBox(height: 25), - ], + ), + SizedBox(height: 25), + ], SizedBox(height: 150), ], ), ), floatingActionButtonLocation: - FloatingActionButtonLocation.centerFloat, + FloatingActionButtonLocation.centerFloat, floatingActionButton: InkResponse( - onTap:provider.submitLoading?null: () { - provider.submitLoading = true; - provider.crmAddFollowUpAPIFunction( - context, - widget.from, - provider.nextAppointmentStatus, - provider.selectOrderStatus, - widget.leadID, - provider.selectedFollowupType, - provider.selectedCompetitor, - provider.selectedLeadStatus, - provider.selectNextAppointmentType, - provider.smsSent, - widget.mode); - }, + onTap: + provider.submitLoading + ? null + : () { + provider.submitLoading = true; + provider.crmAddFollowUpAPIFunction( + context, + widget.from, + provider.nextAppointmentStatus, + provider.selectOrderStatus, + widget.leadID, + provider.selectedFollowupType, + provider.selectedCompetitor, + provider.selectedLeadStatus, + provider.selectNextAppointmentType, + provider.smsSent, + widget.mode, + ); + }, child: Container( height: 45, alignment: Alignment.center, @@ -727,16 +722,19 @@ class _FollowupupdatescreenState extends State { color: AppColors.app_blue, borderRadius: BorderRadius.circular(15), ), - child:provider.submitLoading?CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation(AppColors.white), - ): Text( - "Submit", - style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - color: Colors.white, - ), - ), + child: + provider.submitLoading + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation(AppColors.white), + ) + : Text( + "Submit", + style: TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + color: Colors.white, + ), + ), ), ), ); diff --git a/lib/screens/crm/generateQuotationAddEditProduct.dart b/lib/screens/crm/generateQuotationAddEditProduct.dart index b9f2eb1..5336c74 100644 --- a/lib/screens/crm/generateQuotationAddEditProduct.dart +++ b/lib/screens/crm/generateQuotationAddEditProduct.dart @@ -61,11 +61,11 @@ class _GeneratequotationaddeditproductState if (widget.type == "add") { // Initialize controllers and dropdowns after API call provider.addEditInitializeForm(context); - } else if (widget.type == "edit"){ + } else if (widget.type == "edit") { print(widget.index); print(widget.product); - provider.preFillFormForEdit(widget.product,widget.index); + provider.preFillFormForEdit(widget.product, widget.index); } }); } @@ -147,9 +147,7 @@ class _GeneratequotationaddeditproductState items: provider.productsList .map( - ( - ord, - ) => DropdownMenuItem( + (ord) => DropdownMenuItem( value: ord, child: Text( "${ord.name}", @@ -161,6 +159,7 @@ class _GeneratequotationaddeditproductState ), ) .toList(), + // provider.selectedOrderIds[index] != null? // provider // .orderList @@ -171,25 +170,27 @@ class _GeneratequotationaddeditproductState // provider // .selectedOrderIds[index], // ) - value: provider.selectedProducts != null ? provider.productsList.firstWhere( (element) => element.id == - provider - .selectedAddEditProductId, + provider.selectedAddEditProductId, ) : null, onChanged: (Products? value) { if (value != null) { provider.selectedProducts = value; provider.selectedAddEditProductId = - value!.id!; + value.id!; provider.selectedAddEditProductName = value.name; print(value.id.toString()); - provider.crmSelectedProductDetailsApiFunction(context, value.id.toString()); + provider + .crmSelectedProductDetailsApiFunction( + context, + value.id.toString(), + ); } }, buttonStyleData: ddtheme.buttonStyleData, @@ -261,10 +262,9 @@ class _GeneratequotationaddeditproductState floatingActionButton: InkWell( onTap: () { if (provider.selectedProducts != null) { - var newProduct; + LeadProducts newProduct; if (widget.type == "add") { newProduct = LeadProducts( - productId: provider.selectedAddEditProductId, productName: provider.selectedAddEditProductName, price: provider.addEditProductPriceController.text, @@ -280,7 +280,7 @@ class _GeneratequotationaddeditproductState "net_price": provider.addEditTotalAmountController.text, }); Navigator.pop(context, newProduct); - } else if (widget.type == "edit"){ + } else if (widget.type == "edit") { final updatedProduct = LeadProducts( productId: provider.selectedAddEditProductId, productName: provider.selectedAddEditProductName, diff --git a/lib/screens/crm/generateQuotationScreen.dart b/lib/screens/crm/generateQuotationScreen.dart index 6c627dd..4f363e5 100644 --- a/lib/screens/crm/generateQuotationScreen.dart +++ b/lib/screens/crm/generateQuotationScreen.dart @@ -176,7 +176,7 @@ class _GeneratequotationscreenState extends State { ), ); if (res != null) { - print("result ${res}"); + print("result $res"); // provider // .crmLeadDetailsGenerateQuoteViewAPIFunction( @@ -245,7 +245,7 @@ class _GeneratequotationscreenState extends State { ), ); if (res != null) { - print("result ${res}"); + print("result $res"); } }, child: Container( diff --git a/lib/screens/crm/generatedQuotesList.dart b/lib/screens/crm/generatedQuotesList.dart index ed5f68f..d381314 100644 --- a/lib/screens/crm/generatedQuotesList.dart +++ b/lib/screens/crm/generatedQuotesList.dart @@ -14,7 +14,6 @@ import 'package:provider/provider.dart'; import 'LeadDetailsByMode.dart'; class Generatedquoteslist extends StatefulWidget { - const Generatedquoteslist({super.key}); @override @@ -46,9 +45,8 @@ class _GeneratedquoteslistState extends State { _connectivity.disposeStream(); } - - getDecorationColor(value){ - switch (value){ + getDecorationColor(value) { + switch (value) { case "Hot": return AppColors.processed_bg_color; case "Warm": @@ -60,8 +58,8 @@ class _GeneratedquoteslistState extends State { } } - getTextColor(value){ - switch (value){ + getTextColor(value) { + switch (value) { case "Hot": return AppColors.processed_text_color; case "Warm": @@ -73,7 +71,6 @@ class _GeneratedquoteslistState extends State { } } - @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -89,15 +86,15 @@ class _GeneratedquoteslistState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -141,103 +138,113 @@ class _GeneratedquoteslistState extends State { ), ), body: - (quotess.isNotEmpty) - ? SingleChildScrollView( - physics: AlwaysScrollableScrollPhysics(), - child: Column( - children: [ - Container( - width: double.infinity, - child: ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - padding: EdgeInsets.symmetric( - vertical: 5, - horizontal: 10, - ), - itemCount: quotess.length, - itemBuilder: (context, index) { - - return InkResponse( - onTap: () async { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => LeadDetailsByMode( - pageTitleName: "Lead Details", - mode: "", - leadId: quotess[index].leadid, - ), + (quotess.isNotEmpty) + ? SingleChildScrollView( + physics: AlwaysScrollableScrollPhysics(), + child: Column( + children: [ + SizedBox( + width: double.infinity, + child: ListView.builder( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + padding: EdgeInsets.symmetric( + vertical: 5, + horizontal: 10, ), - ); - }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - ), - margin: EdgeInsets.symmetric(vertical: 3), - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - child: Row( - - children: [ - SvgPicture.asset("assets/svg/finance/fin_payments_ic.svg",), - SizedBox(width: 10,), - Expanded( - flex: 4, - child: Text( - "${quotess[index].aname}", - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - decoration: TextDecoration.underline, - height: 1.5, - decorationStyle: TextDecorationStyle.dotted, - decorationColor: Color(0xFF676767), - color: AppColors.semi_black, - fontFamily: "JakartaRegular", - fontSize: 14, - ), - ), - ), - SizedBox(width: 10,), - Expanded( - flex: 2, + itemCount: quotess.length, + itemBuilder: (context, index) { + return InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => LeadDetailsByMode( + pageTitleName: "Lead Details", + mode: "", + leadId: quotess[index].leadid, + ), + ), + ); + }, child: Container( - padding: EdgeInsets.symmetric(vertical: 5), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: getDecorationColor(quotess[index].lstatus) + color: Colors.white, + borderRadius: BorderRadius.circular(15), ), - child: Text( - "${quotess[index].lstatus}", - textAlign: TextAlign.center, - maxLines: 1, - style: TextStyle( - color: getTextColor(quotess[index].lstatus), - fontFamily: "JakartaRegular", - fontSize: 14, - ), + margin: EdgeInsets.symmetric(vertical: 3), + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + child: Row( + children: [ + SvgPicture.asset( + "assets/svg/finance/fin_payments_ic.svg", + ), + SizedBox(width: 10), + Expanded( + flex: 4, + child: Text( + "${quotess[index].aname}", + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + decoration: + TextDecoration.underline, + height: 1.5, + decorationStyle: + TextDecorationStyle.dotted, + decorationColor: Color(0xFF676767), + color: AppColors.semi_black, + fontFamily: "JakartaRegular", + fontSize: 14, + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 2, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 5, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + 8, + ), + color: getDecorationColor( + quotess[index].lstatus, + ), + ), + child: Text( + "${quotess[index].lstatus}", + textAlign: TextAlign.center, + maxLines: 1, + style: TextStyle( + color: getTextColor( + quotess[index].lstatus, + ), + fontFamily: "JakartaRegular", + fontSize: 14, + ), + ), + ), + ), + ], ), ), - ), - ], + ); + }, ), ), - ); - }, - ), - ), - SizedBox(height: 150), - ], - ), - ) - : Emptywidget(context), + SizedBox(height: 150), + ], + ), + ) + : Emptywidget(context), ); }, ); diff --git a/lib/screens/crm/pendingTasksDetails.dart b/lib/screens/crm/pendingTasksDetails.dart index 63a93c7..6ce95f4 100644 --- a/lib/screens/crm/pendingTasksDetails.dart +++ b/lib/screens/crm/pendingTasksDetails.dart @@ -176,21 +176,26 @@ class _PendingtasksdetailsState extends State { children: [ Expanded( child: Text( - "${subHeadings[j]}", + subHeadings[j], style: TextStyle( - decoration:j == 0 - ? TextDecoration.underline:TextDecoration.none, - height: j == 0 - ? 1:1.5, - decorationStyle: TextDecorationStyle.dotted, - decorationColor: Color(0xFF676767), + decoration: + j == 0 + ? TextDecoration + .underline + : TextDecoration.none, + height: j == 0 ? 1 : 1.5, + decorationStyle: + TextDecorationStyle + .dotted, + decorationColor: Color( + 0xFF676767, + ), fontFamily: "JakartaRegular", fontSize: 14, color: j == 0 ? AppColors.semi_black : AppColors.grey_semi, - ), ), ), @@ -233,7 +238,7 @@ class _PendingtasksdetailsState extends State { children: [ Expanded( child: Text( - "${belowHeads[i]}", + belowHeads[i], style: TextStyle( color: AppColors.semi_black, fontSize: 14, @@ -242,24 +247,39 @@ class _PendingtasksdetailsState extends State { ), Expanded( child: InkResponse( - onTap:belowHeads[i]=="Mobile Number"?(){ - HapticFeedback.selectionClick(); - launch( - 'tel://${belowSubHeads[i]}', - ); - - }:null, + onTap: + belowHeads[i] == + "Mobile Number" + ? () { + HapticFeedback.selectionClick(); + launch( + 'tel://${belowSubHeads[i]}', + ); + } + : null, child: Padding( - padding: const EdgeInsets.all(4.0), + padding: const EdgeInsets.all( + 4.0, + ), child: Text( - "${belowSubHeads[i]}", + belowSubHeads[i], style: TextStyle( - decoration:belowHeads[i]=="Mobile Number" - ? TextDecoration.underline:TextDecoration.none, + decoration: + belowHeads[i] == + "Mobile Number" + ? TextDecoration + .underline + : TextDecoration + .none, - decorationStyle: TextDecorationStyle.dotted, - decorationColor: Color(0xFF676767), - color: AppColors.grey_semi, + decorationStyle: + TextDecorationStyle + .dotted, + decorationColor: Color( + 0xFF676767, + ), + color: + AppColors.grey_semi, fontSize: 14, ), ), @@ -289,10 +309,13 @@ class _PendingtasksdetailsState extends State { HapticFeedback.selectionClick(); await Navigator.push( context, - MaterialPageRoute(builder: (context) => Followupupdatescreen( - leadID: task.leadid, - from:"Pending Tasks" - )), + MaterialPageRoute( + builder: + (context) => Followupupdatescreen( + leadID: task.leadid, + from: "Pending Tasks", + ), + ), ); }, child: Container( diff --git a/lib/screens/crm/pendingTasksList.dart b/lib/screens/crm/pendingTasksList.dart index 39937cd..2d89ab3 100644 --- a/lib/screens/crm/pendingTasksList.dart +++ b/lib/screens/crm/pendingTasksList.dart @@ -122,7 +122,7 @@ class _PendingTasksListState extends State { physics: AlwaysScrollableScrollPhysics(), child: Column( children: [ - Container( + SizedBox( width: double.infinity, child: ListView.builder( physics: NeverScrollableScrollPhysics(), @@ -149,7 +149,9 @@ class _PendingTasksListState extends State { (context) => Pendingtasksdetails( detailIndex: index, ), - settings: RouteSettings(name: 'Pendingtasksdetails') + settings: RouteSettings( + name: 'Pendingtasksdetails', + ), ), ); }, @@ -176,20 +178,29 @@ class _PendingTasksListState extends State { children: [ Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( "${provider.pendingTasksLists[index].aname}", maxLines: 1, - overflow: TextOverflow.visible, + overflow: + TextOverflow.visible, style: TextStyle( - decoration: TextDecoration.underline, + decoration: + TextDecoration + .underline, height: 1, - decorationStyle: TextDecorationStyle.dotted, - decorationColor: Color(0xFF676767), - color: AppColors.semi_black, - fontFamily: "JakartaRegular", + decorationStyle: + TextDecorationStyle + .dotted, + decorationColor: Color( + 0xFF676767, + ), + color: + AppColors.semi_black, + fontFamily: + "JakartaRegular", fontSize: 14, ), ), @@ -200,36 +211,47 @@ class _PendingTasksListState extends State { textAlign: TextAlign.right, maxLines: 1, style: TextStyle( - color: AppColors.grey_semi, - fontFamily: "JakartaRegular", + color: + AppColors.grey_semi, + fontFamily: + "JakartaRegular", fontSize: 14, ), ), ), ], ), - SizedBox(height: 10,), + SizedBox(height: 10), Container( - padding: EdgeInsets.symmetric(vertical: 10,horizontal: 10), + padding: EdgeInsets.symmetric( + vertical: 10, + horizontal: 10, + ), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - gradient: LinearGradient(colors: [ + borderRadius: + BorderRadius.circular(16), + gradient: LinearGradient( + colors: [ Color(0xFFFFFFFF), - Color(0xFFE8F7FF) - ]) + Color(0xFFE8F7FF), + ], + ), ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( "Remarks", maxLines: 1, - overflow: TextOverflow.ellipsis, + overflow: + TextOverflow.ellipsis, style: TextStyle( - color: AppColors.app_blue, - fontFamily: "JakartaRegular", + color: + AppColors.app_blue, + fontFamily: + "JakartaRegular", fontSize: 14, ), ), @@ -237,12 +259,17 @@ class _PendingTasksListState extends State { Expanded( child: Text( "${provider.pendingTasksLists[index].anote}", - textAlign: TextAlign.right, + textAlign: + TextAlign.right, maxLines: 2, - overflow: TextOverflow.ellipsis, + overflow: + TextOverflow.ellipsis, style: TextStyle( - color: AppColors.semi_black, - fontFamily: "JakartaRegular", + color: + AppColors + .semi_black, + fontFamily: + "JakartaRegular", fontSize: 14, ), ), diff --git a/lib/screens/crm/productDetails.dart b/lib/screens/crm/productDetails.dart index 02e4414..829ed3c 100644 --- a/lib/screens/crm/productDetails.dart +++ b/lib/screens/crm/productDetails.dart @@ -2,7 +2,6 @@ import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:generp/Utils/commonServices.dart'; import 'package:generp/screens/crm/editProductsList.dart'; import 'package:provider/provider.dart'; diff --git a/lib/screens/crm/universalSearchScreen.dart b/lib/screens/crm/universalSearchScreen.dart index 8cfaa1e..929e590 100644 --- a/lib/screens/crm/universalSearchScreen.dart +++ b/lib/screens/crm/universalSearchScreen.dart @@ -52,15 +52,9 @@ class _UniversalsearchscreenState extends State { child: Column( children: [ Container( - // padding: const EdgeInsets.fromLTRB(5.0, 0.0, 10, 0), // margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 10), - padding: const EdgeInsets.fromLTRB( - 10.0, - 0.0, - 10, - 10, - ), + padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 10), height: 55, decoration: BoxDecoration( color: AppColors.white, @@ -79,8 +73,11 @@ class _UniversalsearchscreenState extends State { Navigator.pop(context, true); }, child: Container( - - child: SvgPicture.asset("assets/svg/appbar_back_button.svg", height: 25)), + child: SvgPicture.asset( + "assets/svg/appbar_back_button.svg", + height: 25, + ), + ), ), ), Expanded( @@ -128,22 +125,28 @@ class _UniversalsearchscreenState extends State { ), suffixIcon: Container( padding: EdgeInsets.only(right: 10), - child:provider.searchController.text.isNotEmpty? - InkResponse( - onTap: () { - HapticFeedback.selectionClick(); - provider.searchController.clear(); - provider.crmUniversalSearchFunction( - context, - ); - }, - child: SvgPicture.asset( - "assets/svg/crm/clear_search.svg", - ), - ): - SvgPicture.asset( - "assets/svg/search_ic.svg", - ), + child: + provider + .searchController + .text + .isNotEmpty + ? InkResponse( + onTap: () { + HapticFeedback.selectionClick(); + provider.searchController + .clear(); + provider + .crmUniversalSearchFunction( + context, + ); + }, + child: SvgPicture.asset( + "assets/svg/crm/clear_search.svg", + ), + ) + : SvgPicture.asset( + "assets/svg/search_ic.svg", + ), ), counterText: "", hintText: "Search By Name/Mobile", @@ -186,7 +189,7 @@ class _UniversalsearchscreenState extends State { ), ), ], - if (provider.accountsList.length > 0) ...[ + if (provider.accountsList.isNotEmpty) ...[ Align( alignment: Alignment.centerLeft, child: Padding( @@ -209,11 +212,13 @@ class _UniversalsearchscreenState extends State { ), itemCount: provider.accountsList.length, itemBuilder: (context, index) { - String accname = provider.accountsList[index].aname ?? ""; - RegExp regex = - RegExp(provider.searchController.text, caseSensitive: false); - Iterable matches = - regex.allMatches(accname); + String accname = + provider.accountsList[index].aname ?? ""; + RegExp regex = RegExp( + provider.searchController.text, + caseSensitive: false, + ); + Iterable matches = regex.allMatches(accname); List textSpans = []; int previousMatchEnd = 0; @@ -224,7 +229,9 @@ class _UniversalsearchscreenState extends State { textSpans.add( TextSpan( text: accname.substring( - previousMatchEnd, match.start), + previousMatchEnd, + match.start, + ), style: TextStyle( color: AppColors.semi_black, fontSize: 12, @@ -237,8 +244,7 @@ class _UniversalsearchscreenState extends State { // Add the matching text with highlighting textSpans.add( TextSpan( - text: accname.substring( - match.start, match.end), + text: accname.substring(match.start, match.end), style: TextStyle( color: AppColors.app_blue, fontSize: 12, // Highlight color @@ -304,14 +310,16 @@ class _UniversalsearchscreenState extends State { leading: SvgPicture.asset( "assets/svg/crm/crm_search_list_ic.svg", ), - title:RichText(text: TextSpan( - children: textSpans, - style: TextStyle( - color: AppColors.semi_black, - fontSize: 12, // Highlight color - fontFamily: "JakartaMedium", + title: RichText( + text: TextSpan( + children: textSpans, + style: TextStyle( + color: AppColors.semi_black, + fontSize: 12, // Highlight color + fontFamily: "JakartaMedium", + ), ), - )), + ), // trailing: SvgPicture.asset( // "assets/svg/arrow_right_new.svg", // ), @@ -322,7 +330,7 @@ class _UniversalsearchscreenState extends State { ), ], - if (provider.leadsList.length > 0) ...[ + if (provider.leadsList.isNotEmpty) ...[ Align( alignment: Alignment.centerLeft, child: Padding( @@ -345,11 +353,13 @@ class _UniversalsearchscreenState extends State { ), itemCount: provider.leadsList.length, itemBuilder: (context, index) { - String accname = provider.leadsList[index].aname ?? ""; - RegExp regex = - RegExp(provider.searchController.text, caseSensitive: false); - Iterable matches = - regex.allMatches(accname); + String accname = + provider.leadsList[index].aname ?? ""; + RegExp regex = RegExp( + provider.searchController.text, + caseSensitive: false, + ); + Iterable matches = regex.allMatches(accname); List textSpans = []; int previousMatchEnd = 0; @@ -360,7 +370,9 @@ class _UniversalsearchscreenState extends State { textSpans.add( TextSpan( text: accname.substring( - previousMatchEnd, match.start), + previousMatchEnd, + match.start, + ), style: TextStyle( color: AppColors.semi_black, fontSize: 12, @@ -373,8 +385,7 @@ class _UniversalsearchscreenState extends State { // Add the matching text with highlighting textSpans.add( TextSpan( - text: accname.substring( - match.start, match.end), + text: accname.substring(match.start, match.end), style: TextStyle( color: AppColors.app_blue, fontSize: 12, // Highlight color @@ -439,14 +450,16 @@ class _UniversalsearchscreenState extends State { leading: SvgPicture.asset( "assets/svg/crm/crm_search_list_ic.svg", ), - title: RichText(text: TextSpan( - children: textSpans, - style: TextStyle( - color: AppColors.semi_black, - fontSize: 12, // Highlight color - fontFamily: "JakartaMedium", + title: RichText( + text: TextSpan( + children: textSpans, + style: TextStyle( + color: AppColors.semi_black, + fontSize: 12, // Highlight color + fontFamily: "JakartaMedium", + ), ), - )), + ), // trailing: SvgPicture.asset( // "assets/svg/arrow_right_new.svg", // ), @@ -456,7 +469,7 @@ class _UniversalsearchscreenState extends State { }, ), ], - if (provider.enquiresList.length > 0) ...[ + if (provider.enquiresList.isNotEmpty) ...[ Align( alignment: Alignment.centerLeft, child: Padding( @@ -480,17 +493,21 @@ class _UniversalsearchscreenState extends State { itemCount: provider.enquiresList.length, itemBuilder: (context, index) { String accname = ""; - if(provider.enquiresList[index].companyName!.isEmpty){ + if (provider + .enquiresList[index] + .companyName! + .isEmpty) { accname = provider.enquiresList[index].name ?? ""; - }else{ - accname = provider.enquiresList[index].companyName ?? ""; + } else { + accname = + provider.enquiresList[index].companyName ?? ""; } - - RegExp regex = - RegExp(provider.searchController.text, caseSensitive: false); - Iterable matches = - regex.allMatches(accname); + RegExp regex = RegExp( + provider.searchController.text, + caseSensitive: false, + ); + Iterable matches = regex.allMatches(accname); List textSpans = []; int previousMatchEnd = 0; @@ -501,7 +518,9 @@ class _UniversalsearchscreenState extends State { textSpans.add( TextSpan( text: accname.substring( - previousMatchEnd, match.start), + previousMatchEnd, + match.start, + ), style: TextStyle( color: AppColors.semi_black, fontSize: 12, @@ -514,8 +533,7 @@ class _UniversalsearchscreenState extends State { // Add the matching text with highlighting textSpans.add( TextSpan( - text: accname.substring( - match.start, match.end), + text: accname.substring(match.start, match.end), style: TextStyle( color: AppColors.app_blue, fontSize: 12, // Highlight color @@ -557,7 +575,7 @@ class _UniversalsearchscreenState extends State { ), child: ListTile( leading: SvgPicture.asset( - "assets/svg/crm/crm_search_list_ic.svg", + "assets/svg/crm/crm_search_list_ic.svg", ), // title: Text( // provider.enquiresList[index].companyName == "" @@ -568,14 +586,16 @@ class _UniversalsearchscreenState extends State { // fontSize: 14, // ), // ), - title:RichText(text: TextSpan( - children: textSpans, - style: TextStyle( - color: AppColors.semi_black, - fontSize: 12, // Highlight color - fontFamily: "JakartaMedium", + title: RichText( + text: TextSpan( + children: textSpans, + style: TextStyle( + color: AppColors.semi_black, + fontSize: 12, // Highlight color + fontFamily: "JakartaMedium", + ), ), - )), + ), // trailing: SvgPicture.asset( // "assets/svg/arrow_right_new.svg", // ), diff --git a/lib/screens/finance/AllPaymentRequesitionListsByModes.dart b/lib/screens/finance/AllPaymentRequesitionListsByModes.dart index c185781..fab6e4b 100644 --- a/lib/screens/finance/AllPaymentRequesitionListsByModes.dart +++ b/lib/screens/finance/AllPaymentRequesitionListsByModes.dart @@ -77,7 +77,7 @@ class _AllpaymentrequesitionlistsbymodesState _scrollController.addListener(() { if (_scrollController.position.pixels >= - _scrollController.position.maxScrollExtent - 200 && + _scrollController.position.maxScrollExtent - 200 && !provider.isLoadingMore && provider.hasMoreData) { provider.paymentRequestionListsAPIFunction( @@ -337,316 +337,317 @@ class _AllpaymentrequesitionlistsbymodesState 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading && requestLists.isEmpty - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation(AppColors.app_blue), - ), - ) - : requestLists.isNotEmpty - ? RefreshIndicator( - onRefresh: () async { - provider.resetPagination(); - await provider.paymentRequestionListsAPIFunction( - context, - widget.mode, - "", - "", - ); - }, - child: Scrollbar( - controller: _scrollController, // attach here - thumbVisibility: false, - child: ListView.builder( - controller: _scrollController, - physics: const AlwaysScrollableScrollPhysics(), - itemCount: - requestLists.length + (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, index) { - // loader row for pagination - if (index == requestLists.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center( - child: CircularProgressIndicator(), + body: + provider.isLoading && requestLists.isEmpty + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - ) - : const SizedBox.shrink(); - } - - // Your swipe logic untouched - final request = requestLists[index]; - shouldShowSwipeButtons(request.status); - - return InkResponse( - onTap: () async { - HapticFeedback.selectionClick(); - var res = await Navigator.push( + ), + ) + : requestLists.isNotEmpty + ? RefreshIndicator( + onRefresh: () async { + provider.resetPagination(); + await provider.paymentRequestionListsAPIFunction( context, - MaterialPageRoute( - builder: - (context) => Paymentrequestionlistdetails( - pageName: widget.pageTitleName, - mode: widget.mode, - paymentRequestId: - requestLists[index].id, - ), - settings: RouteSettings( - name: "Paymentrequestionlistdetails", - ), - ), + widget.mode, + "", + "", ); - if (routeSettingName == - "Paymentrequestionlistdetails") { - print("croos refresh"); - provider.paymentRequestionListsAPIFunction( - context, - widget.mode, - "", - "", - ); - } }, - child: Container( - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(20), - child: Slidable( - startActionPane: - shouldShowButtons - ? ActionPane( - motion: const ScrollMotion(), - dragDismissible: false, - - // dismissible: DismissiblePane(onDismissed: () {}), - children: [ - if (shouldShowButtons && - ![ - "admin", - "self", - ].contains(widget.mode)) ...[ - SlidableAction( - onPressed: (context) { - _showLevelRejectionSheet( - context, - requestLists[index].id, - ); - }, - backgroundColor: Color( - 0xFFFFE5E5, - ), - foregroundColor: Color( - 0xFFEF3739, + child: Scrollbar( + controller: _scrollController, // attach here + thumbVisibility: false, + child: ListView.builder( + controller: _scrollController, + physics: const AlwaysScrollableScrollPhysics(), + itemCount: + requestLists.length + + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, index) { + // loader row for pagination + if (index == requestLists.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), + child: Center( + child: CircularProgressIndicator(), ), - icon: Icons.clear, - label: 'Reject', - ), - ], + ) + : const SizedBox.shrink(); + } - if (widget.mode == "process") ...[ - SlidableAction( - onPressed: (context) { - detailsProvider - .approveRejectPaymentRequestAPIFunction( - context, - requestLists[index] - .id, - ); - detailsProvider.preValues(); - _showAddPaymentSheet( - context, - requestLists[index].id, - ); - }, - backgroundColor: Color( - 0xFFFFF8E5, - ), - foregroundColor: Color( - 0xFFFFB600, - ), - icon: Icons.add, - label: 'Add Payment', - ), - ], - ], - ) - : null, - endActionPane: - shouldShowButtons - ? ActionPane( - motion: const ScrollMotion(), - key: ValueKey( - requestLists[index].id, - ), - dragDismissible: false, + // Your swipe logic untouched + final request = requestLists[index]; + shouldShowSwipeButtons(request.status); - // dismissible: DismissiblePane( - // - // onDismissed: () {}, - // closeOnCancel: true, - // resizeDuration: Duration(milliseconds: 300),), - children: [ - if ([ - "apr_lvl1", - "apr_lvl2", - "self_apr_lvl2", - ].contains(widget.mode)) ...[ - SlidableAction( - onPressed: (context) { - detailsProvider - .paymentRequesitionDetails( - context, - requestLists[index] - .id, - ); - detailsProvider.preValues(); - detailsProvider - .approveRejectPaymentRequestAPIFunction( - context, - requestLists[index] - .id, - ); - _showLevelApprovalSheet( - context, - requestLists[index].id, - ); - }, - backgroundColor: Color( - 0xFFE9FFE8, - ), - foregroundColor: Color( - 0xFF4CB443, + return InkResponse( + onTap: () async { + HapticFeedback.selectionClick(); + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Paymentrequestionlistdetails( + pageName: widget.pageTitleName, + mode: widget.mode, + paymentRequestId: + requestLists[index].id, + ), + settings: RouteSettings( + name: "Paymentrequestionlistdetails", ), - icon: Icons.check, - label: 'Approve', ), - ], - ], - ) - : null, + ); + if (routeSettingName == + "Paymentrequestionlistdetails") { + print("croos refresh"); + provider.paymentRequestionListsAPIFunction( + context, + widget.mode, + "", + "", + ); + } + }, + child: Container( + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(20), + child: Slidable( + startActionPane: + shouldShowButtons + ? ActionPane( + motion: const ScrollMotion(), + dragDismissible: false, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 50, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: getDecorationColor( - requestLists[index].status, - ), - shape: BoxShape.circle, - ), - child: Center( - child: Text( - getText( - requestLists[index] - .status, - ), - style: TextStyle( - color: getTextColor( - requestLists[index] - .status, - ), - fontSize: getSize( - requestLists[index] - .status, - ), - fontFamily: "JakartaBold", + // dismissible: DismissiblePane(onDismissed: () {}), + children: [ + if (shouldShowButtons && + ![ + "admin", + "self", + ].contains(widget.mode)) ...[ + SlidableAction( + onPressed: (context) { + _showLevelRejectionSheet( + context, + requestLists[index].id, + ); + }, + backgroundColor: Color( + 0xFFFFE5E5, + ), + foregroundColor: Color( + 0xFFEF3739, + ), + icon: Icons.clear, + label: 'Reject', + ), + ], + + if (widget.mode == "process") ...[ + SlidableAction( + onPressed: (context) { + detailsProvider + .approveRejectPaymentRequestAPIFunction( + context, + requestLists[index] + .id, + ); + detailsProvider.preValues(); + _showAddPaymentSheet( + context, + requestLists[index].id, + ); + }, + backgroundColor: Color( + 0xFFFFF8E5, + ), + foregroundColor: Color( + 0xFFFFB600, + ), + icon: Icons.add, + label: 'Add Payment', + ), + ], + ], + ) + : null, + endActionPane: + shouldShowButtons + ? ActionPane( + motion: const ScrollMotion(), + key: ValueKey( + requestLists[index].id, ), - ), - ), - ), + dragDismissible: false, + + // dismissible: DismissiblePane( + // + // onDismissed: () {}, + // closeOnCancel: true, + // resizeDuration: Duration(milliseconds: 300),), + children: [ + if ([ + "apr_lvl1", + "apr_lvl2", + "self_apr_lvl2", + ].contains(widget.mode)) ...[ + SlidableAction( + onPressed: (context) { + detailsProvider + .paymentRequesitionDetails( + context, + requestLists[index] + .id, + ); + detailsProvider.preValues(); + detailsProvider + .approveRejectPaymentRequestAPIFunction( + context, + requestLists[index] + .id, + ); + _showLevelApprovalSheet( + context, + requestLists[index].id, + ); + }, + backgroundColor: Color( + 0xFFE9FFE8, + ), + foregroundColor: Color( + 0xFF4CB443, + ), + icon: Icons.check, + label: 'Approve', + ), + ], + ], + ) + : null, + + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + child: Column( + children: [ + Row( children: [ - Text( - requestLists[index] - .accountName!, - maxLines: 1, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontFamily: - "JakartaRegular", - fontSize: 14, - color: - AppColors - .semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 50, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: getDecorationColor( + requestLists[index].status, + ), + shape: BoxShape.circle, + ), + child: Center( + child: Text( + getText( + requestLists[index] + .status, + ), + style: TextStyle( + color: getTextColor( + requestLists[index] + .status, + ), + fontSize: getSize( + requestLists[index] + .status, + ), + fontFamily: "JakartaBold", + ), + ), + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + requestLists[index] + .accountName!, + maxLines: 1, + overflow: + TextOverflow.ellipsis, + style: TextStyle( + fontFamily: + "JakartaRegular", + fontSize: 14, + color: + AppColors + .semi_black, + ), + ), + Text( + "${requestLists[index].date}", + style: TextStyle( + fontFamily: + "JakartaRegular", + fontSize: 14, + color: + AppColors.app_blue, + ), + ), + ], + ), ), ), - Text( - "${requestLists[index].date}", - style: TextStyle( - fontFamily: - "JakartaRegular", - fontSize: 14, - color: - AppColors.app_blue, + Expanded( + flex: 3, + child: Text( + maxLines: 1, + "₹ ${requestLists[index].amount!}", + textAlign: TextAlign.right, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), ), ), ], ), - ), - ), - Expanded( - flex: 3, - child: Text( - maxLines: 1, - "₹ ${requestLists[index].amount!}", - textAlign: TextAlign.right, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), + ], ), - ], + ), ), - ], + ), ), - ), - ), + ); + }, ), ), - ); - }, - ), - ), - ) - : Emptywidget(context), - + ) + : Emptywidget(context), ); }, ); } - - Future _showLevelApprovalSheet(BuildContext context, paymentID) { return showModalBottomSheet( useSafeArea: true, @@ -791,8 +792,7 @@ class _AllpaymentrequesitionlistsbymodesState provider.selectedID = value.id!; provider.selectedValue = value.name!; print( - "hfjkshfg" + - provider.selectedID.toString(), + "hfjkshfg${provider.selectedID}", ); } } @@ -1079,10 +1079,6 @@ class _AllpaymentrequesitionlistsbymodesState child: Consumer( builder: (context, provider, child) { // Fallback UI if provider data is not ready - if (provider.paymentsAccounts == null) { - return Center(child: CircularProgressIndicator()); - } - return Container( // Constrain the height to avoid overflow constraints: BoxConstraints( @@ -1623,7 +1619,7 @@ class _AllpaymentrequesitionlistsbymodesState Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -1635,7 +1631,7 @@ class _AllpaymentrequesitionlistsbymodesState Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/finance/FileViewer.dart b/lib/screens/finance/FileViewer.dart index 23297fa..cc7d0b0 100644 --- a/lib/screens/finance/FileViewer.dart +++ b/lib/screens/finance/FileViewer.dart @@ -79,7 +79,7 @@ class _FileviewerState extends State { Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: true, - appBar: appbarNew(context, "File Viewer",0xFFFFFFFF), + appBar: appbarNew(context, "File Viewer", 0xFFFFFFFF), body: SafeArea(child: Center(child: fileWidget(context))), ); } @@ -172,7 +172,7 @@ class _FileviewerState extends State { }, onConsoleMessage: (controller, consoleMessage) { if (kDebugMode) { - debugPrint("consoleMessage${consoleMessage}"); + debugPrint("consoleMessage$consoleMessage"); } debugPrint("JavaScript console message: ${consoleMessage.message}"); }, @@ -185,11 +185,9 @@ class _FileviewerState extends State { Future _loadPdf(String url) async { try { final response = await http.get(Uri.parse(url)); - if (response != null) { - if (response.statusCode == 200) { - print(response.bodyBytes); - return response.bodyBytes; - } + if (response.statusCode == 200) { + print(response.bodyBytes); + return response.bodyBytes; } } catch (e) { print('Error loading PDF: $e'); diff --git a/lib/screens/finance/PaymentRequestionListDetails.dart b/lib/screens/finance/PaymentRequestionListDetails.dart index 624b072..3bd69a8 100644 --- a/lib/screens/finance/PaymentRequestionListDetails.dart +++ b/lib/screens/finance/PaymentRequestionListDetails.dart @@ -187,20 +187,20 @@ class _PaymentrequestionlistdetailsState Widget _scaffold(BuildContext context) { return Consumer( builder: (context, provider, child) { - var req_det = provider.requestsDetails; + var reqDet = provider.requestsDetails; isLevel1Finalized = [ "Level 1 Approved", "Level 1 Rejected", "Level 1 approved", "Level 1 rejected", - ].contains(req_det.status); + ].contains(reqDet.status); isLevel2Finalized = [ "Level 2 Approved", "Level 2 Rejected", "Level 2 approved", "Level 2 rejected", - ].contains(req_det.status); + ].contains(reqDet.status); if (widget.mode == "apr_lvl1") { shouldShowButtons = !isLevel1Finalized; } else if (widget.mode == "apr_lvl2") { @@ -210,14 +210,14 @@ class _PaymentrequestionlistdetailsState "Requested", "Level 1 Approved", "Level 1 approved", - ].contains(req_det.status); + ].contains(reqDet.status); } else if (widget.mode == "process") { shouldShowButtons = [ "Level 2 Approved", "Level 2 approved", - ].contains(req_det.status); + ].contains(reqDet.status); } else if (widget.mode == "self_apr_lvl2") { - shouldShowButtons = ["Requested"].contains(req_det.status); + shouldShowButtons = ["Requested"].contains(reqDet.status); } return Scaffold( resizeToAvoidBottomInset: true, @@ -262,9 +262,9 @@ class _PaymentrequestionlistdetailsState crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - req_det.accountName == "" + reqDet.accountName == "" ? "-" - : req_det.accountName ?? "-", + : reqDet.accountName ?? "-", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -272,9 +272,9 @@ class _PaymentrequestionlistdetailsState ), ), Text( - req_det.amount == "" + reqDet.amount == "" ? "-" - : "₹${req_det.amount}", + : "₹${reqDet.amount}", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -298,7 +298,7 @@ class _PaymentrequestionlistdetailsState ), child: Center( child: Text( - req_det.status ?? "-", + reqDet.status ?? "-", textAlign: TextAlign.center, style: TextStyle( fontFamily: "JakartaMedium", @@ -314,7 +314,7 @@ class _PaymentrequestionlistdetailsState Divider(thickness: 0.5, color: Color(0xFFD7D7D7)), ...List.generate(provider.subHeadings.length, (j) { if (provider.Headings[j] == "Attachment" && - req_det.attachmentViewFileName == "") { + reqDet.attachmentViewFileName == "") { return SizedBox.shrink(); } return Container( @@ -343,11 +343,11 @@ class _PaymentrequestionlistdetailsState builder: (context) => Fileviewer( fileName: - req_det + reqDet .attachmentViewFileName ?? "", fileUrl: - req_det + reqDet .attachmentDirFilePath ?? "", ), @@ -667,21 +667,21 @@ class _PaymentrequestionlistdetailsState Widget _scaffold1(BuildContext context) { return Consumer( builder: (context, provider, child) { - var req_det = provider.requestsDetails; - var pay_det = provider.paymentsDetails; + var reqDet = provider.requestsDetails; + var payDet = provider.paymentsDetails; isLevel1Finalized = [ "Level 1 Approved", "Level 1 Rejected", "Level 1 approved", "Level 1 rejected", - ].contains(req_det.status); + ].contains(reqDet.status); isLevel2Finalized = [ "Level 2 Approved", "Level 2 Rejected", "Level 2 approved", "Level 2 rejected", - ].contains(req_det.status); + ].contains(reqDet.status); if (widget.mode == "apr_lvl1") { shouldShowButtons = !isLevel1Finalized; } else if (widget.mode == "apr_lvl2") { @@ -691,14 +691,14 @@ class _PaymentrequestionlistdetailsState "Requested", "Level 1 Approved", "Level 1 approved", - ].contains(req_det.status); + ].contains(reqDet.status); } else if (widget.mode == "process") { shouldShowButtons = [ "Level 2 Approved", "Level 2 approved", - ].contains(req_det.status); + ].contains(reqDet.status); } else if (widget.mode == "self_apr_lvl2") { - shouldShowButtons = ["Requested"].contains(req_det.status); + shouldShowButtons = ["Requested"].contains(reqDet.status); } final headings2 = [ @@ -709,11 +709,11 @@ class _PaymentrequestionlistdetailsState "Requested Date", ]; final subHeadings2 = [ - req_det.proposedAccount ?? "-", - req_det.requestingPurpose ?? "-", - req_det.requestedAmount ?? "-", - req_det.amount ?? "-", - req_det.date ?? "-", + reqDet.proposedAccount ?? "-", + reqDet.requestingPurpose ?? "-", + reqDet.requestedAmount ?? "-", + reqDet.amount ?? "-", + reqDet.date ?? "-", ]; final headings3 = [ @@ -726,12 +726,12 @@ class _PaymentrequestionlistdetailsState "Attachment", ]; final subHeadings3 = [ - pay_det.accountName ?? "-", - pay_det.paymentAccountName ?? "-", - pay_det.mode ?? "-", - pay_det.paymentEmployeeName ?? "-", - req_det.amount ?? "-", - req_det.date ?? "-", + payDet.accountName ?? "-", + payDet.paymentAccountName ?? "-", + payDet.mode ?? "-", + payDet.paymentEmployeeName ?? "-", + reqDet.amount ?? "-", + reqDet.date ?? "-", "View", ]; final headings4 = [ @@ -743,12 +743,12 @@ class _PaymentrequestionlistdetailsState "UPI ID", ]; final subHeadings4 = [ - pay_det.bankName ?? "-", - pay_det.bankAccountHolderName ?? "-", - pay_det.bankAccountNumber ?? "-", - pay_det.bankBranchName ?? "-", - pay_det.bankIfscCode ?? "-", - pay_det.bankUpiId ?? "-", + payDet.bankName ?? "-", + payDet.bankAccountHolderName ?? "-", + payDet.bankAccountNumber ?? "-", + payDet.bankBranchName ?? "-", + payDet.bankIfscCode ?? "-", + payDet.bankUpiId ?? "-", ]; final headings5 = [ "Level 1 Approved By", @@ -757,15 +757,15 @@ class _PaymentrequestionlistdetailsState "Level 2 Remarks", ]; final subHeadings5 = [ - req_det.level1Employee ?? "-", - req_det.level1ApprovalRemarks ?? "-", - req_det.level2Employee ?? "-", - req_det.level2ApprovalRemarks ?? "-", + reqDet.level1Employee ?? "-", + reqDet.level1ApprovalRemarks ?? "-", + reqDet.level2Employee ?? "-", + reqDet.level2ApprovalRemarks ?? "-", ]; final headings6 = ["Note", "Created Employee"]; final subHeadings6 = [ - req_det.description ?? "-", - req_det.createdEmployee ?? "-", + reqDet.description ?? "-", + reqDet.createdEmployee ?? "-", ]; final sections = [ @@ -873,9 +873,9 @@ class _PaymentrequestionlistdetailsState bottom: 4, ), child: Text( - req_det.accountName == "" + reqDet.accountName == "" ? "-" - : req_det.accountName ?? "-", + : reqDet.accountName ?? "-", style: TextStyle( decoration: TextDecoration.underline, decorationStyle: @@ -890,9 +890,9 @@ class _PaymentrequestionlistdetailsState ), ), Text( - req_det.amount == "" + reqDet.amount == "" ? "-" - : "₹${req_det.amount}", + : "₹${reqDet.amount}", style: TextStyle( fontFamily: "JakartaRegular", fontSize: 14, @@ -912,16 +912,16 @@ class _PaymentrequestionlistdetailsState ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: getDecorationColor(req_det.status ?? "-"), + color: getDecorationColor(reqDet.status ?? "-"), ), child: Center( child: Text( - getText(req_det.status ?? "-"), + getText(reqDet.status ?? "-"), textAlign: TextAlign.center, style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, - color: getTextColor(req_det.status), + color: getTextColor(reqDet.status), ), ), ), @@ -972,7 +972,7 @@ class _PaymentrequestionlistdetailsState Column( children: List.generate(headings.length, (j) { if (provider.Headings[j] == "Attachment" && - req_det.attachmentViewFileName == "") { + reqDet.attachmentViewFileName == "") { return SizedBox.shrink(); } return Container( @@ -1004,11 +1004,11 @@ class _PaymentrequestionlistdetailsState context, ) => Fileviewer( fileName: - req_det + reqDet .attachmentViewFileName ?? "", fileUrl: - req_det + reqDet .attachmentDirFilePath ?? "", ), @@ -1446,8 +1446,7 @@ class _PaymentrequestionlistdetailsState provider.selectedID = value.id!; provider.selectedValue = value.name!; print( - "hfjkshfg" + - provider.selectedID.toString(), + "hfjkshfg${provider.selectedID}", ); } } @@ -2151,16 +2150,9 @@ class _PaymentrequestionlistdetailsState child: Consumer( builder: (context, provider, child) { // Fallback UI if provider data is not ready - if (provider.paymentsAccounts == null) { - return Center(child: CircularProgressIndicator()); - } - return Padding( padding: EdgeInsets.only( - bottom: - MediaQuery.of( - context, - ).viewInsets.bottom, + bottom: MediaQuery.of(context).viewInsets.bottom, ), child: Container( // Constrain the height to avoid overflow @@ -2261,7 +2253,8 @@ class _PaymentrequestionlistdetailsState provider .selectedPaymentAccounts, onChanged: ( - PaymentAccounts? value, + PaymentAccounts? + value, ) { if (value != null && provider @@ -2301,7 +2294,8 @@ class _PaymentrequestionlistdetailsState EdgeInsets.symmetric( horizontal: 10, - vertical: 8, + vertical: + 8, ), hintText: 'Search account...', @@ -2342,7 +2336,8 @@ class _PaymentrequestionlistdetailsState ddtheme .buttonStyleData, iconStyleData: - ddtheme.iconStyleData, + ddtheme + .iconStyleData, menuItemStyleData: ddtheme .menuItemStyleData, @@ -2433,7 +2428,9 @@ class _PaymentrequestionlistdetailsState decoration: BoxDecoration( color: Color(0xFFE6F6FF), borderRadius: - BorderRadius.circular(12), + BorderRadius.circular( + 12, + ), border: Border.all( color: AppColors.app_blue, width: 0.5, @@ -2445,14 +2442,16 @@ class _PaymentrequestionlistdetailsState style: TextStyle( fontFamily: "JakartaMedium", - color: AppColors.app_blue, + color: + AppColors.app_blue, ), ), ), ), ), if (provider.imagePicked == 1 && - provider.imagePath != null) ...[ + provider.imagePath != + null) ...[ Padding( padding: const EdgeInsets.symmetric( @@ -2477,8 +2476,8 @@ class _PaymentrequestionlistdetailsState InkResponse( onTap: () { setState(() { - provider.imagePicked = - 0; + provider + .imagePicked = 0; provider.imagePath = null; provider.imageFilePath = @@ -2645,10 +2644,7 @@ class _PaymentrequestionlistdetailsState builder: (context, provider, child) { return Padding( padding: EdgeInsets.only( - bottom: - MediaQuery.of( - context, - ).viewInsets.bottom, + bottom: MediaQuery.of(context).viewInsets.bottom, ), child: Container( constraints: BoxConstraints( @@ -2680,7 +2676,8 @@ class _PaymentrequestionlistdetailsState ), textControllerWidget( context, - provider.editPaymentRequestedEditableAmountController, + provider + .editPaymentRequestedEditableAmountController, "Approved Amount", "Enter Approved Amount", (p0) { @@ -2704,7 +2701,8 @@ class _PaymentrequestionlistdetailsState provider.editPaymentProcessLoading ? null : () { - provider.editPaymentProcessLoading = true; + provider.editPaymentProcessLoading = + true; provider.editProcessedPaymentAmountAPIFunction( context, @@ -2731,7 +2729,9 @@ class _PaymentrequestionlistdetailsState : Text( "Submit", textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), + style: TextStyle( + color: Colors.white, + ), ), ), ), @@ -2801,7 +2801,7 @@ class _PaymentrequestionlistdetailsState Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -2812,7 +2812,7 @@ class _PaymentrequestionlistdetailsState Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/finance/addPaymentReceiptList.dart b/lib/screens/finance/addPaymentReceiptList.dart index a192d43..e6f80c6 100644 --- a/lib/screens/finance/addPaymentReceiptList.dart +++ b/lib/screens/finance/addPaymentReceiptList.dart @@ -97,7 +97,7 @@ class _AddpaymentreceiptlistState extends State { "${widget.pageTitleName}", provider.resetForm, SizedBox.shrink(), - 0xFFFFFFFF + 0xFFFFFFFF, ), body: Scrollbar( thumbVisibility: false, @@ -107,7 +107,8 @@ class _AddpaymentreceiptlistState extends State { decoration: BoxDecoration( color: AppColors.white, borderRadius: BorderRadius.circular(20), - ),margin: EdgeInsets.only(top: 10,left: 10,right: 10), + ), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -124,18 +125,16 @@ class _AddpaymentreceiptlistState extends State { overflow: TextOverflow.ellipsis, ), items: [ - ...provider.receiptAccounts - .map( - (accs) => DropdownMenuItem( - value: accs, - child: Text( - accs.name ?? '', - style: const TextStyle(fontSize: 14), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), + ...provider.receiptAccounts.map( + (accs) => DropdownMenuItem( + value: accs, + child: Text( + accs.name ?? '', + style: const TextStyle(fontSize: 14), + overflow: TextOverflow.ellipsis, + ), + ), + ), ], value: provider.selectreceiptAccounts, onChanged: (Accounts? value) { @@ -148,8 +147,7 @@ class _AddpaymentreceiptlistState extends State { provider.receiptAccountId = value.id!; provider.receiptAccountValue = value.name!; print( - "hfjkshfg" + - provider.receiptAccountId.toString(), + "hfjkshfg${provider.receiptAccountId}", ); } } @@ -161,13 +159,15 @@ class _AddpaymentreceiptlistState extends State { searchInnerWidget: Padding( padding: const EdgeInsets.all(8), child: TextFormField( - controller: provider.accountSearchController, + controller: + provider.accountSearchController, decoration: InputDecoration( isDense: true, - contentPadding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), + contentPadding: + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), hintText: 'Search account...', border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -176,12 +176,14 @@ class _AddpaymentreceiptlistState extends State { ), ), searchMatchFn: (item, searchValue) { - return item.value?.name?.toLowerCase().contains( - searchValue.toLowerCase(), - ) ?? + return item.value?.name + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, - + // Optional: clear search text when dropdown closes ), onMenuStateChange: (isOpen) { @@ -233,17 +235,17 @@ class _AddpaymentreceiptlistState extends State { if (provider .receiptPaymentAccounts .isNotEmpty) { - provider.selectreceiptPaymentAccounts = value; + provider.selectreceiptPaymentAccounts = + value; print( "Selected Complaint Type: ${value.name}, ID: ${value.id}", ); - provider.receiptPaymentAccountsID = value.id!; + provider.receiptPaymentAccountsID = + value.id!; provider.receiptPaymentAccountsValue = value.name!; print( - "hfjkshfg" + - provider.receiptPaymentAccountsID - .toString(), + "hfjkshfg${provider.receiptPaymentAccountsID}", ); } } @@ -259,10 +261,11 @@ class _AddpaymentreceiptlistState extends State { provider.paymentAccountSearchController, decoration: InputDecoration( isDense: true, - contentPadding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), + contentPadding: + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), hintText: 'Search account...', border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -271,17 +274,20 @@ class _AddpaymentreceiptlistState extends State { ), ), searchMatchFn: (item, searchValue) { - return item.value?.name?.toLowerCase().contains( - searchValue.toLowerCase(), - ) ?? + return item.value?.name + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, - + // Optional: clear search text when dropdown closes ), onMenuStateChange: (isOpen) { if (!isOpen) { - provider.paymentAccountSearchController.clear(); + provider.paymentAccountSearchController + .clear(); } }, buttonStyleData: ddtheme.buttonStyleData, @@ -294,7 +300,7 @@ class _AddpaymentreceiptlistState extends State { ), ), errorWidget(context, provider.selectPaymentAccountError), - + textControllerWidget( context, provider.amountController, @@ -309,7 +315,7 @@ class _AddpaymentreceiptlistState extends State { TextInputAction.next, ), errorWidget(context, provider.amountError), - + ///payment date toBE TextWidget(context, "Receipt Date"), GestureDetector( @@ -358,7 +364,7 @@ class _AddpaymentreceiptlistState extends State { color: Color(0xFFB4BEC0), fontSize: 14, ), - + enabledBorder: InputBorder.none, disabledBorder: InputBorder.none, focusedBorder: InputBorder.none, @@ -371,7 +377,7 @@ class _AddpaymentreceiptlistState extends State { ), ), errorWidget(context, provider.dateError), - + TextWidget(context, "Select Payment Mode"), DropdownButtonHideUnderline( child: Row( @@ -412,9 +418,7 @@ class _AddpaymentreceiptlistState extends State { provider.receiptPaymentModesValues = value.name!; print( - "hfjkshfg" + - provider.receiptPaymentModesID - .toString(), + "hfjkshfg${provider.receiptPaymentModesID}", ); } } @@ -774,7 +778,7 @@ class _AddpaymentreceiptlistState extends State { Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -785,7 +789,7 @@ class _AddpaymentreceiptlistState extends State { Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/finance/directPaymentRequesitionList.dart b/lib/screens/finance/directPaymentRequesitionList.dart index c33e133..1fc56b2 100644 --- a/lib/screens/finance/directPaymentRequesitionList.dart +++ b/lib/screens/finance/directPaymentRequesitionList.dart @@ -96,13 +96,13 @@ class _DirectpaymentrequesitionlistState return Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.scaffold_bg_color, - appBar: appbarNew(context, "${widget.pageTitleName}",0xFFFFFFFF), + appBar: appbarNew(context, widget.pageTitleName, 0xFFFFFFFF), body: Scrollbar( thumbVisibility: false, child: SingleChildScrollView( child: Container( padding: EdgeInsets.symmetric(horizontal: 10), - margin: EdgeInsets.only(top: 10,left: 10,right: 10), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), @@ -149,8 +149,7 @@ class _DirectpaymentrequesitionlistState provider.directAccountId = value.id!; provider.directAccountValue = value.name!; print( - "hfjkshfg" + - provider.directAccountId.toString(), + "hfjkshfg${provider.directAccountId}", ); } } @@ -162,13 +161,15 @@ class _DirectpaymentrequesitionlistState searchInnerWidget: Padding( padding: const EdgeInsets.all(8), child: TextFormField( - controller: provider.accountSearchController, + controller: + provider.accountSearchController, decoration: InputDecoration( isDense: true, - contentPadding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), + contentPadding: + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), hintText: 'Search account...', border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -177,9 +178,11 @@ class _DirectpaymentrequesitionlistState ), ), searchMatchFn: (item, searchValue) { - return item.value?.name?.toLowerCase().contains( - searchValue.toLowerCase(), - ) ?? + return item.value?.name + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, @@ -222,7 +225,9 @@ class _DirectpaymentrequesitionlistState value: accs, child: Text( accs.name ?? '', - style: const TextStyle(fontSize: 14), + style: const TextStyle( + fontSize: 14, + ), overflow: TextOverflow.ellipsis, ), ), @@ -231,18 +236,20 @@ class _DirectpaymentrequesitionlistState value: provider.selectDirectPaymentAccounts, onChanged: (DirectPaymentAccounts? value) { if (value != null) { - if (provider.directPaymentAccounts.isNotEmpty) { - provider.selectDirectPaymentAccounts = value; + if (provider + .directPaymentAccounts + .isNotEmpty) { + provider.selectDirectPaymentAccounts = + value; print( "Selected Complaint Type: ${value.name}, ID: ${value.id}", ); - provider.directPaymentAccountsID = value.id!; + provider.directPaymentAccountsID = + value.id!; provider.directPaymentAccountsValue = value.name!; print( - "hfjkshfg" + - provider.directPaymentAccountsID - .toString(), + "hfjkshfg${provider.directPaymentAccountsID}", ); } } @@ -258,10 +265,11 @@ class _DirectpaymentrequesitionlistState provider.paymentAccountSearchController, decoration: InputDecoration( isDense: true, - contentPadding: const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), + contentPadding: + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), hintText: 'Search account...', border: OutlineInputBorder( borderRadius: BorderRadius.circular(8), @@ -270,9 +278,11 @@ class _DirectpaymentrequesitionlistState ), ), searchMatchFn: (item, searchValue) { - return item.value?.name?.toLowerCase().contains( - searchValue.toLowerCase(), - ) ?? + return item.value?.name + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, @@ -280,7 +290,8 @@ class _DirectpaymentrequesitionlistState ), onMenuStateChange: (isOpen) { if (!isOpen) { - provider.paymentAccountSearchController.clear(); + provider.paymentAccountSearchController + .clear(); } }, buttonStyleData: ddtheme.buttonStyleData, @@ -387,17 +398,18 @@ class _DirectpaymentrequesitionlistState items: provider.directPaymentModes .map( - (paymenents) => - DropdownMenuItem( - value: paymenents, - child: Text( - paymenents.name ?? '', - style: const TextStyle( - fontSize: 14, - ), - overflow: TextOverflow.ellipsis, - ), + (paymenents) => DropdownMenuItem< + DirectPaymentModes + >( + value: paymenents, + child: Text( + paymenents.name ?? '', + style: const TextStyle( + fontSize: 14, ), + overflow: TextOverflow.ellipsis, + ), + ), ) .toList(), value: provider.selectDirectPaymentModes, @@ -412,9 +424,7 @@ class _DirectpaymentrequesitionlistState provider.directPaymentModesValues = value.name!; print( - "hfjkshfg" + - provider.directPaymentModesID - .toString(), + "hfjkshfg${provider.directPaymentModesID}", ); } } @@ -615,7 +625,7 @@ class _DirectpaymentrequesitionlistState ), ), ], - SizedBox(height: 20,) + SizedBox(height: 20), ], ), ), @@ -773,7 +783,7 @@ class _DirectpaymentrequesitionlistState Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -784,7 +794,7 @@ class _DirectpaymentrequesitionlistState Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/finance/financeDashboard.dart b/lib/screens/finance/financeDashboard.dart index 938570e..b20f38c 100644 --- a/lib/screens/finance/financeDashboard.dart +++ b/lib/screens/finance/financeDashboard.dart @@ -228,7 +228,8 @@ class _FinancedashboardState extends State { child: InkResponse( onTap: () async { HapticFeedback.selectionClick(); - var navigate; + Allpaymentrequesitionlistsbymodes + navigate; navigate = Allpaymentrequesitionlistsbymodes( mode: approvalModes[co], pageTitleName: diff --git a/lib/screens/finance/paymentDetailsPaymentRequisition.dart b/lib/screens/finance/paymentDetailsPaymentRequisition.dart index 6ba0d1e..6b6a7ac 100644 --- a/lib/screens/finance/paymentDetailsPaymentRequisition.dart +++ b/lib/screens/finance/paymentDetailsPaymentRequisition.dart @@ -88,11 +88,11 @@ class _PaymentdetailspaymentrequisitionState Widget _scaffold(BuildContext context) { return Consumer( builder: (context, provider, child) { - var payment_det = provider.paymentDetails; + var paymentDet = provider.paymentDetails; final headings1 = ["From Account", "Created Employee"]; final subHeadings1 = [ - payment_det.paymentAccountName ?? "-", - payment_det.paymentEmployeeName ?? "-", + paymentDet.paymentAccountName ?? "-", + paymentDet.paymentEmployeeName ?? "-", ]; final headings2 = [ "Bank Name", @@ -103,12 +103,12 @@ class _PaymentdetailspaymentrequisitionState "UPI ID", ]; final subHeadings2 = [ - payment_det.bankName ?? "-", - payment_det.bankAccountHolderName ?? "-", - payment_det.bankAccountNumber ?? "-", - payment_det.bankBranchName ?? "-", - payment_det.bankIfscCode ?? "-", - payment_det.bankUpiId ?? "-", + paymentDet.bankName ?? "-", + paymentDet.bankAccountHolderName ?? "-", + paymentDet.bankAccountNumber ?? "-", + paymentDet.bankBranchName ?? "-", + paymentDet.bankIfscCode ?? "-", + paymentDet.bankUpiId ?? "-", ]; final headings3 = [ "Payment Mode", @@ -117,10 +117,10 @@ class _PaymentdetailspaymentrequisitionState "Payment Date", ]; final subHeadings3 = [ - payment_det.mode ?? "-", - payment_det.paymentReferenceNumber ?? "-", + paymentDet.mode ?? "-", + paymentDet.paymentReferenceNumber ?? "-", "View", - payment_det.paymentDate ?? "-", + paymentDet.paymentDate ?? "-", ]; final sections = [ @@ -194,7 +194,7 @@ class _PaymentdetailspaymentrequisitionState MaterialPageRoute( builder: (context) => Accountslistdetails( - accountID: payment_det.accountId, + accountID: paymentDet.accountId, ), ), ); @@ -204,7 +204,7 @@ class _PaymentdetailspaymentrequisitionState vertical: 6, ), child: Text( - payment_det.accountName ?? "-", + paymentDet.accountName ?? "-", style: TextStyle( decoration: TextDecoration.underline, decorationColor: AppColors.grey_thick, @@ -219,7 +219,7 @@ class _PaymentdetailspaymentrequisitionState ), ), Text( - "₹${payment_det.amount}", + "₹${paymentDet.amount}", style: TextStyle( fontFamily: "JakartaRegular", fontSize: 14, @@ -243,7 +243,7 @@ class _PaymentdetailspaymentrequisitionState ), child: Center( child: Text( - payment_det.refType ?? "-", + paymentDet.refType ?? "-", textAlign: TextAlign.center, style: TextStyle( fontFamily: "JakartaMedium", @@ -316,53 +316,65 @@ class _PaymentdetailspaymentrequisitionState ), Expanded( child: InkResponse( - onTap: [ - "Attachment", - "From Account", - "Created Employee", - ].contains(headings[j]) ? () { - switch(headings[j]){ - case "Attachment": - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Fileviewer( - fileName: - payment_det - .attachmentViewFileName!, - fileUrl: - payment_det - .attachmentDirFilePath!, - ), - ), - ); - break; - case "From Account": - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Accountslistdetails( - accountID: payment_det.paymentAccountId, - ), - ), - ); - break; - case "Created Employee": - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Accountslistdetails( - accountID: payment_det.createdEmployeeId, - ), - ), - ); - break; - } - - } : null, + onTap: + [ + "Attachment", + "From Account", + "Created Employee", + ].contains(headings[j]) + ? () { + switch (headings[j]) { + case "Attachment": + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Fileviewer( + fileName: + paymentDet + .attachmentViewFileName!, + fileUrl: + paymentDet + .attachmentDirFilePath!, + ), + ), + ); + break; + case "From Account": + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Accountslistdetails( + accountID: + paymentDet + .paymentAccountId, + ), + ), + ); + break; + case "Created Employee": + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Accountslistdetails( + accountID: + paymentDet + .createdEmployeeId, + ), + ), + ); + break; + } + } + : null, child: Padding( padding: EdgeInsets.only( top: 2.5, @@ -395,15 +407,16 @@ class _PaymentdetailspaymentrequisitionState .solid : TextDecorationStyle .solid, - decorationColor: [ - "From Account", - "Created Employee", - ].contains(headings[j]) - ? AppColors.grey_thick - : subHeadings[j] == - "View" - ? AppColors.app_blue - : AppColors.app_blue, + decorationColor: + [ + "From Account", + "Created Employee", + ].contains(headings[j]) + ? AppColors.grey_thick + : subHeadings[j] == + "View" + ? AppColors.app_blue + : AppColors.app_blue, fontSize: 14, color: subHeadings[j] == "View" @@ -470,7 +483,7 @@ class _PaymentdetailspaymentrequisitionState Widget _scaffold1(BuildContext context) { return Consumer( builder: (context, provider, child) { - var payment_det = provider.paymentDetails; + var paymentDet = provider.paymentDetails; return Scaffold( resizeToAvoidBottomInset: true, @@ -510,7 +523,7 @@ class _PaymentdetailspaymentrequisitionState crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - payment_det.accountName ?? "-", + paymentDet.accountName ?? "-", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -518,7 +531,7 @@ class _PaymentdetailspaymentrequisitionState ), ), Text( - "₹${payment_det.amount}", + "₹${paymentDet.amount}", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -542,7 +555,7 @@ class _PaymentdetailspaymentrequisitionState ), child: Center( child: Text( - payment_det.refType ?? "-", + paymentDet.refType ?? "-", textAlign: TextAlign.center, style: TextStyle( fontFamily: "JakartaMedium", @@ -558,7 +571,7 @@ class _PaymentdetailspaymentrequisitionState Divider(thickness: 0.5, color: Color(0xFFD7D7D7)), ...List.generate(provider.subHeadings.length, (j) { if (provider.Headings[j] == "Attachment" && - payment_det.attachmentViewFileName == "") { + paymentDet.attachmentViewFileName == "") { return SizedBox.shrink(); } return Container( @@ -586,10 +599,10 @@ class _PaymentdetailspaymentrequisitionState builder: (context) => Fileviewer( fileName: - payment_det + paymentDet .attachmentViewFileName!, fileUrl: - payment_det + paymentDet .attachmentDirFilePath!, ), ), diff --git a/lib/screens/finance/paymentListPaymentRequisition.dart b/lib/screens/finance/paymentListPaymentRequisition.dart index b82c10d..889399d 100644 --- a/lib/screens/finance/paymentListPaymentRequisition.dart +++ b/lib/screens/finance/paymentListPaymentRequisition.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/svg.dart'; @@ -13,7 +12,6 @@ import '../../Utils/app_colors.dart'; import '../../Utils/commonServices.dart'; import '../../Utils/commonWidgets.dart'; import '../commonDateRangeFilter.dart'; -import 'FileViewer.dart'; class Paymentlistpaymentrequisition extends StatefulWidget { final String pageTitleName; @@ -66,7 +64,6 @@ class _PaymentlistpaymentrequisitionState super.dispose(); } - @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -146,155 +143,152 @@ class _PaymentlistpaymentrequisitionState ), ], ), - 0xFFFFFFFF + 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue, - ), - ), - ) - : requestLists.isNotEmpty - ? Scrollbar( - controller: _scrollController, - thumbVisibility: false, - child: ListView.builder( - controller: _scrollController, - itemCount: requestLists.length + - (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, index) { - if (index == requestLists.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center( - child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final payment = requestLists[index]; - return InkResponse( - onTap: () async { - HapticFeedback.selectionClick(); - var res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Paymentdetailspaymentrequisition( - pageName: - widget.pageTitleName, - paymentRequestId: - requestLists[index].id, - ), - settings: RouteSettings( - name: - "Paymentdetailspaymentrequisition", - ), + body: + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - ); - if (routeSettingName == - "Paymentdetailspaymentrequisition") { - print("pld"); - - provider.paymentsListAPI(context, '', ''); - } - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 50, - padding: EdgeInsets.all(3.0), - decoration: BoxDecoration( - color: AppColors.requested_bg_color, - shape: BoxShape.circle + ) + : requestLists.isNotEmpty + ? Scrollbar( + controller: _scrollController, + thumbVisibility: false, + child: ListView.builder( + controller: _scrollController, + itemCount: + requestLists.length + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, index) { + if (index == requestLists.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), + child: Center( + child: CircularProgressIndicator(), ), - child: SvgPicture.asset( - "assets/svg/finance/rupee_ic.svg", - fit: BoxFit.scaleDown, + ) + : const SizedBox.shrink(); + } + + final payment = requestLists[index]; + return InkResponse( + onTap: () async { + HapticFeedback.selectionClick(); + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Paymentdetailspaymentrequisition( + pageName: widget.pageTitleName, + paymentRequestId: + requestLists[index].id, + ), + settings: RouteSettings( + name: "Paymentdetailspaymentrequisition", ), ), + ); + if (routeSettingName == + "Paymentdetailspaymentrequisition") { + print("pld"); + + provider.paymentsListAPI(context, '', ''); + } + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - requestLists[index] - .receipientAccount!, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 50, + padding: EdgeInsets.all(3.0), + decoration: BoxDecoration( + color: AppColors.requested_bg_color, + shape: BoxShape.circle, + ), + child: SvgPicture.asset( + "assets/svg/finance/rupee_ic.svg", + fit: BoxFit.scaleDown, + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + requestLists[index] + .receipientAccount!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + "${requestLists[index].paymentDate}", + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ], + ), ), ), - Text( - "${requestLists[index].paymentDate}", - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.app_blue, + SizedBox(width: 10), + Expanded( + flex: 3, + child: Text( + "₹${requestLists[index].amount}", + maxLines: 1, + textAlign: TextAlign.right, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), ), ), ], ), - ), + ], ), - SizedBox(width: 10), - Expanded( - flex: 3, - child: Text( - "₹${requestLists[index].amount}", - maxLines: 1, - textAlign: TextAlign.right, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - ), - - ], - ), - - - ], + ), + ); + }, ), - ), - ); - }, - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); diff --git a/lib/screens/finance/paymentReceiptDetails.dart b/lib/screens/finance/paymentReceiptDetails.dart index 20bf069..5b3640e 100644 --- a/lib/screens/finance/paymentReceiptDetails.dart +++ b/lib/screens/finance/paymentReceiptDetails.dart @@ -85,12 +85,12 @@ class _PaymentreceiptdetailsState extends State { Widget _scaffold(BuildContext context) { return Consumer( builder: (context, provider, child) { - var payment_det = provider.receiptDetails; + var paymentDet = provider.receiptDetails; final headings1 = ["Payment Mode", "Receipt Date"]; final subHeadings1 = [ - payment_det.requestMode ?? "-", - payment_det.receiptDate ?? "-", + paymentDet.requestMode ?? "-", + paymentDet.receiptDate ?? "-", ]; final headings2 = [ "Bank Name", @@ -101,17 +101,17 @@ class _PaymentreceiptdetailsState extends State { "UPI ID", ]; final subHeadings2 = [ - payment_det.bankName ?? "-", - payment_det.bankAccountHolderName ?? "-", - payment_det.bankAccountNumber ?? "-", - payment_det.bankBranchName ?? "-", - payment_det.bankIfscCode ?? "-", - payment_det.bankUpiId ?? "-", + paymentDet.bankName ?? "-", + paymentDet.bankAccountHolderName ?? "-", + paymentDet.bankAccountNumber ?? "-", + paymentDet.bankBranchName ?? "-", + paymentDet.bankIfscCode ?? "-", + paymentDet.bankUpiId ?? "-", ]; final headings3 = ["Note", "Created Employee"]; final subHeadings3 = [ - payment_det.description ?? "-", - payment_det.createdEmployee ?? "-", + paymentDet.description ?? "-", + paymentDet.createdEmployee ?? "-", ]; final sections = [ @@ -189,7 +189,10 @@ class _PaymentreceiptdetailsState extends State { MaterialPageRoute( builder: (context) => Accountslistdetails( - accountID: provider.receiptDetails.accountId, + accountID: + provider + .receiptDetails + .accountId, ), ), ); @@ -199,7 +202,7 @@ class _PaymentreceiptdetailsState extends State { vertical: 6, ), child: Text( - payment_det.receipientAccount ?? "-", + paymentDet.receipientAccount ?? "-", style: TextStyle( decoration: TextDecoration.underline, decorationColor: AppColors.grey_thick, @@ -214,7 +217,7 @@ class _PaymentreceiptdetailsState extends State { ), ), Text( - "₹${payment_det.amount}", + "₹${paymentDet.amount}", style: TextStyle( fontFamily: "JakartaRegular", fontSize: 14, @@ -351,7 +354,7 @@ class _PaymentreceiptdetailsState extends State { Widget _scaffold1(BuildContext context) { return Consumer( builder: (context, provider, child) { - var payment_det = provider.receiptDetails; + var paymentDet = provider.receiptDetails; return Scaffold( resizeToAvoidBottomInset: true, @@ -392,7 +395,7 @@ class _PaymentreceiptdetailsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - payment_det.receipientAccount ?? "-", + paymentDet.receipientAccount ?? "-", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -400,7 +403,7 @@ class _PaymentreceiptdetailsState extends State { ), ), Text( - "₹${payment_det.amount}", + "₹${paymentDet.amount}", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -416,7 +419,7 @@ class _PaymentreceiptdetailsState extends State { Divider(thickness: 0.5, color: Color(0xFFD7D7D7)), ...List.generate(provider.subHeadings.length, (j) { if (provider.Headings[j] == "Attachment" && - payment_det.attachmentViewFileName == "") { + paymentDet.attachmentViewFileName == "") { return SizedBox.shrink(); } return Container( @@ -444,10 +447,10 @@ class _PaymentreceiptdetailsState extends State { builder: (context) => Fileviewer( fileName: - payment_det + paymentDet .attachmentViewFileName!, fileUrl: - payment_det + paymentDet .attachmentDirFilePath!, ), ), diff --git a/lib/screens/finance/paymentreceiptList.dart b/lib/screens/finance/paymentreceiptList.dart index dddb613..89ceead 100644 --- a/lib/screens/finance/paymentreceiptList.dart +++ b/lib/screens/finance/paymentreceiptList.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/svg.dart'; @@ -15,7 +14,6 @@ import '../../Utils/app_colors.dart'; import '../../Utils/commonServices.dart'; import '../../Utils/commonWidgets.dart'; import '../commonDateRangeFilter.dart'; -import 'FileViewer.dart'; class Paymentreceiptlist extends StatefulWidget { final String pageTitleName; @@ -63,7 +61,6 @@ class _PaymentreceiptlistState extends State { super.dispose(); } - @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -147,146 +144,147 @@ class _PaymentreceiptlistState extends State { 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue, - ), - ), - ) - : receipts.isNotEmpty - ? Scrollbar( - controller: _scrollController, - child: ListView.builder( - controller: _scrollController, - itemCount: - receipts.length + (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, index) { - if (index == receipts.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center( - child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final receipt = receipts[index]; - return InkResponse( - onTap: () async { - HapticFeedback.selectionClick(); - var res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Paymentreceiptdetails( - pageName: widget.pageTitleName, - paymentRequestId: - requestLists[index].id, - ), - settings: RouteSettings( - name: "Paymentreceiptdetails", - ), + body: + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - ); - if (routeSettingName == "Paymentreceiptdetails") { - debugPrint("prd"); - provider.paymentsListAPI(context, '', ''); - } - // if (res == true) { - // provider.paymentsListAPI(context, '', ''); - // } - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 50, - padding: EdgeInsets.all(3.0), - decoration: BoxDecoration( - color: AppColors.requested_bg_color, - shape: BoxShape.circle, + ) + : receipts.isNotEmpty + ? Scrollbar( + controller: _scrollController, + child: ListView.builder( + controller: _scrollController, + itemCount: + receipts.length + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, index) { + if (index == receipts.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), + child: Center( + child: CircularProgressIndicator(), ), - child: SvgPicture.asset( - "assets/svg/finance/rupee_ic.svg", - fit: BoxFit.scaleDown, + ) + : const SizedBox.shrink(); + } + + final receipt = receipts[index]; + return InkResponse( + onTap: () async { + HapticFeedback.selectionClick(); + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Paymentreceiptdetails( + pageName: widget.pageTitleName, + paymentRequestId: requestLists[index].id, + ), + settings: RouteSettings( + name: "Paymentreceiptdetails", ), ), + ); + if (routeSettingName == "Paymentreceiptdetails") { + debugPrint("prd"); + provider.paymentsListAPI(context, '', ''); + } + // if (res == true) { + // provider.paymentsListAPI(context, '', ''); + // } + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + child: Column( + children: [ + Row( children: [ - Text( - requestLists[index] - .receipientAccount!, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 50, + padding: EdgeInsets.all(3.0), + decoration: BoxDecoration( + color: AppColors.requested_bg_color, + shape: BoxShape.circle, + ), + child: SvgPicture.asset( + "assets/svg/finance/rupee_ic.svg", + fit: BoxFit.scaleDown, + ), ), ), - Text( - "${requestLists[index].receiptDate}", - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.grey_semi, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + requestLists[index] + .receipientAccount!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + "${requestLists[index].receiptDate}", + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.grey_semi, + ), + ), + ], + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 3, + child: Text( + "₹${requestLists[index].amount}", + textAlign: TextAlign.right, + maxLines: 1, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), ), ), ], ), - ), + ], ), - SizedBox(width: 10), - Expanded( - flex: 3, - child: Text( - "₹${requestLists[index].amount}", - textAlign: TextAlign.right, - maxLines: 1, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - ), - ], - ), - ], + ), + ); + }, ), - ), - ); - }, - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); diff --git a/lib/screens/finance/submitPaymentRequestionListsByMode.dart b/lib/screens/finance/submitPaymentRequestionListsByMode.dart index d1e0432..6d07fdc 100644 --- a/lib/screens/finance/submitPaymentRequestionListsByMode.dart +++ b/lib/screens/finance/submitPaymentRequestionListsByMode.dart @@ -41,7 +41,7 @@ class _SubmitpaymentrequestionlistsbymodeState Dropdowntheme ddtheme = Dropdowntheme(); List focusNodes = List.generate(11, (index) => FocusNode()); - GlobalKey _globalKey = GlobalKey(); + final GlobalKey _globalKey = GlobalKey(); ScrollController scrollcontroller = ScrollController(); @override @@ -63,7 +63,7 @@ class _SubmitpaymentrequestionlistsbymodeState if (widget.mode == "self" && provider.accounts.length == 1) { provider.selectedAccount = provider.accounts.first; provider.accountId = provider.accounts.first.id!; - } else if (widget.mode == "other" && provider.accounts != null) { + } else if (widget.mode == "other") { if (widget.accountId != null) { provider.selectedAccount = provider.accounts.firstWhereOrNull( (element) => element.id == widget.accountId, @@ -72,11 +72,11 @@ class _SubmitpaymentrequestionlistsbymodeState print("sdsd,al;,al${provider.selectedAccount!.name}"); provider.accountId = provider.accounts - .firstWhere((e) => e.id == widget.accountId)! + .firstWhere((e) => e.id == widget.accountId) .id!; provider.accountValue = provider.accounts - .firstWhere((e) => e.id == widget.accountId)! + .firstWhere((e) => e.id == widget.accountId) .name!; } } @@ -115,15 +115,13 @@ class _SubmitpaymentrequestionlistsbymodeState autofill(res) { print("auto"); var provider = Provider.of(context, listen: false); - if (provider.accounts != null) { - provider.selectedAccount = provider.accounts.firstWhereOrNull( - (element) => element.id == res, - ); - print("sdsd,al;,al${provider.selectedAccount}"); - provider.accountId = provider.accounts.firstWhere((e) => e.id == res).id!; - provider.accountValue = - provider.accounts.firstWhere((e) => e.id == res).name!; - } + provider.selectedAccount = provider.accounts.firstWhereOrNull( + (element) => element.id == res, + ); + print("sdsd,al;,al${provider.selectedAccount}"); + provider.accountId = provider.accounts.firstWhere((e) => e.id == res).id!; + provider.accountValue = + provider.accounts.firstWhere((e) => e.id == res).name!; } Future _onBackPressed(BuildContext context) async { @@ -178,14 +176,14 @@ class _SubmitpaymentrequestionlistsbymodeState backgroundColor: AppColors.scaffold_bg_color, appBar: appbar2New( context, - "${widget.pageTitleName}", + widget.pageTitleName, provider.resetForm, SizedBox(width: 0), - 0xFFFFFFFF + 0xFFFFFFFF, ), body: Container( padding: EdgeInsets.symmetric(horizontal: 10), - margin: EdgeInsets.only(top: 10,left: 10,right: 10), + margin: EdgeInsets.only(top: 10, left: 10, right: 10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), @@ -235,8 +233,7 @@ class _SubmitpaymentrequestionlistsbymodeState ); provider.accountId = value.id!; print( - "hfjkshfg" + - provider.accountId.toString(), + "hfjkshfg${provider.accountId}", ); provider .paymentRequestionBankDetailsAPIFunction( @@ -303,7 +300,7 @@ class _SubmitpaymentrequestionlistsbymodeState ), ), ); - print("return Response: ${res}"); + print("return Response: $res"); if (res != true) { provider.addPaymentRequestionViewAPI( context, @@ -371,12 +368,9 @@ class _SubmitpaymentrequestionlistsbymodeState onChanged: (String? value) { if (value != null) { provider.selectReqPurpose = value; - print("Selected Complaint Type: ${value},"); + print("Selected Complaint Type: $value,"); - print( - "hfjkshfg" + - provider.selectReqPurpose.toString(), - ); + print("hfjkshfg${provider.selectReqPurpose}"); } }, buttonStyleData: ddtheme.buttonStyleData, @@ -473,16 +467,13 @@ class _SubmitpaymentrequestionlistsbymodeState ); provider.paymentModeId = value.id!; provider.paymentModeValue = value.name!; - print( - "hfjkshfg" + - provider.paymentModeId.toString(), - ); + print("hfjkshfg${provider.paymentModeId}"); if ([ "Cheque", "RTGS", "IMPS", "NEFT", - "UPI" + "UPI", ].contains(provider.paymentModeValue)) { WidgetsBinding.instance .addPostFrameCallback((_) { @@ -554,10 +545,7 @@ class _SubmitpaymentrequestionlistsbymodeState value.id!; provider.selectedApprovalEmployeeValue = value.name!; - print( - "hfjkshfg" + - provider.paymentModeId.toString(), - ); + print("hfjkshfg${provider.paymentModeId}"); } } }, @@ -648,8 +636,6 @@ class _SubmitpaymentrequestionlistsbymodeState "IMPS", "NEFT", ].contains(provider.paymentModeValue)) ...[ - - textControllerWidget( context, provider.bankNameController, @@ -748,7 +734,7 @@ class _SubmitpaymentrequestionlistsbymodeState ), errorWidget(context, provider.UPIError), - SizedBox(height: 20,) + SizedBox(height: 20), ], ], ), @@ -761,7 +747,7 @@ class _SubmitpaymentrequestionlistsbymodeState provider.submitClicked ? null : () { - HapticFeedback.selectionClick(); + HapticFeedback.selectionClick(); provider.submitClicked = true; provider.addPaymentRequestionSubmitAPI( @@ -851,7 +837,7 @@ class _SubmitpaymentrequestionlistsbymodeState Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -862,7 +848,7 @@ class _SubmitpaymentrequestionlistsbymodeState Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/genTracker/ComplaintHistory.dart b/lib/screens/genTracker/ComplaintHistory.dart index feba2a5..2ac3b79 100644 --- a/lib/screens/genTracker/ComplaintHistory.dart +++ b/lib/screens/genTracker/ComplaintHistory.dart @@ -20,7 +20,6 @@ class Complainthistory extends StatefulWidget { } class _ComplainthistoryState extends State { - Map _source = {ConnectivityResult.mobile: true}; final MyConnectivity _connectivity = MyConnectivity.instance; @@ -48,6 +47,7 @@ class _ComplainthistoryState extends State { ); }); } + @override void dispose() { // TODO: implement dispose @@ -68,118 +68,132 @@ class _ComplainthistoryState extends State { default: connection = 'Offline'; } - return connection=="Online"?Consumer( - builder: (context, provider, child) { - return WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: Platform.isIOS?false:true, - child: Scaffold( - resizeToAvoidBottomInset: true, - appBar: appbar(context, "Complaint History"), - backgroundColor: AppColors.scaffold_bg_color, - body: Container( - child: SingleChildScrollView( - child: Column( - children: [ - if (provider.complaintListOther.isNotEmpty) ...[ - ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: provider.complaintListOther.length, - itemBuilder: (context, l) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.only(left: 8.0,top: 5.0), - child: Text( - "${provider.complaintListOther[l].compRegdate}", - style: TextStyle( - fontSize:14, - color: Color(0xFF818181)), - ), - ), - Container( - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - ...List.generate(4, (jndex) { - final headings = [ - "Technician Name", - "Complaint Type", - "Complaint Status", - "Complaint Created By", - ]; + return connection == "Online" + ? Consumer( + builder: (context, provider, child) { + return WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + appBar: appbar(context, "Complaint History"), + backgroundColor: AppColors.scaffold_bg_color, + body: Container( + child: SingleChildScrollView( + child: Column( + children: [ + if (provider.complaintListOther.isNotEmpty) ...[ + ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: provider.complaintListOther.length, + itemBuilder: (context, l) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only( + left: 8.0, + top: 5.0, + ), + child: Text( + "${provider.complaintListOther[l].compRegdate}", + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + ...List.generate(4, (jndex) { + final headings = [ + "Technician Name", + "Complaint Type", + "Complaint Status", + "Complaint Created By", + ]; - final values = [ - provider.complaintListOther[l].techName, - provider.complaintListOther[l].compType, - provider.complaintListOther[l].compStatus, - provider.complaintListOther[l].createdBy, - ]; - return Container( - padding: EdgeInsets.symmetric( - horizontal: 15, - vertical: 6, - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: SizedBox( - child: Text( - "${headings[jndex]}", - style: TextStyle( - fontSize: 14 + final values = [ + provider + .complaintListOther[l] + .techName, + provider + .complaintListOther[l] + .compType, + provider + .complaintListOther[l] + .compStatus, + provider + .complaintListOther[l] + .createdBy, + ]; + return Container( + padding: EdgeInsets.symmetric( + horizontal: 15, + vertical: 6, + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: SizedBox( + child: Text( + headings[jndex], + style: TextStyle( + fontSize: 14, + ), + ), ), ), - ), - ), - Expanded( - child: SizedBox( - child: Text( - "${values[jndex]}", - style: TextStyle( - fontSize:14, - color: Color( - - 0xFF818181, + Expanded( + child: SizedBox( + child: Text( + "${values[jndex]}", + style: TextStyle( + fontSize: 14, + color: Color( + 0xFF818181, + ), + ), ), ), ), - ), + ], ), - ], - ), - ); - }), - ], - ), - ), - ], - ); - }, - ), - ] else ...[ - Emptywidget(context), - ], - ], + ); + }), + ], + ), + ), + ], + ); + }, + ), + ] else ...[ + Emptywidget(context), + ], + ], + ), + ), ), ), ), - ), - ), - ); - }, - ):NoNetwork(context); + ); + }, + ) + : NoNetwork(context); } } diff --git a/lib/screens/genTracker/GeneratorDetails.dart b/lib/screens/genTracker/GeneratorDetails.dart index b14ce24..8518250 100644 --- a/lib/screens/genTracker/GeneratorDetails.dart +++ b/lib/screens/genTracker/GeneratorDetails.dart @@ -877,7 +877,10 @@ class _GeneratordetailsState extends State { vertical: 10, ), child: Text( - "${provider.scheduleList[lp].status ?? "-"}", + provider + .scheduleList[lp] + .status ?? + "-", textAlign: TextAlign.center, style: TextStyle( @@ -1194,7 +1197,10 @@ class _GeneratordetailsState extends State { vertical: 10, ), child: Text( - "${provider.complaintsList[lp].openStatus ?? "-"}", + provider + .complaintsList[lp] + .openStatus ?? + "-", textAlign: TextAlign.center, style: TextStyle( @@ -1956,7 +1962,7 @@ class _GeneratordetailsState extends State { Expanded( child: SizedBox( child: Text( - "${headings[jndex]}", + headings[jndex], style: TextStyle( fontSize: 14, ), @@ -2081,7 +2087,7 @@ class _GeneratordetailsState extends State { Expanded( child: SizedBox( child: Text( - "${headings[jndex]}", + headings[jndex], style: TextStyle( fontSize: 14, ), @@ -2622,7 +2628,7 @@ class _TagLocationScreenState extends State { Navigator.of(context).pop(false); provider.imgFromCamera(); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/genTracker/RegisterComplaint.dart b/lib/screens/genTracker/RegisterComplaint.dart index c912014..b274279 100644 --- a/lib/screens/genTracker/RegisterComplaint.dart +++ b/lib/screens/genTracker/RegisterComplaint.dart @@ -323,14 +323,11 @@ class _RegistercomplaintState extends State { "Selected Complaint Type: ${value.name}, ID: ${value.id}", ); provider.selectedType = - value?.name; + value.name; provider.selectedTypeId = - value?.id; + value.id; print( - "hfjkshfg" + - provider - .selectedTypeId - .toString(), + "hfjkshfg${provider.selectedTypeId}", ); } } diff --git a/lib/screens/genTracker/ScanEnterGeneratorIDScreen.dart b/lib/screens/genTracker/ScanEnterGeneratorIDScreen.dart index e546f18..75a2d8f 100644 --- a/lib/screens/genTracker/ScanEnterGeneratorIDScreen.dart +++ b/lib/screens/genTracker/ScanEnterGeneratorIDScreen.dart @@ -4,7 +4,6 @@ import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/material.dart'; import 'package:generp/Notifiers/GeneratorDetailsProvider.dart'; import 'package:generp/Utils/commonServices.dart'; -import 'package:generp/services/api_calling.dart'; import 'package:provider/provider.dart'; import 'package:qr_code_scanner/qr_code_scanner.dart'; diff --git a/lib/screens/hrm/AddLiveAttendance.dart b/lib/screens/hrm/AddLiveAttendance.dart index 3c8bc54..16ec4cf 100644 --- a/lib/screens/hrm/AddLiveAttendance.dart +++ b/lib/screens/hrm/AddLiveAttendance.dart @@ -11,7 +11,7 @@ import '../../Utils/app_colors.dart'; import '../../Utils/dropdownTheme.dart'; class AddLiveAttendanceScreen extends StatefulWidget { - const AddLiveAttendanceScreen({Key? key}) : super(key: key); + const AddLiveAttendanceScreen({super.key}); @override State createState() => @@ -45,8 +45,8 @@ class _AddLiveAttendanceScreenState extends State { bool get isSubmitEnabled => selectedType != null && - locationController.text.trim().isNotEmpty && - proofFile != null; + locationController.text.trim().isNotEmpty && + proofFile != null; @override void initState() { @@ -63,14 +63,16 @@ class _AddLiveAttendanceScreenState extends State { final coords = "${position.latitude},${position.longitude}"; // Convert to address for display - final placemarks = - await placemarkFromCoordinates(position.latitude, position.longitude); + final placemarks = await placemarkFromCoordinates( + position.latitude, + position.longitude, + ); String displayAddress; if (placemarks.isNotEmpty) { final place = placemarks.first; displayAddress = - "${place.name}, ${place.locality}, ${place.administrativeArea}, ${place.country}"; + "${place.name}, ${place.locality}, ${place.administrativeArea}, ${place.country}"; } else { displayAddress = coords; // fallback } @@ -81,10 +83,9 @@ class _AddLiveAttendanceScreenState extends State { }); } -// Add this field at the top of your State class: + // Add this field at the top of your State class: String? _rawCoordinates; - Future getCurrentLocation() async { try { LocationPermission permission = await Geolocator.checkPermission(); @@ -99,10 +100,13 @@ class _AddLiveAttendanceScreenState extends State { } Position position = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.high); + desiredAccuracy: LocationAccuracy.high, + ); - List placemarks = - await placemarkFromCoordinates(position.latitude, position.longitude); + List placemarks = await placemarkFromCoordinates( + position.latitude, + position.longitude, + ); if (placemarks.isNotEmpty) { Placemark place = placemarks.first; @@ -127,8 +131,9 @@ class _AddLiveAttendanceScreenState extends State { title: const Text('Camera'), onTap: () async { Navigator.of(context).pop(); - final XFile? image = - await picker.pickImage(source: ImageSource.camera); + final XFile? image = await picker.pickImage( + source: ImageSource.camera, + ); if (image != null) { setState(() => proofFile = image); } @@ -139,8 +144,9 @@ class _AddLiveAttendanceScreenState extends State { title: const Text('Gallery'), onTap: () async { Navigator.of(context).pop(); - final XFile? image = - await picker.pickImage(source: ImageSource.gallery); + final XFile? image = await picker.pickImage( + source: ImageSource.gallery, + ); if (image != null) { setState(() => proofFile = image); } @@ -182,7 +188,10 @@ class _AddLiveAttendanceScreenState extends State { setState(() => isSubmitting = true); - final provider = Provider.of(context, listen: false); + final provider = Provider.of( + context, + listen: false, + ); await provider.addAttendanceRequest( context, @@ -191,14 +200,13 @@ class _AddLiveAttendanceScreenState extends State { loc: _rawCoordinates ?? "", // send actual coordinates checkDate: DateTime.now().toString().split(" ").first, checkInTime: - selectedType == "Check In" ? TimeOfDay.now().format(context) : null, + selectedType == "Check In" ? TimeOfDay.now().format(context) : null, checkInLoc: selectedType == "Check In" ? locationController.text : null, checkInProof: selectedType == "Check In" ? File(proofFile!.path) : null, checkOutTime: - selectedType == "Check Out" ? TimeOfDay.now().format(context) : null, + selectedType == "Check Out" ? TimeOfDay.now().format(context) : null, checkOutLoc: selectedType == "Check Out" ? locationController.text : null, - checkOutProof: - selectedType == "Check Out" ? File(proofFile!.path) : null, + checkOutProof: selectedType == "Check Out" ? File(proofFile!.path) : null, note: descriptionController.text, ); @@ -259,11 +267,14 @@ class _AddLiveAttendanceScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ /// Type Dropdown - const Text("Type", - style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w500)), + const Text( + "Type", + style: TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w500, + ), + ), const SizedBox(height: 6), Container( padding: const EdgeInsets.symmetric(horizontal: 2), @@ -278,22 +289,28 @@ class _AddLiveAttendanceScreenState extends State { "Select Type", overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w400), + fontSize: 15, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w400, + ), ), value: selectedType, - items: types - .map((e) => DropdownMenuItem( - value: e, - child: Text( - e, - style: const TextStyle( - fontSize: 14, fontFamily: "JakartaMedium"), - overflow: TextOverflow.ellipsis, - ), - )) - .toList(), + items: + types + .map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e, + style: const TextStyle( + fontSize: 14, + fontFamily: "JakartaMedium", + ), + overflow: TextOverflow.ellipsis, + ), + ), + ) + .toList(), onChanged: (val) => setState(() => selectedType = val), iconStyleData: ddtheme.iconStyleData, dropdownStyleData: ddtheme.dropdownStyleData, @@ -302,21 +319,27 @@ class _AddLiveAttendanceScreenState extends State { ), if (typeError != null) ...[ const SizedBox(height: 4), - Text(typeError!, - style: const TextStyle( - color: Colors.red, - fontSize: 13, - fontFamily: "JakartaMedium")), + Text( + typeError!, + style: const TextStyle( + color: Colors.red, + fontSize: 13, + fontFamily: "JakartaMedium", + ), + ), ], const SizedBox(height: 16), /// Location - Text(locationHeading, - style: const TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w500)), + Text( + locationHeading, + style: const TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w500, + ), + ), const SizedBox(height: 6), TextField( controller: locationController, @@ -324,21 +347,27 @@ class _AddLiveAttendanceScreenState extends State { ), if (locationError != null) ...[ const SizedBox(height: 4), - Text(locationError!, - style: const TextStyle( - color: Colors.red, - fontSize: 13, - fontFamily: "JakartaMedium")), + Text( + locationError!, + style: const TextStyle( + color: Colors.red, + fontSize: 13, + fontFamily: "JakartaMedium", + ), + ), ], const SizedBox(height: 16), /// Description - Text(descriptionHeading, - style: const TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w500)), + Text( + descriptionHeading, + style: const TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w500, + ), + ), const SizedBox(height: 6), TextField( controller: descriptionController, @@ -374,11 +403,14 @@ class _AddLiveAttendanceScreenState extends State { ), if (proofError != null) ...[ const SizedBox(height: 4), - Text(proofError!, - style: const TextStyle( - color: Colors.red, - fontSize: 13, - fontFamily: "JakartaMedium")), + Text( + proofError!, + style: const TextStyle( + color: Colors.red, + fontSize: 13, + fontFamily: "JakartaMedium", + ), + ), ], if (proofFile != null) ...[ @@ -388,16 +420,21 @@ class _AddLiveAttendanceScreenState extends State { const Icon(Icons.check_circle, color: Colors.green), const SizedBox(width: 8), Expanded( - child: Text("Attached: ${proofFile!.name}", - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontFamily: "JakartaMedium", fontSize: 14))), + child: Text( + "Attached: ${proofFile!.name}", + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + ), + ), + ), IconButton( icon: const Icon(Icons.close, color: Colors.red), onPressed: () => setState(() => proofFile = null), ), ], - ) + ), ], const SizedBox(height: 24), @@ -405,27 +442,33 @@ class _AddLiveAttendanceScreenState extends State { /// Submit Button InkResponse( onTap: - isSubmitEnabled && !isSubmitting ? () => submitAttendance(context) : null, + isSubmitEnabled && !isSubmitting + ? () => submitAttendance(context) + : null, child: Container( height: 48, alignment: Alignment.center, decoration: BoxDecoration( - color: isSubmitEnabled - ? AppColors.app_blue - : Colors.grey.shade400, + color: + isSubmitEnabled + ? AppColors.app_blue + : Colors.grey.shade400, borderRadius: BorderRadius.circular(12), ), - child: isSubmitting - ? const CircularProgressIndicator( - color: Colors.white, strokeWidth: 2) - : const Text( - "Submit", - style: TextStyle( - fontSize: 16, - fontFamily: "JakartaMedium", - color: Colors.white, - ), - ), + child: + isSubmitting + ? const CircularProgressIndicator( + color: Colors.white, + strokeWidth: 2, + ) + : const Text( + "Submit", + style: TextStyle( + fontSize: 16, + fontFamily: "JakartaMedium", + color: Colors.white, + ), + ), ), ), ], diff --git a/lib/screens/hrm/AddManualAttendance.dart b/lib/screens/hrm/AddManualAttendance.dart index 072f7d5..852d22a 100644 --- a/lib/screens/hrm/AddManualAttendance.dart +++ b/lib/screens/hrm/AddManualAttendance.dart @@ -51,8 +51,14 @@ class _AddManualAttendanceScreenState extends State { // Errors String? dateError, typeError; - String? checkInTimeError, checkInLocError, checkInDescError, checkInProofError; - String? checkOutTimeError, checkOutLocError, checkOutDescError, checkOutProofError; + String? checkInTimeError, + checkInLocError, + checkInDescError, + checkInProofError; + String? checkOutTimeError, + checkOutLocError, + checkOutDescError, + checkOutProofError; // In your Attendancelistprovider class CommonResponse? get addResponse => addResponse; @@ -132,10 +138,13 @@ class _AddManualAttendanceScreenState extends State { } Position pos = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.high); + desiredAccuracy: LocationAccuracy.high, + ); - List placemarks = - await placemarkFromCoordinates(pos.latitude, pos.longitude); + List placemarks = await placemarkFromCoordinates( + pos.latitude, + pos.longitude, + ); if (placemarks.isNotEmpty) { Placemark p = placemarks.first; @@ -147,9 +156,14 @@ class _AddManualAttendanceScreenState extends State { } } - Future _pickTime(TextEditingController controller, bool isCheckIn) async { - final TimeOfDay? picked = - await showTimePicker(context: context, initialTime: TimeOfDay.now()); + Future _pickTime( + TextEditingController controller, + bool isCheckIn, + ) async { + final TimeOfDay? picked = await showTimePicker( + context: context, + initialTime: TimeOfDay.now(), + ); if (picked != null) { controller.text = picked.format(context); // Clear error when time is selected @@ -177,16 +191,19 @@ class _AddManualAttendanceScreenState extends State { leading: const Icon(Icons.camera_alt), title: const Text("Capture photo from camera"), onTap: () async { - final XFile? file = - await picker.pickImage(source: ImageSource.camera); + final XFile? file = await picker.pickImage( + source: ImageSource.camera, + ); if (file != null) { setState(() { if (isCheckIn) { checkInProof = file; - if (checkInProofError != null) setState(() => checkInProofError = null); + if (checkInProofError != null) + setState(() => checkInProofError = null); } else { checkOutProof = file; - if (checkOutProofError != null) setState(() => checkOutProofError = null); + if (checkOutProofError != null) + setState(() => checkOutProofError = null); } }); } @@ -197,16 +214,19 @@ class _AddManualAttendanceScreenState extends State { leading: const Icon(Icons.photo_library), title: const Text("Select photo from gallery"), onTap: () async { - final XFile? file = - await picker.pickImage(source: ImageSource.gallery); + final XFile? file = await picker.pickImage( + source: ImageSource.gallery, + ); if (file != null) { setState(() { if (isCheckIn) { checkInProof = file; - if (checkInProofError != null) setState(() => checkInProofError = null); + if (checkInProofError != null) + setState(() => checkInProofError = null); } else { checkOutProof = file; - if (checkOutProofError != null) setState(() => checkOutProofError = null); + if (checkOutProofError != null) + setState(() => checkOutProofError = null); } }); } @@ -224,17 +244,24 @@ class _AddManualAttendanceScreenState extends State { // Reset errors first dateError = null; typeError = null; - checkInTimeError = checkInLocError = checkInDescError = checkInProofError = null; - checkOutTimeError = checkOutLocError = checkOutDescError = checkOutProofError = null; + checkInTimeError = + checkInLocError = checkInDescError = checkInProofError = null; + checkOutTimeError = + checkOutLocError = checkOutDescError = checkOutProofError = null; - final provider = Provider.of(context, listen: false); + final provider = Provider.of( + context, + listen: false, + ); // --- Date Validation (allow today, yesterday, day before yesterday) --- if (provider.dateController.text.isEmpty) { dateError = "Please select a date"; } else { try { - final enteredDate = DateFormat("dd MMM yyyy").parse(provider.dateController.text); + final enteredDate = DateFormat( + "dd MMM yyyy", + ).parse(provider.dateController.text); provider.setSelectedDate(enteredDate); final today = DateTime.now(); @@ -242,14 +269,16 @@ class _AddManualAttendanceScreenState extends State { final dayBeforeYesterday = today.subtract(const Duration(days: 2)); // Normalize dates (ignore time part) - bool isValid = enteredDate.year == today.year && + bool isValid = + enteredDate.year == today.year && enteredDate.month == today.month && (enteredDate.day == today.day || enteredDate.day == yesterday.day || enteredDate.day == dayBeforeYesterday.day); if (!isValid) { - dateError = "Date must be today, yesterday, or the day before yesterday"; + dateError = + "Date must be today, yesterday, or the day before yesterday"; } } catch (e) { dateError = "Invalid date format (use dd MMM yyyy)"; @@ -263,18 +292,26 @@ class _AddManualAttendanceScreenState extends State { // --- Check In Validations --- if (selectedType == "Check In" || selectedType == "Check In/Out") { - if (checkInTime.text.isEmpty) checkInTimeError = "Please select check-in time"; - if (checkInLocation.text.isEmpty) checkInLocError = "Please enter check-in location"; - if (checkInDescription.text.isEmpty) checkInDescError = "Please enter description"; - if (checkInProof == null) checkInProofError = "Please attach check-in proof"; + if (checkInTime.text.isEmpty) + checkInTimeError = "Please select check-in time"; + if (checkInLocation.text.isEmpty) + checkInLocError = "Please enter check-in location"; + if (checkInDescription.text.isEmpty) + checkInDescError = "Please enter description"; + if (checkInProof == null) + checkInProofError = "Please attach check-in proof"; } // --- Check Out Validations --- if (selectedType == "Check Out" || selectedType == "Check In/Out") { - if (checkOutTime.text.isEmpty) checkOutTimeError = "Please select check-out time"; - if (checkOutLocation.text.isEmpty) checkOutLocError = "Please enter check-out location"; - if (checkOutDescription.text.isEmpty) checkOutDescError = "Please enter description"; - if (checkOutProof == null) checkOutProofError = "Please attach check-out proof"; + if (checkOutTime.text.isEmpty) + checkOutTimeError = "Please select check-out time"; + if (checkOutLocation.text.isEmpty) + checkOutLocError = "Please enter check-out location"; + if (checkOutDescription.text.isEmpty) + checkOutDescError = "Please enter description"; + if (checkOutProof == null) + checkOutProofError = "Please attach check-out proof"; } // --- Stop if any error --- @@ -288,7 +325,7 @@ class _AddManualAttendanceScreenState extends State { checkOutTimeError, checkOutLocError, checkOutDescError, - checkOutProofError + checkOutProofError, ].any((e) => e != null)) { setState(() {}); // refresh UI to show error messages return; @@ -297,12 +334,14 @@ class _AddManualAttendanceScreenState extends State { // --- Format date for server --- String formattedDate = ""; try { - final parsedDate = DateFormat("dd MMM yyyy").parse(provider.dateController.text); + final parsedDate = DateFormat( + "dd MMM yyyy", + ).parse(provider.dateController.text); formattedDate = DateFormat("yyyy-MM-dd").format(parsedDate); } catch (e) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text("Error formatting date: $e")), - ); + ScaffoldMessenger.of( + context, + ).showSnackBar(SnackBar(content: Text("Error formatting date: $e"))); return; } @@ -340,11 +379,12 @@ class _AddManualAttendanceScreenState extends State { context, process: "Manual", type: selectedType!, - loc: selectedType == "Check In" - ? checkInLocation.text - : selectedType == "Check Out" - ? checkOutLocation.text - : "${checkInLocation.text}, ${checkOutLocation.text}", + loc: + selectedType == "Check In" + ? checkInLocation.text + : selectedType == "Check Out" + ? checkOutLocation.text + : "${checkInLocation.text}, ${checkOutLocation.text}", checkDate: formattedDate, checkInTime: finalCheckInTime, checkInLoc: finalCheckInLoc, @@ -358,7 +398,12 @@ class _AddManualAttendanceScreenState extends State { // --- Response handling --- if (provider.addResponse != null && provider.addResponse!.error == "0") { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(provider.addResponse!.message ?? "Attendance Submitted Successfully")), + SnackBar( + content: Text( + provider.addResponse!.message ?? + "Attendance Submitted Successfully", + ), + ), ); // Reset fields @@ -377,11 +422,13 @@ class _AddManualAttendanceScreenState extends State { _fetchInitialLocation(); } else { - String errorMessage = provider.errorMessage ?? "Failed to submit attendance"; + String errorMessage = + provider.errorMessage ?? "Failed to submit attendance"; if (errorMessage.contains("Check In is not Available")) { - errorMessage = "Cannot submit Check Out without a Check In record for this date"; + errorMessage = + "Cannot submit Check Out without a Check In record for this date"; } - if (errorMessage.contains("2")){ + if (errorMessage.contains("2")) { errorMessage = "Only One manual Request can be added in a month !"; } @@ -409,15 +456,15 @@ class _AddManualAttendanceScreenState extends State { return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => _onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => _onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -429,7 +476,7 @@ class _AddManualAttendanceScreenState extends State { appBar: appbar2New( context, "Add Manual Attendance", - () {}, + () {}, SizedBox.shrink(), 0xFFFFFFFF, ), @@ -453,7 +500,7 @@ class _AddManualAttendanceScreenState extends State { provider.dateController, "Date", "Select Date", - (v) {}, + (v) {}, TextInputType.text, false, null, @@ -474,12 +521,15 @@ class _AddManualAttendanceScreenState extends State { child: DropdownButton2( isExpanded: true, hint: const Text("Select Type"), - items: types - .map((e) => DropdownMenuItem( - value: e, - child: Text(e), - )) - .toList(), + items: + types + .map( + (e) => DropdownMenuItem( + value: e, + child: Text(e), + ), + ) + .toList(), value: selectedType, onChanged: (val) { setState(() { @@ -500,9 +550,11 @@ class _AddManualAttendanceScreenState extends State { ), errorWidget(context, typeError), - if (selectedType == "Check In" || selectedType == "Check In/Out") + if (selectedType == "Check In" || + selectedType == "Check In/Out") _buildSection("Check In"), - if (selectedType == "Check Out" || selectedType == "Check In/Out") + if (selectedType == "Check Out" || + selectedType == "Check In/Out") _buildSection("Check Out"), SizedBox(height: 80), @@ -520,18 +572,19 @@ class _AddManualAttendanceScreenState extends State { color: AppColors.app_blue, borderRadius: BorderRadius.circular(15), ), - child: provider.isSubmitting - ? CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation(AppColors.white), - ) - : const Text( - "Submit", - style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - color: Colors.white, - ), - ), + child: + provider.isSubmitting + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation(AppColors.white), + ) + : const Text( + "Submit", + style: TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + color: Colors.white, + ), + ), ), ), ); @@ -559,7 +612,7 @@ class _AddManualAttendanceScreenState extends State { timeCtrl, "$title Time", "Select Time", - (v) {}, + (v) {}, TextInputType.text, false, null, @@ -577,7 +630,7 @@ class _AddManualAttendanceScreenState extends State { locCtrl, "$title Location", "Enter Location", - (v) {}, + (v) {}, TextInputType.text, false, null, @@ -593,7 +646,7 @@ class _AddManualAttendanceScreenState extends State { descCtrl, "$title Description", "Enter Description", - (v) {}, + (v) {}, TextInputType.text, false, null, @@ -642,11 +695,14 @@ class _AddManualAttendanceScreenState extends State { icon: const Icon(Icons.close, color: Colors.red, size: 18), onPressed: () { setState(() { - if (isCheckIn) checkInProof = null; - else checkOutProof = null; + if (isCheckIn) { + checkInProof = null; + } else { + checkOutProof = null; + } }); }, - ) + ), ], ), errorWidget(context, proofError), @@ -661,9 +717,6 @@ Widget errorWidget(BuildContext context, String? error) { return Padding( padding: const EdgeInsets.only(bottom: 8, left: 4), - child: Text( - error, - style: const TextStyle(color: Colors.red, fontSize: 12), - ), + child: Text(error, style: const TextStyle(color: Colors.red, fontSize: 12)), ); -} \ No newline at end of file +} diff --git a/lib/screens/hrm/AddTourExpBillScreen.dart b/lib/screens/hrm/AddTourExpBillScreen.dart index 4a0fead..794fc2c 100644 --- a/lib/screens/hrm/AddTourExpBillScreen.dart +++ b/lib/screens/hrm/AddTourExpBillScreen.dart @@ -74,7 +74,10 @@ class _AddBillScreenState extends State { }); Future.microtask(() { - final provider = Provider.of(context, listen: false); + final provider = Provider.of( + context, + listen: false, + ); provider.fetchTourExpensesAddView(context, "0"); // fresh bill }); } @@ -97,13 +100,21 @@ class _AddBillScreenState extends State { // Function to validate all fields bool validateFields() { - String? newPlaceError = placeController.text.isEmpty ? "Place of visit is required" : null; - String? newDaAmountError = selectedDAAmount == null ? "DA Amount is required" : null; - String? newTourTypeError = selectedTourType == null ? "Tour Type is required" : null; - String? newTourDateError = Provider.of(context, listen: false).dateController.text.isEmpty - ? "Tour Date is required" - : null; - String? newNoteError = noteController.text.isEmpty ? "Note is required" : null; + String? newPlaceError = + placeController.text.isEmpty ? "Place of visit is required" : null; + String? newDaAmountError = + selectedDAAmount == null ? "DA Amount is required" : null; + String? newTourTypeError = + selectedTourType == null ? "Tour Type is required" : null; + String? newTourDateError = + Provider.of( + context, + listen: false, + ).dateController.text.isEmpty + ? "Tour Date is required" + : null; + String? newNoteError = + noteController.text.isEmpty ? "Note is required" : null; // Only update if there are actual changes to avoid unnecessary rebuilds if (placeError != newPlaceError || @@ -129,7 +140,20 @@ class _AddBillScreenState extends State { // Format date to "02 Sep 2025" format String _formatDate(DateTime date) { - const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', + ]; return '${date.day.toString().padLeft(2, '0')} ${months[date.month - 1]} ${date.year}'; } @@ -147,14 +171,18 @@ class _AddBillScreenState extends State { return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => _onBackPressed(context), - child: SafeArea( - top: false, bottom: true, child: _scaffold(context)), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => _onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } + Future pickImage(BuildContext context) async { final ImagePicker picker = ImagePicker(); @@ -168,7 +196,9 @@ class _AddBillScreenState extends State { leading: const Icon(Icons.photo_library), title: const Text('Pick from Gallery'), onTap: () async { - final picked = await picker.pickImage(source: ImageSource.gallery); + final picked = await picker.pickImage( + source: ImageSource.gallery, + ); Navigator.pop(ctx, picked != null ? File(picked.path) : null); }, ), @@ -176,7 +206,9 @@ class _AddBillScreenState extends State { leading: const Icon(Icons.camera_alt), title: const Text('Take a Photo'), onTap: () async { - final picked = await picker.pickImage(source: ImageSource.camera); + final picked = await picker.pickImage( + source: ImageSource.camera, + ); Navigator.pop(ctx, picked != null ? File(picked.path) : null); }, ), @@ -192,7 +224,11 @@ class _AddBillScreenState extends State { builder: (context, provider, _) { if (provider.isLoading) { return Scaffold( - body: Container(child: Center(child: CircularProgressIndicator(color: Colors.blue)),), + body: Container( + child: Center( + child: CircularProgressIndicator(color: Colors.blue), + ), + ), ); } if (provider.errorMessage != null) { @@ -239,7 +275,7 @@ class _AddBillScreenState extends State { placeController, "Place of Visit", "Enter Place", - (value) { + (value) { // Clear error when user types if (placeError != null && value.isNotEmpty) { setState(() => placeError = null); @@ -266,21 +302,27 @@ class _AddBillScreenState extends State { style: TextStyle(fontSize: 14), overflow: TextOverflow.ellipsis, ), - items: provider.daAmountList - .map((item) => DropdownMenuItem( - value: item, - child: Text( - item, - style: const TextStyle(fontSize: 14), - overflow: TextOverflow.ellipsis, - ), - )) - .toList(), + items: + provider.daAmountList + .map( + (item) => DropdownMenuItem( + value: item, + child: Text( + item, + style: const TextStyle( + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ) + .toList(), value: selectedDAAmount, onChanged: (String? value) { setState(() { selectedDAAmount = value; - if (daAmountError != null) daAmountError = null; + if (daAmountError != null) + daAmountError = null; }); }, buttonStyleData: ddtheme.buttonStyleData, @@ -306,21 +348,27 @@ class _AddBillScreenState extends State { style: TextStyle(fontSize: 14), overflow: TextOverflow.ellipsis, ), - items: provider.tourTypeList - .map((item) => DropdownMenuItem( - value: item, - child: Text( - item, - style: const TextStyle(fontSize: 14), - overflow: TextOverflow.ellipsis, - ), - )) - .toList(), + items: + provider.tourTypeList + .map( + (item) => DropdownMenuItem( + value: item, + child: Text( + item, + style: const TextStyle( + fontSize: 14, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ) + .toList(), value: selectedTourType, onChanged: (String? value) { setState(() { selectedTourType = value; - if (tourTypeError != null) tourTypeError = null; + if (tourTypeError != null) + tourTypeError = null; }); }, buttonStyleData: ddtheme.buttonStyleData, @@ -337,7 +385,10 @@ class _AddBillScreenState extends State { TextWidget(context, "Tour Date"), GestureDetector( onTap: () async { - final d = await provider.showDatePickerDialog(context, isFromDate: true); + final d = await provider.showDatePickerDialog( + context, + isFromDate: true, + ); if (d != null) { provider.dateController.text = _formatDate(d); if (tourDateError != null) { @@ -362,7 +413,9 @@ class _AddBillScreenState extends State { fontSize: 14, ), border: InputBorder.none, - contentPadding: EdgeInsets.symmetric(horizontal: 15), + contentPadding: EdgeInsets.symmetric( + horizontal: 15, + ), ), ), ), @@ -374,7 +427,7 @@ class _AddBillScreenState extends State { noteController, "Note", "Enter Note", - (value) { + (value) { // Clear error when user types if (noteError != null && value.isNotEmpty) { setState(() => noteError = null); @@ -393,40 +446,52 @@ class _AddBillScreenState extends State { const SizedBox(height: 16), /// Travel Expenses Section - sectionHeader("Travel Expenses", onAddTap: () { - showAddTravelExpenseSheet( - context, - travelExpenses, - () => setState(() {}), - provider.travelTypeList, - travelImages, - ); - }), - if (travelExpenses.isNotEmpty) travelExpenseList(travelExpenses), + sectionHeader( + "Travel Expenses", + onAddTap: () { + showAddTravelExpenseSheet( + context, + travelExpenses, + () => setState(() {}), + provider.travelTypeList, + travelImages, + ); + }, + ), + if (travelExpenses.isNotEmpty) + travelExpenseList(travelExpenses), /// Hotel Expenses Section - sectionHeader("Hotel Expenses", onAddTap: () { - showAddHotelExpenseSheet( - context, - hotelExpenses, - () => setState(() {}), - provider, - hotelImages, - ); - }), - if (hotelExpenses.isNotEmpty) hotelExpenseList(hotelExpenses), + sectionHeader( + "Hotel Expenses", + onAddTap: () { + showAddHotelExpenseSheet( + context, + hotelExpenses, + () => setState(() {}), + provider, + hotelImages, + ); + }, + ), + if (hotelExpenses.isNotEmpty) + hotelExpenseList(hotelExpenses), /// Other Expenses Section - sectionHeader("Other Expenses", onAddTap: () { - showAddOtherExpenseSheet( - context, - otherExpenses, - () => setState(() {}), - provider, - otherImages, - ); - }), - if (otherExpenses.isNotEmpty) otherExpenseList(otherExpenses), + sectionHeader( + "Other Expenses", + onAddTap: () { + showAddOtherExpenseSheet( + context, + otherExpenses, + () => setState(() {}), + provider, + otherImages, + ); + }, + ), + if (otherExpenses.isNotEmpty) + otherExpenseList(otherExpenses), const SizedBox(height: 80), ], @@ -434,7 +499,8 @@ class _AddBillScreenState extends State { ), ), ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + floatingActionButtonLocation: + FloatingActionButtonLocation.centerFloat, bottomNavigationBar: InkResponse( onTap: () async { // Validate all fields first @@ -443,22 +509,35 @@ class _AddBillScreenState extends State { } String formattedDate = ""; - final provider = Provider.of(context, listen: false); + final provider = Provider.of( + context, + listen: false, + ); tourDateError = null; - final parsedDate = DateFormat("dd MMM yyyy").parse(provider.dateController.text); + final parsedDate = DateFormat( + "dd MMM yyyy", + ).parse(provider.dateController.text); formattedDate = DateFormat("yyyy-MM-dd").format(parsedDate); - final success = await provider.addTourBill( context: context, placeOfVisit: placeController.text, daAmount: selectedDAAmount ?? "", tourType: selectedTourType ?? "", tourDate: formattedDate, - travelExpenses: travelExpenses.map((e) => e.map((k, v) => MapEntry(k, v as dynamic))).toList(), - hotelExpenses: hotelExpenses.map((e) => e.map((k, v) => MapEntry(k, v as dynamic))).toList(), - otherExpenses: otherExpenses.map((e) => e.map((k, v) => MapEntry(k, v as dynamic))).toList(), + travelExpenses: + travelExpenses + .map((e) => e.map((k, v) => MapEntry(k, v as dynamic))) + .toList(), + hotelExpenses: + hotelExpenses + .map((e) => e.map((k, v) => MapEntry(k, v as dynamic))) + .toList(), + otherExpenses: + otherExpenses + .map((e) => e.map((k, v) => MapEntry(k, v as dynamic))) + .toList(), travelImages: travelImages, hotelImages: hotelImages, otherImages: otherImages, @@ -468,12 +547,18 @@ class _AddBillScreenState extends State { print("image================== $travelImages"); if (success) { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text("Tour Bill Submitted Successfully")), + const SnackBar( + content: Text("Tour Bill Submitted Successfully"), + ), ); Navigator.pop(context, true); } else { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text(provider.errorMessage ?? "Failed to submit bill")), + SnackBar( + content: Text( + provider.errorMessage ?? "Failed to submit bill", + ), + ), ); } }, @@ -505,11 +590,14 @@ class _AddBillScreenState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - fontFamily: "JakartaMedium", - )), + Text( + title, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + fontFamily: "JakartaMedium", + ), + ), const SizedBox(height: 6), Container( height: 45, @@ -525,11 +613,14 @@ class _AddBillScreenState extends State { children: [ Icon(Icons.add, color: Colors.blue), SizedBox(width: 6), - Text("Add Expenses", style: TextStyle( - color: Colors.blue, - fontSize: 14, - fontFamily: "JakartaMedium", - )), + Text( + "Add Expenses", + style: TextStyle( + color: Colors.blue, + fontSize: 14, + fontFamily: "JakartaMedium", + ), + ), ], ), ), @@ -559,7 +650,6 @@ class _AddBillScreenState extends State { } } - Widget travelExpenseList(List> items) { return Container( height: 90, @@ -795,21 +885,23 @@ class _AddBillScreenState extends State { } Future pickFile() async { - FilePickerResult? result = await FilePicker.platform.pickFiles(type: FileType.any); + FilePickerResult? result = await FilePicker.platform.pickFiles( + type: FileType.any, + ); if (result != null && result.files.isNotEmpty) { return File(result.files.single.path!); } return null; } -// --- Travel Expense BottomSheet --- + // --- Travel Expense BottomSheet --- Future showAddTravelExpenseSheet( - BuildContext context, - List> travelExpenses, - VoidCallback onUpdated, - List travelTypes, - List travelImages, - ) { + BuildContext context, + List> travelExpenses, + VoidCallback onUpdated, + List travelTypes, + List travelImages, + ) { final fromController = TextEditingController(); final toController = TextEditingController(); final fareController = TextEditingController(); @@ -856,11 +948,16 @@ class _AddBillScreenState extends State { // Function to validate fields and show errors if needed bool validateFields() { - String? newFromError = fromController.text.isEmpty ? "From is required" : null; - String? newToError = toController.text.isEmpty ? "To is required" : null; - String? newTypeError = selectedTravelType == null ? "Please select type" : null; - String? newFareError = fareController.text.isEmpty ? "Fare is required" : null; - String? newBillError = billFile == null ? "Attach bill required" : null; + String? newFromError = + fromController.text.isEmpty ? "From is required" : null; + String? newToError = + toController.text.isEmpty ? "To is required" : null; + String? newTypeError = + selectedTravelType == null ? "Please select type" : null; + String? newFareError = + fareController.text.isEmpty ? "Fare is required" : null; + String? newBillError = + billFile == null ? "Attach bill required" : null; // Only update if there are actual changes to avoid unnecessary rebuilds if (fromError != newFromError || @@ -884,23 +981,27 @@ class _AddBillScreenState extends State { newBillError == null; } - Widget errorText(String? msg) => msg == null - ? const SizedBox() - : Padding( - padding: const EdgeInsets.only(top: 4, left: 4), - child: Text( - msg, - style: TextStyle( - color: Colors.red, - fontSize: 12, - fontFamily: "JakartaMedium", - ) - ), - ); + Widget errorText(String? msg) => + msg == null + ? const SizedBox() + : Padding( + padding: const EdgeInsets.only(top: 4, left: 4), + child: Text( + msg, + style: TextStyle( + color: Colors.red, + fontSize: 12, + fontFamily: "JakartaMedium", + ), + ), + ); return SafeArea( child: Container( - margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + margin: const EdgeInsets.symmetric( + horizontal: 15, + vertical: 10, + ), padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom, ), @@ -923,7 +1024,7 @@ class _AddBillScreenState extends State { fromController, "From", "Enter Starting Location", - (value) { + (value) { // Clear error when user types if (fromError != null && value.isNotEmpty) { updateState(() => fromError = null); @@ -944,7 +1045,7 @@ class _AddBillScreenState extends State { toController, "To", "Enter Destination Location", - (value) { + (value) { // Clear error when user types if (toError != null && value.isNotEmpty) { updateState(() => toError = null); @@ -962,26 +1063,29 @@ class _AddBillScreenState extends State { TextWidget(context, "Travel Type"), DropdownButtonHideUnderline( - child: Container( + child: SizedBox( width: double.infinity, child: DropdownButton2( isExpanded: true, hint: Text( - "Select Travel Type", - style: TextStyle( - fontSize: 14, - color: Color(0xFFB4BEC0), - ) + "Select Travel Type", + style: TextStyle( + fontSize: 14, + color: Color(0xFFB4BEC0), + ), ), - items: travelTypes.map((t) => - DropdownMenuItem( - value: t, - child: Text( - t, - style: TextStyle(fontSize: 14), + items: + travelTypes + .map( + (t) => DropdownMenuItem( + value: t, + child: Text( + t, + style: TextStyle(fontSize: 14), + ), + ), ) - ) - ).toList(), + .toList(), value: selectedTravelType, onChanged: (val) { updateState(() { @@ -992,7 +1096,10 @@ class _AddBillScreenState extends State { buttonStyleData: ButtonStyleData( height: 50, width: double.infinity, - padding: const EdgeInsets.only(left: 14, right: 14), + padding: const EdgeInsets.only( + left: 14, + right: 14, + ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(14), color: AppColors.text_field_color, @@ -1008,8 +1115,10 @@ class _AddBillScreenState extends State { offset: const Offset(0, -5), scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(40), - thickness: MaterialStateProperty.all(6), - thumbVisibility: MaterialStateProperty.all(true), + thickness: WidgetStateProperty.all(6), + thumbVisibility: WidgetStateProperty.all( + true, + ), ), ), ), @@ -1023,7 +1132,7 @@ class _AddBillScreenState extends State { fareController, "Fare Amount", "Enter Amount", - (value) { + (value) { // Clear error when user types if (fareError != null && value.isNotEmpty) { updateState(() => fareError = null); @@ -1054,11 +1163,16 @@ class _AddBillScreenState extends State { decoration: BoxDecoration( color: Color(0xFFE6F6FF), borderRadius: BorderRadius.circular(12), - border: Border.all(color: AppColors.app_blue, width: 0.5), + border: Border.all( + color: AppColors.app_blue, + width: 0.5, + ), ), child: Center( child: Text( - billFile == null ? "Attach Bill" : "Bill Attached", + billFile == null + ? "Attach Bill" + : "Bill Attached", style: TextStyle( fontFamily: "JakartaMedium", color: AppColors.app_blue, @@ -1078,7 +1192,7 @@ class _AddBillScreenState extends State { Expanded( flex: 5, child: Text( - "${billFile!.path.split('/').last}", + billFile!.path.split('/').last, maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -1091,7 +1205,8 @@ class _AddBillScreenState extends State { Expanded( flex: 1, child: InkResponse( - onTap: () => updateState(() => billFile = null), + onTap: + () => updateState(() => billFile = null), child: SvgPicture.asset( "assets/svg/ic_close.svg", width: 15, @@ -1101,7 +1216,7 @@ class _AddBillScreenState extends State { ), ], ), - ) + ), ], const SizedBox(height: 20), @@ -1149,14 +1264,14 @@ class _AddBillScreenState extends State { ); } -// --- Hotel Expense BottomSheet --- + // --- Hotel Expense BottomSheet --- Future showAddHotelExpenseSheet( - BuildContext context, - List> hotelExpenses, - VoidCallback onUpdated, - TourExpensesProvider provider, - List hotelImages, - ) { + BuildContext context, + List> hotelExpenses, + VoidCallback onUpdated, + TourExpensesProvider provider, + List hotelImages, + ) { final hotelController = TextEditingController(); final amountController = TextEditingController(); DateTime? fromDate, toDate; @@ -1197,12 +1312,16 @@ class _AddBillScreenState extends State { // Function to validate fields and show errors bool validateFields() { - String? newHotelError = hotelController.text.isEmpty ? "Hotel name required" : null; - String? newFromDateError = fromDate == null ? "From date required" : null; - String? newToDateError = toDate == null ? "To date required" : null; - String? newAmountError = amountController.text.isEmpty ? "Amount required" : null; - String? newBillError = billFile == null ? "Attach bill required" : null; - + String? newHotelError = + hotelController.text.isEmpty ? "Hotel name required" : null; + String? newFromDateError = + fromDate == null ? "From date required" : null; + String? newToDateError = + toDate == null ? "To date required" : null; + String? newAmountError = + amountController.text.isEmpty ? "Amount required" : null; + String? newBillError = + billFile == null ? "Attach bill required" : null; if (hotelError != newHotelError || fromDateError != newFromDateError || @@ -1225,23 +1344,27 @@ class _AddBillScreenState extends State { newBillError == null; } - Widget errorText(String? msg) => msg == null - ? const SizedBox() - : Padding( - padding: const EdgeInsets.only(top: 4, left: 4), - child: Text( - msg, - style: TextStyle( - color: Colors.red, - fontSize: 12, - fontFamily: "JakartaMedium", - ), - ), - ); + Widget errorText(String? msg) => + msg == null + ? const SizedBox() + : Padding( + padding: const EdgeInsets.only(top: 4, left: 4), + child: Text( + msg, + style: TextStyle( + color: Colors.red, + fontSize: 12, + fontFamily: "JakartaMedium", + ), + ), + ); return SafeArea( child: Container( - margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + margin: const EdgeInsets.symmetric( + horizontal: 15, + vertical: 10, + ), padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom, ), @@ -1264,7 +1387,7 @@ class _AddBillScreenState extends State { hotelController, "Hotel Name", "Enter Hotel Name", - (value) { + (value) { // Clear error if (hotelError != null && value.isNotEmpty) { updateState(() => hotelError = null); @@ -1293,11 +1416,15 @@ class _AddBillScreenState extends State { Expanded( child: GestureDetector( onTap: () async { - final d = await provider.showDatePickerDialog(context, isFromDate: true); + final d = await provider.showDatePickerDialog( + context, + isFromDate: true, + ); if (d != null) { updateState(() { fromDate = d; - if (fromDateError != null) fromDateError = null; + if (fromDateError != null) + fromDateError = null; }); } }, @@ -1311,10 +1438,15 @@ class _AddBillScreenState extends State { child: Text( fromDate == null ? "From Date" - : DateFormat("dd MMM yyyy").format(fromDate!), + : DateFormat( + "dd MMM yyyy", + ).format(fromDate!), style: TextStyle( fontSize: 14, - color: fromDate == null ? Color(0xFFB4BEC0) : Colors.black, + color: + fromDate == null + ? Color(0xFFB4BEC0) + : Colors.black, fontFamily: "JakartaMedium", ), ), @@ -1326,7 +1458,10 @@ class _AddBillScreenState extends State { Expanded( child: GestureDetector( onTap: () async { - final d = await provider.showDatePickerDialog(context, isFromDate: false); + final d = await provider.showDatePickerDialog( + context, + isFromDate: false, + ); if (d != null) { updateState(() { toDate = d; @@ -1344,14 +1479,18 @@ class _AddBillScreenState extends State { child: Text( toDate == null ? "To Date" - : DateFormat("dd MMM yyyy").format(toDate!), + : DateFormat( + "dd MMM yyyy", + ).format(toDate!), style: TextStyle( fontSize: 14, - color: toDate == null ? Color(0xFFB4BEC0) : Colors.black, + color: + toDate == null + ? Color(0xFFB4BEC0) + : Colors.black, fontFamily: "JakartaMedium", ), ), - ), ), ), @@ -1367,7 +1506,7 @@ class _AddBillScreenState extends State { amountController, "Amount", "Enter Amount", - (value) { + (value) { // Clear error if (amountError != null && value.isNotEmpty) { updateState(() => amountError = null); @@ -1398,11 +1537,16 @@ class _AddBillScreenState extends State { decoration: BoxDecoration( color: Color(0xFFE6F6FF), borderRadius: BorderRadius.circular(12), - border: Border.all(color: AppColors.app_blue, width: 0.5), + border: Border.all( + color: AppColors.app_blue, + width: 0.5, + ), ), child: Center( child: Text( - billFile == null ? "Attach Bill" : "Bill Attached", + billFile == null + ? "Attach Bill" + : "Bill Attached", style: TextStyle( fontFamily: "JakartaMedium", color: AppColors.app_blue, @@ -1419,16 +1563,22 @@ class _AddBillScreenState extends State { const Icon(Icons.check_circle, color: Colors.green), const SizedBox(width: 8), Expanded( - child: Text("Attached: ${billFile!.path.split('/').last}", - overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontFamily: "JakartaMedium", fontSize: 14))), + child: Text( + "Attached: ${billFile!.path.split('/').last}", + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + ), + ), + ), IconButton( icon: const Icon(Icons.close, color: Colors.red), - onPressed: () => updateState(() => billFile = null), + onPressed: + () => updateState(() => billFile = null), ), ], - ) + ), ], const SizedBox(height: 20), @@ -1476,14 +1626,14 @@ class _AddBillScreenState extends State { ); } -// --- Other Expense BottomSheet --- + // --- Other Expense BottomSheet --- Future showAddOtherExpenseSheet( - BuildContext context, - List> otherExpenses, - VoidCallback onUpdated, - TourExpensesProvider provider, - List otherImages, - ) { + BuildContext context, + List> otherExpenses, + VoidCallback onUpdated, + TourExpensesProvider provider, + List otherImages, + ) { final titleController = TextEditingController(); final amountController = TextEditingController(); File? billFile; @@ -1524,10 +1674,12 @@ class _AddBillScreenState extends State { // Function to validate fields and show errors bool validateFields() { String? newDateError = date == null ? "Date required" : null; - String? newTitleError = titleController.text.isEmpty ? "Title required" : null; - String? newAmountError = amountController.text.isEmpty ? "Amount required" : null; - String? newBillError = billFile == null ? "Attach bill required" : null; - + String? newTitleError = + titleController.text.isEmpty ? "Title required" : null; + String? newAmountError = + amountController.text.isEmpty ? "Amount required" : null; + String? newBillError = + billFile == null ? "Attach bill required" : null; if (dateError != newDateError || titleError != newTitleError || @@ -1547,23 +1699,27 @@ class _AddBillScreenState extends State { newBillError == null; } - Widget errorText(String? msg) => msg == null - ? const SizedBox() - : Padding( - padding: const EdgeInsets.only(top: 4, left: 4), - child: Text( - msg, - style: TextStyle( - color: Colors.red, - fontSize: 12, - fontFamily: "JakartaMedium", - ), - ), - ); + Widget errorText(String? msg) => + msg == null + ? const SizedBox() + : Padding( + padding: const EdgeInsets.only(top: 4, left: 4), + child: Text( + msg, + style: TextStyle( + color: Colors.red, + fontSize: 12, + fontFamily: "JakartaMedium", + ), + ), + ); return SafeArea( child: Container( - margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + margin: const EdgeInsets.symmetric( + horizontal: 15, + vertical: 10, + ), padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom, ), @@ -1584,7 +1740,10 @@ class _AddBillScreenState extends State { TextWidget(context, "Date"), GestureDetector( onTap: () async { - final d = await provider.showDatePickerDialog(context, isFromDate: false); + final d = await provider.showDatePickerDialog( + context, + isFromDate: false, + ); if (d != null) { updateState(() { date = d; @@ -1600,7 +1759,10 @@ class _AddBillScreenState extends State { ), child: Container( width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 14, horizontal: 12), + padding: const EdgeInsets.symmetric( + vertical: 14, + horizontal: 12, + ), decoration: BoxDecoration( color: Colors.grey.shade100, borderRadius: BorderRadius.circular(16), @@ -1611,7 +1773,10 @@ class _AddBillScreenState extends State { : DateFormat("dd MMM yyyy").format(date!), style: TextStyle( fontSize: 14, - color: date == null ? const Color(0xFFB4BEC0) : Colors.black, + color: + date == null + ? const Color(0xFFB4BEC0) + : Colors.black, fontFamily: "JakartaMedium", ), ), @@ -1626,7 +1791,7 @@ class _AddBillScreenState extends State { titleController, "Description", "Enter Title", - (value) { + (value) { // Clear error if (titleError != null && value.isNotEmpty) { updateState(() => titleError = null); @@ -1647,7 +1812,7 @@ class _AddBillScreenState extends State { amountController, "Amount", "Enter Amount", - (value) { + (value) { // Clear error if (amountError != null && value.isNotEmpty) { updateState(() => amountError = null); @@ -1678,11 +1843,16 @@ class _AddBillScreenState extends State { decoration: BoxDecoration( color: Color(0xFFE6F6FF), borderRadius: BorderRadius.circular(12), - border: Border.all(color: AppColors.app_blue, width: 0.5), + border: Border.all( + color: AppColors.app_blue, + width: 0.5, + ), ), child: Center( child: Text( - billFile == null ? "Attach Bill" : "Bill Attached", + billFile == null + ? "Attach Bill" + : "Bill Attached", style: TextStyle( fontFamily: "JakartaMedium", color: AppColors.app_blue, @@ -1702,7 +1872,7 @@ class _AddBillScreenState extends State { Expanded( flex: 5, child: Text( - "${billFile!.path.split('/').last}", + billFile!.path.split('/').last, maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -1715,7 +1885,8 @@ class _AddBillScreenState extends State { Expanded( flex: 1, child: InkResponse( - onTap: () => updateState(() => billFile = null), + onTap: + () => updateState(() => billFile = null), child: SvgPicture.asset( "assets/svg/ic_close.svg", width: 15, @@ -1725,7 +1896,7 @@ class _AddBillScreenState extends State { ), ], ), - ) + ), ], const SizedBox(height: 20), @@ -1771,4 +1942,4 @@ class _AddBillScreenState extends State { }, ); } -} \ No newline at end of file +} diff --git a/lib/screens/hrm/AttendanceRequestDetail.dart b/lib/screens/hrm/AttendanceRequestDetail.dart index 7a71a1a..6fb278f 100644 --- a/lib/screens/hrm/AttendanceRequestDetail.dart +++ b/lib/screens/hrm/AttendanceRequestDetail.dart @@ -14,7 +14,11 @@ import '../finance/FileViewer.dart'; class AttendanceRequestDetailScreen extends StatefulWidget { final String mode; final attendanceListId; - const AttendanceRequestDetailScreen({super.key, required this.attendanceListId, required this.mode}); + const AttendanceRequestDetailScreen({ + super.key, + required this.attendanceListId, + required this.mode, + }); @override State createState() => @@ -23,8 +27,7 @@ class AttendanceRequestDetailScreen extends StatefulWidget { class _AttendanceRequestDetailScreenState extends State { - - bool _actionSubmitted = false; + final bool _actionSubmitted = false; late AttendanceDetailsProvider provider; @override @@ -32,336 +35,502 @@ class _AttendanceRequestDetailScreenState return SafeArea( top: false, child: ChangeNotifierProvider( - create: (_) => - AttendanceDetailsProvider()..fetchAttendanceRequestDetail(context, widget.attendanceListId), - child: Consumer( - builder: (context, provider, child) { - // Get screen dimensions for responsive scaling - final screenWidth = MediaQuery.of(context).size.width; - final screenHeight = MediaQuery.of(context).size.height; - - // Scale factors based on screen size - final scaleFactor = screenWidth / 360; // Base width for scaling - final textScaleFactor = MediaQuery.of(context).textScaleFactor.clamp(1.0, 1.2); - - return Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - backgroundColor: Color(0xFFFFFFFF), - title: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - InkResponse( - onTap: () => Navigator.pop(context, true), - child: SvgPicture.asset( - "assets/svg/appbar_back_button.svg", - height: 25 * scaleFactor, - ), + create: + (_) => + AttendanceDetailsProvider()..fetchAttendanceRequestDetail( + context, + widget.attendanceListId, + ), + child: Consumer( + builder: (context, provider, child) { + // Get screen dimensions for responsive scaling + final screenWidth = MediaQuery.of(context).size.width; + final screenHeight = MediaQuery.of(context).size.height; + + // Scale factors based on screen size + final scaleFactor = screenWidth / 360; // Base width for scaling + final textScaleFactor = MediaQuery.of( + context, + ).textScaleFactor.clamp(1.0, 1.2); + + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + backgroundColor: Color(0xFFFFFFFF), + title: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + InkResponse( + onTap: () => Navigator.pop(context, true), + child: SvgPicture.asset( + "assets/svg/appbar_back_button.svg", + height: 25 * scaleFactor, ), - SizedBox(width: 10 * scaleFactor), - InkResponse( - onTap: () => Navigator.pop(context, true), - child: Text( - "Attendance Details", - style: TextStyle( - fontSize: 18, - height: 1.1, - fontFamily: "Plus Jakarta Sans", - fontWeight: FontWeight.w600, - color: AppColors.semi_black, - ), + ), + SizedBox(width: 10 * scaleFactor), + InkResponse( + onTap: () => Navigator.pop(context, true), + child: Text( + "Attendance Details", + style: TextStyle( + fontSize: 18, + height: 1.1, + fontFamily: "Plus Jakarta Sans", + fontWeight: FontWeight.w600, + color: AppColors.semi_black, ), ), - ], - ), + ), + ], ), - backgroundColor: Color(0xFFF6F6F8), - body: Builder( - builder: (context) { - if (provider.isLoading) { - return const Center(child: CircularProgressIndicator(color: Colors.blue,)); - } - // if (provider.errorMessage != null) { - // return Center(child: Text(provider.errorMessage!)); - // } - if (provider.response?.requestDetails == null) { - return const Center(child: Text("No details found")); - } - - final details = provider.response!.requestDetails!; - final checkInTime = details.status == "Requested" ? "--" : details.checkInTime; - - + ), + backgroundColor: Color(0xFFF6F6F8), + body: Builder( + builder: (context) { + if (provider.isLoading) { + return const Center( + child: CircularProgressIndicator(color: Colors.blue), + ); + } + // if (provider.errorMessage != null) { + // return Center(child: Text(provider.errorMessage!)); + // } + if (provider.response?.requestDetails == null) { + return const Center(child: Text("No details found")); + } + final details = provider.response!.requestDetails!; + final checkInTime = + details.status == "Requested" + ? "--" + : details.checkInTime; - /// scr - return SingleChildScrollView( - padding: EdgeInsets.all(16.0 * scaleFactor), - child: Column( - children: [ - Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(16 * scaleFactor), + /// scr + return SingleChildScrollView( + padding: EdgeInsets.all(16.0 * scaleFactor), + child: Column( + children: [ + Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 16 * scaleFactor, ), - elevation: 0, - child: Padding( - padding: EdgeInsets.all(16.0 * scaleFactor), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(bottom: 0.5 * scaleFactor), - padding: EdgeInsets.symmetric(horizontal: 2.5 * scaleFactor, vertical: 12 * scaleFactor), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12 * scaleFactor), + ), + elevation: 0, + child: Padding( + padding: EdgeInsets.all(16.0 * scaleFactor), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only( + bottom: 0.5 * scaleFactor, + ), + padding: EdgeInsets.symmetric( + horizontal: 2.5 * scaleFactor, + vertical: 12 * scaleFactor, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular( + 12 * scaleFactor, ), - child: Row( - children: [ - /// Left Avatar - Container( - height: 44 * scaleFactor, - width: 44 * scaleFactor, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: const Color(0xFFEDF8FF), // icon bg - ), - child: Center( - child: SvgPicture.asset( - height: 24 * scaleFactor, - width: 24 * scaleFactor, - "assets/svg/hrm/attendanceList.svg", - fit: BoxFit.contain, - ), + ), + child: Row( + children: [ + /// Left Avatar + Container( + height: 44 * scaleFactor, + width: 44 * scaleFactor, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: const Color( + 0xFFEDF8FF, + ), // icon bg + ), + child: Center( + child: SvgPicture.asset( + height: 24 * scaleFactor, + width: 24 * scaleFactor, + "assets/svg/hrm/attendanceList.svg", + fit: BoxFit.contain, ), ), - SizedBox(width: 12 * scaleFactor), - - /// Middle text - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - details.type ?? "-", - style: TextStyle( - decoration: TextDecoration.underline, - decorationStyle: - TextDecorationStyle.dotted, - decorationColor: AppColors.grey_thick, - height: 1.2, - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.semi_black, - ), + ), + SizedBox(width: 12 * scaleFactor), + + /// Middle text + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + details.type ?? "-", + style: TextStyle( + decoration: + TextDecoration.underline, + decorationStyle: + TextDecorationStyle.dotted, + decorationColor: + AppColors.grey_thick, + height: 1.2, + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, ), - SizedBox(height: 2 * scaleFactor), - Text( - details.date ?? "-", - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.app_blue, - ), + ), + SizedBox(height: 2 * scaleFactor), + Text( + details.date ?? "-", + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.app_blue, ), - ], - ), + ), + ], ), + ), - /// Right side (Live/Manual) - Container( - height: 30 * scaleFactor, - padding: EdgeInsets.symmetric( - horizontal: 12 * scaleFactor, + /// Right side (Live/Manual) + Container( + height: 30 * scaleFactor, + padding: EdgeInsets.symmetric( + horizontal: 12 * scaleFactor, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + 6 * scaleFactor, ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6 * scaleFactor), - color: getDecorationColor(details.status) + color: getDecorationColor( + details.status, ), - child: Center( - child: Text( - details.status ?? "-", - style: TextStyle( - fontSize: 13, - fontWeight: FontWeight.w600, - color: getTextColor(details.status.toString()), + ), + child: Center( + child: Text( + details.status ?? "-", + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + color: getTextColor( + details.status.toString(), ), ), ), ), - ], - ), + ), + ], ), + ), + + // Employee Details + _buildSectionHeader( + "Employee Details", + scaleFactor, + ), + _buildDetailTile( + "Employee Name", + details.employeeName, + scaleFactor, + ), + _buildDetailTile( + "Created Employee", + details.createdEmpName, + scaleFactor, + ), - // Employee Details - _buildSectionHeader("Employee Details", scaleFactor), - _buildDetailTile("Employee Name", details.employeeName, scaleFactor), - _buildDetailTile("Created Employee", details.createdEmpName, scaleFactor), - - // Check In/Out - _buildSectionHeader("Check In/Out Details", scaleFactor), - _buildDate_TimeTile("Check In Date & Time", details.date, details.checkInTime, scaleFactor), - _buildDate_TimeTile("Check Out Date & Time", details.date, details.checkOutTime, scaleFactor), - - _buildDetailTile("Original Check In", checkInTime, scaleFactor), - - _buildDetailTile("Original Check Out", "--", scaleFactor), - _buildDetailTile("Original Check In Location", details.checkInLocation, scaleFactor), - _buildDetailTile("Original Check Out Location", details.checkOutLocation, scaleFactor), - buildLocationTile("Location", details.location, scaleFactor), - - // Proofs - if ((details.checkInProofDirFilePath != null && details.checkInProofDirFilePath!.isNotEmpty) || - (details.checkOutProofDirFilePath != null && details.checkOutProofDirFilePath!.isNotEmpty)) ...[ - _buildSectionHeader("Proofs", scaleFactor), - if (details.checkInProofDirFilePath != null && details.checkInProofDirFilePath!.isNotEmpty) - _buildProofLink(context, "Check In Proof", details.checkInProofDirFilePath, scaleFactor), - if (details.checkOutProofDirFilePath != null && details.checkOutProofDirFilePath!.isNotEmpty) - _buildProofLink(context, "Check Out Proof", details.checkOutProofDirFilePath, scaleFactor), - ], - - // Remarks & Approvals - _buildSectionHeader("Remarks & Approvals", scaleFactor), - _buildDetailTile("Level 1 Approved By", details.level1EmpName, scaleFactor), - _buildDetailTile("Level 2 Approved By", details.level2EmpName, scaleFactor), - _buildDetailTile("Level 1 Remark", details.level1Remarks, scaleFactor), - _buildDetailTile("Level 2 Remark", details.level2Remarks, scaleFactor), - - ///remain data - _buildSectionHeader("Other Details", scaleFactor), - _buildDetailTile("Check In Type", details.checkInType, scaleFactor), - _buildDetailTile("Check Out Type", details.chechOutType, scaleFactor), - _buildDetailTile("Check Out Time", details.checkOutTime, scaleFactor), - // Attendance Info - _buildDetailTile("ID", details.id, scaleFactor), - _buildDetailTile("Attendance Type", details.attendanceType, scaleFactor), - _buildDetailTile("Note", details.note, scaleFactor), - _buildDetailTile("Created Datetime", details.requestedDatetime, scaleFactor), + // Check In/Out + _buildSectionHeader( + "Check In/Out Details", + scaleFactor, + ), + _buildDate_TimeTile( + "Check In Date & Time", + details.date, + details.checkInTime, + scaleFactor, + ), + _buildDate_TimeTile( + "Check Out Date & Time", + details.date, + details.checkOutTime, + scaleFactor, + ), + + _buildDetailTile( + "Original Check In", + checkInTime, + scaleFactor, + ), + + _buildDetailTile( + "Original Check Out", + "--", + scaleFactor, + ), + _buildDetailTile( + "Original Check In Location", + details.checkInLocation, + scaleFactor, + ), + _buildDetailTile( + "Original Check Out Location", + details.checkOutLocation, + scaleFactor, + ), + buildLocationTile( + "Location", + details.location, + scaleFactor, + ), + + // Proofs + if ((details.checkInProofDirFilePath != null && + details + .checkInProofDirFilePath! + .isNotEmpty) || + (details.checkOutProofDirFilePath != null && + details + .checkOutProofDirFilePath! + .isNotEmpty)) ...[ + _buildSectionHeader("Proofs", scaleFactor), + if (details.checkInProofDirFilePath != null && + details + .checkInProofDirFilePath! + .isNotEmpty) + _buildProofLink( + context, + "Check In Proof", + details.checkInProofDirFilePath, + scaleFactor, + ), + if (details.checkOutProofDirFilePath != + null && + details + .checkOutProofDirFilePath! + .isNotEmpty) + _buildProofLink( + context, + "Check Out Proof", + details.checkOutProofDirFilePath, + scaleFactor, + ), ], - ), + + // Remarks & Approvals + _buildSectionHeader( + "Remarks & Approvals", + scaleFactor, + ), + _buildDetailTile( + "Level 1 Approved By", + details.level1EmpName, + scaleFactor, + ), + _buildDetailTile( + "Level 2 Approved By", + details.level2EmpName, + scaleFactor, + ), + _buildDetailTile( + "Level 1 Remark", + details.level1Remarks, + scaleFactor, + ), + _buildDetailTile( + "Level 2 Remark", + details.level2Remarks, + scaleFactor, + ), + + ///remain data + _buildSectionHeader( + "Other Details", + scaleFactor, + ), + _buildDetailTile( + "Check In Type", + details.checkInType, + scaleFactor, + ), + _buildDetailTile( + "Check Out Type", + details.chechOutType, + scaleFactor, + ), + _buildDetailTile( + "Check Out Time", + details.checkOutTime, + scaleFactor, + ), + // Attendance Info + _buildDetailTile("ID", details.id, scaleFactor), + _buildDetailTile( + "Attendance Type", + details.attendanceType, + scaleFactor, + ), + _buildDetailTile( + "Note", + details.note, + scaleFactor, + ), + _buildDetailTile( + "Created Datetime", + details.requestedDatetime, + scaleFactor, + ), + ], ), ), - SizedBox(height: 30 * scaleFactor), - ], - ), - ); - }, - ), - bottomNavigationBar: (widget.mode == "apr_lvl1" - && !_actionSubmitted - && provider.response?.requestDetails?.status != "Level 1 Approved" - && provider.response?.requestDetails?.status != "Rejected") - ? Container( - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xffFFFFFF), - Color(0x00FFFFFF), + ), + SizedBox(height: 30 * scaleFactor), ], ), - ), - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), - height: 61, - child: Column( - children: [ - Row( - children: [ - /// Reject Button - Expanded( - child: InkWell( - onTap: () { - showRemarkSheet( - context: context, - actionType: "Reject", - onSubmit: (remark) { - provider.rejectApproveAttendanceRequest( - context, - mode: widget.mode, - type: "Rejected", - remarks: remark, - id: provider.response!.requestDetails!.id!, - ); - }, - ).then((_) { - provider.fetchAttendanceRequestDetail(context, widget.attendanceListId); // or setState(() {}) if needed - }); - }, - child: Container( - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/svg/finance/level_reject_ic.svg"), - const SizedBox(width: 6), - const Text("Reject"), - ], - ), - ), - ), + ); + }, + ), + bottomNavigationBar: + (widget.mode == "apr_lvl1" && + !_actionSubmitted && + provider.response?.requestDetails?.status != + "Level 1 Approved" && + provider.response?.requestDetails?.status != + "Rejected") + ? Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [Color(0xffFFFFFF), Color(0x00FFFFFF)], ), + ), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 6, + ), + height: 61, + child: Column( + children: [ + Row( + children: [ + /// Reject Button + Expanded( + child: InkWell( + onTap: () { + showRemarkSheet( + context: context, + actionType: "Reject", + onSubmit: (remark) { + provider + .rejectApproveAttendanceRequest( + context, + mode: widget.mode, + type: "Rejected", + remarks: remark, + id: + provider + .response! + .requestDetails! + .id!, + ); + }, + ).then((_) { + provider.fetchAttendanceRequestDetail( + context, + widget.attendanceListId, + ); // or setState(() {}) if needed + }); + }, + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/svg/finance/level_reject_ic.svg", + ), + const SizedBox(width: 6), + const Text("Reject"), + ], + ), + ), + ), + ), - /// Vertical Divider - Container( - width: 1, - height: 45, - color: Colors.grey.shade300, - ), + /// Vertical Divider + Container( + width: 1, + height: 45, + color: Colors.grey.shade300, + ), - /// Approve Button - Expanded( - child: InkWell( - onTap: () { - showRemarkSheet( - context: context, - actionType: "Approve", - onSubmit: (remark) async { - await provider.rejectApproveAttendanceRequest( - context, - mode: widget.mode, - type: "Approved", - remarks: remark, - id: provider.response!.requestDetails!.id!, - ); - }, - ).then((_) { - provider.fetchAttendanceRequestDetail(context, widget.attendanceListId); // or setState(() {}) if needed - }); - }, + /// Approve Button + Expanded( + child: InkWell( + onTap: () { + showRemarkSheet( + context: context, + actionType: "Approve", + onSubmit: (remark) async { + await provider + .rejectApproveAttendanceRequest( + context, + mode: widget.mode, + type: "Approved", + remarks: remark, + id: + provider + .response! + .requestDetails! + .id!, + ); + }, + ).then((_) { + provider.fetchAttendanceRequestDetail( + context, + widget.attendanceListId, + ); // or setState(() {}) if needed + }); + }, - child: Container( - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/svg/finance/level_approve_ic.svg"), - const SizedBox(width: 6), - const Text("Approve"), - ], + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/svg/finance/level_approve_ic.svg", + ), + const SizedBox(width: 6), + const Text("Approve"), + ], + ), + ), + ), ), - ), + ], ), - ), - ], - ), - SizedBox(height: 0,) - ], - ), - ) - : const SizedBox.shrink(), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, - ); - }, - ) + SizedBox(height: 0), + ], + ), + ) + : const SizedBox.shrink(), + floatingActionButtonLocation: + FloatingActionButtonLocation.centerDocked, + ); + }, + ), ), ); } @@ -391,7 +560,9 @@ class _AttendanceRequestDetailScreenState bool validateFields() { String? newRemarkError = - remarkController.text.trim().isEmpty ? "Remark required" : null; + remarkController.text.trim().isEmpty + ? "Remark required" + : null; if (remarkError != newRemarkError) { updateState(() { @@ -401,23 +572,27 @@ class _AttendanceRequestDetailScreenState return newRemarkError == null; } - Widget errorText(String? msg) => msg == null - ? const SizedBox() - : Padding( - padding: const EdgeInsets.only(top: 4, left: 4), - child: Text( - msg, - style: const TextStyle( - color: Colors.red, - fontSize: 12, - fontFamily: "JakartaMedium", - ), - ), - ); + Widget errorText(String? msg) => + msg == null + ? const SizedBox() + : Padding( + padding: const EdgeInsets.only(top: 4, left: 4), + child: Text( + msg, + style: const TextStyle( + color: Colors.red, + fontSize: 12, + fontFamily: "JakartaMedium", + ), + ), + ); return SafeArea( child: Container( - margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + margin: const EdgeInsets.symmetric( + horizontal: 15, + vertical: 10, + ), padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom, ), @@ -463,11 +638,15 @@ class _AttendanceRequestDetailScreenState decoration: InputDecoration( hintText: "Enter your remark here...", hintStyle: TextStyle( - color: Colors.grey.shade500, // Customize this color + color: + Colors.grey.shade500, // Customize this color fontSize: 14, // Optional: tweak font size ), border: InputBorder.none, - contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12), + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 12, + ), ), ), ), @@ -510,7 +689,9 @@ class _AttendanceRequestDetailScreenState Navigator.pop(context); ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text("Request submitted successfully"), + content: Text( + "Request submitted successfully", + ), backgroundColor: Colors.green, behavior: SnackBarBehavior.floating, ), @@ -534,7 +715,6 @@ class _AttendanceRequestDetailScreenState ), ), ), - ), ], ), @@ -549,7 +729,6 @@ class _AttendanceRequestDetailScreenState ); } - /// Reusable Row Widget for details Widget _buildDetailTile(String label, String? value, double scaleFactor) { return Padding( @@ -569,17 +748,14 @@ class _AttendanceRequestDetailScreenState ), ), ), - SizedBox(width: 4,), + SizedBox(width: 4), // Value Expanded( flex: 5, // take remaining width child: Text( value ?? "-", - style: const TextStyle( - fontSize: 14, - color: Color(0xFF818181), - ), + style: const TextStyle(fontSize: 14, color: Color(0xFF818181)), softWrap: true, overflow: TextOverflow.visible, // wrap instead of clipping ), @@ -589,16 +765,16 @@ class _AttendanceRequestDetailScreenState ); } - /// for location /// Location Tile Widget buildLocationTile(String label, String? value, double scaleFactor) { return FutureBuilder( future: getReadableLocation(value), builder: (context, snapshot) { - final locationText = snapshot.connectionState == ConnectionState.done - ? (snapshot.data ?? value ?? "-") - : value ?? "-"; + final locationText = + snapshot.connectionState == ConnectionState.done + ? (snapshot.data ?? value ?? "-") + : value ?? "-"; return Padding( padding: EdgeInsets.symmetric(vertical: 6 * scaleFactor), @@ -624,9 +800,13 @@ class _AttendanceRequestDetailScreenState child: GestureDetector( onTap: () async { final uri = Uri.parse( - "https://www.google.com/maps/search/?api=1&query=$value"); + "https://www.google.com/maps/search/?api=1&query=$value", + ); if (await canLaunchUrl(uri)) { - await launchUrl(uri, mode: LaunchMode.externalApplication); + await launchUrl( + uri, + mode: LaunchMode.externalApplication, + ); } }, child: Text( @@ -668,12 +848,12 @@ class _AttendanceRequestDetailScreenState // Include more details final address = [ place.name, - place.street, // e.g. "A-46, Lata Enclave" - place.subLocality, // e.g. "Madhura Nagar" - place.locality, // e.g. "Hyderabad" + place.street, // e.g. "A-46, Lata Enclave" + place.subLocality, // e.g. "Madhura Nagar" + place.locality, // e.g. "Hyderabad" place.administrativeArea, // e.g. "Telangana" - place.postalCode, // e.g. "500038" - place.country // e.g. "India" + place.postalCode, // e.g. "500038" + place.country, // e.g. "India" ].where((e) => e != null && e.isNotEmpty).join(", "); return address; @@ -682,9 +862,13 @@ class _AttendanceRequestDetailScreenState } } - /// for date and time - Widget _buildDate_TimeTile(String label, String? date, String? time, double scaleFactor) { + Widget _buildDate_TimeTile( + String label, + String? date, + String? time, + double scaleFactor, + ) { return Padding( padding: EdgeInsets.symmetric(vertical: 6 * scaleFactor), child: Row( @@ -702,7 +886,7 @@ class _AttendanceRequestDetailScreenState ), ), ), - SizedBox(width: 4,), + SizedBox(width: 4), // Value (date + time) Expanded( @@ -714,7 +898,7 @@ class _AttendanceRequestDetailScreenState color: Color(0xff818181), fontWeight: FontWeight.w400, ), - softWrap: true, // allow wrapping + softWrap: true, // allow wrapping overflow: TextOverflow.visible, ), ), @@ -723,7 +907,6 @@ class _AttendanceRequestDetailScreenState ); } - Widget _buildSectionHeader(String title, double scaleFactor) { return Padding( padding: EdgeInsets.symmetric(vertical: 9 * scaleFactor), @@ -731,10 +914,7 @@ class _AttendanceRequestDetailScreenState children: [ Text( title, - style: TextStyle( - fontSize: 14, - fontFamily: "JakartaSemiBold", - ), + style: TextStyle(fontSize: 14, fontFamily: "JakartaSemiBold"), ), SizedBox(width: 10 * scaleFactor), Expanded( @@ -752,7 +932,12 @@ class _AttendanceRequestDetailScreenState } /// Proof section (image/file path) - Widget _buildProofLink(BuildContext context, String label, String? filePath, double scaleFactor) { + Widget _buildProofLink( + BuildContext context, + String label, + String? filePath, + double scaleFactor, + ) { return Padding( padding: EdgeInsets.symmetric(vertical: 6 * scaleFactor), child: Row( @@ -770,40 +955,35 @@ class _AttendanceRequestDetailScreenState ), Expanded( flex: 0, - child: filePath != null - ? InkWell( - onTap: () { - print("++++++++++++++++ImageUrel: $filePath"); - Navigator.push( - context, - MaterialPageRoute( - builder: - ( - context, - ) => Fileviewer( - fileName: - filePath ?? - "", - fileUrl: - filePath ?? - "", - ), - ), - ); - }, - child: const Text( - "View", - style: TextStyle( - fontSize: 14, - color: Colors.blue, - fontStyle: FontStyle.normal, - fontFamily: "Plus Jakarta Sans", - fontWeight: FontWeight.w400, - decoration: TextDecoration.underline - ), - ), - ) - : const Text("-"), + child: + filePath != null + ? InkWell( + onTap: () { + print("++++++++++++++++ImageUrel: $filePath"); + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Fileviewer( + fileName: filePath ?? "", + fileUrl: filePath ?? "", + ), + ), + ); + }, + child: const Text( + "View", + style: TextStyle( + fontSize: 14, + color: Colors.blue, + fontStyle: FontStyle.normal, + fontFamily: "Plus Jakarta Sans", + fontWeight: FontWeight.w400, + decoration: TextDecoration.underline, + ), + ), + ) + : const Text("-"), ), ], ), @@ -851,4 +1031,4 @@ class _AttendanceRequestDetailScreenState } return color; } -} \ No newline at end of file +} diff --git a/lib/screens/hrm/Attendancelist.dart b/lib/screens/hrm/Attendancelist.dart index f77555e..e328014 100644 --- a/lib/screens/hrm/Attendancelist.dart +++ b/lib/screens/hrm/Attendancelist.dart @@ -18,7 +18,7 @@ import 'AddLiveAttendance.dart'; class AttendanceListScreen extends StatefulWidget { final mode; - const AttendanceListScreen({super.key,required this.mode}); + const AttendanceListScreen({super.key, required this.mode}); @override State createState() => _AttendanceListScreenState(); @@ -36,416 +36,513 @@ class _AttendanceListScreenState extends State { @override Widget build(BuildContext context) { - String _truncate(String text, int maxLength) { + String truncate(String text, int maxLength) { if (text.length <= maxLength) return text; - return text.substring(0, maxLength).trim() + '...'; + return '${text.substring(0, maxLength).trim()}...'; } return SafeArea( top: false, - child: ChangeNotifierProvider( - create: (_) { - final provider = Attendancelistprovider(); - Future.microtask(() { - provider.fetchAttendanceRequests(context, widget.mode); - }); - return provider; - }, - builder: (context, child) { - return Consumer( - builder: (context, provider, child) { - final requestProvider = Provider.of(context, listen: false); - return Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - backgroundColor: Colors.white, - title: Row( - children: [ - InkResponse( - onTap: () => Navigator.pop(context, true), - child: SvgPicture.asset( - "assets/svg/appbar_back_button.svg", - height: 25, + child: ChangeNotifierProvider( + create: (_) { + final provider = Attendancelistprovider(); + Future.microtask(() { + provider.fetchAttendanceRequests(context, widget.mode); + }); + return provider; + }, + builder: (context, child) { + return Consumer( + builder: (context, provider, child) { + final requestProvider = Provider.of( + context, + listen: false, + ); + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + backgroundColor: Colors.white, + title: Row( + children: [ + InkResponse( + onTap: () => Navigator.pop(context, true), + child: SvgPicture.asset( + "assets/svg/appbar_back_button.svg", + height: 25, + ), ), - ), - const SizedBox(width: 10), - Text( - "Attendance List", - style: TextStyle( - fontSize: 18, - fontFamily: "Plus Jakarta Sans", - fontWeight: FontWeight.w600, - color: AppColors.semi_black, + const SizedBox(width: 10), + Text( + "Attendance List", + style: TextStyle( + fontSize: 18, + fontFamily: "Plus Jakarta Sans", + fontWeight: FontWeight.w600, + color: AppColors.semi_black, + ), ), - ), - ], - ), - actions: [ - InkResponse( - onTap: () async { - final result = await CommonFilter2().showFilterBottomSheet(context); - - if (result != null) { - final provider = Provider.of(context, listen: false); - - provider.updateFiltersFromSheet( - widget.mode, - context, - type: result['type'] ?? "All", - selectedValue: result['selectedValue'] ?? "This Month", - customRange: result['dateRange'], - ); - } - }, - child: SvgPicture.asset( - "assets/svg/filter_ic.svg", - height: 25, - ), + ], ), - const SizedBox(width: 20), - ], - + actions: [ + InkResponse( + onTap: () async { + final result = await CommonFilter2() + .showFilterBottomSheet(context); - ), - backgroundColor: const Color(0xFFF6F6F8), - body: Column( - children: [ - /// Filter chips - show active filters - // if (provider.selectedType != "All" || provider.selectedDateRange != "This Month") - // Container( - // padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), - // color: Colors.white, - // child: Wrap( - // spacing: 8, - // children: [ - // if (provider.selectedType != "All") - // Chip( - // label: Text('Type: ${provider.selectedType}'), - // onDeleted: () { - // provider.setTypeFilter(context, "All"); - // }, - // ), - // if (provider.selectedDateRange != "This Month") - // Chip( - // label: Text('Date: ${provider.selectedDateRange}'), - // onDeleted: () { - // provider.setDateRangeFilter(context, "This Month"); - // }, - // ), - // ], - // ), - // ), + if (result != null) { + final provider = Provider.of( + context, + listen: false, + ); - /// Attendance list - Expanded( - child: Builder( - builder: (context) { - if (provider.isLoading) { - return const Center(child: CircularProgressIndicator(color: Colors.blue)); - } - // if (provider.errorMessage != null) { - // return Center(child: Text(provider.errorMessage!)); - // } - if (provider.response?.requestList == null || - provider.response!.requestList!.isEmpty) { - return const Center( - child: Text( - "No attendance records found", - style: TextStyle(fontSize: 16, color: Colors.grey), - ), + provider.updateFiltersFromSheet( + widget.mode, + context, + type: result['type'] ?? "All", + selectedValue: + result['selectedValue'] ?? "This Month", + customRange: result['dateRange'], ); } - - final list = provider.response!.requestList!; - return ListView.builder( - padding: const EdgeInsets.all(8), - itemCount: list.length, - itemBuilder: (context, index) { - final item = list[index]; - - final canSwipe = widget.mode == "apr_lvl1" && - item.status != "Level 1 Approved" && - item.status != "Rejected"; - - final homeProvider = Provider.of(context, listen: false); - return Slidable( - key: ValueKey(item.id), - - // Left swipe (Reject) - startActionPane: canSwipe - ? ActionPane( - motion: const ScrollMotion(), - dragDismissible: false, - children: [ - - - SlidableAction( - onPressed: (_) { - showRemarkSheet( - context: context, - actionType: "Reject", - onSubmit: (remark) async { - await provider.rejectApproveAttendanceRequest( - session: homeProvider.session, - empId: homeProvider.empId, - mode: widget.mode, - type: "Rejected", - remarks: remark, - id: item.id ?? "0", - ); - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text("Attendance request rejected successfully.")), - ); - // refresh list - provider.fetchAttendanceRequests(context, widget.mode); - }, - ).then((_) { - provider.fetchAttendanceRequests(context, widget.mode); // or setState(() {}) if needed - }); - }, - backgroundColor: const Color(0xFFFFE5E5), - foregroundColor: const Color(0xFFEF3739), - icon: Icons.clear, - label: 'Reject', - ), - - - ], - ) - : null, - - // Right swipe (Approve) - endActionPane: canSwipe - ? ActionPane( - motion: const ScrollMotion(), - dragDismissible: false, - children: [ - SlidableAction( - onPressed: (context) { - showRemarkSheet( - context: context, - actionType: "Approve", - onSubmit: (remark) async { - await provider.rejectApproveAttendanceRequest( - session: homeProvider.session, - empId: homeProvider.empId, - mode: widget.mode, - type: "Approved", - remarks: remark, - id: item.id ?? "0", - ); - }, - ).then((_) { - provider.fetchAttendanceRequests(context, widget.mode); - }); - print("######################################"); - }, - backgroundColor: const Color(0xFFE9FFE8), - foregroundColor: const Color(0xFF4CB443), - icon: Icons.check, - label: 'Approve', - ), - ], - ) - : null, - - child: InkWell( - borderRadius: BorderRadius.circular(16), - onTap: () { - Navigator.push( + }, + child: SvgPicture.asset( + "assets/svg/filter_ic.svg", + height: 25, + ), + ), + const SizedBox(width: 20), + ], + ), + backgroundColor: const Color(0xFFF6F6F8), + body: Column( + children: [ + /// Filter chips - show active filters + // if (provider.selectedType != "All" || provider.selectedDateRange != "This Month") + // Container( + // padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + // color: Colors.white, + // child: Wrap( + // spacing: 8, + // children: [ + // if (provider.selectedType != "All") + // Chip( + // label: Text('Type: ${provider.selectedType}'), + // onDeleted: () { + // provider.setTypeFilter(context, "All"); + // }, + // ), + // if (provider.selectedDateRange != "This Month") + // Chip( + // label: Text('Date: ${provider.selectedDateRange}'), + // onDeleted: () { + // provider.setDateRangeFilter(context, "This Month"); + // }, + // ), + // ], + // ), + // ), + + /// Attendance list + Expanded( + child: Builder( + builder: (context) { + if (provider.isLoading) { + return const Center( + child: CircularProgressIndicator( + color: Colors.blue, + ), + ); + } + // if (provider.errorMessage != null) { + // return Center(child: Text(provider.errorMessage!)); + // } + if (provider.response?.requestList == null || + provider.response!.requestList!.isEmpty) { + return const Center( + child: Text( + "No attendance records found", + style: TextStyle( + fontSize: 16, + color: Colors.grey, + ), + ), + ); + } + + final list = provider.response!.requestList!; + return ListView.builder( + padding: const EdgeInsets.all(8), + itemCount: list.length, + itemBuilder: (context, index) { + final item = list[index]; + + final canSwipe = + widget.mode == "apr_lvl1" && + item.status != "Level 1 Approved" && + item.status != "Rejected"; + + final homeProvider = + Provider.of( context, - MaterialPageRoute( - builder: (context) => AttendanceRequestDetailScreen( - attendanceListId: item.id, - mode: widget.mode, - ), - ), + listen: false, ); - }, - child: Container( - margin: const EdgeInsets.symmetric(horizontal: 8.5, vertical: 5), - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8.5), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Row( - children: [ - /// Left Avatar Circle - Container( - height: 48, - width: 50, - padding: const EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: _getAvatarColor(item.status), - shape: BoxShape.circle, - ), - child: Center( - child: Text( - getText(item.status), - style: TextStyle( - color: _getTextColor(item.status), - fontSize: 14, - fontWeight: FontWeight.bold, + return Slidable( + key: ValueKey(item.id), + + // Left swipe (Reject) + startActionPane: + canSwipe + ? ActionPane( + motion: const ScrollMotion(), + dragDismissible: false, + children: [ + SlidableAction( + onPressed: (_) { + showRemarkSheet( + context: context, + actionType: "Reject", + onSubmit: (remark) async { + await provider + .rejectApproveAttendanceRequest( + session: + homeProvider + .session, + empId: + homeProvider + .empId, + mode: widget.mode, + type: "Rejected", + remarks: remark, + id: item.id ?? "0", + ); + ScaffoldMessenger.of( + context, + ).showSnackBar( + const SnackBar( + content: Text( + "Attendance request rejected successfully.", + ), + ), + ); + // refresh list + provider + .fetchAttendanceRequests( + context, + widget.mode, + ); + }, + ).then((_) { + provider.fetchAttendanceRequests( + context, + widget.mode, + ); // or setState(() {}) if needed + }); + }, + backgroundColor: const Color( + 0xFFFFE5E5, + ), + foregroundColor: const Color( + 0xFFEF3739, + ), + icon: Icons.clear, + label: 'Reject', ), - ), - ), - ), - const SizedBox(width: 10), - - /// Middle Section - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + ], + ) + : null, + + // Right swipe (Approve) + endActionPane: + canSwipe + ? ActionPane( + motion: const ScrollMotion(), + dragDismissible: false, children: [ - Text( - widget.mode == "apr_lvl1" - ? _truncate(item.employeeName ?? "-", 20) - : item.type ?? "-", - maxLines: 1, - overflow: TextOverflow.ellipsis, + SlidableAction( + onPressed: (context) { + showRemarkSheet( + context: context, + actionType: "Approve", + onSubmit: (remark) async { + await provider + .rejectApproveAttendanceRequest( + session: + homeProvider + .session, + empId: + homeProvider + .empId, + mode: widget.mode, + type: "Approved", + remarks: remark, + id: item.id ?? "0", + ); + }, + ).then((_) { + provider + .fetchAttendanceRequests( + context, + widget.mode, + ); + }); + print( + "######################################", + ); + }, + backgroundColor: const Color( + 0xFFE9FFE8, + ), + foregroundColor: const Color( + 0xFF4CB443, + ), + icon: Icons.check, + label: 'Approve', + ), + ], + ) + : null, + + child: InkWell( + borderRadius: BorderRadius.circular(16), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + AttendanceRequestDetailScreen( + attendanceListId: item.id, + mode: widget.mode, + ), + ), + ); + }, + child: Container( + margin: const EdgeInsets.symmetric( + horizontal: 8.5, + vertical: 5, + ), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8.5, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Row( + children: [ + /// Left Avatar Circle + Container( + height: 48, + width: 50, + padding: const EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: _getAvatarColor(item.status), + shape: BoxShape.circle, + ), + child: Center( + child: Text( + getText(item.status), style: TextStyle( - fontFamily: "JakartaRegular", + color: _getTextColor( + item.status, + ), fontSize: 14, - color: AppColors.semi_black, + fontWeight: FontWeight.bold, ), ), - Row( - children: [ - Text( - widget.mode == "apr_lvl1" - ? item.type ?? "-" - : item.type ?? "-", - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.grey_semi, - ), + ), + ), + const SizedBox(width: 10), + + /// Middle Section + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + widget.mode == "apr_lvl1" + ? truncate( + item.employeeName ?? "-", + 20, + ) + : item.type ?? "-", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, ), - const SizedBox(width: 2), - Text( - " - ${item.date}" ?? "-", - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.grey_semi, + ), + Row( + children: [ + Text( + widget.mode == "apr_lvl1" + ? item.type ?? "-" + : item.type ?? "-", + style: TextStyle( + fontFamily: + "JakartaRegular", + fontSize: 14, + color: + AppColors.grey_semi, + ), ), - ), - ], - ), - ], + const SizedBox(width: 2), + Text( + " - ${item.date}" ?? "-", + style: TextStyle( + fontFamily: + "JakartaRegular", + fontSize: 14, + color: + AppColors.grey_semi, + ), + ), + ], + ), + ], + ), ), - ), - /// Right Status (Live / Manual) + /// Right Status (Live / Manual) + Text( + item.attendanceType ?? "-", + textAlign: TextAlign.right, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: + (item.attendanceType ?? "") + .toLowerCase() == + "live" + ? Colors.green + : Colors.orange, + ), + ), + ], + ), + ), + ), + ); + }, + ); + }, + ), + ), + ], + ), + bottomNavigationBar: + widget.mode == "apr_lvl1" + ? null + : Container( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), + alignment: Alignment.bottomCenter, + height: 61, + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [Color(0xffFFFFFF), Color(0x00FFFFFF)], + ), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + child: InkResponse( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + AddLiveAttendanceScreen(), + settings: const RouteSettings( + name: 'AddLiveAttendanceScreen', + ), + ), + ).then((_) { + provider.fetchAttendanceRequests( + context, + widget.mode, + ); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/svg/hrm/live.svg", + ), + const SizedBox(width: 10), Text( - item.attendanceType ?? "-", - textAlign: TextAlign.right, + "Live Request", style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: (item.attendanceType ?? "").toLowerCase() == "live" - ? Colors.green - : Colors.orange, + color: AppColors.semi_black, ), ), ], ), ), ), - ); - }, - ); - - }, - ), - ) - ], - ), - bottomNavigationBar: widget.mode == "apr_lvl1" - ? null - : Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), - alignment: Alignment.bottomCenter, - height: 61, - decoration: const BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - Color(0xffFFFFFF), - Color(0x00FFFFFF), - ], - ), - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: InkResponse( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddLiveAttendanceScreen(), - settings: const RouteSettings( - name: 'AddLiveAttendanceScreen', + const SizedBox(width: 10), + SvgPicture.asset( + "assets/svg/crm/vertical_line_ic.svg", ), - ), - ).then((_) { - provider.fetchAttendanceRequests(context, widget.mode); - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/svg/hrm/live.svg"), - const SizedBox(width: 10), - Text("Live Request", - style: TextStyle(color: AppColors.semi_black)), - ], - ), - ), - ), - const SizedBox(width: 10), - SvgPicture.asset("assets/svg/crm/vertical_line_ic.svg"), - const SizedBox(width: 10), - Expanded( - child: InkResponse( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AddManualAttendanceScreen(), - settings: const RouteSettings( - name: 'AddManualAttendanceScreen'), - ), - ).then((_) { - provider.fetchAttendanceRequests(context, widget.mode); - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/svg/hrm/manual.svg"), - const SizedBox(width: 10), - Text("Manual Request", - style: TextStyle(color: AppColors.semi_black)), - ], + const SizedBox(width: 10), + Expanded( + child: InkResponse( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + const AddManualAttendanceScreen(), + settings: const RouteSettings( + name: 'AddManualAttendanceScreen', + ), + ), + ).then((_) { + provider.fetchAttendanceRequests( + context, + widget.mode, + ); + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/svg/hrm/manual.svg", + ), + const SizedBox(width: 10), + Text( + "Manual Request", + style: TextStyle( + color: AppColors.semi_black, + ), + ), + ], + ), + ), + ), + ], + ), ), - ), - ), - ], - ), - ), - - ); - - }, - ); - }, - ) + ); + }, + ); + }, + ), ); } @@ -474,7 +571,9 @@ class _AttendanceListScreenState extends State { bool validateFields() { String? newRemarkError = - remarkController.text.trim().isEmpty ? "Remark required" : null; + remarkController.text.trim().isEmpty + ? "Remark required" + : null; if (remarkError != newRemarkError) { updateState(() { @@ -484,23 +583,27 @@ class _AttendanceListScreenState extends State { return newRemarkError == null; } - Widget errorText(String? msg) => msg == null - ? const SizedBox() - : Padding( - padding: const EdgeInsets.only(top: 4, left: 4), - child: Text( - msg, - style: const TextStyle( - color: Colors.red, - fontSize: 12, - fontFamily: "JakartaMedium", - ), - ), - ); + Widget errorText(String? msg) => + msg == null + ? const SizedBox() + : Padding( + padding: const EdgeInsets.only(top: 4, left: 4), + child: Text( + msg, + style: const TextStyle( + color: Colors.red, + fontSize: 12, + fontFamily: "JakartaMedium", + ), + ), + ); return SafeArea( child: Container( - margin: const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + margin: const EdgeInsets.symmetric( + horizontal: 15, + vertical: 10, + ), padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom, ), @@ -546,11 +649,15 @@ class _AttendanceListScreenState extends State { decoration: InputDecoration( hintText: "Enter your remark here...", hintStyle: TextStyle( - color: Colors.grey.shade500, // Customize this color + color: + Colors.grey.shade500, // Customize this color fontSize: 14, // Optional: tweak font size ), border: InputBorder.none, - contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12), + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 12, + ), ), ), ), @@ -593,7 +700,9 @@ class _AttendanceListScreenState extends State { Navigator.pop(context); ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text("Request submitted successfully"), + content: Text( + "Request submitted successfully", + ), backgroundColor: Colors.green, behavior: SnackBarBehavior.floating, ), @@ -617,7 +726,6 @@ class _AttendanceListScreenState extends State { ), ), ), - ), ], ), @@ -632,8 +740,6 @@ class _AttendanceListScreenState extends State { ); } - - /// Avatar color generator Color _getAvatarColor(value) { var color = AppColors.approved_bg_color; @@ -693,4 +799,4 @@ class _AttendanceListScreenState extends State { return "Requested"; } } -} \ No newline at end of file +} diff --git a/lib/screens/hrm/HrmDashboardScreen.dart b/lib/screens/hrm/HrmDashboardScreen.dart index 1d58e09..a4ddec2 100644 --- a/lib/screens/hrm/HrmDashboardScreen.dart +++ b/lib/screens/hrm/HrmDashboardScreen.dart @@ -3,11 +3,9 @@ import 'package:flutter_svg/svg.dart'; import 'package:generp/screens/hrm/Attendancelist.dart'; import 'package:provider/provider.dart'; import '../../Utils/app_colors.dart'; -import 'AttendanceRequestDetail.dart'; import 'LeaveApplicationScreen.dart'; import 'TourExpensesListScreen.dart'; import 'RewardListScreen.dart'; -import 'OrganizationStructureScreen.dart'; import '../../Notifiers/hrmProvider/hrmAccessiblePagesProvider.dart'; import 'oggchart.dart'; @@ -31,9 +29,12 @@ class _HrmdashboardScreenState extends State { @override void initState() { super.initState(); - Future.microtask(() => - Provider.of(context, listen: false) - .fetchAccessiblePages(context)); + Future.microtask( + () => Provider.of( + context, + listen: false, + ).fetchAccessiblePages(context), + ); } @override @@ -104,7 +105,7 @@ class _HrmdashboardScreenState extends State { fit: BoxFit.fitWidth, ), ), - + /// Content Column( children: [ @@ -122,10 +123,14 @@ class _HrmdashboardScreenState extends State { const SizedBox(height: 32), Container( padding: const EdgeInsets.symmetric( - horizontal: 20, vertical: 8), + horizontal: 20, + vertical: 8, + ), decoration: BoxDecoration( border: Border.all( - color: const Color(0xFF1487C9), // border color + color: const Color( + 0xFF1487C9, + ), // border color width: 1.2, // thickness of the border ), color: const Color(0xffEDF8FF), @@ -152,9 +157,17 @@ class _HrmdashboardScreenState extends State { const SizedBox(width: 7), const Text( "Organization Structure", - style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500, fontStyle: FontStyle.normal, fontFamily: "Plus Jakarta Sans"), + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.w500, + fontStyle: FontStyle.normal, + fontFamily: "Plus Jakarta Sans", + ), + ), + const Icon( + Icons.chevron_right, + color: Colors.black54, ), - const Icon(Icons.chevron_right, color: Colors.black54), ], ), ), @@ -162,51 +175,67 @@ class _HrmdashboardScreenState extends State { ], ), ), - + /// Grid Section LayoutBuilder( builder: (context, constraints) { return Padding( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10), + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 10, + ), child: Consumer( builder: (context, provider, child) { if (provider.isLoading) { return const Center( - child: CircularProgressIndicator()); + child: CircularProgressIndicator(), + ); } if (provider.errorMessage != null) { return Center( - child: Text(provider.errorMessage!)); + child: Text(provider.errorMessage!), + ); } - - final pages = (provider.response?.pagesAccessible ?? []) - .where((page) => - allowedPages.contains(page.pageName)) - .toList(); - + + final pages = + (provider.response?.pagesAccessible ?? []) + .where( + (page) => allowedPages.contains( + page.pageName, + ), + ) + .toList(); + return GridView.builder( itemCount: pages.length, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: (constraints.maxWidth / 180).floor().clamp(2, 4), - crossAxisSpacing: 1, - mainAxisSpacing: 2, - childAspectRatio: 1.8, - ), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: (constraints.maxWidth / + 180) + .floor() + .clamp(2, 4), + crossAxisSpacing: 1, + mainAxisSpacing: 2, + childAspectRatio: 1.8, + ), itemBuilder: (context, index) { final page = pages[index]; - + return _buildTile( label: page.pageName ?? "", - subtitle: _getSubtitle(page.pageName ?? ""), - assetIcon: _getIcon(page.pageName ?? ""), - txtColor: const Color(0xff1487C9), - onTap: () => _handleNavigation( - context, + subtitle: _getSubtitle( page.pageName ?? "", - page.mode ?? "", ), + assetIcon: _getIcon(page.pageName ?? ""), + txtColor: const Color(0xff1487C9), + onTap: + () => _handleNavigation( + context, + page.pageName ?? "", + page.mode ?? "", + ), ); }, ); @@ -283,7 +312,6 @@ class _HrmdashboardScreenState extends State { ), ), ], - ), ), Expanded( @@ -311,6 +339,7 @@ class _HrmdashboardScreenState extends State { }, ); } + /// Mapping subtitles String _getSubtitle(String pageName) { switch (pageName) { @@ -352,11 +381,7 @@ class _HrmdashboardScreenState extends State { } /// Navigation mapping - void _handleNavigation( - BuildContext context, - String pageName, - String mode, - ) { + void _handleNavigation(BuildContext context, String pageName, String mode) { switch (pageName) { case "Attendance Request List": Navigator.push( @@ -371,9 +396,7 @@ class _HrmdashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => LeaveApplicationListScreen( - mode: mode, - ), + builder: (context) => LeaveApplicationListScreen(mode: mode), ), ); break; @@ -381,18 +404,14 @@ class _HrmdashboardScreenState extends State { case "Rewards List": Navigator.push( context, - MaterialPageRoute( - builder: (context) => RewardListScreen(), - ), + MaterialPageRoute(builder: (context) => RewardListScreen()), ); break; case "Tour Bill List": Navigator.push( context, - MaterialPageRoute( - builder: (context) => TourExpensesListScreen(), - ), + MaterialPageRoute(builder: (context) => TourExpensesListScreen()), ); break; @@ -400,9 +419,7 @@ class _HrmdashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => LeaveApplicationListScreen( - mode: mode, - ), + builder: (context) => LeaveApplicationListScreen(mode: mode), ), ); break; @@ -417,5 +434,4 @@ class _HrmdashboardScreenState extends State { break; } } - } diff --git a/lib/screens/hrm/LeaveApplicationScreen.dart b/lib/screens/hrm/LeaveApplicationScreen.dart index 9ccfbc3..e85a7f3 100644 --- a/lib/screens/hrm/LeaveApplicationScreen.dart +++ b/lib/screens/hrm/LeaveApplicationScreen.dart @@ -15,10 +15,12 @@ class LeaveApplicationListScreen extends StatefulWidget { const LeaveApplicationListScreen({super.key, required this.mode}); @override - State createState() => _LeaveApplicationListScreenState(); + State createState() => + _LeaveApplicationListScreenState(); } -class _LeaveApplicationListScreenState extends State { +class _LeaveApplicationListScreenState + extends State { // @override // void initState() { // super.initState(); @@ -28,7 +30,6 @@ class _LeaveApplicationListScreenState extends State // }); // } - @override Widget build(BuildContext context) { return SafeArea( @@ -45,37 +46,44 @@ class _LeaveApplicationListScreenState extends State return Consumer( builder: (context, provider, child) { return Scaffold( - appBar: appbar2New( - context, - "Leave Application List", - provider.resetForm, - Row( - children: [ - InkResponse( - onTap: () async { - var cf = Commondaterangefilter(); - var result = await cf.showFilterBottomSheet(context); - if (result != null) { - var dateRange = result['dateRange'] as DateTimeRange?; - var formatted = result['formatted'] as List; - if (formatted.isNotEmpty) { - provider.setDateRangeFilter("Custom", customRange: dateRange); - provider.fetchLeaveApplications( - context, - widget.mode, - dateRange: "Custom", - customRange: dateRange, - ); - } + appBar: appbar2New( + context, + "Leave Application List", + provider.resetForm, + Row( + children: [ + InkResponse( + onTap: () async { + var cf = Commondaterangefilter(); + var result = await cf.showFilterBottomSheet(context); + if (result != null) { + var dateRange = + result['dateRange'] as DateTimeRange?; + var formatted = result['formatted'] as List; + if (formatted.isNotEmpty) { + provider.setDateRangeFilter( + "Custom", + customRange: dateRange, + ); + provider.fetchLeaveApplications( + context, + widget.mode, + dateRange: "Custom", + customRange: dateRange, + ); } - }, - child: SvgPicture.asset("assets/svg/filter_ic.svg", height: 25), + } + }, + child: SvgPicture.asset( + "assets/svg/filter_ic.svg", + height: 25, ), - ], - ), - 0xFFFFFFFF, + ), + ], ), - backgroundColor: const Color(0xFFF6F6F8), + 0xFFFFFFFF, + ), + backgroundColor: const Color(0xFFF6F6F8), body: Column( children: [ /// Filter chips (if you want visible filter indicators) @@ -110,29 +118,46 @@ class _LeaveApplicationListScreenState extends State child: Builder( builder: (context) { if (provider.isLoading) { - return const Center(child: CircularProgressIndicator(color: Colors.blue)); + return const Center( + child: CircularProgressIndicator( + color: Colors.blue, + ), + ); } if (provider.errorMessage != null) { return Center(child: Text(provider.errorMessage!)); } if (provider.response?.requestList == null || provider.response!.requestList!.isEmpty) { - return const Center(child: Text("No leave applications found")); + return const Center( + child: Text("No leave applications found"), + ); } final list = provider.response!.requestList!; return ListView.builder( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10), + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 10, + ), itemCount: list.length, itemBuilder: (context, index) { final item = list[index]; // Parse the full string into a DateTime object - DateTime parsedFromDate = DateFormat("dd MMM yyyy, hh:mm a").parse(item.fromPeriod.toString()); - String dateFromMonth = DateFormat("dd MMM").format(parsedFromDate); + DateTime parsedFromDate = DateFormat( + "dd MMM yyyy, hh:mm a", + ).parse(item.fromPeriod.toString()); + String dateFromMonth = DateFormat( + "dd MMM", + ).format(parsedFromDate); // Parse the full string into a DateTime object - DateTime parsedToDate = DateFormat("dd MMM yyyy, hh:mm a").parse(item.toPeriod.toString()); + DateTime parsedToDate = DateFormat( + "dd MMM yyyy, hh:mm a", + ).parse(item.toPeriod.toString()); - String dateToMonth = DateFormat("dd MMM yyyy").format(parsedToDate); + String dateToMonth = DateFormat( + "dd MMM yyyy", + ).format(parsedToDate); return InkWell( borderRadius: BorderRadius.circular(16), @@ -140,21 +165,35 @@ class _LeaveApplicationListScreenState extends State Navigator.push( context, MaterialPageRoute( - builder: (context) => LeaveApplicationDetailScreen( - leaveRequestId: item.id.toString(), - mode: widget.mode, - ), + builder: + (context) => + LeaveApplicationDetailScreen( + leaveRequestId: + item.id.toString(), + mode: widget.mode, + ), ), ).then((_) { - provider.fetchLeaveApplications(context,widget.mode); + provider.fetchLeaveApplications( + context, + widget.mode, + ); }); }, child: Container( - margin: const EdgeInsets.symmetric(horizontal: 8.5, vertical: 5), - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12), + margin: const EdgeInsets.symmetric( + horizontal: 8.5, + vertical: 5, + ), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 12, + ), decoration: BoxDecoration( - color: Colors.white,//Color(int.parse(item.rowColor!.replaceFirst('#', '0xff'))), + color: + Colors + .white, //Color(int.parse(item.rowColor!.replaceFirst('#', '0xff'))), borderRadius: BorderRadius.circular(16), ), child: Row( @@ -165,14 +204,18 @@ class _LeaveApplicationListScreenState extends State width: 48, padding: const EdgeInsets.all(8.0), decoration: BoxDecoration( - color: _getStatusBackgroundColor(item.status), + color: _getStatusBackgroundColor( + item.status, + ), shape: BoxShape.circle, ), child: Center( child: Text( _getStatusInitials(item.status), style: TextStyle( - color: _getStatusTextColor(item.status), + color: _getStatusTextColor( + item.status, + ), fontSize: 14, fontWeight: FontWeight.bold, ), @@ -184,12 +227,13 @@ class _LeaveApplicationListScreenState extends State /// Middle Section - Leave Details Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( widget.mode == "teamleader" - ? item.employeeName ?? "-" - : item.leaveType ?? "-", + ? item.employeeName ?? "-" + : item.leaveType ?? "-", maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -204,15 +248,17 @@ class _LeaveApplicationListScreenState extends State Text( dateFromMonth ?? "-", style: TextStyle( - fontFamily: "JakartaRegular", + fontFamily: + "JakartaRegular", fontSize: 14, color: AppColors.grey_semi, ), ), Text( - " - ${dateToMonth}" ?? "-", + " - $dateToMonth" ?? "-", style: TextStyle( - fontFamily: "JakartaRegular", + fontFamily: + "JakartaRegular", fontSize: 14, color: AppColors.grey_semi, ), @@ -235,10 +281,15 @@ class _LeaveApplicationListScreenState extends State /// Right Status if (widget.mode == "teamleader") Container( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 4, + ), decoration: BoxDecoration( color: Color(0x00FFFFFF), - borderRadius: BorderRadius.circular(10), + borderRadius: BorderRadius.circular( + 10, + ), ), child: Text( item.leaveType ?? "-", @@ -258,52 +309,67 @@ class _LeaveApplicationListScreenState extends State }, ), ), - SizedBox(height: 28,) + SizedBox(height: 28), ], ), - bottomNavigationBar: widget.mode == "teamleader" - ? null - : Container( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), - color: Colors.white, - child: InkResponse( - onTap: () { - HapticFeedback.selectionClick(); - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => ChangeNotifierProvider( - create: (_) => LeaveApplicationListProvider(), - child: AddLeaveRequest(pageTitleName: "Add Leave Request"), + bottomNavigationBar: + widget.mode == "teamleader" + ? null + : Container( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - ), - ).then((_) { - provider.fetchLeaveApplications(context, widget.mode); - }); - - // show add bill screen here - }, - child: Container( - height: 45, - alignment: Alignment.center, - margin: EdgeInsets.symmetric(horizontal: 14), - padding: EdgeInsets.symmetric(horizontal: 6, vertical: 5), - decoration: BoxDecoration( - color: AppColors.app_blue, - borderRadius: BorderRadius.circular(15), - ), - child: Text( - "Add Leave Request", - style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", color: Colors.white, + child: InkResponse( + onTap: () { + HapticFeedback.selectionClick(); + Navigator.push( + context, + MaterialPageRoute( + builder: + (_) => ChangeNotifierProvider( + create: + (_) => + LeaveApplicationListProvider(), + child: AddLeaveRequest( + pageTitleName: "Add Leave Request", + ), + ), + ), + ).then((_) { + provider.fetchLeaveApplications( + context, + widget.mode, + ); + }); + + // show add bill screen here + }, + child: Container( + height: 45, + alignment: Alignment.center, + margin: EdgeInsets.symmetric(horizontal: 14), + padding: EdgeInsets.symmetric( + horizontal: 6, + vertical: 5, + ), + decoration: BoxDecoration( + color: AppColors.app_blue, + borderRadius: BorderRadius.circular(15), + ), + child: Text( + "Add Leave Request", + style: TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + color: Colors.white, + ), + ), + ), + ), ), - ), - ), - ), - ), ); }, ); @@ -312,11 +378,6 @@ class _LeaveApplicationListScreenState extends State ); } - - - - - /// Get status background color Color _getStatusBackgroundColor(String? status) { switch (status?.toLowerCase()) { @@ -330,7 +391,6 @@ class _LeaveApplicationListScreenState extends State } } - /// Get status text color Color _getStatusTextColor(String? status) { switch (status?.toLowerCase()) { @@ -356,4 +416,4 @@ class _LeaveApplicationListScreenState extends State return "P"; // Pending } } -} \ No newline at end of file +} diff --git a/lib/screens/hrm/OrganizationStructureScreen.dart b/lib/screens/hrm/OrganizationStructureScreen.dart index a2eb4dc..4a56c97 100644 --- a/lib/screens/hrm/OrganizationStructureScreen.dart +++ b/lib/screens/hrm/OrganizationStructureScreen.dart @@ -5,8 +5,8 @@ class OrganizationStructureScreen extends StatelessWidget { Department( name: "Engineering", teams: [ - Team(name: "Mobile Team", members: ["Mohit", "Srinivas", ]), - Team(name: "Backend Team", members: ["Dheeraj", "Satya","Sneha"]), + Team(name: "Mobile Team", members: ["Mohit", "Srinivas"]), + Team(name: "Backend Team", members: ["Dheeraj", "Satya", "Sneha"]), ], ), Department( @@ -25,6 +25,8 @@ class OrganizationStructureScreen extends StatelessWidget { ), ]; + const OrganizationStructureScreen({super.key}); + @override Widget build(BuildContext context) { return Scaffold( @@ -40,34 +42,45 @@ class OrganizationStructureScreen extends StatelessWidget { child: ExpansionTile( title: Text( "${dept.name} not ready", - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), ), - children: dept.teams.map((team) { - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - team.name, - style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600), - ), - const SizedBox(height: 4), - Wrap( - spacing: 8, - children: team.members.map((member) { - return Chip( - label: Text(member), - backgroundColor: Colors.blue.shade50, - ); - }).toList(), + children: + dept.teams.map((team) { + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + team.name, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 4), + Wrap( + spacing: 8, + children: + team.members.map((member) { + return Chip( + label: Text(member), + backgroundColor: Colors.blue.shade50, + ); + }).toList(), + ), - const SizedBox(height: 8), - ], - ), - ); - }).toList(), + const SizedBox(height: 8), + ], + ), + ); + }).toList(), ), ); }, diff --git a/lib/screens/hrm/RewardListScreen.dart b/lib/screens/hrm/RewardListScreen.dart index 77ea0ec..cd569fd 100644 --- a/lib/screens/hrm/RewardListScreen.dart +++ b/lib/screens/hrm/RewardListScreen.dart @@ -8,7 +8,7 @@ import '../../Notifiers/hrmProvider/rewardListProvider.dart'; import '../../Utils/app_colors.dart'; class RewardListScreen extends StatefulWidget { - const RewardListScreen({Key? key}) : super(key: key); + const RewardListScreen({super.key}); @override State createState() => _RewardListScreenState(); @@ -20,287 +20,294 @@ class _RewardListScreenState extends State { return SafeArea( top: false, child: ChangeNotifierProvider( - create: (_) => - RewardListProvider()..fetchRewardList(context), - child: Consumer( - builder: (context, provider, child) { - return Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - backgroundColor: Colors.white, - title: Row( - children: [ - InkResponse( - onTap: () => Navigator.pop(context, true), - child: SvgPicture.asset( - "assets/svg/appbar_back_button.svg", - height: 25, - ), - ), - const SizedBox(width: 10), - Text( - "Reward List", - style: TextStyle( - fontSize: 18, - fontFamily: "Plus Jakarta Sans", - fontWeight: FontWeight.w600, - color: AppColors.semi_black, - ), - ), - ], + create: (_) => RewardListProvider()..fetchRewardList(context), + child: Consumer( + builder: (context, provider, child) { + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + backgroundColor: Colors.white, + title: Row( + children: [ + InkResponse( + onTap: () => Navigator.pop(context, true), + child: SvgPicture.asset( + "assets/svg/appbar_back_button.svg", + height: 25, + ), ), - // actions: [ - // InkResponse( - // onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => RewardSearchScreen(), - // settings: const RouteSettings( - // name: 'AddLiveAttendanceScreen', - // ), - // ), - // ).then((_) { - // }); - // }, - // child: SvgPicture.asset( - // "assets/svg/search_ic.svg", - // height: 25, - // ), - // ), - // const SizedBox(width: 20), - // ], - ), - - backgroundColor: Color(0xFFF6F6F8), - body: Builder( - builder: (context) { - if (provider.isLoading) { - return const Center(child: CircularProgressIndicator( - color: Colors.blue,)); - } - if (provider.errorMessage != null) { - return Center(child: Text(provider.errorMessage!)); - } - if (provider.response == null) { - return const Center(child: Text("No details found")); - } - final rewardDetail = provider.response!; - final rewardResponse = provider.response!; - final rewards = rewardResponse.rewardsList; // main list object - final achieved = rewardResponse.achievedAmount ?? "0"; - final disbursed = rewardResponse.disbursedAmount ?? "0"; - final balance = rewardResponse.balanceAmount ?? "0"; - return SingleChildScrollView( - padding: const EdgeInsets.all(16), - child: Column( - children: [ + const SizedBox(width: 10), + Text( + "Reward List", + style: TextStyle( + fontSize: 18, + fontFamily: "Plus Jakarta Sans", + fontWeight: FontWeight.w600, + color: AppColors.semi_black, + ), + ), + ], + ), + // actions: [ + // InkResponse( + // onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => RewardSearchScreen(), + // settings: const RouteSettings( + // name: 'AddLiveAttendanceScreen', + // ), + // ), + // ).then((_) { + // }); + // }, + // child: SvgPicture.asset( + // "assets/svg/search_ic.svg", + // height: 25, + // ), + // ), + // const SizedBox(width: 20), + // ], + ), - /// --- Top Summary Cards --- - Stack( + backgroundColor: Color(0xFFF6F6F8), + body: Builder( + builder: (context) { + if (provider.isLoading) { + return const Center( + child: CircularProgressIndicator(color: Colors.blue), + ); + } + if (provider.errorMessage != null) { + return Center(child: Text(provider.errorMessage!)); + } + if (provider.response == null) { + return const Center(child: Text("No details found")); + } + final rewardDetail = provider.response!; + final rewardResponse = provider.response!; + final rewards = + rewardResponse.rewardsList; // main list object + final achieved = rewardResponse.achievedAmount ?? "0"; + final disbursed = rewardResponse.disbursedAmount ?? "0"; + final balance = rewardResponse.balanceAmount ?? "0"; + return SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + children: [ + /// --- Top Summary Cards --- + Stack( + children: [ + Container( + height: 110, + width: double.infinity, + padding: const EdgeInsets.all(18), + decoration: BoxDecoration( + color: const Color(0xffd9ffd6), + borderRadius: BorderRadius.circular(18), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - height: 110, - width: double.infinity, - padding: const EdgeInsets.all(18), - decoration: BoxDecoration( - color: const Color(0xffd9ffd6), - borderRadius: BorderRadius.circular(18), + Text( + "₹$achieved", // Achieved Amount from response + style: const TextStyle( + fontSize: 20, + color: Color(0xff0D9C00), + fontStyle: FontStyle.normal, + fontWeight: FontWeight.w500, + ), + ), + const SizedBox(height: 10), + const Text( + "Achievement Amount", + style: TextStyle( + fontSize: 14, + color: Color(0xff2D2D2D), + fontStyle: FontStyle.normal, + fontWeight: FontWeight.w400, ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, + ), + ], + ), + ), + + // Positioned SVG Icon + Positioned( + bottom: 8, + right: 12, + child: Container( + height: 42, + width: 42, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: const Color(0xA0FFFFFF), // icon bg + ), + child: Center( + child: SvgPicture.asset( + height: 25, + width: 25, + "assets/svg/hrm/achievement_ic.svg", + fit: BoxFit.contain, + ), + ), + ), + ), + ], + ), + const SizedBox(height: 12), + + Row( + children: [ + Expanded( + child: Container( + height: 110, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: const Color(0xffe8ddff), + borderRadius: BorderRadius.circular(16), + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Text( - "₹${achieved}", // Achieved Amount from response + "₹$disbursed", // Disbursed Amount style: const TextStyle( fontSize: 20, - color: Color(0xff0D9C00), - fontStyle: FontStyle.normal, + color: Color(0xff493272), fontWeight: FontWeight.w500, ), ), - const SizedBox(height: 10), + const SizedBox(height: 8), const Text( - "Achievement Amount", + "Disbursed \nAmount", style: TextStyle( fontSize: 14, color: Color(0xff2D2D2D), - fontStyle: FontStyle.normal, fontWeight: FontWeight.w400, ), ), ], ), - ), - - // Positioned SVG Icon - Positioned( - bottom: 8, - right: 12, - child: Container( - height: 42, - width: 42, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: const Color(0xA0FFFFFF), // icon bg - ), - child: Center( - child: SvgPicture.asset( - height: 25, - width: 25, - "assets/svg/hrm/achievement_ic.svg", - fit: BoxFit.contain, + Positioned( + bottom: 2, + right: 2, + child: Container( + height: 42, + width: 42, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: const Color( + 0xA0FFFFFF, + ), // icon bg + ), + child: Center( + child: SvgPicture.asset( + height: 25, + width: 25, + "assets/svg/hrm/location_ic.svg", + fit: BoxFit.contain, + ), ), ), ), - ), - ], + ], + ), ), - const SizedBox(height: 12), - - Row( - children: [ - Expanded( - child: Container( - height: 110, - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: const Color(0xffe8ddff), - borderRadius: BorderRadius.circular(16), - ), - child: Stack( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "₹${disbursed}", // Disbursed Amount - style: const TextStyle( - fontSize: 20, - color: Color(0xff493272), - fontWeight: FontWeight.w500, - ), - ), - const SizedBox(height: 8), - const Text( - "Disbursed \nAmount", - style: TextStyle( - fontSize: 14, - color: Color(0xff2D2D2D), - fontWeight: FontWeight.w400, - ), - ), - ], + ), + const SizedBox(width: 12), + Expanded( + child: Container( + height: 110, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: const Color(0xfffffbc3), + borderRadius: BorderRadius.circular(16), + ), + child: Stack( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + "₹$balance", // Balance Amount + style: const TextStyle( + fontSize: 18, + color: Color(0xff605C00), ), - Positioned( - bottom: 2, - right: 2, - child: Container( - height: 42, - width: 42, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: const Color(0xA0FFFFFF), // icon bg - ), - child: Center( - child: SvgPicture.asset( - height: 25, - width: 25, - "assets/svg/hrm/location_ic.svg", - fit: BoxFit.contain, - ), - ), - ), + ), + const SizedBox(height: 8), + const Text( + "Balance \nAmount", + style: TextStyle( + fontSize: 14, + color: Color(0xff2D2D2D), + fontWeight: FontWeight.w400, ), - ], - ), + ), + ], ), - ), - const SizedBox(width: 12), - Expanded( - child: Container( - height: 110, - padding: const EdgeInsets.all(16), - decoration: BoxDecoration( - color: const Color(0xfffffbc3), - borderRadius: BorderRadius.circular(16), - ), - child: Stack( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "₹${balance}", // Balance Amount - style: const TextStyle( - fontSize: 18, - color: Color(0xff605C00), - ), - ), - const SizedBox(height: 8), - const Text( - "Balance \nAmount", - style: TextStyle( - fontSize: 14, - color: Color(0xff2D2D2D), - fontWeight: FontWeight.w400, - ), - ), - ], - ), - Positioned( - bottom: 2, - right: 2, - child: Container( - height: 42, - width: 42, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: const Color(0xA0FFFFFF), // icon bg - ), - child: Center( - child: SvgPicture.asset( - height: 25, - width: 25, - "assets/svg/hrm/ballance_ic.svg", - fit: BoxFit.contain, - ), - ), - ), + Positioned( + bottom: 2, + right: 2, + child: Container( + height: 42, + width: 42, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: const Color( + 0xA0FFFFFF, + ), // icon bg + ), + child: Center( + child: SvgPicture.asset( + height: 25, + width: 25, + "assets/svg/hrm/ballance_ic.svg", + fit: BoxFit.contain, ), - ], + ), ), ), - ), - ], + ], + ), ), + ), + ], + ), - const SizedBox(height: 20), + const SizedBox(height: 20), - /// --- Reward List Card --- - if (rewards != null) - _rewardListCard( - title: rewards.description ?? "-", // rewardsList fields - dateTime: rewards.dateTime ?? "-", - achieved: achieved, - disbursed: disbursed, - balance: balance, - enteredBy: rewards.enteredBy ?? "-", - ) - else - const Text("No rewards available"), - ], - ), - ); - } - ), - ); - } - ) + /// --- Reward List Card --- + if (rewards != null) + _rewardListCard( + title: + rewards.description ?? + "-", // rewardsList fields + dateTime: rewards.dateTime ?? "-", + achieved: achieved, + disbursed: disbursed, + balance: balance, + enteredBy: rewards.enteredBy ?? "-", + ) + else + const Text("No rewards available"), + ], + ), + ); + }, + ), + ); + }, + ), ), ); - } /// Reusable Reward Card Function @@ -350,31 +357,31 @@ class _RewardListScreenState extends State { Text( title, style: const TextStyle( - fontSize: 14.5, - color: Color(0xff2D2D2D), - fontFamily: "Plus Jakarta Sans", - fontStyle: FontStyle.normal, - fontWeight: FontWeight.w400), + fontSize: 14.5, + color: Color(0xff2D2D2D), + fontFamily: "Plus Jakarta Sans", + fontStyle: FontStyle.normal, + fontWeight: FontWeight.w400, + ), ), Text( dateTime, style: const TextStyle( - fontSize: 12.5, - color: Color(0xff818181), - fontFamily: "Plus Jakarta Sans", - fontStyle: FontStyle.normal, - fontWeight: FontWeight.w400), + fontSize: 12.5, + color: Color(0xff818181), + fontFamily: "Plus Jakarta Sans", + fontStyle: FontStyle.normal, + fontWeight: FontWeight.w400, + ), ), ], ), - ), ], ), const SizedBox(height: 12), - /// Amount Details Padding( padding: const EdgeInsets.all(2.0), @@ -382,10 +389,7 @@ class _RewardListScreenState extends State { children: [ const Text( "Amount Details", - style: TextStyle( - fontSize: 14, - fontFamily: "JakartaSemiBold", - ), + style: TextStyle(fontSize: 14, fontFamily: "JakartaSemiBold"), ), const SizedBox(width: 10), Expanded( @@ -415,10 +419,7 @@ class _RewardListScreenState extends State { children: [ const Text( "Employee Details", - style: TextStyle( - fontSize: 14, - fontFamily: "JakartaSemiBold", - ), + style: TextStyle(fontSize: 14, fontFamily: "JakartaSemiBold"), ), const SizedBox(width: 10), Expanded( @@ -447,19 +448,18 @@ class _RewardListScreenState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(key, style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.semi_black, - ), + Text( + key, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, + ), ), Text( value, - style: const TextStyle( - fontSize: 14, - color: Color(0xFF818181), - ), + style: const TextStyle(fontSize: 14, color: Color(0xFF818181)), ), ], ), diff --git a/lib/screens/hrm/RewardSearchScreen.dart b/lib/screens/hrm/RewardSearchScreen.dart index 381c537..c1196a9 100644 --- a/lib/screens/hrm/RewardSearchScreen.dart +++ b/lib/screens/hrm/RewardSearchScreen.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; -import '../../Utils/app_colors.dart'; - class RewardSearchScreen extends StatefulWidget { const RewardSearchScreen({super.key}); @@ -42,11 +40,17 @@ class _RewardSearchScreenState extends State { @override Widget build(BuildContext context) { final filteredAccounts = - accounts.where((e) => e.toLowerCase().contains(query.toLowerCase())).toList(); + accounts + .where((e) => e.toLowerCase().contains(query.toLowerCase())) + .toList(); final filteredInquiries = - inquiries.where((e) => e.toLowerCase().contains(query.toLowerCase())).toList(); + inquiries + .where((e) => e.toLowerCase().contains(query.toLowerCase())) + .toList(); final filteredLeads = - leads.where((e) => e.toLowerCase().contains(query.toLowerCase())).toList(); + leads + .where((e) => e.toLowerCase().contains(query.toLowerCase())) + .toList(); return Scaffold( appBar: AppBar( @@ -94,8 +98,10 @@ class _RewardSearchScreenState extends State { prefixIcon: const Icon(Icons.search, color: Colors.black54), filled: true, fillColor: const Color(0xffFFFFFF), - contentPadding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 12, + ), border: OutlineInputBorder( borderRadius: BorderRadius.circular(12), borderSide: BorderSide.none, @@ -159,52 +165,60 @@ class _RewardSearchScreenState extends State { ), const SizedBox(height: 10), Column( - children: items - .map((e) => Container( - margin: const EdgeInsets.only(bottom: 12), - padding: const EdgeInsets.symmetric( - horizontal: 12, vertical: 12), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.1), - blurRadius: 5, - offset: const Offset(0, 3), - ) - ], - ), - child: Row( - children: [ - Container( - height: 32, - width: 32, - decoration: BoxDecoration( - color: const Color(0xffE8F3FF), - borderRadius: BorderRadius.circular(8), - ), - child: const Icon(Icons.search, - color: Color(0xff0066FF), size: 20), - ), - const SizedBox(width: 10), - Expanded( - child: Text( - e, - style: const TextStyle( - fontSize: 14, - fontFamily: "Plus Jakarta Sans", - fontWeight: FontWeight.w400, - color: Color(0xff2D2D2D), + children: + items + .map( + (e) => Container( + margin: const EdgeInsets.only(bottom: 12), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 12, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.1), + blurRadius: 5, + offset: const Offset(0, 3), + ), + ], + ), + child: Row( + children: [ + Container( + height: 32, + width: 32, + decoration: BoxDecoration( + color: const Color(0xffE8F3FF), + borderRadius: BorderRadius.circular(8), + ), + child: const Icon( + Icons.search, + color: Color(0xff0066FF), + size: 20, + ), + ), + const SizedBox(width: 10), + Expanded( + child: Text( + e, + style: const TextStyle( + fontSize: 14, + fontFamily: "Plus Jakarta Sans", + fontWeight: FontWeight.w400, + color: Color(0xff2D2D2D), + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), ), - overflow: TextOverflow.ellipsis, - ), - ), - ], - ), - )) - .toList(), - ) + ) + .toList(), + ), ], ); } diff --git a/lib/screens/hrm/TourExpensesDetailsScreen.dart b/lib/screens/hrm/TourExpensesDetailsScreen.dart index 42c46d2..e555de2 100644 --- a/lib/screens/hrm/TourExpensesDetailsScreen.dart +++ b/lib/screens/hrm/TourExpensesDetailsScreen.dart @@ -7,23 +7,25 @@ import '../../Notifiers/hrmProvider/tourExpensesDetailsProvider.dart'; import '../../Utils/app_colors.dart'; import '../finance/FileViewer.dart'; - class TourExpensesDetailsScreen extends StatefulWidget { final String tourBillId; - const TourExpensesDetailsScreen({Key? key, required this.tourBillId}) - : super(key: key); + const TourExpensesDetailsScreen({super.key, required this.tourBillId}); @override - State createState() => _TourExpensesDetailsScreenState(); + State createState() => + _TourExpensesDetailsScreenState(); } -class _TourExpensesDetailsScreenState extends State{ + +class _TourExpensesDetailsScreenState extends State { @override Widget build(BuildContext context) { return SafeArea( top: false, child: ChangeNotifierProvider( - create: (_) => TourExpensesDetailsProvider() - ..fetchTourExpensesDetails(context, widget.tourBillId), + create: + (_) => + TourExpensesDetailsProvider() + ..fetchTourExpensesDetails(context, widget.tourBillId), child: Scaffold( appBar: AppBar( automaticallyImplyLeading: false, @@ -71,8 +73,9 @@ class _TourExpensesDetailsScreenState extends State{ if (response == null) { return const Center(child: Text("No data available")); } - debugPrint("==================requestDetails: ${widget.tourBillId}"); - + debugPrint( + "==================requestDetails: ${widget.tourBillId}", + ); return SingleChildScrollView( child: Column( @@ -82,29 +85,68 @@ class _TourExpensesDetailsScreenState extends State{ _expenseHeaderCard( title: response.requestDetails?.placeOfVisit ?? "Tour", date: response.requestDetails?.appliedDate ?? "-", - status: (response.requestDetails?.approvalStatus?.isNotEmpty ?? false) - ? response.requestDetails!.approvalStatus! - : "No Status", + status: + (response + .requestDetails + ?.approvalStatus + ?.isNotEmpty ?? + false) + ? response.requestDetails!.approvalStatus! + : "No Status", details: [ - {"key": "Employee", "value": response.requestDetails!.employeeName!}, - {"key": "Approved By TL", "value": response.requestDetails!.tlApprovedBy!}, - {"key": "TL Approval Amount", "value": response.requestDetails!.tlApprovedAmount!}, - {"key": "TL Remarks", "value": response.requestDetails!.tlRemarks!}, - {"key": "Approved By HR", "value": response.requestDetails!.hrApprovedBy!}, - {"key": "HR Approval Amount", "value": response.requestDetails!.hrApprovedAmount!}, - {"key": "TL Remarks", "value": response.requestDetails!.tlRemarks!}, - {"key": "Total Approved Amount", "value": response.requestDetails?.approvedAmount ?? "-"}, - {"key": "Total Balance Amount", "value": response.requestDetails!.appliedAmount!}, - {"key": "Type", "value": response.requestDetails!.type!}, + { + "key": "Employee", + "value": response.requestDetails!.employeeName!, + }, + { + "key": "Approved By TL", + "value": response.requestDetails!.tlApprovedBy!, + }, + { + "key": "TL Approval Amount", + "value": response.requestDetails!.tlApprovedAmount!, + }, + { + "key": "TL Remarks", + "value": response.requestDetails!.tlRemarks!, + }, + { + "key": "Approved By HR", + "value": response.requestDetails!.hrApprovedBy!, + }, + { + "key": "HR Approval Amount", + "value": response.requestDetails!.hrApprovedAmount!, + }, + { + "key": "TL Remarks", + "value": response.requestDetails!.tlRemarks!, + }, + { + "key": "Total Approved Amount", + "value": + response.requestDetails?.approvedAmount ?? "-", + }, + { + "key": "Total Balance Amount", + "value": response.requestDetails!.appliedAmount!, + }, + { + "key": "Type", + "value": response.requestDetails!.type!, + }, ], ), const SizedBox(height: 16), + /// Tour Expense Card (Main Summary) - if (response.requestDetails != null && response.tourExpenses != null) ...[ + if (response.requestDetails != null && + response.tourExpenses != null) ...[ const SizedBox(height: 10), Padding( padding: const EdgeInsets.only(left: 30.0), - child: Text("Tour Summary", + child: Text( + "Tour Summary", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -119,28 +161,36 @@ class _TourExpensesDetailsScreenState extends State{ child: ListView( scrollDirection: Axis.horizontal, padding: EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * 0.05, + horizontal: + MediaQuery.of(context).size.width * 0.05, ), children: [ SizedBox( width: MediaQuery.of(context).size.width * 0.90, child: _tourExpenseCard( - employeeName: response.requestDetails?.employeeName ?? "-", - placeOfVisit: response.requestDetails?.placeOfVisit ?? "-", + employeeName: + response.requestDetails?.employeeName ?? + "-", + placeOfVisit: + response.requestDetails?.placeOfVisit ?? + "-", daAmount: response.tourExpenses?.da ?? "0", - totalAmount: response.tourExpenses?.appliedAmount ?? "0", - fromDate: response.tourExpenses?.fromDate ?? "-", + totalAmount: + response.tourExpenses?.appliedAmount ?? "0", + fromDate: + response.tourExpenses?.fromDate ?? "-", toDate: response.tourExpenses?.toDate ?? "-", - remarks: response.tourExpenses?.extraNote ?? "-", + remarks: + response.tourExpenses?.extraNote ?? "-", ), ), - ], ), ), ], const SizedBox(height: 10), + /// Travel Expenses Cards if (response.travelExpenses != null && response.travelExpenses!.isNotEmpty) ...[ @@ -163,14 +213,18 @@ class _TourExpensesDetailsScreenState extends State{ child: ListView.separated( scrollDirection: Axis.horizontal, padding: EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * 0.04, + horizontal: + MediaQuery.of(context).size.width * 0.04, ), itemCount: response.travelExpenses!.length, - separatorBuilder: (_, __) => const SizedBox(width: 12), + separatorBuilder: + (_, __) => const SizedBox(width: 12), itemBuilder: (context, index) { final t = response.travelExpenses![index]; return SizedBox( - width: MediaQuery.of(context).size.width * 0.90, // card width + width: + MediaQuery.of(context).size.width * + 0.90, // card width child: _travelExpenseCard( travelType: t.travelType ?? "-", amount: t.fare ?? "0", @@ -185,16 +239,10 @@ class _TourExpensesDetailsScreenState extends State{ context, MaterialPageRoute( builder: - ( - context, - ) => Fileviewer( - fileName: - t.imageDirFilePath ?? - "", - fileUrl: - t.imageDirFilePath ?? - "", - ), + (context) => Fileviewer( + fileName: t.imageDirFilePath ?? "", + fileUrl: t.imageDirFilePath ?? "", + ), ), ); }, @@ -202,7 +250,7 @@ class _TourExpensesDetailsScreenState extends State{ ); }, ), - ) + ), ], const SizedBox(height: 10), @@ -212,7 +260,8 @@ class _TourExpensesDetailsScreenState extends State{ const SizedBox(height: 10), Padding( padding: const EdgeInsets.only(left: 30.0), - child: Text("Hotel Expenses", + child: Text( + "Hotel Expenses", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -227,10 +276,12 @@ class _TourExpensesDetailsScreenState extends State{ child: ListView.separated( scrollDirection: Axis.horizontal, padding: EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * 0.04, + horizontal: + MediaQuery.of(context).size.width * 0.04, ), itemCount: response.hotelExpenses!.length, - separatorBuilder: (_, __) => const SizedBox(width: 12), + separatorBuilder: + (_, __) => const SizedBox(width: 12), itemBuilder: (context, index) { final h = response.hotelExpenses![index]; return SizedBox( @@ -247,16 +298,10 @@ class _TourExpensesDetailsScreenState extends State{ context, MaterialPageRoute( builder: - ( - context, - ) => Fileviewer( - fileName: - h.imageDirFilePath ?? - "", - fileUrl: - h.imageDirFilePath ?? - "", - ), + (context) => Fileviewer( + fileName: h.imageDirFilePath ?? "", + fileUrl: h.imageDirFilePath ?? "", + ), ), ); }, @@ -274,7 +319,8 @@ class _TourExpensesDetailsScreenState extends State{ const SizedBox(height: 10), Padding( padding: const EdgeInsets.only(left: 30.0), - child: Text("Other Expenses", + child: Text( + "Other Expenses", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -289,10 +335,12 @@ class _TourExpensesDetailsScreenState extends State{ child: ListView.separated( scrollDirection: Axis.horizontal, padding: EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width * 0.04, + horizontal: + MediaQuery.of(context).size.width * 0.04, ), itemCount: response.otherExpenses!.length, - separatorBuilder: (_, __) => const SizedBox(width: 12), + separatorBuilder: + (_, __) => const SizedBox(width: 12), itemBuilder: (context, index) { final o = response.otherExpenses![index]; return SizedBox( @@ -308,16 +356,10 @@ class _TourExpensesDetailsScreenState extends State{ context, MaterialPageRoute( builder: - ( - context, - ) => Fileviewer( - fileName: - o.imageDirFilePath ?? - "", - fileUrl: - o.imageDirFilePath ?? - "", - ), + (context) => Fileviewer( + fileName: o.imageDirFilePath ?? "", + fileUrl: o.imageDirFilePath ?? "", + ), ), ); }, @@ -328,7 +370,6 @@ class _TourExpensesDetailsScreenState extends State{ ), ], - const SizedBox(height: 25), ], ), @@ -381,15 +422,17 @@ class _TourExpensesDetailsScreenState extends State{ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(employeeName, - style: TextStyle( - fontSize: 14.5, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w600, - color: AppColors.semi_black, - ) + Text( + employeeName, + style: TextStyle( + fontSize: 14.5, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w600, + color: AppColors.semi_black, + ), ), - Text(placeOfVisit, + Text( + placeOfVisit, style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, @@ -457,22 +500,24 @@ class _TourExpensesDetailsScreenState extends State{ ), ), const SizedBox(width: 8), - Text(travelType, - style: TextStyle( - fontSize: 14.5, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w600, - color: AppColors.semi_black, - ) + Text( + travelType, + style: TextStyle( + fontSize: 14.5, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w600, + color: AppColors.semi_black, + ), ), ], ), - Text("₹$amount", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), + Text( + "₹$amount", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), ), ], ), @@ -483,7 +528,7 @@ class _TourExpensesDetailsScreenState extends State{ const SizedBox(height: 2), _buildKeyValue("To", to), const SizedBox(height: 2), - if ( imageUrl != null && imageUrl!.isNotEmpty) + if (imageUrl != null && imageUrl!.isNotEmpty) _buildKeyValue("Image", "View", isLink: true, onTap: onViewTap), ], ), @@ -524,29 +569,27 @@ class _TourExpensesDetailsScreenState extends State{ CircleAvatar( radius: 20, backgroundColor: const Color(0xffFCE4EC), - child: - SvgPicture.asset( - "assets/svg/hrm/hotel_ic.svg", - ), + child: SvgPicture.asset("assets/svg/hrm/hotel_ic.svg"), ), const SizedBox(width: 8), - Text(hotelName, - style: TextStyle( - - fontSize: 14.5, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w600, - color: AppColors.semi_black, - ) + Text( + hotelName, + style: TextStyle( + fontSize: 14.5, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w600, + color: AppColors.semi_black, + ), ), ], ), - Text("₹$amount", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), + Text( + "₹$amount", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), ), ], ), @@ -557,8 +600,8 @@ class _TourExpensesDetailsScreenState extends State{ const SizedBox(height: 2), _buildKeyValue("To", toDate), const SizedBox(height: 2), - if ( imageUrl != null && imageUrl!.isNotEmpty) - _buildKeyValue("Image", "View", isLink: true, onTap: onViewTap), + if (imageUrl != null && imageUrl!.isNotEmpty) + _buildKeyValue("Image", "View", isLink: true, onTap: onViewTap), ], ), ); @@ -597,28 +640,27 @@ class _TourExpensesDetailsScreenState extends State{ CircleAvatar( radius: 20, backgroundColor: const Color(0xffEDE7F6), - child: SvgPicture.asset( - "assets/svg/hrm/books_ic.svg", - ), + child: SvgPicture.asset("assets/svg/hrm/books_ic.svg"), ), const SizedBox(width: 8), Text( - description, - style: TextStyle( - fontSize: 14.5, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w600, - color: AppColors.semi_black, - ) + description, + style: TextStyle( + fontSize: 14.5, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w600, + color: AppColors.semi_black, + ), ), ], ), - Text("₹$amount", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), + Text( + "₹$amount", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), ), ], ), @@ -629,8 +671,8 @@ class _TourExpensesDetailsScreenState extends State{ const SizedBox(height: 2), _buildKeyValue("Description", description), const SizedBox(height: 2), - if ( imageUrl != null && imageUrl!.isNotEmpty) - _buildKeyValue("Image", "View", isLink: true, onTap: onViewTap), + if (imageUrl != null && imageUrl!.isNotEmpty) + _buildKeyValue("Image", "View", isLink: true, onTap: onViewTap), ], ), ); @@ -639,56 +681,59 @@ class _TourExpensesDetailsScreenState extends State{ Widget _buildSectionHeader(String title) { return Row( children: [ - Text(title, - style: const TextStyle( - fontSize: 14, - fontFamily: "JakartaSemiBold", - ) + Text( + title, + style: const TextStyle(fontSize: 14, fontFamily: "JakartaSemiBold"), ), const SizedBox(width: 16), Expanded( - child: DottedLine( - dashGapLength: 3, - dashGapColor: - Colors.white, - dashColor: AppColors.grey_semi, - dashLength: 2, - lineThickness: 0.5, - ), - ) + child: DottedLine( + dashGapLength: 3, + dashGapColor: Colors.white, + dashColor: AppColors.grey_semi, + dashLength: 2, + lineThickness: 0.5, + ), + ), ], ); } - Widget _buildKeyValue(String key, String value, - {bool isLink = false, VoidCallback? onTap}) { + Widget _buildKeyValue( + String key, + String value, { + bool isLink = false, + VoidCallback? onTap, + }) { return Padding( padding: const EdgeInsets.symmetric(vertical: 3.5, horizontal: 2), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(key, - style: TextStyle( - fontFamily: "JakartaRegular", - fontSize: 14, - color: AppColors.semi_black, - ), + Text( + key, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, + ), ), isLink ? GestureDetector( - onTap: onTap, - child: const Text("View", - style: TextStyle( + onTap: onTap, + child: const Text( + "View", + style: TextStyle( fontSize: 14, fontWeight: FontWeight.w500, - color: Colors.blue)), - ) - : Text(value, - style: const TextStyle( - fontSize: 14, - color: Color(0xFF818181), + color: Colors.blue, + ), + ), + ) + : Text( + value, + style: const TextStyle(fontSize: 14, color: Color(0xFF818181)), ), - ), ], ), ); @@ -735,7 +780,9 @@ class _TourExpensesDetailsScreenState extends State{ color: Color(0xFFE6F6FF), shape: BoxShape.circle, ), - child: SvgPicture.asset("assets/svg/hrm/tour_main_ic.svg"), + child: SvgPicture.asset( + "assets/svg/hrm/tour_main_ic.svg", + ), ), const SizedBox(width: 10), Expanded( @@ -743,36 +790,43 @@ class _TourExpensesDetailsScreenState extends State{ child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, - style: const TextStyle( - fontSize: 14, - fontFamily: "JakartaRegular", - color: Color(0xff2D2D2D) - ) + Text( + title, + style: const TextStyle( + fontSize: 14, + fontFamily: "JakartaRegular", + color: Color(0xff2D2D2D), + ), ), const SizedBox(height: 3), - Text(date, - style: const TextStyle( - fontSize: 12, - color: Color(0xff818181) - ) + Text( + date, + style: const TextStyle( + fontSize: 12, + color: Color(0xff818181), + ), ), ], ), ), Container( - padding: - const EdgeInsets.symmetric(horizontal: 10, vertical: 6), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 6, + ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), color: _getStatusBgColor(status), ), - child: Text(status, - style: TextStyle( - fontSize: 14, - fontFamily: "JakartaRegular", - color: _getStatusTxtColor(status))), - ) + child: Text( + status, + style: TextStyle( + fontSize: 14, + fontFamily: "JakartaRegular", + color: _getStatusTxtColor(status), + ), + ), + ), ], ), @@ -784,11 +838,12 @@ class _TourExpensesDetailsScreenState extends State{ padding: const EdgeInsets.symmetric(vertical: 8), child: Row( children: [ - const Text("Amount Details", - style: TextStyle( - fontSize: 14, - fontFamily: "JakartaSemiBold", - ) + const Text( + "Amount Details", + style: TextStyle( + fontSize: 14, + fontFamily: "JakartaSemiBold", + ), ), const SizedBox(width: 10), Expanded( @@ -806,37 +861,40 @@ class _TourExpensesDetailsScreenState extends State{ const SizedBox(height: 6), Column( - children: details.map((d) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 4, - child: Text(d["key"] ?? "-", + children: + details.map((d) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 4, + child: Text( + d["key"] ?? "-", style: TextStyle( fontSize: 14, color: AppColors.semi_black, fontFamily: "JakartaRegular", - ) - ) - ), - Expanded( - flex: 3, - child: Text(d["value"] ?? "-", + ), + ), + ), + Expanded( + flex: 3, + child: Text( + d["value"] ?? "-", textAlign: TextAlign.right, style: const TextStyle( - fontSize: 14, - fontFamily: "JakartaRegular", - color: Color(0xff818181) - ) - ) + fontSize: 14, + fontFamily: "JakartaRegular", + color: Color(0xff818181), + ), + ), + ), + ], ), - ], - ), - ); - }).toList(), + ); + }).toList(), ), ], @@ -848,13 +906,14 @@ class _TourExpensesDetailsScreenState extends State{ child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text(showMore ? "Hide Details" : "View Details", - style: TextStyle( - fontSize: 14, - fontFamily: "JakartaMedium", - fontWeight: FontWeight.w500, - color: AppColors.app_blue, - ) + Text( + showMore ? "Hide Details" : "View Details", + style: TextStyle( + fontSize: 14, + fontFamily: "JakartaMedium", + fontWeight: FontWeight.w500, + color: AppColors.app_blue, + ), ), const SizedBox(width: 6), Transform.flip( @@ -865,11 +924,11 @@ class _TourExpensesDetailsScreenState extends State{ width: 20, color: AppColors.app_blue, ), - ) + ), ], ), ), - ) + ), ], ), ), @@ -877,6 +936,7 @@ class _TourExpensesDetailsScreenState extends State{ }, ); } + ///travel icons String _getTravelIcon(String? travelType) { switch (travelType?.toLowerCase()) { @@ -897,7 +957,6 @@ class _TourExpensesDetailsScreenState extends State{ } } - /// Avatar color generator Color _getStatusBgColor(value) { var color = AppColors.approved_bg_color; @@ -921,10 +980,10 @@ class _TourExpensesDetailsScreenState extends State{ return AppColors.rejected_text_color; case 'Expired at TL': return AppColors.rejected_text_color; - } return color; } + getText(value) { switch (value) { case 'HR Approved': @@ -939,5 +998,4 @@ class _TourExpensesDetailsScreenState extends State{ return "Requested"; } } - } diff --git a/lib/screens/hrm/oggchart.dart b/lib/screens/hrm/oggchart.dart index 3560edd..2398a59 100644 --- a/lib/screens/hrm/oggchart.dart +++ b/lib/screens/hrm/oggchart.dart @@ -4,7 +4,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:generp/Utils/app_colors.dart'; -import 'package:generp/screens/commom/accountsListDetails.dart'; import 'package:graphview/GraphView.dart'; import 'package:provider/provider.dart'; import '../../Models/hrmmodels/ogresponse.dart'; diff --git a/lib/screens/inventory/GeneratorPartDetailsScreen.dart b/lib/screens/inventory/GeneratorPartDetailsScreen.dart index 1ffeaf7..dc9ea90 100644 --- a/lib/screens/inventory/GeneratorPartDetailsScreen.dart +++ b/lib/screens/inventory/GeneratorPartDetailsScreen.dart @@ -126,7 +126,10 @@ class _GeneratorPartDetailsScreenState child: Column( children: [ Card( - margin: EdgeInsets.symmetric(horizontal: 0,vertical: 2), + margin: EdgeInsets.symmetric( + horizontal: 0, + vertical: 2, + ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(30), @@ -344,13 +347,13 @@ class _GeneratorPartDetailsScreenState Container( alignment: Alignment.topLeft, - padding: EdgeInsets.only(left: 10,top: 10), + padding: EdgeInsets.only(left: 10, top: 10), child: Text( "Product Details", style: TextStyle( color: AppColors.grey_thick, fontFamily: "JakartaMedium", - fontSize: 14 + fontSize: 14, ), ), ), @@ -425,7 +428,7 @@ class _GeneratorPartDetailsScreenState Expanded( child: Text( values[j] == "" ? "-" : values[j], - textAlign:TextAlign.right, + textAlign: TextAlign.right, style: TextStyle( fontSize: 14, color: AppColors.grey_semi, @@ -495,7 +498,7 @@ class _GeneratorPartDetailsScreenState Expanded( child: Text( values[j] == "" ? "-" : values[j], - textAlign:TextAlign.right, + textAlign: TextAlign.right, style: TextStyle( fontSize: 14, fontFamily: "JakartaRegular", @@ -560,7 +563,6 @@ class _GeneratorPartDetailsScreenState child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( child: Text( provider.partData.prodDesc == "" @@ -569,7 +571,7 @@ class _GeneratorPartDetailsScreenState style: TextStyle( fontSize: 14, color: AppColors.grey_semi, - fontFamily: "JakartaRegular" + fontFamily: "JakartaRegular", ), ), ), @@ -815,7 +817,7 @@ class _GeneratorPartDetailsScreenState Expanded( flex: 1, child: Text( - "${headings[index]}", + headings[index], style: TextStyle( fontFamily: "JakartaMedium", ), @@ -881,7 +883,7 @@ class _GeneratorPartDetailsScreenState Expanded( flex: 1, child: Text( - "${headings[index]}", + headings[index], style: TextStyle( fontFamily: "JakartaMedium", ), @@ -960,7 +962,7 @@ class _GeneratorPartDetailsScreenState Expanded( flex: 1, child: Text( - "${headings[index]}", + headings[index], style: TextStyle( fontFamily: "JakartaMedium", ), @@ -1122,7 +1124,7 @@ class _GeneratorPartDetailsScreenState mainAxisSize: MainAxisSize.min, children: [ Text( - "Inventory ${type}", + "Inventory $type", style: TextStyle( color: AppColors.app_blue, fontWeight: FontWeight.w600, @@ -1253,7 +1255,12 @@ class _GeneratorPartDetailsScreenState color: AppColors.grey_semi, fontSize: 14, ), - contentPadding: EdgeInsets.fromLTRB(5.0, 10.0, 5.0, 10.0), + contentPadding: EdgeInsets.fromLTRB( + 5.0, + 10.0, + 5.0, + 10.0, + ), enabledBorder: InputBorder.none, focusedBorder: InputBorder.none, hintText: 'Enter Description', diff --git a/lib/screens/inventory/InventoryScreen.dart b/lib/screens/inventory/InventoryScreen.dart index 869103f..8bfe7e3 100644 --- a/lib/screens/inventory/InventoryScreen.dart +++ b/lib/screens/inventory/InventoryScreen.dart @@ -81,13 +81,13 @@ class _InventoryScreenState extends State { return Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.scaffold_bg_color, - appBar: appbarNew(context, "Gen Inventory",0xFFFFFFFF), + appBar: appbarNew(context, "Gen Inventory", 0xFFFFFFFF), body: Container( decoration: BoxDecoration(color: Colors.black), child: Column( children: [ Spacer(), - Container( + SizedBox( height: 250, child: QRView( diff --git a/lib/screens/old/AllrequesitionListsOld.dart b/lib/screens/old/AllrequesitionListsOld.dart index 0169fb7..26bd187 100644 --- a/lib/screens/old/AllrequesitionListsOld.dart +++ b/lib/screens/old/AllrequesitionListsOld.dart @@ -1,9 +1,7 @@ import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_svg/svg.dart'; import 'package:generp/Notifiers/financeProvider/RequestionListProvider.dart'; import 'package:generp/Utils/GlobalConstants.dart'; @@ -84,17 +82,17 @@ class _AllpaymentrequesitionlistsbymodesoldState } return connection == "Online" ? Platform.isAndroid - ? WillPopScope( - onWillPop: () { - return onBackPressed(context); - }, - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () { + return onBackPressed(context); + }, + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -157,294 +155,294 @@ class _AllpaymentrequesitionlistsbymodesoldState ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue, - ), - ), - ) - : requestLists.isNotEmpty - ? SizedBox( - child: Scrollbar( - thumbVisibility: false, - child: ListView.builder( - itemCount: requestLists.length, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemBuilder: (context, index) { - if (requestLists.isEmpty) { - return SizedBox( - child: Center(child: Text("No Data Available")), - ); - } - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, + ), ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Color(0xFFFFF3CE), - borderRadius: BorderRadius.circular( - 8, - ), - ), - child: SvgPicture.asset( - "assets/svg/fin_ic.svg", - ), - ), + ) + : requestLists.isNotEmpty + ? SizedBox( + child: Scrollbar( + thumbVisibility: false, + child: ListView.builder( + itemCount: requestLists.length, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemBuilder: (context, index) { + if (requestLists.isEmpty) { + return SizedBox( + child: Center(child: Text("No Data Available")), + ); + } + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + child: Column( + children: [ + Row( children: [ - Text( - requestLists[index].accountName!, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Color(0xFFFFF3CE), + borderRadius: BorderRadius.circular( + 8, + ), + ), + child: SvgPicture.asset( + "assets/svg/fin_ic.svg", + ), ), ), - Text( - "₹" - "${requestLists[index].amount}", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + requestLists[index].accountName!, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + "₹" + "${requestLists[index].amount}", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ], + ), + ), + ), + Expanded( + flex: 2, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5, + vertical: 10, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + 8, + ), + color: Color(0xFFE3FFE0), + ), + child: Center( + child: Text( + requestLists[index].status!, + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: Color(0xFF0D9C00), + ), + ), + ), ), ), ], ), - ), - ), - Expanded( - flex: 2, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 5, - vertical: 10, - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - 8, - ), - color: Color(0xFFE3FFE0), - ), - child: Center( - child: Text( - requestLists[index].status!, - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: Color(0xFF0D9C00), - ), - ), + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), ), - ), - ), - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(4, (j) { - final headings = [ - "Requesting Propose", - "Attachment", - "Requested Date", - "Note", - ]; + ...List.generate(4, (j) { + final headings = [ + "Requesting Propose", + "Attachment", + "Requested Date", + "Note", + ]; - final subHeadings = [ - requestLists[index].requestingPurpose, - "View", - // requestLists[index].attachmentDirFilePath - requestLists[index].date, - requestLists[index].description, - ]; - if (j == 1 && - requestLists[index] - .attachmentViewFileName == - "") { - return SizedBox.shrink(); - } - return Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, - ), - ), - ), - Expanded( - child: InkResponse( - onTap: - j != 1 - ? null - : () { - Navigator.push( - context, - MaterialPageRoute( - builder: - ( - context, - ) => Fileviewer( - fileName: - requestLists[index] - .attachmentViewFileName!, - fileUrl: - requestLists[index] - .attachmentDirFilePath!, + final subHeadings = [ + requestLists[index].requestingPurpose, + "View", + // requestLists[index].attachmentDirFilePath + requestLists[index].date, + requestLists[index].description, + ]; + if (j == 1 && + requestLists[index] + .attachmentViewFileName == + "") { + return SizedBox.shrink(); + } + return Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + ), + Expanded( + child: InkResponse( + onTap: + j != 1 + ? null + : () { + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Fileviewer( + fileName: + requestLists[index] + .attachmentViewFileName!, + fileUrl: + requestLists[index] + .attachmentDirFilePath!, + ), + ), + ); + }, + child: Text( + subHeadings[j]!, + style: TextStyle( + fontSize: 14, + color: + j == 1 + ? AppColors.app_blue + : Color(0xFF818181), + decoration: + j == 1 + ? TextDecoration + .underline + : TextDecoration.none, + decorationColor: + j == 1 + ? AppColors.app_blue + : AppColors.white, + ), + ), ), ), - ); - }, - child: Text( - subHeadings[j]!, - style: TextStyle( - fontSize: 14, - color: - j == 1 - ? AppColors.app_blue - : Color(0xFF818181), - decoration: - j == 1 - ? TextDecoration - .underline - : TextDecoration.none, - decorationColor: - j == 1 - ? AppColors.app_blue - : AppColors.white, + ], + ), + ); + }), + InkResponse( + onTap: () async { + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Paymentrequestionlistdetails( + pageName: + widget.pageTitleName, + mode: widget.mode, + paymentRequestId: + requestLists[index].id, + ), + settings: RouteSettings( + name: "Paymentrequestionlistdetails", + ), ), + ); + if (routeSettingName == + "Paymentrequestionlistdetails") { + print("croos refresh"); + provider + .paymentRequestionListsAPIFunction( + context, + widget.mode, + "", + "", + ); + } + // if (res == true) { + // print("android refresh"); + // provider + // .paymentRequestionListsAPIFunction( + // context, + // widget.mode, + // "", + // "", + // ); + // } + // if (Platform.isIOS) { + // print("IOS Refresh"); + // if (didPushed == "true" || + // didPopped == "true") { + // provider + // .paymentRequestionListsAPIFunction( + // context, + // widget.mode, + // "", + // "", + // ); + // } + // } + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), ), ), ], ), ); - }), - InkResponse( - onTap: () async { - var res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Paymentrequestionlistdetails( - pageName: - widget.pageTitleName, - mode: widget.mode, - paymentRequestId: - requestLists[index].id, - ), - settings: RouteSettings( - name: "Paymentrequestionlistdetails", - ), - ), - ); - if (routeSettingName == - "Paymentrequestionlistdetails") { - print("croos refresh"); - provider - .paymentRequestionListsAPIFunction( - context, - widget.mode, - "", - "", - ); - } - // if (res == true) { - // print("android refresh"); - // provider - // .paymentRequestionListsAPIFunction( - // context, - // widget.mode, - // "", - // "", - // ); - // } - // if (Platform.isIOS) { - // print("IOS Refresh"); - // if (didPushed == "true" || - // didPopped == "true") { - // provider - // .paymentRequestionListsAPIFunction( - // context, - // widget.mode, - // "", - // "", - // ); - // } - // } - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ), - ], + }, + ), ), - ); - }, - ), - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); diff --git a/lib/screens/old/HomescreenOld.dart b/lib/screens/old/HomescreenOld.dart index 7af6198..3354ac6 100644 --- a/lib/screens/old/HomescreenOld.dart +++ b/lib/screens/old/HomescreenOld.dart @@ -34,60 +34,59 @@ class _MyHomePageOldState extends State { // TODO: implement initState _connectivity.initialise(); _connectivity.myStream.listen((source) { - setState(() => _source = source); }); var prov = Provider.of(context, listen: false); - var prof_prov = Provider.of(context, listen: false); + var profProv = Provider.of(context, listen: false); Future.microtask(() { prov.DashboardApiFunction(context); }); Future.delayed(Duration(milliseconds: 600), () { - prof_prov.ProfileApiFunction(prov, context); - prof_prov.VersionApiFunction(); + profProv.ProfileApiFunction(prov, context); + profProv.VersionApiFunction(); }); super.initState(); } Future onBackPressed() async { return await showDialog( - context: context, - builder: - (context) => AlertDialog( - title: const Text('Are you sure?'), - content: const Text('Do you want to exit the App'), - actions: [ - TextButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white), - ), - onPressed: () => Navigator.of(context).pop(false), - child: Text( - "NO", - style: TextStyle(fontWeight: FontWeight.w500), - ), - ), - const SizedBox(height: 16), - TextButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.white), - overlayColor: MaterialStateProperty.all(Colors.white70), - ), - onPressed: - () => SystemChannels.platform.invokeMethod( - 'SystemNavigator.pop', - ), - child: Text( - "YES", - style: TextStyle(fontWeight: FontWeight.w500), - ), - ), - ], - elevation: 30.0, - ), - barrierDismissible: false, - ) ?? + context: context, + builder: + (context) => AlertDialog( + title: const Text('Are you sure?'), + content: const Text('Do you want to exit the App'), + actions: [ + TextButton( + style: ButtonStyle( + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white), + ), + onPressed: () => Navigator.of(context).pop(false), + child: Text( + "NO", + style: TextStyle(fontWeight: FontWeight.w500), + ), + ), + const SizedBox(height: 16), + TextButton( + style: ButtonStyle( + backgroundColor: WidgetStateProperty.all(Colors.white), + overlayColor: WidgetStateProperty.all(Colors.white70), + ), + onPressed: + () => SystemChannels.platform.invokeMethod( + 'SystemNavigator.pop', + ), + child: Text( + "YES", + style: TextStyle(fontWeight: FontWeight.w500), + ), + ), + ], + elevation: 30.0, + ), + barrierDismissible: false, + ) ?? false; } @@ -100,7 +99,7 @@ class _MyHomePageOldState extends State { LocationPermission permission = await Geolocator.checkPermission(); hasLocationPermission = permission == LocationPermission.always || - permission == LocationPermission.whileInUse; + permission == LocationPermission.whileInUse; final loc.Location location = loc.Location(); bool serviceEnabled; @@ -135,491 +134,491 @@ class _MyHomePageOldState extends State { } return (connection == 'Online') ? Consumer2( - builder: (context, homescreen, profile, child) { - // Define the original data - final names = [ - "Attendance", - "Finance", - "CRM", - "Orders", - "ERP", - "Service Engineer", - "Gen Tracker", - // "Nearby", - "Inventory", - "Whizzdom", - // "Common", - ]; - final icons = [ - "assets/svg/home_icons_1.svg", - "assets/svg/home_icons_10.svg", - "assets/svg/home_icons_12.svg", - "assets/svg/home_icons_11.svg", - "assets/svg/home_icons_2.svg", - "assets/svg/home_icons_4.svg", - "assets/svg/home_icons_31.svg", - // "assets/svg/home_icons_5.svg", - "assets/svg/home_icons_6.svg", - "assets/svg/home_icons_81.svg", - // "assets/svg/home_icons_9.svg", - ]; - final requiredRoles = [ - "430", - "430", - "430", - "430", - "431", - "433", - "434", - // "433", - "432", - "431", - // "430", - ]; - - final filteredItems = >[]; - for (int i = 0; i < names.length; i++) { - if (homescreen.roleStatus.contains(requiredRoles[i])) { - filteredItems.add({'name': names[i], 'icon': icons[i]}); - } - } - return WillPopScope( - onWillPop: onBackPressed, - child: RefreshIndicator.adaptive( - color: AppColors.app_blue, - - onRefresh: () async { - await Future.delayed(const Duration(milliseconds: 600)); - homescreen.DashboardApiFunction(context); - }, - child: SafeArea( - top: false, - bottom: Platform.isIOS ? false : true, - child: Scaffold( - resizeToAvoidBottomInset: true, - backgroundColor: AppColors.scaffold_bg_color, - - body: Container( - child: Column( - children: [ - Expanded( - flex: 4, - child: Container( - padding: EdgeInsets.symmetric(vertical: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.vertical( - bottom: Radius.circular(30), - ), - ), - child: Container( - margin: EdgeInsets.only( - bottom: 15, - left: 15, - right: 15, - top: 30, - ), - padding: EdgeInsets.only(bottom: 15, right: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(30), - gradient: LinearGradient( - colors: [ - AppColors.profile_card_gradient1, - AppColors.profile_card_gradient2, - ], + builder: (context, homescreen, profile, child) { + // Define the original data + final names = [ + "Attendance", + "Finance", + "CRM", + "Orders", + "ERP", + "Service Engineer", + "Gen Tracker", + // "Nearby", + "Inventory", + "Whizzdom", + // "Common", + ]; + final icons = [ + "assets/svg/home_icons_1.svg", + "assets/svg/home_icons_10.svg", + "assets/svg/home_icons_12.svg", + "assets/svg/home_icons_11.svg", + "assets/svg/home_icons_2.svg", + "assets/svg/home_icons_4.svg", + "assets/svg/home_icons_31.svg", + // "assets/svg/home_icons_5.svg", + "assets/svg/home_icons_6.svg", + "assets/svg/home_icons_81.svg", + // "assets/svg/home_icons_9.svg", + ]; + final requiredRoles = [ + "430", + "430", + "430", + "430", + "431", + "433", + "434", + // "433", + "432", + "431", + // "430", + ]; + + final filteredItems = >[]; + for (int i = 0; i < names.length; i++) { + if (homescreen.roleStatus.contains(requiredRoles[i])) { + filteredItems.add({'name': names[i], 'icon': icons[i]}); + } + } + return WillPopScope( + onWillPop: onBackPressed, + child: RefreshIndicator.adaptive( + color: AppColors.app_blue, + + onRefresh: () async { + await Future.delayed(const Duration(milliseconds: 600)); + homescreen.DashboardApiFunction(context); + }, + child: SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + backgroundColor: AppColors.scaffold_bg_color, + + body: Container( + child: Column( + children: [ + Expanded( + flex: 4, + child: Container( + padding: EdgeInsets.symmetric(vertical: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.vertical( + bottom: Radius.circular(30), + ), ), - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 2, - child: SizedBox( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - - children: [ - SizedBox( - width: 66, - height: 66, - child: ClipRRect( - borderRadius: - BorderRadius.circular(50), - child: CachedNetworkImage( - cacheKey: - profile.profileImage, - fit: BoxFit.cover, - imageUrl: - "${profile.profileImage}", - useOldImageOnUrlChange: false, - placeholder: - (context, url) => - CircularProgressIndicator.adaptive(), - errorWidget: - (context, url, error) => - Icon(Icons.error), + child: Container( + margin: EdgeInsets.only( + bottom: 15, + left: 15, + right: 15, + top: 30, + ), + padding: EdgeInsets.only(bottom: 15, right: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + gradient: LinearGradient( + colors: [ + AppColors.profile_card_gradient1, + AppColors.profile_card_gradient2, + ], + ), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 2, + child: SizedBox( + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + + children: [ + SizedBox( + width: 66, + height: 66, + child: ClipRRect( + borderRadius: + BorderRadius.circular(50), + child: CachedNetworkImage( + cacheKey: + profile.profileImage, + fit: BoxFit.cover, + imageUrl: + "${profile.profileImage}", + useOldImageOnUrlChange: false, + placeholder: + (context, url) => + CircularProgressIndicator.adaptive(), + errorWidget: + (context, url, error) => + Icon(Icons.error), + ), + ), ), - ), - ), - Row( + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Container( + width: 13, + height: 13, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: + homescreen.onlineStatus == + "Online" + ? Colors.green + : Colors.yellow, + ), + ), + SizedBox(width: 6), + Text( + "${homescreen.onlineStatus}", + style: TextStyle( + fontSize: 16, + fontFamily: "JakartaMedium", + color: Color(0xFF2D2D2D), + ), + ), + ], + ), + ], + ), + ), + ), + Expanded( + flex: 3, + child: Container( + padding: EdgeInsets.only(right: 10), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, mainAxisAlignment: - MainAxisAlignment.center, + MainAxisAlignment.center, children: [ - Container( - width: 13, - height: 13, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: - homescreen.onlineStatus == - "Online" - ? Colors.green - : Colors.yellow, + // Text( + // "${profile.employeeName}", + // maxLines: 1, + // style: TextStyle( + // color: AppColors.app_blue, + // fontFamily: "JakartaSemiBold", + // fontSize: 18, + // ), + // ), + AutoSizeText( + '${profile.employeeName}', + maxFontSize: 18, + minFontSize: 12, + style: TextStyle( + fontSize: 18, + color: AppColors.app_blue, + fontFamily: "JakartaRegular", ), + maxLines: 2, ), - SizedBox(width: 6), - Text( - "${homescreen.onlineStatus}", + AutoSizeText( + '(${profile.designation})', + maxFontSize: 14, + minFontSize: 10, style: TextStyle( - fontSize: 16, - fontFamily: "JakartaMedium", - color: Color(0xFF2D2D2D), + fontSize: 14, + color: AppColors.semi_black, + fontFamily: "JakartaRegular", ), + maxLines: 1, ), - ], - ), - ], - ), - ), - ), - Expanded( - flex: 3, - child: Container( - padding: EdgeInsets.only(right: 10), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - // Text( - // "${profile.employeeName}", - // maxLines: 1, - // style: TextStyle( - // color: AppColors.app_blue, - // fontFamily: "JakartaSemiBold", - // fontSize: 18, - // ), - // ), - AutoSizeText( - '${profile.employeeName}', - maxFontSize: 18, - minFontSize: 12, - style: TextStyle( - fontSize: 18, - color: AppColors.app_blue, - fontFamily: "JakartaRegular", - ), - maxLines: 2, - ), - AutoSizeText( - '(${profile.designation})', - maxFontSize: 14, - minFontSize: 10, - style: TextStyle( - fontSize: 14, - color: AppColors.semi_black, - fontFamily: "JakartaRegular", - ), - maxLines: 1, - ), - // Text( - // "${profile.designation}", - // maxLines: 1, - // style: TextStyle( - // color: AppColors.semi_black, - // fontFamily: "JakartaRegular", - // fontSize: 14, - // ), - // ), - Text( - "${profile.employeeeID}", - style: TextStyle( - color: AppColors.semi_black, - fontFamily: "JakartaRegular", - fontSize: 14, - ), - ), - InkResponse( - onTap: () { - _showProfileBottomSheet( - context, - ); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Text( - "View Profile", - style: TextStyle( - color: AppColors.app_blue, - fontFamily: - "JakartaRegular", - fontSize: 14, - ), + // Text( + // "${profile.designation}", + // maxLines: 1, + // style: TextStyle( + // color: AppColors.semi_black, + // fontFamily: "JakartaRegular", + // fontSize: 14, + // ), + // ), + Text( + "${profile.employeeeID}", + style: TextStyle( + color: AppColors.semi_black, + fontFamily: "JakartaRegular", + fontSize: 14, ), - SizedBox(width: 5), - SizedBox( - width: 15, - height: 15, - child: Center( - child: SvgPicture.asset( - "assets/svg/next_button.svg", + ), + InkResponse( + onTap: () { + _showProfileBottomSheet( + context, + ); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Text( + "View Profile", + style: TextStyle( + color: AppColors.app_blue, + fontFamily: + "JakartaRegular", + fontSize: 14, + ), ), - ), + SizedBox(width: 5), + SizedBox( + width: 15, + height: 15, + child: Center( + child: SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ), + ), + ], ), - ], - ), + ), + ], ), - ], + ), ), - ), + ], ), - ], + ), ), ), - ), - ), - Expanded( - flex: 10, - child: Container( - padding: EdgeInsets.only( - left: 20, - right: 20, - top: 0, - bottom: 10, - ), - margin: EdgeInsets.only(top: 10), - child: GridView.builder( - itemCount: filteredItems.length, - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - ), - itemBuilder: (context, index) { - final item = filteredItems[index]; - return InkResponse( - onTap: () async { - var res; - switch (item['name']) { - case "Attendance": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - AttendanceScreen(), - settings: RouteSettings( - arguments: 'AttendanceScreen', - ), - ), - ); - break; - case "ERP": - bool isGpsEnabled = - await Geolocator.isLocationServiceEnabled(); - if (isGpsEnabled) { - if (Platform.isAndroid) { + Expanded( + flex: 10, + child: Container( + padding: EdgeInsets.only( + left: 20, + right: 20, + top: 0, + bottom: 10, + ), + margin: EdgeInsets.only(top: 10), + child: GridView.builder( + itemCount: filteredItems.length, + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + ), + itemBuilder: (context, index) { + final item = filteredItems[index]; + return InkResponse( + onTap: () async { + var res; + switch (item['name']) { + case "Attendance": + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + AttendanceScreen(), + settings: RouteSettings( + arguments: 'AttendanceScreen', + ), + ), + ); + break; + case "ERP": + bool isGpsEnabled = + await Geolocator.isLocationServiceEnabled(); + if (isGpsEnabled) { + if (Platform.isAndroid) { + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => WebErpScreen( + erp_url: + homescreen + .webPageUrl, + ), + ), + ); + } else { + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => WebERPIOS( + url: + homescreen + .webPageUrl, + ), + ), + ); + } + } else { + requestGpsPermission(); + } + + break; + case "Gen Tracker": + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Gentrackerdashboard(), + settings: RouteSettings( + arguments: + 'Gentrackerdashboard', + ), + ), + ); + break; + case "Service Engineer": + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Serviceengineerdashboard(), + ), + ); + break; + case "Nearby": + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Nearbygenerators(), + ), + ); + + break; + case "Inventory": + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + InventoryScreen(), + ), + ); + break; + case "Whizzdom": + bool isGpsEnabled = + await Geolocator.isLocationServiceEnabled(); + if (isGpsEnabled) { + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => WebWhizzdomScreen( + whizzdom_url: + homescreen + .whizzdomPageUrl, + ), + ), + ); + } else { + requestGpsPermission(); + } + break; + case "Common": + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Commondashboard(), + ), + ); + break; + case "Finance": res = await Navigator.push( context, MaterialPageRoute( builder: - (context) => WebErpScreen( - erp_url: - homescreen - .webPageUrl, + (context) => + Financedashboard(), + settings: RouteSettings( + arguments: 'Financedashboard', ), ), ); - } else { + break; + case "Orders": res = await Navigator.push( context, MaterialPageRoute( builder: - (context) => WebERPIOS( - url: - homescreen - .webPageUrl, + (context) => + Ordermoduledashboard(), + ), + ); + case "CRM": + res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + CrmdashboardScreen(), + settings: RouteSettings( + name: 'CrmdashboardScreen', ), ), ); - } - } else { - requestGpsPermission(); + default: + print("111"); + break; } - - break; - case "Gen Tracker": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Gentrackerdashboard(), - settings: RouteSettings( - arguments: - 'Gentrackerdashboard', - ), - ), - ); - break; - case "Service Engineer": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Serviceengineerdashboard(), - ), - ); - break; - case "Nearby": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Nearbygenerators(), - ), - ); - - break; - case "Inventory": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - InventoryScreen(), - ), - ); - break; - case "Whizzdom": - bool isGpsEnabled = - await Geolocator.isLocationServiceEnabled(); - if (isGpsEnabled) { - res = await Navigator.push( + if (res == true) { + homescreen.DashboardApiFunction( context, - MaterialPageRoute( - builder: - ( - context, - ) => WebWhizzdomScreen( - whizzdom_url: - homescreen - .whizzdomPageUrl, - ), - ), ); - } else { - requestGpsPermission(); } - break; - case "Common": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Commondashboard(), - ), - ); - break; - case "Finance": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Financedashboard(), - settings: RouteSettings( - arguments: 'Financedashboard', - ), - ), - ); - break; - case "Orders": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Ordermoduledashboard(), - ), - ); - case "CRM": - res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - CrmdashboardScreen(), - settings: RouteSettings( - name: 'CrmdashboardScreen', + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(30), + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + SvgPicture.asset( + item['icon']!, + height: 45, ), - ), - ); - default: - print("111"); - break; - } - if (res == true) { - homescreen.DashboardApiFunction( - context, - ); - } - }, - child: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(30), - ), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - SvgPicture.asset( - item['icon']!, - height: 45, + SizedBox(height: 10), + Text(item['name']!), + ], ), - SizedBox(height: 10), - Text(item['name']!), - ], - ), - ), - ); - }, + ), + ); + }, + ), + ), ), - ), + ], ), - ], + ), ), ), ), - ), - ), - ); - }, - ) + ); + }, + ) : NoNetwork(context); } @@ -647,9 +646,9 @@ class _MyHomePageOldState extends State { bottom: MediaQuery.of(context).viewInsets.bottom, ), child: Consumer3< - HomescreenNotifier, - ProfileNotifer, - LogoutNotifier + HomescreenNotifier, + ProfileNotifer, + LogoutNotifier >( builder: (context, home, profile, logout, child) { return SingleChildScrollView( @@ -721,10 +720,10 @@ class _MyHomePageOldState extends State { useOldImageOnUrlChange: false, placeholder: (context, url) => - CircularProgressIndicator.adaptive(), + CircularProgressIndicator.adaptive(), errorWidget: (context, url, error) => - Icon(Icons.error), + Icon(Icons.error), ), ), ), @@ -752,7 +751,7 @@ class _MyHomePageOldState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: - CrossAxisAlignment.center, + CrossAxisAlignment.center, children: [ Expanded( flex: 1, @@ -760,7 +759,7 @@ class _MyHomePageOldState extends State { shrinkWrap: true, itemCount: 5, physics: - NeverScrollableScrollPhysics(), + NeverScrollableScrollPhysics(), itemBuilder: (context, index) { final textHeadings = [ "Company", @@ -774,7 +773,7 @@ class _MyHomePageOldState extends State { child: Align( alignment: Alignment.centerLeft, child: Text( - "${textHeadings[index]}", + textHeadings[index], textAlign: TextAlign.left, style: TextStyle( @@ -794,7 +793,7 @@ class _MyHomePageOldState extends State { shrinkWrap: true, itemCount: 5, physics: - NeverScrollableScrollPhysics(), + NeverScrollableScrollPhysics(), itemBuilder: (context, index) { final textHeadings = [ profile.company, @@ -808,7 +807,8 @@ class _MyHomePageOldState extends State { child: Align( alignment: Alignment.centerLeft, child: Text( - "${textHeadings[index].toString()}", + textHeadings[index] + .toString(), textAlign: TextAlign.left, style: TextStyle( fontSize: 14, @@ -906,9 +906,9 @@ class _MyHomePageOldState extends State { bottom: MediaQuery.of(context).viewInsets.bottom, ), child: Consumer3< - HomescreenNotifier, - ProfileNotifer, - LogoutNotifier + HomescreenNotifier, + ProfileNotifer, + LogoutNotifier >( builder: (context, home, profile, logout, child) { return SingleChildScrollView( diff --git a/lib/screens/old/crmDashboardold.dart b/lib/screens/old/crmDashboardold.dart index ca9c382..05c91e1 100644 --- a/lib/screens/old/crmDashboardold.dart +++ b/lib/screens/old/crmDashboardold.dart @@ -62,15 +62,15 @@ class _CrmdashboardScreenState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -78,9 +78,9 @@ class _CrmdashboardScreenState extends State { return Consumer( builder: (context, provider, child) { final gridPages = - provider.accessPages - .where((page) => ![8, 9, 23, 24, 51, 50].contains(page.id)) - .toList(); + provider.accessPages + .where((page) => ![8, 9, 23, 24, 51, 50].contains(page.id)) + .toList(); return Scaffold( resizeToAvoidBottomInset: true, @@ -126,9 +126,9 @@ class _CrmdashboardScreenState extends State { color: AppColors.text_field_color, borderRadius: BorderRadius.circular(14), border: - focusNode.hasFocus - ? Border.all(color: AppColors.app_blue) - : null, + focusNode.hasFocus + ? Border.all(color: AppColors.app_blue) + : null, ), child: Row( children: [ @@ -154,8 +154,8 @@ class _CrmdashboardScreenState extends State { MaterialPageRoute( builder: (context) => Universalsearchscreen( - text: provider.searchController.text, - ), + text: provider.searchController.text, + ), settings: RouteSettings(name: 'SearchScreen'), ), ); @@ -191,7 +191,7 @@ class _CrmdashboardScreenState extends State { physics: AlwaysScrollableScrollPhysics(), child: Column( children: [ - if (provider.allLeads.length > 0) ...[ + if (provider.allLeads.isNotEmpty) ...[ Container( padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10), @@ -254,19 +254,19 @@ class _CrmdashboardScreenState extends State { MaterialPageRoute( builder: (context) => Leadlistbymode( - pageTitleName: - provider - .allLeads[jndex] - .filter! - .pageName!, - mode: - provider - .allLeads[jndex] - .filter! - .mode, - filter: - provider.allLeads[jndex].filter!, - ), + pageTitleName: + provider + .allLeads[jndex] + .filter! + .pageName!, + mode: + provider + .allLeads[jndex] + .filter! + .mode, + filter: + provider.allLeads[jndex].filter!, + ), ), ); } @@ -331,9 +331,9 @@ class _CrmdashboardScreenState extends State { MaterialPageRoute( builder: (context) => Leadlistbymode( - mode: gridPages[index].mode, - pageTitleName: gridPages[index].pageName, - ), + mode: gridPages[index].mode, + pageTitleName: gridPages[index].pageName, + ), ), ); } else if (gridPages[index].pageName!.contains( @@ -344,9 +344,9 @@ class _CrmdashboardScreenState extends State { MaterialPageRoute( builder: (context) => ProspectListByMode( - mode: gridPages[index].mode, - pageTitleName: gridPages[index].pageName, - ), + mode: gridPages[index].mode, + pageTitleName: gridPages[index].pageName, + ), ), ); } else if (gridPages[index].pageName == @@ -414,7 +414,7 @@ class _CrmdashboardScreenState extends State { }, ), - if (provider.pendingTasksLists.length > 0) ...[ + if (provider.pendingTasksLists.isNotEmpty) ...[ Align( alignment: Alignment.centerLeft, child: Padding( @@ -428,7 +428,7 @@ class _CrmdashboardScreenState extends State { ), ), ), - Container( + SizedBox( width: double.infinity, height: MediaQuery.of(context).size.height * 0.34, child: ListView.builder( @@ -483,17 +483,17 @@ class _CrmdashboardScreenState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( - "${headings[j]}", + headings[j], style: TextStyle(fontSize: 14), ), ), Expanded( child: Text( - "${subHeadings[j]}", + subHeadings[j], style: TextStyle( color: AppColors.grey_semi, fontSize: 14, @@ -516,7 +516,7 @@ class _CrmdashboardScreenState extends State { ), ), floatingActionButtonLocation: - FloatingActionButtonLocation.centerFloat, + FloatingActionButtonLocation.centerFloat, floatingActionButton: InkResponse( onTap: () { if (provider.accessPages @@ -566,9 +566,9 @@ class _CrmdashboardScreenState extends State { child: Consumer( builder: (context, provider, child) { final accessiblePagesList = - provider.accessPages - .where((page) => [8, 9].contains(page.id)) - .toList(); + provider.accessPages + .where((page) => [8, 9].contains(page.id)) + .toList(); return Container( margin: EdgeInsets.only( bottom: 15, diff --git a/lib/screens/old/leadDetailsOld.dart b/lib/screens/old/leadDetailsOld.dart index 6cb3c85..cab0149 100644 --- a/lib/screens/old/leadDetailsOld.dart +++ b/lib/screens/old/leadDetailsOld.dart @@ -76,15 +76,15 @@ class _LeadDetailsByModeOldState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -101,11 +101,11 @@ class _LeadDetailsByModeOldState extends State { "Last Followup Date", ]; var subHeadings1 = [ - provider.accountDetails!.accManager ?? "-", - provider.accountDetails!.owner ?? "-", - provider.leadDetails!.address ?? "-", - provider.leadDetails!.status ?? "-", - provider.followupDetails.first!.fdate ?? "-", + provider.accountDetails.accManager ?? "-", + provider.accountDetails.owner ?? "-", + provider.leadDetails.address ?? "-", + provider.leadDetails.status ?? "-", + provider.followupDetails.first.fdate ?? "-", ]; var headings2 = [ @@ -120,14 +120,14 @@ class _LeadDetailsByModeOldState extends State { ]; var subHeadings2 = [ - provider.accountDetails!.state ?? "-", - provider.accountDetails!.district ?? "-", - provider.accountDetails!.subLocality ?? "-", - provider.accountDetails!.source ?? "-", - provider.accountDetails!.reference ?? "-", - provider.accountDetails!.team ?? "-", - provider.accountDetails!.segment ?? "-", - "${provider.leadDetails!.lage ?? "-"} days", + provider.accountDetails.state ?? "-", + provider.accountDetails.district ?? "-", + provider.accountDetails.subLocality ?? "-", + provider.accountDetails.source ?? "-", + provider.accountDetails.reference ?? "-", + provider.accountDetails.team ?? "-", + provider.accountDetails.segment ?? "-", + "${provider.leadDetails.lage ?? "-"} days", ]; var totalHeadings = [...headings1]; @@ -210,11 +210,11 @@ class _LeadDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => EditAccountDetails( - leadID: leadDetails.id, - mode: widget.mode, - accountID: leadDetails.accId, - companyName: leadDetails.name, - ), + leadID: leadDetails.id, + mode: widget.mode, + accountID: leadDetails.accId, + companyName: leadDetails.name, + ), ), ); if (res == true) { @@ -257,35 +257,35 @@ class _LeadDetailsByModeOldState extends State { Expanded( child: InkResponse( child: - totalHeadings[j] == "Lead Age" - ? Tooltip( - triggerMode: TooltipTriggerMode.tap, + totalHeadings[j] == "Lead Age" + ? Tooltip( + triggerMode: TooltipTriggerMode.tap, - message: - "${provider.leadDetails.createdDatetime}", - child: Text( - totalSubHeadings[j] == "" - ? "-" - : totalSubHeadings[j], - style: TextStyle( - fontSize: 14, - color: Color(0xFF818181), - decorationColor: - AppColors.grey_semi, - decoration: - TextDecoration.underline, - ), - ), - ) - : Text( - totalSubHeadings[j] == "" - ? "-" - : totalSubHeadings[j], - style: TextStyle( - fontSize: 14, - color: Color(0xFF818181), - ), - ), + message: + "${provider.leadDetails.createdDatetime}", + child: Text( + totalSubHeadings[j] == "" + ? "-" + : totalSubHeadings[j], + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + decorationColor: + AppColors.grey_semi, + decoration: + TextDecoration.underline, + ), + ), + ) + : Text( + totalSubHeadings[j] == "" + ? "-" + : totalSubHeadings[j], + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + ), + ), ), ), ], @@ -385,9 +385,9 @@ class _LeadDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => Productdetails( - leadID: provider.leadDetails.id, - mode: widget.mode, - ), + leadID: provider.leadDetails.id, + mode: widget.mode, + ), ), ); break; @@ -397,8 +397,8 @@ class _LeadDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => Contactdetails( - accID: provider.leadDetails.accId, - ), + accID: provider.leadDetails.accId, + ), ), ); break; @@ -416,8 +416,8 @@ class _LeadDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => AppointmentDetails( - leadID: provider.leadDetails.id, - ), + leadID: provider.leadDetails.id, + ), ), ); break; @@ -427,9 +427,9 @@ class _LeadDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => QuotationDetails( - leadID: provider.leadDetails.id, - mode: widget.mode, - ), + leadID: provider.leadDetails.id, + mode: widget.mode, + ), ), ); default: diff --git a/lib/screens/old/leadListOld.dart b/lib/screens/old/leadListOld.dart index 3cee8d0..b60c423 100644 --- a/lib/screens/old/leadListOld.dart +++ b/lib/screens/old/leadListOld.dart @@ -102,15 +102,15 @@ class _LeadlistbymodeOldState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -140,207 +140,207 @@ class _LeadlistbymodeOldState extends State { ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue, - ), - ), - ) - : crmLists.isNotEmpty - ? SizedBox( - child: Scrollbar( - thumbVisibility: false, - child: ListView.builder( - itemCount: crmLists.length, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemBuilder: (context, index) { - if (crmLists.isEmpty) { - return SizedBox( - child: Center(child: Text("No Data Available")), - ); - } - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, + ), ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Color(0xFFE6F6FF), - borderRadius: BorderRadius.circular( - 8, - ), - ), - child: SvgPicture.asset( - "assets/svg/se_block_head.svg", - ), - ), + ) + : crmLists.isNotEmpty + ? SizedBox( + child: Scrollbar( + thumbVisibility: false, + child: ListView.builder( + itemCount: crmLists.length, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemBuilder: (context, index) { + if (crmLists.isEmpty) { + return SizedBox( + child: Center(child: Text("No Data Available")), + ); + } + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - crmLists[index].company!, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Color(0xFFE6F6FF), + borderRadius: BorderRadius.circular( + 8, + ), + ), + child: SvgPicture.asset( + "assets/svg/se_block_head.svg", + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + crmLists[index].company!, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + ], + ), + ), + ), + Expanded( + flex: 2, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5, + vertical: 10, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + 8, + ), + color: Color(0xFFE3FFE0), + ), + child: Center( + child: Text( + crmLists[index].status!, + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: Color(0xFF0D9C00), + ), + ), + ), ), ), ], ), - ), - ), - Expanded( - flex: 2, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 5, - vertical: 10, + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), ), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - 8, - ), - color: Color(0xFFE3FFE0), - ), - child: Center( - child: Text( - crmLists[index].status!, - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: Color(0xFF0D9C00), - ), - ), - ), - ), - ), - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(4, (j) { - final headings = [ - "Account Manager", - "Contact Person", - "Product", - "Open Status", - ]; + ...List.generate(4, (j) { + final headings = [ + "Account Manager", + "Contact Person", + "Product", + "Open Status", + ]; - final subHeadings = [ - crmLists[index].accman, - crmLists[index].cname, - crmLists[index].product, - crmLists[index].openStatus, - ]; - return Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + final subHeadings = [ + crmLists[index].accman, + crmLists[index].cname, + crmLists[index].product, + crmLists[index].openStatus, + ]; + return Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + ), + Expanded( + child: Text( + subHeadings[j] ?? "-", + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + ), + ), + ), + ], ), - ), - ), - Expanded( - child: Text( - subHeadings[j] ?? "-", - style: TextStyle( - fontSize: 14, - color: Color(0xFF818181), + ); + }), + InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => LeadDetailsByMode( + pageTitleName: + widget.pageTitleName, + mode: widget.mode, + leadId: + provider + .crmLeadList[index] + .leadid, + ), + ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), ), ), ], ), ); - }), - InkResponse( - onTap: () async { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => LeadDetailsByMode( - pageTitleName: - widget.pageTitleName, - mode: widget.mode, - leadId: - provider - .crmLeadList[index] - .leadid, - ), - ), - ); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ), - ], + }, + ), ), - ); - }, - ), - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); @@ -412,26 +412,26 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.employeesList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.employeesList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: - provider.employeesList.contains( - provider.selectedEmployee, - ) - ? provider.selectedEmployee - : null, + provider.employeesList.contains( + provider.selectedEmployee, + ) + ? provider.selectedEmployee + : null, // value: provider.selectedEmployees, onChanged: (Employees? value) { @@ -441,15 +441,15 @@ class _LeadlistbymodeOldState extends State { .isNotEmpty) { provider.selectedEmployee = value; provider.selectedEmployeeId = - value!.id!; + value.id!; provider.selectedEmployeeValue = - value!.name!; + value.name!; provider .crmLeadListSourceOnReferenceAPIFunction( - context, - widget.mode, - provider.selectedSourceId, - ); + context, + widget.mode, + provider.selectedSourceId, + ); } } }, @@ -457,9 +457,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -477,20 +477,20 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.leadStatusList - .map( - (leadStatus) => - DropdownMenuItem( - value: leadStatus, - child: Text( - leadStatus!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.leadStatusList + .map( + (leadStatus) => + DropdownMenuItem( + value: leadStatus, + child: Text( + leadStatus!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedLeadStatus, onChanged: (String? value) { if (value != null) { @@ -501,9 +501,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -521,20 +521,20 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.openStatusList - .map( - (leadStatus) => - DropdownMenuItem( - value: leadStatus, - child: Text( - leadStatus!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.openStatusList + .map( + (leadStatus) => + DropdownMenuItem( + value: leadStatus, + child: Text( + leadStatus!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedOpenStatus, onChanged: (String? value) { if (value != null) { @@ -545,9 +545,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -585,35 +585,34 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.sourcesList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.sourcesList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedSource, onChanged: (Sources? value) { if (value != null) { if (provider.sourcesList.isNotEmpty) { provider.selectedSource = value; - provider.selectedSourceId = - value!.id!; + provider.selectedSourceId = value.id!; provider.selectedSourceValue = - value!.name!; + value.name!; provider .crmLeadListSourceOnReferenceAPIFunction( - context, - widget.mode, - provider.selectedSourceId, - ); + context, + widget.mode, + provider.selectedSourceId, + ); } } }, @@ -621,9 +620,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -641,20 +640,20 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.referencesList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.referencesList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedReference, onChanged: (References? value) { if (value != null) { @@ -663,9 +662,9 @@ class _LeadlistbymodeOldState extends State { .isNotEmpty) { provider.selectedReference = value; provider.selectedReferenceId = - value!.id!; + value.id!; provider.selectedReferenceValue = - value!.name!; + value.name!; } } }, @@ -673,9 +672,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -693,34 +692,34 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.teamsList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.teamsList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedTeam, onChanged: (Teams? value) { if (value != null) { if (provider.teamsList.isNotEmpty) { provider.selectedTeam = value; - provider.selectedTeamId = value!.id!; + provider.selectedTeamId = value.id!; provider.selectedTeamValue = - value!.name!; + value.name!; provider .crmLeadListSegmentOnTeamAPIFunction( - context, - widget.mode, - provider.selectedTeamId, - ); + context, + widget.mode, + provider.selectedTeamId, + ); } } }, @@ -728,9 +727,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -748,29 +747,29 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.segmentsList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.segmentsList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedSegment, onChanged: (Segments? value) { if (value != null) { if (provider.segmentsList.isNotEmpty) { provider.selectedSegment = value; provider.selectedSegmentId = - value!.id!; + value.id!; provider.selectedSegmentValue = - value!.name!; + value.name!; } } }, @@ -778,9 +777,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -798,28 +797,28 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.statesList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.statesList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedStates, onChanged: (States? value) { if (value != null) { if (provider.statesList.isNotEmpty) { provider.selectedStates = value; - provider.selectedStateId = value!.id!; + provider.selectedStateId = value.id!; provider.selectedStateValue = - value!.name!; + value.name!; if (provider .districtsList .isNotEmpty) { @@ -830,10 +829,10 @@ class _LeadlistbymodeOldState extends State { } provider .crmLeadListDistrictsOnStateAPIFunction( - context, - widget.mode, - provider.selectedStateId, - ); + context, + widget.mode, + provider.selectedStateId, + ); } } }, @@ -841,9 +840,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -861,29 +860,29 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.districtsList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.district!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.districtsList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.district!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedDistricts, onChanged: (Districts? value) { if (value != null) { if (provider.districtsList.isNotEmpty) { provider.selectedDistricts = value; provider.selectedDistrictId = - value!.id!; + value.id!; provider.selectedDistrictValue = - value!.district!; + value.district!; if (provider .subLocationsList .isNotEmpty) { @@ -891,16 +890,16 @@ class _LeadlistbymodeOldState extends State { // provider.selectedSubLocations = // null; provider.selectedSubLocationId = - null; + null; provider.selectedSubLocationValue = - ""; + ""; } provider .crmLeadListSubLocOnDistrictAPIFunction( - context, - widget.mode, - provider.selectedDistrictId, - ); + context, + widget.mode, + provider.selectedDistrictId, + ); } } }, @@ -908,9 +907,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -928,21 +927,21 @@ class _LeadlistbymodeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.subLocationsList - .map( - (slist) => DropdownMenuItem< - SubLocations - >( - value: slist, - child: Text( - slist.subLocality!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.subLocationsList + .map( + (slist) => DropdownMenuItem< + SubLocations + >( + value: slist, + child: Text( + slist.subLocality!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedSubLocations, onChanged: (SubLocations? value) { if (value != null) { @@ -951,9 +950,9 @@ class _LeadlistbymodeOldState extends State { .isNotEmpty) { provider.selectedSubLocations = value; provider.selectedSubLocationId = - value!.id!; + value.id!; provider.selectedSubLocationValue = - value!.subLocality!; + value.subLocality!; } } }, @@ -961,9 +960,9 @@ class _LeadlistbymodeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -981,7 +980,7 @@ class _LeadlistbymodeOldState extends State { provider.selectedReferenceId, provider.selectedTeamId, provider.selectedSegmentId, - "" + "", ); Navigator.pop(context); }, diff --git a/lib/screens/old/paymentListPayReqOld.dart b/lib/screens/old/paymentListPayReqOld.dart index 5db83ce..3eceb43 100644 --- a/lib/screens/old/paymentListPayReqOld.dart +++ b/lib/screens/old/paymentListPayReqOld.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:generp/Utils/GlobalConstants.dart'; @@ -17,7 +16,10 @@ import '../commonDateRangeFilter.dart'; class PaymentlistpaymentrequisitionOld extends StatefulWidget { final String pageTitleName; - const PaymentlistpaymentrequisitionOld({super.key, required this.pageTitleName}); + const PaymentlistpaymentrequisitionOld({ + super.key, + required this.pageTitleName, + }); @override State createState() => @@ -77,15 +79,15 @@ class _PaymentlistpaymentrequisitionOldState } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -143,266 +145,266 @@ class _PaymentlistpaymentrequisitionOldState ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue, - ), - ), - ) - : requestLists.isNotEmpty - ? SizedBox( - child: Scrollbar( - thumbVisibility: false, - - child: ListView.builder( - itemCount: requestLists.length, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemBuilder: (context, index) { - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, + ), ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Color(0xFFFFF3CE), - borderRadius: BorderRadius.circular( - 8, - ), - ), - child: SvgPicture.asset( - "assets/svg/fin_ic.svg", - ), - ), + ) + : requestLists.isNotEmpty + ? SizedBox( + child: Scrollbar( + thumbVisibility: false, + + child: ListView.builder( + itemCount: requestLists.length, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - requestLists[index] - .receipientAccount!, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Color(0xFFFFF3CE), + borderRadius: BorderRadius.circular( + 8, + ), + ), + child: SvgPicture.asset( + "assets/svg/fin_ic.svg", + ), ), ), - Text( - "₹${requestLists[index].amount}", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + requestLists[index] + .receipientAccount!, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + "₹${requestLists[index].amount}", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ], + ), ), ), + // Expanded( + // flex: 2, + // child: Container( + // padding: EdgeInsets.symmetric( + // horizontal: 5, + // vertical: 10, + // ), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(8), + // color: Color(0xFFE3FFE0), + // ), + // child: Center( + // child: Text( + // requestLists[index].refType!, + // textAlign: TextAlign.center, + // style: TextStyle( + // fontFamily: "JakartaMedium", + // fontSize: 14, + // color: Color(0xFF0D9C00), + // ), + // ), + // ), + // ), + // ), ], ), - ), - ), - // Expanded( - // flex: 2, - // child: Container( - // padding: EdgeInsets.symmetric( - // horizontal: 5, - // vertical: 10, - // ), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8), - // color: Color(0xFFE3FFE0), - // ), - // child: Center( - // child: Text( - // requestLists[index].refType!, - // textAlign: TextAlign.center, - // style: TextStyle( - // fontFamily: "JakartaMedium", - // fontSize: 14, - // color: Color(0xFF0D9C00), - // ), - // ), - // ), - // ), - // ), - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(5, (j) { - final headings = [ - "To Account", - "Attachment", - "Request Mode", + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), + ), + ...List.generate(5, (j) { + final headings = [ + "To Account", + "Attachment", + "Request Mode", - "Payment Date", - "Note", - ]; + "Payment Date", + "Note", + ]; - final subHeadings = [ - requestLists[index].payAccount, - "View", - requestLists[index].requestMode, + final subHeadings = [ + requestLists[index].payAccount, + "View", + requestLists[index].requestMode, - // requestLists[index].attachmentDirFilePath - requestLists[index].paymentDate, - requestLists[index].description, - ]; - if (headings[j] == "Attachment" && - requestLists[index] - .attachmentViewFileName == - "") { - return SizedBox.shrink(); - } - return Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, - ), - ), - ), - Expanded( - child: InkResponse( - onTap: - j != 1 - ? null - : () { - Navigator.push( - context, - MaterialPageRoute( - builder: - ( - context, - ) => Fileviewer( - fileName: - requestLists[index] - .attachmentViewFileName!, - fileUrl: - requestLists[index] - .attachmentDirFilePath!, + // requestLists[index].attachmentDirFilePath + requestLists[index].paymentDate, + requestLists[index].description, + ]; + if (headings[j] == "Attachment" && + requestLists[index] + .attachmentViewFileName == + "") { + return SizedBox.shrink(); + } + return Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), ), ), - ); - }, - child: Text( - subHeadings[j] == "" - ? "-" - : subHeadings[j] ?? "-", - style: TextStyle( - fontSize: 14, - color: - j == 1 - ? AppColors.app_blue - : Color(0xFF818181), - decoration: - j == 1 - ? TextDecoration - .underline - : TextDecoration.none, - decorationColor: - j == 1 - ? AppColors.app_blue - : AppColors.white, + Expanded( + child: InkResponse( + onTap: + j != 1 + ? null + : () { + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Fileviewer( + fileName: + requestLists[index] + .attachmentViewFileName!, + fileUrl: + requestLists[index] + .attachmentDirFilePath!, + ), + ), + ); + }, + child: Text( + subHeadings[j] == "" + ? "-" + : subHeadings[j] ?? "-", + style: TextStyle( + fontSize: 14, + color: + j == 1 + ? AppColors.app_blue + : Color(0xFF818181), + decoration: + j == 1 + ? TextDecoration + .underline + : TextDecoration.none, + decorationColor: + j == 1 + ? AppColors.app_blue + : AppColors.white, + ), + ), + ), + ), + ], + ), + ); + }), + InkResponse( + onTap: () async { + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Paymentdetailspaymentrequisition( + pageName: + widget.pageTitleName, + paymentRequestId: + requestLists[index].id, + ), + settings: RouteSettings( + name: + "Paymentdetailspaymentrequisition", + ), ), + ); + if (routeSettingName == + "Paymentdetailspaymentrequisition") { + print("pld"); + + provider.paymentsListAPI(context, '', ''); + } + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), ), ), ], ), ); - }), - InkResponse( - onTap: () async { - var res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Paymentdetailspaymentrequisition( - pageName: - widget.pageTitleName, - paymentRequestId: - requestLists[index].id, - ), - settings: RouteSettings( - name: - "Paymentdetailspaymentrequisition", - ), - ), - ); - if (routeSettingName == - "Paymentdetailspaymentrequisition") { - print("pld"); - - provider.paymentsListAPI(context, '', ''); - } - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ), - ], + }, + ), ), - ); - }, - ), - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); diff --git a/lib/screens/old/paymentreceiptListOld.dart b/lib/screens/old/paymentreceiptListOld.dart index 4d2cb83..ea5007f 100644 --- a/lib/screens/old/paymentreceiptListOld.dart +++ b/lib/screens/old/paymentreceiptListOld.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:generp/Utils/GlobalConstants.dart'; @@ -61,15 +60,15 @@ class _PaymentreceiptlistOldState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -127,239 +126,239 @@ class _PaymentreceiptlistOldState extends State { ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue, - ), - ), - ) - : requestLists.isNotEmpty - ? SizedBox( - child: Scrollbar( - child: ListView.builder( - itemCount: requestLists.length, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemBuilder: (context, index) { - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, + ), ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Color(0xFFFFF3CE), - borderRadius: BorderRadius.circular( - 8, - ), - ), - child: SvgPicture.asset( - "assets/svg/fin_ic.svg", - ), - ), + ) + : requestLists.isNotEmpty + ? SizedBox( + child: Scrollbar( + child: ListView.builder( + itemCount: requestLists.length, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - requestLists[index] - .receipientAccount!, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Color(0xFFFFF3CE), + borderRadius: BorderRadius.circular( + 8, + ), + ), + child: SvgPicture.asset( + "assets/svg/fin_ic.svg", + ), ), ), - Text( - "₹${requestLists[index].amount}", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + requestLists[index] + .receipientAccount!, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + "₹${requestLists[index].amount}", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ], + ), ), ), ], ), - ), - ), - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(5, (j) { - final headings = [ - "Receipt Account", - "Attachment", - "Request Mode", + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), + ), + ...List.generate(5, (j) { + final headings = [ + "Receipt Account", + "Attachment", + "Request Mode", - "Receipt Date", - "Note", - ]; + "Receipt Date", + "Note", + ]; - final subHeadings = [ - requestLists[index].receipientAccount, - "View", - requestLists[index].requestMode, + final subHeadings = [ + requestLists[index].receipientAccount, + "View", + requestLists[index].requestMode, - // requestLists[index].attachmentDirFilePath - requestLists[index].receiptDate, - requestLists[index].description, - ]; - if (headings[j] == "Attachment" && - requestLists[index] - .attachmentViewFileName == - "") { - return SizedBox.shrink(); - } - return Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, - ), - ), - ), - Expanded( - child: InkResponse( - onTap: - j != 1 - ? null - : () { - Navigator.push( - context, - MaterialPageRoute( - builder: - ( - context, - ) => Fileviewer( - fileName: - requestLists[index] - .attachmentViewFileName!, - fileUrl: - requestLists[index] - .attachmentDirFilePath!, + // requestLists[index].attachmentDirFilePath + requestLists[index].receiptDate, + requestLists[index].description, + ]; + if (headings[j] == "Attachment" && + requestLists[index] + .attachmentViewFileName == + "") { + return SizedBox.shrink(); + } + return Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), ), ), - ); - }, - child: Text( - subHeadings[j] == "" - ? "-" - : subHeadings[j] ?? "-", - style: TextStyle( - fontSize: 14, - color: - j == 1 - ? AppColors.app_blue - : Color(0xFF818181), - decoration: - j == 1 - ? TextDecoration - .underline - : TextDecoration.none, - decorationColor: - j == 1 - ? AppColors.app_blue - : AppColors.white, + Expanded( + child: InkResponse( + onTap: + j != 1 + ? null + : () { + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Fileviewer( + fileName: + requestLists[index] + .attachmentViewFileName!, + fileUrl: + requestLists[index] + .attachmentDirFilePath!, + ), + ), + ); + }, + child: Text( + subHeadings[j] == "" + ? "-" + : subHeadings[j] ?? "-", + style: TextStyle( + fontSize: 14, + color: + j == 1 + ? AppColors.app_blue + : Color(0xFF818181), + decoration: + j == 1 + ? TextDecoration + .underline + : TextDecoration.none, + decorationColor: + j == 1 + ? AppColors.app_blue + : AppColors.white, + ), + ), + ), + ), + ], + ), + ); + }), + InkResponse( + onTap: () async { + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Paymentreceiptdetails( + pageName: widget.pageTitleName, + paymentRequestId: + requestLists[index].id, + ), + settings: RouteSettings( + name: "Paymentreceiptdetails", + ), ), + ); + if (routeSettingName == + "Paymentreceiptdetails") { + debugPrint("prd"); + provider.paymentsListAPI(context, '', ''); + } + // if (res == true) { + // provider.paymentsListAPI(context, '', ''); + // } + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), ), ), ], ), ); - }), - InkResponse( - onTap: () async { - var res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Paymentreceiptdetails( - pageName: widget.pageTitleName, - paymentRequestId: - requestLists[index].id, - ), - settings: RouteSettings( - name: "Paymentreceiptdetails", - ), - ), - ); - if (routeSettingName == - "Paymentreceiptdetails") { - debugPrint("prd"); - provider.paymentsListAPI(context, '', ''); - } - // if (res == true) { - // provider.paymentsListAPI(context, '', ''); - // } - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ), - ], + }, + ), ), - ); - }, - ), - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); diff --git a/lib/screens/old/prospectDetailsOld.dart b/lib/screens/old/prospectDetailsOld.dart index e6830cc..192f9e0 100644 --- a/lib/screens/old/prospectDetailsOld.dart +++ b/lib/screens/old/prospectDetailsOld.dart @@ -36,7 +36,8 @@ class ProspectDetailsByModeOld extends StatefulWidget { }); @override - State createState() => ProspectDetailsByModeOldState(); + State createState() => + ProspectDetailsByModeOldState(); } class ProspectDetailsByModeOldState extends State { @@ -100,9 +101,9 @@ class ProspectDetailsByModeOldState extends State { editProvider.accountDetails.salutationName != null) { editProvider.selectedSalutation = editProvider.salutationList.firstWhere( - (element) => element == editProvider.accountDetails.salutationName, + (element) => element == editProvider.accountDetails.salutationName, ) ?? - editProvider.salutationList.first; + editProvider.salutationList.first; } // print("States:${editProvider.statesList.toList()}"); @@ -110,53 +111,47 @@ class ProspectDetailsByModeOldState extends State { editProvider.accountDetails.state != null) { print(editProvider.accountDetails.state); final selectedState = editProvider.statesList.firstWhere( - (element) => - element.id!.trim() == editProvider.accountDetails.state!.trim(), + (element) => + element.id!.trim() == editProvider.accountDetails.state!.trim(), ); - if (selectedState != null) { - editProvider.selectedStates = selectedState; - editProvider.selectedStateId = selectedState.id; - editProvider.selectedStateValue = selectedState.name; + editProvider.selectedStates = selectedState; + editProvider.selectedStateId = selectedState.id; + editProvider.selectedStateValue = selectedState.name; - await editProvider.crmLeadListDistrictsOnStateAPIFunction( - context, - widget.mode, - editProvider.selectedStateId, - ); - } + await editProvider.crmLeadListDistrictsOnStateAPIFunction( + context, + widget.mode, + editProvider.selectedStateId, + ); } // Prefill district if (editProvider.districtsList.isNotEmpty && editProvider.accountDetails.district != null) { final selectedDistrict = editProvider.districtsList.firstWhere( - (element) => - element.id!.trim() == editProvider.accountDetails.district!.trim(), + (element) => + element.id!.trim() == editProvider.accountDetails.district!.trim(), ); - if (selectedDistrict != null) { - editProvider.selectedDistricts = selectedDistrict; - editProvider.selectedDistrictId = selectedDistrict.id; - editProvider.selectedDistrictValue = selectedDistrict.district; + editProvider.selectedDistricts = selectedDistrict; + editProvider.selectedDistrictId = selectedDistrict.id; + editProvider.selectedDistrictValue = selectedDistrict.district; - await editProvider.crmLeadListSubLocOnDistrictAPIFunction( - context, - widget.mode, - editProvider.selectedDistrictId, - ); - } + await editProvider.crmLeadListSubLocOnDistrictAPIFunction( + context, + widget.mode, + editProvider.selectedDistrictId, + ); } if (editProvider.subLocationsList.isNotEmpty && editProvider.accountDetails.subLocality != null) { final selectedSubLocation = editProvider.subLocationsList.firstWhere( - (element) => element.id == editProvider.accountDetails.subLocality, + (element) => element.id == editProvider.accountDetails.subLocality, ); - if (selectedSubLocation != null) { - editProvider.selectedSubLocations = selectedSubLocation; - editProvider.selectedSubLocationId = selectedSubLocation.id; - editProvider.selectedSubLocationValue = selectedSubLocation.subLocality; - } + editProvider.selectedSubLocations = selectedSubLocation; + editProvider.selectedSubLocationId = selectedSubLocation.id; + editProvider.selectedSubLocationValue = selectedSubLocation.subLocality; } print("Company Name: ${editProvider.editCompanyNameController.text}"); @@ -188,22 +183,22 @@ class ProspectDetailsByModeOldState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } Widget _scaffold(BuildContext context) { return Consumer2< - crmProspectDetailsProvider, - Crmeditprospectaccountprovider + crmProspectDetailsProvider, + Crmeditprospectaccountprovider >( builder: (context, provider, editProvider, child) { var leadDetails = provider.accountDetails; @@ -336,35 +331,35 @@ class ProspectDetailsByModeOldState extends State { Expanded( child: InkResponse( child: - provider.Headings[j] == "Lead Age" - ? Tooltip( - triggerMode: TooltipTriggerMode.tap, + provider.Headings[j] == "Lead Age" + ? Tooltip( + triggerMode: TooltipTriggerMode.tap, - message: - "${provider.accountDetails.createdDatetime}", - child: Text( - provider.subHeadings[j] == "" - ? "-" - : provider.subHeadings[j], - style: TextStyle( - fontSize: 14, - color: Color(0xFF818181), - decorationColor: - AppColors.grey_semi, - decoration: - TextDecoration.underline, - ), - ), - ) - : Text( - provider.subHeadings[j] == "" - ? "-" - : provider.subHeadings[j], - style: TextStyle( - fontSize: 14, - color: Color(0xFF818181), - ), - ), + message: + "${provider.accountDetails.createdDatetime}", + child: Text( + provider.subHeadings[j] == "" + ? "-" + : provider.subHeadings[j], + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + decorationColor: + AppColors.grey_semi, + decoration: + TextDecoration.underline, + ), + ), + ) + : Text( + provider.subHeadings[j] == "" + ? "-" + : provider.subHeadings[j], + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + ), + ), ), ), ], @@ -433,27 +428,27 @@ class ProspectDetailsByModeOldState extends State { style: TextStyle(fontSize: 14), ), items: - editProsProvider.employeesList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + editProsProvider.employeesList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: - editProsProvider.employeesList.contains( - editProsProvider - .selectedEmployees, - ) - ? editProsProvider.selectedEmployees - : null, + editProsProvider.employeesList.contains( + editProsProvider + .selectedEmployees, + ) + ? editProsProvider.selectedEmployees + : null, // value: provider.selectedEmployees, onChanged: (Employees? value) { @@ -464,10 +459,10 @@ class ProspectDetailsByModeOldState extends State { editProsProvider.selectedEmployees = value; editProsProvider.selectedEmployeeId = - value!.id!; + value.id!; editProsProvider - .selectedEmployeeValue = - value!.name!; + .selectedEmployeeValue = + value.name!; } } }, @@ -475,33 +470,33 @@ class ProspectDetailsByModeOldState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - editProsProvider.searchController, + editProsProvider.searchController, searchInnerWidget: Padding( padding: const EdgeInsets.all(8), child: TextFormField( controller: - editProsProvider.searchController, + editProsProvider.searchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), hintText: 'Search account...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular(8), + BorderRadius.circular(8), ), ), ), ), searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue.toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), @@ -514,9 +509,9 @@ class ProspectDetailsByModeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -525,17 +520,17 @@ class ProspectDetailsByModeOldState extends State { InkWell( onTap: - editProsProvider.isLoading - ? null - : () { - editProsProvider.isLoading = true; - editProsProvider - .crmProspectDetailsTransferAccountAPIFunction( - context, - accID, - editProsProvider.selectedEmployeeId, - ); - }, + editProsProvider.isLoading + ? null + : () { + editProsProvider.isLoading = true; + editProsProvider + .crmProspectDetailsTransferAccountAPIFunction( + context, + accID, + editProsProvider.selectedEmployeeId, + ); + }, child: Container( alignment: Alignment.center, height: 45, @@ -551,17 +546,17 @@ class ProspectDetailsByModeOldState extends State { ), child: Center( child: - editProsProvider.isLoading - ? CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.white, - ), - ) - : Text( - "Submit", - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), - ), + editProsProvider.isLoading + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.white, + ), + ) + : Text( + "Submit", + textAlign: TextAlign.center, + style: TextStyle(color: Colors.white), + ), ), ), ), @@ -592,8 +587,8 @@ class ProspectDetailsByModeOldState extends State { builder: (context, setState) { return SafeArea( child: Consumer2< - Crmeditprospectaccountprovider, - crmProspectDetailsProvider + Crmeditprospectaccountprovider, + crmProspectDetailsProvider >( builder: (context, provider, prosDetProvider, child) { return Container( @@ -637,20 +632,20 @@ class ProspectDetailsByModeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.salutationList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.salutationList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedSalutation, onChanged: (String? value) { if (value != null) { @@ -665,9 +660,9 @@ class ProspectDetailsByModeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -697,33 +692,33 @@ class ProspectDetailsByModeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.statesList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.statesList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: - provider.statesList.contains( - provider.selectedStates, - ) - ? provider.selectedStates - : null, + provider.statesList.contains( + provider.selectedStates, + ) + ? provider.selectedStates + : null, onChanged: (States? value) { if (value != null) { if (provider.statesList.isNotEmpty) { provider.selectedStates = value; - provider.selectedStateId = value!.id!; + provider.selectedStateId = value.id!; provider.selectedStateValue = - value!.name!; + value.name!; if (provider .districtsList .isNotEmpty) { @@ -734,10 +729,10 @@ class ProspectDetailsByModeOldState extends State { } provider .crmLeadListDistrictsOnStateAPIFunction( - context, - widget.mode, - provider.selectedStateId, - ); + context, + widget.mode, + provider.selectedStateId, + ); } } }, @@ -745,9 +740,9 @@ class ProspectDetailsByModeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -765,57 +760,57 @@ class ProspectDetailsByModeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.districtsList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.district!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.districtsList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.district!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: - provider.districtsList.contains( - provider.selectedDistricts, - ) - ? provider.selectedDistricts - : null, + provider.districtsList.contains( + provider.selectedDistricts, + ) + ? provider.selectedDistricts + : null, // value: provider.selectedDistricts, onChanged: (Districts? value) { if (value != null) { if (provider.districtsList.isNotEmpty) { provider.selectedDistricts = value; provider.selectedDistrictId = - value!.id!; + value.id!; provider.selectedDistrictValue = - value!.district!; + value.district!; if (provider .subLocationsList .isNotEmpty) { provider.subLocationsList.clear(); provider.selectedSubLocations = - null; + null; provider.selectedSubLocationId = - null; + null; provider.selectedSubLocationValue = - ""; + ""; } provider .crmLeadListSubLocOnDistrictAPIFunction( - context, - widget.mode, - provider.selectedDistrictId, - ); + context, + widget.mode, + provider.selectedDistrictId, + ); prosDetProvider .crmProspectDetailsAPIFunction( - context, - widget.leadId, - ); + context, + widget.leadId, + ); } } }, @@ -823,9 +818,9 @@ class ProspectDetailsByModeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -843,27 +838,27 @@ class ProspectDetailsByModeOldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.subLocationsList - .map( - (slist) => DropdownMenuItem< - SubLocations - >( - value: slist, - child: Text( - slist.subLocality!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.subLocationsList + .map( + (slist) => DropdownMenuItem< + SubLocations + >( + value: slist, + child: Text( + slist.subLocality!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: - provider.subLocationsList.contains( - provider.selectedSubLocations, - ) - ? provider.selectedSubLocations - : null, + provider.subLocationsList.contains( + provider.selectedSubLocations, + ) + ? provider.selectedSubLocations + : null, // value: provider.selectedSubLocations, onChanged: (SubLocations? value) { if (value != null) { @@ -872,9 +867,9 @@ class ProspectDetailsByModeOldState extends State { .isNotEmpty) { provider.selectedSubLocations = value; provider.selectedSubLocationId = - value!.id!; + value.id!; provider.selectedSubLocationValue = - value!.subLocality!; + value.subLocality!; } } }, @@ -882,9 +877,9 @@ class ProspectDetailsByModeOldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], @@ -916,21 +911,21 @@ class ProspectDetailsByModeOldState extends State { InkResponse( onTap: - provider.isLoading - ? null - : () { - provider.isLoading = true; - provider - .crmProspectDetailsEditAccountSubmitAPIFunction( - context, - accID, - provider.selectedSalutation, - provider.selectedStateId, - provider.selectedDistrictId, - provider.selectedSubLocationId, - ); - Navigator.pop(context); - }, + provider.isLoading + ? null + : () { + provider.isLoading = true; + provider + .crmProspectDetailsEditAccountSubmitAPIFunction( + context, + accID, + provider.selectedSalutation, + provider.selectedStateId, + provider.selectedDistrictId, + provider.selectedSubLocationId, + ); + Navigator.pop(context); + }, child: Container( height: 45, alignment: Alignment.center, @@ -944,20 +939,20 @@ class ProspectDetailsByModeOldState extends State { borderRadius: BorderRadius.circular(15), ), child: - provider.isLoading - ? CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.white, - ), - ) - : Text( - "Submit", - style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - color: Colors.white, - ), - ), + provider.isLoading + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.white, + ), + ) + : Text( + "Submit", + style: TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + color: Colors.white, + ), + ), ), ), ], @@ -1026,9 +1021,9 @@ class ProspectDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => ProspectLeadDetails( - leadID: widget.leadId, - mode: widget.mode, - ), + leadID: widget.leadId, + mode: widget.mode, + ), ), ); break; @@ -1038,9 +1033,9 @@ class ProspectDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => ProspectContactDetails( - accountId: - provider.accountDetails.id, - ), + accountId: + provider.accountDetails.id, + ), ), ); break; @@ -1050,8 +1045,8 @@ class ProspectDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => ProspectOrderDetails( - leadID: widget.leadId, - ), + leadID: widget.leadId, + ), ), ); break; @@ -1061,8 +1056,8 @@ class ProspectDetailsByModeOldState extends State { MaterialPageRoute( builder: (context) => ProspectPaymentDetails( - leadID: widget.leadId, - ), + leadID: widget.leadId, + ), ), ); break; diff --git a/lib/screens/old/prospectListold.dart b/lib/screens/old/prospectListold.dart index 2ab77f6..c3330c8 100644 --- a/lib/screens/old/prospectListold.dart +++ b/lib/screens/old/prospectListold.dart @@ -69,15 +69,15 @@ class _ProspectListByModeoldState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } @@ -108,187 +108,187 @@ class _ProspectListByModeoldState extends State { ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue, - ), - ), - ) - : crmLists.isNotEmpty - ? SizedBox( - child: Scrollbar( - thumbVisibility: false, - child: ListView.builder( - itemCount: crmLists.length, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemBuilder: (context, index) { - if (crmLists.isEmpty) { - return SizedBox( - child: Center(child: Text("No Data Available")), - ); - } - - // if(crmLists[index].aid=="1726"){ - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, + ), ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Color(0xFFE6F6FF), - borderRadius: BorderRadius.circular( - 8, - ), - ), - child: SvgPicture.asset( - "assets/svg/se_block_head.svg", - ), - ), + ) + : crmLists.isNotEmpty + ? SizedBox( + child: Scrollbar( + thumbVisibility: false, + child: ListView.builder( + itemCount: crmLists.length, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemBuilder: (context, index) { + if (crmLists.isEmpty) { + return SizedBox( + child: Center(child: Text("No Data Available")), + ); + } + + // if(crmLists[index].aid=="1726"){ + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - crmLists[index].aname!, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Color(0xFFE6F6FF), + borderRadius: BorderRadius.circular( + 8, + ), + ), + child: SvgPicture.asset( + "assets/svg/se_block_head.svg", + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + crmLists[index].aname!, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + ], + ), ), ), ], ), - ), - ), - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(6, (j) { - final headings = [ - "Account Manager", - "Contact Person", - "Mobile Number", - "Address", - "Account Age", - "GST Number", - ]; + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), + ), + ...List.generate(6, (j) { + final headings = [ + "Account Manager", + "Contact Person", + "Mobile Number", + "Address", + "Account Age", + "GST Number", + ]; - final subHeadings = [ - crmLists[index].accman, - crmLists[index].cname, - crmLists[index].mob1, - crmLists[index].address, - "${crmLists[index].age} days old", - crmLists[index].gstNumber, - ]; - return Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, + final subHeadings = [ + crmLists[index].accman, + crmLists[index].cname, + crmLists[index].mob1, + crmLists[index].address, + "${crmLists[index].age} days old", + crmLists[index].gstNumber, + ]; + return Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + ), + Expanded( + child: Text( + subHeadings[j]!, + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + ), + ), + ), + ], ), - ), - ), - Expanded( - child: Text( - subHeadings[j]!, - style: TextStyle( - fontSize: 14, - color: Color(0xFF818181), + ); + }), + InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => ProspectDetailsByMode( + pageTitleName: + widget.pageTitleName, + mode: widget.mode, + leadId: + provider + .accountList[index] + .aid, + ), + ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), ), ), ], ), ); - }), - InkResponse( - onTap: () async { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => ProspectDetailsByMode( - pageTitleName: - widget.pageTitleName, - mode: widget.mode, - leadId: - provider - .accountList[index] - .aid, - ), - ), - ); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 5), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ), - ], + }, + ), ), - ); - }, - ), - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); @@ -352,26 +352,26 @@ class _ProspectListByModeoldState extends State { style: TextStyle(fontSize: 14), ), items: - provider.employeesList - .map( - (slist) => - DropdownMenuItem( - value: slist, - child: Text( - slist.name!, - style: TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.employeesList + .map( + (slist) => + DropdownMenuItem( + value: slist, + child: Text( + slist.name!, + style: TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: - provider.employeesList.contains( - provider.selectedEmployees, - ) - ? provider.selectedEmployees - : null, + provider.employeesList.contains( + provider.selectedEmployees, + ) + ? provider.selectedEmployees + : null, // value: provider.selectedEmployees, onChanged: (Employees? value) { @@ -381,9 +381,9 @@ class _ProspectListByModeoldState extends State { .isNotEmpty) { provider.selectedEmployees = value; provider.selectedEmployeeId = - value!.id!; + value.id!; provider.selectedEmployeeValue = - value!.name!; + value.name!; } } }, @@ -391,33 +391,33 @@ class _ProspectListByModeoldState extends State { dropdownSearchData: DropdownSearchData( searchInnerWidgetHeight: 50, searchController: - provider.searchController, + provider.searchController, searchInnerWidget: Padding( padding: const EdgeInsets.all(8), child: TextFormField( controller: - provider.searchController, + provider.searchController, decoration: InputDecoration( isDense: true, contentPadding: - const EdgeInsets.symmetric( - horizontal: 10, - vertical: 8, - ), + const EdgeInsets.symmetric( + horizontal: 10, + vertical: 8, + ), hintText: 'Search account...', border: OutlineInputBorder( borderRadius: - BorderRadius.circular(8), + BorderRadius.circular(8), ), ), ), ), searchMatchFn: (item, searchValue) { return item.value?.name - ?.toLowerCase() - .contains( - searchValue.toLowerCase(), - ) ?? + ?.toLowerCase() + .contains( + searchValue.toLowerCase(), + ) ?? false; }, ), @@ -429,9 +429,9 @@ class _ProspectListByModeoldState extends State { buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, menuItemStyleData: - ddtheme.menuItemStyleData, + ddtheme.menuItemStyleData, dropdownStyleData: - ddtheme.dropdownStyleData, + ddtheme.dropdownStyleData, ), ), ], diff --git a/lib/screens/order/addOrder.dart b/lib/screens/order/addOrder.dart index e5cbc93..c60033e 100644 --- a/lib/screens/order/addOrder.dart +++ b/lib/screens/order/addOrder.dart @@ -152,7 +152,6 @@ class _AddorderScreenState extends State { Widget _scaffold(BuildContext context) { return Consumer( builder: (context, provider, child) { - return WillPopScope( child: SafeArea( top: false, @@ -296,14 +295,13 @@ class _AddorderScreenState extends State { if (value != null) { print('Selected account: ${value.text}'); provider.selectedAccountList = (value); - provider.selectedAccountID = value!.id!; - provider.selectedAccountName = value!.text!; + provider.selectedAccountID = value.id!; + provider.selectedAccountName = value.text!; provider .ordersAddOrderAccountDetailsAPIFunction( context, value.id, ); - } }, selectedItem: provider.selectedAccountList, @@ -353,7 +351,6 @@ class _AddorderScreenState extends State { // }, ), - if (provider.selectAccountError != null) ...[ errorWidget( context, @@ -1153,38 +1150,37 @@ class _AddorderScreenState extends State { .isNotEmpty ? provider.selectedDispatchDistricts != null - ? provider.dispatchDistricts - .firstWhere( - (ord) => - ord.id == - provider - .selectedDispatchDistrictId, + ? provider.dispatchDistricts.firstWhere( + (ord) => + ord.id == + provider + .selectedDispatchDistrictId, - orElse: () { - provider.selectedDispatchDistricts = - provider - .dispatchDistricts[0]; - provider.selectedDispatchDistrictId = - provider - .dispatchDistricts[0] - .id; - provider.selectedDispatchDistrictValue = - provider - .dispatchDistricts[0] - .district; - provider.getDispatchSubLocationAPI( - context, - provider - .selectedBillingDistrictId, - ); - return provider - .dispatchDistricts[0]; - }, - // orElse: - // () => - // provider - // .dispatchDistricts[0], - ) + orElse: () { + provider.selectedDispatchDistricts = + provider + .dispatchDistricts[0]; + provider.selectedDispatchDistrictId = + provider + .dispatchDistricts[0] + .id; + provider.selectedDispatchDistrictValue = + provider + .dispatchDistricts[0] + .district; + provider.getDispatchSubLocationAPI( + context, + provider + .selectedBillingDistrictId, + ); + return provider + .dispatchDistricts[0]; + }, + // orElse: + // () => + // provider + // .dispatchDistricts[0], + ) : null : null, onChanged: (Districts? value) { @@ -1311,36 +1307,34 @@ class _AddorderScreenState extends State { .isNotEmpty ? provider.selectedDispatchSubLocations != null - ? provider - .dispatchSubLocations - .firstWhere( - (ord) => - ord.id == - provider - .selectedDispatchSubLocID, + ? provider.dispatchSubLocations.firstWhere( + (ord) => + ord.id == + provider + .selectedDispatchSubLocID, - orElse: () { - provider.selectedDispatchSubLocations = - provider - .dispatchSubLocations[0]; - provider.selectedDispatchSubLocID = - provider - .dispatchSubLocations[0] - .id; - provider.selectedDispatchSubLocValue = - provider - .dispatchSubLocations[0] - .subLocality; + orElse: () { + provider.selectedDispatchSubLocations = + provider + .dispatchSubLocations[0]; + provider.selectedDispatchSubLocID = + provider + .dispatchSubLocations[0] + .id; + provider.selectedDispatchSubLocValue = + provider + .dispatchSubLocations[0] + .subLocality; - return provider - .dispatchSubLocations[0]; - }, + return provider + .dispatchSubLocations[0]; + }, - // orElse: - // () => - // provider - // .dispatchSubLocations[0], - ) + // orElse: + // () => + // provider + // .dispatchSubLocations[0], + ) : null : null, onChanged: (SubLocations? value) { @@ -1681,11 +1675,11 @@ class _AddorderScreenState extends State { scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(15), thickness: - MaterialStateProperty.all< - double - >(6), + WidgetStateProperty.all( + 6, + ), thumbVisibility: - MaterialStateProperty.all( + WidgetStateProperty.all( true, ), ), @@ -1902,9 +1896,9 @@ class _AddorderScreenState extends State { if (value != null) { print('Selected account: ${value.text}'); provider.selectedTpcAgent = (value); - provider.selectedTpcAgentID = value!.id!; + provider.selectedTpcAgentID = value.id!; provider.selectedTpcAgentValue = - value!.text!; + value.text!; } }, selectedItem: provider.selectedTpcAgent, @@ -2156,7 +2150,8 @@ class _AddorderScreenState extends State { widget.mode, provider.selectedEmployeeID, provider.selectedAccountID, - provider.selectedDispatchStateID, + provider + .selectedDispatchStateID, provider .selectedDispatchDistrictId, provider @@ -2501,9 +2496,7 @@ class _AddorderScreenState extends State { provider.selectedAccountName = provider.accountList[index].text!; print( - "hfjkshfg" + - provider.selectedAccountID - .toString(), + "hfjkshfg${provider.selectedAccountID}", ); provider.dropDownSearchController.text = provider.accountList[index].text!; @@ -2644,8 +2637,8 @@ class _AddorderScreenState extends State { null, TextInputAction.done, ), - if(provider.billingNameError!=null) - errorWidget(context, provider.billingNameError), + if (provider.billingNameError != null) + errorWidget(context, provider.billingNameError), TextWidget(context, "Billing State"), //dd DropdownButtonHideUnderline( @@ -2759,8 +2752,11 @@ class _AddorderScreenState extends State { ], ), ), - if(provider.selectedBillingStateError!=null) - errorWidget(context, provider.selectedBillingStateError), + if (provider.selectedBillingStateError != null) + errorWidget( + context, + provider.selectedBillingStateError, + ), TextWidget(context, "Billing District"), //dd DropdownButtonHideUnderline( @@ -2875,11 +2871,11 @@ class _AddorderScreenState extends State { ], ), ), - if(provider.selectedBillingDistrictError!=null) - errorWidget( - context, - provider.selectedBillingDistrictError, - ), + if (provider.selectedBillingDistrictError != null) + errorWidget( + context, + provider.selectedBillingDistrictError, + ), TextWidget(context, "Billing Sub Location"), //dd DropdownButtonHideUnderline( @@ -2982,8 +2978,11 @@ class _AddorderScreenState extends State { ], ), ), - if(provider.selectedBillingSubLocError!=null) - errorWidget(context, provider.selectedBillingSubLocError), + if (provider.selectedBillingSubLocError != null) + errorWidget( + context, + provider.selectedBillingSubLocError, + ), textControllerWidget( context, provider.billingAddressController, @@ -2997,8 +2996,8 @@ class _AddorderScreenState extends State { focusNodes[2], TextInputAction.next, ), - if(provider.billingAddressError!=null) - errorWidget(context, provider.billingAddressError), + if (provider.billingAddressError != null) + errorWidget(context, provider.billingAddressError), textControllerWidget( context, @@ -3014,8 +3013,8 @@ class _AddorderScreenState extends State { TextInputAction.done, 6, ), - if(provider.billingPincodeError!=null) - errorWidget(context, provider.billingPincodeError), + if (provider.billingPincodeError != null) + errorWidget(context, provider.billingPincodeError), TextWidget(context, "Dispatch State"), DropdownButtonHideUnderline( @@ -3571,10 +3570,11 @@ class _AddorderScreenState extends State { ), scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(15), - thickness: - MaterialStateProperty.all(6), + thickness: WidgetStateProperty.all( + 6, + ), thumbVisibility: - MaterialStateProperty.all(true), + WidgetStateProperty.all(true), ), ), menuItemStyleData: const MenuItemStyleData( @@ -3764,9 +3764,7 @@ class _AddorderScreenState extends State { provider.selectedTpcAgentValue = provider.tpcAgent[index].text!; print( - "hfjkshfg" + - provider.selectedTpcAgentID - .toString(), + "hfjkshfg${provider.selectedTpcAgentID}", ); provider .dropDownTpcSearchController @@ -3937,7 +3935,7 @@ class _AddorderScreenState extends State { Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -3948,7 +3946,7 @@ class _AddorderScreenState extends State { Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), @@ -3999,7 +3997,7 @@ class OrderForm extends StatelessWidget { ), ); if (res != null) { - print("result ${res}"); + print("result $res"); } }, child: Container( @@ -4063,7 +4061,7 @@ class OrderForm extends StatelessWidget { ), ); if (res != null) { - print("result ${res}"); + print("result $res"); } }, child: Container( diff --git a/lib/screens/order/addPayment.dart b/lib/screens/order/addPayment.dart index bb4a648..9afdea2 100644 --- a/lib/screens/order/addPayment.dart +++ b/lib/screens/order/addPayment.dart @@ -16,6 +16,7 @@ import '../../Utils/commonWidgets.dart'; import '../../Utils/dropdownTheme.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:generp/Utils/commonServices.dart'; + class AddpaymentScreen extends StatefulWidget { final pageTitleName; final mode; @@ -62,7 +63,7 @@ class _AddpaymentScreenState extends State { @override void dispose() { - focusNodes.map((e)=>e.dispose()); + focusNodes.map((e) => e.dispose()); _connectivity.disposeStream(); super.dispose(); } @@ -85,664 +86,708 @@ class _AddpaymentScreenState extends State { default: connection = 'Offline'; } - return connection=="Online"? Consumer( - builder: (context, provider, child) { - return WillPopScope( - child: SafeArea( - top: false, - bottom: Platform.isIOS?false:true, - child: Scaffold( - resizeToAvoidBottomInset: true, - backgroundColor: AppColors.white, - appBar: appbar2New( - context, - "${widget.pageTitleName}", - provider.resetForm, - SizedBox(width: 0), - 0xFFFFFFFF - ), - body: Container( - padding: EdgeInsets.symmetric(horizontal: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - ), - child: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - TextWidget(context, "Account"), - Container( - alignment: Alignment.center, - decoration: BoxDecoration( - color: AppColors.text_field_color, - borderRadius: BorderRadius.circular(14), - ), - child: ListTile( - title: TextFormField( - focusNode: focusNode, - onTapUpOutside: (event) { - focusNode.unfocus(); - }, - controller: provider.dropDownSearchController, - onChanged: (value) async { - Future.delayed( - Duration(milliseconds: 100), - () async { - await provider - .ordersAddPaymentSelectAccountAPIFunction( - context, - widget.mode, - provider.selectedAccountID, - value, - ); - }, - ); - }, - decoration: InputDecoration( - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, - isDense: true, - contentPadding: const EdgeInsets.symmetric( - horizontal: 0, - vertical: 8, - ), - hintText: 'Select Account Type', - hintStyle: const TextStyle(fontSize: 14), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), - ), - ), - ), - - trailing: InkResponse( - onTap: () { - if (focusNode.hasFocus) { - focusNode.unfocus(); - } else { - FocusScope.of(context).requestFocus(focusNode); - } - }, - child: SvgPicture.asset( - "assets/svg/arrow_dropdown.svg", - height: 25, - width: 20, - ), - ), - ), - ), - - if (provider.accountList.isNotEmpty && - focusNode.hasFocus) ...[ - Card( - margin: EdgeInsets.symmetric(horizontal: 0), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 10), - height: widget.mode=="self"?50:150, + return connection == "Online" + ? Consumer( + builder: (context, provider, child) { + return WillPopScope( + child: SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + backgroundColor: AppColors.white, + appBar: appbar2New( + context, + "${widget.pageTitleName}", + provider.resetForm, + SizedBox(width: 0), + 0xFFFFFFFF, + ), + body: Container( + padding: EdgeInsets.symmetric(horizontal: 10), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextWidget(context, "Account"), + Container( + alignment: Alignment.center, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), + color: AppColors.text_field_color, + borderRadius: BorderRadius.circular(14), ), - child: Scrollbar( - thickness: 2.5, - radius: Radius.circular(6), - thumbVisibility: true, - child: ListView.builder( - itemCount: provider.accountList.length, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemBuilder: (context, index) { - return InkResponse( - onTap: () async { - if (provider.accountList.isNotEmpty) { - provider.selectedAccountList = - provider.accountList[index]; - - print( - "Selected Complaint Type: ${provider.accountList[index].text}, ID: ${provider.accountList[index].id}", - ); - provider.selectedAccountID = - provider.accountList[index].id!; - provider.selectedAccountName = - provider.accountList[index].text!; - print( - "hfjkshfg" + - provider.selectedAccountID - .toString(), - ); - provider.dropDownSearchController.text = - provider.accountList[index].text!; - } - provider - .ordersAddPaymentSelectOrderAPIFunction( + child: ListTile( + title: TextFormField( + focusNode: focusNode, + onTapUpOutside: (event) { + focusNode.unfocus(); + }, + controller: provider.dropDownSearchController, + onChanged: (value) async { + Future.delayed( + Duration(milliseconds: 100), + () async { + await provider + .ordersAddPaymentSelectAccountAPIFunction( context, + widget.mode, provider.selectedAccountID, + value, ); - provider.accountList = []; }, - child: SizedBox( - height: 45, - child: Align( - alignment: Alignment.centerLeft, - child: Text( - provider.accountList[index].text!, - ), - ), - ), ); }, + decoration: InputDecoration( + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + isDense: true, + contentPadding: const EdgeInsets.symmetric( + horizontal: 0, + vertical: 8, + ), + hintText: 'Select Account Type', + hintStyle: const TextStyle(fontSize: 14), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + ), + + trailing: InkResponse( + onTap: () { + if (focusNode.hasFocus) { + focusNode.unfocus(); + } else { + FocusScope.of( + context, + ).requestFocus(focusNode); + } + }, + child: SvgPicture.asset( + "assets/svg/arrow_dropdown.svg", + height: 25, + width: 20, + ), ), ), ), - ), - ], - ///enwewe - errorWidget(context, provider.selectAccountError), - textControllerWidget( - context, - provider.amountController, - "Amount", - "Enter Amount", - provider.onChangeAmount, - TextInputType.number, - false, - FilteringTextInputFormatter.digitsOnly, - focusNodes[0], - null, - TextInputAction.next - ), - errorWidget(context, provider.amountError), + if (provider.accountList.isNotEmpty && + focusNode.hasFocus) ...[ + Card( + margin: EdgeInsets.symmetric(horizontal: 0), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10), + height: widget.mode == "self" ? 50 : 150, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + ), + child: Scrollbar( + thickness: 2.5, + radius: Radius.circular(6), + thumbVisibility: true, + child: ListView.builder( + itemCount: provider.accountList.length, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemBuilder: (context, index) { + return InkResponse( + onTap: () async { + if (provider.accountList.isNotEmpty) { + provider.selectedAccountList = + provider.accountList[index]; - ///Addorderbutton - if (provider.selectedAccountID!=null) ...[ - InkResponse( - onTap: () { - // if (provider.selectedOrderIds.length < provider.orderList.length) { - provider.addNewRow(); - // } else { - // ScaffoldMessenger.of(context).showSnackBar( - // SnackBar( - // content: Text('No more unique order IDs or statuses available'), - // ), - // ); - // } - }, - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - height: 45, - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - color: Color(0xFFE6F6FF), - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: AppColors.app_blue, - width: 0.5, + print( + "Selected Complaint Type: ${provider.accountList[index].text}, ID: ${provider.accountList[index].id}", + ); + provider.selectedAccountID = + provider.accountList[index].id!; + provider.selectedAccountName = + provider + .accountList[index] + .text!; + print( + "hfjkshfg${provider.selectedAccountID}", + ); + provider + .dropDownSearchController + .text = provider + .accountList[index] + .text!; + } + provider + .ordersAddPaymentSelectOrderAPIFunction( + context, + provider.selectedAccountID, + ); + provider.accountList = []; + }, + child: SizedBox( + height: 45, + child: Align( + alignment: Alignment.centerLeft, + child: Text( + provider.accountList[index].text!, + ), + ), + ), + ); + }, + ), + ), ), ), - child: Center( - child: Text( - "+ Add Order", - style: TextStyle( - fontFamily: "JakartaMedium", - color: AppColors.app_blue, + ], + + ///enwewe + errorWidget(context, provider.selectAccountError), + + textControllerWidget( + context, + provider.amountController, + "Amount", + "Enter Amount", + provider.onChangeAmount, + TextInputType.number, + false, + FilteringTextInputFormatter.digitsOnly, + focusNodes[0], + null, + TextInputAction.next, + ), + errorWidget(context, provider.amountError), + + ///Addorderbutton + if (provider.selectedAccountID != null) ...[ + InkResponse( + onTap: () { + // if (provider.selectedOrderIds.length < provider.orderList.length) { + provider.addNewRow(); + // } else { + // ScaffoldMessenger.of(context).showSnackBar( + // SnackBar( + // content: Text('No more unique order IDs or statuses available'), + // ), + // ); + // } + }, + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + height: 45, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Color(0xFFE6F6FF), + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: AppColors.app_blue, + width: 0.5, + ), + ), + child: Center( + child: Text( + "+ Add Order", + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), + ), ), ), ), - ), - ), - if (provider.orderAmountControllers.length > 0) ...[ - Row( - children: [ - Expanded( - child: ListView.builder( - itemCount: - provider.orderAmountControllers.length, - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, index) { - return Row( - children: [ - Expanded( - flex: 3, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - TextWidget(context, "Order"), - Row( + if (provider.orderAmountControllers.isNotEmpty) ...[ + Row( + children: [ + Expanded( + child: ListView.builder( + itemCount: + provider + .orderAmountControllers + .length, + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Row( + children: [ + Expanded( + flex: 3, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - Expanded( - child: DropdownButtonHideUnderline( - child: DropdownButton2< - OrderList - >( - isExpanded: true, - hint: Text( - 'Select Account Type', - style: TextStyle( - fontSize: 14, - ), - overflow: - TextOverflow - .ellipsis, - ), - items: - provider.orderList - .map( - ( - ord, - ) => DropdownMenuItem< - OrderList - >( - value: ord, - child: Text( - "(Order Number: ${ord.orderNumber}) + (Order Amount: ${ord.totalAmount}) + (Balance Amount: ${ord.balanceAmount}) + (Date Time: ${ord.createdDatetime})" ?? - '', - style: const TextStyle( - fontSize: - 14, - ), - overflow: - TextOverflow - .ellipsis, - ), + TextWidget( + context, + "Order", + ), + Row( + children: [ + Expanded( + child: DropdownButtonHideUnderline( + child: DropdownButton2< + OrderList + >( + isExpanded: true, + hint: Text( + 'Select Account Type', + style: + TextStyle( + fontSize: + 14, ), - ) - .toList(), - // value: provider.selectedOrderLists, - value:provider.selectedOrderIds[index] != null? - provider - .orderList - .firstWhere( - (product) => - product - .orderId == - provider - .selectedOrderIds[index], - ):null, - onChanged: ( - OrderList? value, - ) { - if (value != null) { - if (provider - .orderList - .isNotEmpty) { - provider.selectedOrderLists = - value; - print( - "Selected Complaint Type: ${value.orderId}, ID: ${value.orderNumber}", - ); - provider.updateSelectedOrderId( - index, + overflow: + TextOverflow + .ellipsis, + ), + items: provider - .selectedOrderLists, - ); - // provider.selectedOrderIds = value!.orderId!; - // provider.selectedOrderNumbers = value!.orderNumber!; - print( - "hfjkshfg" + + .orderList + .map( + ( + ord, + ) => DropdownMenuItem< + OrderList + >( + value: + ord, + child: Text( + "(Order Number: ${ord.orderNumber}) + (Order Amount: ${ord.totalAmount}) + (Balance Amount: ${ord.balanceAmount}) + (Date Time: ${ord.createdDatetime})" ?? + '', + style: const TextStyle( + fontSize: + 14, + ), + overflow: + TextOverflow.ellipsis, + ), + ), + ) + .toList(), + // value: provider.selectedOrderLists, + value: + provider.selectedOrderIds[index] != + null + ? provider.orderList.firstWhere( + ( + product, + ) => + product.orderId == + provider.selectedOrderIds[index], + ) + : null, + onChanged: ( + OrderList? + value, + ) { + if (value != + null) { + if (provider + .orderList + .isNotEmpty) { + provider.selectedOrderLists = + value; + print( + "Selected Complaint Type: ${value.orderId}, ID: ${value.orderNumber}", + ); + provider.updateSelectedOrderId( + index, provider - .selectedOrderIds - .toString(), - ); - } - } - }, - buttonStyleData: - ddtheme - .buttonStyleData, - iconStyleData: - ddtheme - .iconStyleData, - menuItemStyleData: - ddtheme - .menuItemStyleData, - dropdownStyleData: - ddtheme - .dropdownStyleData, + .selectedOrderLists, + ); + // provider.selectedOrderIds = value!.orderId!; + // provider.selectedOrderNumbers = value!.orderNumber!; + print( + "hfjkshfg${provider.selectedOrderIds}", + ); + } + } + }, + buttonStyleData: + ddtheme + .buttonStyleData, + iconStyleData: + ddtheme + .iconStyleData, + menuItemStyleData: + ddtheme + .menuItemStyleData, + dropdownStyleData: + ddtheme + .dropdownStyleData, + ), + ), ), - ), + ], ), ], ), - ], + ), ), - ), - ), - SizedBox(width: 10), + SizedBox(width: 10), + Expanded( + flex: 2, + child: textControllerWidget( + context, + provider + .orderAmountControllers[index], + "Order Amount", + "Enter Order Amount", + (p0) { + provider + .updateAdjustedAmount(); + }, + TextInputType.number, + false, + FilteringTextInputFormatter + .digitsOnly, + null, + null, + TextInputAction.next, + ), + ), + // SizedBox(width: 10), + // + // IconButton( + // icon: Icon(Icons.delete), + // onPressed: provider.orderAmountControllers.length > 1 + // ? () => provider.removeRow(index) + // : null, // Prevent removing the last row + // ), + ], + ); + }, + ), + ), + ], + ), + ], + ], + + textControllerWidget( + context, + provider.orderAdjustedAmountController, + "Order Adjusted Amount", + "Enter Order Adjusted Amount", + provider.onChangeorderAdjustedAmount, + TextInputType.number, + false, + FilteringTextInputFormatter.digitsOnly, + focusNodes[1], + null, + TextInputAction.done, + ), + errorWidget( + context, + provider.orderAdjustedAmountError, + ), + TextWidget(context, "Description"), + DropdownButtonHideUnderline( + child: Row( + children: [ + Expanded( + child: DropdownButton2( + isExpanded: true, + hint: const Row( + children: [ Expanded( - flex: 2, - child: textControllerWidget( - context, - provider - .orderAmountControllers[index], - "Order Amount", - "Enter Order Amount", - (p0) { - provider.updateAdjustedAmount(); - }, - TextInputType.number, - false, - FilteringTextInputFormatter - .digitsOnly, - null,null,TextInputAction.next + child: Text( + 'Select Advance Payment', + style: TextStyle(fontSize: 14), + overflow: TextOverflow.ellipsis, ), ), - // SizedBox(width: 10), - // - // IconButton( - // icon: Icon(Icons.delete), - // onPressed: provider.orderAmountControllers.length > 1 - // ? () => provider.removeRow(index) - // : null, // Prevent removing the last row - // ), ], - ); - }, + ), + items: + provider.description + .map( + (pm) => DropdownMenuItem( + value: pm, + child: Text( + pm, + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow.ellipsis, + ), + ), + ) + .toList(), + value: provider.selectedDescription, + onChanged: (value) { + if (value != null) { + provider.selectedDescription = value; + print( + "statusId:${provider.selectedDescription}", + ); + } + }, + buttonStyleData: ddtheme.buttonStyleData, + iconStyleData: ddtheme.iconStyleData, + menuItemStyleData: + ddtheme.menuItemStyleData, + dropdownStyleData: + ddtheme.dropdownStyleData, + ), ), - ), - ], + ], + ), ), - ], + errorWidget(context, provider.descriptionError), - ], - - textControllerWidget( - context, - provider.orderAdjustedAmountController, - "Order Adjusted Amount", - "Enter Order Adjusted Amount", - provider.onChangeorderAdjustedAmount, - TextInputType.number, - false, - FilteringTextInputFormatter.digitsOnly, - focusNodes[1], - null, - TextInputAction.done - ), - errorWidget(context, provider.orderAdjustedAmountError), - TextWidget(context, "Description"), - DropdownButtonHideUnderline( - child: Row( - children: [ - Expanded( - child: DropdownButton2( - isExpanded: true, - hint: const Row( - children: [ - Expanded( - child: Text( - 'Select Advance Payment', - style: TextStyle(fontSize: 14), - overflow: TextOverflow.ellipsis, - ), + TextWidget(context, "Payment Received Date"), + GestureDetector( + onTap: () { + provider.showDatePickerDialog(context); + }, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Container( + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: AppColors.text_field_color, + borderRadius: BorderRadius.circular(14), ), - ], - ), - items: - provider.description - .map( - (pm) => DropdownMenuItem( - value: pm, - child: Text( - pm, - style: const TextStyle( - fontSize: 14, - ), - overflow: TextOverflow.ellipsis, - ), + child: Padding( + padding: const EdgeInsets.fromLTRB( + 10.0, + 0.0, + 10, + 0, + ), + child: TextFormField( + controller: + provider + .paymentReceivedDateController, + keyboardType: TextInputType.text, + enabled: false, + maxLines: 1, + readOnly: true, + onChanged: (value) {}, + decoration: InputDecoration( + hintText: "Enter Date", + hintStyle: TextStyle( + fontWeight: FontWeight.w400, + color: Color(0xFFB4BEC0), + fontSize: 14, ), - ) - .toList(), - value: provider.selectedDescription, - onChanged: (value) { - if (value != null) { - provider.selectedDescription = value; - print( - "statusId:${provider.selectedDescription}", - ); - } - }, - buttonStyleData: ddtheme.buttonStyleData, - iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: ddtheme.menuItemStyleData, - dropdownStyleData: ddtheme.dropdownStyleData, - ), - ), - ], - ), - ), - errorWidget(context, provider.descriptionError), - TextWidget(context, "Payment Received Date"), - GestureDetector( - onTap: () { - provider.showDatePickerDialog(context); - }, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Container( - height: 50, - alignment: Alignment.center, - decoration: BoxDecoration( - color: AppColors.text_field_color, - borderRadius: BorderRadius.circular(14), - ), - child: Padding( - padding: const EdgeInsets.fromLTRB( - 10.0, - 0.0, - 10, - 0, - ), - child: TextFormField( - controller: - provider.paymentReceivedDateController, - keyboardType: TextInputType.text, - enabled: false, - maxLines: 1, - readOnly: true, - onChanged: (value) {}, - decoration: InputDecoration( - hintText: "Enter Date", - hintStyle: TextStyle( - fontWeight: FontWeight.w400, - color: Color(0xFFB4BEC0), - fontSize: 14, + enabledBorder: InputBorder.none, + disabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + ), ), - - enabledBorder: InputBorder.none, - disabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, ), ), ), - ), + ], ), - ], - ), - ), - errorWidget(context, provider.dateError), + ), + errorWidget(context, provider.dateError), - TextWidget(context, "Select Payment Mode"), - DropdownButtonHideUnderline( - child: Row( - children: [ - Expanded( - child: DropdownButton2( - isExpanded: true, - hint: const Row( - children: [ - Expanded( - child: Text( - 'Select Payment Mode', - style: TextStyle(fontSize: 14), - overflow: TextOverflow.ellipsis, - ), + TextWidget(context, "Select Payment Mode"), + DropdownButtonHideUnderline( + child: Row( + children: [ + Expanded( + child: DropdownButton2( + isExpanded: true, + hint: const Row( + children: [ + Expanded( + child: Text( + 'Select Payment Mode', + style: TextStyle(fontSize: 14), + overflow: TextOverflow.ellipsis, + ), + ), + ], ), - ], - ), - items: - provider.paymentMode - .map( - (pm) => DropdownMenuItem( - value: pm, - child: Text( - pm, - style: const TextStyle( - fontSize: 14, + items: + provider.paymentMode + .map( + (pm) => DropdownMenuItem( + value: pm, + child: Text( + pm, + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow.ellipsis, + ), ), - overflow: TextOverflow.ellipsis, - ), - ), - ) - .toList(), - value: provider.selectedPaymentMode, - onChanged: (value) { - if (value != null) { - provider.selectedPaymentMode = value; - print( - "statusId:${provider.selectedPaymentMode}", - ); - } - }, - buttonStyleData: ddtheme.buttonStyleData, - iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: ddtheme.menuItemStyleData, - dropdownStyleData: ddtheme.dropdownStyleData, - ), + ) + .toList(), + value: provider.selectedPaymentMode, + onChanged: (value) { + if (value != null) { + provider.selectedPaymentMode = value; + print( + "statusId:${provider.selectedPaymentMode}", + ); + } + }, + buttonStyleData: ddtheme.buttonStyleData, + iconStyleData: ddtheme.iconStyleData, + menuItemStyleData: + ddtheme.menuItemStyleData, + dropdownStyleData: + ddtheme.dropdownStyleData, + ), + ), + ], ), - ], - ), - ), - errorWidget(context, provider.paymentModeError), + ), + errorWidget(context, provider.paymentModeError), - textControllerWidget( - context, - provider.paymentRefController, - "Payment Reference No", - "Enter Payment Reference No. / Cheque No. / UTR No.", - provider.onChangepaymentRef, - TextInputType.text, - false, - null, - focusNodes[2], - null, - TextInputAction.done - ), - errorWidget(context, provider.paymentRefError), + textControllerWidget( + context, + provider.paymentRefController, + "Payment Reference No", + "Enter Payment Reference No. / Cheque No. / UTR No.", + provider.onChangepaymentRef, + TextInputType.text, + false, + null, + focusNodes[2], + null, + TextInputAction.done, + ), + errorWidget(context, provider.paymentRefError), - InkResponse( - onTap: () { - _showAttachmentSheet(context); - }, - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - height: 45, - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - color: Color(0xFFE6F6FF), - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: AppColors.app_blue, - width: 0.5, + InkResponse( + onTap: () { + _showAttachmentSheet(context); + }, + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + height: 45, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Color(0xFFE6F6FF), + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: AppColors.app_blue, + width: 0.5, + ), + ), + child: Center( + child: Text( + "Payment Reference", + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), + ), + ), ), ), - child: Center( - child: Text( - "Payment Reference", - style: TextStyle( - fontFamily: "JakartaMedium", - color: AppColors.app_blue, + if (provider.imagePicked == 1 && + provider.imagePath != null) ...[ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 4.0, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "${provider.imagePath}", + style: TextStyle( + color: AppColors.semi_black, + fontSize: 11, + fontWeight: FontWeight.w600, + ), + ), + InkResponse( + onTap: () { + provider.imagePicked = 0; + provider.imagePath = null; + provider.imageFilePath = null; + }, + child: SvgPicture.asset( + "assets/svg/ic_close.svg", + width: 15, + height: 15, + ), + ), + ], ), ), - ), - ), + ], + ], ), - if (provider.imagePicked == 1 && - provider.imagePath != null) ...[ - Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "${provider.imagePath}", - style: TextStyle( - color: AppColors.semi_black, - fontSize: 11, - fontWeight: FontWeight.w600, + ), + ), + floatingActionButtonLocation: + FloatingActionButtonLocation.centerFloat, + bottomNavigationBar: InkResponse( + onTap: + provider.submitClicked + ? null + : () { + provider.submitClicked = true; + provider.selectedOrders = provider.getFormData(); + provider.ordersAddPaymentAPISubmitFunction( + context, + provider.selectedAccountID, + provider.selectedDescription, + provider.selectedOrders, + provider.selectedPaymentMode, + ); + }, + child: Container( + height: 45, + alignment: Alignment.center, + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 15, + ), + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: AppColors.app_blue, + borderRadius: BorderRadius.circular(15), + ), + child: + provider.submitClicked + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + Colors.white, ), - ), - InkResponse( - onTap: () { - provider.imagePicked = 0; - provider.imagePath = null; - provider.imageFilePath = null; - }, - child: SvgPicture.asset( - "assets/svg/ic_close.svg", - width: 15, - height: 15, + ) + : Text( + "Submit", + style: TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + color: Colors.white, ), ), - ], - ), - ), - ], - ], - ), - ), - ), - floatingActionButtonLocation: - FloatingActionButtonLocation.centerFloat, - bottomNavigationBar: - InkResponse( - onTap: provider.submitClicked?null:() { - provider.submitClicked = true; - provider.selectedOrders = provider.getFormData(); - provider.ordersAddPaymentAPISubmitFunction( - context, - provider.selectedAccountID, - provider.selectedDescription, - provider.selectedOrders, - provider.selectedPaymentMode, - ); - }, - child: Container( - height: 45, - alignment: Alignment.center, - margin: EdgeInsets.symmetric(horizontal: 10, vertical: 15), - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5), - decoration: BoxDecoration( - color: AppColors.app_blue, - borderRadius: BorderRadius.circular(15), - ), - child:provider.submitClicked?CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation(Colors.white), - ): Text( - "Submit", - style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - color: Colors.white, ), ), ), ), - ), - ), - onWillPop: () async { - provider.resetForm(); - return _onBackPressed(context); + onWillPop: () async { + provider.resetForm(); + return _onBackPressed(context); + }, + ); }, - ); - }, - ):NoNetwork(context); + ) + : NoNetwork(context); } Future _showAttachmentSheet(BuildContext context) { @@ -797,7 +842,7 @@ class _AddpaymentScreenState extends State { Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -808,7 +853,7 @@ class _AddpaymentScreenState extends State { Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/order/addTpcAgent.dart b/lib/screens/order/addTpcAgent.dart index cc761ec..3d99723 100644 --- a/lib/screens/order/addTpcAgent.dart +++ b/lib/screens/order/addTpcAgent.dart @@ -59,268 +59,303 @@ class _AddtpcagentScreenState extends State { default: connection = 'Offline'; } - return connection=="Online"? Consumer( - builder: (context, provider, child) { - return WillPopScope( - child: SafeArea( - top: false, - bottom: Platform.isIOS?false:true, - child: Scaffold( - resizeToAvoidBottomInset: true, - appBar: appbar2New( - context, - "Add TPC Agent", - provider.resetAll, - SizedBox(width: 0), - 0xFFFFFFFF - ), - backgroundColor: AppColors.scaffold_bg_color, - body: Container( - child: SingleChildScrollView( - child: Column( - children: [ - Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - margin: EdgeInsets.symmetric( - vertical: 10, - horizontal: 10, - ), - padding: EdgeInsets.symmetric( - vertical: 10, - horizontal: 10, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - textControllerWidget( - context, - provider.tpcNameController, - "Name", - "Enter Name", - provider.onChangetpcName, - TextInputType.text, - false, - null, - focusNodes[0], - focusNodes[1], - TextInputAction.next + return connection == "Online" + ? Consumer( + builder: (context, provider, child) { + return WillPopScope( + child: SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + appBar: appbar2New( + context, + "Add TPC Agent", + provider.resetAll, + SizedBox(width: 0), + 0xFFFFFFFF, + ), + backgroundColor: AppColors.scaffold_bg_color, + body: Container( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), ), - if (provider.tpcNameError != null) ...[ - errorWidget(context, provider.tpcNameError), - ], - - textControllerWidget( - context, - provider.tpcMobileNumberController, - "Mobile Number", - "Enter Mobile Number", - provider.onChangetpcMobileNumber, - TextInputType.number, - false, - FilteringTextInputFormatter.digitsOnly, - focusNodes[1], - focusNodes[2], - TextInputAction.next, - 10 + margin: EdgeInsets.symmetric( + vertical: 10, + horizontal: 10, + ), + padding: EdgeInsets.symmetric( + vertical: 10, + horizontal: 10, ), - if (provider.tpcMobileNumberError != null) ...[ - errorWidget(context, provider.tpcMobileNumberError), - ], + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + textControllerWidget( + context, + provider.tpcNameController, + "Name", + "Enter Name", + provider.onChangetpcName, + TextInputType.text, + false, + null, + focusNodes[0], + focusNodes[1], + TextInputAction.next, + ), + if (provider.tpcNameError != null) ...[ + errorWidget(context, provider.tpcNameError), + ], - InkResponse( - onTap: () { - _showAttachmentSheet(context); - }, - child: Container( - margin: EdgeInsets.symmetric(vertical: 10), - height: 45, - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - color: Color(0xFFE6F6FF), - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: AppColors.app_blue, - width: 0.5, - ), + textControllerWidget( + context, + provider.tpcMobileNumberController, + "Mobile Number", + "Enter Mobile Number", + provider.onChangetpcMobileNumber, + TextInputType.number, + false, + FilteringTextInputFormatter.digitsOnly, + focusNodes[1], + focusNodes[2], + TextInputAction.next, + 10, ), - child: Center( - child: Text( - "ID Proof", - style: TextStyle( - fontFamily: "JakartaMedium", - color: AppColors.app_blue, - ), + if (provider.tpcMobileNumberError != null) ...[ + errorWidget( + context, + provider.tpcMobileNumberError, ), - ), - ), - ), - if (provider.imagePicked == 1 && - provider.imagePath != null) ...[ - Padding( - padding: const EdgeInsets.symmetric( - vertical: 4.0, - ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Text( - "${provider.imagePath}", - style: TextStyle( - color: AppColors.semi_black, - fontSize: 11, - fontWeight: FontWeight.w600, + ], + + InkResponse( + onTap: () { + _showAttachmentSheet(context); + }, + child: Container( + margin: EdgeInsets.symmetric(vertical: 10), + height: 45, + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: Color(0xFFE6F6FF), + borderRadius: BorderRadius.circular(12), + border: Border.all( + color: AppColors.app_blue, + width: 0.5, ), ), - InkResponse( - onTap: () { - provider.imagePicked = 0; - provider.imagePath = null; - provider.imageFilePath = null; - }, - child: SvgPicture.asset( - "assets/svg/ic_close.svg", - width: 15, - height: 15, + child: Center( + child: Text( + "ID Proof", + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), ), ), - ], + ), ), - ), - ], - errorWidget(context, provider.imageError), - - textControllerWidget( - context, - provider.tpcBankNameController, - "Bank Name", - "Enter Bank Name", - provider.onChangetpcBankName, - TextInputType.text, - false, - null, - focusNodes[2],focusNodes[3],TextInputAction.next - ), - if (provider.tpcBankNameError != null) ...[ - errorWidget(context, provider.tpcBankNameError), - ], - - textControllerWidget( - context, - provider.tpcBankBeneficiaryNameController, - "Bank Beneficiary Name", - "Enter Bank Beneficiary Name", - provider.onChangetpcBankBeneficiaryName, - TextInputType.text, - false, - null, - focusNodes[3],focusNodes[4],TextInputAction.next - ), - if (provider.tpcBankBeneficiaryNameError != null) ...[ - errorWidget( - context, - provider.tpcBankBeneficiaryNameError, - ), - ], + if (provider.imagePicked == 1 && + provider.imagePath != null) ...[ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 4.0, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "${provider.imagePath}", + style: TextStyle( + color: AppColors.semi_black, + fontSize: 11, + fontWeight: FontWeight.w600, + ), + ), + InkResponse( + onTap: () { + provider.imagePicked = 0; + provider.imagePath = null; + provider.imageFilePath = null; + }, + child: SvgPicture.asset( + "assets/svg/ic_close.svg", + width: 15, + height: 15, + ), + ), + ], + ), + ), + ], + errorWidget(context, provider.imageError), - textControllerWidget( - context, - provider.tpcBankAccountNumberController, - "Bank Account Number", - "Enter Bank Account Number", - provider.onChangetpcBankAccountNumber, - TextInputType.number, - false, - FilteringTextInputFormatter.digitsOnly, - focusNodes[4],focusNodes[5],TextInputAction.next - ), - if (provider.tpcBankAccountNumberError != null) ...[ - errorWidget( - context, - provider.tpcBankAccountNumberError, - ), - ], + textControllerWidget( + context, + provider.tpcBankNameController, + "Bank Name", + "Enter Bank Name", + provider.onChangetpcBankName, + TextInputType.text, + false, + null, + focusNodes[2], + focusNodes[3], + TextInputAction.next, + ), + if (provider.tpcBankNameError != null) ...[ + errorWidget( + context, + provider.tpcBankNameError, + ), + ], - textControllerWidget( - context, - provider.tpcBankIFSCController, - "Bank IFSC", - "Enter Bank IFSC", - provider.onChangetpcBankIFSC, - TextInputType.text, - false, - null, - focusNodes[5],focusNodes[6], - TextInputAction.next - ), - if (provider.tpcBankIFSCError != null) ...[ - errorWidget(context, provider.tpcBankIFSCError), - ], + textControllerWidget( + context, + provider.tpcBankBeneficiaryNameController, + "Bank Beneficiary Name", + "Enter Bank Beneficiary Name", + provider.onChangetpcBankBeneficiaryName, + TextInputType.text, + false, + null, + focusNodes[3], + focusNodes[4], + TextInputAction.next, + ), + if (provider.tpcBankBeneficiaryNameError != + null) ...[ + errorWidget( + context, + provider.tpcBankBeneficiaryNameError, + ), + ], - textControllerWidget( - context, - provider.tpcNoteController, - "Description", - "Enter Description", - provider.onChangetpcNote, - TextInputType.text, - false, - null, - focusNodes[6],focusNodes[7],TextInputAction.next - ), - if (provider.tpcNoteError != null) ...[ - errorWidget(context, provider.tpcNoteError), - ], - InkWell( - onTap:provider.submitClicked?null: () { - provider.submitClicked = true; - provider.addTPCAgentAPIFunction(context); - }, + textControllerWidget( + context, + provider.tpcBankAccountNumberController, + "Bank Account Number", + "Enter Bank Account Number", + provider.onChangetpcBankAccountNumber, + TextInputType.number, + false, + FilteringTextInputFormatter.digitsOnly, + focusNodes[4], + focusNodes[5], + TextInputAction.next, + ), + if (provider.tpcBankAccountNumberError != + null) ...[ + errorWidget( + context, + provider.tpcBankAccountNumberError, + ), + ], - child: Container( - alignment: Alignment.center, - height: 45, - margin: EdgeInsets.only( - left: 5.0, - right: 5.0, - top: 5.0, - bottom: 5.0, + textControllerWidget( + context, + provider.tpcBankIFSCController, + "Bank IFSC", + "Enter Bank IFSC", + provider.onChangetpcBankIFSC, + TextInputType.text, + false, + null, + focusNodes[5], + focusNodes[6], + TextInputAction.next, ), - decoration: BoxDecoration( - color: AppColors.app_blue, //1487C9 - borderRadius: BorderRadius.circular(14.0), + if (provider.tpcBankIFSCError != null) ...[ + errorWidget( + context, + provider.tpcBankIFSCError, + ), + ], + + textControllerWidget( + context, + provider.tpcNoteController, + "Description", + "Enter Description", + provider.onChangetpcNote, + TextInputType.text, + false, + null, + focusNodes[6], + focusNodes[7], + TextInputAction.next, ), - child: Center( - child:provider.submitClicked?CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation(Colors.white), - ): Text( - "Submit", - textAlign: TextAlign.center, - style: TextStyle(color: Colors.white), + if (provider.tpcNoteError != null) ...[ + errorWidget(context, provider.tpcNoteError), + ], + InkWell( + onTap: + provider.submitClicked + ? null + : () { + provider.submitClicked = true; + provider.addTPCAgentAPIFunction( + context, + ); + }, + + child: Container( + alignment: Alignment.center, + height: 45, + margin: EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + decoration: BoxDecoration( + color: AppColors.app_blue, //1487C9 + borderRadius: BorderRadius.circular(14.0), + ), + child: Center( + child: + provider.submitClicked + ? CircularProgressIndicator.adaptive( + valueColor: + AlwaysStoppedAnimation( + Colors.white, + ), + ) + : Text( + "Submit", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + ), + ), + ), ), ), - ), + ], ), - ], - ), + ), + ], ), - ], + ), ), ), ), - ), - ), - onWillPop: () { - return onBackPressed(context); + onWillPop: () { + return onBackPressed(context); + }, + ); }, - ); - }, - ):NoNetwork(context); + ) + : NoNetwork(context); } Future _showAttachmentSheet(BuildContext context) { @@ -374,7 +409,7 @@ class _AddtpcagentScreenState extends State { Navigator.of(context).pop(false); tcpProvider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -385,7 +420,7 @@ class _AddtpcagentScreenState extends State { Navigator.of(context).pop(false); tcpProvider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/order/editAdjustedOrderList.dart b/lib/screens/order/editAdjustedOrderList.dart index ca12eb7..1fbffd4 100644 --- a/lib/screens/order/editAdjustedOrderList.dart +++ b/lib/screens/order/editAdjustedOrderList.dart @@ -73,7 +73,7 @@ class _EditadjustedorderlistState extends State { @override void dispose() { - focusNodes.map((e)=>e.dispose()); + focusNodes.map((e) => e.dispose()); super.dispose(); } @@ -89,7 +89,7 @@ class _EditadjustedorderlistState extends State { return WillPopScope( child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.scaffold_bg_color, @@ -109,7 +109,7 @@ class _EditadjustedorderlistState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (editProvider.editOrderList!.isNotEmpty) ...[ + if (editProvider.editOrderList.isNotEmpty) ...[ InkResponse( onTap: () { // if (provider.selectedOrderIds.length < provider.orderList.length) { @@ -145,7 +145,7 @@ class _EditadjustedorderlistState extends State { ), ), ), - if (editProvider.paidList.length > 0) ...[ + if (editProvider.paidList.isNotEmpty) ...[ Row( children: [ Expanded( @@ -158,7 +158,9 @@ class _EditadjustedorderlistState extends State { padding: EdgeInsets.symmetric( horizontal: 10, ), - margin: EdgeInsets.symmetric(vertical: 10), + margin: EdgeInsets.symmetric( + vertical: 10, + ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(20), @@ -172,7 +174,8 @@ class _EditadjustedorderlistState extends State { child: SizedBox( child: Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment + .start, children: [ TextWidget( context, @@ -183,9 +186,10 @@ class _EditadjustedorderlistState extends State { Expanded( child: DropdownButtonHideUnderline( child: DropdownButton2< - EditPaidList + EditPaidList >( - isExpanded: true, + isExpanded: + true, hint: Text( 'Select Account Type', style: @@ -204,7 +208,7 @@ class _EditadjustedorderlistState extends State { ( ord, ) => DropdownMenuItem< - EditPaidList + EditPaidList >( value: ord, @@ -227,7 +231,9 @@ class _EditadjustedorderlistState extends State { value: editProvider .paidList .firstWhere( - (product) => + ( + product, + ) => product .orderId == editProvider @@ -244,7 +250,8 @@ class _EditadjustedorderlistState extends State { // editProvider.paidList[0], // ), onChanged: ( - EditPaidList? value, + EditPaidList? + value, ) { if (value != null) { @@ -312,7 +319,7 @@ class _EditadjustedorderlistState extends State { .digitsOnly, focusNodes[0], focusNodes[1], - TextInputAction.next + TextInputAction.next, ), ), ], @@ -335,13 +342,16 @@ class _EditadjustedorderlistState extends State { ], ), ], - if (editProvider.editOrderList.length > 0) ...[ - if (editProvider.editOrderAmountControllers2.length > 0) + if (editProvider.editOrderList.isNotEmpty) ...[ + if (editProvider + .editOrderAmountControllers2 + .isNotEmpty) Row( children: [ Expanded( child: ListView.builder( - itemCount: editProvider.editOrderList.length, + itemCount: + editProvider.editOrderList.length, physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemBuilder: (context, j) { @@ -354,7 +364,9 @@ class _EditadjustedorderlistState extends State { ), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular(20), + borderRadius: BorderRadius.circular( + 20, + ), ), child: Column( children: [ @@ -383,11 +395,10 @@ class _EditadjustedorderlistState extends State { true, hint: Text( 'Select Account Type', - style: - TextStyle( - fontSize: - 14, - ), + style: TextStyle( + fontSize: + 14, + ), overflow: TextOverflow .ellipsis, @@ -440,8 +451,7 @@ class _EditadjustedorderlistState extends State { if (editProvider .editOrderList .isNotEmpty) { - editProvider - .selectedOrderList = + editProvider.selectedOrderList = value; print( "Selected Complaint Type: ${value.orderId}, ID: ${value.orderNumber}", @@ -501,7 +511,7 @@ class _EditadjustedorderlistState extends State { .digitsOnly, null, null, - TextInputAction.done + TextInputAction.done, ), ), ], diff --git a/lib/screens/order/editOrderAccountDetails.dart b/lib/screens/order/editOrderAccountDetails.dart index 1acbeeb..0181777 100644 --- a/lib/screens/order/editOrderAccountDetails.dart +++ b/lib/screens/order/editOrderAccountDetails.dart @@ -19,16 +19,22 @@ class Editorderaccountdetails extends StatefulWidget { final mode; final orderID; - const Editorderaccountdetails({super.key,required this.pageTitleName,required this.mode,required this.orderID}); + const Editorderaccountdetails({ + super.key, + required this.pageTitleName, + required this.mode, + required this.orderID, + }); @override - State createState() => _EditorderaccountdetailsState(); + State createState() => + _EditorderaccountdetailsState(); } class _EditorderaccountdetailsState extends State { FocusNode focusNode = FocusNode(); FocusNode focusNodetpc = FocusNode(); - List focusNodes = List.generate(5, (index) => FocusNode(),); + List focusNodes = List.generate(5, (index) => FocusNode()); Dropdowntheme ddtheme = Dropdowntheme(); @override void initState() { @@ -43,7 +49,7 @@ class _EditorderaccountdetailsState extends State { @override void dispose() { - focusNodes.map((e)=>e.dispose()); + focusNodes.map((e) => e.dispose()); super.dispose(); } @@ -59,7 +65,7 @@ class _EditorderaccountdetailsState extends State { return WillPopScope( child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.white, @@ -68,7 +74,7 @@ class _EditorderaccountdetailsState extends State { "${widget.pageTitleName}", provider.resetForm, SizedBox(width: 0), - 0xFFFFFFFF + 0xFFFFFFFF, ), body: Container( padding: EdgeInsets.symmetric(horizontal: 10), @@ -80,7 +86,6 @@ class _EditorderaccountdetailsState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - TextWidget(context, "Dispatch State"), DropdownButtonHideUnderline( child: Row( @@ -94,31 +99,34 @@ class _EditorderaccountdetailsState extends State { overflow: TextOverflow.ellipsis, ), items: - provider.dispatchStates - .map( - (e) => DropdownMenuItem( - value: e, - child: Text( - e.name!, - style: const TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.dispatchStates + .map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e.name!, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selecetdDispatchStates, onChanged: (States? value) { if (provider.dispatchStates.isNotEmpty) { provider.selecetdDispatchStates = value; - provider.selectedDispatchStateID = value!.id!; + provider.selectedDispatchStateID = + value!.id!; provider.selectedDispatchStateName = - value!.name!; + value.name!; if (provider.dispatchDistricts.isNotEmpty) { provider.dispatchDistricts.clear(); // provider.selectedDispatchDistricts = null; - provider.selectedDispatchDistrictId = null; - provider.selectedDispatchDistrictValue = ""; + provider.selectedDispatchDistrictId = + null; + provider.selectedDispatchDistrictValue = + ""; } provider.getDispatchDistrictAPI( context, @@ -149,27 +157,27 @@ class _EditorderaccountdetailsState extends State { style: const TextStyle(fontSize: 14), ), items: - provider.dispatchDistricts - .map( - (e) => DropdownMenuItem( - value: e, - child: Text( - e.district!, - style: const TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.dispatchDistricts + .map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e.district!, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedDispatchDistricts, onChanged: (Districts? value) { if (provider.dispatchDistricts.isNotEmpty) { provider.selectedDispatchDistricts = value; provider.selectedDispatchDistrictId = - value!.id!; + value!.id!; provider.selectedDispatchDistrictValue = - value!.district!; + value.district!; if (provider .dispatchSubLocations .isNotEmpty) { @@ -205,27 +213,30 @@ class _EditorderaccountdetailsState extends State { style: const TextStyle(fontSize: 14), ), items: - provider.dispatchSubLocations - .map( - (e) => DropdownMenuItem( - value: e, - child: Text( - e.subLocality!, - style: const TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.dispatchSubLocations + .map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e.subLocality!, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedDispatchSubLocations, onChanged: (SubLocations? value) { - if (provider.dispatchSubLocations.isNotEmpty) { - provider.selectedDispatchSubLocations = value; + if (provider + .dispatchSubLocations + .isNotEmpty) { + provider.selectedDispatchSubLocations = + value; provider.selectedDispatchSubLocID = - value!.id!; + value!.id!; provider.selectedDispatchSubLocValue = - value!.subLocality!; + value.subLocality!; } }, buttonStyleData: ddtheme.buttonStyleData, @@ -247,7 +258,9 @@ class _EditorderaccountdetailsState extends State { TextInputType.text, false, null, - focusNodes[0],focusNodes[1],TextInputAction.next + focusNodes[0], + focusNodes[1], + TextInputAction.next, ), errorWidget(context, provider.dispatchAddressError), @@ -260,7 +273,9 @@ class _EditorderaccountdetailsState extends State { TextInputType.number, false, FilteringTextInputFormatter.digitsOnly, - focusNodes[1],focusNodes[2],TextInputAction.next + focusNodes[1], + focusNodes[2], + TextInputAction.next, ), errorWidget(context, provider.dispatchPincodeError), textControllerWidget( @@ -272,12 +287,12 @@ class _EditorderaccountdetailsState extends State { TextInputType.text, false, null, - focusNodes[2],focusNodes[3],TextInputAction.done + focusNodes[2], + focusNodes[3], + TextInputAction.done, ), errorWidget(context, provider.noteError), - - InkResponse( onTap: () { _showAttachmentSheet(context); @@ -349,19 +364,19 @@ class _EditorderaccountdetailsState extends State { style: const TextStyle(fontSize: 14), ), items: - provider.unloadingScope - .map( - (e) => DropdownMenuItem( - value: e!, - child: Text( - e, - style: const TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), + provider.unloadingScope + .map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), value: provider.selectedUnloadingScope, onChanged: (String? value) { if (provider.unloadingScope.isNotEmpty) { @@ -389,20 +404,20 @@ class _EditorderaccountdetailsState extends State { style: const TextStyle(fontSize: 14), ), items: - provider.freightScope - .map( - (e) => DropdownMenuItem( - value: e!, - child: Text( - e, - style: const TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), - value:provider.selectedFreightScope, + provider.freightScope + .map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), + value: provider.selectedFreightScope, onChanged: (String? value) { if (provider.freightScope.isNotEmpty) { provider.selectedFreightScope = value; @@ -438,11 +453,11 @@ class _EditorderaccountdetailsState extends State { ), scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(15), - thickness: MaterialStateProperty.all( + thickness: WidgetStateProperty.all( 6, ), thumbVisibility: - MaterialStateProperty.all(true), + WidgetStateProperty.all(true), ), ), menuItemStyleData: const MenuItemStyleData( @@ -466,20 +481,20 @@ class _EditorderaccountdetailsState extends State { style: const TextStyle(fontSize: 14), ), items: - provider.erectionScope - .map( - (e) => DropdownMenuItem( - value: e!, - child: Text( - e, - style: const TextStyle( - fontSize: 14, - ), - ), - ), - ) - .toList(), - value:provider.selectedErectionScope, + provider.erectionScope + .map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e, + style: const TextStyle( + fontSize: 14, + ), + ), + ), + ) + .toList(), + value: provider.selectedErectionScope, onChanged: (String? value) { if (provider.erectionScope.isNotEmpty) { provider.selectedErectionScope = value; @@ -494,22 +509,29 @@ class _EditorderaccountdetailsState extends State { ], ), ), - ], ), ), ), floatingActionButtonLocation: - FloatingActionButtonLocation.centerFloat, + FloatingActionButtonLocation.centerFloat, bottomNavigationBar: InkResponse( onTap: - provider.submitClicked - ? null - : () { - provider.submitClicked = true; - provider.ordersEditOrderAPISubmitFunction(context, widget.orderID, provider.selectedDispatchStateID, provider.selectedDispatchDistrictId, provider.selectedDispatchSubLocID, - provider.selectedUnloadingScope, provider.selectedFreightScope, provider.selectedErectionScope); - }, + provider.submitClicked + ? null + : () { + provider.submitClicked = true; + provider.ordersEditOrderAPISubmitFunction( + context, + widget.orderID, + provider.selectedDispatchStateID, + provider.selectedDispatchDistrictId, + provider.selectedDispatchSubLocID, + provider.selectedUnloadingScope, + provider.selectedFreightScope, + provider.selectedErectionScope, + ); + }, child: Container( height: 45, alignment: Alignment.center, @@ -520,26 +542,25 @@ class _EditorderaccountdetailsState extends State { borderRadius: BorderRadius.circular(15), ), child: - provider.submitClicked - ? CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.white, - ), - ) - : Text( - "Submit", - style: TextStyle( - fontSize: 15, - fontFamily: "JakartaMedium", - color: Colors.white, - ), - ), + provider.submitClicked + ? CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.white, + ), + ) + : Text( + "Submit", + style: TextStyle( + fontSize: 15, + fontFamily: "JakartaMedium", + color: Colors.white, + ), + ), ), ), ), ), onWillPop: () async { - return _onBackPressed(context); }, ); @@ -565,9 +586,9 @@ class _EditorderaccountdetailsState extends State { return Padding( padding: EdgeInsets.only( bottom: - MediaQuery.of( - context, - ).viewInsets.bottom, // This handles keyboard + MediaQuery.of( + context, + ).viewInsets.bottom, // This handles keyboard ), child: Container( margin: EdgeInsets.only( @@ -599,7 +620,7 @@ class _EditorderaccountdetailsState extends State { Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -610,7 +631,7 @@ class _EditorderaccountdetailsState extends State { Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), @@ -629,6 +650,3 @@ class _EditorderaccountdetailsState extends State { ); } } - - - diff --git a/lib/screens/order/editPaymentDetailsByMode.dart b/lib/screens/order/editPaymentDetailsByMode.dart index eb8cd57..0303519 100644 --- a/lib/screens/order/editPaymentDetailsByMode.dart +++ b/lib/screens/order/editPaymentDetailsByMode.dart @@ -5,10 +5,8 @@ import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:provider/provider.dart'; -import '../../Models/ordersModels/AddOrderPaymentSelectOrderResponse.dart'; import '../../Notifiers/ordersProvider/addPaymentProvider.dart'; import '../../Notifiers/ordersProvider/editPaymentProvider.dart'; import '../../Utils/app_colors.dart'; @@ -105,38 +103,36 @@ class _EditpaymentdetailsbymodeState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () async { - Provider.of( - context, - listen: false, - ).resetForm(); - Provider.of( - context, - listen: false, - ).resetForm(); + ? WillPopScope( + onWillPop: () async { + Provider.of( + context, + listen: false, + ).resetForm(); + Provider.of( + context, + listen: false, + ).resetForm(); - return onBackPressed(context); - }, - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + return onBackPressed(context); + }, + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } - - Widget _scaffold(BuildContext context) { return Consumer2( builder: (context, provider, editProvider, child) { return WillPopScope( child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.white, @@ -145,7 +141,7 @@ class _EditpaymentdetailsbymodeState extends State { "${widget.pageTitleName}", provider.resetForm, SizedBox.shrink(), - 0xFFFFFFFF + 0xFFFFFFFF, ), body: Container( padding: EdgeInsets.symmetric(horizontal: 10), @@ -220,7 +216,7 @@ class _EditpaymentdetailsbymodeState extends State { FilteringTextInputFormatter.digitsOnly, focusNodes[0], null, - TextInputAction.done + TextInputAction.done, ), errorWidget(context, provider.amountError), @@ -286,9 +282,9 @@ class _EditpaymentdetailsbymodeState extends State { TextInputType.text, false, null, - focusNodes[1], - null, - TextInputAction.done + focusNodes[1], + null, + TextInputAction.done, ), errorWidget(context, provider.paymentRefError), TextWidget(context, "Payment Received Date"), diff --git a/lib/screens/order/orderDetailsFeedbackHistory.dart b/lib/screens/order/orderDetailsFeedbackHistory.dart index bd23135..6bf2dca 100644 --- a/lib/screens/order/orderDetailsFeedbackHistory.dart +++ b/lib/screens/order/orderDetailsFeedbackHistory.dart @@ -12,20 +12,18 @@ class Orderdetailsfeedbackhistory extends StatefulWidget { const Orderdetailsfeedbackhistory({super.key}); @override - State createState() => _OrderdetailsfeedbackhistoryState(); + State createState() => + _OrderdetailsfeedbackhistoryState(); } -class _OrderdetailsfeedbackhistoryState extends State { +class _OrderdetailsfeedbackhistoryState + extends State { @override void initState() { // TODO: implement initState super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { - var details = Provider.of( - context, - listen: false, - ); - + var details = Provider.of(context, listen: false); }); } @@ -39,89 +37,101 @@ class _OrderdetailsfeedbackhistoryState extends State onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar(context, "Feedback History"), backgroundColor: AppColors.scaffold_bg_color, - body: feedbackHistory.isNotEmpty?Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemCount: feedbackHistory.length, - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), + body: + feedbackHistory.isNotEmpty + ? Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemCount: feedbackHistory.length, + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), - itemBuilder: (context, index) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), - padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: List.generate(5, (j) { - final textheads = [ - "Employee", - "Feedback", - "Attachment", - "Status", - "Date", - ]; - final textSubheads = [ - "${feedbackHistory[index].employeNaem}", - "${feedbackHistory[index].feedback}", - "${feedbackHistory[index].attachmentDirFilePath}", - "${feedbackHistory[index].status}", - "${feedbackHistory[index].createdDatetime}", - ]; + itemBuilder: (context, index) { return Container( - + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), padding: EdgeInsets.symmetric( - vertical: 6, - horizontal: 0, + horizontal: 15, + vertical: 10, ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - Expanded( - child: Text(textheads[j].toString(), - maxLines: 2, - overflow: TextOverflow.ellipsis,), - ), - Expanded( - child: SizedBox( - // height:45, - width: - MediaQuery.of( - context, - ).size.width * - 0.75, - child: Text( - textSubheads[j], - maxLines: 2, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF818181), + children: List.generate(5, (j) { + final textheads = [ + "Employee", + "Feedback", + "Attachment", + "Status", + "Date", + ]; + final textSubheads = [ + "${feedbackHistory[index].employeNaem}", + "${feedbackHistory[index].feedback}", + "${feedbackHistory[index].attachmentDirFilePath}", + "${feedbackHistory[index].status}", + "${feedbackHistory[index].createdDatetime}", + ]; + return Container( + padding: EdgeInsets.symmetric( + vertical: 6, + horizontal: 0, + ), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + textheads[j].toString(), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ), + Expanded( + child: SizedBox( + // height:45, + width: + MediaQuery.of( + context, + ).size.width * + 0.75, + child: Text( + textSubheads[j], + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF818181), + ), + ), + ), ), - ), + ], ), - ), - ], + ); + }), ), ); - }), + }, ), - ); - } - ), - ):Emptywidget(context), + ) + : Emptywidget(context), floatingActionButton: Align( alignment: Alignment.bottomCenter, child: InkWell( @@ -141,21 +151,24 @@ class _OrderdetailsfeedbackhistoryState extends State _showFeedbackSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, @@ -179,7 +192,9 @@ class _OrderdetailsfeedbackhistoryState extends State createState() => _OrderdetailspaymenthistoryState(); + State createState() => + _OrderdetailspaymenthistoryState(); } -class _OrderdetailspaymenthistoryState extends State { +class _OrderdetailspaymenthistoryState + extends State { @override void initState() { // TODO: implement initState super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { - var details = Provider.of( - context, - listen: false, - ); - + var details = Provider.of(context, listen: false); }); } @@ -39,94 +35,105 @@ class _OrderdetailspaymenthistoryState extends State onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar(context, "Payment History"), backgroundColor: AppColors.scaffold_bg_color, - body: paymentHistory.isNotEmpty?Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: AlwaysScrollableScrollPhysics(), - itemCount: paymentHistory.length, - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), - - itemBuilder: (context, index) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), - padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: List.generate(7, (j) { - final textheads = [ - "Mode of Payment", - "Payment Reference", - "Payment Amount", - "Adjusted Amount", - "Entered By Employee", - "Payment Received Date", - "Action", - ]; - final textSubheads = [ - "${paymentHistory[index].paymentType}", - "${paymentHistory[index].refNo}", - "${paymentHistory[index].amount}", - "${paymentHistory[index].adjustedAmount}", - "${paymentHistory[index].enteredEmployee}", - "${paymentHistory[index].paymentDate}", - "${paymentHistory[index].approvalStatus}", - ]; - return Container( + body: + paymentHistory.isNotEmpty + ? Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: AlwaysScrollableScrollPhysics(), + itemCount: paymentHistory.length, + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), - padding: EdgeInsets.symmetric( - vertical: 6, - horizontal: 0, - ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - Expanded( - child: Text(textheads[j].toString(), - maxLines: 2, - overflow: TextOverflow.ellipsis,), - ), - Expanded( - child: SizedBox( - // height:45, - width: - MediaQuery.of( - context, - ).size.width * - 0.75, - child: Text( - textSubheads[j], - maxLines: 2, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF818181), - ), + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + padding: EdgeInsets.symmetric( + horizontal: 15, + vertical: 10, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: List.generate(7, (j) { + final textheads = [ + "Mode of Payment", + "Payment Reference", + "Payment Amount", + "Adjusted Amount", + "Entered By Employee", + "Payment Received Date", + "Action", + ]; + final textSubheads = [ + "${paymentHistory[index].paymentType}", + "${paymentHistory[index].refNo}", + "${paymentHistory[index].amount}", + "${paymentHistory[index].adjustedAmount}", + "${paymentHistory[index].enteredEmployee}", + "${paymentHistory[index].paymentDate}", + "${paymentHistory[index].approvalStatus}", + ]; + return Container( + padding: EdgeInsets.symmetric( + vertical: 6, + horizontal: 0, ), - ), - ), - ], - ), - ); - }), - ), - ); - } - ), - ):Emptywidget(context), - + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + textheads[j].toString(), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ), + Expanded( + child: SizedBox( + // height:45, + width: + MediaQuery.of( + context, + ).size.width * + 0.75, + child: Text( + textSubheads[j], + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Color(0xFF818181), + ), + ), + ), + ), + ], + ), + ); + }), + ), + ); + }, + ), + ) + : Emptywidget(context), ), ), ); diff --git a/lib/screens/order/orderModuleDashboard.dart b/lib/screens/order/orderModuleDashboard.dart index 17f9817..594397f 100644 --- a/lib/screens/order/orderModuleDashboard.dart +++ b/lib/screens/order/orderModuleDashboard.dart @@ -323,11 +323,10 @@ class _OrdermoduledashboardState extends State { ); break; } - ; return Expanded( child: InkResponse( onTap: () async { - var navigate; + OrderslistbyModes navigate; if (approvalOrderPages[co].pageName!.contains( "Order List", )) { @@ -431,11 +430,10 @@ class _OrdermoduledashboardState extends State { ); break; } - ; return InkResponse( onTap: () async { - var navigate; + OrderslistbyModes navigate; if (otherOrderPages[index].pageName!.contains( "Order List", )) { @@ -556,7 +554,6 @@ class _OrdermoduledashboardState extends State { ); break; } - ; return InkResponse( onTap: () async { @@ -564,21 +561,21 @@ class _OrdermoduledashboardState extends State { if (receiptListPages[index].pageName!.contains( "Receipt List", )) { - navigate = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => Paymentlistsbymode( - mode: receiptListPages[index].mode!, - pageTitleName: - receiptListPages[index].pageName!, - ), - settings: RouteSettings( - name: "Paymentlistsbymode" - ) + navigate = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Paymentlistsbymode( + mode: receiptListPages[index].mode!, + pageTitleName: + receiptListPages[index].pageName!, + ), + settings: RouteSettings( + name: "Paymentlistsbymode", ), + ), ); } - }, child: Container( padding: EdgeInsets.symmetric( @@ -665,7 +662,6 @@ class _OrdermoduledashboardState extends State { itemBuilder: (context, index) { Widget? SvgIcon; switch (otherPages[index].mode) { - case "self": SvgIcon = SvgPicture.asset( "assets/svg/finance/fin_receipts_ic.svg", @@ -678,11 +674,10 @@ class _OrdermoduledashboardState extends State { ); break; } - ; return InkResponse( onTap: () async { - var navigate; + StatefulWidget navigate; if (otherPages[index].pageName!.contains( "TPC Agent List", )) { @@ -811,7 +806,7 @@ class _OrdermoduledashboardState extends State { child: SingleChildScrollView( child: Column( children: [ - if (provider.ordersgain.length > 0) ...[ + if (provider.ordersgain.isNotEmpty) ...[ Container( padding: EdgeInsets.symmetric( horizontal: 10, @@ -932,11 +927,10 @@ class _OrdermoduledashboardState extends State { SvgIcon = SvgPicture.asset("assets/svg/fin_ic.svg"); break; } - ; return InkResponse( onTap: () async { - var navigate; + StatefulWidget navigate; if (pages[index].pageName!.contains("Add Order")) { navigate = AddorderScreen( mode: pages[index].mode!, @@ -1188,9 +1182,7 @@ class _OrdermoduledashboardState extends State { // } Navigator.pop(context); }, - leading: SvgPicture.asset( - icons[index], - ), + leading: SvgPicture.asset(icons[index]), title: Text( "${pages2[index].pageName}", style: TextStyle( diff --git a/lib/screens/order/ordersDetailsByModes.dart b/lib/screens/order/ordersDetailsByModes.dart index 175abbe..654565c 100644 --- a/lib/screens/order/ordersDetailsByModes.dart +++ b/lib/screens/order/ordersDetailsByModes.dart @@ -510,7 +510,7 @@ class _OrdersdetailsbymodesState extends State { resizeToAvoidBottomInset: true, appBar: appbar2New( context, - "Order Details", + "Order Details", provider.resetAll, SizedBox.shrink(), 0xFFFFFFFF, @@ -536,10 +536,7 @@ class _OrdersdetailsbymodesState extends State { ), ), // margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - padding: EdgeInsets.symmetric( - vertical: 10, - horizontal: 10, - ), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), child: Column( children: [ Row( @@ -565,8 +562,7 @@ class _OrdersdetailsbymodesState extends State { flex: 4, child: SizedBox( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ InkResponse( onTap: () {}, @@ -578,8 +574,7 @@ class _OrdersdetailsbymodesState extends State { child: Text( orderDetails.accountName == "" ? "-" - : orderDetails.accountName ?? - "-", + : orderDetails.accountName ?? "-", style: TextStyle( decoration: TextDecoration.underline, @@ -630,9 +625,7 @@ class _OrdersdetailsbymodesState extends State { style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, - color: getTextColor( - orderDetails.status, - ), + color: getTextColor(orderDetails.status), ), ), ), @@ -646,19 +639,18 @@ class _OrdersdetailsbymodesState extends State { context, MaterialPageRoute( builder: - (context) => - Editorderaccountdetails( - mode: widget.mode, - pageTitleName: "Edit Order", - orderID: - widget.orderId, - ), + (context) => Editorderaccountdetails( + mode: widget.mode, + pageTitleName: "Edit Order", + orderID: widget.orderId, + ), settings: RouteSettings( name: 'Editorderaccountdetails', ), ), ); - if (routeSettingName == 'Editorderaccountdetails') { + if (routeSettingName == + 'Editorderaccountdetails') { provider.ordersDetailsByModeAPIFunction( context, widget.orderId, @@ -694,9 +686,7 @@ class _OrdersdetailsbymodesState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.symmetric( - vertical: 4, - ), + padding: EdgeInsets.symmetric(vertical: 4), child: Row( children: [ Expanded( @@ -724,9 +714,7 @@ class _OrdersdetailsbymodesState extends State { ), Column( - children: List.generate(headings.length, ( - j, - ) { + children: List.generate(headings.length, (j) { return Container( padding: EdgeInsets.symmetric( vertical: 7, @@ -739,8 +727,7 @@ class _OrdersdetailsbymodesState extends State { child: Text( headings[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -761,22 +748,16 @@ class _OrdersdetailsbymodesState extends State { fontSize: 14, decoration: - subHeadings[j] == - "View" + subHeadings[j] == "View" ? TextDecoration .underline - : TextDecoration - .none, + : TextDecoration.none, decorationColor: AppColors.app_blue, color: - subHeadings[j] == - "View" - ? AppColors - .app_blue - : Color( - 0xFF818181, - ), + subHeadings[j] == "View" + ? AppColors.app_blue + : Color(0xFF818181), ), ), ), @@ -814,9 +795,7 @@ class _OrdersdetailsbymodesState extends State { ), Transform.flip( flipY: - provider.showMoreDetails - ? true - : false, + provider.showMoreDetails ? true : false, child: SvgPicture.asset( "assets/svg/arrow_dropdown.svg", height: 25, @@ -839,11 +818,7 @@ class _OrdersdetailsbymodesState extends State { ///product details if (productsHistory.isNotEmpty) ...[ Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -876,8 +851,7 @@ class _OrdersdetailsbymodesState extends State { itemBuilder: (context, lp) { return Container( height: 300, - width: - MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.of(context).size.width * 0.9, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(14), @@ -948,8 +922,7 @@ class _OrdersdetailsbymodesState extends State { "JakartaMedium", fontSize: 14, color: - AppColors - .app_blue, + AppColors.app_blue, ), ), ), @@ -1032,15 +1005,14 @@ class _OrdersdetailsbymodesState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( textAlign: TextAlign.left, heads[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -1055,31 +1027,31 @@ class _OrdersdetailsbymodesState extends State { MaterialPageRoute( builder: ( - context, + context, ) => Fileviewer( - fileName: - feedbackHistory[lp].attachmentViewFileName!, - fileUrl: - feedbackHistory[lp].attachmentDirFilePath!, - ), + fileName: + feedbackHistory[lp] + .attachmentViewFileName!, + fileUrl: + feedbackHistory[lp] + .attachmentDirFilePath!, + ), ), ); }, child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, - color: - AppColors.app_blue, + color: AppColors.app_blue, decorationColor: - AppColors.app_blue, + AppColors.app_blue, decoration: - TextDecoration - .underline, + TextDecoration + .underline, ), ), ), @@ -1133,13 +1105,10 @@ class _OrdersdetailsbymodesState extends State { ), ), ...List.generate(2, (j) { - final heads = [ - "Unit Price", - "Total Price" - ]; + final heads = ["Unit Price", "Total Price"]; final subHeads = [ - "₹ ${productsHistory[lp].unitPrice ?? "-"}", - "₹ ${productsHistory[lp].totalPrice ?? "-"}", + "₹ ${productsHistory[lp].unitPrice ?? "-"}", + "₹ ${productsHistory[lp].totalPrice ?? "-"}", ]; return Container( padding: EdgeInsets.symmetric( @@ -1147,15 +1116,14 @@ class _OrdersdetailsbymodesState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( textAlign: TextAlign.left, heads[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -1170,31 +1138,31 @@ class _OrdersdetailsbymodesState extends State { MaterialPageRoute( builder: ( - context, + context, ) => Fileviewer( - fileName: - feedbackHistory[lp].attachmentViewFileName!, - fileUrl: - feedbackHistory[lp].attachmentDirFilePath!, - ), + fileName: + feedbackHistory[lp] + .attachmentViewFileName!, + fileUrl: + feedbackHistory[lp] + .attachmentDirFilePath!, + ), ), ); }, child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, - color: - AppColors.app_blue, + color: AppColors.app_blue, decorationColor: - AppColors.app_blue, + AppColors.app_blue, decoration: - TextDecoration - .underline, + TextDecoration + .underline, ), ), ), @@ -1227,11 +1195,7 @@ class _OrdersdetailsbymodesState extends State { ///Feedback details Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -1285,8 +1249,7 @@ class _OrdersdetailsbymodesState extends State { itemBuilder: (context, lp) { return Container( height: 220, - width: - MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.of(context).size.width * 0.9, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(14), @@ -1300,8 +1263,7 @@ class _OrdersdetailsbymodesState extends State { child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1380,9 +1342,10 @@ class _OrdersdetailsbymodesState extends State { child: Center( child: Text( textAlign: - TextAlign - .center, - "${feedbackHistory[lp].status ?? "-"}", + TextAlign.center, + feedbackHistory[lp] + .status ?? + "-", style: TextStyle( fontFamily: "JakartaMedium", @@ -1433,10 +1396,7 @@ class _OrdersdetailsbymodesState extends State { ), ), ...List.generate(2, (j) { - final heads = [ - "Feedback", - "Attachment", - ]; + final heads = ["Feedback", "Attachment"]; final subHeads = [ feedbackHistory[lp].feedback ?? "-", "View", @@ -1450,13 +1410,12 @@ class _OrdersdetailsbymodesState extends State { CrossAxisAlignment.start, children: [ Expanded( - flex:1, + flex: 1, child: Text( textAlign: TextAlign.left, heads[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -1464,7 +1423,7 @@ class _OrdersdetailsbymodesState extends State { ), if (subHeads[j] == "View") ...[ Expanded( - flex:3, + flex: 3, child: InkResponse( onTap: () { Navigator.push( @@ -1475,23 +1434,23 @@ class _OrdersdetailsbymodesState extends State { context, ) => Fileviewer( fileName: - feedbackHistory[lp].attachmentViewFileName!, + feedbackHistory[lp] + .attachmentViewFileName!, fileUrl: - feedbackHistory[lp].attachmentDirFilePath!, + feedbackHistory[lp] + .attachmentDirFilePath!, ), ), ); }, child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, - color: - AppColors.app_blue, + color: AppColors.app_blue, decorationColor: AppColors.app_blue, decoration: @@ -1503,13 +1462,13 @@ class _OrdersdetailsbymodesState extends State { ), ] else ...[ Expanded( - flex:4, + flex: 4, child: Text( textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], - maxLines:2, + maxLines: 2, style: TextStyle( fontSize: 14, color: Color(0xFF818181), @@ -1558,14 +1517,9 @@ class _OrdersdetailsbymodesState extends State { ], ///PaymentHistory details - if (paymentHistory.isNotEmpty) ...[ Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -1579,7 +1533,6 @@ class _OrdersdetailsbymodesState extends State { ), ), ), - ], ), ), @@ -1598,9 +1551,7 @@ class _OrdersdetailsbymodesState extends State { itemBuilder: (context, lp) { return Container( height: 225, - width: - MediaQuery.of(context).size.width * - 0.9, + width: MediaQuery.of(context).size.width * 0.9, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(14), @@ -1609,17 +1560,14 @@ class _OrdersdetailsbymodesState extends State { horizontal: 10, vertical: 10, ), - margin: EdgeInsets.symmetric( - horizontal: 5, - ), + margin: EdgeInsets.symmetric(horizontal: 5), child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( flex: 1, @@ -1634,10 +1582,9 @@ class _OrdersdetailsbymodesState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment.start, mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ Row( children: [ @@ -1645,35 +1592,31 @@ class _OrdersdetailsbymodesState extends State { flex: 4, child: Column( crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment + .start, children: [ Text( paymentHistory[lp] - .ename ?? + .ename ?? "-", style: TextStyle( fontFamily: - "JakartaMedium", - fontSize: - 14, + "JakartaMedium", + fontSize: 14, color: - AppColors - .semi_black, + AppColors + .semi_black, ), ), Text( - "₹ ${paymentHistory[lp] - .amount ?? - "-"}", + "₹ ${paymentHistory[lp].amount ?? "-"}", style: TextStyle( fontFamily: - "JakartaMedium", - fontSize: - 14, + "JakartaMedium", + fontSize: 14, color: - AppColors - .grey_semi, + AppColors + .grey_semi, ), ), ], @@ -1689,43 +1632,36 @@ class _OrdersdetailsbymodesState extends State { flex: 2, child: Container( height: 45, - padding: - EdgeInsets.symmetric( + padding: EdgeInsets.symmetric( horizontal: 5, ), decoration: BoxDecoration( - color: - AppColors - .processed_bg_color, - borderRadius: - BorderRadius.circular( + color: AppColors.processed_bg_color, + borderRadius: BorderRadius.circular( 8, ), ), child: Center( child: Text( - paymentHistory[lp].approvalStatus??"-", - textAlign: - TextAlign.right, + paymentHistory[lp] + .approvalStatus ?? + "-", + textAlign: TextAlign.right, style: TextStyle( - fontFamily: - "JakartaMedium", + fontFamily: "JakartaMedium", fontSize: 14, color: - AppColors - .processed_text_color, + AppColors + .processed_text_color, ), ), ), ), ), - ], ), Container( - padding: EdgeInsets.symmetric( - vertical: 10, - ), + padding: EdgeInsets.symmetric(vertical: 10), child: Row( children: [ Expanded( @@ -1734,8 +1670,7 @@ class _OrdersdetailsbymodesState extends State { "Payment Info", style: TextStyle( fontSize: 14, - fontFamily: - "JakartaSemiBold", + fontFamily: "JakartaSemiBold", ), ), ), @@ -1744,8 +1679,7 @@ class _OrdersdetailsbymodesState extends State { child: DottedLine( dashGapLength: 4, dashGapColor: Colors.white, - dashColor: - AppColors.grey_semi, + dashColor: AppColors.grey_semi, dashLength: 2, lineThickness: 0.5, ), @@ -1761,17 +1695,10 @@ class _OrdersdetailsbymodesState extends State { "Payment Date", ]; final subHeadsa = [ - paymentHistory[lp] - .paymentType ?? - "-", paymentHistory[lp] - .refNo ?? - "-", - "₹${paymentHistory[lp] - .adjustedAmount ?? - "-"}", - paymentHistory[lp] - .paymentDate ?? - "-", + paymentHistory[lp].paymentType ?? "-", + paymentHistory[lp].refNo ?? "-", + "₹${paymentHistory[lp].adjustedAmount ?? "-"}", + paymentHistory[lp].paymentDate ?? "-", ]; return Container( padding: EdgeInsets.symmetric( @@ -1779,34 +1706,28 @@ class _OrdersdetailsbymodesState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( textAlign: TextAlign.left, headsa[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, - color: - AppColors - .semi_black, + color: AppColors.semi_black, ), ), ), Expanded( child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeadsa[j] == "" ? "-" : subHeadsa[j], style: TextStyle( fontSize: 14, - color: Color( - 0xFF818181, - ), + color: Color(0xFF818181), ), ), ), @@ -1814,7 +1735,6 @@ class _OrdersdetailsbymodesState extends State { ), ); }), - ], ), ); @@ -1830,65 +1750,64 @@ class _OrdersdetailsbymodesState extends State { bottomNavigationBar: (widget.mode == "pending_approval") ? SizedBox.shrink() - : widget.mode=="self" && orderDetails.status == "Customer verification Pending"? - - Container( - decoration: BoxDecoration(color: Colors.white), - padding: EdgeInsets.symmetric(horizontal: 10), - alignment: Alignment.bottomCenter, - height: 75, - child: Container( - margin: EdgeInsets.only(bottom: 10), - alignment: Alignment.center, - height: 45, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - - SizedBox(width: 10), - Expanded( - child: InkResponse( - onTap: () { - _showVerifyOTPSheet(context); - }, - child: Container( - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8), - // color: Color(0xFFFFEFEF), - // border: Border.all( - // color: Color(0xFFED3424), - // width: 0.5, - // ), - // ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/svg/finance/verify_otp_ic.svg"), - SizedBox(width: 5,), - Center( - child: Text( - "Verify OTP", - style: TextStyle( - color: AppColors.semi_black, - fontSize: 14, + : widget.mode == "self" && + orderDetails.status == "Customer verification Pending" + ? Container( + decoration: BoxDecoration(color: Colors.white), + padding: EdgeInsets.symmetric(horizontal: 10), + alignment: Alignment.bottomCenter, + height: 75, + child: Container( + margin: EdgeInsets.only(bottom: 10), + alignment: Alignment.center, + height: 45, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(width: 10), + Expanded( + child: InkResponse( + onTap: () { + _showVerifyOTPSheet(context); + }, + child: Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(8), + // color: Color(0xFFFFEFEF), + // border: Border.all( + // color: Color(0xFFED3424), + // width: 0.5, + // ), + // ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/svg/finance/verify_otp_ic.svg", + ), + SizedBox(width: 5), + Center( + child: Text( + "Verify OTP", + style: TextStyle( + color: AppColors.semi_black, + fontSize: 14, + ), ), ), - ), - ], + ], + ), ), ), ), - ), - SizedBox(width: 10), - - - ], - ), - ), - ) - :Container( - decoration: BoxDecoration(color: Colors.white), - padding: EdgeInsets.symmetric(horizontal: 10), + SizedBox(width: 10), + ], + ), + ), + ) + : Container( + decoration: BoxDecoration(color: Colors.white), + padding: EdgeInsets.symmetric(horizontal: 10), alignment: Alignment.bottomCenter, height: 75, child: Container( @@ -1926,7 +1845,7 @@ class _OrdersdetailsbymodesState extends State { SvgPicture.asset( "assets/svg/finance/level_reject_ic.svg", ), - SizedBox(width: 5,), + SizedBox(width: 5), Center( child: Text( "Reject", @@ -1981,7 +1900,7 @@ class _OrdersdetailsbymodesState extends State { SvgPicture.asset( "assets/svg/finance/level_approve_ic.svg", ), - SizedBox(width: 5,), + SizedBox(width: 5), Center( child: Text( "Approve", @@ -1999,7 +1918,7 @@ class _OrdersdetailsbymodesState extends State { SizedBox(width: 10), ], - if (widget.mode=="admin") ...[ + if (widget.mode == "admin") ...[ SvgPicture.asset( "assets/svg/crm/vertical_line_ic.svg", ), @@ -2021,8 +1940,10 @@ class _OrdersdetailsbymodesState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - SvgPicture.asset("assets/svg/finance/level_delete_ic.svg"), - SizedBox(width: 5,), + SvgPicture.asset( + "assets/svg/finance/level_delete_ic.svg", + ), + SizedBox(width: 5), Center( child: Text( "Delete", @@ -2369,7 +2290,7 @@ class _OrdersdetailsbymodesState extends State { ? "View" : subHeadings[j] == "" ? "-" - : "${subHeadings[j]}", + : subHeadings[j], style: TextStyle( fontSize: 14, color: @@ -2746,8 +2667,8 @@ class _OrdersdetailsbymodesState extends State { alignment: Alignment.topLeft, child: Text( type == "Approve" - ? "${provider.approvalSheetHeading}" - : "${provider.rejecetionSheetHeading}", + ? provider.approvalSheetHeading + : provider.rejecetionSheetHeading, style: TextStyle( color: AppColors.app_blue, fontSize: 16, @@ -3413,7 +3334,7 @@ class _OrdersdetailsbymodesState extends State { Align( alignment: Alignment.topLeft, child: Text( - "${provider.deletionSheetHeading}", + provider.deletionSheetHeading, style: TextStyle( color: AppColors.app_blue, fontSize: 16, @@ -3550,9 +3471,9 @@ class _OrdersdetailsbymodesState extends State { return Padding( padding: EdgeInsets.only( bottom: - MediaQuery.of( - context, - ).viewInsets.bottom, // This handles keyboard + MediaQuery.of( + context, + ).viewInsets.bottom, // This handles keyboard ), child: Container( margin: EdgeInsets.only( @@ -3667,7 +3588,8 @@ class _OrdersdetailsbymodesState extends State { // ), Container( margin: EdgeInsets.zero, - width: MediaQuery.of(context).size.width * 0.78, + width: + MediaQuery.of(context).size.width * 0.78, child: Pinput( useNativeKeyboard: true, // pastedTextStyle: TextStyle( @@ -3681,8 +3603,7 @@ class _OrdersdetailsbymodesState extends State { // controller: provider.otpController, hapticFeedbackType: - HapticFeedbackType.mediumImpact, - + HapticFeedbackType.mediumImpact, // defaultPinTheme: PinTheme( // height: 50, @@ -3710,17 +3631,23 @@ class _OrdersdetailsbymodesState extends State { // borderRadius: BorderRadius.circular(15), // color: AppColors.cyan_blue), // ), - keyboardType: TextInputType.numberWithOptions(), - textInputAction: (Platform.isAndroid) - ? TextInputAction.none - : TextInputAction.done, + keyboardType: + TextInputType.numberWithOptions(), + textInputAction: + (Platform.isAndroid) + ? TextInputAction.none + : TextInputAction.done, inputFormatters: [ FilteringTextInputFormatter.digitsOnly, ], onCompleted: (String enteredCode) { provider.enteredOtp = enteredCode; - provider.verifyOrderAPIFunction(context, provider.orderDetails.id,provider.enteredOtp); + provider.verifyOrderAPIFunction( + context, + provider.orderDetails.id, + provider.enteredOtp, + ); }, onChanged: (String enteredCode) { @@ -3748,7 +3675,10 @@ class _OrdersdetailsbymodesState extends State { ), child: InkResponse( onTap: () { - provider.ResendOtpAPI(context,provider.orderDetails.id); + provider.ResendOtpAPI( + context, + provider.orderDetails.id, + ); }, child: Center( child: Text( @@ -3762,8 +3692,12 @@ class _OrdersdetailsbymodesState extends State { ), InkResponse( - onTap: () async{ - await provider.verifyOrderAPIFunction(context,provider.orderDetails.id,provider.enteredOtp); + onTap: () async { + await provider.verifyOrderAPIFunction( + context, + provider.orderDetails.id, + provider.enteredOtp, + ); }, child: Container( alignment: Alignment.center, @@ -3807,8 +3741,6 @@ class _OrdersdetailsbymodesState extends State { ); } - - Future _showFeedbackSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, @@ -4060,7 +3992,7 @@ class _OrdersdetailsbymodesState extends State { Navigator.of(context).pop(false); provider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -4071,7 +4003,7 @@ class _OrdersdetailsbymodesState extends State { Navigator.of(context).pop(false); provider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/order/ordersListByModes.dart b/lib/screens/order/ordersListByModes.dart index 3d1f428..6bb6ed0 100644 --- a/lib/screens/order/ordersListByModes.dart +++ b/lib/screens/order/ordersListByModes.dart @@ -47,7 +47,10 @@ class _OrderslistbyModesState extends State { }); WidgetsBinding.instance.addPostFrameCallback((_) { - final provider = Provider.of(context, listen: false); + final provider = Provider.of( + context, + listen: false, + ); provider.resetPagination(); provider.ordersListByModeFilterAPIFunction(context, widget.mode); provider.ordersListByModeAPIFunction(context, widget.mode, "", ""); @@ -56,7 +59,10 @@ class _OrderslistbyModesState extends State { _scrollController.addListener(() { if (_scrollController.position.pixels >= _scrollController.position.maxScrollExtent - 200) { - final provider = Provider.of(context, listen: false); + final provider = Provider.of( + context, + listen: false, + ); provider.loadMore(context, widget.mode, "", ""); } }); @@ -126,7 +132,7 @@ class _OrderslistbyModesState extends State { return "L2R"; case 'Sales Order Registered': return "SOR"; - case 'Dispatched': + case 'Dispatched': return "D"; } return text; @@ -175,7 +181,10 @@ class _OrderslistbyModesState extends State { ? Platform.isAndroid ? WillPopScope( onWillPop: () { - Provider.of(context,listen: false).resetAll(); + Provider.of( + context, + listen: false, + ).resetAll(); return onBackPressed(context); }, child: SafeArea( @@ -220,183 +229,181 @@ class _OrderslistbyModesState extends State { 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading && ordersList.isEmpty - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation(AppColors.app_blue), - ), - ) - : ordersList.isNotEmpty - ? RefreshIndicator( - onRefresh: () async { - provider.resetPagination(); - await provider.ordersListByModeAPIFunction( - context, - widget.mode, - "", - "", - ); - }, - child: ListView.builder( - controller: _scrollController, - itemCount: ordersList.length + (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, ol) { - if (ol == ordersList.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center(child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final order = ordersList[ol]; - return InkResponse( - onTap: () async { - var res = await Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Ordersdetailsbymodes( - pageTitleName: widget.pageTitleName, - orderId: ordersList[ol].orderId, - mode: widget.mode, - ), - settings: RouteSettings(name: "Ordersdetailsbymodes") + body: + provider.isLoading && ordersList.isEmpty + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - ); - if (routeSettingName == "Ordersdetailsbymodes") { - provider.ordersListByModeFilterAPIFunction( - context, - widget.mode, - ); - provider.ordersListByModeAPIFunction( + ), + ) + : ordersList.isNotEmpty + ? RefreshIndicator( + onRefresh: () async { + provider.resetPagination(); + await provider.ordersListByModeAPIFunction( context, widget.mode, "", "", ); - } - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 7.5, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 50, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: getDecorationColor( - ordersList[ol].status, - ), - shape: BoxShape.circle, - ), + }, + child: ListView.builder( + controller: _scrollController, + itemCount: + ordersList.length + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, ol) { + if (ol == ordersList.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), child: Center( - child: Text( - getText( - ordersList[ol].status, - ), - style: TextStyle( - color: getTextColor( - ordersList[ol].status, - ), - fontSize: getSize( - ordersList[ol].status, - ), - fontFamily: "JakartaBold", + child: CircularProgressIndicator(), + ), + ) + : const SizedBox.shrink(); + } + + final order = ordersList[ol]; + return InkResponse( + onTap: () async { + var res = await Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Ordersdetailsbymodes( + pageTitleName: widget.pageTitleName, + orderId: ordersList[ol].orderId, + mode: widget.mode, ), - ), + settings: RouteSettings( + name: "Ordersdetailsbymodes", ), ), + ); + if (routeSettingName == "Ordersdetailsbymodes") { + provider.ordersListByModeFilterAPIFunction( + context, + widget.mode, + ); + provider.ordersListByModeAPIFunction( + context, + widget.mode, + "", + "", + ); + } + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 7.5, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - ordersList[ol] - .accountName!, - maxLines: 1, - overflow: - TextOverflow.ellipsis, - style: TextStyle( - fontFamily: - "JakartaRegular", - fontSize: 14, - color: AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 50, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: getDecorationColor( + ordersList[ol].status, + ), + shape: BoxShape.circle, + ), + child: Center( + child: Text( + getText(ordersList[ol].status), + style: TextStyle( + color: getTextColor( + ordersList[ol].status, + ), + fontSize: getSize( + ordersList[ol].status, + ), + fontFamily: "JakartaBold", + ), + ), + ), ), ), - Text( - ordersList[ol] - .orderNumber!, - style: TextStyle( - fontSize: 14, - color: AppColors.grey_semi, - fontFamily: - "JakartaRegular", - decoration: - TextDecoration.none, - decorationColor: - AppColors.white, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + ordersList[ol].accountName!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + ordersList[ol].orderNumber!, + style: TextStyle( + fontSize: 14, + color: AppColors.grey_semi, + fontFamily: "JakartaRegular", + decoration: TextDecoration.none, + decorationColor: + AppColors.white, + ), + ), + ], + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 3, + child: Container( + child: Text( + "₹" + "${ordersList[ol].balanceAmount}", + textAlign: TextAlign.right, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), ), ), ], ), - ), - ), - SizedBox(width: 10), - Expanded( - flex: 3, - child: Container( - child: Text( - "₹" - "${ordersList[ol].balanceAmount}", - textAlign: TextAlign.right, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - ), + ], ), - ], - ), - ], + ), + ); + }, ), - ), - ); - }, - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); } - - Future _showOptionsSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, @@ -643,9 +650,7 @@ class _OrderslistbyModesState extends State { provider.selectedEmpName = value.name!; print( - "hfjkshfg" + - provider.selectedEmpID - .toString(), + "hfjkshfg${provider.selectedEmpID}", ); } } diff --git a/lib/screens/order/paymentDetailsByMode.dart b/lib/screens/order/paymentDetailsByMode.dart index f1be754..a85c3f3 100644 --- a/lib/screens/order/paymentDetailsByMode.dart +++ b/lib/screens/order/paymentDetailsByMode.dart @@ -271,10 +271,7 @@ class _PaymentdetailsbymodeState extends State { ), ), // margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - padding: EdgeInsets.symmetric( - vertical: 10, - horizontal: 10, - ), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), child: Column( children: [ Row( @@ -300,8 +297,7 @@ class _PaymentdetailsbymodeState extends State { flex: 4, child: SizedBox( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ InkResponse( onTap: () {}, @@ -313,8 +309,7 @@ class _PaymentdetailsbymodeState extends State { child: Text( paymentDetails.accountName == "" ? "-" - : paymentDetails - .accountName ?? + : paymentDetails.accountName ?? "-", style: TextStyle( decoration: @@ -396,23 +391,23 @@ class _PaymentdetailsbymodeState extends State { .paymentId, "description": provider - .paymentDetails! + .paymentDetails .description, "amount": provider - .paymentDetails! + .paymentDetails .amount, "payment_mode": provider - .paymentDetails! + .paymentDetails .paymentType, "pay_ref": provider - .paymentDetails! + .paymentDetails .refNo, "pay_received_date": provider - .paymentDetails! + .paymentDetails .paymentDate, }, ), @@ -422,12 +417,11 @@ class _PaymentdetailsbymodeState extends State { ), ); if (res == true) { - provider - .paymentsDetailsByModeAPIFunction( - context, - widget.paymentId, - widget.mode, - ); + provider.paymentsDetailsByModeAPIFunction( + context, + widget.paymentId, + widget.mode, + ); } }, child: Container( @@ -459,9 +453,7 @@ class _PaymentdetailsbymodeState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.symmetric( - vertical: 4, - ), + padding: EdgeInsets.symmetric(vertical: 4), child: Row( children: [ Expanded( @@ -489,9 +481,7 @@ class _PaymentdetailsbymodeState extends State { ), Column( - children: List.generate(headings.length, ( - j, - ) { + children: List.generate(headings.length, (j) { return Container( padding: EdgeInsets.symmetric( vertical: 7, @@ -504,8 +494,7 @@ class _PaymentdetailsbymodeState extends State { child: Text( headings[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -526,22 +515,16 @@ class _PaymentdetailsbymodeState extends State { fontSize: 14, decoration: - subHeadings[j] == - "View" + subHeadings[j] == "View" ? TextDecoration .underline - : TextDecoration - .none, + : TextDecoration.none, decorationColor: AppColors.app_blue, color: - subHeadings[j] == - "View" - ? AppColors - .app_blue - : Color( - 0xFF818181, - ), + subHeadings[j] == "View" + ? AppColors.app_blue + : Color(0xFF818181), ), ), ), @@ -579,9 +562,7 @@ class _PaymentdetailsbymodeState extends State { ), Transform.flip( flipY: - provider.showMoreDetails - ? true - : false, + provider.showMoreDetails ? true : false, child: SvgPicture.asset( "assets/svg/arrow_dropdown.svg", height: 25, @@ -621,13 +602,13 @@ class _PaymentdetailsbymodeState extends State { context, paymentDetails.paymentId, ); - Future.delayed(Duration(milliseconds: 500),() { + Future.delayed(Duration(milliseconds: 500), () { _showAddAdjustedOrderSheet( context, paymentDetails.paymentId, widget.mode, ); - },); + }); }, child: Padding( padding: const EdgeInsets.all(8.0), @@ -650,10 +631,7 @@ class _PaymentdetailsbymodeState extends State { shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: adjustList.length, - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), itemBuilder: (context, lp) { return InkResponse( @@ -741,15 +719,14 @@ class _PaymentdetailsbymodeState extends State { context, MaterialPageRoute( builder: - ( - context, - ) => Ordersdetailsbymodes( - pageTitleName: - "CRM Order Details", - mode: widget.mode, - orderId: - adjustList[lp].id, - ), + (context) => + Ordersdetailsbymodes( + pageTitleName: + "CRM Order Details", + mode: widget.mode, + orderId: + adjustList[lp].id, + ), ), ); }, @@ -780,9 +757,7 @@ class _PaymentdetailsbymodeState extends State { ], ), Container( - padding: EdgeInsets.symmetric( - vertical: 7.5, - ), + padding: EdgeInsets.symmetric(vertical: 7.5), child: Row( children: [ Expanded( @@ -822,9 +797,7 @@ class _PaymentdetailsbymodeState extends State { adjustList[lp].adjustedAmount ?? "-", ]; return Container( - padding: EdgeInsets.symmetric( - vertical: 3, - ), + padding: EdgeInsets.symmetric(vertical: 3), child: Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -843,9 +816,7 @@ class _PaymentdetailsbymodeState extends State { Expanded( child: Text( textAlign: TextAlign.right, - subHeads[j] == "" - ? "-" - : subHeads[j], + subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, color: Color(0xFF818181), @@ -870,13 +841,13 @@ class _PaymentdetailsbymodeState extends State { context, paymentDetails.paymentId, ); - Future.delayed(Duration(milliseconds: 500),() { + Future.delayed(Duration(milliseconds: 500), () { _showAddAdjustedOrderSheet( context, paymentDetails.paymentId, widget.mode, ); - },); + }); }, child: Container( height: 50, @@ -934,8 +905,7 @@ class _PaymentdetailsbymodeState extends State { // ), // ), child: Row( - mainAxisAlignment: - MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( "assets/svg/finance/level_reject_ic.svg", @@ -983,8 +953,7 @@ class _PaymentdetailsbymodeState extends State { // ), // ), child: Row( - mainAxisAlignment: - MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( "assets/svg/finance/level_approve_ic.svg", @@ -1023,8 +992,7 @@ class _PaymentdetailsbymodeState extends State { // ), // ), child: Row( - mainAxisAlignment: - MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ SvgPicture.asset( "assets/svg/finance/level_delete_ic.svg", @@ -1210,7 +1178,7 @@ class _PaymentdetailsbymodeState extends State { child: Text( provider.Headings[j] == "Attachment" ? "View" - : "${provider.subHeadings[j]}", + : provider.subHeadings[j], style: TextStyle( fontSize: 14, color: @@ -1553,23 +1521,23 @@ class _PaymentdetailsbymodeState extends State { .paymentId, "description": provider - .paymentDetails! + .paymentDetails .description, "amount": provider - .paymentDetails! + .paymentDetails .amount, "payment_mode": provider - .paymentDetails! + .paymentDetails .paymentType, "pay_ref": provider - .paymentDetails! + .paymentDetails .refNo, "pay_received_date": provider - .paymentDetails! + .paymentDetails .paymentDate, }, ), @@ -1682,8 +1650,8 @@ class _PaymentdetailsbymodeState extends State { alignment: Alignment.topLeft, child: Text( type == "Approve" - ? "${"Payment Approval"}" - : "${"Payment Reject"}", + ? "Payment Approval" + : "Payment Reject", style: TextStyle( color: AppColors.app_blue, fontSize: 16, @@ -2107,7 +2075,7 @@ class _PaymentdetailsbymodeState extends State { if (provider.paidList.isNotEmpty) { provider.editselectedPaidList = value; provider.editselectedPaidOrderId = - value!.orderId; + value.orderId; print( "Selected Complaint Type: ${provider.editselectedPaidOrderId}, ID: ${value.orderNumber}", ); @@ -2330,7 +2298,7 @@ class _PaymentdetailsbymodeState extends State { if (provider.paidList.isNotEmpty) { provider.editselectedPaidList = value; provider.editselectedPaidOrderId = - value!.orderId; + value.orderId; print( "Selected Complaint Type: ${value.orderId}, ID: ${value.orderNumber}", ); diff --git a/lib/screens/order/paymentListsByMode.dart b/lib/screens/order/paymentListsByMode.dart index 7fc05a9..052c90d 100644 --- a/lib/screens/order/paymentListsByMode.dart +++ b/lib/screens/order/paymentListsByMode.dart @@ -14,12 +14,16 @@ import '../../Utils/dropdownTheme.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:generp/Utils/commonServices.dart'; + class Paymentlistsbymode extends StatefulWidget { final mode; final pageTitleName; - const Paymentlistsbymode( - {super.key, required this.mode, required this.pageTitleName}); + const Paymentlistsbymode({ + super.key, + required this.mode, + required this.pageTitleName, + }); @override State createState() => _PaymentlistsbymodeState(); @@ -117,6 +121,7 @@ class _PaymentlistsbymodeState extends State { } return 18.0; } + final ScrollController _scrollController = ScrollController(); @override @@ -165,25 +170,26 @@ class _PaymentlistsbymodeState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () async { - Provider.of(context,listen: false).resetAll(); - Navigator.pop(context,true); - return true; - }, - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () async { + Provider.of( + context, + listen: false, + ).resetAll(); + Navigator.pop(context, true); + return true; + }, + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } - Widget _scaffold(BuildContext context) { - return Consumer( builder: (context, provider, child) { final paymentLists = provider.paymentsList; @@ -201,179 +207,180 @@ class _PaymentlistsbymodeState extends State { // }, // child: SvgPicture.asset("assets/svg/ic_download.svg",), // ), - InkResponse( onTap: () async { _showFilterSheet(context); }, child: SvgPicture.asset( - "assets/svg/filter_ic.svg", height: 25,), + "assets/svg/filter_ic.svg", + height: 25, + ), ), ], ), - 0xFFFFFFFF + 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading && paymentLists.isEmpty - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation(AppColors.app_blue), - ), - ) - : paymentLists.isNotEmpty - ? RefreshIndicator( - onRefresh: () async { - provider.resetPagination(); - await provider.paymentsListsByModeAPIFunction( - context, - widget.mode, - "", - ); - }, - child: ListView.builder( - controller: _scrollController, - itemCount: paymentLists.length + (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, index) { - if (index == paymentLists.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center(child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final payment = paymentLists[index]; - return InkResponse( - onTap: () async { - Navigator.push(context, MaterialPageRoute( - builder: (context) => - Paymentdetailsbymode(mode: widget.mode, - pageTitleName: widget.pageTitleName, - paymentId: paymentLists[index].paymentId, - ),)); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 7.5, - vertical: 5, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), + body: + provider.isLoading && paymentLists.isEmpty + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, + ), ), - child: Column( - - children: [ - Row( - children: [ - - Expanded( - flex: 1, - child: Container( - height: 50, - width: 50, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: getDecorationColor( - paymentLists[index].status, - ), - shape: BoxShape.circle, - ), + ) + : paymentLists.isNotEmpty + ? RefreshIndicator( + onRefresh: () async { + provider.resetPagination(); + await provider.paymentsListsByModeAPIFunction( + context, + widget.mode, + "", + ); + }, + child: ListView.builder( + controller: _scrollController, + itemCount: + paymentLists.length + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, index) { + if (index == paymentLists.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), child: Center( - child: Text( - getText( - paymentLists[index].status, - ), - style: TextStyle( - color: getTextColor( - paymentLists[index].status, - ), - fontSize: getSize( - paymentLists[index].status, - ), - fontFamily: "JakartaBold", - ), - ), + child: CircularProgressIndicator(), ), + ) + : const SizedBox.shrink(); + } + + final payment = paymentLists[index]; + return InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Paymentdetailsbymode( + mode: widget.mode, + pageTitleName: widget.pageTitleName, + paymentId: paymentLists[index].paymentId, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 7.5, + vertical: 5, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), ), - SizedBox(width: 10), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + child: Column( + children: [ + Row( children: [ - Text( - paymentLists[index].ename!, - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: - AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 50, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: getDecorationColor( + paymentLists[index].status, + ), + shape: BoxShape.circle, + ), + child: Center( + child: Text( + getText(paymentLists[index].status), + style: TextStyle( + color: getTextColor( + paymentLists[index].status, + ), + fontSize: getSize( + paymentLists[index].status, + ), + fontFamily: "JakartaBold", + ), + ), + ), ), ), - Text( - paymentLists[index] - .orderNumber??"-", - style: TextStyle( - fontSize: 14, - color: AppColors.grey_semi, - fontFamily: - "JakartaRegular", - decoration: - TextDecoration.none, - decorationColor: - AppColors.white, + SizedBox(width: 10), + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + paymentLists[index].ename!, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + paymentLists[index].orderNumber ?? + "-", + style: TextStyle( + fontSize: 14, + color: AppColors.grey_semi, + fontFamily: "JakartaRegular", + decoration: TextDecoration.none, + decorationColor: + AppColors.white, + ), + ), + ], + ), ), ), - - ], - ), - ), - ), - Expanded( - flex: 2, - child: Container( - - child: Center( - child: Text( - "₹" - "${paymentLists[index].amount}", - textAlign: TextAlign.right, - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, + Expanded( + flex: 2, + child: Container( + child: Center( + child: Text( + "₹" + "${paymentLists[index].amount}", + textAlign: TextAlign.right, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ), + ), ), - ), + ], ), - ), + ], ), - ], - ), - - ], + ), + ); + }, ), - ), - ); - }, - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); } + Widget _scaffold1(BuildContext context) { switch (_source.keys.toList()[0]) { case ConnectivityResult.mobile: @@ -386,8 +393,7 @@ class _PaymentlistsbymodeState extends State { default: connection = 'Offline'; } - return - Consumer( + return Consumer( builder: (context, provider, child) { final paymentLists = provider.paymentsList; return WillPopScope( @@ -397,7 +403,7 @@ class _PaymentlistsbymodeState extends State { }, child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar2( @@ -412,231 +418,245 @@ class _PaymentlistsbymodeState extends State { // }, // child: SvgPicture.asset("assets/svg/ic_download.svg",), // ), - InkResponse( onTap: () async { _showFilterSheet(context); }, child: SvgPicture.asset( - "assets/svg/filter_ic.svg", height: 25,), + "assets/svg/filter_ic.svg", + height: 25, + ), ), ], ), ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center(child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue) - )) - : paymentLists.isNotEmpty ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - itemCount: paymentLists.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - if (paymentLists.isEmpty) { - return SizedBox( - child: Center( - child: Text("No Data Available"), - ), - ); - } - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Color(0xFFFFF3CE), - borderRadius: - BorderRadius.circular(8), - ), - child: SvgPicture.asset( - "assets/svg/fin_ic.svg", - ), + ), + ) + : paymentLists.isNotEmpty + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + itemCount: paymentLists.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + if (paymentLists.isEmpty) { + return SizedBox( + child: Center( + child: Text("No Data Available"), ), + ); + } + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - paymentLists[index].ename!, - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: - AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + padding: EdgeInsets.all(8.0), + decoration: BoxDecoration( + color: Color(0xFFFFF3CE), + borderRadius: + BorderRadius.circular(8), + ), + child: SvgPicture.asset( + "assets/svg/fin_ic.svg", + ), ), ), - Text( - "₹" - "${paymentLists[index].amount}", - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + paymentLists[index].ename!, + style: TextStyle( + fontFamily: + "JakartaMedium", + fontSize: 14, + color: + AppColors.semi_black, + ), + ), + Text( + "₹" + "${paymentLists[index].amount}", + style: TextStyle( + fontFamily: + "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ], + ), + ), + ), + Expanded( + flex: 2, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 5, + vertical: 10, + ), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(8), + color: Color(0xFFE3FFE0), + ), + child: Center( + child: Text( + paymentLists[index].status!, + textAlign: TextAlign.center, + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: Color(0xFF0D9C00), + ), + ), + ), ), ), ], ), - ), - ), - Expanded( - flex: 2, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 5, - vertical: 10, - ), - decoration: BoxDecoration( - borderRadius: - BorderRadius.circular(8), - color: Color(0xFFE3FFE0), + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), ), - child: Center( - child: Text( - paymentLists[index].status!, - textAlign: TextAlign.center, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: Color(0xFF0D9C00), + ...List.generate(4, (j) { + final headings = [ + "Customer Name", + "Order Number", + "Date", + "Description", + ]; + + final subHeadings = [ + paymentLists[index].aname, + paymentLists[index].orderNumber, + paymentLists[index].datetime, + paymentLists[index].description, + ]; + return Container( + padding: EdgeInsets.symmetric( + vertical: 5, ), - ), - ), - ), - ), - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(4, (j) { - final headings = [ - "Customer Name", - "Order Number", - "Date", - "Description", - ]; - - final subHeadings = [ - paymentLists[index].aname, - paymentLists[index].orderNumber, - paymentLists[index].datetime, - paymentLists[index].description, - ]; - return Container( - padding: EdgeInsets.symmetric( - vertical: 5, - ), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, - ), - ), - ), - Expanded( - child: InkResponse( - - child: Text( - "${subHeadings[j]}", - style: TextStyle( - fontSize: 14, - color: Color( - 0xFF818181, + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + ), + Expanded( + child: InkResponse( + child: Text( + "${subHeadings[j]}", + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + decoration: + TextDecoration.none, + decorationColor: + AppColors.white, + ), + ), + ), ), - decoration: TextDecoration - .none, - decorationColor: AppColors.white, + ], + ), + ); + }), + InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Paymentdetailsbymode( + mode: widget.mode, + pageTitleName: + widget + .pageTitleName, + paymentId: + paymentLists[index] + .paymentId, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 5, + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), ), ), ], ), ); - }), - InkResponse( - onTap: () async { - Navigator.push(context, MaterialPageRoute( - builder: (context) => - Paymentdetailsbymode(mode: widget.mode, - pageTitleName: widget.pageTitleName, - paymentId: paymentLists[index].paymentId, - ),)); - }, - child: Container( - padding: EdgeInsets.symmetric( - vertical: 5, - ), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ), - ], - ), - ); - }, - ), - ], - ), - ) : Emptywidget(context), + }, + ), + ], + ), + ) + : Emptywidget(context), ), ), ); @@ -666,7 +686,9 @@ class _PaymentlistsbymodeState extends State { right: 15, top: 10, ), - padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom,), + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, @@ -750,10 +772,7 @@ class _PaymentlistsbymodeState extends State { builder: (context, provider, child) { return Container( padding: EdgeInsets.only( - bottom: MediaQuery - .of(context) - .viewInsets - .bottom, + bottom: MediaQuery.of(context).viewInsets.bottom, ), margin: EdgeInsets.only( bottom: 15, @@ -795,46 +814,45 @@ class _PaymentlistsbymodeState extends State { overflow: TextOverflow.ellipsis, ), items: - provider.employeesList - .map( - (emps) => - DropdownMenuItem( - value: emps, - child: Text( - emps.name ?? '', - style: const TextStyle( - fontSize: 14, - ), - overflow: - TextOverflow.ellipsis, - ), - ), - ) - .toList(), + provider.employeesList + .map( + (emps) => + DropdownMenuItem( + value: emps, + child: Text( + emps.name ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow.ellipsis, + ), + ), + ) + .toList(), value: provider.selectedEmployee, onChanged: (Employees? value) { if (value != null) { if (provider.employeesList.isNotEmpty) { provider.selectedEmployee = value; print( - "Selected Complaint Type: ${value - .name}, ID: ${value.id}", + "Selected Complaint Type: ${value.name}, ID: ${value.id}", ); provider.selectedEmpID = value.id!; provider.selectedEmpName = - value.name!; + value.name!; print( - "hfjkshfg" + - provider.selectedEmpID - .toString(), + "hfjkshfg${provider.selectedEmpID}", ); } } }, buttonStyleData: ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: ddtheme.menuItemStyleData, - dropdownStyleData: ddtheme.dropdownStyleData, + menuItemStyleData: + ddtheme.menuItemStyleData, + dropdownStyleData: + ddtheme.dropdownStyleData, ), ), ], @@ -844,15 +862,22 @@ class _PaymentlistsbymodeState extends State { onTap: () { Navigator.pop(context); provider.paymentsListsByModeAPIFunction( - context, widget.mode, provider.selectedEmpID.toString()); + context, + widget.mode, + provider.selectedEmpID.toString(), + ); }, child: Container( height: 45, alignment: Alignment.center, margin: EdgeInsets.symmetric( - horizontal: 10, vertical: 15), + horizontal: 10, + vertical: 15, + ), padding: EdgeInsets.symmetric( - horizontal: 10, vertical: 5), + horizontal: 10, + vertical: 5, + ), decoration: BoxDecoration( color: AppColors.app_blue, borderRadius: BorderRadius.circular(15), diff --git a/lib/screens/order/tpcAgentDetailsByMode.dart b/lib/screens/order/tpcAgentDetailsByMode.dart index e106595..e3d8a12 100644 --- a/lib/screens/order/tpcAgentDetailsByMode.dart +++ b/lib/screens/order/tpcAgentDetailsByMode.dart @@ -172,7 +172,7 @@ class _TpcagentdetailsbymodeState extends State { children: [ Expanded( flex: 1, - child: Container( + child: SizedBox( height: 50, width: 35, child: SvgPicture.asset( @@ -206,24 +206,20 @@ class _TpcagentdetailsbymodeState extends State { ); }, child: Padding( - padding: - const EdgeInsets.symmetric( - vertical: 3.0, - ), + padding: const EdgeInsets.symmetric( + vertical: 3.0, + ), child: Text( - tpcAgentDetails - .mobileNumber ?? + tpcAgentDetails.mobileNumber ?? "-", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, color: AppColors.grey_semi, decoration: - TextDecoration - .underline, + TextDecoration.underline, decorationStyle: - TextDecorationStyle - .dashed, + TextDecorationStyle.dashed, decorationColor: AppColors.grey_semi, ), @@ -239,8 +235,7 @@ class _TpcagentdetailsbymodeState extends State { ), SizedBox(height: 5), Visibility( - visible: - provider.showMoreDetails ? true : false, + visible: provider.showMoreDetails ? true : false, child: Column( children: List.generate(sections.length, ( sectionIndex, @@ -250,8 +245,7 @@ class _TpcagentdetailsbymodeState extends State { final headings = section["headings"] as List; final subHeadings = - section["subHeadings"] - as List; + section["subHeadings"] as List; return Column( crossAxisAlignment: @@ -269,8 +263,7 @@ class _TpcagentdetailsbymodeState extends State { title, style: TextStyle( fontSize: 14, - fontFamily: - "JakartaSemiBold", + fontFamily: "JakartaSemiBold", ), ), ), @@ -279,8 +272,7 @@ class _TpcagentdetailsbymodeState extends State { child: DottedLine( dashGapLength: 4, dashGapColor: Colors.white, - dashColor: - AppColors.grey_semi, + dashColor: AppColors.grey_semi, dashLength: 2, lineThickness: 0.5, ), @@ -295,7 +287,8 @@ class _TpcagentdetailsbymodeState extends State { ) { if (headings[j] == "ID Proof" && tpcAgentDetails - .idProofDirFilePath=="") { + .idProofDirFilePath == + "") { return SizedBox.shrink(); } return Container( @@ -314,16 +307,14 @@ class _TpcagentdetailsbymodeState extends State { "JakartaRegular", fontSize: 14, color: - AppColors - .semi_black, + AppColors.semi_black, ), ), ), Expanded( child: InkResponse( onTap: - subHeadings[j] == - "View" + subHeadings[j] == "View" ? () { Navigator.push( context, @@ -398,10 +389,8 @@ class _TpcagentdetailsbymodeState extends State { child: Container( padding: EdgeInsets.symmetric(vertical: 5), child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Text( provider.showMoreDetails @@ -438,10 +427,7 @@ class _TpcagentdetailsbymodeState extends State { Container( alignment: Alignment.topLeft, - padding: EdgeInsets.only( - top: 15, - left: 10, - ), + padding: EdgeInsets.only(top: 15, left: 10), child: Text( "TPC Amounts Requested", style: TextStyle( @@ -456,10 +442,7 @@ class _TpcagentdetailsbymodeState extends State { shrinkWrap: true, physics: NeverScrollableScrollPhysics(), itemCount: tpcReqAmt.length, - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), itemBuilder: (context, index) { return InkResponse( @@ -468,23 +451,16 @@ class _TpcagentdetailsbymodeState extends State { context, MaterialPageRoute( builder: - ( - context, - ) => Ordersdetailsbymodes( - pageTitleName: - "CRM Order Details", - mode: widget.mode, - orderId: - tpcReqAmt[index] - .orderId, - ), + (context) => Ordersdetailsbymodes( + pageTitleName: "CRM Order Details", + mode: widget.mode, + orderId: tpcReqAmt[index].orderId, + ), ), ); }, child: Container( - width: - MediaQuery.of(context).size.width * - 0.9, + width: MediaQuery.of(context).size.width * 0.9, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(14), @@ -495,16 +471,14 @@ class _TpcagentdetailsbymodeState extends State { ), margin: EdgeInsets.symmetric( horizontal: 5, - vertical: 5 + vertical: 5, ), child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( flex: 1, @@ -519,10 +493,9 @@ class _TpcagentdetailsbymodeState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment.start, mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ Row( children: [ @@ -530,8 +503,7 @@ class _TpcagentdetailsbymodeState extends State { flex: 4, child: Column( crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment.start, children: [ InkResponse( onTap: () { @@ -540,50 +512,59 @@ class _TpcagentdetailsbymodeState extends State { MaterialPageRoute( builder: ( - context, + context, ) => Ordersdetailsbymodes( - pageTitleName: - "CRM Order Details", - mode: widget.mode, - orderId: - tpcReqAmt[index] - .orderId, - ), + pageTitleName: + "CRM Order Details", + mode: + widget.mode, + orderId: + tpcReqAmt[index] + .orderId, + ), ), ); }, child: Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), + padding: + const EdgeInsets.symmetric( + vertical: 4.0, + ), child: Text( - tpcReqAmt[index].customerName ?? + tpcReqAmt[index] + .customerName ?? "-", style: TextStyle( - decoration: TextDecoration.underline, - decorationStyle: TextDecorationStyle.dashed, - decorationColor: AppColors.semi_black, + decoration: + TextDecoration + .underline, + decorationStyle: + TextDecorationStyle + .dashed, + decorationColor: + AppColors + .semi_black, height: 1.5, fontFamily: - "JakartaRegular", - fontSize: - 14, + "JakartaRegular", + fontSize: 14, color: - AppColors - .semi_black, + AppColors + .semi_black, ), ), ), ), Text( - tpcReqAmt[index].orderNumber ?? + tpcReqAmt[index] + .orderNumber ?? "-", style: TextStyle( fontFamily: - "JakartaRegular", - fontSize: - 14, + "JakartaRegular", + fontSize: 14, color: - AppColors - .grey_semi, + AppColors.grey_semi, ), ), ], @@ -592,32 +573,27 @@ class _TpcagentdetailsbymodeState extends State { Expanded( flex: 2, child: Container( - decoration: - BoxDecoration( + decoration: BoxDecoration( borderRadius: - BorderRadius.circular( - 8, - ), - color: AppColors.requested_bg_color, + BorderRadius.circular(8), + color: + AppColors + .requested_bg_color, ), - padding: - EdgeInsets.symmetric( - horizontal: - 5, - vertical: - 10, + padding: EdgeInsets.symmetric( + horizontal: 5, + vertical: 10, ), child: Center( child: Text( - textAlign: - TextAlign - .right, - "${tpcReqAmt[index].tpcStatus ?? "-"}", + textAlign: TextAlign.right, + tpcReqAmt[index] + .tpcStatus ?? + "-", style: TextStyle( fontFamily: - "JakartaMedium", - fontSize: - 14, + "JakartaMedium", + fontSize: 14, color: AppColors.app_blue, ), ), @@ -633,9 +609,7 @@ class _TpcagentdetailsbymodeState extends State { ], ), Container( - padding: EdgeInsets.symmetric( - vertical: 7.5, - ), + padding: EdgeInsets.symmetric(vertical: 7.5), child: Row( children: [ Expanded( @@ -644,8 +618,7 @@ class _TpcagentdetailsbymodeState extends State { "Order Details", style: TextStyle( fontSize: 14, - fontFamily: - "JakartaSemiBold", + fontFamily: "JakartaSemiBold", ), ), ), @@ -654,8 +627,7 @@ class _TpcagentdetailsbymodeState extends State { child: DottedLine( dashGapLength: 4, dashGapColor: Colors.white, - dashColor: - AppColors.grey_semi, + dashColor: AppColors.grey_semi, dashLength: 2, lineThickness: 0.5, ), @@ -673,39 +645,28 @@ class _TpcagentdetailsbymodeState extends State { "${tpcReqAmt[index].level2TpcApprovedAmount}", ]; return Container( - padding: EdgeInsets.symmetric( - vertical: 3, - ), + padding: EdgeInsets.symmetric(vertical: 3), child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: Text( textAlign: TextAlign.left, heads[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, - color: - AppColors - .semi_black, + color: AppColors.semi_black, ), ), ), Expanded( child: Text( - textAlign: - TextAlign.right, - subHeads[j] == "" - ? "-" - : subHeads[j], + textAlign: TextAlign.right, + subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, - color: Color( - 0xFF818181, - ), + color: Color(0xFF818181), ), ), ), @@ -713,14 +674,12 @@ class _TpcagentdetailsbymodeState extends State { ), ); }), - ], ), ), ); }, ), - ], ), ), @@ -815,7 +774,6 @@ class _TpcagentdetailsbymodeState extends State { ), Divider(thickness: 0.5, color: Color(0xFFD7D7D7)), ...List.generate(provider.subHeadings.length, (j) { - return Container( padding: EdgeInsets.symmetric(vertical: 7), child: Row( @@ -853,7 +811,7 @@ class _TpcagentdetailsbymodeState extends State { } }, child: Text( - "${provider.subHeadings[j]}", + provider.subHeadings[j], style: TextStyle( fontSize: 14, color: diff --git a/lib/screens/order/tpcAgentIssueList.dart b/lib/screens/order/tpcAgentIssueList.dart index 67d3e10..a11cf92 100644 --- a/lib/screens/order/tpcAgentIssueList.dart +++ b/lib/screens/order/tpcAgentIssueList.dart @@ -16,20 +16,22 @@ import 'ordersDetailsByModes.dart'; class Tpcagentissuelist extends StatefulWidget { final pageTitleName; final mode; - const Tpcagentissuelist({super.key,required this.pageTitleName,required this.mode}); + const Tpcagentissuelist({ + super.key, + required this.pageTitleName, + required this.mode, + }); @override State createState() => _TpcagentissuelistState(); } class _TpcagentissuelistState extends State { - Map _source = {ConnectivityResult.mobile: true}; final MyConnectivity _connectivity = MyConnectivity.instance; final ScrollController _scrollController = ScrollController(); - @override void initState() { super.initState(); @@ -59,6 +61,7 @@ class _TpcagentissuelistState extends State { _connectivity.disposeStream(); super.dispose(); } + @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -74,22 +77,24 @@ class _TpcagentissuelistState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () { - Provider.of(context,listen: false).resetAll(); - return onBackPressed(context); - }, - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () { + Provider.of( + context, + listen: false, + ).resetAll(); + return onBackPressed(context); + }, + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } - Widget _scaffold(BuildContext context) { return Consumer( builder: (context, provider, child) { @@ -108,148 +113,143 @@ class _TpcagentissuelistState extends State { // }, // child: SvgPicture.asset("assets/svg/ic_download.svg",), // ), - - ], ), - 0xFFFFFFFF + 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading && tpcAgentsIssueList.isEmpty - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: - AlwaysStoppedAnimation(AppColors.app_blue), - ), - ) - : tpcAgentsIssueList.isNotEmpty - ? RefreshIndicator( - onRefresh: () async { - provider.resetPagination(); - await provider.TPCAgentsIssueListAPIFunction(context); - }, - child: ListView.builder( - controller: _scrollController, - itemCount: tpcAgentsIssueList.length + - (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, index) { - if (index == tpcAgentsIssueList.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center( - child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final issue = tpcAgentsIssueList[index]; - return InkResponse( - onTap: () async { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Tpcagentissuelistdetails( - pageTitleName: "CRM Order Details", - mode: widget.mode, - orderId: tpcAgentsIssueList[index].orderId, - ), + body: + provider.isLoading && tpcAgentsIssueList.isEmpty + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - ); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 7.5, - vertical: 5, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - - child: SvgPicture.asset( - "assets/svg/order/tpc_list_ic.svg", + ) + : tpcAgentsIssueList.isNotEmpty + ? RefreshIndicator( + onRefresh: () async { + provider.resetPagination(); + await provider.TPCAgentsIssueListAPIFunction(context); + }, + child: ListView.builder( + controller: _scrollController, + itemCount: + tpcAgentsIssueList.length + + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, index) { + if (index == tpcAgentsIssueList.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), + child: Center( + child: CircularProgressIndicator(), ), + ) + : const SizedBox.shrink(); + } + + final issue = tpcAgentsIssueList[index]; + return InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Tpcagentissuelistdetails( + pageTitleName: "CRM Order Details", + mode: widget.mode, + orderId: + tpcAgentsIssueList[index].orderId, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 7.5, + vertical: 5, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - tpcAgentsIssueList[index].name!, - style: TextStyle( - fontFamily: - "JakartaRegular", - fontSize: 14, - color: - AppColors.semi_black, + Expanded( + flex: 1, + child: SizedBox( + height: 50, + width: 35, + + child: SvgPicture.asset( + "assets/svg/order/tpc_list_ic.svg", + ), ), ), - Text( - - "${tpcAgentsIssueList[index].aname}", - style: TextStyle( - fontFamily: - "JakartaRegular", - fontSize: 14, - color: AppColors.grey_semi, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + tpcAgentsIssueList[index].name!, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + "${tpcAgentsIssueList[index].aname}", + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.grey_semi, + ), + ), + ], + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 1, + child: InkResponse( + onTap: () { + launch( + 'tel://${tpcAgentsIssueList[index].mobileNumber}', + ); + }, + child: SizedBox( + height: 35, + width: 35, + child: SvgPicture.asset( + "assets/svg/crm/lead_list_call_ic.svg", + ), + ), ), ), ], ), - ), + ], ), - SizedBox(width: 10), - Expanded( - flex: 1, - child: InkResponse( - onTap: () { - launch( - 'tel://${tpcAgentsIssueList[index] - .mobileNumber}', - ); - }, - child: SizedBox( - height: 35, - width: 35, - child: SvgPicture.asset( - "assets/svg/crm/lead_list_call_ic.svg", - ), - ), - ), - ), - ], - ), - - - ], + ), + ); + }, ), - ), - ); - }, - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); @@ -266,7 +266,7 @@ class _TpcagentissuelistState extends State { }, child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar2( @@ -281,209 +281,211 @@ class _TpcagentissuelistState extends State { // }, // child: SvgPicture.asset("assets/svg/ic_download.svg",), // ), - - ], ), ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center(child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue) - )) - : tpcAgentsIssueList.isNotEmpty ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - itemCount: tpcAgentsIssueList.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - if (tpcAgentsIssueList.isEmpty) { - return SizedBox( - child: Center( - child: Text("No Data Available"), - ), - ); - } - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - - decoration: BoxDecoration( - color: Color(0xFFEAF7FF), - borderRadius: - BorderRadius.circular(8), - ), - child: SvgPicture.asset( - "assets/svg/tpc_ic.svg", - ), + ), + ) + : tpcAgentsIssueList.isNotEmpty + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + itemCount: tpcAgentsIssueList.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + if (tpcAgentsIssueList.isEmpty) { + return SizedBox( + child: Center( + child: Text("No Data Available"), ), + ); + } + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - tpcAgentsIssueList[index].name!, - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: - AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + + decoration: BoxDecoration( + color: Color(0xFFEAF7FF), + borderRadius: + BorderRadius.circular(8), + ), + child: SvgPicture.asset( + "assets/svg/tpc_ic.svg", + ), ), ), - Text( - - "${tpcAgentsIssueList[index].aname}", - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + tpcAgentsIssueList[index] + .name!, + style: TextStyle( + fontFamily: + "JakartaMedium", + fontSize: 14, + color: + AppColors.semi_black, + ), + ), + Text( + "${tpcAgentsIssueList[index].aname}", + style: TextStyle( + fontFamily: + "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ], + ), ), ), ], ), - ), - ), - - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(4, (j) { - final headings = [ - "Sales Person", - "Order Number", - "Order Amount", - "Order Status", - - - ]; - - final subHeadings = [ - tpcAgentsIssueList[index].ename, - tpcAgentsIssueList[index].orderNumber, - tpcAgentsIssueList[index].totalAmount, - tpcAgentsIssueList[index].status, - ]; - return Container( - padding: EdgeInsets.symmetric( - vertical: 5, - ), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, - ), - ), + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), ), - Expanded( - child: InkResponse( + ...List.generate(4, (j) { + final headings = [ + "Sales Person", + "Order Number", + "Order Amount", + "Order Status", + ]; - child: Text( - "${subHeadings[j]}", - style: TextStyle( - fontSize: 14, - color: Color( - 0xFF818181, + final subHeadings = [ + tpcAgentsIssueList[index].ename, + tpcAgentsIssueList[index].orderNumber, + tpcAgentsIssueList[index].totalAmount, + tpcAgentsIssueList[index].status, + ]; + return Container( + padding: EdgeInsets.symmetric( + vertical: 5, + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), ), - decoration: TextDecoration - .none, - decorationColor: AppColors.white, + Expanded( + child: InkResponse( + child: Text( + "${subHeadings[j]}", + style: TextStyle( + fontSize: 14, + color: Color(0xFF818181), + decoration: + TextDecoration.none, + decorationColor: + AppColors.white, + ), + ), + ), + ), + ], + ), + ); + }), + InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Tpcagentissuelistdetails( + pageTitleName: + "CRM Order Details", + mode: widget.mode, + orderId: + tpcAgentsIssueList[index] + .orderId, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 5, + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), ), ), ], ), ); - }), - InkResponse( - onTap: () async { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => - Tpcagentissuelistdetails( - pageTitleName: "CRM Order Details", - mode: widget.mode, - orderId: tpcAgentsIssueList[index].orderId, - ), - ), - ); - }, - child: Container( - padding: EdgeInsets.symmetric( - vertical: 5, - ), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ), - ], - ), - ); - }, - ), - ], - ), - ) : Emptywidget(context), + }, + ), + ], + ), + ) + : Emptywidget(context), ), ), ); diff --git a/lib/screens/order/tpcAgentIssueListDetails.dart b/lib/screens/order/tpcAgentIssueListDetails.dart index 7383541..cf93538 100644 --- a/lib/screens/order/tpcAgentIssueListDetails.dart +++ b/lib/screens/order/tpcAgentIssueListDetails.dart @@ -17,11 +17,16 @@ class Tpcagentissuelistdetails extends StatefulWidget { final orderId; final mode; - const Tpcagentissuelistdetails( - {super.key, required this.pageTitleName, required this.orderId, required this.mode}); + const Tpcagentissuelistdetails({ + super.key, + required this.pageTitleName, + required this.orderId, + required this.mode, + }); @override - State createState() => _TpcagentissuelistdetailsState(); + State createState() => + _TpcagentissuelistdetailsState(); } class _TpcagentissuelistdetailsState extends State { @@ -44,7 +49,10 @@ class _TpcagentissuelistdetailsState extends State { provider.showMoreDetails = false; provider.ordersDetailsByModeAPIFunction( - context, widget.orderId, widget.mode); + context, + widget.orderId, + widget.mode, + ); }); } @@ -144,7 +152,6 @@ class _TpcagentissuelistdetailsState extends State { return 18.0; } - @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -160,28 +167,28 @@ class _TpcagentissuelistdetailsState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () async { - Provider.of( - context, - listen: false, - ).resetAll(); - - return onBackPressed(context); - }, - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () async { + Provider.of( + context, + listen: false, + ).resetAll(); + + return onBackPressed(context); + }, + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } Widget _scaffold(BuildContext context) { - return Consumer2( - builder: (context, provider,tpcProvider, child) { + return Consumer2( + builder: (context, provider, tpcProvider, child) { var orderDetails = provider.orderDetails; final productsHistory = provider.productsHistory; final feedbackHistory = provider.feedbackHistory; @@ -353,15 +360,19 @@ class _TpcagentissuelistdetailsState extends State { return Scaffold( resizeToAvoidBottomInset: true, - appBar: appbar2New(context, widget.pageTitleName, provider.resetAll, - SizedBox.shrink(), - 0xFFFFFFFF), + appBar: appbar2New( + context, + widget.pageTitleName, + provider.resetAll, + SizedBox.shrink(), + 0xFFFFFFFF, + ), backgroundColor: AppColors.scaffold_bg_color, body: SingleChildScrollView( child: Column( children: [ Card( - margin: EdgeInsets.symmetric(horizontal: 0,vertical: 2), + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 2), shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(30), @@ -378,10 +389,7 @@ class _TpcagentissuelistdetailsState extends State { ), ), // margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10), - padding: EdgeInsets.symmetric( - vertical: 10, - horizontal: 10, - ), + padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), child: Column( children: [ Row( @@ -407,8 +415,7 @@ class _TpcagentissuelistdetailsState extends State { flex: 4, child: SizedBox( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ InkResponse( onTap: () {}, @@ -420,15 +427,14 @@ class _TpcagentissuelistdetailsState extends State { child: Text( orderDetails.accountName == "" ? "-" - : orderDetails.accountName ?? - "-", + : orderDetails.accountName ?? "-", style: TextStyle( decoration: - TextDecoration.underline, + TextDecoration.underline, decorationStyle: - TextDecorationStyle.dotted, + TextDecorationStyle.dotted, decorationColor: - AppColors.grey_thick, + AppColors.grey_thick, height: 1.2, fontFamily: "JakartaRegular", fontSize: 14, @@ -472,36 +478,31 @@ class _TpcagentissuelistdetailsState extends State { style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, - color: getTextColor( - orderDetails.status, - ), + color: getTextColor(orderDetails.status), ), ), ), ), ), - ], ), SizedBox(height: 10), Column( children: List.generate(sections.length, ( - sectionIndex, - ) { + sectionIndex, + ) { final section = sections[sectionIndex]; final title = section["title"] as String; final headings = - section["headings"] as List; + section["headings"] as List; final subHeadings = - section["subHeadings"] as List; + section["subHeadings"] as List; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - padding: EdgeInsets.symmetric( - vertical: 4, - ), + padding: EdgeInsets.symmetric(vertical: 4), child: Row( children: [ Expanded( @@ -529,23 +530,20 @@ class _TpcagentissuelistdetailsState extends State { ), Column( - children: List.generate(headings.length, ( - j, - ) { + children: List.generate(headings.length, (j) { return Container( padding: EdgeInsets.symmetric( vertical: 7, ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( headings[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -554,9 +552,9 @@ class _TpcagentissuelistdetailsState extends State { Expanded( child: InkResponse( onTap: - subHeadings[j] == "View" - ? () {} - : null, + subHeadings[j] == "View" + ? () {} + : null, child: Text( subHeadings[j].isEmpty ? "-" @@ -566,22 +564,16 @@ class _TpcagentissuelistdetailsState extends State { fontSize: 14, decoration: - subHeadings[j] == - "View" - ? TextDecoration - .underline - : TextDecoration - .none, + subHeadings[j] == "View" + ? TextDecoration + .underline + : TextDecoration.none, decorationColor: - AppColors.app_blue, + AppColors.app_blue, color: - subHeadings[j] == - "View" - ? AppColors - .app_blue - : Color( - 0xFF818181, - ), + subHeadings[j] == "View" + ? AppColors.app_blue + : Color(0xFF818181), ), ), ), @@ -599,7 +591,7 @@ class _TpcagentissuelistdetailsState extends State { InkResponse( onTap: () async { provider.showMoreDetails = - !provider.showMoreDetails; + !provider.showMoreDetails; }, child: Container( padding: EdgeInsets.symmetric(vertical: 5), @@ -619,9 +611,7 @@ class _TpcagentissuelistdetailsState extends State { ), Transform.flip( flipY: - provider.showMoreDetails - ? true - : false, + provider.showMoreDetails ? true : false, child: SvgPicture.asset( "assets/svg/arrow_dropdown.svg", height: 25, @@ -644,11 +634,7 @@ class _TpcagentissuelistdetailsState extends State { ///product details if (productsHistory.isNotEmpty) ...[ Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -681,8 +667,7 @@ class _TpcagentissuelistdetailsState extends State { itemBuilder: (context, lp) { return Container( height: 260, - width: - MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.of(context).size.width * 0.9, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(14), @@ -702,7 +687,7 @@ class _TpcagentissuelistdetailsState extends State { Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( flex: 1, @@ -717,9 +702,9 @@ class _TpcagentissuelistdetailsState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ Row( children: [ @@ -727,18 +712,18 @@ class _TpcagentissuelistdetailsState extends State { flex: 4, child: Text( productsHistory[lp] - .productName ?? + .productName ?? "-", maxLines: 2, overflow: - TextOverflow.ellipsis, + TextOverflow.ellipsis, style: TextStyle( fontFamily: - "JakartaMedium", + "JakartaMedium", fontSize: 14, color: - AppColors - .semi_black, + AppColors + .semi_black, ), ), ), @@ -746,15 +731,14 @@ class _TpcagentissuelistdetailsState extends State { flex: 3, child: Text( textAlign: - TextAlign.right, + TextAlign.right, "₹${productsHistory[lp].totalPrice ?? "-"}", style: TextStyle( fontFamily: - "JakartaMedium", + "JakartaMedium", fontSize: 14, color: - AppColors - .app_blue, + AppColors.app_blue, ), ), ), @@ -837,15 +821,14 @@ class _TpcagentissuelistdetailsState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( textAlign: TextAlign.left, heads[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -860,31 +843,31 @@ class _TpcagentissuelistdetailsState extends State { MaterialPageRoute( builder: ( - context, + context, ) => Fileviewer( - fileName: - feedbackHistory[lp].attachmentViewFileName!, - fileUrl: - feedbackHistory[lp].attachmentDirFilePath!, - ), + fileName: + feedbackHistory[lp] + .attachmentViewFileName!, + fileUrl: + feedbackHistory[lp] + .attachmentDirFilePath!, + ), ), ); }, child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, - color: - AppColors.app_blue, + color: AppColors.app_blue, decorationColor: - AppColors.app_blue, + AppColors.app_blue, decoration: - TextDecoration - .underline, + TextDecoration + .underline, ), ), ), @@ -940,7 +923,7 @@ class _TpcagentissuelistdetailsState extends State { ...List.generate(1, (j) { final heads = [ // "Unit Price", - "Total Price" + "Total Price", ]; final subHeads = [ // "₹ ${productsHistory[lp].unitPrice ?? "-"}", @@ -952,15 +935,14 @@ class _TpcagentissuelistdetailsState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( textAlign: TextAlign.left, heads[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -975,31 +957,31 @@ class _TpcagentissuelistdetailsState extends State { MaterialPageRoute( builder: ( - context, + context, ) => Fileviewer( - fileName: - feedbackHistory[lp].attachmentViewFileName!, - fileUrl: - feedbackHistory[lp].attachmentDirFilePath!, - ), + fileName: + feedbackHistory[lp] + .attachmentViewFileName!, + fileUrl: + feedbackHistory[lp] + .attachmentDirFilePath!, + ), ), ); }, child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, - color: - AppColors.app_blue, + color: AppColors.app_blue, decorationColor: - AppColors.app_blue, + AppColors.app_blue, decoration: - TextDecoration - .underline, + TextDecoration + .underline, ), ), ), @@ -1032,11 +1014,7 @@ class _TpcagentissuelistdetailsState extends State { ///Feedback details Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -1090,8 +1068,7 @@ class _TpcagentissuelistdetailsState extends State { itemBuilder: (context, lp) { return Container( height: 220, - width: - MediaQuery.of(context).size.width * 0.9, + width: MediaQuery.of(context).size.width * 0.9, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(14), @@ -1106,10 +1083,9 @@ class _TpcagentissuelistdetailsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( flex: 1, @@ -1124,9 +1100,9 @@ class _TpcagentissuelistdetailsState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ Row( children: [ @@ -1134,35 +1110,37 @@ class _TpcagentissuelistdetailsState extends State { flex: 4, child: Column( crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment + .start, children: [ Text( feedbackHistory[lp] - .employeNaem ?? + .employeNaem ?? "-", maxLines: 2, - overflow: TextOverflow.ellipsis, + overflow: + TextOverflow + .ellipsis, style: TextStyle( fontFamily: - "JakartaMedium", + "JakartaMedium", fontSize: 14, color: - AppColors - .semi_black, + AppColors + .semi_black, ), ), Text( feedbackHistory[lp] - .createdDatetime ?? + .createdDatetime ?? "-", style: TextStyle( fontFamily: - "JakartaMedium", + "JakartaMedium", fontSize: 14, color: - AppColors - .grey_semi, + AppColors + .grey_semi, ), ), ], @@ -1173,27 +1151,28 @@ class _TpcagentissuelistdetailsState extends State { child: Container( decoration: BoxDecoration( borderRadius: - BorderRadius.circular( - 8, - ), + BorderRadius.circular( + 8, + ), color: Color( 0xFFF3FFD5, ), ), padding: - EdgeInsets.symmetric( - horizontal: 5, - vertical: 10, - ), + EdgeInsets.symmetric( + horizontal: 5, + vertical: 10, + ), child: Center( child: Text( textAlign: - TextAlign - .center, - "${feedbackHistory[lp].status ?? "-"}", + TextAlign.center, + feedbackHistory[lp] + .status ?? + "-", style: TextStyle( fontFamily: - "JakartaMedium", + "JakartaMedium", fontSize: 14, color: Color( 0xFF586000, @@ -1241,10 +1220,7 @@ class _TpcagentissuelistdetailsState extends State { ), ), ...List.generate(2, (j) { - final heads = [ - "Feedback", - "Attachment", - ]; + final heads = ["Feedback", "Attachment"]; final subHeads = [ feedbackHistory[lp].feedback ?? "-", "View", @@ -1255,16 +1231,15 @@ class _TpcagentissuelistdetailsState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( - flex:1, + flex: 1, child: Text( textAlign: TextAlign.left, heads[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, color: AppColors.semi_black, ), @@ -1272,7 +1247,7 @@ class _TpcagentissuelistdetailsState extends State { ), if (subHeads[j] == "View") ...[ Expanded( - flex:3, + flex: 3, child: InkResponse( onTap: () { Navigator.push( @@ -1280,44 +1255,44 @@ class _TpcagentissuelistdetailsState extends State { MaterialPageRoute( builder: ( - context, + context, ) => Fileviewer( - fileName: - feedbackHistory[lp].attachmentViewFileName!, - fileUrl: - feedbackHistory[lp].attachmentDirFilePath!, - ), + fileName: + feedbackHistory[lp] + .attachmentViewFileName!, + fileUrl: + feedbackHistory[lp] + .attachmentDirFilePath!, + ), ), ); }, child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], style: TextStyle( fontSize: 14, - color: - AppColors.app_blue, + color: AppColors.app_blue, decorationColor: - AppColors.app_blue, + AppColors.app_blue, decoration: - TextDecoration - .underline, + TextDecoration + .underline, ), ), ), ), ] else ...[ Expanded( - flex:4, + flex: 4, child: Text( textAlign: TextAlign.right, subHeads[j] == "" ? "-" : subHeads[j], - maxLines:2, + maxLines: 2, style: TextStyle( fontSize: 14, color: Color(0xFF818181), @@ -1366,14 +1341,9 @@ class _TpcagentissuelistdetailsState extends State { ], ///PaymentHistory details - if (paymentHistory.isNotEmpty) ...[ Container( - padding: EdgeInsets.only( - left: 10, - right: 10, - top: 10, - ), + padding: EdgeInsets.only(left: 10, right: 10, top: 10), child: Row( children: [ Expanded( @@ -1387,7 +1357,6 @@ class _TpcagentissuelistdetailsState extends State { ), ), ), - ], ), ), @@ -1406,9 +1375,7 @@ class _TpcagentissuelistdetailsState extends State { itemBuilder: (context, lp) { return Container( height: 225, - width: - MediaQuery.of(context).size.width * - 0.9, + width: MediaQuery.of(context).size.width * 0.9, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(14), @@ -1417,17 +1384,14 @@ class _TpcagentissuelistdetailsState extends State { horizontal: 10, vertical: 10, ), - margin: EdgeInsets.symmetric( - horizontal: 5, - ), + margin: EdgeInsets.symmetric(horizontal: 5), child: Column( children: [ Row( - mainAxisAlignment: - MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( flex: 1, @@ -1442,10 +1406,9 @@ class _TpcagentissuelistdetailsState extends State { child: Column( // mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment.start, mainAxisAlignment: - MainAxisAlignment.start, + MainAxisAlignment.start, children: [ Row( children: [ @@ -1453,35 +1416,31 @@ class _TpcagentissuelistdetailsState extends State { flex: 4, child: Column( crossAxisAlignment: - CrossAxisAlignment - .start, + CrossAxisAlignment + .start, children: [ Text( paymentHistory[lp] - .ename ?? + .ename ?? "-", style: TextStyle( fontFamily: - "JakartaMedium", - fontSize: - 14, + "JakartaMedium", + fontSize: 14, color: - AppColors - .semi_black, + AppColors + .semi_black, ), ), Text( - "₹ ${paymentHistory[lp] - .amount ?? - "-"}", + "₹ ${paymentHistory[lp].amount ?? "-"}", style: TextStyle( fontFamily: - "JakartaMedium", - fontSize: - 14, + "JakartaMedium", + fontSize: 14, color: - AppColors - .grey_semi, + AppColors + .grey_semi, ), ), ], @@ -1497,43 +1456,36 @@ class _TpcagentissuelistdetailsState extends State { flex: 2, child: Container( height: 45, - padding: - EdgeInsets.symmetric( + padding: EdgeInsets.symmetric( horizontal: 5, ), decoration: BoxDecoration( - color: - AppColors - .processed_bg_color, - borderRadius: - BorderRadius.circular( + color: AppColors.processed_bg_color, + borderRadius: BorderRadius.circular( 8, ), ), child: Center( child: Text( - paymentHistory[lp].approvalStatus??"-", - textAlign: - TextAlign.right, + paymentHistory[lp] + .approvalStatus ?? + "-", + textAlign: TextAlign.right, style: TextStyle( - fontFamily: - "JakartaMedium", + fontFamily: "JakartaMedium", fontSize: 14, color: - AppColors - .processed_text_color, + AppColors + .processed_text_color, ), ), ), ), ), - ], ), Container( - padding: EdgeInsets.symmetric( - vertical: 10, - ), + padding: EdgeInsets.symmetric(vertical: 10), child: Row( children: [ Expanded( @@ -1542,8 +1494,7 @@ class _TpcagentissuelistdetailsState extends State { "Payment Info", style: TextStyle( fontSize: 14, - fontFamily: - "JakartaSemiBold", + fontFamily: "JakartaSemiBold", ), ), ), @@ -1552,8 +1503,7 @@ class _TpcagentissuelistdetailsState extends State { child: DottedLine( dashGapLength: 4, dashGapColor: Colors.white, - dashColor: - AppColors.grey_semi, + dashColor: AppColors.grey_semi, dashLength: 2, lineThickness: 0.5, ), @@ -1569,17 +1519,10 @@ class _TpcagentissuelistdetailsState extends State { "Payment Date", ]; final subHeadsa = [ - paymentHistory[lp] - .paymentType ?? - "-", paymentHistory[lp] - .refNo ?? - "-", - "₹${paymentHistory[lp] - .adjustedAmount ?? - "-"}", - paymentHistory[lp] - .paymentDate ?? - "-", + paymentHistory[lp].paymentType ?? "-", + paymentHistory[lp].refNo ?? "-", + "₹${paymentHistory[lp].adjustedAmount ?? "-"}", + paymentHistory[lp].paymentDate ?? "-", ]; return Container( padding: EdgeInsets.symmetric( @@ -1587,34 +1530,28 @@ class _TpcagentissuelistdetailsState extends State { ), child: Row( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Expanded( child: Text( textAlign: TextAlign.left, headsa[j], style: TextStyle( - fontFamily: - "JakartaRegular", + fontFamily: "JakartaRegular", fontSize: 14, - color: - AppColors - .semi_black, + color: AppColors.semi_black, ), ), ), Expanded( child: Text( - textAlign: - TextAlign.right, + textAlign: TextAlign.right, subHeadsa[j] == "" ? "-" : subHeadsa[j], style: TextStyle( fontSize: 14, - color: Color( - 0xFF818181, - ), + color: Color(0xFF818181), ), ), ), @@ -1622,7 +1559,6 @@ class _TpcagentissuelistdetailsState extends State { ), ); }), - ], ), ); @@ -1635,74 +1571,61 @@ class _TpcagentissuelistdetailsState extends State { ], ), ), - bottomNavigationBar: - - Container( - decoration: BoxDecoration( - color: Colors.white - ), + bottomNavigationBar: Container( + decoration: BoxDecoration(color: Colors.white), alignment: Alignment.center, height: 65, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - - Expanded( - child: InkResponse( - onTap: () { - // provider - // .approveRejectPaymentRequestAPIFunction( - // context, - // provider.requestsDetails.id, - // ); - _showLevelApprovalSheet( - context); - }, - child: Container( - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8), - // color: Color(0xFFE7FFE5), - // border: Border.all( - // color: Color(0xFF0D9C00), - // width: 0.5, - // ), - // ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgPicture.asset("assets/svg/finance/level_approve_ic.svg"), - SizedBox(width: 10,), - Center( - child: Text( - "Approve", - style: TextStyle( - color: AppColors.semi_black, - ), - ), + Expanded( + child: InkResponse( + onTap: () { + // provider + // .approveRejectPaymentRequestAPIFunction( + // context, + // provider.requestsDetails.id, + // ); + _showLevelApprovalSheet(context); + }, + child: Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(8), + // color: Color(0xFFE7FFE5), + // border: Border.all( + // color: Color(0xFF0D9C00), + // width: 0.5, + // ), + // ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + "assets/svg/finance/level_approve_ic.svg", + ), + SizedBox(width: 10), + Center( + child: Text( + "Approve", + style: TextStyle(color: AppColors.semi_black), ), - ], - ), + ), + ], ), ), ), - - - - + ), ], ), ), - ); }, ); } - - Widget _scaffold1(BuildContext context) { - return Consumer2( - builder: (context, provider,tpcProvider, child) { + return Consumer2( + builder: (context, provider, tpcProvider, child) { var orderDetails = provider.orderDetails; var Headings1 = [ @@ -1718,7 +1641,6 @@ class _TpcagentissuelistdetailsState extends State { provider.orderDetails.orderReceivedDate ?? "-", ]; - var Headings2 = [ "Billing State", "Billing District", @@ -1769,7 +1691,6 @@ class _TpcagentissuelistdetailsState extends State { "Status", ]; var subHeadings2 = [ - provider.orderDetails.billingState ?? "-", provider.orderDetails.billingDistrict ?? "-", provider.orderDetails.billingSubLocality ?? "-", @@ -1819,34 +1740,30 @@ class _TpcagentissuelistdetailsState extends State { provider.orderDetails.status ?? "-", ]; - - - - - var Headings = [...Headings1]; var subHeadings = [...subHeadings1]; - - if(provider.showMoreDetails){ - Headings = [...Headings1,...Headings2]; - subHeadings = [...subHeadings1,...subHeadings2]; + if (provider.showMoreDetails) { + Headings = [...Headings1, ...Headings2]; + subHeadings = [...subHeadings1, ...subHeadings2]; } return WillPopScope( child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, - appBar: appbar2(context, widget.pageTitleName, provider.resetAll, + appBar: appbar2( + context, + widget.pageTitleName, + provider.resetAll, InkResponse( onTap: () { - _showOptionsSheet( - context - ); + _showOptionsSheet(context); }, - child: SvgPicture.asset("assets/svg/ic_more.svg", height: 30,), - ),), + child: SvgPicture.asset("assets/svg/ic_more.svg", height: 30), + ), + ), backgroundColor: AppColors.scaffold_bg_color, body: Container( child: SingleChildScrollView( @@ -1871,7 +1788,9 @@ class _TpcagentissuelistdetailsState extends State { color: Color(0xFFFFF3CE), borderRadius: BorderRadius.circular(8), ), - child: SvgPicture.asset("assets/svg/fin_ic.svg"), + child: SvgPicture.asset( + "assets/svg/fin_ic.svg", + ), ), ), SizedBox(width: 10), @@ -1947,20 +1866,18 @@ class _TpcagentissuelistdetailsState extends State { Expanded( child: InkResponse( onTap: () { - if (Headings[j] == - "Purchase Order") { + if (Headings[j] == "Purchase Order") { Navigator.push( context, MaterialPageRoute( builder: - (context) => - Fileviewer( + (context) => Fileviewer( fileName: - orderDetails - .tpcPaymentAttachementViewFileName!, + orderDetails + .tpcPaymentAttachementViewFileName!, fileUrl: - orderDetails - .tpcPaymentAttachmentDirFilePath!, + orderDetails + .tpcPaymentAttachmentDirFilePath!, ), ), ); @@ -1969,21 +1886,21 @@ class _TpcagentissuelistdetailsState extends State { child: Text( Headings[j] == "Purchase Order" ? "View" - : "${subHeadings[j]}", + : subHeadings[j], style: TextStyle( fontSize: 14, color: - Headings[j] == "Purchase Order" - ? AppColors.app_blue - : Color(0xFF818181), + Headings[j] == "Purchase Order" + ? AppColors.app_blue + : Color(0xFF818181), decoration: - Headings[j] == "Purchase Order" - ? TextDecoration.underline - : TextDecoration.none, + Headings[j] == "Purchase Order" + ? TextDecoration.underline + : TextDecoration.none, decorationColor: - Headings[j] == "Purchase Order" - ? AppColors.app_blue - : AppColors.white, + Headings[j] == "Purchase Order" + ? AppColors.app_blue + : AppColors.white, ), ), ), @@ -1994,27 +1911,25 @@ class _TpcagentissuelistdetailsState extends State { }), InkResponse( onTap: () async { - provider.showMoreDetails = !provider.showMoreDetails; + provider.showMoreDetails = + !provider.showMoreDetails; }, child: Container( - padding: EdgeInsets.symmetric( - vertical: 5, - ), + padding: EdgeInsets.symmetric(vertical: 5), child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - provider.showMoreDetails?"- Show Less": "+ More Details", + provider.showMoreDetails + ? "- Show Less" + : "+ More Details", style: TextStyle( fontFamily: "JakartaMedium", fontSize: 14, color: AppColors.app_blue, ), ), - ], ), ), @@ -2024,9 +1939,7 @@ class _TpcagentissuelistdetailsState extends State { ), ), ), - bottomNavigationBar: - - Container( + bottomNavigationBar: Container( margin: EdgeInsets.symmetric(horizontal: 10), alignment: Alignment.bottomCenter, height: 60, @@ -2037,47 +1950,38 @@ class _TpcagentissuelistdetailsState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - - Expanded( - child: InkResponse( - onTap: () { - // provider - // .approveRejectPaymentRequestAPIFunction( - // context, - // provider.requestsDetails.id, - // ); - _showLevelApprovalSheet( - context); - }, - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Color(0xFFE7FFE5), - border: Border.all( - color: Color(0xFF0D9C00), - width: 0.5, - ), + Expanded( + child: InkResponse( + onTap: () { + // provider + // .approveRejectPaymentRequestAPIFunction( + // context, + // provider.requestsDetails.id, + // ); + _showLevelApprovalSheet(context); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Color(0xFFE7FFE5), + border: Border.all( + color: Color(0xFF0D9C00), + width: 0.5, ), - child: Center( - child: Text( - "Approve", - style: TextStyle( - color: Color(0xFF0D9C00), - ), - ), + ), + child: Center( + child: Text( + "Approve", + style: TextStyle(color: Color(0xFF0D9C00)), ), ), ), ), - - - - + ), ], ), ), ), - ), ), @@ -2089,8 +1993,7 @@ class _TpcagentissuelistdetailsState extends State { ); } - - Future _showOptionsSheet(BuildContext context,) { + Future _showOptionsSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, isDismissible: true, @@ -2103,8 +2006,8 @@ class _TpcagentissuelistdetailsState extends State { return StatefulBuilder( builder: (context, setState) { return SafeArea( - child: Consumer2( - builder: (context, provider,tpcProvider, child) { + child: Consumer2( + builder: (context, provider, tpcProvider, child) { return Container( margin: EdgeInsets.only( bottom: 15, @@ -2112,7 +2015,9 @@ class _TpcagentissuelistdetailsState extends State { right: 15, top: 10, ), - padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom,), + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, @@ -2140,8 +2045,7 @@ class _TpcagentissuelistdetailsState extends State { MaterialPageRoute( builder: (context) => - Orderdetailspaymenthistory( - ), + Orderdetailspaymenthistory(), ), ); break; @@ -2152,8 +2056,7 @@ class _TpcagentissuelistdetailsState extends State { MaterialPageRoute( builder: (context) => - Orderdetailsproductshistory( - ), + Orderdetailsproductshistory(), ), ); break; @@ -2164,9 +2067,7 @@ class _TpcagentissuelistdetailsState extends State { MaterialPageRoute( builder: (context) => - Orderdetailsfeedbackhistory( - - ), + Orderdetailsfeedbackhistory(), ), ); break; @@ -2175,9 +2076,10 @@ class _TpcagentissuelistdetailsState extends State { leading: SvgPicture.asset( "assets/svg/${assetnames[index]}.svg", ), - title: Text(Headingnames[index], style: TextStyle( - fontFamily: "JakartaMedium" - ),), + title: Text( + Headingnames[index], + style: TextStyle(fontFamily: "JakartaMedium"), + ), trailing: SvgPicture.asset( "assets/svg/arrow_right_new.svg", ), @@ -2219,7 +2121,9 @@ class _TpcagentissuelistdetailsState extends State { right: 15, top: 10, ), - padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom,), + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -2237,7 +2141,10 @@ class _TpcagentissuelistdetailsState extends State { ), Padding( - padding: const EdgeInsets.only(bottom: 5.0, top: 8.0), + padding: const EdgeInsets.only( + bottom: 5.0, + top: 8.0, + ), child: Text("Remarks"), ), Container( @@ -2248,14 +2155,22 @@ class _TpcagentissuelistdetailsState extends State { borderRadius: BorderRadius.circular(14), ), child: Padding( - padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10, 0), + padding: const EdgeInsets.fromLTRB( + 10.0, + 0.0, + 10, + 0, + ), child: TextFormField( controller: provider.feedbackController, readOnly: true, keyboardType: TextInputType.text, - maxLines: 60 , + maxLines: 60, onChanged: provider.onChangeFeedback, - style: TextStyle(color: Color(0xFF818181), fontSize: 14), + style: TextStyle( + color: Color(0xFF818181), + fontSize: 14, + ), decoration: InputDecoration( hintText: "Write Remarks", hintStyle: TextStyle( @@ -2270,13 +2185,16 @@ class _TpcagentissuelistdetailsState extends State { ), ), ), - if(provider.feedbackError!=null)...[ + if (provider.feedbackError != null) ...[ Container( alignment: Alignment.topLeft, margin: EdgeInsets.only(top: 2.5, left: 25), child: Text( "${provider.feedbackError}", - style: TextStyle(color: Colors.red, fontSize: 10), + style: TextStyle( + color: Colors.red, + fontSize: 10, + ), ), ), ], @@ -2307,31 +2225,48 @@ class _TpcagentissuelistdetailsState extends State { ), ), ), - if(provider.imagePicked==1 && provider.imagePath!=null)...[ + if (provider.imagePicked == 1 && + provider.imagePath != null) ...[ Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), + padding: const EdgeInsets.symmetric( + vertical: 4.0, + ), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - Text("${provider.imagePath}",style: TextStyle( + Text( + "${provider.imagePath}", + style: TextStyle( color: AppColors.semi_black, fontSize: 11, - fontWeight: FontWeight.w600 - ),), + fontWeight: FontWeight.w600, + ), + ), InkResponse( - onTap: () { - provider.imagePicked = 0; - provider.imagePath = null; - provider.imageFilePath = null; - }, - child: SvgPicture.asset("assets/svg/ic_close.svg",width: 15,height: 15,)) + onTap: () { + provider.imagePicked = 0; + provider.imagePath = null; + provider.imageFilePath = null; + }, + child: SvgPicture.asset( + "assets/svg/ic_close.svg", + width: 15, + height: 15, + ), + ), ], ), - ) + ), ], InkWell( onTap: () { - provider.ordersDetailsFeedbackSubmissionAPIFunction(context,orderDetails.id,orderDetails.status); + provider + .ordersDetailsFeedbackSubmissionAPIFunction( + context, + orderDetails.id, + orderDetails.status, + ); }, child: Container( alignment: Alignment.center, @@ -2363,9 +2298,6 @@ class _TpcagentissuelistdetailsState extends State { ); } - - - Future _showLevelApprovalSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, @@ -2380,8 +2312,7 @@ class _TpcagentissuelistdetailsState extends State { builder: (context, setState) { return SafeArea( child: Consumer( - - builder: (context,tcpProvider, child) { + builder: (context, tcpProvider, child) { return Container( margin: EdgeInsets.only( bottom: 15, @@ -2389,7 +2320,9 @@ class _TpcagentissuelistdetailsState extends State { right: 15, top: 10, ), - padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom,), + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -2406,108 +2339,134 @@ class _TpcagentissuelistdetailsState extends State { ), ), - Padding( - padding: const EdgeInsets.only( - bottom: 5.0, top: 8.0), - child: Text("TPC Payment Mode"), + Padding( + padding: const EdgeInsets.only( + bottom: 5.0, + top: 8.0, ), - Container( - height: 50, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFFE9E9E9), - borderRadius: BorderRadius.circular(14), + child: Text("TPC Payment Mode"), + ), + Container( + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFE9E9E9), + borderRadius: BorderRadius.circular(14), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB( + 10.0, + 0.0, + 10, + 0, ), - child: Padding( - padding: const EdgeInsets.fromLTRB( - 10.0, 0.0, 10, 0), - child: TextFormField( - controller: tcpProvider - .tpcPaymentModeController, - readOnly: true, - keyboardType: TextInputType.text, - maxLines: 1, - onChanged: tcpProvider.onChangeTPCPayment, - style: TextStyle( - color: Color(0xFF818181), fontSize: 14), - decoration: InputDecoration( - hintText: "Enter Company Name", - hintStyle: TextStyle( - fontWeight: FontWeight.w400, - color: Color(0xFFB4BEC0), - fontSize: 14, - ), - - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, + child: TextFormField( + controller: + tcpProvider.tpcPaymentModeController, + readOnly: true, + keyboardType: TextInputType.text, + maxLines: 1, + onChanged: tcpProvider.onChangeTPCPayment, + style: TextStyle( + color: Color(0xFF818181), + fontSize: 14, + ), + decoration: InputDecoration( + hintText: "Enter Company Name", + hintStyle: TextStyle( + fontWeight: FontWeight.w400, + color: Color(0xFFB4BEC0), + fontSize: 14, ), + + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, ), ), ), - if(tcpProvider.tpcPaymentModeError!=null)...[ - Container( - alignment: Alignment.topLeft, - margin: EdgeInsets.only(top: 2.5, left: 25), - child: Text( - "${tcpProvider.tpcPaymentModeError}", - style: TextStyle(color: Colors.red, fontSize: 10), + ), + if (tcpProvider.tpcPaymentModeError != null) ...[ + Container( + alignment: Alignment.topLeft, + margin: EdgeInsets.only(top: 2.5, left: 25), + child: Text( + "${tcpProvider.tpcPaymentModeError}", + style: TextStyle( + color: Colors.red, + fontSize: 10, ), ), - ], - Padding( - padding: const EdgeInsets.only( - bottom: 5.0, top: 8.0), - child: Text("TPC Payment Reference No. /Cheque No. / UTR No."), ), - Container( - height: 50, - alignment: Alignment.center, - decoration: BoxDecoration( - color: Color(0xFFE9E9E9), - borderRadius: BorderRadius.circular(14), + ], + Padding( + padding: const EdgeInsets.only( + bottom: 5.0, + top: 8.0, + ), + child: Text( + "TPC Payment Reference No. /Cheque No. / UTR No.", + ), + ), + Container( + height: 50, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFE9E9E9), + borderRadius: BorderRadius.circular(14), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB( + 10.0, + 0.0, + 10, + 0, ), - child: Padding( - padding: const EdgeInsets.fromLTRB( - 10.0, 0.0, 10, 0), - child: TextFormField( - controller: tcpProvider - .tpcPaymentModeController, - readOnly: true, - keyboardType: TextInputType.text, - maxLines: 1, - onChanged: tcpProvider.onChangeTPCPaymentReference, - style: TextStyle( - color: Color(0xFF818181), fontSize: 14), - decoration: InputDecoration( - hintText: "Enter Order Number", - hintStyle: TextStyle( - fontWeight: FontWeight.w400, - color: Color(0xFFB4BEC0), - fontSize: 14, - ), - - enabledBorder: InputBorder.none, - focusedBorder: InputBorder.none, + child: TextFormField( + controller: + tcpProvider.tpcPaymentModeController, + readOnly: true, + keyboardType: TextInputType.text, + maxLines: 1, + onChanged: + tcpProvider.onChangeTPCPaymentReference, + style: TextStyle( + color: Color(0xFF818181), + fontSize: 14, + ), + decoration: InputDecoration( + hintText: "Enter Order Number", + hintStyle: TextStyle( + fontWeight: FontWeight.w400, + color: Color(0xFFB4BEC0), + fontSize: 14, ), + + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, ), ), ), - if(tcpProvider.tpcPaymentReferenceNoError!=null)...[ - Container( - alignment: Alignment.topLeft, - margin: EdgeInsets.only(top: 2.5, left: 25), - child: Text( - "${tcpProvider.tpcPaymentReferenceNoError}", - style: TextStyle(color: Colors.red, fontSize: 10), + ), + if (tcpProvider.tpcPaymentReferenceNoError != + null) ...[ + Container( + alignment: Alignment.topLeft, + margin: EdgeInsets.only(top: 2.5, left: 25), + child: Text( + "${tcpProvider.tpcPaymentReferenceNoError}", + style: TextStyle( + color: Colors.red, + fontSize: 10, ), ), - ], - - + ), + ], Padding( padding: const EdgeInsets.only( - bottom: 5.0, top: 8.0), + bottom: 5.0, + top: 8.0, + ), child: Text("Remarks"), ), Container( @@ -2519,16 +2478,22 @@ class _TpcagentissuelistdetailsState extends State { ), child: Padding( padding: const EdgeInsets.fromLTRB( - 10.0, 0.0, 10, 0), + 10.0, + 0.0, + 10, + 0, + ), child: TextFormField( - controller: tcpProvider - .orderTpcFeedbackController, + controller: + tcpProvider.orderTpcFeedbackController, readOnly: true, keyboardType: TextInputType.text, maxLines: 60, onChanged: tcpProvider.onChangeTpcFeedback, style: TextStyle( - color: Color(0xFF818181), fontSize: 14), + color: Color(0xFF818181), + fontSize: 14, + ), decoration: InputDecoration( hintText: "Write Remarks", hintStyle: TextStyle( @@ -2543,13 +2508,16 @@ class _TpcagentissuelistdetailsState extends State { ), ), ), - if(tcpProvider.orderTpcFeedbackError!=null)...[ + if (tcpProvider.orderTpcFeedbackError != null) ...[ Container( alignment: Alignment.topLeft, margin: EdgeInsets.only(top: 2.5, left: 25), child: Text( "${tcpProvider.orderTpcFeedbackError}", - style: TextStyle(color: Colors.red, fontSize: 10), + style: TextStyle( + color: Colors.red, + fontSize: 10, + ), ), ), ], @@ -2580,32 +2548,47 @@ class _TpcagentissuelistdetailsState extends State { ), ), ), - if(tcpProvider.imagePicked==1 && tcpProvider.imagePath!=null)...[ + if (tcpProvider.imagePicked == 1 && + tcpProvider.imagePath != null) ...[ Padding( - padding: const EdgeInsets.symmetric(vertical: 4.0), + padding: const EdgeInsets.symmetric( + vertical: 4.0, + ), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ - Text("${tcpProvider.imagePath}",style: TextStyle( + Text( + "${tcpProvider.imagePath}", + style: TextStyle( color: AppColors.semi_black, fontSize: 11, - fontWeight: FontWeight.w600 - ),), + fontWeight: FontWeight.w600, + ), + ), InkResponse( - onTap: () { - tcpProvider.imagePicked = 0; - tcpProvider.imagePath = null; - tcpProvider.imageFilePath = null; - }, - child: SvgPicture.asset("assets/svg/ic_close.svg",width: 15,height: 15,)) + onTap: () { + tcpProvider.imagePicked = 0; + tcpProvider.imagePath = null; + tcpProvider.imageFilePath = null; + }, + child: SvgPicture.asset( + "assets/svg/ic_close.svg", + width: 15, + height: 15, + ), + ), ], ), - ) + ), ], InkWell( onTap: () { - tcpProvider.TPCAgentsIssueApprovalAPIFunction(context, widget.orderId); + tcpProvider.TPCAgentsIssueApprovalAPIFunction( + context, + widget.orderId, + ); }, child: Container( @@ -2656,19 +2639,14 @@ class _TpcagentissuelistdetailsState extends State { return StatefulBuilder( builder: (context, setState) { return SafeArea( - child: Consumer( - - builder: (context,tcpProvider, child) { + child: Consumer( + builder: (context, tcpProvider, child) { return Padding( - padding: EdgeInsets.only( bottom: - MediaQuery - .of( - context, - ) - .viewInsets - .bottom, // This handles keyboard + MediaQuery.of( + context, + ).viewInsets.bottom, // This handles keyboard ), child: Container( margin: EdgeInsets.only( @@ -2688,18 +2666,18 @@ class _TpcagentissuelistdetailsState extends State { child: Text( "Select Source", style: TextStyle( - color: AppColors.app_blue, - fontSize: 16 + color: AppColors.app_blue, + fontSize: 16, ), ), ), - SizedBox(height: 15,), + SizedBox(height: 15), InkWell( onTap: () { Navigator.of(context).pop(false); tcpProvider.imgFromGallery(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -2708,10 +2686,9 @@ class _TpcagentissuelistdetailsState extends State { InkWell( onTap: () { Navigator.of(context).pop(false); - tcpProvider.imgFromCamera( - context); + tcpProvider.imgFromCamera(context); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), @@ -2729,5 +2706,4 @@ class _TpcagentissuelistdetailsState extends State { }, ); } - } diff --git a/lib/screens/order/tpcAgentListByMode.dart b/lib/screens/order/tpcAgentListByMode.dart index 2efbe0f..7783102 100644 --- a/lib/screens/order/tpcAgentListByMode.dart +++ b/lib/screens/order/tpcAgentListByMode.dart @@ -13,12 +13,16 @@ import '../../Utils/commonWidgets.dart'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:generp/Utils/commonServices.dart'; + class Tpcagentlistbymode extends StatefulWidget { final pageTitleName; final mode; - const Tpcagentlistbymode( - {super.key, required this.pageTitleName, required this.mode}); + const Tpcagentlistbymode({ + super.key, + required this.pageTitleName, + required this.mode, + }); @override State createState() => _TpcagentlistbymodeState(); @@ -59,7 +63,6 @@ class _TpcagentlistbymodeState extends State { super.dispose(); } - @override Widget build(BuildContext context) { switch (_source.keys.toList()[0]) { @@ -75,24 +78,26 @@ class _TpcagentlistbymodeState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () { - Provider.of(context,listen: false).resetAll(); - return onBackPressed(context); - }, - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () { + Provider.of( + context, + listen: false, + ).resetAll(); + return onBackPressed(context); + }, + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } Widget _scaffold(BuildContext context) { - - return Consumer( + return Consumer( builder: (context, provider, child) { final tpcAgentsLists = provider.tpcAgentsList; return Scaffold( @@ -109,165 +114,160 @@ class _TpcagentlistbymodeState extends State { // }, // child: SvgPicture.asset("assets/svg/ic_download.svg",), // ), - - ], ), - 0xFFFFFFFF + 0xFFFFFFFF, ), backgroundColor: AppColors.scaffold_bg_color, - body: provider.isLoading && tpcAgentsLists.isEmpty - ? Center( - child: CircularProgressIndicator.adaptive( - valueColor: - AlwaysStoppedAnimation(AppColors.app_blue), - ), - ) - : tpcAgentsLists.isNotEmpty - ? RefreshIndicator( - onRefresh: () async { - provider.resetPagination(); - await provider.TPCAgentsListAPIFunction( - context, - widget.mode, - ); - }, - child: ListView.builder( - controller: _scrollController, - itemCount: tpcAgentsLists.length + - (provider.hasMoreData ? 1 : 0), - itemBuilder: (context, index) { - if (index == tpcAgentsLists.length) { - return provider.isLoadingMore - ? const Padding( - padding: EdgeInsets.all(16), - child: Center( - child: CircularProgressIndicator()), - ) - : const SizedBox.shrink(); - } - - final agent = tpcAgentsLists[index]; - return InkResponse( - onTap: () async { - Navigator.push(context, MaterialPageRoute( - builder: (context) => - Tpcagentdetailsbymode(mode: widget.mode, - pageTitleName: widget.pageTitleName, - tpcAgentId: tpcAgentsLists[index] - .tpcAgentId, - ),)); - }, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 7.5, - vertical: 5, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 5, + body: + provider.isLoading && tpcAgentsLists.isEmpty + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, + ), ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - - // decoration: BoxDecoration( - // color: Color(0xFFEAF7FF), - // borderRadius: - // BorderRadius.circular(8), - // ), - child: SvgPicture.asset( - "assets/svg/order/tpc_list_ic.svg", + ) + : tpcAgentsLists.isNotEmpty + ? RefreshIndicator( + onRefresh: () async { + provider.resetPagination(); + await provider.TPCAgentsListAPIFunction( + context, + widget.mode, + ); + }, + child: ListView.builder( + controller: _scrollController, + itemCount: + tpcAgentsLists.length + + (provider.hasMoreData ? 1 : 0), + itemBuilder: (context, index) { + if (index == tpcAgentsLists.length) { + return provider.isLoadingMore + ? const Padding( + padding: EdgeInsets.all(16), + child: Center( + child: CircularProgressIndicator(), ), + ) + : const SizedBox.shrink(); + } + + final agent = tpcAgentsLists[index]; + return InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Tpcagentdetailsbymode( + mode: widget.mode, + pageTitleName: widget.pageTitleName, + tpcAgentId: + tpcAgentsLists[index].tpcAgentId, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 7.5, + vertical: 5, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, ), - SizedBox(width: 10), - Expanded( - flex: 5, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + ), + child: Column( + children: [ + Row( children: [ - Text( - tpcAgentsLists[index].name!, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontFamily: - "JakartaRegular", - fontSize: 14, - color: - AppColors.semi_black, + Expanded( + flex: 1, + child: SizedBox( + height: 50, + width: 35, + + // decoration: BoxDecoration( + // color: Color(0xFFEAF7FF), + // borderRadius: + // BorderRadius.circular(8), + // ), + child: SvgPicture.asset( + "assets/svg/order/tpc_list_ic.svg", + ), ), ), - Text( - - "${tpcAgentsLists[index] - .mobileNumber}", - style: TextStyle( - fontFamily: - "JakartaRegular", - fontSize: 14, - color: AppColors.grey_semi, + SizedBox(width: 10), + Expanded( + flex: 5, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + tpcAgentsLists[index].name!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.semi_black, + ), + ), + Text( + "${tpcAgentsLists[index].mobileNumber}", + style: TextStyle( + fontFamily: "JakartaRegular", + fontSize: 14, + color: AppColors.grey_semi, + ), + ), + ], + ), + ), + ), + SizedBox(width: 10), + Expanded( + flex: 1, + child: InkResponse( + onTap: () { + launch( + 'tel://${tpcAgentsLists[index].mobileNumber}', + ); + }, + child: SizedBox( + height: 35, + width: 35, + child: SvgPicture.asset( + "assets/svg/crm/lead_list_call_ic.svg", + ), + ), ), ), ], ), - ), + ], ), - SizedBox(width: 10), - Expanded( - flex: 1, - child: InkResponse( - onTap: () { - launch( - 'tel://${tpcAgentsLists[index] - .mobileNumber}', - ); - }, - child: SizedBox( - height: 35, - width: 35, - child: SvgPicture.asset( - "assets/svg/crm/lead_list_call_ic.svg", - ), - ), - ), - ), - - ], - ), - - - ], + ), + ); + }, ), - ), - ); - }, - ), - ) - : Emptywidget(context), + ) + : Emptywidget(context), ); }, ); } - - Widget _scaffold1(BuildContext context) { - - return Consumer( + return Consumer( builder: (context, provider, child) { final tpcAgentsLists = provider.tpcAgentsList; return WillPopScope( @@ -277,7 +277,7 @@ class _TpcagentlistbymodeState extends State { }, child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar2( @@ -292,235 +292,252 @@ class _TpcagentlistbymodeState extends State { // }, // child: SvgPicture.asset("assets/svg/ic_download.svg",), // ), - - ], ), ), backgroundColor: AppColors.scaffold_bg_color, body: - provider.isLoading - ? Center(child: CircularProgressIndicator.adaptive( - valueColor: AlwaysStoppedAnimation( - AppColors.app_blue) - )) - : tpcAgentsLists.isNotEmpty ? SingleChildScrollView( - child: Column( - children: [ - ListView.builder( - itemCount: tpcAgentsLists.length, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, index) { - if (tpcAgentsLists.isEmpty) { - return SizedBox( - child: Center( - child: Text("No Data Available"), - ), - ); - } - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, + provider.isLoading + ? Center( + child: CircularProgressIndicator.adaptive( + valueColor: AlwaysStoppedAnimation( + AppColors.app_blue, ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(16), - ), - child: Column( - children: [ - Row( - children: [ - Expanded( - flex: 1, - child: Container( - height: 50, - width: 35, - - decoration: BoxDecoration( - color: Color(0xFFEAF7FF), - borderRadius: - BorderRadius.circular(8), - ), - child: SvgPicture.asset( - "assets/svg/tpc_ic.svg", - ), + ), + ) + : tpcAgentsLists.isNotEmpty + ? SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + itemCount: tpcAgentsLists.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, index) { + if (tpcAgentsLists.isEmpty) { + return SizedBox( + child: Center( + child: Text("No Data Available"), ), + ); + } + return Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), ), - SizedBox(width: 10), - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + child: Column( + children: [ + Row( children: [ - Text( - tpcAgentsLists[index].name!, - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: - AppColors.semi_black, + Expanded( + flex: 1, + child: Container( + height: 50, + width: 35, + + decoration: BoxDecoration( + color: Color(0xFFEAF7FF), + borderRadius: + BorderRadius.circular(8), + ), + child: SvgPicture.asset( + "assets/svg/tpc_ic.svg", + ), ), ), - Text( - - "${tpcAgentsLists[index] - .mobileNumber}", - style: TextStyle( - fontFamily: - "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, + SizedBox(width: 10), + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + tpcAgentsLists[index].name!, + style: TextStyle( + fontFamily: + "JakartaMedium", + fontSize: 14, + color: + AppColors.semi_black, + ), + ), + Text( + "${tpcAgentsLists[index].mobileNumber}", + style: TextStyle( + fontFamily: + "JakartaMedium", + fontSize: 14, + color: AppColors.app_blue, + ), + ), + ], + ), ), ), ], ), - ), - ), - - ], - ), - Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ...List.generate(4, (j) { - final headings = [ - "Entered Employee", - "Issued Amount", - "ID Proof", - "Description", - ]; - - final subHeadings = [ - tpcAgentsLists[index].enteredEmpName, - tpcAgentsLists[index].issuedAmount, - "View", - tpcAgentsLists[index].note, - ]; - return Container( - padding: EdgeInsets.symmetric( - vertical: 5, - ), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - headings[j], - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.semi_black, - ), - ), + Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), ), - if(subHeadings[j] == "View")...[ - Expanded( - child: InkResponse( - onTap: () { - Navigator.push(context, - MaterialPageRoute( - builder: (context) => - Fileviewer( - fileName: tpcAgentsLists[index] - .idProofViewFileName ?? - "-", - fileUrl: tpcAgentsLists[index] - .idProofDirFilePath ?? - "-"),)); - }, - child: Text( - "${subHeadings[j]}", - style: TextStyle( - fontSize: 14, - color:AppColors.app_blue, - decoration: TextDecoration - .underline, - decorationColor: AppColors.app_blue, + ...List.generate(4, (j) { + final headings = [ + "Entered Employee", + "Issued Amount", + "ID Proof", + "Description", + ]; + + final subHeadings = [ + tpcAgentsLists[index].enteredEmpName, + tpcAgentsLists[index].issuedAmount, + "View", + tpcAgentsLists[index].note, + ]; + return Container( + padding: EdgeInsets.symmetric( + vertical: 5, + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + headings[j], + style: TextStyle( + fontFamily: "JakartaMedium", + fontSize: 14, + color: AppColors.semi_black, + ), + ), ), + if (subHeadings[j] == "View") ...[ + Expanded( + child: InkResponse( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Fileviewer( + fileName: + tpcAgentsLists[index] + .idProofViewFileName ?? + "-", + fileUrl: + tpcAgentsLists[index] + .idProofDirFilePath ?? + "-", + ), + ), + ); + }, + child: Text( + "${subHeadings[j]}", + style: TextStyle( + fontSize: 14, + color: + AppColors.app_blue, + decoration: + TextDecoration + .underline, + decorationColor: + AppColors.app_blue, + ), + ), + ), + ), + ] else ...[ + Expanded( + child: InkResponse( + child: Text( + "${subHeadings[j]}", + style: TextStyle( + fontSize: 14, + color: Color( + 0xFF818181, + ), + decoration: + TextDecoration.none, + decorationColor: + AppColors.white, + ), + ), + ), + ), + ], + ], + ), + ); + }), + InkResponse( + onTap: () async { + Navigator.push( + context, + MaterialPageRoute( + builder: + ( + context, + ) => Tpcagentdetailsbymode( + mode: widget.mode, + pageTitleName: + widget.pageTitleName, + tpcAgentId: + tpcAgentsLists[index] + .tpcAgentId, + ), ), + ); + }, + child: Container( + padding: EdgeInsets.symmetric( + vertical: 5, ), - ), - ] else - ...[ - Expanded( - child: InkResponse( - - child: Text( - "${subHeadings[j]}", + child: Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Text( + "View Details", style: TextStyle( + fontFamily: "JakartaMedium", fontSize: 14, - color: Color( - 0xFF818181, - ), - decoration: TextDecoration - .none, - decorationColor: AppColors - .white, + color: AppColors.app_blue, ), ), - ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], ), - ] - - ], - ), - ); - }), - InkResponse( - onTap: () async { - Navigator.push(context, MaterialPageRoute( - builder: (context) => - Tpcagentdetailsbymode(mode: widget.mode, - pageTitleName: widget.pageTitleName, - tpcAgentId: tpcAgentsLists[index] - .tpcAgentId, - ),)); - }, - child: Container( - padding: EdgeInsets.symmetric( - vertical: 5, - ), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.center, - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14, - color: AppColors.app_blue, ), ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), ], ), - ), - ), - ], - ), - ); - }, - ), - ], - ), - ) : Emptywidget(context), + ); + }, + ), + ], + ), + ) + : Emptywidget(context), ), ), ); diff --git a/lib/screens/serviceEngineer/AccountSuggestions.dart b/lib/screens/serviceEngineer/AccountSuggestions.dart index 94bf6a3..024188a 100644 --- a/lib/screens/serviceEngineer/AccountSuggestions.dart +++ b/lib/screens/serviceEngineer/AccountSuggestions.dart @@ -30,7 +30,7 @@ class _AccountsuggestionsState extends State { bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, - appBar: appbarNew(context, "Accounts",0xFFFFFFFF), + appBar: appbarNew(context, "Accounts", 0xFFFFFFFF), backgroundColor: AppColors.scaffold_bg_color, body: Container( decoration: BoxDecoration(color: Colors.white), @@ -91,19 +91,20 @@ class _AccountsuggestionsState extends State { ), suffixIcon: Container( padding: EdgeInsets.only(right: 10), - child:_searchController.text.isNotEmpty? - InkResponse( - onTap: () { - _searchController.clear(); - provider.accountList.clear(); - }, - child: SvgPicture.asset( - "assets/svg/crm/clear_search.svg", - ), - ): - SvgPicture.asset( - "assets/svg/search_ic.svg", - ), + child: + _searchController.text.isNotEmpty + ? InkResponse( + onTap: () { + _searchController.clear(); + provider.accountList.clear(); + }, + child: SvgPicture.asset( + "assets/svg/crm/clear_search.svg", + ), + ) + : SvgPicture.asset( + "assets/svg/search_ic.svg", + ), ), counterText: "", hintText: "Enter Account Name", @@ -144,18 +145,22 @@ class _AccountsuggestionsState extends State { physics: AlwaysScrollableScrollPhysics(), child: Container( child: ListView.builder( - itemCount: provider.accountList!.length, + itemCount: provider.accountList.length, padding: const EdgeInsets.all(5), physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, itemBuilder: (context, index) { var accountList = provider.accountList; - String accname = provider.accountList[index].accountName ?? ""; - RegExp regex = - RegExp(_searchController.text, caseSensitive: false); - Iterable matches = - regex.allMatches(accname); + String accname = + provider.accountList[index].accountName ?? ""; + RegExp regex = RegExp( + _searchController.text, + caseSensitive: false, + ); + Iterable matches = regex.allMatches( + accname, + ); List textSpans = []; int previousMatchEnd = 0; @@ -166,7 +171,9 @@ class _AccountsuggestionsState extends State { textSpans.add( TextSpan( text: accname.substring( - previousMatchEnd, match.start), + previousMatchEnd, + match.start, + ), style: TextStyle( color: AppColors.semi_black, fontSize: 14, @@ -180,7 +187,9 @@ class _AccountsuggestionsState extends State { textSpans.add( TextSpan( text: accname.substring( - match.start, match.end), + match.start, + match.end, + ), style: TextStyle( color: AppColors.app_blue, fontSize: 14, // Highlight color @@ -205,7 +214,7 @@ class _AccountsuggestionsState extends State { ), ); } - if (accountList!.length > 0) { + if (accountList!.isNotEmpty) { return InkWell( onTap: () { // if(actname == "pendingComplaints"&&status=="Open"){ @@ -216,18 +225,18 @@ class _AccountsuggestionsState extends State { (context) => Paymentdetails( accountName: "Account", name: - accountList![index] + accountList[index] .accountName, genId: "", referenceID: - accountList![index].accountId, + accountList[index].accountId, ), ), ); // } }, child: SizedBox( - child: Container( + child: SizedBox( width: MediaQuery.of(context).size.width * 0.9, @@ -274,22 +283,24 @@ class _AccountsuggestionsState extends State { // ), // ], // ), - child: ListTile( - leading: SvgPicture.asset( - "assets/svg/crm/crm_search_list_ic.svg", - ), - title:RichText(text: TextSpan( + child: ListTile( + leading: SvgPicture.asset( + "assets/svg/crm/crm_search_list_ic.svg", + ), + title: RichText( + text: TextSpan( children: textSpans, - style: TextStyle( + style: TextStyle( color: AppColors.semi_black, fontSize: 14, // Highlight color fontFamily: "JakartaMedium", ), - )), - trailing: SvgPicture.asset( - "assets/svg/arrow_right_new.svg", ), - ) + ), + trailing: SvgPicture.asset( + "assets/svg/arrow_right_new.svg", + ), + ), ), ), ); diff --git a/lib/screens/serviceEngineer/NearbyGenerators.dart b/lib/screens/serviceEngineer/NearbyGenerators.dart index 89d83a3..76a556b 100644 --- a/lib/screens/serviceEngineer/NearbyGenerators.dart +++ b/lib/screens/serviceEngineer/NearbyGenerators.dart @@ -28,9 +28,12 @@ class _NearbygeneratorsState extends State { // TODO: implement initState super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) { - var provider = Provider.of(context,listen: false); + var provider = Provider.of( + context, + listen: false, + ); provider.getLocationPermission(context); - },); + }); } // Future infoDialogue(BuildContext context) async { @@ -207,77 +210,92 @@ class _NearbygeneratorsState extends State { @override Widget build(BuildContext context) { debugPrint("Nearbygenerators widget rebuilt"); - return Consumer(builder: (context, provider, child) { - var sendWidget = GestureDetector( + return Consumer( + builder: (context, provider, child) { + var sendWidget = GestureDetector( onTap: () { _showFilterBottomSheet(context); }, - child: SvgPicture.asset("assets/svg/filter_ic.svg",height: 25,)); + child: SvgPicture.asset("assets/svg/filter_ic.svg", height: 25), + ); - return WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: Platform.isIOS?false:true, - child: Scaffold( - resizeToAvoidBottomInset: true, - appBar: appbar2(context, "Nearby Generators",provider.resetAll,sendWidget), - backgroundColor: AppColors.scaffold_bg_color, - body: Container( - child: SingleChildScrollView( - child:Column( - children: [ - ClipRRect( - // Apply border radius using ClipRRect - borderRadius: BorderRadius.only( - topLeft: Radius.circular(30.0), - topRight: Radius.circular(30.0), - ), - // padding: EdgeInsets.fromLTRB(10, 20, 10, 20), - child: Container( - height: MediaQuery.of(context).size.height, - child: Stack(children: [ - GoogleMap( - scrollGesturesEnabled: true, - rotateGesturesEnabled: true, + return WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + appBar: appbar2( + context, + "Nearby Generators", + provider.resetAll, + sendWidget, + ), + backgroundColor: AppColors.scaffold_bg_color, + body: Container( + child: SingleChildScrollView( + child: Column( + children: [ + ClipRRect( + // Apply border radius using ClipRRect + borderRadius: BorderRadius.only( + topLeft: Radius.circular(30.0), + topRight: Radius.circular(30.0), + ), + // padding: EdgeInsets.fromLTRB(10, 20, 10, 20), + child: SizedBox( + height: MediaQuery.of(context).size.height, + child: Stack( + children: [ + GoogleMap( + scrollGesturesEnabled: true, + rotateGesturesEnabled: true, - myLocationEnabled: true, - zoomGesturesEnabled: true, - zoomControlsEnabled: true, - gestureRecognizers: { - Factory(() => EagerGestureRecognizer()), - Factory(() => PanGestureRecognizer()), - Factory(() => ScaleGestureRecognizer()), // Prioritize pinch-to-zoom - }, - initialCameraPosition: CameraPosition( - target: provider.startLocation, - zoom:14.0 - ), - markers:provider.markers.toSet(), - mapType: MapType.normal, - onMapCreated: (controller) { - setState(() { - provider.mapController = controller; - }); - }, - onCameraMove: (position) { - provider.onCameraMove(context,position); - }, + myLocationEnabled: true, + zoomGesturesEnabled: true, + zoomControlsEnabled: true, + gestureRecognizers: { + Factory( + () => EagerGestureRecognizer(), + ), + Factory( + () => PanGestureRecognizer(), + ), + Factory( + () => ScaleGestureRecognizer(), + ), // Prioritize pinch-to-zoom + }, + initialCameraPosition: CameraPosition( + target: provider.startLocation, + zoom: 14.0, + ), + markers: provider.markers.toSet(), + mapType: MapType.normal, + onMapCreated: (controller) { + setState(() { + provider.mapController = controller; + }); + }, + onCameraMove: (position) { + provider.onCameraMove(context, position); + }, + ), + ], ), - ]), + ), ), - ), - ], + ], + ), ), ), ), ), - ), - ); - },); + ); + }, + ); } - Future _showFilterBottomSheet(BuildContext context) { return showModalBottomSheet( useSafeArea: true, @@ -292,7 +310,7 @@ class _NearbygeneratorsState extends State { builder: (context, setState) { return SafeArea( child: Consumer( - builder: (context,provider,child) { + builder: (context, provider, child) { return Container( margin: EdgeInsets.only( bottom: 15, @@ -300,7 +318,9 @@ class _NearbygeneratorsState extends State { right: 15, top: 15, ), - padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom,), + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, @@ -339,46 +359,53 @@ class _NearbygeneratorsState extends State { Expanded( child: Text( 'Select Complaint Status', - style: TextStyle( - fontSize: 14, - ), + style: TextStyle(fontSize: 14), overflow: TextOverflow.ellipsis, ), ), ], ), - items: [ - 'Active', - 'Inactive', - 'Suspense', - ].map( - (value) => - DropdownMenuItem( - value: value, - child: Text( - value ?? '', - style: const TextStyle( - fontSize: 14, + items: + [ + 'Active', + 'Inactive', + 'Suspense', + ] + .map( + ( + value, + ) => DropdownMenuItem( + value: value, + child: Text( + value ?? '', + style: const TextStyle( + fontSize: 14, + ), + overflow: + TextOverflow.ellipsis, ), - overflow: TextOverflow.ellipsis, ), - )).toList(), + ) + .toList(), value: provider.selectedItem, onChanged: (String? newValue) { setState(() { provider.selectedItem = newValue!; }); }, - buttonStyleData: ddtheme.buttonStyleData, + buttonStyleData: + ddtheme.buttonStyleData, iconStyleData: ddtheme.iconStyleData, - menuItemStyleData: ddtheme.menuItemStyleData, - dropdownStyleData: ddtheme.dropdownStyleData, + menuItemStyleData: + ddtheme.menuItemStyleData, + dropdownStyleData: + ddtheme.dropdownStyleData, ), ), ], ), ), - SizedBox(height: 10,), + SizedBox(height: 10), Row( children: [ Text( @@ -399,14 +426,17 @@ class _NearbygeneratorsState extends State { ], ), InteractiveSlider( - padding: EdgeInsets.symmetric(horizontal: 4,vertical: 0), + padding: EdgeInsets.symmetric( + horizontal: 4, + vertical: 0, + ), min: 1.0, max: 50.0, enabled: true, // backgroundColor: AppColors.app_blue, foregroundColor: AppColors.app_blue, - segmentDividerColor:Color(0xFFF6F6F8), + segmentDividerColor: Color(0xFFF6F6F8), onChanged: (value) { provider.currentValue = value; // provider.debounce(() { @@ -434,7 +464,10 @@ class _NearbygeneratorsState extends State { child: InkWell( onTap: () { provider.debounce(() { - provider.LoadNearbyGeneratorsAPI(context,provider.currentValue); + provider.LoadNearbyGeneratorsAPI( + context, + provider.currentValue, + ); Navigator.pop(context); }, Duration(milliseconds: 500)); }, @@ -447,14 +480,14 @@ class _NearbygeneratorsState extends State { ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(14.0), - color: AppColors.app_blue + color: AppColors.app_blue, ), child: Text( "Search", textAlign: TextAlign.center, style: TextStyle( fontFamily: 'JakartaMedium', - color: Colors.white + color: Colors.white, ), ), ), @@ -466,7 +499,7 @@ class _NearbygeneratorsState extends State { ), ), ); - } + }, ), ); }, diff --git a/lib/screens/serviceEngineer/PCWallet.dart b/lib/screens/serviceEngineer/PCWallet.dart index f2788f2..5ead1c5 100644 --- a/lib/screens/serviceEngineer/PCWallet.dart +++ b/lib/screens/serviceEngineer/PCWallet.dart @@ -58,19 +58,18 @@ class _PcwalletState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold(context), - ), - ) - : _scaffold(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold(context), + ), + ) + : _scaffold(context) : NoNetwork(context); } - Widget _scaffold(BuildContext context) { return Consumer( builder: (context, provider, child) { @@ -79,9 +78,10 @@ class _PcwalletState extends State { onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, + ///Container( // padding: EdgeInsets.symmetric(horizontal: 10), // height: 40, @@ -111,7 +111,10 @@ class _PcwalletState extends State { child: Column( children: [ Container( - margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), @@ -138,7 +141,7 @@ class _PcwalletState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - "₹${provider.totlDetails.balanceAmount ?? "-"}", + "₹${provider.totlDetails.balanceAmount ?? "-"}", style: TextStyle( fontSize: 20, fontFamily: "JakartaMedium", @@ -187,24 +190,24 @@ class _PcwalletState extends State { ), decoration: BoxDecoration( color: - texts[jj] == "Debited" - ? Color(0xFFFFEFEF) - : Color(0xFFE7FFE5), + texts[jj] == "Debited" + ? Color(0xFFFFEFEF) + : Color(0xFFE7FFE5), borderRadius: BorderRadius.circular(16), ), child: Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Text( - "₹${heads[jj] ?? "-"}", + "₹${heads[jj] ?? "-"}", maxLines: 2, style: TextStyle( fontSize: 20, color: - texts[jj] == "Debited" - ? Color(0xFFEF3739) - : Color(0xFF0D9C00), + texts[jj] == "Debited" + ? Color(0xFFEF3739) + : Color(0xFF0D9C00), fontFamily: "JakartaMedium", ), ), @@ -219,14 +222,18 @@ class _PcwalletState extends State { maxLines: 1, style: TextStyle( fontSize: 14, - fontFamily: "JakartaRegular", - color: AppColors.semi_black, + fontFamily: + "JakartaRegular", + color: + AppColors.semi_black, ), ), ), Expanded( flex: 1, - child: SvgPicture.asset(svgs[jj]), + child: SvgPicture.asset( + svgs[jj], + ), ), ], ), @@ -238,28 +245,31 @@ class _PcwalletState extends State { }), ], ), - SizedBox(height: 5,) + SizedBox(height: 5), ], ), ), - ListView.builder( physics: NeverScrollableScrollPhysics(), shrinkWrap: true, itemCount: provider.historyList.length, itemBuilder: (context, index) { - double running_balance = 0; + double runningBalance = 0; int currentIndex = provider.historyList.indexOf( provider.historyList[index], ); String part1 = - provider.historyList[index].description!.split(' (').first; + provider.historyList[index].description! + .split(' (') + .first; RegExp regExp = RegExp(r'\(([^)]+)\)'); String? part2 = regExp - .firstMatch(provider.historyList[index].description!) + .firstMatch( + provider.historyList[index].description!, + ) ?.group(1); return Container( @@ -267,7 +277,10 @@ class _PcwalletState extends State { horizontal: 10, vertical: 10, ), - margin: EdgeInsets.symmetric(horizontal: 10, vertical: 5), + margin: EdgeInsets.symmetric( + horizontal: 10, + vertical: 5, + ), // margin: EdgeInsets.symmetric(vertical: 5), decoration: BoxDecoration( color: Colors.white, @@ -281,20 +294,22 @@ class _PcwalletState extends State { flex: 1, child: SizedBox( child: - provider.historyList[index].transactionType == - "Debit" - ? SvgPicture.asset( - "assets/svg/finance/debited_filled_ic.svg", - height: 45, - width: 45, - fit: BoxFit.contain, - ) - : SvgPicture.asset( - "assets/svg/finance/credited_filled_ic.svg", - height: 45, - width: 45, - fit: BoxFit.contain, - ), + provider + .historyList[index] + .transactionType == + "Debit" + ? SvgPicture.asset( + "assets/svg/finance/debited_filled_ic.svg", + height: 45, + width: 45, + fit: BoxFit.contain, + ) + : SvgPicture.asset( + "assets/svg/finance/credited_filled_ic.svg", + height: 45, + width: 45, + fit: BoxFit.contain, + ), ), ), SizedBox(width: 10), @@ -304,7 +319,8 @@ class _PcwalletState extends State { child: Column( children: [ Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ // Expanded( // flex: 5, @@ -324,27 +340,32 @@ class _PcwalletState extends State { // ), // ), Expanded( - flex:5, + flex: 5, child: SizedBox( child: Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ - Text(part1, - maxLines: 2, - style: TextStyle( - fontFamily: "JakartaMedium", - fontSize: 14 - ),), - if(part2!=null) Text( - "${part2}", + part1, maxLines: 2, style: TextStyle( - color: AppColors.grey_semi, - fontSize: 14 + fontFamily: + "JakartaMedium", + fontSize: 14, ), ), + if (part2 != null) + Text( + part2, + maxLines: 2, + style: TextStyle( + color: + AppColors + .grey_semi, + fontSize: 14, + ), + ), ], ), ), @@ -356,43 +377,53 @@ class _PcwalletState extends State { child: RichText( maxLines: 1, textAlign: TextAlign.right, - overflow: TextOverflow.ellipsis, + overflow: + TextOverflow.ellipsis, text: TextSpan( children: [ TextSpan( text: - provider - .historyList[index] - .transactionType == - "Debit" - ? "-" - : "+", + provider + .historyList[index] + .transactionType == + "Debit" + ? "-" + : "+", style: TextStyle( color: - provider - .historyList[index] - .transactionType == - "Debit" - ? Color(0xFFEF3739) - : Color(0xFF0D9C00), + provider + .historyList[index] + .transactionType == + "Debit" + ? Color( + 0xFFEF3739, + ) + : Color( + 0xFF0D9C00, + ), fontSize: 14, fontFamily: - "JakartaRegular", + "JakartaRegular", ), ), TextSpan( text: - "₹${provider.historyList[index].transactionType == "Debit" ? "${provider.historyList[index].amount}" : "${provider.historyList[index].amount}"}", + "₹${provider.historyList[index].transactionType == "Debit" ? "${provider.historyList[index].amount}" : "${provider.historyList[index].amount}"}", style: TextStyle( - color: provider - .historyList[index] - .transactionType == - "Debit" - ? Color(0xFFEF3739) - : Color(0xFF0D9C00), + color: + provider + .historyList[index] + .transactionType == + "Debit" + ? Color( + 0xFFEF3739, + ) + : Color( + 0xFF0D9C00, + ), fontSize: 14, fontFamily: - "JakartaRegular", + "JakartaRegular", ), ), ], @@ -402,7 +433,7 @@ class _PcwalletState extends State { ), ], ), - SizedBox(height: 7,), + SizedBox(height: 7), Row( children: [ Expanded( @@ -410,20 +441,21 @@ class _PcwalletState extends State { child: SizedBox( child: Text( provider - .historyList[index] - .datetime ?? + .historyList[index] + .datetime ?? "-", maxLines: 2, - overflow: TextOverflow.ellipsis, + overflow: + TextOverflow.ellipsis, style: TextStyle( - fontFamily: "JakartaRegular", + fontFamily: + "JakartaRegular", color: AppColors.grey_semi, fontSize: 12, ), ), ), ), - ], ), ], @@ -446,7 +478,6 @@ class _PcwalletState extends State { ); } - Widget _scaffold1(BuildContext context) { return Consumer( builder: (context, provider, child) { @@ -455,9 +486,10 @@ class _PcwalletState extends State { onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, + ///Container( // padding: EdgeInsets.symmetric(horizontal: 10), // height: 40, @@ -486,9 +518,11 @@ class _PcwalletState extends State { child: SingleChildScrollView( child: Column( children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 10, vertical: 15), + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 15, + ), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16), @@ -509,7 +543,8 @@ class _PcwalletState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Text( "₹", @@ -519,7 +554,8 @@ class _PcwalletState extends State { ), ), Text( - "${provider.totlDetails.creditAmount??"0.00"}", + provider.totlDetails.creditAmount ?? + "0.00", style: TextStyle( fontSize: 30, height: 1, @@ -528,9 +564,12 @@ class _PcwalletState extends State { ), ], ), - Text("Credited",style: TextStyle( - fontFamily: "JakartaMedium" - ),), + Text( + "Credited", + style: TextStyle( + fontFamily: "JakartaMedium", + ), + ), ], ), ), @@ -550,7 +589,8 @@ class _PcwalletState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, children: [ Text( "₹", @@ -560,7 +600,7 @@ class _PcwalletState extends State { ), ), Text( - "${provider.totlDetails.debitAmount??0.00}", + "${provider.totlDetails.debitAmount ?? 0.00}", style: TextStyle( fontSize: 30, height: 1, @@ -569,9 +609,12 @@ class _PcwalletState extends State { ), ], ), - Text("Debited",style: TextStyle( - fontFamily: "JakartaMedium" - )), + Text( + "Debited", + style: TextStyle( + fontFamily: "JakartaMedium", + ), + ), ], ), ), @@ -599,7 +642,7 @@ class _PcwalletState extends State { date, style: TextStyle( fontSize: 14, - fontFamily: "JakartaMedium", + fontFamily: "JakartaMedium", color: Color(0xFF818181), ), ), @@ -627,36 +670,40 @@ class _PcwalletState extends State { MainAxisAlignment.start, children: [ Expanded( - flex:1, + flex: 1, child: SizedBox( - child: item.transactionType == "Credit" - ? Image.asset( - "assets/images/trans_credit.png", - height: 45, - width: 45, - fit: BoxFit.contain, - ) - : Image.asset( - "assets/images/trans_debit.png", - height: 45, - width: 45, - fit: BoxFit.contain, - ), + child: + item.transactionType == "Credit" + ? Image.asset( + "assets/images/trans_credit.png", + height: 45, + width: 45, + fit: BoxFit.contain, + ) + : Image.asset( + "assets/images/trans_debit.png", + height: 45, + width: 45, + fit: BoxFit.contain, + ), ), ), - SizedBox(width: 10,), + SizedBox(width: 10), Expanded( - flex:5, + flex: 5, child: SizedBox( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(part1,style: TextStyle( - fontFamily: "JakartaMedium" - ),), Text( - "${part2}", + part1, + style: TextStyle( + fontFamily: "JakartaMedium", + ), + ), + Text( + "$part2", style: TextStyle( color: Color(0xFF818181), ), @@ -673,13 +720,16 @@ class _PcwalletState extends State { text: TextSpan( children: [ TextSpan( - text: item.transactionType == - "Credit" - ? "+":"-", + text: + item.transactionType == + "Credit" + ? "+" + : "-", style: TextStyle( color: Color(0xFF2D2D2D), fontSize: 14, - fontFamily: "JakartaRegular", + fontFamily: + "JakartaRegular", ), ), TextSpan( @@ -687,7 +737,8 @@ class _PcwalletState extends State { style: TextStyle( color: Color(0xFF2D2D2D), fontSize: 14, - fontFamily: "JakartaMedium", + fontFamily: + "JakartaMedium", ), ), ], @@ -698,13 +749,12 @@ class _PcwalletState extends State { ], ), ); - }).toList(), + }), ], ), ); }, ), - ], ), ), diff --git a/lib/screens/serviceEngineer/PaymentDetails.dart b/lib/screens/serviceEngineer/PaymentDetails.dart index 619543e..a161094 100644 --- a/lib/screens/serviceEngineer/PaymentDetails.dart +++ b/lib/screens/serviceEngineer/PaymentDetails.dart @@ -73,7 +73,7 @@ class _PaymentdetailsState extends State { bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, - appBar: appbarNew(context, "Payment Details",0xFFFFFFFF), + appBar: appbarNew(context, "Payment Details", 0xFFFFFFFF), backgroundColor: AppColors.scaffold_bg_color, body: SingleChildScrollView( child: RefreshIndicator.adaptive( @@ -162,7 +162,7 @@ class _PaymentdetailsState extends State { ], ), ); - }).toList(), + }), DropdownMenuItem( onTap: () {}, value: null, @@ -294,12 +294,10 @@ class _PaymentdetailsState extends State { print( "Selected Complaint Type: ${value.name}, ID: ${value.id}", ); - provider.PaymentMode = value?.name; - provider.paymentModeID = value?.id; + provider.PaymentMode = value.name; + provider.paymentModeID = value.id; print( - "hfjkshfg" + - provider.paymentModeID - .toString(), + "hfjkshfg${provider.paymentModeID}", ); } } @@ -438,7 +436,7 @@ class _PaymentdetailsState extends State { MainAxisAlignment.spaceBetween, children: [ Expanded( - flex: 5 , + flex: 5, child: Text( "${provider.imagePath}", style: TextStyle( @@ -468,7 +466,6 @@ class _PaymentdetailsState extends State { ), ], errorWidget(context, provider.imageError), - ], ), ), @@ -478,13 +475,11 @@ class _PaymentdetailsState extends State { FloatingActionButtonLocation.centerFloat, floatingActionButton: InkWell( onTap: () { - provider.PaymentUpdateAPI( context, provider.Referencecontroller.text, provider.Amountcontroller.text, ); - }, child: Container( alignment: Alignment.center, @@ -575,7 +570,7 @@ class _PaymentdetailsState extends State { provider.Amountcontroller.text, ); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -590,7 +585,7 @@ class _PaymentdetailsState extends State { provider.Amountcontroller.text, ); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), @@ -897,7 +892,7 @@ class _PaymentdetailsState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("${controllersNames[index]}"), + Text(controllersNames[index]), Container( height: 50, margin: EdgeInsets.symmetric(vertical: 5), @@ -946,7 +941,7 @@ class _PaymentdetailsState extends State { : TextInputAction.next, decoration: InputDecoration( counterText: "", - hintText: "${hintTextNames[index]}", + hintText: hintTextNames[index], hintStyle: TextStyle( fontWeight: FontWeight.w400, color: Color(0xFFB4BEC0), @@ -959,7 +954,7 @@ class _PaymentdetailsState extends State { ), ), ), - errorWidget(context, Errors[index]) + errorWidget(context, Errors[index]), ], ); }), diff --git a/lib/screens/serviceEngineer/PendingComplaints.dart b/lib/screens/serviceEngineer/PendingComplaints.dart index 526fca7..f53b9b4 100644 --- a/lib/screens/serviceEngineer/PendingComplaints.dart +++ b/lib/screens/serviceEngineer/PendingComplaints.dart @@ -135,7 +135,6 @@ class _PendingcomplaintsState extends State { ); }, child: Container( - margin: EdgeInsets.symmetric(vertical: 5), decoration: BoxDecoration( color: Colors.white, @@ -168,7 +167,7 @@ class _PendingcomplaintsState extends State { ?.split(",") .toString(); var uri = Uri.parse( - "google.navigation:q=${loc![0]},${loc![1]}&mode=d", + "google.navigation:q=${loc![0]},${loc[1]}&mode=d", ); if (await canLaunch( uri.toString(), @@ -190,11 +189,14 @@ class _PendingcomplaintsState extends State { context, MaterialPageRoute( builder: - (context) => Updatecomplaints( - ComplaintID: provider - .technician_complaint_list[index] - .complaintId, - ), + ( + context, + ) => Updatecomplaints( + ComplaintID: + provider + .technician_complaint_list[index] + .complaintId, + ), ), ); }, @@ -319,7 +321,7 @@ class _PendingcomplaintsState extends State { "#${provider.technician_complaint_list[index].engineNo}", maxLines: 1, overflow: - TextOverflow.ellipsis, + TextOverflow.ellipsis, style: TextStyle( color: Color( 0xFF818181, @@ -749,7 +751,7 @@ class _PendingcomplaintsState extends State { ?.split(",") .toString(); var uri = Uri.parse( - "google.navigation:q=${loc![0]},${loc![1]}&mode=d", + "google.navigation:q=${loc![0]},${loc[1]}&mode=d", ); if (await canLaunch(uri.toString())) { await launch(uri.toString()); diff --git a/lib/screens/serviceEngineer/TodayMontlyVisists.dart b/lib/screens/serviceEngineer/TodayMontlyVisists.dart index bd506a1..9501198 100644 --- a/lib/screens/serviceEngineer/TodayMontlyVisists.dart +++ b/lib/screens/serviceEngineer/TodayMontlyVisists.dart @@ -22,7 +22,6 @@ class Todaymontlyvisists extends StatefulWidget { } class _TodaymontlyvisistsState extends State { - Map _source = {ConnectivityResult.mobile: true}; final MyConnectivity _connectivity = MyConnectivity.instance; @@ -52,6 +51,7 @@ class _TodaymontlyvisistsState extends State { } }); } + @override void dispose() { // TODO: implement dispose @@ -74,19 +74,18 @@ class _TodaymontlyvisistsState extends State { } return (connection == "Online") ? Platform.isAndroid - ? WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: true, - child: _scaffold1(context), - ), - ) - : _scaffold1(context) + ? WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: true, + child: _scaffold1(context), + ), + ) + : _scaffold1(context) : NoNetwork(context); } - @override Widget _scaffold1(BuildContext context) { return Consumer( @@ -95,109 +94,249 @@ class _TodaymontlyvisistsState extends State { onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.scaffold_bg_color, - appBar: appbarNew(context, provider.title,0xFFFFFFFF), - body:provider.visitsList.isNotEmpty - ? Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: provider.visitsList.length, - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - - itemBuilder: (context, index) { - return InkResponse( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Visitdetails( - complaintID: - provider - .visitsList[index] - .complaintId, - ), + appBar: appbarNew(context, provider.title, 0xFFFFFFFF), + body: + provider.visitsList.isNotEmpty + ? Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: provider.visitsList.length, + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, ), - ); - }, - child: Container( - // padding: EdgeInsets.symmetric( - // horizontal: 10, - // vertical: 0, - // ), - margin: EdgeInsets.symmetric(vertical: 5), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(20), - child: Slidable( - endActionPane: ActionPane( - motion: const ScrollMotion(), - key: ValueKey(provider.visitsList[index].complaintId), - dragDismissible: false, - // dismissible: DismissiblePane( - // - // onDismissed: () {}, - // closeOnCancel: true, - // resizeDuration: Duration(milliseconds: 300),), + itemBuilder: (context, index) { + return InkResponse( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Visitdetails( + complaintID: + provider + .visitsList[index] + .complaintId, + ), + ), + ); + }, + child: Container( + // padding: EdgeInsets.symmetric( + // horizontal: 10, + // vertical: 0, + // ), + margin: EdgeInsets.symmetric(vertical: 5), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(20), + child: Slidable( + endActionPane: ActionPane( + motion: const ScrollMotion(), + key: ValueKey( + provider.visitsList[index].complaintId, + ), + dragDismissible: false, - children: [ + // dismissible: DismissiblePane( + // + // onDismissed: () {}, + // closeOnCancel: true, + // resizeDuration: Duration(milliseconds: 300),), + children: [ + SlidableAction( + onPressed: (context) { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Paymentdetails( + accountName: "Generator", + name: + provider + .visitsList[index] + .companyName, + genId: + provider + .visitsList[index] + .genId, + referenceID: + provider + .visitsList[index] + .complaintId, + ), + ), + ); + }, + backgroundColor: Color(0xFFE7FFE5), + foregroundColor: Color(0xFF0D9C00), + icon: Icons.add, + label: 'Payment Details', + ), + ], + ), - SlidableAction( - onPressed: (context) { + child: Container( + margin: EdgeInsets.symmetric(vertical: 5), + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 0, + ), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: + CrossAxisAlignment.center, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Container( + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), + decoration: BoxDecoration( + color: Color(0xFFE6F6FF), + shape: BoxShape.circle, + ), + child: SvgPicture.asset( + width: 30, + height: 30, + "assets/svg/se_block_head.svg", + ), + ), + ), + SizedBox(width: 5), - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Paymentdetails( - accountName: "Generator", - name: - provider - .visitsList[index] - .companyName, - genId: - provider - .visitsList[index] - .genId, - referenceID: - provider - .visitsList[index] - .complaintId, + Expanded( + flex: 4, + child: SizedBox( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + provider + .visitsList[index] + .contactName ?? + "-", + maxLines: 1, + overflow: + TextOverflow + .ellipsis, + style: TextStyle( + fontFamily: + "JakartaMedium", + ), + ), + Text( + "${provider.visitsList[index].companyName}", + maxLines: 1, + overflow: + TextOverflow + .ellipsis, + style: TextStyle( + color: Color( + 0xFF818181, + ), + ), + ), + ], + ), + ), + ), + Spacer(), + Expanded( + flex: 1, + child: InkResponse( + onTap: () { + launch( + 'tel://${provider.visitsList[index].mobileNo}', + ); + }, + child: SvgPicture.asset( + "assets/svg/se_call_customer.svg", + color: Color(0xFF0D9C00), + height: 20, + width: 20, + ), + ), + ), + ], ), - ), - ); - }, - backgroundColor: Color(0xFFE7FFE5), - foregroundColor: Color(0xFF0D9C00), - icon: Icons.add, - label: 'Payment Details', + ], + ), + ), ), + ), + ), + ); + }, + ), + ) + : Emptywidget(context), + ), + ), + ); + }, + ); + } - ], - ), + Widget _scaffold(BuildContext context) { + return Consumer( + builder: (context, provider, child) { + return WillPopScope( + onWillPop: () => onBackPressed(context), + child: SafeArea( + top: false, + bottom: Platform.isIOS ? false : true, + child: Scaffold( + resizeToAvoidBottomInset: true, + backgroundColor: AppColors.scaffold_bg_color, + appBar: appbar(context, provider.title), + body: + provider.visitsList.isNotEmpty + ? Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: provider.visitsList.length, + padding: EdgeInsets.symmetric( + horizontal: 10, + vertical: 10, + ), - child: Container( - margin: EdgeInsets.symmetric(vertical: 5), + itemBuilder: (context, index) { + return Container( padding: EdgeInsets.symmetric( horizontal: 10, - vertical: 0, + vertical: 10, + ), + margin: EdgeInsets.symmetric(vertical: 5), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: + CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( @@ -209,7 +348,9 @@ class _TodaymontlyvisistsState extends State { ), decoration: BoxDecoration( color: Color(0xFFE6F6FF), - shape: BoxShape.circle + borderRadius: BorderRadius.circular( + 8, + ), ), child: SvgPicture.asset( width: 30, @@ -225,10 +366,13 @@ class _TodaymontlyvisistsState extends State { child: SizedBox( child: Column( crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Text( - "${provider.visitsList[index].contactName ?? "-"}", + provider + .visitsList[index] + .contactName ?? + "-", maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -264,271 +408,144 @@ class _TodaymontlyvisistsState extends State { ), ), ), + // Expanded( + // flex: 1, + // child: InkResponse( + // onTap: () { + // _showOptionsSheet(context); + // }, + // child: Icon(Icons.more_vert), + // ), + // ), ], ), - - - ], - ), - ), - ), - ), - ), - ); - }, - ), - ) - : Emptywidget(context) - ), - ), - ); - }, - ); - } - - Widget _scaffold(BuildContext context) { - return Consumer( - builder: (context, provider, child) { - return WillPopScope( - onWillPop: () => onBackPressed(context), - child: SafeArea( - top: false, - bottom: Platform.isIOS?false:true, - child: Scaffold( - resizeToAvoidBottomInset: true, - backgroundColor: AppColors.scaffold_bg_color, - appBar: appbar(context, provider.title), - body:provider.visitsList.isNotEmpty - ? Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: provider.visitsList.length, - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - - itemBuilder: (context, index) { - return Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - margin: EdgeInsets.symmetric(vertical: 5), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(20), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Container( - padding: EdgeInsets.symmetric( - horizontal: 10, - vertical: 10, - ), - decoration: BoxDecoration( - color: Color(0xFFE6F6FF), - borderRadius: BorderRadius.circular( - 8, + Padding( + padding: const EdgeInsets.all(8.0), + child: Divider( + thickness: 0.5, + color: Color(0xFFD7D7D7), ), ), - child: SvgPicture.asset( - width: 30, - height: 30, - "assets/svg/se_block_head.svg", - ), - ), - ), - SizedBox(width: 5), - - Expanded( - flex: 4, - child: SizedBox( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - "${provider.visitsList[index].contactName ?? "-"}", - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontFamily: "JakartaMedium", - ), + ...List.generate(3, (j) { + final textheads = [ + "ID", + "Generator Type", + "Address", + ]; + final textSubheads = [ + provider.visitsList[index].genId, + provider.visitsList[index].productName, + provider.visitsList[index].address, + ]; + return Container( + padding: EdgeInsets.symmetric( + vertical: 3, ), - Text( - "${provider.visitsList[index].companyName}", - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Color(0xFF818181), - ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + flex: 1, + child: Text( + textheads[j].toString(), + style: TextStyle( + fontFamily: "JakartaMedium", + ), + ), + ), + Expanded( + flex: 2, + child: Text( + textSubheads[j].toString(), + style: TextStyle( + color: Color(0xFF818181), + ), + ), + ), + ], ), - ], - ), - ), - ), - Spacer(), - Expanded( - flex: 1, - child: InkResponse( - onTap: () { - launch( - 'tel://${provider.visitsList[index].mobileNo}', ); - }, - child: SvgPicture.asset( - "assets/svg/se_call_customer.svg", - color: Color(0xFF0D9C00), - height: 20, - width: 20, - ), - ), - ), - // Expanded( - // flex: 1, - // child: InkResponse( - // onTap: () { - // _showOptionsSheet(context); - // }, - // child: Icon(Icons.more_vert), - // ), - // ), - ], - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Divider( - thickness: 0.5, - color: Color(0xFFD7D7D7), - ), - ), - ...List.generate(3, (j) { - final textheads = [ - "ID", - "Generator Type", - "Address", - ]; - final textSubheads = [ - provider.visitsList[index].genId, - provider.visitsList[index].productName, - provider.visitsList[index].address, - ]; - return Container( - padding: EdgeInsets.symmetric(vertical: 3), - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Expanded( - flex: 1, - child: Text( - textheads[j].toString(), - style: TextStyle( - fontFamily: "JakartaMedium", - ), - ), - ), - Expanded( - flex: 2, - child: Text( - textSubheads[j].toString(), - style: TextStyle( - color: Color(0xFF818181), - ), + }), + SizedBox( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + InkResponse( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Paymentdetails( + accountName: "Generator", + name: + provider + .visitsList[index] + .companyName, + genId: + provider + .visitsList[index] + .genId, + referenceID: + provider + .visitsList[index] + .complaintId, + ), + ), + ); + }, + child: SvgPicture.asset( + "assets/svg/se_payment_details.svg", + ), + ), + Spacer(), + InkResponse( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => Visitdetails( + complaintID: + provider + .visitsList[index] + .complaintId, + ), + ), + ); + }, + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Text( + "View Details", + style: TextStyle( + fontFamily: "JakartaMedium", + color: AppColors.app_blue, + ), + ), + SizedBox(width: 5), + SvgPicture.asset( + "assets/svg/next_button.svg", + ), + ], + ), + ), + ], ), ), ], ), ); - }), - SizedBox( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - InkResponse( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Paymentdetails( - accountName: "Generator", - name: - provider - .visitsList[index] - .companyName, - genId: - provider - .visitsList[index] - .genId, - referenceID: - provider - .visitsList[index] - .complaintId, - ), - ), - ); - }, - child: SvgPicture.asset( - "assets/svg/se_payment_details.svg", - ), - ), - Spacer(), - InkResponse( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: - (context) => Visitdetails( - complaintID: - provider - .visitsList[index] - .complaintId, - ), - ), - ); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Text( - "View Details", - style: TextStyle( - fontFamily: "JakartaMedium", - color: AppColors.app_blue, - ), - ), - SizedBox(width: 5), - SvgPicture.asset( - "assets/svg/next_button.svg", - ), - ], - ), - ), - ], - ), - ), - ], - ), - ); - }, - ), - ) - : Emptywidget(context) + }, + ), + ) + : Emptywidget(context), ), ), ); diff --git a/lib/screens/serviceEngineer/UpdateComplaints.dart b/lib/screens/serviceEngineer/UpdateComplaints.dart index d80414c..cf84830 100644 --- a/lib/screens/serviceEngineer/UpdateComplaints.dart +++ b/lib/screens/serviceEngineer/UpdateComplaints.dart @@ -45,7 +45,7 @@ class _UpdatecomplaintsState extends State { }, child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, appBar: appbar2( @@ -230,10 +230,7 @@ class _UpdatecomplaintsState extends State { child: Row( children: [ Text( - provider.selectedTime.hour.toString() + - ":" + - provider.selectedTime.minute - .toString() ?? + "${provider.selectedTime.hour}:${provider.selectedTime.minute}" ?? "Enter in Time", textAlign: TextAlign.center, style: TextStyle( @@ -451,10 +448,11 @@ class _UpdatecomplaintsState extends State { } Widget ErrorWidget(context, text) { - if (text != null) + if (text != null) { return Text(text!, style: TextStyle(color: Colors.red, fontSize: 12)); - else + } else { return SizedBox(height: 10); + } } Future _showAttachmentSheet(BuildContext context) { @@ -508,7 +506,7 @@ class _UpdatecomplaintsState extends State { Navigator.of(context).pop(false); provider.imgFromGallery(); }, - child: Container( + child: SizedBox( height: 35, child: Text("Select photo from gallery"), ), @@ -519,7 +517,7 @@ class _UpdatecomplaintsState extends State { Navigator.of(context).pop(false); provider.imgFromCamera(); }, - child: Container( + child: SizedBox( height: 35, child: Text("Capture photo from camera"), ), diff --git a/lib/screens/serviceEngineer/VisitDetails.dart b/lib/screens/serviceEngineer/VisitDetails.dart index f706bd8..877c457 100644 --- a/lib/screens/serviceEngineer/VisitDetails.dart +++ b/lib/screens/serviceEngineer/VisitDetails.dart @@ -1079,7 +1079,7 @@ class _VisitdetailsState extends State { ?.split(",") .toString(); var uri = Uri.parse( - "google.navigation:q=${loc![0]},${loc![1]}&mode=d", + "google.navigation:q=${loc![0]},${loc[1]}&mode=d", ); if (await canLaunch(uri.toString())) { await launch(uri.toString()); diff --git a/lib/screens/serviceEngineer/scanComplaintDetails.dart b/lib/screens/serviceEngineer/scanComplaintDetails.dart index 615d5fc..a96cf96 100644 --- a/lib/screens/serviceEngineer/scanComplaintDetails.dart +++ b/lib/screens/serviceEngineer/scanComplaintDetails.dart @@ -41,7 +41,7 @@ class _ScancomplaintdetailsState extends State { onWillPop: () => onBackPressed(context), child: SafeArea( top: false, - bottom: Platform.isIOS?false:true, + bottom: Platform.isIOS ? false : true, child: Scaffold( resizeToAvoidBottomInset: true, backgroundColor: AppColors.scaffold_bg_color, @@ -51,20 +51,22 @@ class _ScancomplaintdetailsState extends State { child: Column( children: [ Spacer(), - Container( + SizedBox( height: 250, child: QRView( - key: provider.scannerKey, onQRViewCreated: (p0) { - provider.onQRViewCreated(p0, "pendingComplaints", context); + provider.onQRViewCreated( + p0, + "pendingComplaints", + context, + ); }, formatsAllowed: [BarcodeFormat.qrcode], cameraFacing: CameraFacing.back, overlay: QrScannerOverlayShape( - borderColor: AppColors.app_blue, borderRadius: 20, borderLength: 60, @@ -127,9 +129,9 @@ class _ScancomplaintdetailsState extends State { child: Padding( padding: EdgeInsets.only( bottom: - MediaQuery.of( - context, - ).viewInsets.bottom, // This handles keyboard + MediaQuery.of( + context, + ).viewInsets.bottom, // This handles keyboard ), child: Container( margin: EdgeInsets.only( @@ -156,7 +158,7 @@ class _ScancomplaintdetailsState extends State { ), ), ), - SizedBox(height: 5,), + SizedBox(height: 5), Container( height: 48, alignment: Alignment.center, @@ -164,12 +166,12 @@ class _ScancomplaintdetailsState extends State { color: AppColors.text_field_color, borderRadius: BorderRadius.circular(20), border: - partIDfocusNode.hasFocus - ? Border.all( - color: AppColors.app_blue, - width: 0.5, - ) - : null, + partIDfocusNode.hasFocus + ? Border.all( + color: AppColors.app_blue, + width: 0.5, + ) + : null, ), // alignment: Alignment.center, margin: EdgeInsets.only(left: 5.0, right: 5.0), @@ -184,7 +186,8 @@ class _ScancomplaintdetailsState extends State { controller: partIDcontroller, keyboardType: TextInputType.emailAddress, focusNode: partIDfocusNode, - textCapitalization: TextCapitalization.characters, + textCapitalization: + TextCapitalization.characters, style: TextStyle(fontSize: 14), onChanged: (value) {}, @@ -206,7 +209,7 @@ class _ScancomplaintdetailsState extends State { ), ), ), - SizedBox(height: 15,), + SizedBox(height: 15), InkWell( onTap: () { provider.LoadgeneratorComplaintHistoryApifunction( @@ -215,7 +218,6 @@ class _ScancomplaintdetailsState extends State { "pendingComplaints", partIDcontroller.text, ); - }, child: Container( alignment: Alignment.center, diff --git a/lib/screens/serviceEngineer/serviceEngineerDashboard.dart b/lib/screens/serviceEngineer/serviceEngineerDashboard.dart index bfc93ea..bbb99a2 100644 --- a/lib/screens/serviceEngineer/serviceEngineerDashboard.dart +++ b/lib/screens/serviceEngineer/serviceEngineerDashboard.dart @@ -216,7 +216,7 @@ class _ServiceengineerdashboardState extends State { ]; return InkResponse( onTap: () { - var route; + StatefulWidget route; switch (index) { case 0: route = Monthlycollection(); @@ -270,7 +270,7 @@ class _ServiceengineerdashboardState extends State { Padding( padding: EdgeInsets.only(top: 5), child: Text( - "${numbers[index].toString()}", + numbers[index].toString(), style: TextStyle( fontSize: 20, color: Color(textColorCodes[index]), diff --git a/lib/screens/splash.dart b/lib/screens/splash.dart index 529b6bd..629a084 100644 --- a/lib/screens/splash.dart +++ b/lib/screens/splash.dart @@ -1,7 +1,6 @@ import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:generp/Utils/commonWidgets.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -9,6 +8,7 @@ import 'package:provider/provider.dart'; import '../Notifiers/splashVersionNotifier.dart'; import '../Utils/commonServices.dart'; + class Splash extends StatefulWidget { const Splash({super.key}); @@ -201,7 +201,6 @@ class Splash extends StatefulWidget { // } // } - class _SplashState extends State { late Image splashImage; Map _source = {ConnectivityResult.mobile: true}; @@ -213,7 +212,6 @@ class _SplashState extends State { super.initState(); _connectivity.initialise(); _connectivity.myStream.listen((source) { - setState(() => _source = source); }); splashImage = Image.asset("assets/images/ic_splash.jpg"); @@ -228,7 +226,7 @@ class _SplashState extends State { if (connection == 'Online') { print("camer here"); spalshProvider.handleVersionCheck(context); - }else{ + } else { spalshProvider.handleVersionCheck(context); } }); diff --git a/lib/screens/test.dart b/lib/screens/test.dart index 2515eed..81d8c24 100644 --- a/lib/screens/test.dart +++ b/lib/screens/test.dart @@ -29,7 +29,7 @@ class _AffiliatedashboardState extends State var earnings_filter = ""; var earnings_filter_from_date = ""; var earnings_filter_to_date = ""; - int _currentIndex = 0; + final int _currentIndex = 0; final List Filteritems = [ 'Today', @@ -76,8 +76,11 @@ class _AffiliatedashboardState extends State case 'Past 7 days': DateTime startOfPast7Days = now.subtract(Duration(days: 6)); return DateTimeRange( - start: DateTime(startOfPast7Days.year, startOfPast7Days.month, - startOfPast7Days.day), + start: DateTime( + startOfPast7Days.year, + startOfPast7Days.month, + startOfPast7Days.day, + ), end: DateTime(now.year, now.month, now.day), ); case 'Custom': @@ -87,7 +90,7 @@ class _AffiliatedashboardState extends State } } -// Function to show custom date range picker + // Function to show custom date range picker Future showCustomDateRangePicker(BuildContext context) async { return await showDateRangePicker( context: context, @@ -96,12 +99,12 @@ class _AffiliatedashboardState extends State ); } -// Function to format date for display as YYYY-MM-DD + // Function to format date for display as YYYY-MM-DD String formatDate(DateTime date) { return "${date.year}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}"; } -// Example usage for displaying the selected date range + // Example usage for displaying the selected date range String getFormattedDateRange() { if (selectedDateRange != null) { return '${formatDate(selectedDateRange!.start)} - ${formatDate(selectedDateRange!.end)}'; @@ -116,30 +119,30 @@ class _AffiliatedashboardState extends State super.initState(); } - void _prepareChartData() { - chartData = [] - .map((earning) { - // Convert rawDate or date to DateTime - DateTime? dateTime; - if (earning.rawDate != null) { - dateTime = DateTime.tryParse(earning.rawDate!); - } else if (earning.date != null) { - dateTime = DateTime.tryParse(earning.date!); - } + chartData = + [] + .map((earning) { + // Convert rawDate or date to DateTime + DateTime? dateTime; + if (earning.rawDate != null) { + dateTime = DateTime.tryParse(earning.rawDate!); + } else if (earning.date != null) { + dateTime = DateTime.tryParse(earning.date!); + } - // Convert creditAmount to double - double? credit = double.tryParse(earning.creditAmount ?? '0'); + // Convert creditAmount to double + double? credit = double.tryParse(earning.creditAmount ?? '0'); - if (dateTime != null && credit != null) { - return _ChartData(dateTime, credit); - } else { - return null; - } - }) - .where((data) => data != null) // Remove null values - .cast<_ChartData>() - .toList(); + if (dateTime != null && credit != null) { + return _ChartData(dateTime, credit); + } else { + return null; + } + }) + .where((data) => data != null) // Remove null values + .cast<_ChartData>() + .toList(); } @override @@ -149,22 +152,19 @@ class _AffiliatedashboardState extends State super.dispose(); } - - List<_ChartData> chartData = []; @override Widget build(BuildContext context) { - double screenWidth = MediaQuery.of(context).size.width; double screenHeight = MediaQuery.of(context).size.height; - return Scaffold( + return Scaffold( backgroundColor: Color(0xFFF4F5FA), body: SingleChildScrollView( child: Container( padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), child: Column( children: [ - Container( + SizedBox( width: screenWidth, height: screenHeight * 0.28, child: GridView.builder( @@ -186,45 +186,51 @@ class _AffiliatedashboardState extends State "Total Orders Shipped", ]; List labelsTexts = [ - "${totalEarned}", - "${totalOrders}", - "${totalClicks}", - "${totalordersShipped}", + "$totalEarned", + "$totalOrders", + "$totalClicks", + "$totalordersShipped", ]; return Container( - padding: - EdgeInsets.symmetric(vertical: 5, horizontal: 10), + padding: EdgeInsets.symmetric( + vertical: 5, + horizontal: 10, + ), decoration: BoxDecoration( - color: (index == 0) - ? Color(0xFF382560) - : Color(0xFFD7E0FF), - borderRadius: BorderRadius.circular(14)), + color: + (index == 0) + ? Color(0xFF382560) + : Color(0xFFD7E0FF), + borderRadius: BorderRadius.circular(14), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end, children: [ Text( - "${labelsTexts[index]}", + labelsTexts[index], style: TextStyle( - color: (index == 0) - ? Colors.white - : Color(0xFF382560), + color: + (index == 0) + ? Colors.white + : Color(0xFF382560), fontFamily: "Inter", fontWeight: FontWeight.w400, fontSize: 28, ), ), Text( - "${labels[index]}", + labels[index], style: TextStyle( - color: (index == 0) - ? Colors.white - : Color(0xFF566CB8), + color: + (index == 0) + ? Colors.white + : Color(0xFF566CB8), fontFamily: "Inter", fontWeight: FontWeight.w400, fontSize: 12, ), - ) + ), ], ), ); @@ -238,13 +244,16 @@ class _AffiliatedashboardState extends State height: screenHeight * 0.5, width: screenWidth, decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12)), + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), child: Column( children: [ Container( - padding: - EdgeInsets.symmetric(vertical: 0, horizontal: 10), + padding: EdgeInsets.symmetric( + vertical: 0, + horizontal: 10, + ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -264,7 +273,7 @@ class _AffiliatedashboardState extends State isExpanded: true, hint: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, children: [ SizedBox(width: 4), Expanded( @@ -280,20 +289,22 @@ class _AffiliatedashboardState extends State ), ], ), - items: Filteritems2.map( - (String item) => DropdownMenuItem( - value: item, - child: Text( - item, - textAlign: TextAlign.right, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, - color: Colors.white, + items: + Filteritems2.map( + (String item) => DropdownMenuItem( + value: item, + child: Text( + item, + textAlign: TextAlign.right, + style: const TextStyle( + fontSize: 14, + fontWeight: FontWeight.w400, + color: Colors.white, + ), + overflow: TextOverflow.ellipsis, ), - overflow: TextOverflow.ellipsis, ), - )).toList(), + ).toList(), value: selectedValue2, style: TextStyle( fontSize: 14, @@ -304,8 +315,9 @@ class _AffiliatedashboardState extends State onChanged: (value) async { if (value == 'Custom') { selectedDateRange = - await showCustomDateRangePicker( - context); + await showCustomDateRangePicker( + context, + ); } else { selectedDateRange = getDateRange(value!); } @@ -318,11 +330,11 @@ class _AffiliatedashboardState extends State if (selectedDateRange != null) { // Extracting the 'from' and 'to' dates directly from DateTimeRange var fromRange = formatDate( - selectedDateRange! - .start); // Format start date + selectedDateRange!.start, + ); // Format start date var toRange = formatDate( - selectedDateRange! - .end); // Format end date + selectedDateRange!.end, + ); // Format end date // print('From range: $fromRange'); // Output: From range: 2024-09-21 // print('To range: $toRange'); // Output: To range: 2024-09-21 @@ -336,12 +348,12 @@ class _AffiliatedashboardState extends State height: 40, width: 160, padding: const EdgeInsets.only( - left: 14, right: 14), + left: 14, + right: 14, + ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(14), - border: Border.all( - color: Colors.black26, - ), + border: Border.all(color: Colors.black26), color: Color(0xFF382560), ), elevation: 0, @@ -363,9 +375,10 @@ class _AffiliatedashboardState extends State offset: const Offset(0, 0), scrollbarTheme: ScrollbarThemeData( radius: const Radius.circular(40), - thickness: MaterialStateProperty.all(0), - thumbVisibility: - MaterialStateProperty.all(true), + thickness: WidgetStateProperty.all(0), + thumbVisibility: WidgetStateProperty.all( + true, + ), ), ), menuItemStyleData: const MenuItemStyleData( @@ -373,24 +386,20 @@ class _AffiliatedashboardState extends State padding: EdgeInsets.only(left: 14, right: 14), ), ), - ) + ), ], ), ), - ], ), ), ], - ], ), ), ), ); } - - } class _ChartData { -- GitLab