Compare commits
No commits in common. 'master' and 'mohemm_HMG_flutter_upgrade' have entirely different histories.
master
...
mohemm_HMG
@ -1,25 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
class GetTicketAccuralBalanceModel {
|
|
||||||
int? accrualNetEntitlement;
|
|
||||||
String? accuralPlanCode;
|
|
||||||
|
|
||||||
GetTicketAccuralBalanceModel({
|
|
||||||
this.accrualNetEntitlement,
|
|
||||||
this.accuralPlanCode,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory GetTicketAccuralBalanceModel.fromRawJson(String str) => GetTicketAccuralBalanceModel.fromJson(json.decode(str));
|
|
||||||
|
|
||||||
String toRawJson() => json.encode(toJson());
|
|
||||||
|
|
||||||
factory GetTicketAccuralBalanceModel.fromJson(Map<String, dynamic> json) => GetTicketAccuralBalanceModel(
|
|
||||||
accrualNetEntitlement: json["ACCRUAL_NET_ENTITLEMENT"],
|
|
||||||
accuralPlanCode: json["ACCURAL_PLAN_CODE"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"ACCRUAL_NET_ENTITLEMENT": accrualNetEntitlement,
|
|
||||||
"ACCURAL_PLAN_CODE": accuralPlanCode,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,233 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
class GetFaDisposalNtfDetails {
|
|
||||||
List<PFaBuyer>? pFaBuyers;
|
|
||||||
List<PFaHeader>? pFaHeader;
|
|
||||||
List<PFaLine>? pFaLines;
|
|
||||||
String? pInformation;
|
|
||||||
dynamic pQuestion;
|
|
||||||
|
|
||||||
GetFaDisposalNtfDetails({
|
|
||||||
this.pFaBuyers,
|
|
||||||
this.pFaHeader,
|
|
||||||
this.pFaLines,
|
|
||||||
this.pInformation,
|
|
||||||
this.pQuestion,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory GetFaDisposalNtfDetails.fromRawJson(String str) => GetFaDisposalNtfDetails.fromJson(json.decode(str));
|
|
||||||
|
|
||||||
String toRawJson() => json.encode(toJson());
|
|
||||||
|
|
||||||
factory GetFaDisposalNtfDetails.fromJson(Map<String, dynamic> json) => GetFaDisposalNtfDetails(
|
|
||||||
pFaBuyers: json["P_FA_BUYERS"] == null ? [] : List<PFaBuyer>.from(json["P_FA_BUYERS"]!.map((x) => PFaBuyer.fromJson(x))),
|
|
||||||
pFaHeader: json["P_FA_HEADER"] == null ? [] : List<PFaHeader>.from(json["P_FA_HEADER"]!.map((x) => PFaHeader.fromJson(x))),
|
|
||||||
pFaLines: json["P_FA_LINES"] == null ? [] : List<PFaLine>.from(json["P_FA_LINES"]!.map((x) => PFaLine.fromJson(x))),
|
|
||||||
pInformation: json["P_INFORMATION"],
|
|
||||||
pQuestion: json["P_QUESTION"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"P_FA_BUYERS": pFaBuyers == null ? [] : List<dynamic>.from(pFaBuyers!.map((x) => x.toJson())),
|
|
||||||
"P_FA_HEADER": pFaHeader == null ? [] : List<dynamic>.from(pFaHeader!.map((x) => x.toJson())),
|
|
||||||
"P_FA_LINES": pFaLines == null ? [] : List<dynamic>.from(pFaLines!.map((x) => x.toJson())),
|
|
||||||
"P_INFORMATION": pInformation,
|
|
||||||
"P_QUESTION": pQuestion,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class PFaBuyer {
|
|
||||||
int? amount;
|
|
||||||
String? buyerName;
|
|
||||||
String? buyerNumber;
|
|
||||||
int? fromRowNum;
|
|
||||||
String? highestBidder;
|
|
||||||
int? noOfRows;
|
|
||||||
String? receiptNumber;
|
|
||||||
String? remarks;
|
|
||||||
int? requestNo;
|
|
||||||
int? rowNum;
|
|
||||||
int? toRowNum;
|
|
||||||
|
|
||||||
PFaBuyer({
|
|
||||||
this.amount,
|
|
||||||
this.buyerName,
|
|
||||||
this.buyerNumber,
|
|
||||||
this.fromRowNum,
|
|
||||||
this.highestBidder,
|
|
||||||
this.noOfRows,
|
|
||||||
this.receiptNumber,
|
|
||||||
this.remarks,
|
|
||||||
this.requestNo,
|
|
||||||
this.rowNum,
|
|
||||||
this.toRowNum,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory PFaBuyer.fromRawJson(String str) => PFaBuyer.fromJson(json.decode(str));
|
|
||||||
|
|
||||||
String toRawJson() => json.encode(toJson());
|
|
||||||
|
|
||||||
factory PFaBuyer.fromJson(Map<String, dynamic> json) => PFaBuyer(
|
|
||||||
amount: json["AMOUNT"],
|
|
||||||
buyerName: json["BUYER_NAME"],
|
|
||||||
buyerNumber: json["BUYER_NUMBER"],
|
|
||||||
fromRowNum: json["FROM_ROW_NUM"],
|
|
||||||
highestBidder: json["HIGHEST_BIDDER"],
|
|
||||||
noOfRows: json["NO_OF_ROWS"],
|
|
||||||
receiptNumber: json["RECEIPT_NUMBER"],
|
|
||||||
remarks: json["REMARKS"],
|
|
||||||
requestNo: json["REQUEST_NO"],
|
|
||||||
rowNum: json["ROW_NUM"],
|
|
||||||
toRowNum: json["TO_ROW_NUM"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"AMOUNT": amount,
|
|
||||||
"BUYER_NAME": buyerName,
|
|
||||||
"BUYER_NUMBER": buyerNumber,
|
|
||||||
"FROM_ROW_NUM": fromRowNum,
|
|
||||||
"HIGHEST_BIDDER": highestBidder,
|
|
||||||
"NO_OF_ROWS": noOfRows,
|
|
||||||
"RECEIPT_NUMBER": receiptNumber,
|
|
||||||
"REMARKS": remarks,
|
|
||||||
"REQUEST_NO": requestNo,
|
|
||||||
"ROW_NUM": rowNum,
|
|
||||||
"TO_ROW_NUM": toRowNum,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class PFaHeader {
|
|
||||||
String? bookTypeCode;
|
|
||||||
String? categoryCode;
|
|
||||||
String? categoryGroup;
|
|
||||||
String? comments;
|
|
||||||
int? requestNo;
|
|
||||||
String? status;
|
|
||||||
|
|
||||||
PFaHeader({
|
|
||||||
this.bookTypeCode,
|
|
||||||
this.categoryCode,
|
|
||||||
this.categoryGroup,
|
|
||||||
this.comments,
|
|
||||||
this.requestNo,
|
|
||||||
this.status,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory PFaHeader.fromRawJson(String str) => PFaHeader.fromJson(json.decode(str));
|
|
||||||
|
|
||||||
String toRawJson() => json.encode(toJson());
|
|
||||||
|
|
||||||
factory PFaHeader.fromJson(Map<String, dynamic> json) => PFaHeader(
|
|
||||||
bookTypeCode: json["BOOK_TYPE_CODE"],
|
|
||||||
categoryCode: json["CATEGORY_CODE"],
|
|
||||||
categoryGroup: json["CATEGORY_GROUP"],
|
|
||||||
comments: json["COMMENTS"],
|
|
||||||
requestNo: json["REQUEST_NO"],
|
|
||||||
status: json["STATUS"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"BOOK_TYPE_CODE": bookTypeCode,
|
|
||||||
"CATEGORY_CODE": categoryCode,
|
|
||||||
"CATEGORY_GROUP": categoryGroup,
|
|
||||||
"COMMENTS": comments,
|
|
||||||
"REQUEST_NO": requestNo,
|
|
||||||
"STATUS": status,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
class PFaLine {
|
|
||||||
String? action;
|
|
||||||
String? assetDescription;
|
|
||||||
int? assetNumber;
|
|
||||||
String? barcodeNumber;
|
|
||||||
String? bme;
|
|
||||||
String? datePlacedInService;
|
|
||||||
String? department;
|
|
||||||
String? disposedDate;
|
|
||||||
int? fromRowNum;
|
|
||||||
double? netBookValue;
|
|
||||||
int? noOfRows;
|
|
||||||
String? poNumber;
|
|
||||||
double? purchasePrice;
|
|
||||||
int? quantity;
|
|
||||||
int? requestNo;
|
|
||||||
int? rowNum;
|
|
||||||
String? serialNumber;
|
|
||||||
int? toRowNum;
|
|
||||||
int? usefulLife;
|
|
||||||
String? yearsUsed;
|
|
||||||
|
|
||||||
PFaLine({
|
|
||||||
this.action,
|
|
||||||
this.assetDescription,
|
|
||||||
this.assetNumber,
|
|
||||||
this.barcodeNumber,
|
|
||||||
this.bme,
|
|
||||||
this.datePlacedInService,
|
|
||||||
this.department,
|
|
||||||
this.disposedDate,
|
|
||||||
this.fromRowNum,
|
|
||||||
this.netBookValue,
|
|
||||||
this.noOfRows,
|
|
||||||
this.poNumber,
|
|
||||||
this.purchasePrice,
|
|
||||||
this.quantity,
|
|
||||||
this.requestNo,
|
|
||||||
this.rowNum,
|
|
||||||
this.serialNumber,
|
|
||||||
this.toRowNum,
|
|
||||||
this.usefulLife,
|
|
||||||
this.yearsUsed,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory PFaLine.fromRawJson(String str) => PFaLine.fromJson(json.decode(str));
|
|
||||||
|
|
||||||
String toRawJson() => json.encode(toJson());
|
|
||||||
|
|
||||||
factory PFaLine.fromJson(Map<String, dynamic> json) => PFaLine(
|
|
||||||
action: json["ACTION"],
|
|
||||||
assetDescription: json["ASSET_DESCRIPTION"],
|
|
||||||
assetNumber: json["ASSET_NUMBER"],
|
|
||||||
barcodeNumber: json["BARCODE_NUMBER"],
|
|
||||||
bme: json["BME"],
|
|
||||||
datePlacedInService: json["DATE_PLACED_IN_SERVICE"],
|
|
||||||
department: json["DEPARTMENT"],
|
|
||||||
disposedDate: json["DISPOSED_DATE"],
|
|
||||||
fromRowNum: json["FROM_ROW_NUM"],
|
|
||||||
netBookValue: json["NET_BOOK_VALUE"]?.toDouble(),
|
|
||||||
noOfRows: json["NO_OF_ROWS"],
|
|
||||||
poNumber: json["PO_NUMBER"],
|
|
||||||
purchasePrice: json["PURCHASE_PRICE"]?.toDouble(),
|
|
||||||
quantity: json["QUANTITY"],
|
|
||||||
requestNo: json["REQUEST_NO"],
|
|
||||||
rowNum: json["ROW_NUM"],
|
|
||||||
serialNumber: json["SERIAL_NUMBER"],
|
|
||||||
toRowNum: json["TO_ROW_NUM"],
|
|
||||||
usefulLife: json["USEFUL_LIFE"],
|
|
||||||
yearsUsed: json["YEARS_USED"],
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => {
|
|
||||||
"ACTION": action,
|
|
||||||
"ASSET_DESCRIPTION": assetDescription,
|
|
||||||
"ASSET_NUMBER": assetNumber,
|
|
||||||
"BARCODE_NUMBER": barcodeNumber,
|
|
||||||
"BME": bme,
|
|
||||||
"DATE_PLACED_IN_SERVICE": datePlacedInService,
|
|
||||||
"DEPARTMENT": department,
|
|
||||||
"DISPOSED_DATE": disposedDate,
|
|
||||||
"FROM_ROW_NUM": fromRowNum,
|
|
||||||
"NET_BOOK_VALUE": netBookValue,
|
|
||||||
"NO_OF_ROWS": noOfRows,
|
|
||||||
"PO_NUMBER": poNumber,
|
|
||||||
"PURCHASE_PRICE": purchasePrice,
|
|
||||||
"QUANTITY": quantity,
|
|
||||||
"REQUEST_NO": requestNo,
|
|
||||||
"ROW_NUM": rowNum,
|
|
||||||
"SERIAL_NUMBER": serialNumber,
|
|
||||||
"TO_ROW_NUM": toRowNum,
|
|
||||||
"USEFUL_LIFE": usefulLife,
|
|
||||||
"YEARS_USED": yearsUsed,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,187 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
||||||
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
||||||
import 'package:mohem_flutter_app/classes/date_uitl.dart';
|
|
||||||
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
||||||
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
||||||
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
||||||
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
||||||
import 'package:mohem_flutter_app/models/dashboard/get_accural_ticket_balance_model.dart';
|
|
||||||
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
|
||||||
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
||||||
import 'package:mohem_flutter_app/widgets/balances_dashboard_widget.dart';
|
|
||||||
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
|
||||||
import 'package:mohem_flutter_app/widgets/item_detail_view_widget.dart';
|
|
||||||
import 'package:mohem_flutter_app/widgets/sso_webview_widget.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
class TicketDetailedScreen extends StatefulWidget {
|
|
||||||
final String? url;
|
|
||||||
final String? jwtToken;
|
|
||||||
|
|
||||||
const TicketDetailedScreen({super.key, this.url, this.jwtToken});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<TicketDetailedScreen> createState() => _TicketDetailedScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _TicketDetailedScreenState extends State<TicketDetailedScreen> {
|
|
||||||
DashboardProviderModel? dashboardProviderModel;
|
|
||||||
late DateTime accrualDateTime;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
dashboardProviderModel = Provider.of<DashboardProviderModel>(context, listen: false);
|
|
||||||
accrualDateTime = DateTime.now();
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void changeAccrualDate(bool showLoading) async {
|
|
||||||
try {
|
|
||||||
if (showLoading) Utils.showLoading(context);
|
|
||||||
await dashboardProviderModel?.fetchTicketAccuralBalance(context, accrualDateTime);
|
|
||||||
if (showLoading) Utils.hideLoading(context);
|
|
||||||
setState(() {});
|
|
||||||
} catch (ex) {
|
|
||||||
if (showLoading) Utils.hideLoading(context);
|
|
||||||
Utils.handleException(ex, context, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: Colors.white,
|
|
||||||
appBar: AppBarWidget(context, title: "Ticket Details"),
|
|
||||||
body: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
ListView(
|
|
||||||
padding: const EdgeInsets.all(21),
|
|
||||||
physics: const BouncingScrollPhysics(),
|
|
||||||
children: <Widget>[
|
|
||||||
if (dashboardProviderModel == null && dashboardProviderModel?.accrualTicketBalanceList == null) ...<Widget>[Utils.getNoDataWidget(context).paddingOnly(top: 50)] else ...<Widget>[
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
|
||||||
boxShadow: <BoxShadow>[BoxShadow(color: Colors.grey.withOpacity(0.2), spreadRadius: 2, blurRadius: 5, offset: const Offset(0, 3))],
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
"Current Ticket Balance".toText20().expanded,
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
const Icon(Icons.calendar_month_rounded, color: MyColors.darkIconColor, size: 16),
|
|
||||||
5.width,
|
|
||||||
DateUtil.formatDateToDate(accrualDateTime, AppState().isArabic(context)).toText13(isUnderLine: true),
|
|
||||||
8.width,
|
|
||||||
],
|
|
||||||
).onPress(() async {
|
|
||||||
DateTime selectedDate = await Utils.selectDate(context, accrualDateTime);
|
|
||||||
if (selectedDate != accrualDateTime) {
|
|
||||||
accrualDateTime = selectedDate;
|
|
||||||
changeAccrualDate(true);
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
8.height,
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children:
|
|
||||||
dashboardProviderModel!.accrualTicketBalanceList!.map<Widget>((GetTicketAccuralBalanceModel item) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: <Widget>[
|
|
||||||
item.accuralPlanCode.toString().replaceAll('_', ' ').toCamelCase.toText14(),
|
|
||||||
item.accrualNetEntitlement.toString().toText16(color: MyColors.textMixColor, isBold: true),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 21),
|
|
||||||
dashboardProviderModel == null && dashboardProviderModel!.ticketHistoryTransactionList == null
|
|
||||||
? const SizedBox()
|
|
||||||
: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
children: <Widget>[
|
|
||||||
"Tickets History".toText20().expanded,
|
|
||||||
12.height,
|
|
||||||
ListView.separated(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
itemBuilder: (BuildContext cxt, int cardIndex) {
|
|
||||||
var transactionDetails = dashboardProviderModel!.ticketHistoryTransactionList![cardIndex];
|
|
||||||
const allowedSegmentNames = <String>{
|
|
||||||
"TICKETS_ROUTE",
|
|
||||||
"TRAVELER_NAME",
|
|
||||||
"TICKETS_EFFECTIVE_DATE",
|
|
||||||
"TICKET_ARRIVAL",
|
|
||||||
"TICKET_AMOUNT",
|
|
||||||
"TICKET_COMP_SHARE",
|
|
||||||
"TICKET_EMP_SHARE",
|
|
||||||
};
|
|
||||||
var uniqueDetails =
|
|
||||||
transactionDetails
|
|
||||||
.where((item) => item.dISPLAYFLAG != 'N' && item.sEGMENTPROMPT != null && item.sEGMENTPROMPT!.isNotEmpty && allowedSegmentNames.contains(item.sEGMENTNAME))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
ListView.builder(
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: (uniqueDetails.length / 2).ceil(),
|
|
||||||
itemBuilder: (context, rowIndex) {
|
|
||||||
int firstIndex = rowIndex * 2;
|
|
||||||
int? secondIndex = (firstIndex + 1 < uniqueDetails.length) ? firstIndex + 1 : null;
|
|
||||||
bool isLastRow = (rowIndex == (uniqueDetails.length / 2).ceil() - 1);
|
|
||||||
var item1 = uniqueDetails[firstIndex];
|
|
||||||
var child1 = ItemDetailViewCol(item1.sEGMENTPROMPT!, item1.vARCHAR2VALUE ?? item1.nUMBERVALUE?.toString() ?? "");
|
|
||||||
Widget child2;
|
|
||||||
if (secondIndex != null) {
|
|
||||||
var item2 = uniqueDetails[secondIndex];
|
|
||||||
child2 = ItemDetailViewCol(item2.sEGMENTPROMPT!, item2.vARCHAR2VALUE ?? item2.nUMBERVALUE?.toString() ?? "");
|
|
||||||
} else {
|
|
||||||
child2 = const SizedBox(); // Empty widget if there is no second item
|
|
||||||
}
|
|
||||||
return ItemDetailGrid(child1, child2, isItLast: isLastRow);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).objectContainerView();
|
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext cxt, int index) => 12.height,
|
|
||||||
itemCount: dashboardProviderModel!.ticketHistoryTransactionList!.length,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
).expanded,
|
|
||||||
DefaultButton("Proceed For Booking", () {
|
|
||||||
if (widget.url != null && widget.jwtToken != null) {
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => SsoLoginWebView(url: widget.url, jwtToken: widget.jwtToken)));
|
|
||||||
}
|
|
||||||
}).insideContainer,
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue