Merge remote-tracking branch 'origin/main_design2.0' into main_design2.0

# Conflicts:
#	lib/new_views/pages/land_page/dashboard_fragments/progress_fragment.dart
main_design2.0
Sikander Saleem 2 years ago
commit 89bcb20314

@ -35,10 +35,10 @@ extension WidgetExtensions on Widget {
)
: this;
Widget get toShadowContainer => Container(
Widget toShadowContainer(BuildContext context) => Container(
padding: const EdgeInsets.all(16),
decoration: ShapeDecoration(
color: Colors.white,
color: Theme.of(context).cardColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),

@ -43,7 +43,7 @@ class _CalendarPageState extends State<CalendarPage> with SingleTickerProviderSt
"Sunday to Thursday".bodyText(context),
"09:00 to 18:00".bodyText(context).custom(color: AppColor.neutral50),
],
).toShadowContainer,
).toShadowContainer(context),
).paddingOnly(start: 16, end: 16),
16.height,
Container(

@ -82,7 +82,7 @@ class _MonthlyFragmentState extends State<MonthlyFragment> {
],
),
],
).toShadowContainer,
).toShadowContainer(context),
);
}
}

@ -94,7 +94,7 @@ class _WeeklyFragmentState extends State<WeeklyFragment> {
// availableGestures: AvailableGestures.none,
// ),
],
).toShadowContainer,
).toShadowContainer(context),
);
}

@ -4,7 +4,6 @@ import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/enums/translation_keys.dart';
import '../../app_style/app_color.dart';
@ -42,9 +41,9 @@ class ContactUsBottomSheet extends StatelessWidget {
16.height,
Row(
children: [
contactItem(context.isDark, "phone", context.translation.callUs, "+966 546345567").onPress(() { }).expanded,
contactItem(context, context.isDark, "phone", context.translation.callUs, "+966 546345567").onPress(() {}).expanded,
16.width,
contactItem(context.isDark, "whatsapp", context.translation.liveChat, context.translation.openWhatsapp).onPress(() {}).expanded,
contactItem(context, context.isDark, "whatsapp", context.translation.liveChat, context.translation.openWhatsapp).onPress(() {}).expanded,
],
),
32.height,
@ -53,7 +52,7 @@ class ContactUsBottomSheet extends StatelessWidget {
);
}
Widget contactItem(bool isDark, String iconName, String title, String subtitle) {
Widget contactItem(BuildContext context, bool isDark, String iconName, String title, String subtitle) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -72,6 +71,6 @@ class ContactUsBottomSheet extends StatelessWidget {
style: AppTextStyles.bodyText.copyWith(color: isDark ? AppColor.neutral10 : AppColor.neutral20),
),
],
).toShadowContainer;
).toShadowContainer(context);
}
}

@ -68,6 +68,6 @@ class RequestsFragment extends StatelessWidget {
],
).toShimmer(isShow: isLoading),
],
).toShadowContainer;
).toShadowContainer(context);
}
}

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/localization/localization.dart';
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
@ -12,11 +11,8 @@ import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/pages/device_transfer/update_device_transfer.dart';
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
import 'package:test_sa/views/widgets/buttons/app_small_button.dart';
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/requests/info_row.dart';
import '../../../extensions/text_extensions.dart';
import '../../../models/enums/user_types.dart';
@ -73,73 +69,87 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
child: Column(
children: [
_buildDetailsCard(
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
/// TBD
// StatusLabel(
// label: "",
// id: 0,
// textColor: AColors.getPriorityStatusTextColor(0),
// backgroundColor: AColors.getPriorityStatusColor(0)),
8.width,
/// TBD
//StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
],
),
1.width.expanded,
Text(widget.model.createdOn != null ?widget.model.createdOn.toServiceRequestCardFormat:"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
),
8.height,
Text(context.translation.transferDetails, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
8.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextWidget('${context.translation.assetName} : ${_model.assetName}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model.assetNumber}'),
_buildTextWidget('${context.translation.model} : ${_model.modelName}'),
_buildTextWidget('${context.translation.sn} : ${_model.assetSerialNo}'),
],
),
8.height,
],
).paddingAll(14)
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(context.translation.transferDetails, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
8.height,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextWidget('${context.translation.assetName} : ${_model.assetName}'),
_buildTextWidget('${context.translation.assetNumber} : ${_model.assetNumber}'),
_buildTextWidget('${context.translation.model} : ${_model.modelName}'),
_buildTextWidget('${context.translation.sn} : ${_model.assetSerialNo}'),
],
),
8.height,
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
/// TBD
// Row(
// children: [
// /// TBD
// // StatusLabel(
// // label: "",
// // id: 0,
// // textColor: AColors.getPriorityStatusTextColor(0),
// // backgroundColor: AColors.getPriorityStatusColor(0)),
// 8.width,
//
// /// TBD
// //StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
// ],
// ),
1.width,
Text(widget.model.createdOn != null ? widget.model.createdOn.toServiceRequestCardFormat : "",
textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
),
],
).paddingAll(14),
),
// sender card
_buildCard(
isSender: true,
site: _model.senderSiteName??"",
site: _model.senderSiteName ?? "",
/// TBD
unit: _model.senderDepartmentName??"",
comment: _model.senderComment??"",
unit: _model.senderDepartmentName ?? "",
comment: _model.senderComment ?? "",
/// TBD
statusLabel: _model.senderMachineStatusName != null? StatusLabel(
label: _model.senderMachineStatusName,
id: _model.senderMachineStatusId,
textColor: AColors.getRequestStatusTextColor(getIdstatus(_model.senderMachineStatusName)),
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.senderMachineStatusName))):null,
statusLabel: _model.senderMachineStatusName != null
? StatusLabel(
label: _model.senderMachineStatusName,
id: _model.senderMachineStatusId,
textColor: AColors.getRequestStatusTextColor(getIdstatus(_model.senderMachineStatusName)),
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.senderMachineStatusName)))
: null,
),
// receiver card
_buildCard(
isSender: false,
site: _model.destSiteName??"",
isSender: false,
site: _model.destSiteName ?? "",
/// TBD
unit: _model.destDepartmentName??"",
comment: _model.receiverComment??"",
unit: _model.destDepartmentName ?? "",
comment: _model.receiverComment ?? "",
/// TBD
statusLabel: _model.receiverMachineStatusName != null ? StatusLabel(
label: _model.receiverMachineStatusName??"",
id: _model.receiverMachineStatusId,
textColor: AColors.getRequestStatusTextColor(getIdstatus(_model.receiverMachineStatusName)),
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.receiverMachineStatusName))):null,
statusLabel: _model.receiverMachineStatusName != null
? StatusLabel(
label: _model.receiverMachineStatusName ?? "",
id: _model.receiverMachineStatusId,
textColor: AColors.getRequestStatusTextColor(getIdstatus(_model.receiverMachineStatusName)),
backgroundColor: AColors.getRequestStatusColor(getIdstatus(_model.receiverMachineStatusName)))
: null,
),
],
),
@ -152,7 +162,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
);
}
_buildDetailsCard(Widget widget){
_buildDetailsCard(Widget widget) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
@ -162,13 +172,14 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
).paddingOnly(top: 14, start: 14, end: 14);
}
_buildTextWidget(String text){
_buildTextWidget(String text) {
return Text(
text, style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
text,
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
);
}
_buildCard({@required String site, @required String unit, @required String comment, @required bool isSender, StatusLabel statusLabel}){
_buildCard({@required String site, @required String unit, @required String comment, @required bool isSender, StatusLabel statusLabel}) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
@ -183,13 +194,12 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
statusLabel??Container(),
statusLabel ?? Container(),
8.height,
Text(isSender?context.translation.senderDetails:context.translation.receiverDetails,
style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
Text(isSender ? context.translation.senderDetails : context.translation.receiverDetails, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
],
),
if (_userProvider.user?.type == UsersTypes.engineer)
if ((_userProvider.user?.type == UsersTypes.engineer) && (isSender ? _model.senderMachineStatusName != "Closed" : _model.receiverMachineStatusName != "Closed"))
CircleAvatar(
radius: 25,
backgroundColor: AppColor.neutral30,
@ -201,26 +211,13 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
child: SvgPicture.asset('assets/images/update.svg'),
),
),
).onPress(
isSender ? _model.senderMachineStatusName == "Closed"
? null
: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => UpdateDeviceTransfer(
model: _model,
isSender: isSender,
)));
}
: _model.receiverMachineStatusName == "Closed"
? null
: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => UpdateDeviceTransfer(
model: _model,
isSender: isSender,
)));
}),
).onPress(isSender
? () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
}
: () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateDeviceTransfer(model: _model, isSender: isSender)));
}),
],
),
Column(
@ -239,19 +236,18 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
).paddingAll(14),
).paddingOnly(top: 14, start: 14, end: 14);
}
int getIdstatus(String status){
switch(status){
int getIdstatus(String status) {
switch (status) {
case "Closed":
return 3 ;
return 3;
break;
case "Open":
return 1 ;
return 1;
break;
case "In Progress":
return 2;
break;
}
}
}
}

@ -1,9 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:test_sa/controllers/providers/api/gas_refill_provider.dart';
import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
@ -31,7 +29,6 @@ class GasRefillDetailsPage extends StatefulWidget {
class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
GasRefillModel _model = GasRefillModel(gazRefillDetails: []);
bool _enableEdit = false;
UserProvider _userProvider;
bool _isLoading = false;
@ -46,7 +43,6 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
@override
Widget build(BuildContext context) {
_userProvider = Provider.of<UserProvider>(context);
return Scaffold(
@ -61,9 +57,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
stateCode: 200,
onRefresh: () async {},
child: Column(
children: [
informationCard()
],
children: [informationCard()],
),
),
),
@ -99,60 +93,15 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
//textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
//backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)
//),
8.width,
// 8.width,
StatusLabel(
label: widget.model.status?.name??"",
textColor: AColors.getRequestStatusTextColor(widget.model.status?.value??0),
backgroundColor: AColors.getRequestStatusColor(widget.model.status?.value??0)),
label: widget.model.status?.name ?? "",
textColor: AColors.getRequestStatusTextColor(widget.model.status?.value ?? 0),
backgroundColor: AColors.getRequestStatusColor(widget.model.status?.value ?? 0)),
8.height,
Text(context.translation.gasRefillRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
],
),
1.width.expanded,
if (_userProvider.user.type == UsersTypes.engineer)
CircleAvatar(
radius: 25,
backgroundColor: AppColor.neutral30,
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.white,
child: Padding(
padding: const EdgeInsets.only(left: 3.0),
child: SvgPicture.asset('assets/images/update.svg'),
),
),
).onPress(
(widget.model.status?.value ?? 0) == 2
? null
:
() async {
_enableEdit = !_enableEdit;
_model?.fromGasRefillModel(widget.model);
// setState(() {});
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RequestGasRefill(
gasRefillModel: widget.model,
),
),
).then((value) {
if (value != null) {
_model = value;
}
});
setState(() {});
},),
],
),
8.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
8.height,
///TBD
Text(
context.translation.gasRequest,
@ -168,7 +117,44 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
),
],
),
Text(widget.model.startDate?.toServiceRequestCardFormat??"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
1.width.expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
if (_userProvider.user.type == UsersTypes.engineer && (widget.model.status?.value ?? 0) != 2)
CircleAvatar(
radius: 25,
backgroundColor: AppColor.neutral30,
child: CircleAvatar(
radius: 24,
backgroundColor: Colors.white,
child: Padding(
padding: const EdgeInsets.only(left: 3.0),
child: SvgPicture.asset('assets/images/update.svg'),
),
),
).onPress(
() async {
_model?.fromGasRefillModel(widget.model);
// setState(() {});
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RequestGasRefill(
gasRefillModel: widget.model,
),
),
).then((value) {
if (value != null) {
_model = value;
}
});
setState(() {});
},
),
Text(widget.model.startDate?.toServiceRequestCardFormat ?? "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
)
],
),
8.height,
@ -185,59 +171,59 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
8.height,
],
).paddingAll(16),
/// TBD
(_userProvider.user.type == UsersTypes.normal_user
? Container(
height: 50,
padding: const EdgeInsets.only(left: 16, right: 16),
alignment: Alignment.center,
width: double.infinity,
decoration: const ShapeDecoration(
color: Color(0xFFEAF1F4),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
),
),
),
child: Row(
children: [
Text(
'${context.translation.commentHere}...',
style: AppTextStyles.heading6.copyWith(
color: AppColor.neutral50.withOpacity(.6),
),
).expanded,
SvgPicture.asset("assets/images/comment_send.svg", width: 24 * AppStyle.getScaleFactor(context), height: 24 * AppStyle.getScaleFactor(context), color: AppColor.primary70),
],
),
)
: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
16.height,
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${context.translation.viewComments}',
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
),
4.width,
const Icon(
Icons.arrow_forward,
color: Color(0xFF4A8DB7),
size: 14,
)
],
),
],
).paddingOnly(bottom: 16, start: 16, end: 16))
.onPress(() {
}),
? Container(
height: 50,
padding: const EdgeInsets.only(left: 16, right: 16),
alignment: Alignment.center,
width: double.infinity,
decoration: const ShapeDecoration(
color: Color(0xFFEAF1F4),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20),
),
),
),
child: Row(
children: [
Text(
'${context.translation.commentHere}...',
style: AppTextStyles.heading6.copyWith(
color: AppColor.neutral50.withOpacity(.6),
),
).expanded,
SvgPicture.asset("assets/images/comment_send.svg", width: 24 * AppStyle.getScaleFactor(context), height: 24 * AppStyle.getScaleFactor(context), color: AppColor.primary70),
],
),
)
: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
16.height,
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${context.translation.viewComments}',
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
),
4.width,
const Icon(
Icons.arrow_forward,
color: Color(0xFF4A8DB7),
size: 14,
)
],
),
],
).paddingOnly(bottom: 16, start: 16, end: 16))
.onPress(() {}),
],
),
).paddingAll(16);

@ -178,87 +178,89 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
stateCode: 200,
onRefresh: () async {},
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SingleChildScrollView(
child: Column(
children: [
Container(
width: MediaQuery.of(context).size.width,
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
width: MediaQuery.of(context).size.width,
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
),
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(context.translation.gasRefill, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
8.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(context.translation.gasRefill, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
8.height,
/// TBD
Text(
'Gas Request:',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'Cylinder Size: ${widget.gasRefillModel.gazRefillDetails[0].cylinderSize.value}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'Request Quantity: ${widget.gasRefillModel.gazRefillDetails[0].requestedQty}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'Site: ${widget.gasRefillModel.site.name}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
],
).paddingAll(16),
),
12.height,
AppTimer(
label: context.translation.workingHours,
timer: _formModel.timer,
enabled: _formModel.endDate == null,
onChange: (timer) async {
_formModel.timer = timer;
return true;
},
),
12.height,
SingleItemDropDownMenu<Lookup, GasStatusProvider>(
context: context,
title: context.translation.reportStatus,
initialValue: widget.gasRefillModel.status,
onSelect: (value) {
_formModel.status = value;
},
),
12.height,
AppTextFormField(
labelText: context.translation.deliveredQuantity,
onSaved: (value) {
_currentDetails?.deliverdQty = double.tryParse(value);
},
textInputType: TextInputType.number,
controller: _deliveredQuantityController,
validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
),
12.height,
/// TBD
Text(
'Gas Request:',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'Cylinder Size: ${widget.gasRefillModel.gazRefillDetails[0].cylinderSize.value}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'Request Quantity: ${widget.gasRefillModel.gazRefillDetails[0].requestedQty}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'Site: ${widget.gasRefillModel.site.name}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
],
).paddingAll(16),
),
12.height,
AppTimer(
label: context.translation.workingHours,
timer: _formModel.timer,
enabled: _formModel.endDate == null,
onChange: (timer) async {
_formModel.timer = timer;
return true;
},
),
12.height,
SingleItemDropDownMenu<Lookup, GasStatusProvider>(
context: context,
title: context.translation.reportStatus,
initialValue: widget.gasRefillModel.status,
onSelect: (value) {
_formModel.status = value;
},
),
12.height,
AppTextFormField(
labelText: context.translation.deliveredQuantity,
onSaved: (value) {
_currentDetails?.deliverdQty = double.tryParse(value);
},
textInputType: TextInputType.number,
controller: _deliveredQuantityController,
validator: (value) => Validator.isNumeric(value) ? null : "allow numbers only",
),
12.height,
/// TBD
AppTextFormField(
labelText: context.translation.comments,
textInputType: TextInputType.multiline,
alignLabelWithHint: true,
controller: _commentController,
onSaved: (value) {},
),
],
).paddingAll(16))
.expanded,
/// TBD
AppTextFormField(
labelText: context.translation.comments,
textInputType: TextInputType.multiline,
alignLabelWithHint: true,
controller: _commentController,
onSaved: (value) {},
),
],
).paddingAll(16),
).expanded,
AppFilledButton(
label: widget.gasRefillModel == null ? context.translation.submit : context.translation.update,
onPressed: () async {

@ -15,7 +15,6 @@ import 'package:test_sa/new_views/pages/new_gas_refill_request_page.dart';
import 'package:test_sa/views/app_style/colors.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/pages/device_transfer/track_device_transfer.dart';
import 'package:test_sa/views/pages/sub_workorder/search_sub_workorder_page.dart';
import 'package:test_sa/views/pages/user/gas_refill/track_gas_refill.dart';
import 'package:test_sa/views/pages/user/requests/create_service_request_page.dart';
import 'package:test_sa/views/pages/user/visits/regular_visits_page.dart';
@ -212,14 +211,14 @@ class _LandPageState extends State<LandPage> {
Navigator.of(context).pushNamed(TrackDeviceTransferPage.id);
},
),
if (_userProvider?.user != null && _userProvider?.user?.type != UsersTypes.normal_user)
LandPageItem(
text: "Create Sub Work Order",
svgPath: "assets/images/sub_workorder_icon.svg",
onPressed: () {
Navigator.of(context).pushNamed(SearchSubWorkOrderPage.id);
},
),
// if (_userProvider?.user != null && _userProvider?.user?.type != UsersTypes.normal_user)
// LandPageItem(
// text: "Create Sub Work Order",
// svgPath: "assets/images/sub_workorder_icon.svg",
// onPressed: () {
// Navigator.of(context).pushNamed(SearchSubWorkOrderPage.id);
// },
// ),
],
),
],

@ -120,7 +120,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
children: [
SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Card(
child: Column(

@ -9,6 +9,7 @@ import 'package:test_sa/models/service_request/service_request.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/pages/user/requests/work_order/update_service_report.dart';
import '../../../../../controllers/providers/api/user_provider.dart';
import '../../../../../models/enums/user_types.dart';
@ -75,7 +76,7 @@ class WorkOrderDetailsPage extends StatelessWidget {
if (userProvider.user.type == UsersTypes.engineer && serviceRequest.statusValue != 5 && serviceRequest.statusValue != 3)
AppFilledButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => Container()));
Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdateServiceReport(workOrder: workOrder, request: serviceRequest)));
},
label: context.translation.updateRequest,
).paddingAll(16),

@ -7,7 +7,6 @@ import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/visits/visit.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/views/pages/user/visits/pantry/edit_pentry.dart';
import '../../../../controllers/providers/api/user_provider.dart';
import '../../../../models/enums/user_types.dart';
@ -77,10 +76,11 @@ class VisitDetailsPage extends StatelessWidget {
).paddingAll(16),
),
).expanded,
if (userProvider.user.type == UsersTypes.engineer && visit.status.value != 5 && visit.status.value != 3)
if (userProvider.user.type == UsersTypes.engineer && visit.status.id != 270)
AppFilledButton(
onPressed: () {
Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPentry(visit: visit, pentry: visit.pentry)));
print(visit.status.id);
// Navigator.of(context).push(MaterialPageRoute(builder: (_) => EditPentry(visit: visit, pentry: visit.pentry)));
},
label: context.translation.updateRequest,
).paddingAll(16),

@ -4,11 +4,8 @@ import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/device/asset_transfer.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import '../../../extensions/text_extensions.dart';
import '../../app_style/colors.dart';
import '../requests/request_status.dart';
class DeviceTransferItem extends StatelessWidget {
final int index;
@ -19,41 +16,12 @@ class DeviceTransferItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0,
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
),
),
onPressed: () {
onPressed(item);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// TBD
// StatusLabel(
// label: '',
// id: 0,
// textColor: AColors.getPriorityStatusTextColor(0),
// backgroundColor: AColors.getPriorityStatusColor(0)),
8.width,
/// TBD
//StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
1.width.expanded,
Text(item.createdOn != null ?item.createdOn.toServiceRequestCardFormat:"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
),
8.height,
Text(context.translation.deviceTransferRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
Text(
'${context.translation.from} : ${item.senderAssignedEmployeeName}',
@ -78,10 +46,27 @@ class DeviceTransferItem extends StatelessWidget {
size: 14,
)
],
),
).onPress(() => onPressed(item)),
],
).expanded,
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
/// TBD
// StatusLabel(
// label: '',
// id: 0,
// textColor: AColors.getPriorityStatusTextColor(0),
// backgroundColor: AColors.getPriorityStatusColor(0)),
// 8.width,
/// TBD
//StatusLabel(label: '', textColor: AColors.getRequestStatusTextColor(0), backgroundColor: AColors.getRequestStatusColor(0)),
1.width,
Text(item.createdOn != null ? item.createdOn.toServiceRequestCardFormat : "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
)
),
);
),
],
).toShadowContainer(context).paddingOnly(bottom: 8);
}
}

@ -3,7 +3,6 @@ import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/views/app_style/sizing.dart';
import '../../../extensions/text_extensions.dart';
import '../../../models/new_models/gas_refill_model.dart';
@ -19,137 +18,121 @@ class GasRefillItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
),
),
onPressed: () {
onPressed(item);
},
child: Column(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// TBD
// StatusLabel(
// label: ,
// id: ,
// textColor: AColors.getPriorityStatusTextColor(),
// backgroundColor: AColors.getPriorityStatusColor()),
8.width,
StatusLabel(label: item.status.name, textColor: AColors.getRequestStatusTextColor(item.status.value), backgroundColor: AColors.getRequestStatusColor(item.status.value)),
1.width.expanded,
Text(item.startDate != null ?item.startDate.toServiceRequestCardFormat:"", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
),
8.height,
Text(context.translation.gasRefillRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
Text(
'${context.translation.gasType}: ${item.gazRefillDetails[0].gasType.name}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
/// TBD
// StatusLabel(
// label: ,
// id: ,
// textColor: AColors.getPriorityStatusTextColor(),
// backgroundColor: AColors.getPriorityStatusColor()),
// 8.width,
StatusLabel(label: item.status.name, textColor: AColors.getRequestStatusTextColor(item.status.value), backgroundColor: AColors.getRequestStatusColor(item.status.value)),
1.width.expanded,
Text(item.startDate != null ? item.startDate.toServiceRequestCardFormat : "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
],
),
8.height,
Text(context.translation.gasRefillRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
Text(
'${context.translation.gasType}: ${item.gazRefillDetails[0].gasType.name}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
Text(
'${context.translation.site}: ${item.site.name}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
8.height,
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'${context.translation.site}: ${item.site.name}',
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
),
8.height,
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
context.translation.viewDetails,
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
),
4.width,
const Icon(
Icons.arrow_forward,
color: Color(0xFF4A8DB7),
size: 14,
)
],
context.translation.viewDetails,
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
),
// Row(
// children: [
// Expanded(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// item.title ?? "-----",
// style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
// ),
// Row(
// children: [
// Expanded(
// child: Text(
// subtitle.hospital,
// style: Theme.of(context).textTheme.titleSmall.copyWith(
// color: onItemColor,
// ),
// ),
// ),
// if (item.clientName != null)
// Text(
// item.clientName,
// style: Theme.of(context).textTheme.titleSmall.copyWith(
// color: onItemColor,
// ),
// ),
// ],
// ),
// Divider(color: onItemColor),
// Row(
// children: [
// Expanded(
// child: Text(subtitle.status, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// ),
// if (item.status?.id != null) StatusLabel(label: item.status.name, color: AColors.getGasStatusColor(item.status.id)),
// ],
// ),
// if (item?.expectedDate != null) Divider(color: onItemColor),
// if (item?.expectedDate != null)
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text("Expected Date", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// Text(item.expectedDate.toIso8601String().split("T").first, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// ],
// ),
// if (item?.details?.isNotEmpty ?? false) Divider(color: onItemColor),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// if (item?.details?.isNotEmpty ?? false) Text("Gas Type", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// Column(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: item.details
// .map(
// (gas) => gas?.type?.name?.isNotEmpty ?? false
// ? Text(gas?.type?.name, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor))
// : const SizedBox.shrink(),
// )
// .toList(),
// )
// ],
// ),
// ],
// ),
// ),
// ],
// ),
4.width,
const Icon(
Icons.arrow_forward,
color: Color(0xFF4A8DB7),
size: 14,
)
],
),
),
);
).onPress(() => onPressed(item)),
// Row(
// children: [
// Expanded(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// item.title ?? "-----",
// style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
// ),
// Row(
// children: [
// Expanded(
// child: Text(
// subtitle.hospital,
// style: Theme.of(context).textTheme.titleSmall.copyWith(
// color: onItemColor,
// ),
// ),
// ),
// if (item.clientName != null)
// Text(
// item.clientName,
// style: Theme.of(context).textTheme.titleSmall.copyWith(
// color: onItemColor,
// ),
// ),
// ],
// ),
// Divider(color: onItemColor),
// Row(
// children: [
// Expanded(
// child: Text(subtitle.status, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// ),
// if (item.status?.id != null) StatusLabel(label: item.status.name, color: AColors.getGasStatusColor(item.status.id)),
// ],
// ),
// if (item?.expectedDate != null) Divider(color: onItemColor),
// if (item?.expectedDate != null)
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text("Expected Date", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// Text(item.expectedDate.toIso8601String().split("T").first, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// ],
// ),
// if (item?.details?.isNotEmpty ?? false) Divider(color: onItemColor),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// if (item?.details?.isNotEmpty ?? false) Text("Gas Type", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
// Column(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: item.details
// .map(
// (gas) => gas?.type?.name?.isNotEmpty ?? false
// ? Text(gas?.type?.name, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor))
// : const SizedBox.shrink(),
// )
// .toList(),
// )
// ],
// ),
// ],
// ),
// ),
// ],
// ),
],
).toShadowContainer(context).paddingOnly(bottom: 8);
}
}

Loading…
Cancel
Save