You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
251 lines
12 KiB
Dart
251 lines
12 KiB
Dart
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
|
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/get_hhc_all_pres_orders_response_model.dart';
|
|
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HomeHealthCare/update_pres_oreder_request_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
|
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'Dialog/confirm_cancel_order_dialog.dart';
|
|
|
|
class OrdersLogDetailsPage extends StatelessWidget {
|
|
final CMCViewModel model;
|
|
|
|
const OrdersLogDetailsPage({Key key, this.model}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
void showConfirmMessage(
|
|
CMCViewModel model, GetHHCAllPresOrdersResponseModel order) {
|
|
showDialog(
|
|
context: context,
|
|
child: ConfirmCancelOrderDialog(
|
|
model: model,
|
|
onTap: () async {
|
|
UpdatePresOrderRequestModel updatePresOrderRequestModel =
|
|
UpdatePresOrderRequestModel(
|
|
presOrderID: order.iD,
|
|
rejectionReason: "",
|
|
presOrderStatus: 4, editedBy: 3);
|
|
await model.updateCmcPresOrder(updatePresOrderRequestModel);
|
|
if(model.state == ViewState.ErrorLocal) {
|
|
Utils.showErrorToast(model.error);
|
|
} else {
|
|
AppToast.showSuccessToast(message: "Done Successfully");
|
|
await model.getCmcAllPresOrders();
|
|
}
|
|
},
|
|
));
|
|
}
|
|
|
|
return AppScaffold(
|
|
isShowAppBar: false,
|
|
baseViewModel: model,
|
|
body: SingleChildScrollView(
|
|
physics: ScrollPhysics(),
|
|
child: Container(
|
|
margin: EdgeInsets.all(12),
|
|
child: Center(
|
|
child: FractionallySizedBox(
|
|
widthFactor: 0.94,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: 50,
|
|
),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: model.cmcAllPresOrders.map((order) {
|
|
return Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.only(top: 15),
|
|
decoration: BoxDecoration(
|
|
border:
|
|
Border.all(color: Colors.grey, width: 1),
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: Colors.white),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.only(
|
|
left: 15, bottom: 15, top: 15),
|
|
decoration: BoxDecoration(
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: Colors.grey,
|
|
width: 1.0,
|
|
),
|
|
),
|
|
// borderRadius: BorderRadius.circular(12),
|
|
color: Colors.white),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Texts(
|
|
"Request ID",
|
|
bold: false,
|
|
fontSize: 13,
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Texts(
|
|
order.iD.toString(),
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.only(
|
|
left: 15, bottom: 15, top: 15),
|
|
decoration: BoxDecoration(
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: Colors.grey,
|
|
width: 1.0,
|
|
),
|
|
),
|
|
// borderRadius: BorderRadius.circular(12),
|
|
color: Colors.white),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Texts(
|
|
"Status",
|
|
bold: false,
|
|
fontSize: 13,
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Texts(
|
|
order.description,
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.only(
|
|
left: 15, bottom: 15, top: 15),
|
|
decoration: BoxDecoration(
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: Colors.grey,
|
|
width: 1.0,
|
|
),
|
|
),
|
|
// borderRadius: BorderRadius.circular(12),
|
|
color: Colors.white),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Texts(
|
|
"Pickup Date",
|
|
bold: false,
|
|
fontSize: 13,
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Texts(
|
|
DateUtil.getDayMonthYearDateFormatted(
|
|
DateUtil.convertStringToDate(
|
|
order.createdOn)),
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.only(
|
|
left: 15, bottom: 15, top: 15),
|
|
decoration: BoxDecoration(
|
|
border: Border(
|
|
bottom: BorderSide(
|
|
color: Colors.grey,
|
|
width: 1.0,
|
|
),
|
|
),
|
|
// borderRadius: BorderRadius.circular(12),
|
|
color: Colors.white),
|
|
child: Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Texts(
|
|
"Location",
|
|
bold: false,
|
|
fontSize: 13,
|
|
),
|
|
SizedBox(
|
|
height: 4,
|
|
),
|
|
Texts(
|
|
order.nearestProjectDescription
|
|
.toString() ??
|
|
order.nearestProjectDescriptionN
|
|
.toString(),
|
|
fontSize: 22,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
if (order.status == 1 ||order.status == 2 )
|
|
Center(
|
|
child: Container(
|
|
width: MediaQuery
|
|
.of(context)
|
|
.size
|
|
.width *
|
|
0.85,
|
|
child: SecondaryButton(
|
|
label: "Cancel".toUpperCase(),
|
|
onTap: () {
|
|
showConfirmMessage(model, order);
|
|
}
|
|
,
|
|
color: Colors.red[800],
|
|
disabled: false,
|
|
textColor: Theme
|
|
.of(context)
|
|
.backgroundColor),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}).toList())
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|