Merge branch 'refs/heads/design_3.0_TM_Module_snagsFix' into design_3.0_task_module_new_merge

# Conflicts:
#	lib/modules/cm_module/views/components/action_button/footer_action_button.dart
#	lib/modules/cm_module/views/components/service_request_detail_view.dart
#	lib/modules/cm_module/views/forms/work_order/components/attachments_view.dart
#	lib/modules/tm_module/tasks_wo/update_task_request_view.dart
#	lib/views/pages/user/gas_refill/update_gas_refill_request.dart
#	lib/views/widgets/images/multi_image_picker.dart
design_3.0_demo_module
Sikander Saleem 7 months ago
commit 47673e3473

@ -1,7 +1,7 @@
class URLs {
URLs._();
static const String appReleaseBuildNumber = "21";
static const String appReleaseBuildNumber = "22";
// static const host1 = "https://atomsm.hmg.com"; // production url
// static const host1 = "https://atomsmdev.hmg.com"; // local DEV url

@ -8,6 +8,7 @@ import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/plan_preventive_visit/plan_preventive_visit_model.dart';
import 'package:test_sa/models/ppm/ppm.dart';
import 'package:test_sa/models/ppm/ppm_search.dart';
@ -38,11 +39,11 @@ class PpmProvider extends ChangeNotifier {
notifyListeners();
}
List<File> _ppmPlanAttachments = [];
List<GenericAttachmentModel> _ppmPlanAttachments = [];
List<File> get ppmPlanAttachments => _ppmPlanAttachments;
List<GenericAttachmentModel> get ppmPlanAttachments => _ppmPlanAttachments;
set ppmPlanAttachments(List<File> value) {
set ppmPlanAttachments(List<GenericAttachmentModel> value) {
_ppmPlanAttachments = value;
notifyListeners();
}

@ -147,7 +147,7 @@ class _DashboardViewState extends State<DashboardView> {
height: 100.toScreenHeight,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.white10,
color: AppColor.background(context),
border: Border.all(color: AppColor.primary10.withOpacity(0.5), width: 2),
),
child: Consumer<UserProvider>(builder: (context, userProvider, child) {
@ -159,7 +159,7 @@ class _DashboardViewState extends State<DashboardView> {
8.height,
Text(
("${context.translation.checkIn}\n${userProvider.swipeTransactionModel.swipeTime != null ? SwipeGeneralUtils.instance.formatTimeOnly(userProvider.swipeTransactionModel.swipeTime!) : '--:--'}"),
style: AppTextStyles.bodyText2.copyWith(color: AppColor.white936, fontWeight: FontWeight.w500, fontFamily: "Poppins"),
style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w500, fontFamily: "Poppins"),
),
],
);

@ -248,7 +248,7 @@ class ProgressFragment extends StatelessWidget {
showChartValuesOutside: false,
decimalPlaces: 1,
),
).toShimmer(isShow: snapshot.isAllCountLoading, radius: 250).paddingAll(0).toShadowContainer(context),
).toShimmer(isShow: snapshot.isAllCountLoading, radius: 250,context: context).paddingAll(0).toShadowContainer(context),
],
),
),

@ -60,7 +60,7 @@ class RequestsFragment extends StatelessWidget {
CustomBadge(
value: isLoading ? 0 : value,
child: Container(
child: (icon ?? "").toSvgAsset(height: 26, width: 26, color: iconColor).toShimmer(isShow: isLoading),
child: (icon ?? "").toSvgAsset(height: 26, width: 26, color: iconColor).toShimmer(isShow: isLoading,context: context),
).toShadowCircleContainer(context, padding: 17),
),
10.height,
@ -70,7 +70,7 @@ class RequestsFragment extends StatelessWidget {
style: AppTextStyles.tinyFont.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.black20,
),
).toShimmer(isShow: isLoading),
).toShimmer(isShow: isLoading,context: context),
],
),
);

@ -79,14 +79,15 @@ extension WidgetExtensions on Widget {
: this;
}
Widget toShimmer({bool isShow = true, double radius = 20}) => isShow
Widget toShimmer({bool isShow = true, double radius = 20,required BuildContext context}) => isShow
? Shimmer.fromColors(
baseColor: const Color(0xffe8eff0),
highlightColor: Colors.white,
// baseColor: const Color(0xffe8eff0),
baseColor: Theme.of(context).scaffoldBackgroundColor,
highlightColor: AppColor.background(context),
child: ClipRRect(
borderRadius: BorderRadius.circular(radius),
child: Container(
color: Colors.white,
color: AppColor.background(context),
child: this,
),
),
@ -97,20 +98,21 @@ extension WidgetExtensions on Widget {
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(width: 250, height: 24).toShimmer(isShow: isShow),
const SizedBox(width: 250, height: 24).toShimmer(isShow: isShow,context: context),
8.height,
const SizedBox(width: 160, height: 16).toShimmer(isShow: isShow),
const SizedBox(width: 160, height: 16).toShimmer(isShow: isShow,context: context),
8.height,
const SizedBox(width: 120, height: 18).toShimmer(isShow: isShow).toShimmer(isShow: isShow),
const SizedBox(width: 120, height: 18).toShimmer(isShow: isShow,context: context).toShimmer(isShow: isShow,context: context),
],
).toShadowContainer(context)
: this;
Widget toShadowContainer(BuildContext context,
{bool showShadow = true, double borderRadius = 14, bool withShadow = true, Color? backgroundColor, Color borderColor = Colors.transparent, double padding = 16, EdgeInsets? paddingObject}) =>
{bool showShadow = true, double borderRadius = 14, bool withShadow = true, Color? backgroundColor, Color borderColor = Colors.transparent, double padding = 16, EdgeInsets? paddingObject, EdgeInsets? margin,}) =>
withShadow
? Container(
padding: paddingObject ?? EdgeInsets.all(padding),
margin: margin,
width: double.infinity,
decoration: ShapeDecoration(
color: backgroundColor ?? AppColor.background(context),
@ -125,7 +127,8 @@ extension WidgetExtensions on Widget {
clipBehavior: Clip.antiAlias,
margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
decoration: BoxDecoration(
color: AppColor.background(context),
// color: AppColor.background(context),
color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)),
),
padding: padding ?? EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),

@ -0,0 +1,26 @@
import 'dart:io';
class GenericAttachmentModel {
GenericAttachmentModel({this.id, this.name,this.originalName,this.createdBy});
int? id;
String? name;
String ?createdBy;
String? originalName;
GenericAttachmentModel.fromJson(Map<String, dynamic> json) {
print('created by here is ${json['createdBy']}');
id = json['id'];
name = json['name'];
createdBy = json['createdBy'];
originalName = json['originalName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['name'] = name;
data['createdBy'] = createdBy;
data['originalName'] = originalName;
return data;
}
}

@ -53,7 +53,7 @@ class WorkOrderHelperModel {
}
class WorkOrderAttachments {
WorkOrderAttachments({this.id, this.name});
WorkOrderAttachments({this.id, this.name,this.createdBy});
int? id;
String? name;
@ -170,10 +170,12 @@ class WorkOrderCostModel {
num? qAmount;
String? prNo;
String? poNo;
String? mrNo;
num? exchangeCost;
WorkOrderCostModel({this.workOrderId, this.sparePartCost, this.labourCost, this.travelCost, this.qAmount, this.poNo, this.prNo});
WorkOrderCostModel({this.workOrderId, this.sparePartCost, this.labourCost, this.travelCost, this.qAmount, this.poNo, this.prNo,this.mrNo,this.exchangeCost});
Map<String, dynamic> toJson() {
return {'workOrderId': workOrderId, 'sparePartCost': sparePartCost, 'laborCost': labourCost, 'travelCost': travelCost, 'qAmount': qAmount, 'prNo': prNo, 'poNo': poNo};
return {'workOrderId': workOrderId, 'sparePartCost': sparePartCost, 'laborCost': labourCost, 'travelCost': travelCost, 'qAmount': qAmount, 'prNo': prNo, 'poNo': poNo,'mrNo':mrNo,'exchangeCost':exchangeCost};
}
}

@ -106,6 +106,8 @@ class WorkOrderData {
this.qAmount,
this.prNo,
this.poNo,
this.mrNo,
this.exchangeCost,
required this.workOrderHistory,
required this.activities,
required this.activityAssetToBeRetireds,
@ -171,6 +173,8 @@ class WorkOrderData {
num? qAmount;
String? prNo;
String? poNo;
String? mrNo;
num? exchangeCost;
List<WorkOrderHistory> workOrderHistory;
List<Activities> activities;
List<dynamic> activityAssetToBeRetireds;
@ -207,6 +211,8 @@ class WorkOrderData {
qAmount: json['qAmount'],
prNo: json['prNo'],
poNo: json['poNo'],
mrNo: json['mrNo'],
exchangeCost: json['exchangeCost'],
assetType: json["assetType"] == null ? null : Lookup.fromJson(json["assetType"]),
assignedEmployee: json["assignedEmployee"] == null ? null : WorkOrderAssignedEmployee.fromJson(json["assignedEmployee"]),
lastActivityStatus: json["lastActivityStatus"] != null ? Lookup.fromJson(json["lastActivityStatus"]) : null,
@ -278,6 +284,8 @@ class WorkOrderData {
"comments": comments,
"voiceNote": voiceNote,
"edd": edd,
'mrNo': mrNo,
'exchangeCost': exchangeCost,
"workOrderAttachments": workOrderAttachments.map((e) => e.toJson()).toList(),
"returnToService": returnToService,
"serviceType": serviceType?.toJson(),
@ -828,20 +836,19 @@ class ActivityMaintenanceAssistantEmployees {
double? workingHours;
String? technicalComment;
AssignedEmployee? user;
AssistantEmployees ?employee;
AssistantEmployees? employee;
ActivityMaintenanceAssistantEmployees({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user,this.employee});
ActivityMaintenanceAssistantEmployees({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user, this.employee});
ActivityMaintenanceAssistantEmployees.fromJson(Map<String, dynamic> json) {
Map<String,dynamic> assistEmpData={};
Map<String, dynamic> assistEmpData = {};
startDate = json['startDate'] != null ? DateTime.parse(json['startDate']) : null;
endDate = json['endDate'] != null ? DateTime.parse(json['endDate']) : null;
workingHours = json['workingHours'];
technicalComment = json['technicalComment'];
user = json['user'] != null ? AssignedEmployee.fromJson(json['user']) : null;
if(json['user']!=null) {
if (json['user'] != null) {
assistEmpData = {
'id': null,
'user': {
@ -866,7 +873,6 @@ class ActivityMaintenanceAssistantEmployees {
}
}
// class ActivityMaintenanceAssistantEmployees {
// DateTime? startDate;
// DateTime? endDate;
@ -923,27 +929,25 @@ class ActivityMaintenanceTimers {
}
}
class AssistantEmployeesModel {
DateTime? startDate;
DateTime? endDate;
double? workingHours;
String? technicalComment;
AssignedEmployee? user;
AssistantEmployees ?employee;
AssistantEmployees? employee;
AssistantEmployeesModel({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user,this.employee});
AssistantEmployeesModel({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user, this.employee});
AssistantEmployeesModel.fromJson(Map<String, dynamic> json) {
Map<String,dynamic> assistEmpData={};
Map<String, dynamic> assistEmpData = {};
startDate = json['startDate'] != null ? DateTime.parse(json['startDate']) : null;
endDate = json['endDate'] != null ? DateTime.parse(json['endDate']) : null;
workingHours = json['workingHours'];
technicalComment = json['technicalComment'];
user = json['user'] != null ? AssignedEmployee.fromJson(json['user']) : null;
if(json['user']!=null) {
if (json['user'] != null) {
assistEmpData = {
'id': null,
'user': {

@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:http/src/response.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/helper_data_models/asset_retired/asset_retired_model.dart';
import 'package:test_sa/models/helper_data_models/maintenance_request/activity_maintenance_model.dart';
import 'package:test_sa/models/helper_data_models/spare_part/activity_spare_part_model.dart';
@ -257,15 +258,15 @@ class ServiceRequestDetailProvider extends ChangeNotifier {
}
//upload workorder attachment by engineer..
Future addWorkOrderAttachment({required int woId, required List<File> attachments, required List<WorkOrderAttachments> otherAttachment}) async {
Future addWorkOrderAttachment({required int woId, required List<GenericAttachmentModel> attachments, required List<WorkOrderAttachments> otherAttachment}) async {
try {
List<WorkOrderAttachments> woAttachments = [];
if (otherAttachment.isNotEmpty) {
woAttachments.addAll(otherAttachment);
}
for (var file in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(file.path) ? ("${file.path.split("/").last}|${base64Encode(File(file.path).readAsBytesSync())}") : file.path;
woAttachments.add(WorkOrderAttachments(id: 0, name: fileName));
String fileName = ServiceRequestUtils.isLocalUrl(file.name ?? '') ? ("${file.name ?? ''.split("/").last}|${base64Encode(File(file.name ?? '').readAsBytesSync())}") : file.name ?? '';
woAttachments.add(WorkOrderAttachments(id: file.id, name: fileName, createdBy: file.createdBy));
}
isLoading = true;

@ -23,11 +23,11 @@ import 'package:test_sa/new_views/swipe_module/dialoge/acknowledge_work_dialog.d
import 'package:test_sa/providers/service_request_providers/reject_reason_provider.dart';
class FooterActionButton {
static Widget footerContainer({required Widget child}) {
static Widget footerContainer({required Widget child,required BuildContext context}) {
return Container(
alignment: Alignment.bottomCenter,
padding: const EdgeInsets.only(left: 16, right: 16, top: 12,bottom: 8),
color: AppColor.white10,
color: AppColor.background(context),
child: SafeArea(child: child),
);
}
@ -49,6 +49,7 @@ class FooterActionButton {
switch (workOrderNextStepStatus) {
case WorkOrderNextStepEnum.assignToMe:
return footerContainer(
context: context,
child: AppFilledButton(
label: 'Assign To Me',
// maxWidth: true,
@ -64,9 +65,11 @@ class FooterActionButton {
case WorkOrderNextStepEnum.endWorkFlow:
if (requestDetailProvider.isReadOnlyRequest) {
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.activities,
buttonColor: AppColor.neutral50,
textColor: context.isDark ? AppColor.neutral30 : Colors.white,
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => const ActivitiesListView()));
},
@ -74,6 +77,7 @@ class FooterActionButton {
);
}
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.close,
// maxWidth: true,
@ -85,9 +89,11 @@ class FooterActionButton {
case WorkOrderNextStepEnum.nTakeAction:
if (requestDetailProvider.isReadOnlyRequest) {
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.activities,
buttonColor: AppColor.neutral50,
buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50,
textColor: context.isDark ? AppColor.black10 : Colors.white,
onPressed: () async {
Navigator.push(context, MaterialPageRoute(builder: (context) => const ActivitiesListView()));
},
@ -95,6 +101,7 @@ class FooterActionButton {
);
}
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.close,
// maxWidth: true,
@ -105,6 +112,7 @@ class FooterActionButton {
));
case WorkOrderNextStepEnum.eRejectAccept:
return footerContainer(
context: context,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
@ -112,7 +120,8 @@ class FooterActionButton {
AppFilledButton(
label: context.translation.reject,
maxWidth: true,
buttonColor: Colors.white54,
buttonColor:AppColor.background(context),
// textColor: context.isDark ? AppColor.neutral30 : Colors.white,
textColor: AppColor.red30,
showBorder: true,
onPressed: () async {
@ -140,6 +149,7 @@ class FooterActionButton {
));
case WorkOrderNextStepEnum.eFixRemotelyNeedVisit:
return footerContainer(
context: context,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
@ -169,6 +179,7 @@ class FooterActionButton {
));
case WorkOrderNextStepEnum.eArrived:
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.iHaveArrived,
showIcon: true,
@ -180,6 +191,7 @@ class FooterActionButton {
));
case WorkOrderNextStepEnum.verifyAssetDetail:
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.updateAssetDetails,
// maxWidth: true,
@ -190,12 +202,13 @@ class FooterActionButton {
));
case WorkOrderNextStepEnum.activity:
return footerContainer(
context: context,
child: Column(
children: [
AppFilledButton(
label: context.translation.activities,
// maxWidth: true,
buttonColor: AppColor.neutral50,
textColor: context.isDark ? AppColor.black10 : Colors.white,
buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50,
onPressed: () async {
// ServiceRequestBottomSheet.activityTypeBottomSheet(context: context);
Navigator.push(context, MaterialPageRoute(builder: (context) => const ActivitiesListView()));
@ -237,22 +250,26 @@ class FooterActionButton {
case WorkOrderNextStepEnum.assetRetirementManagementApproval:
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.assetRetiredPendingOpManagementApproval,
buttonColor: AppColor.neutral140,
textColor: AppColor.neutral150,
buttonColor: AppColor.background(context),
textColor: context.isDark ? Colors.white: AppColor.neutral150,
fontSize: 12.toScreenWidth,
));
case WorkOrderNextStepEnum.waitingForRequesterToConfirm:
return footerContainer(
context: context,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppFilledButton(
label: 'Waiting for requester to verify',
buttonColor: AppColor.neutral140,
textColor: AppColor.neutral150,
buttonColor: AppColor.background(context),
textColor: context.isDark ? Colors.white: AppColor.neutral150,
// buttonColor: AppColor.neutral140,
// textColor: AppColor.neutral150,
fontSize: 12.toScreenWidth,
),
12.height,
@ -288,6 +305,7 @@ class FooterActionButton {
));
case WorkOrderNextStepEnum.eFixRemotely:
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.fixedRemotely,
maxWidth: true,
@ -300,9 +318,11 @@ class FooterActionButton {
);
case WorkOrderNextStepEnum.eNeedVisit:
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.needAVisit,
maxWidth: true,
textColor: context.isDark ? AppColor.neutral30 : Colors.white,
buttonColor: AppColor.neutral50,
onPressed: () async {
requestDetailProvider.needVisitHelperModel = NeedVisitHelperModel();
@ -313,6 +333,7 @@ class FooterActionButton {
} else {
if (workOrderNextStepStatus == WorkOrderNextStepEnum.nTakeAction) {
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.takeAction,
// maxWidth: true,
@ -324,6 +345,7 @@ class FooterActionButton {
}
if (workOrderNextStepStatus == WorkOrderNextStepEnum.waitingForRequesterToConfirm) {
return footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.takeAction,
// maxWidth: true,

@ -94,6 +94,7 @@ class _ActivitiesListViewState extends State<ActivitiesListView> {
if (userProvider.user!.type == UsersTypes.engineer &&
(requestDetailProvider.currentWorkOrder?.data?.status?.value != 5 && requestDetailProvider.currentWorkOrder?.data?.status?.value != 3))
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.createNewActivity,
maxWidth: true,

@ -17,14 +17,7 @@ class AssetDetailCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, snapshot) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: AppColor.white10,
),
padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 14.toScreenHeight),
margin: EdgeInsets.only(top: 10.toScreenHeight),
child: Column(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
@ -37,7 +30,7 @@ class AssetDetailCard extends StatelessWidget {
textColor: AppColor.white10,
backgroundColor: AppColor.getEquipmentStatusColor(context, requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.id ?? 0),
),
if(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId!=null)...[
if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId != null) ...[
6.width,
StatusLabel(
label: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId?.name,
@ -59,7 +52,7 @@ class AssetDetailCard extends StatelessWidget {
),
//hide if status is closed or complete .
if (!requestDetailProvider.isReadOnlyRequest)
"edit_icon".toSvgAsset(height: 21, width: 21).onPress(() async {
"edit_icon".toSvgAsset(height: 21, width: 21, color: context.isDark ? AppColor.primary10 : null).onPress(() async {
requestDetailProvider.refreshTimer = false;
await Navigator.push(context, MaterialPageRoute(builder: (context) => VerifyAssetDetails(isEdit: true)));
requestDetailProvider.refreshTimer = true;
@ -105,7 +98,8 @@ class AssetDetailCard extends StatelessWidget {
),
]
],
),
).toShadowContainer(
context,
);
});
}

@ -385,7 +385,7 @@ class ServiceRequestBottomSheet {
],
);
},
).toShimmer(isShow: snapshot.loading);
).toShimmer(isShow: snapshot.loading,context: context);
});
}
@ -644,7 +644,8 @@ class ServiceRequestBottomSheet {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14), // Circular border radius
),
color: AppColor.neutral80,
// color: AppColor.neutral80,
color: AppColor.background(context),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start, // Align items at the top
children: [
@ -657,7 +658,7 @@ class ServiceRequestBottomSheet {
children: [
Text(
heading,
style: AppTextStyles.heading6.copyWith(color: AppColor.neutral50),
style: AppTextStyles.heading6.copyWith(color: AppColor.textColor(context)),
),
7.height,
Text(

@ -136,8 +136,8 @@ class HistoryLogView extends StatelessWidget {
);
}),
],
title.bodyText(context).custom(color: AppColor.black10),
object.timeDifference.isNotEmpty ? object.timeDifference.tinyFont(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120) : const SizedBox(),
title.bodyText(context).custom(color: AppColor.textColor(context)),
object.timeDifference.isNotEmpty ? object.timeDifference.tinyFont(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120) : const SizedBox(),
],
),

@ -27,14 +27,7 @@ class _InitialVisitCardState extends State<InitialVisitCard> {
@override
Widget build(BuildContext context) {
return Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, snapshot) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(14),
color: AppColor.white10,
),
padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 14.toScreenHeight),
margin: EdgeInsets.only(top: 10.toScreenHeight),
child: Column(
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
@ -63,8 +56,7 @@ class _InitialVisitCardState extends State<InitialVisitCard> {
requestDetailProvider.needVisitHelperModel!.comment!.bodyText2(context).custom(color: AppColor.neutral120),
]
],
),
);
).toShadowContainer(context,margin:const EdgeInsets.only(top: 12));
});
}
}

@ -12,6 +12,7 @@ import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/enums/user_types.dart';
import 'package:test_sa/models/enums/work_order_next_step.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_models.dart';
import 'package:test_sa/models/new_models/work_order_detail_model.dart';
import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart';
@ -37,7 +38,7 @@ class ServiceRequestDetailView extends StatefulWidget {
}
class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
List<File> _userAttachments = [];
List<GenericAttachmentModel> _userAttachments = [];
List<WorkOrderAttachments> _attachments = [];
@override
@ -47,10 +48,20 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
@override
Widget build(BuildContext context) {
//GenericAttachmentModel(
// id: e.id,
// name: e.name,
// createdBy: e.createdBy,
// // originalName: ,
// localFile: File(e.name ?? ''),
//
// )
UserProvider _userProvider = Provider.of<UserProvider>(context, listen: false);
return Consumer<ServiceRequestDetailProvider>(builder: (pContext, requestProvider, _) {
if (_userProvider.user?.type == UsersTypes.engineer) {
_userAttachments = requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => File(e.name ?? '')).toList() ?? [];
// _userAttachments = requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => File(e.name ?? '')).toList() ?? [];
_userAttachments =
requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy == _userProvider.user?.userID).map((e) => GenericAttachmentModel.fromJson(e.toJson())).toList() ?? [];
_attachments = requestProvider.currentWorkOrder?.data?.workOrderAttachments.where((e) => e.createdBy != _userProvider.user?.userID).toList() ?? [];
} else {
//show only nurse attachments
@ -73,6 +84,7 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
children: [
workOrderDetailCard(context, requestProvider.currentWorkOrder!.data!, _userProvider, requestProvider),
initialVisitCard(requestDetailProvider: requestProvider, userProvider: _userProvider),
12.height,
assetDetailCard(requestDetailProvider: requestProvider, userProvider: _userProvider),
12.height,
if (context.userProvider.user!.type == UsersTypes.engineer &&
@ -336,20 +348,20 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
"Attachments".addTranslation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
),
FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!)!).toList()),
FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!) ?? '').toList()),
],
if (!requestProvider.isReadOnlyRequest && workOrder.nextStep?.workOrderNextStepEnum == WorkOrderNextStepEnum.activity) ...[
8.height,
const Divider().defaultStyle(context),
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachments,
files: _userAttachments,
attachment: _userAttachments,
buttonColor: AppColor.primary10,
onlyImages: false,
// showAsGrid: true,
buttonIcon: 'quotation_icon'.toSvgAsset(color: AppColor.primary10),
onChange: () {
requestProvider.addWorkOrderAttachment(woId: workOrder.requestId!, attachments: _userAttachments, otherAttachment: _attachments);
onChange: (attachment) {
requestProvider.addWorkOrderAttachment(woId: workOrder.requestId!, attachments: attachment, otherAttachment: _attachments);
},
),
],
@ -496,7 +508,9 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
).expanded,
if (!provider.isReadOnlyRequest)
"edit_icon".toSvgAsset(height: 21, width: 21).onPress(() async {
"edit_icon".toSvgAsset(height: 21, width: 21,
color: context.isDark?AppColor.primary10:null
).onPress(() async {
provider.refreshTimer = false;
await Navigator.push(context, MaterialPageRoute(builder: (context) => CostDetailFormScreen(isEdit: true)));
provider.refreshTimer = true;
@ -531,6 +545,14 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
'PO No: ${provider.currentWorkOrder!.data?.poNo ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'MR No: ${provider.currentWorkOrder!.data?.mrNo ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
Text(
'Exchange Cost: ${provider.currentWorkOrder!.data?.exchangeCost ?? '-'}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120),
),
],
),
],

@ -80,7 +80,7 @@ class _VerifyArrivalViewState extends State<VerifyArrivalView> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(14), // Circular border radius
),
color: Colors.white,
color: AppColor.background(context),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center, // Align items at the top
children: [
@ -93,7 +93,7 @@ class _VerifyArrivalViewState extends State<VerifyArrivalView> {
children: [
Text(
heading,
style: AppTextStyles.heading6.copyWith(color: AppColor.neutral50),
style: AppTextStyles.heading6.copyWith(color: AppColor.textColor(context)),
),
6.height,
Text(

@ -7,9 +7,11 @@ 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/generic_attachment_model.dart';
import 'package:test_sa/models/helper_data_models/asset_retired/asset_retired_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
@ -52,7 +54,7 @@ class _AssetRetiredState extends State<AssetRetired> with TickerProviderStateMix
@override
Widget build(BuildContext context) {
final List<File> _files = [];
final List<GenericAttachmentModel> attachments = [];
return Scaffold(
key: _scaffoldKey,
@ -75,7 +77,7 @@ class _AssetRetiredState extends State<AssetRetired> with TickerProviderStateMix
SingleItemDropDownMenu<Lookup, RetirementTypeProvider>(
context: context,
title: context.translation.retirementType,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
height: 56.toScreenHeight,
showShadow: false,
@ -103,9 +105,9 @@ class _AssetRetiredState extends State<AssetRetired> with TickerProviderStateMix
},
),
23.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachFiles,
files: _files,
attachment: attachments,
buttonIcon: 'image-plus'.toSvgAsset(),
),
],
@ -113,15 +115,17 @@ class _AssetRetiredState extends State<AssetRetired> with TickerProviderStateMix
).paddingAll(16),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
label: context.translation.submit,
buttonColor: AppColor.primary10,
loading: requestDetailProvider.isLoading,
onPressed: () async {
requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments = [];
for (var file in _files) {
for (var attachment in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(attachment.name??'') ? ("${attachment.name??''.split("/").last}|${base64Encode(File(attachment.name??'').readAsBytesSync())}") :attachment.name??'';
requestDetailProvider.assetRetiredHelperModel?.activityAssetToBeRetiredAttachments
?.add(ActivityAssetToBeRetiredAttachments(id: 0, name: "${file.path.split("/").last}|${base64Encode(file.readAsBytesSync())}"));
?.add(ActivityAssetToBeRetiredAttachments(id: attachment.id, name: fileName));
}
int status = await requestDetailProvider.createActivityAssetToBeRetired();
if (status == 200) {

@ -61,11 +61,14 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
});
}
EngineerUpdateWorkOrderHelperModel? updateAssetModel;
late WorkOrderData currentWorkOrderData;
void assignValues() {
// ServiceRequestDetailProvider requestDetailProvider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
// _requestDetailProvider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
WorkOrderData currentWorkOrderData = _requestDetailProvider!.currentWorkOrder!.data!;
_requestDetailProvider!.engineerUpdateWorkOrderHelperModel = EngineerUpdateWorkOrderHelperModel(
currentWorkOrderData = _requestDetailProvider!.currentWorkOrder!.data!;
updateAssetModel = EngineerUpdateWorkOrderHelperModel(
workOrderId: currentWorkOrderData.requestId,
equipmentStatus: currentWorkOrderData.equipmentStatus,
loanAvailability: currentWorkOrderData.loanAvailablity,
@ -91,7 +94,7 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
);
setState(() {});
}
getFaultDescription(assetId: _requestDetailProvider!.currentWorkOrder?.data?.asset?.id);
getFaultDescription(assetId: currentWorkOrderData.asset?.id);
}
@override
@ -126,15 +129,15 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
assetStatusWidget(context: context, workOrderData: requestDetailProvider.engineerUpdateWorkOrderHelperModel!),
assetStatusWidget(context: context, workOrderData: updateAssetModel!),
12.height,
ADatePicker(
label: context.translation.returnToService,
hideShadow: true,
backgroundColor: AppColor.neutral100,
// initialDate: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService ?? ""),
backgroundColor: AppColor.fieldBgColor(context),
// initialDate: DateTime.tryParse(updateAssetModel?.returnToService ?? ""),
from: requestDetailProvider.currentWorkOrder?.data?.requestedDate,
date: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService ?? ""),
date: DateTime.tryParse(updateAssetModel?.returnToService ?? ""),
formatDateWithTime: true,
onDatePicker: (selectedDate) {
showTimePicker(
@ -150,30 +153,29 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
selectedTime.hour,
selectedTime.minute,
);
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService != null &&
// selectedDateTime.isBefore(DateTime.parse(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.returnToService!))) {
// if (updateAssetModel?.returnToService != null &&
// selectedDateTime.isBefore(DateTime.parse(updateAssetModel!.returnToService!))) {
// "Return To Service Date time must be greater then previous date".showToast;
// return;
// }
setState(() {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.returnToService = selectedDateTime.toIso8601String();
updateAssetModel?.returnToService = selectedDateTime.toIso8601String();
});
}
});
},
),
12.height,
SingleItemDropDownMenu<Lookup, WoFrameProvider>(
context: context,
title: "WO Frame",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
height: 56.toScreenHeight,
showShadow: false,
initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId,
initialValue: updateAssetModel?.cmFrameId,
onSelect: (value) {
if (value != null) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.cmFrameId = value;
updateAssetModel?.cmFrameId = value;
}
},
),
@ -181,13 +183,13 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
SingleItemDropDownMenu<Lookup, ReasonProvider>(
context: context,
title: context.translation.failureReason,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
height: 56.toScreenHeight,
showShadow: false,
initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason,
initialValue: updateAssetModel?.failureReason,
onSelect: (value) {
if (value != null) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.failureReason = value;
updateAssetModel?.failureReason = value;
}
},
),
@ -195,52 +197,50 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
SingleItemDropDownMenu<FaultDescription, NullableLoadingProvider>(
context: context,
title: context.translation.faultDescription,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
staticData: _faults,
showShadow: false,
initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription,
initialValue: updateAssetModel?.faultDescription,
onSelect: (fault) {
if (fault != null) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.faultDescription = fault;
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution = fault.workPerformed;
updateAssetModel?.faultDescription = fault;
updateAssetModel?.solution = fault.workPerformed;
setState(() {});
}
},
),
if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution != null) ...[
if (updateAssetModel?.solution != null) ...[
12.height,
context.translation.solutions.heading6(context).custom(color: AppColor.neutral50),
8.height,
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.solution != null
? requestDetailProvider.engineerUpdateWorkOrderHelperModel!.solution!.bodyText2(context).custom(color: AppColor.neutral120, align: TextAlign.justify)
: const SizedBox(),
updateAssetModel?.solution != null ? updateAssetModel!.solution!.bodyText2(context).custom(color: AppColor.neutral120, align: TextAlign.justify) : const SizedBox(),
],
12.height,
SingleItemDropDownMenu<Lookup, LoanAvailabilityProvider>(
context: context,
title: context.translation.loanAvailability,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
height: 56.toScreenHeight,
showShadow: false,
initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability,
initialValue: updateAssetModel?.loanAvailability,
onSelect: (status) {
if (status != null) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability = status;
updateAssetModel?.loanAvailability = status;
if (status.value != 1) {
loanAvailabilityAsset = null;
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAssetId = null;
updateAssetModel?.loanAssetId = null;
}
setState(() {});
}
},
),
if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.value == 1) 8.height,
if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAvailability?.value == 1)
if (updateAssetModel?.loanAvailability?.value == 1) 8.height,
if (updateAssetModel?.loanAvailability?.value == 1)
PickAsset(
device: loanAvailabilityAsset, // ?? _serviceReport.device,
cardColor: AppColor.neutral100,
onPickAsset: (asset) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.loanAssetId = asset.id;
updateAssetModel?.loanAssetId = asset.id;
setState(() {
loanAvailabilityAsset = asset;
});
@ -250,10 +250,10 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
ADatePicker(
label: "EDD",
hideShadow: true,
backgroundColor: AppColor.neutral100,
// initialDate: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd ?? ""),
backgroundColor: AppColor.fieldBgColor(context),
// initialDate: DateTime.tryParse(updateAssetModel?.edd ?? ""),
from: requestDetailProvider.currentWorkOrder?.data?.requestedDate,
date: DateTime.tryParse(requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd ?? ""),
date: DateTime.tryParse(updateAssetModel?.edd ?? ""),
formatDateWithTime: true,
onDatePicker: (selectedDate) {
showTimePicker(
@ -269,13 +269,13 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
selectedTime.hour,
selectedTime.minute,
);
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd != null &&
// selectedDateTime.isBefore(DateTime.parse(requestDetailProvider.engineerUpdateWorkOrderHelperModel!.edd!))) {
// if (updateAssetModel?.edd != null &&
// selectedDateTime.isBefore(DateTime.parse(updateAssetModel!.edd!))) {
// "Return To Service Date time must be greater then previous date".showToast;
// return;
// }
setState(() {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.edd = selectedDateTime.toIso8601String();
updateAssetModel?.edd = selectedDateTime.toIso8601String();
});
}
});
@ -284,13 +284,13 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
12.height,
AppTextFormField(
labelText: context.translation.callResponse,
backgroundColor: AppColor.neutral100,
initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.callResponse,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: updateAssetModel?.callResponse,
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
showShadow: false,
onChange: (value) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.callResponse = value;
updateAssetModel?.callResponse = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
@ -299,12 +299,12 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
AppTextFormField(
labelText: "Description of Finding",
backgroundColor: AppColor.neutral100,
initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding,
initialValue: updateAssetModel?.descriptionOfFinding,
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
showShadow: false,
onChange: (value) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.descriptionOfFinding = value;
updateAssetModel?.descriptionOfFinding = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
@ -312,12 +312,12 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
AppTextFormField(
labelText: "Action Taken",
backgroundColor: AppColor.neutral100,
initialValue: requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken,
initialValue: updateAssetModel?.actionTaken,
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
showShadow: false,
onChange: (value) {
requestDetailProvider.engineerUpdateWorkOrderHelperModel?.actionTaken = value;
updateAssetModel?.actionTaken = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
@ -326,24 +326,24 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
).toShadowContainer(context).paddingAll(16),
).expanded,
] else ...[
assetStatusWidget(context: context, workOrderData: requestDetailProvider.engineerUpdateWorkOrderHelperModel!).toShadowContainer(context).paddingAll(16),
assetStatusWidget(context: context, workOrderData: updateAssetModel!).toShadowContainer(context).paddingAll(16),
],
Container(
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight),
color: AppColor.white10,
color: AppColor.background(context),
child: AppFilledButton(
label: context.translation.updateAssetDetails,
buttonColor: AppColor.primary10,
onPressed: () async {
if (validateForm(requestDetailProvider: requestDetailProvider)) {
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
await requestDetailProvider.engineerUpdateWorkOrder().then((success){
requestDetailProvider.engineerUpdateWorkOrderHelperModel = updateAssetModel;
await requestDetailProvider.engineerUpdateWorkOrder().then((success) {
Navigator.pop(context);
if(success){
if (success) {
Navigator.pop(context);
}
});
}
},
),
@ -359,9 +359,9 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
if (!widget.isEdit) {
return true;
}
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus != null) {
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.value == 1 || requestDetailProvider.engineerUpdateWorkOrderHelperModel!.equipmentStatus!.value == 2) {
// if (requestDetailProvider.engineerUpdateWorkOrderHelperModel!.returnToService == null) {
// if (updateAssetModel!.equipmentStatus != null) {
// if (updateAssetModel!.equipmentStatus!.value == 1 || updateAssetModel!.equipmentStatus!.value == 2) {
// if (updateAssetModel!.returnToService == null) {
// Fluttertoast.showToast(msg: "Return to service is required ", toastLength: Toast.LENGTH_LONG);
// return false;
// }
@ -376,7 +376,7 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
context.translation.assetStatus.bodyText(context).custom(color: AppColor.black20),
context.translation.assetStatus.bodyText(context).custom(color: AppColor.textColor(context)),
8.height,
Wrap(
runSpacing: 8,
@ -408,7 +408,7 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
],
)
],
).toShimmer(isShow: snapshot.loading),
).toShimmer(isShow: snapshot.loading,context: context),
],
);
});

@ -46,6 +46,8 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
qAmount: currentWorkOrderData.qAmount,
prNo: currentWorkOrderData.prNo,
poNo: currentWorkOrderData.poNo,
mrNo: currentWorkOrderData.mrNo,
exchangeCost: currentWorkOrderData.exchangeCost,
);
}
@ -84,11 +86,11 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
// ),
// 8.height,
AppTextFormField(
labelText: "Labor Cost",
backgroundColor: AppColor.neutral100,
initialValue: requestDetailProvider.workOrderCostModel?.labourCost?.toString(),
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelText: "Labor Cost",
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
@ -99,10 +101,10 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
8.height,
AppTextFormField(
labelText: "Travel Cost",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
initialValue: requestDetailProvider.workOrderCostModel?.travelCost?.toString(),
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
@ -113,10 +115,10 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
8.height,
AppTextFormField(
labelText: "Quot Amount",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
initialValue: requestDetailProvider.workOrderCostModel?.qAmount?.toString(),
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
@ -127,10 +129,10 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
8.height,
AppTextFormField(
labelText: "PR No",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
initialValue: requestDetailProvider.workOrderCostModel?.prNo,
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
@ -141,10 +143,10 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
8.height,
AppTextFormField(
labelText: "PO No",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
initialValue: requestDetailProvider.workOrderCostModel?.poNo,
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
@ -152,12 +154,40 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
},
style: Theme.of(context).textTheme.titleMedium,
),
8.height,
AppTextFormField(
labelText: "MR No",
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
initialValue: requestDetailProvider.workOrderCostModel?.mrNo,
textAlign: TextAlign.center,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
requestDetailProvider.workOrderCostModel?.mrNo = value;
},
style: Theme.of(context).textTheme.titleMedium,
),
8.height,
AppTextFormField(
labelText: "Exchange Cost",
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost != null ? requestDetailProvider.workOrderCostModel?.exchangeCost.toString() : '',
textAlign: TextAlign.center,
textInputType: const TextInputType.numberWithOptions(decimal: true),
showShadow: false,
onChange: (value) {
requestDetailProvider.workOrderCostModel?.exchangeCost = num.parse(value);
},
style: Theme.of(context).textTheme.titleMedium,
),
],
).toShadowContainer(context).paddingAll(16),
).expanded,
Container(
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 16.toScreenHeight),
color: AppColor.white10,
color: AppColor.background(context),
child: AppFilledButton(
label: "Update Cost Details",
buttonColor: AppColor.primary10,
@ -234,7 +264,7 @@ class _CostDetailFormScreenState extends State<CostDetailFormScreen> with Ticker
],
)
],
).toShimmer(isShow: snapshot.loading),
).toShimmer(isShow: snapshot.loading, context: context),
],
);
});

@ -14,13 +14,13 @@ import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
import 'package:test_sa/views/widgets/status/report/service_report_assistant_employee_menu.dart';
class AssistantEmployeeList extends StatefulWidget {
class ServiceRequestAssistantEmployeeList extends StatefulWidget {
final List<AssistantEmployeesModel>? assistantEmployeeList;
final ValueChanged<List<AssistantEmployeesModel>>? onListChanged;
final double? cardPadding;
final dynamic assetId;
const AssistantEmployeeList({
const ServiceRequestAssistantEmployeeList({
super.key,
this.assistantEmployeeList,
this.onListChanged,
@ -29,10 +29,10 @@ class AssistantEmployeeList extends StatefulWidget {
});
@override
State<AssistantEmployeeList> createState() => _AssistantEmployeeListState();
State<ServiceRequestAssistantEmployeeList> createState() => _ServiceRequestAssistantEmployeeListState();
}
class _AssistantEmployeeListState extends State<AssistantEmployeeList> {
class _ServiceRequestAssistantEmployeeListState extends State<ServiceRequestAssistantEmployeeList> {
late List<AssistantEmployeesModel> _list;
late List<TextEditingController> _controllers;
@ -80,7 +80,7 @@ class _AssistantEmployeeListState extends State<AssistantEmployeeList> {
child: AppFilledButton(
label: "Add Assistant Employee".addTranslation,
maxWidth: true,
textColor: AppColor.black10,
textColor: AppColor.textColor(context),
buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10,
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
showIcon: true,
@ -132,7 +132,7 @@ class EmployeeCard extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
context.translation.assistantEmployee.bodyText(context).custom(color: AppColor.black20),
context.translation.assistantEmployee.bodyText(context).custom(color: AppColor.textColor(context)),
if (!isReadOnly)
Container(
height: 32,
@ -148,7 +148,7 @@ class EmployeeCard extends StatelessWidget {
children: [
ServiceReportAssistantEmployeeMenu(
title: context.translation.select,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
assetId: assetId,
initialValue: model.employee,
onSelect: (employee) {
@ -170,7 +170,7 @@ class EmployeeCard extends StatelessWidget {
ADatePicker(
label: context.translation.startTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: model.startDate,
formatDateWithTime: true,
from: requestedDate,
@ -215,7 +215,7 @@ class EmployeeCard extends StatelessWidget {
ADatePicker(
label: context.translation.endTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: model.endDate,
formatDateWithTime: true,
from: requestedDate,
@ -261,20 +261,21 @@ class EmployeeCard extends StatelessWidget {
8.height,
AppTextFormField(
labelText: context.translation.workingHours,
backgroundColor: AppColor.neutral80,
backgroundColor: AppColor.fieldBgColor(context),
// backgroundColor: AppColor.neutral80,
controller: workingHoursController,
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
textAlign: TextAlign.center,
enable: false,
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
style: Theme.of(context).textTheme.titleMedium,
),
8.height,
AppTextFormField(
initialValue: model.technicalComment,
labelText: context.translation.technicalComment,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
alignLabelWithHint: true,

@ -60,7 +60,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
SingleItemDropDownMenu<SupplierDetails, VendorProvider>(
context: context,
title: context.translation.supplier,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplier,
showAsBottomSheet: true,
showShadow: false,
@ -76,7 +76,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
children: [
SingleItemDropDownMenu<SuppPersons, NullableLoadingProvider>(
context: context,
backgroundColor: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100,
backgroundColor: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? context.isDark ? AppColor.neutral20 : AppColor.neutral40 : AppColor.fieldBgColor(context),
title: context.translation.supplierEngineer,
showShadow: false,
enabled: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.isNotEmpty ?? false,
@ -106,7 +106,8 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
height: 56.toScreenHeight,
width: 60.toScreenWidth,
decoration: BoxDecoration(
color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100,
// color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100,
color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? context.isDark ? AppColor.neutral20 : AppColor.neutral40 : AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
//boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
),
@ -135,7 +136,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
ADatePicker(
label: context.translation.startTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime,
from: requestDetailProvider.currentWorkOrder?.data?.requestedDate,
formatDateWithTime: true,
@ -177,7 +178,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
ADatePicker(
label: context.translation.endTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
from: requestDetailProvider.currentWorkOrder?.data?.requestedDate,
to: DateTime.now(),
enable: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime != null,
@ -240,13 +241,13 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
8.height,
AppTextFormField(
labelText: context.translation.workingHours,
backgroundColor: AppColor.neutral80,
backgroundColor: AppColor.fieldBgColor(context),
controller: _workingHoursController,
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
initialValue:
requestDetailProvider.activityMaintenanceHelperModel?.supplierWorkingHour != null ? requestDetailProvider.activityMaintenanceHelperModel?.supplierWorkingHour.toString() : '',
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
enable: false,
showShadow: false,
style: Theme.of(context).textTheme.titleMedium,

@ -88,7 +88,8 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
height: 56.toScreenHeight,
title: context.translation.activityStatus,
showShadow: false,
backgroundColor: AppColor.neutral100,
// backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.activityStatus,
onSelect: (status) {
@ -210,7 +211,7 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth),
alignment: Alignment.centerLeft,
decoration: BoxDecoration(
color: context.isDark ? AppColor.neutral40 : AppColor.background(context),
color: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
),
@ -249,7 +250,7 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
AppTextFormField(
labelText: context.translation.travelingHours,
controller: _travellingHoursController,
backgroundColor: AppColor.neutral100,
backgroundColor:AppColor.fieldBgColor(context),
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
@ -268,7 +269,7 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
16.height,
AppTextFormField(
labelText: context.translation.assignedEmployee,
backgroundColor: AppColor.neutral80,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.assignedEmployee?.userName,
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
@ -280,7 +281,7 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
AppTextFormField(
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.technicalComment,
labelText: context.translation.technicalComment,
backgroundColor: AppColor.neutral100,
backgroundColor:AppColor.fieldBgColor(context),
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
alignLabelWithHint: true,
@ -295,7 +296,7 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
],
),
).toShadowContainer(context).paddingOnly(start: 13, end: 14, top: 12),
AssistantEmployeeList(
ServiceRequestAssistantEmployeeList(
assetId: requestDetailProvider.currentWorkOrder?.data?.asset?.id,
assistantEmployeeList: requestDetailProvider.activityMaintenanceHelperModel?.assistantEmployList,
onListChanged: (updatedList) {
@ -325,7 +326,7 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
context.translation.repairLocation.bodyText(context).custom(color: AppColor.black20),
context.translation.repairLocation.bodyText(context).custom(color: AppColor.textColor(context)),
8.height,
Wrap(
runSpacing: 8,
@ -357,7 +358,7 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
],
)
],
).toShimmer(isShow: snapshot.isLoading),
).toShimmer(isShow: snapshot.isLoading,context: context),
],
);
});

@ -51,7 +51,7 @@ class _MaintenanceRequestFormState extends State<MaintenanceRequestForm> with Si
return Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) {
bool isUpdate = requestDetailProvider.activityMaintenanceHelperModel?.id != 0;
return Scaffold(
backgroundColor: AppColor.neutral110,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: DefaultAppBar(
title: "CM Activity",
onWillPopScope: requestDetailProvider.isReadOnlyRequest
@ -104,6 +104,7 @@ class _MaintenanceRequestFormState extends State<MaintenanceRequestForm> with Si
).expanded,
if (!requestDetailProvider.isReadOnlyRequest)
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
label: requestDetailProvider.activityMaintenanceHelperModel?.id != 0 ? context.translation.update : context.translation.addActivity, // Use the dynamic label
buttonColor: AppColor.primary10,

@ -11,11 +11,13 @@ import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/helper_data_models/spare_part/activity_spare_part_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/service_request/spare_parts.dart';
import 'package:test_sa/models/size_config.dart';
import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
@ -25,7 +27,7 @@ import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
import 'package:test_sa/providers/loading_list_notifier.dart';
import 'package:test_sa/views/widgets/images/new_multi_image_picker.dart';
import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
class SparePartRequest extends StatefulWidget {
@ -43,7 +45,7 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
bool _isLoading = false;
List<SparePart> _spareParts = [];
List<MultiFilesPickerModel> _files = [];
List<GenericAttachmentModel> attachments = [];
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final TextEditingController _partQtyController = TextEditingController();
@ -80,7 +82,7 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
activityStatus = _requestDetailProvider?.sparePartHelperModel?.activityStatus?.value;
scheduleMicrotask(() async {
_isLoading = true;
_files = _requestDetailProvider?.sparePartHelperModel?.sparePartAttachments?.map((e) => MultiFilesPickerModel(e.id!, File(e.name!))).toList() ?? [];
attachments = _requestDetailProvider?.sparePartHelperModel?.sparePartAttachments?.map((e) => GenericAttachmentModel(id: e.id!, name: e.name ?? '')).toList() ?? [];
setState(() {});
_spareParts = await _partsProvider!.getPartsListByDisplayName(assetId: _requestDetailProvider?.currentWorkOrder?.data?.asset?.id);
_isLoading = false;
@ -95,7 +97,7 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
_returnQtyController.clear();
_oracleNoController.clear();
_descriptionController.clear();
_files = [];
attachments = [];
}
@override
@ -291,9 +293,9 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
},
),
12.height,
NewMultiFilesPicker(
AttachmentPicker(
label: context.translation.attachQuotation,
files: _files,
attachment: attachments,
buttonIcon: 'quotation_icon'.toSvgAsset(),
buttonColor: AppColor.primary10,
),
@ -307,6 +309,7 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
).expanded,
if (!requestDetailProvider.isReadOnlyRequest)
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity,
buttonColor: AppColor.green70,
@ -332,10 +335,10 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
requestDetailProvider.sparePartHelperModel?.sparePartAttachments?.clear();
for (var pickerObject in _files) {
String fileData = _isLocalUrl(pickerObject.file.path) ? "${pickerObject.file.path.split("/").last}|${base64Encode(File(pickerObject.file.path).readAsBytesSync())}" : pickerObject.file.path;
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
requestDetailProvider.sparePartHelperModel?.sparePartAttachments?.add(
SparePartAttachments(id: pickerObject.id, name: fileData),
SparePartAttachments(id: item.id, name: fileName),
);
}

@ -13,11 +13,13 @@ 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/user_types.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_models.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/service_request/pending_service_request_model.dart';
import 'package:test_sa/models/service_request/service_request.dart';
import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
@ -52,7 +54,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
late ServiceRequestsProvider _serviceRequestsProvider;
late ServiceRequestDetailProvider _requestDetailProvider;
late ServiceRequest _serviceRequest;
final List<File> _deviceImages = [];
final List<GenericAttachmentModel> _deviceImages = [];
final bool _isLoading = false;
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@ -72,7 +74,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
getInitialData();
if (_serviceRequestsProvider.currentSelectedRequest != null) {
_serviceRequest = _serviceRequestsProvider.currentSelectedRequest!;
_deviceImages.addAll(_serviceRequest.devicePhotos!.map((e) => File(e)).toList());
_deviceImages.addAll(_serviceRequest.devicePhotos!.map((e) => GenericAttachmentModel(name: e)).toList());
_showDatePicker = _serviceRequest.firstAction != null && _serviceRequest.firstAction?.name == "Need a visit";
if (_showDatePicker && _serviceRequest.visitDate != null) {
_dateTime = DateTime.tryParse(_serviceRequest.visitDate!);
@ -154,9 +156,9 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
16.height,
assetStatusWidget(context),
24.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachImage,
files: _deviceImages,
attachment: _deviceImages,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -169,6 +171,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
// label: context.translation.submitRequest,
buttonColor: AppColor.primary10,
@ -235,7 +238,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
],
)
],
).toShimmer(isShow: snapshot.loading),
).toShimmer(isShow: snapshot.loading,context: context),
],
);
});
@ -277,7 +280,7 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
_serviceRequest.priority = snapshot.items.firstWhere((element) => element.value == 0, orElse: null);
}
setState(() {});
}).toShimmer(isShow: snapshot.loading);
}).toShimmer(isShow: snapshot.loading,context: context);
}),
],
);
@ -351,7 +354,8 @@ class _CreateNewRequestState extends State<CreateNewRequest> with TickerProvider
}
List<WorkOrderAttachments> attachement = [];
for (var item in _deviceImages) {
attachement.add(WorkOrderAttachments(id: 0, name: "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}"));
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??'';
attachement.add(WorkOrderAttachments(id: 0, name: fileName));
}
_requestDetailProvider.workOrderHelperModel = WorkOrderHelperModel(
assetId: _serviceRequest.device?.id,

@ -73,7 +73,7 @@ class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
return true;
},
child: Scaffold(
backgroundColor: AppColor.neutral100,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: DefaultAppBar(
title: context.translation.cmDetails,
onBackPress: () {

@ -43,7 +43,7 @@ class _PpmCalibrationToolsFormState extends State<PpmCalibrationToolsForm> {
child: AppFilledButton(
label: "Add More Calibration Tools".addTranslation,
maxWidth: true,
textColor: AppColor.black10,
textColor: AppColor.headingTextColor(context),
buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10,
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
showIcon: true,
@ -106,8 +106,8 @@ class _PpmCalibrationToolsFormState extends State<PpmCalibrationToolsForm> {
ADatePicker(
label: context.translation.calibrationDate,
date: DateTime.tryParse(model.calibrationDateOfTesters ?? ""),
from: DateTime.now().subtract(const Duration(days: 90)),
backgroundColor: context.isDark ? AppColor.neutral50 : AppColor.neutral100,
from: DateTime.now().subtract(const Duration(days: 10*365)),
backgroundColor: AppColor.fieldBgColor(context),
withBorder: false,
hideShadow: true,
onDatePicker: (date) {

@ -66,7 +66,7 @@ class _PpmExternalDetailsFormState extends State<PpmExternalDetailsForm> {
child: AppFilledButton(
label: "Add More External Details".addTranslation,
maxWidth: true,
textColor: AppColor.black10,
textColor: AppColor.headingTextColor(context),
buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10,
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
showIcon: true,
@ -150,7 +150,7 @@ class _ExternalDetailItemState extends State<ExternalDetailItem> {
context: context,
title: context.translation.supplier,
initialValue: widget.model.supplier,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
showShadow: false,
showCancel: true,
@ -168,7 +168,7 @@ class _ExternalDetailItemState extends State<ExternalDetailItem> {
context: context,
title: context.translation.supplierEngineer,
enabled: widget.model.supplier != null,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.model.suppPerson,
staticData: widget.model.supplier?.suppPersons,
showAsBottomSheet: true,
@ -184,7 +184,7 @@ class _ExternalDetailItemState extends State<ExternalDetailItem> {
height: 56.toScreenHeight,
width: 60.toScreenWidth,
decoration: BoxDecoration(
color: AppColor.neutral100,
color: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
//boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
),
@ -217,7 +217,7 @@ class _ExternalDetailItemState extends State<ExternalDetailItem> {
ADatePicker(
label: context.translation.startTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: widget.model.startDateTime,
formatDateWithTime: true,
from: DateTime.tryParse(_ppmProvider?.planPreventiveVisit?.createdDate ?? ''),
@ -260,7 +260,7 @@ class _ExternalDetailItemState extends State<ExternalDetailItem> {
ADatePicker(
label: context.translation.endTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: widget.model.endDateTime,
enable: widget.model.startDateTime != null,
formatDateWithTime: true,
@ -303,7 +303,7 @@ class _ExternalDetailItemState extends State<ExternalDetailItem> {
8.height,
AppTextFormField(
labelText: context.translation.workingHours,
backgroundColor: AppColor.neutral80,
backgroundColor: AppColor.fieldBgColor(context),
controller: controller,
textAlign: TextAlign.center,
enable: false,

@ -55,6 +55,7 @@ class _PpmPmChecklistFormState extends State<PpmPmChecklistForm> {
],
AppTextFormField(
labelText: "Task".addTranslation,
labelStyle: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120, fontWeight: FontWeight.w500),
initialValue: list[index].instructionText?.text ?? "",
enable: false,

@ -40,7 +40,7 @@ class _PpmPMKitsFormState extends State<PpmPMKitsForm> {
child: AppFilledButton(
label: "Add More PM Kits".addTranslation,
maxWidth: true,
textColor: AppColor.black10,
textColor: AppColor.headingTextColor(context),
buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10,
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
showIcon: true,

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -47,8 +48,9 @@ class _UpdatePpmState extends State<UpdatePpm> with TickerProviderStateMixin {
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
ppmProvider.planPreventiveVisit?.preventiveVisitAttachments = [];
for (var item in ppmProvider.ppmPlanAttachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??'';
ppmProvider.planPreventiveVisit?.preventiveVisitAttachments
?.add(PreventiveVisitAttachments(id: 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path));
?.add(PreventiveVisitAttachments(id: item.id, attachmentName: fileName));
}
ppmProvider.planPreventiveVisit?.preventiveVisitTimers = ppmProvider.planPreventiveVisit?.preventiveVisitTimers ?? [];
@ -123,7 +125,7 @@ class _UpdatePpmState extends State<UpdatePpm> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.neutral110,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: DefaultAppBar(
title: context.translation.preventiveMaintenance,
onWillPopScope: ppmProvider.isReadOnly
@ -205,6 +207,7 @@ class _UpdatePpmState extends State<UpdatePpm> with TickerProviderStateMixin {
if (tabIndex == 1) ...[
AppFilledButton(
buttonColor: _tabController!.index == 0 ? null : AppColor.background(context),
// buttonColor: _tabController!.index == 0 ? null : AppColor.background(context),
textColor: _tabController!.index == 0 ? null : AppColor.blueStatus(context),
showBorder: true,
disableButton: _tabController!.index == 0,
@ -222,8 +225,10 @@ class _UpdatePpmState extends State<UpdatePpm> with TickerProviderStateMixin {
],
if (!ppmProvider.isReadOnly) ...[
AppFilledButton(
buttonColor: AppColor.white60,
textColor: AppColor.neutral50,
// buttonColor: AppColor.white60,
// textColor: AppColor.neutral50,
buttonColor: context.isDark?AppColor.neutral50:AppColor.white60,
textColor: context.isDark ? Colors.white: AppColor.neutral150,
onPressed: () {
_onSubmit(status: 0);
},

@ -12,6 +12,7 @@ import 'package:test_sa/helper/utils.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/device/model_definition.dart';
import 'package:test_sa/models/device/supplier.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/building.dart';
import 'package:test_sa/models/new_models/department.dart';
@ -51,7 +52,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
PpmProvider ppmProvider = Provider.of<PpmProvider>(context, listen: false);
if (widget.planPreventiveVisit.preventiveVisitAttachments != null && widget.planPreventiveVisit.preventiveVisitAttachments!.isNotEmpty) {
ppmProvider.ppmPlanAttachments = [];
ppmProvider.ppmPlanAttachments.addAll(widget.planPreventiveVisit.preventiveVisitAttachments!.map((e) => File(e.attachmentName!)).toList());
ppmProvider.ppmPlanAttachments.addAll(widget.planPreventiveVisit.preventiveVisitAttachments!.map((e) => GenericAttachmentModel(id:e.id,name:e.attachmentName!)).toList());
}
});
@ -82,7 +83,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
backgroundColor: AppColor.getRequestStatusColorByName(context, widget.planPreventiveVisit.visitStatus?.name),
),
8.height,
widget.planPreventiveVisit.planName!.bodyText(context).custom(color: AppColor.black10),
widget.planPreventiveVisit.planName!.bodyText(context).custom(color: AppColor.headingTextColor(context)),
2.height,
'${context.translation.pmPlanNo}: ${widget.planPreventiveVisit.planNo}'.bodyText2(context).custom(color: AppColor.neutral120),
//need to add in translation it's suggestion from ahmed..
@ -107,7 +108,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
widget.planPreventiveVisit.assetName!.bodyText(context).custom(color: AppColor.black10).expanded,
widget.planPreventiveVisit.assetName!.bodyText(context).custom(color: AppColor.headingTextColor(context)).expanded,
"info_icon".toSvgAsset(height: 17, width: 17).onPress(
() {
// There is only limited information for asset is returned from backend to show all info need to return the whole model from backend...
@ -127,8 +128,8 @@ class _WoInfoFormState extends State<WoInfoForm> {
],
),
2.height,
'${context.translation.assetNo}: ${widget.planPreventiveVisit.asset?.assetNumber}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.model}: ${widget.planPreventiveVisit.model}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.assetNo}: ${widget.planPreventiveVisit.asset?.assetNumber}'.bodyText2(context).custom(color: AppColor.lightTextColor(context)),
'${context.translation.model}: ${widget.planPreventiveVisit.model}'.bodyText2(context).custom(color: AppColor.lightTextColor(context)),
],
).toShadowContainer(context),
@ -172,7 +173,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
initialValue:
widget.planPreventiveVisit.taskStatus == null ? null : Lookup(name: widget.planPreventiveVisit.taskStatus?.name ?? "", id: widget.planPreventiveVisit.taskStatus?.id),
title: context.translation.pmTestResult,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
onSelect: (value) {
if (value != null) {
widget.planPreventiveVisit.taskStatus = value;
@ -183,7 +184,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
ADatePicker(
label: context.translation.actualVisit,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: widget.planPreventiveVisit.acutalDateOfVisit,
from: DateTime.tryParse(widget.planPreventiveVisit.creationDate ?? ''),
formatDateWithTime: true,
@ -230,7 +231,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
8.height,
SingleItemDropDownMenu<Lookup, PpmElectricalSafetyProvider>(
context: context,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
initialValue: widget.planPreventiveVisit.safety?.id == null ? null : Lookup(name: widget.planPreventiveVisit.safety?.name ?? "", id: widget.planPreventiveVisit.safety?.id),
title: "Electrical Safety",
@ -243,7 +244,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
8.height,
SingleItemDropDownMenu<Lookup, PpmAssetAvailabilityProvider>(
context: context,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
initialValue: widget.planPreventiveVisit.assetAvailability == null
? null
@ -258,7 +259,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
8.height,
SingleItemDropDownMenu<Lookup, PpmServiceProvider>(
context: context,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
initialValue: widget.planPreventiveVisit.typeOfService == null
? null
@ -281,7 +282,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
8.height,
AppTextFormField(
labelText: context.translation.comment,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
initialValue: (widget.planPreventiveVisit.comments ?? "").toString(),
textAlign: TextAlign.center,
@ -291,9 +292,9 @@ class _WoInfoFormState extends State<WoInfoForm> {
},
),
16.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachments,
files: ppmProvider.ppmPlanAttachments,
attachment: ppmProvider.ppmPlanAttachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -359,7 +360,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
children: [
AppTimer(
label: context.translation.workingHours,
decoration: BoxDecoration(color: AppColor.neutral100, borderRadius: BorderRadius.circular(10)),
decoration: BoxDecoration(color: AppColor.fieldBgColor(context), borderRadius: BorderRadius.circular(10)),
width: double.infinity,
timer: widget.planPreventiveVisit.tbsTimer,
pickerTimer: widget.planPreventiveVisit.ppMTimePicker,

@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:test_sa/controllers/providers/api/gas_refill_comments.dart';
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';
@ -28,10 +30,10 @@ class _RoomInspectionCardState extends State<RoomInspectionCard> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.inspectionModel!.tabName!.bodyText(context).custom(color: AppColor.neutral50, fontWeight: FontWeight.w600),
widget.inspectionModel!.tabName!.bodyText(context).custom(color:AppColor.textColor(context), fontWeight: FontWeight.w600),
8.height,
Container(
color: Colors.white10,
color: context.isDark?null: Colors.white10,
child: Column(
children: widget.inspectionModel!.planRecurrentMedicalTaskRoomTabAttributes?.asMap().entries.map<Widget>((entry) {
final model = entry.value;
@ -66,7 +68,7 @@ class _RoomInspectionCardState extends State<RoomInspectionCard> {
model.attribute?.name ?? '',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.white936),
style: AppTextStyles.bodyText2.copyWith(color: context.isDark?Colors.white:AppColor.white936),
),
(status ? 'Pass' : 'Fail').bodyText2(context).custom(color: AppColor.neutral120, fontWeight: FontWeight.w500),
],
@ -83,7 +85,7 @@ class _RoomInspectionCardState extends State<RoomInspectionCard> {
height: 30.toScreenHeight,
padding: EdgeInsetsDirectional.all(4.toScreenHeight),
decoration: BoxDecoration(
color: AppColor.white80,
color: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(5),
),
child: Row(
@ -94,14 +96,14 @@ class _RoomInspectionCardState extends State<RoomInspectionCard> {
isActive: status,
activeColor: AppColor.green20,
inactiveColor: Colors.transparent,
textColor: status ? AppColor.green50 : AppColor.black20,
textColor: status ? AppColor.green50 : context.isDark?Colors.white: AppColor.black20,
),
buildToggleOption(
label: "FAIL",
isActive: !status,
activeColor: AppColor.red20,
inactiveColor: Colors.transparent,
textColor: status ? AppColor.black20 : AppColor.red30,
textColor: status ? context.isDark?Colors.white: AppColor.black20 : AppColor.red30,
),
],
),
@ -188,14 +190,14 @@ class _RoomInspectionCardState extends State<RoomInspectionCard> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
model.attribute!.name!.bodyText2(context).custom(color: AppColor.white936, fontWeight: FontWeight.w500),
model.attribute!.name!.bodyText2(context).custom(color: context.isDark?Colors.white:AppColor.white936, fontWeight: FontWeight.w500),
TextFormField(
keyboardType: TextInputType.number,
initialValue: model.attributeValue ?? '',
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(horizontal: 5.toScreenWidth),
filled: true,
fillColor: AppColor.neutral100,
fillColor: AppColor.fieldBgColor(context),
constraints: BoxConstraints(
maxWidth: 99.toScreenWidth,
maxHeight: 30.toScreenHeight,

@ -68,7 +68,7 @@ class _RoomTabsWidgetState extends State<RoomTabsWidget> {
color: selectedIndex == index ? (context.isDark ? AppColor.neutral60 : AppColor.neutral110) : Colors.transparent,
borderRadius: BorderRadius.circular(7),
),
child: label.bodyText(context).custom(color: AppColor.white936),
child: label.bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936),
),
);
}).toList(),

@ -35,7 +35,7 @@ class RecurrentTaskInfoWidget extends StatelessWidget {
backgroundColor: AppColor.getRequestStatusColorByName(context, model?.status?.name),
),
8.height,
model!.title!.bodyText(context).custom(color: AppColor.black10),
model!.title!.bodyText(context).custom(color: AppColor.textColor(context)),
2.height,
'${context.translation.taskNo}: ${model!.taskNo!}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.site}: ${model!.site!.siteName!}'.bodyText2(context).custom(color: AppColor.neutral120),
@ -79,7 +79,7 @@ class RecurrentTaskInfoWidget extends StatelessWidget {
width: double.infinity,
enabled: snapshot.recurrentWoData?.status?.value != 1,
decoration: BoxDecoration(
color: AppColor.neutral100,
color: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
),
pickerTimer: model?.recurrentWoTimePicker,
@ -103,7 +103,7 @@ class RecurrentTaskInfoWidget extends StatelessWidget {
8.width,
Text(
ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()),
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
style: AppTextStyles.bodyText.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w600),
),
],
),
@ -117,9 +117,10 @@ class RecurrentTaskInfoWidget extends StatelessWidget {
return AppTextFormField(
initialValue: model?.comment,
labelText: context.translation.comment,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
hintStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10),
labelStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10),
alignLabelWithHint: true,
textInputType: TextInputType.multiline,
onChange: (value) {
@ -145,8 +146,8 @@ Widget buildingInfoWidget({required String label, required String? value, requir
3.height,
Text(
value ?? '',
style: AppTextStyles.bodyText2.copyWith(color: AppColor.black10),
style: AppTextStyles.bodyText2.copyWith(color: AppColor.textColor(context)),
)
],
).toShadowContainer(context, backgroundColor: AppColor.neutral100, borderRadius: 10, paddingObject: EdgeInsets.all(12.toScreenHeight), showShadow: false);
).toShadowContainer(context, backgroundColor: AppColor.background(context), borderRadius: 10, paddingObject: EdgeInsets.all(12.toScreenHeight), showShadow: false);
}

@ -80,19 +80,22 @@ class _RecurrentWorkOrderViewState extends State<RecurrentWorkOrderView> {
).expanded,
if (requestProvider.recurrentWoData?.status?.value != 1) ...[
FooterActionButton.footerContainer(
context: context,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
AppFilledButton(
label: context.translation.save,
buttonColor: AppColor.white60,
textColor: AppColor.black10,
buttonColor: context.isDark?AppColor.neutral20: AppColor.white60,
textColor: context.isDark?Colors.white: AppColor.black10,
onPressed: () => _updateTask(context: context, status: 0),
).expanded,
12.width,
AppFilledButton(
label: context.translation.complete,
buttonColor: AppColor.primary10,
// textColor: context.isDark?Colors.white: AppColor.black10,
onPressed: () => _updateTask(context: context, status: 1),
).expanded,
],

@ -10,12 +10,14 @@ import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/enums/user_types.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/mapped_sites.dart';
import 'package:test_sa/models/new_models/room_model.dart';
import 'package:test_sa/models/new_models/task_request/task_request_model.dart';
import 'package:test_sa/models/new_models/task_request/task_type_model.dart';
import 'package:test_sa/models/service_request/pending_service_request_model.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
@ -41,7 +43,7 @@ class CreateTaskView extends StatefulWidget {
}
class _CreateTaskViewState extends State<CreateTaskView> with TickerProviderStateMixin {
final List<File> _deviceImages = [];
final List<GenericAttachmentModel> attachments = [];
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
List<Asset> _deviceList = [];
@ -111,17 +113,23 @@ class _CreateTaskViewState extends State<CreateTaskView> with TickerProviderStat
},
),
23.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachImage,
files: _deviceImages,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
//verify this if not required delete this ..
onChange: (attachments) {
attachments = attachments;
setState(() {});
},
),
],
).toShadowContainer(context).paddingAll(16),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(
buttonColor: AppColor.primary10,
label: context.translation.submitRequest,
@ -444,8 +452,9 @@ class _CreateTaskViewState extends State<CreateTaskView> with TickerProviderStat
_addTaskModel!.assetIds?.add(int.parse(device!.id.toString()));
}
}
for (var item in _deviceImages) {
_addTaskModel?.attachments?.add(TaskJobAttachment(id: 0, name: "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}"));
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
_addTaskModel?.attachments?.add(TaskJobAttachment(id: item.id, name: fileName));
}
TaskRequestProvider taskRequestProvider = Provider.of<TaskRequestProvider>(context, listen: false);
await taskRequestProvider.addTask(context: context, task: _addTaskModel!);

@ -12,6 +12,7 @@ import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/building.dart';
import 'package:test_sa/models/new_models/department.dart';
@ -54,7 +55,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
final TextEditingController _requestedQuantityController = TextEditingController();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
List<File> _files = [];
List<GenericAttachmentModel> attachments = [];
bool installationType = true;
String comments = '';
List<File> _userAttachments = [];
@ -78,6 +79,12 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
_readOnlyAttachments = _taskProvider?.taskRequestModel?.taskJobAttachments?.where((e) => e.createdBy != _userProvider.user?.userID).toList() ?? [];
_taskProvider?.updateTaskModel(taskModel);
if (taskModel != null) {
attachments.addAll(taskModel.taskJobAttachments!.map((e) => GenericAttachmentModel(id:e.id,name:e.name ?? '')).toList());
// if (taskModel.taskType?.isInstallation == true) {
// await _taskProvider!.getSiteData(siteId: taskModel.asset?.siteId);
// }
}
}
@override
@ -127,7 +134,8 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
initialValue: "",
labelText: context.translation.technicalComment,
textInputType: TextInputType.multiline,
backgroundColor: AppColor.neutral90,
backgroundColor: AppColor.fieldBgColor(context),
labelStyle: TextStyle(color: AppColor.textColor(context)),
showShadow: false,
alignLabelWithHint: true,
onChange: (value) {
@ -137,9 +145,9 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
onSaved: (value) {},
),
20.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachFiles,
files: _userAttachments,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -152,6 +160,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
@ -189,12 +198,9 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
if (validate(model: taskModel)) {
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
List<TaskJobAttachment> attachment = [];
if (_readOnlyAttachments.isNotEmpty) {
attachment.addAll(_readOnlyAttachments);
}
for (var file in _userAttachments) {
String fileName = ServiceRequestUtils.isLocalUrl(file.path) ? ("${file.path.split("/").last}|${base64Encode(File(file.path).readAsBytesSync())}") : file.path;
attachment.add(TaskJobAttachment(id: 0, name: fileName));
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??'';
attachment.add(TaskJobAttachment(id: item.id, name: fileName));
}
taskModel?.taskJobAttachments = attachment;
if (taskModel?.taskTimePicker != null) {
@ -268,7 +274,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
ADatePicker(
label: context.translation.installationDate,
hideShadow: true,
backgroundColor: AppColor.neutral90,
backgroundColor: AppColor.fieldBgColor(context),
date: DateTime.tryParse(taskModel.installationDate ?? ""),
formatDateWithTime: false,
onDatePicker: (selectedDate) {
@ -294,7 +300,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
8.height,
AppTextFormField(
labelText: context.translation.serialNo,
backgroundColor: AppColor.neutral90,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
initialValue: taskModel.serialNo ?? '',
@ -310,7 +316,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
initialValue: taskModel.site,
loading: _taskProvider?.isSiteLoading,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
enabled: false,
onSelect: (value) {
@ -328,7 +334,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
SingleItemDropDownMenu<Building, NullableLoadingProvider>(
context: context,
title: 'Installation Building',
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
loading: _taskProvider?.isSiteLoading,
showShadow: false,
@ -349,7 +355,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
SingleItemDropDownMenu<Floor, NullableLoadingProvider>(
context: context,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
loading: _taskProvider?.isSiteLoading,
showShadow: false,
title: 'Installation Floor',
@ -369,7 +375,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
SingleItemDropDownMenu<Department, NullableLoadingProvider>(
context: context,
title: 'Installation Department',
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
loading: _taskProvider?.isSiteLoading,
showAsBottomSheet: true,
showShadow: false,
@ -429,7 +435,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
height: 56.toScreenHeight,
title: context.translation.completedActions,
showShadow: false,
backgroundColor: AppColor.neutral90,
backgroundColor: AppColor.fieldBgColor(context),
enabled: false,
showAsBottomSheet: true,
initialValue: taskModel.actionNeeded,
@ -444,7 +450,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
height: 56.toScreenHeight,
title: context.translation.impactStatus,
showShadow: false,
backgroundColor: AppColor.neutral90,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
initialValue: taskModel.impactStatus,
onSelect: (status) {
@ -468,7 +474,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
height: 56.toScreenHeight,
title: context.translation.completedActions,
showShadow: false,
backgroundColor: AppColor.neutral90,
backgroundColor: AppColor.fieldBgColor(context),
enabled: false,
showAsBottomSheet: true,
initialValue: taskModel.actionNeeded,
@ -483,7 +489,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
height: 56.toScreenHeight,
title: context.translation.impactStatus,
showShadow: false,
backgroundColor: AppColor.neutral90,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
initialValue: taskModel.impactStatus,
onSelect: (status) {
@ -515,7 +521,7 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
width: double.infinity,
enabled: isTimerEnable,
decoration: BoxDecoration(
color: AppColor.neutral90,
color: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
),
pickerTimer: taskProvider.taskRequestModel?.taskTimePicker,
@ -534,11 +540,11 @@ class _UpdateTaskRequestState extends State<UpdateTaskRequest> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
'Total Working Time:'.bodyText2(context).custom(color: AppColor.neutral50),
'Total Working Time:'.bodyText2(context).custom(color: AppColor.textColor(context)),
8.width,
Text(
ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()),
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
style: AppTextStyles.bodyText.copyWith(color: AppColor.textColor(context), fontWeight: FontWeight.w600),
),
],
),
@ -655,7 +661,7 @@ class _AssistantEmployeeCardState extends State<AssistantEmployeeCard> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
context.translation.assistantEmployee.heading6(context).custom(color: AppColor.black10),
context.translation.assistantEmployee.heading6(context).custom(color: AppColor.textColor(context)),
Icon(isExpanded ? Icons.keyboard_arrow_up_rounded : Icons.keyboard_arrow_down_rounded),
],
),
@ -670,7 +676,7 @@ class _AssistantEmployeeCardState extends State<AssistantEmployeeCard> {
children: [
ServiceReportAssistantEmployeeMenu(
title: context.translation.select,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: (taskModel?.assistantEmployees?.isNotEmpty ?? false) ? taskModel?.assistantEmployees?.first : null,
onSelect: (employee) {
if (employee == null) {
@ -688,7 +694,7 @@ class _AssistantEmployeeCardState extends State<AssistantEmployeeCard> {
ADatePicker(
label: context.translation.startTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: taskModel?.modelAssistantEmployees?.startDate,
// from: taskModel?.d,
formatDateWithTime: true,
@ -728,7 +734,7 @@ class _AssistantEmployeeCardState extends State<AssistantEmployeeCard> {
ADatePicker(
label: context.translation.endTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: taskModel?.modelAssistantEmployees?.endDate,
enable: taskModel?.modelAssistantEmployees?.startDate != null,
formatDateWithTime: true,
@ -782,12 +788,12 @@ class _AssistantEmployeeCardState extends State<AssistantEmployeeCard> {
8.height,
AppTextFormField(
labelText: context.translation.workingHours,
backgroundColor: AppColor.neutral80,
backgroundColor: AppColor.fieldBgColor(context),
controller: _workingHoursController,
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
initialValue: taskModel?.modelAssistantEmployees?.workingHours != null ? taskModel!.modelAssistantEmployees!.workingHours?.toStringAsFixed(2) : '',
textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
enable: false,
showShadow: false,
style: Theme.of(context).textTheme.titleMedium,
@ -796,9 +802,9 @@ class _AssistantEmployeeCardState extends State<AssistantEmployeeCard> {
AppTextFormField(
initialValue: taskModel?.modelAssistantEmployees?.comment,
labelText: context.translation.comment,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
alignLabelWithHint: true,
textInputType: TextInputType.multiline,
onChange: (value) {

@ -96,6 +96,11 @@ class AppColor {
static Color yellowIcon(BuildContext context) => context.isDark ? const Color(0xffFFC945) : orange70;
static Color background(BuildContext context) => context.isDark ? neutral60 : Colors.white;
static Color textColor(BuildContext context) =>context.isDark ? AppColor.neutral30 : AppColor.neutral50;
static Color headingTextColor(BuildContext context) =>context.isDark ? AppColor.neutral30 : AppColor.black10;
static Color lightTextColor(BuildContext context) =>AppColor.neutral120;
static Color iconColor(BuildContext context) =>context.isDark ? AppColor.neutral30 : AppColor.neutral50;
static Color fieldBgColor(BuildContext context) => context.isDark ? AppColor.neutral20 : AppColor.neutral100;
static Color selectedButtonColor(BuildContext context) => context.isDark ? neutral60 : neutral30;
@ -180,6 +185,8 @@ static Color getActivityTypeTextColor(String type) {
return red30;
case "canceled":
return red30;
case "returned":
return red30;
default:
return Colors.white;
}

@ -34,7 +34,8 @@ class AppBottomNavigationBar extends StatelessWidget {
boxShadow: [boxShadowR14],
),
child: BottomNavigationBar(
backgroundColor: Colors.white,
// backgroundColor: Colors.white,
backgroundColor: AppColor.background(context),
items: <BottomNavigationBarItem>[
for (int i = 0; i < navItems.length; i++) navBarItem(context, index: navItems[i].index, iconName: navItems[i].iconName, label: navItems[i].label, showLabel: navItems[i].showLabel),
],

@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
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/new_models/gas_refill_model.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
class AppFilledButton extends StatelessWidget {
@ -43,7 +45,7 @@ class AppFilledButton extends StatelessWidget {
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: disableButton ? AppColor.neutral140 : (buttonColor ?? AppColor.blueStatus(context)),
color: disableButton ?context.isDark ?AppColor.neutral20 :AppColor.neutral140 : (buttonColor ?? AppColor.blueStatus(context)),
border: showBorder ? Border.all(color: textColor ?? AppColor.background(context)) : null,
),
child: loading

@ -188,7 +188,7 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
controller: widget.controller,
textInputAction: widget.textInputType == TextInputType.multiline ? null : widget.textInputAction ?? TextInputAction.next,
onEditingComplete: widget.onAction ?? () => FocusScope.of(context).nextFocus(),
style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500,color: AppColor.black10),
style: widget.style ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500,color:context.isDark?AppColor.white10: AppColor.black10),
onTap: widget.onTap,
decoration: InputDecoration(
alignLabelWithHint: widget.alignLabelWithHint,
@ -208,7 +208,7 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
? (widget.enableColor ?? AppColor.neutral40)
: AppColor.background(context)),
errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60),
floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? null : AppColor.neutral20),
floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20),
hintText: widget.hintText ?? "",
labelText: (widget.showSpeechToText && _speechToText.isListening) ? "Listening..." : widget.labelText ?? "",
labelStyle: widget.labelStyle,

@ -112,7 +112,7 @@ class _SingleItemDropDownMenuState<T extends Base, X extends LoadingListNotifier
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth),
decoration: BoxDecoration(
color: context.isDark && (widget.enabled == false || isEmpty)
? AppColor.neutral50
? AppColor.neutral20
: (widget.enabled == false || isEmpty)
? AppColor.neutral40
: widget.backgroundColor ?? AppColor.background(context),
@ -160,7 +160,7 @@ class _SingleItemDropDownMenuState<T extends Base, X extends LoadingListNotifier
value: value,
child: Text(
value.name ?? "", // Null-aware operator for value.name
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500, color: AppColor.black10),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500, color: context.isDark?AppColor.white10: AppColor.black10),
),
);
}).toList(),

@ -27,18 +27,19 @@ class TabButton extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
color: isSelected ? AppColor.primary10 : AppColor.white30,
color: isSelected ? AppColor.primary10 : AppColor.background(context),
border: !isSelected ? Border.all(color: AppColor.white936.withOpacity(.03), width: 1) : null,
),
alignment: Alignment.center,
child: Text(
label,
style: AppTextStyles.bodyText2.copyWith(
color: isSelected ? Colors.white : AppColor.black35,
//AppColor.background(context)
color: isSelected ? Colors.white :AppColor.textColor(context) ,
),
),
),
),
).toShimmer(isShow: loading && isSelected, radius: 7);
).toShimmer(isShow: loading && isSelected, radius: 7,context: context);
}
}

@ -11,6 +11,7 @@ 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/user_types.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/new_models/gas_refill_model.dart';
import 'package:test_sa/models/new_models/mapped_sites.dart';
@ -43,7 +44,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
Lookup? _requestedQuantity;
final TextEditingController _commentController = TextEditingController();
GasRefillProvider? _gasRefillProvider;
List<File> _files = [];
List<GenericAttachmentModel> attachments = [];
static List<Lookup> gasQuantity = [
Lookup(name: "1", id: 1, value: 1),
@ -80,7 +81,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
context: context,
title: context.translation.gasType,
initialValue: _currentDetails.gasType,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
onSelect: (value) {
@ -92,7 +93,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
context: context,
title: context.translation.cylinderType,
initialValue: _currentDetails.cylinderType,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
onSelect: (value) {
_currentDetails.cylinderType = value;
@ -104,7 +105,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
title: context.translation.cylinderSize,
initialValue: _currentDetails.cylinderSize,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
onSelect: (value) {
_currentDetails.cylinderSize = value;
@ -117,7 +118,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
showAsBottomSheet: true,
initialValue: _requestedQuantity,
staticData: gasQuantity,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
onSelect: (value) {
_requestedQuantity = value;
@ -132,7 +133,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
title: context.translation.site,
initialValue: _gasModel.mapSite,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
onSelect: (value) {
setState(() {
@ -151,7 +152,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
enabled: _gasModel.mapSite?.buildings?.isNotEmpty ?? false,
staticData: _gasModel.mapSite?.buildings ?? [],
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
onSelect: (value) {
setState(() {
@ -173,7 +174,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
enabled: _gasModel.mappedBuilding?.floors?.isNotEmpty ?? false,
staticData: _gasModel.mappedBuilding?.floors ?? [],
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
onSelect: (value) {
setState(() {
@ -190,7 +191,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
enabled: _gasModel.mappedFloor?.departments?.isNotEmpty ?? false,
staticData: _gasModel.mappedFloor?.departments ?? [],
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
onSelect: (value) {
_gasModel.mappedDepartment = value;
@ -201,10 +202,10 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
8.height,
AppTextFormField(
labelText: context.translation.callComments,
labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral120),
labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.textColor(context)),
textInputType: TextInputType.multiline,
alignLabelWithHint: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
controller: _commentController,
onChange: (value) {
@ -213,9 +214,9 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
onSaved: (value) {},
),
8.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachFiles,
files: _files,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -224,7 +225,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
).toShadowContainer(context, padding: 10).paddingOnly(start: 16, end: 16, top: 16),
).expanded,
16.height,
FooterActionButton.footerContainer(child: AppFilledButton(label: context.translation.submitRequest, maxWidth: true, onPressed: _submit)),
FooterActionButton.footerContainer(context: context, child: AppFilledButton(label: context.translation.submitRequest, maxWidth: true, onPressed: _submit)),
],
),
);
@ -235,9 +236,10 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
_gasModel.gasRefillDetails = [];
_gasModel.gasRefillDetails?.add(_currentDetails);
_gasModel.gasRefillAttachments = [];
for (var item in _files) {
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??'';
_gasModel.gasRefillAttachments?.add(GasRefillAttachments(
id: 0, gasRefillId: _gasModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path));
id: item.id, gasRefillId: _gasModel.id ?? 0, attachmentName: fileName));
}
await _gasRefillProvider?.addGasRefillRequest(
context: context,
@ -380,7 +382,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
// Lookup? _requestedQuantity;
// final TextEditingController _commentController = TextEditingController();
// GasRefillProvider? _gasRefillProvider;
// List<File> _files = [];
// List<File> attachments = [];
//
// static List<Lookup> gasQuantity = [
// Lookup(name: "1", id: 1, value: 1),
@ -397,7 +399,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
// _currentDetails = widget.gasRefillDetails ?? GasRefillDetails();
// _gasModel = widget.gasModel ?? GasRefillModel(gasRefillDetails: []);
// if (_gasModel.gasRefillAttachments != null && _gasModel.gasRefillAttachments!.isNotEmpty) {
// _files.addAll(_gasModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList());
// attachments.addAll(_gasModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList());
// }
// if (widget.gasRefillDetails != null && widget.gasRefillDetails?.requestedQty != null) {
// _requestedQuantity = Lookup(name: "1", id: 1, value: int.parse(widget.gasRefillDetails!.requestedQty!.toStringAsFixed(0)));
@ -561,7 +563,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
// 8.height,
// MultiFilesPicker(
// label: context.translation.attachFiles,
// files: _files,
// files: attachments,
// buttonColor: AppColor.black10,
// onlyImages: false,
// buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -582,7 +584,7 @@ class _GasRefillRequestFormState extends State<GasRefillRequestForm> {
// _gasModel.gasRefillDetails = [];
// _gasModel.gasRefillDetails?.add(_currentDetails);
// _gasModel.gasRefillAttachments = [];
// for (var item in _files) {
// for (var item in attachments) {
// _gasModel.gasRefillAttachments?.add(GasRefillAttachments(
// id: 0, gasRefillId: _gasModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path));
// }

@ -79,7 +79,7 @@ class _MonthlyFragmentState extends State<MonthlyFragment> {
orElse: null,
) !=
null,
).toShimmer(isShow: snapshot.isCalendarLoading);
).toShimmer(isShow: snapshot.isCalendarLoading, context: context);
},
),
daysOfWeekHeight: 35.toScreenHeight,

@ -23,6 +23,7 @@ class CreateRequestTypeBottomSheet extends StatelessWidget {
return Container(
padding: const EdgeInsets.all(16.0),
width: double.infinity,
color: AppColor.background(context),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
@ -63,13 +64,13 @@ class CreateRequestTypeBottomSheet extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Icon(
Icon(
Icons.add_circle,
color: AppColor.neutral120,
color: AppColor.iconColor(context),
size: 32,
),
//24.height,
label.bodyText2(context).custom(color: AppColor.black20),
label.bodyText2(context).custom(color:context.isDark?Colors.white: AppColor.black20),
],
),
),

@ -107,11 +107,11 @@ class _LoginPageState extends State<LoginPage> {
AppTextFormField(
initialValue: _user.userName ?? "",
controller: userNameController,
backgroundColor: AppColor.white20,
backgroundColor: AppColor.fieldBgColor(context),
validator: (value) => Validator.hasValue(value!) ? null : context.translation.requiredField,
labelText: context.translation.username,
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff3B3D4A)),
labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: Color(0xff767676)),
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color:context .isDark?Colors.white: const Color(0xff3B3D4A)),
labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color:context .isDark?Colors.white:const Color(0xff767676)),
textInputType: TextInputType.text,
showWithoutDecoration: true,
contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight),
@ -124,9 +124,9 @@ class _LoginPageState extends State<LoginPage> {
initialValue: _user.password ?? "",
showWithoutDecoration: true,
labelText: context.translation.password,
backgroundColor: AppColor.white20,
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: Color(0xff3B3D4A)),
labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: Color(0xff767676)),
backgroundColor: AppColor.fieldBgColor(context),
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 12, color: context .isDark?Colors.white: const Color(0xff3B3D4A)),
labelStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 11, color: context .isDark?Colors.white: const Color(0xff767676)),
contentPadding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 12.toScreenHeight),
obscureText: !_passwordVisible,
suffixIcon: Icon(

@ -21,7 +21,7 @@ class AcknowledgeWorkDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Dialog(
backgroundColor: Colors.white,
backgroundColor: AppColor.background(context),
shape: const RoundedRectangleBorder(),
insetPadding: const EdgeInsets.only(left: 21, right: 21),
child: Padding(
@ -30,11 +30,11 @@ class AcknowledgeWorkDialog extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
const Text(
Text(
"Confirm",
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Colors.black87, height: 35 / 24, letterSpacing: -0.96),
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: AppColor.headingTextColor(context), height: 35 / 24, letterSpacing: -0.96),
).paddingOnly(top: 16, bottom: 8),
message != null ? message!.heading5(context).custom(color: AppColor.neutral50) : const SizedBox(),
message != null ? message!.heading5(context).custom(color: AppColor.textColor(context)) : const SizedBox(),
28.height,
Row(
children: [

@ -14,9 +14,11 @@ import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/device/asset_transfer_attachment.dart';
import 'package:test_sa/models/device/device_transfer.dart';
import 'package:test_sa/models/enums/user_types.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/new_models/department.dart';
import 'package:test_sa/models/new_models/floor.dart';
import 'package:test_sa/models/service_request/pending_service_request_model.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_text_form_field.dart';
@ -49,7 +51,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
Asset _assetDestination = Asset();
Asset? _pickedAsset;
final List<File> _deviceImages = [];
final List<GenericAttachmentModel> attachments = [];
bool isInternal = true;
PendingAssetServiceRequest? pendingAssetServiceRequest;
@ -77,8 +79,9 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
}
_formKey.currentState!.save();
List<AssetTransferAttachment> attachement = [];
for (var item in _deviceImages) {
attachement.add(AssetTransferAttachment(id: 0, attachmentName: "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}"));
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??'';
attachement.add(AssetTransferAttachment(id: item.id, attachmentName: fileName));
}
_transferModel.attachments = attachement;
@ -144,7 +147,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
21.height,
requestTypeWidget(context),
12.height,
"Destination".bodyText(context).custom(color: AppColor.white936),
"Destination".bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936),
12.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -156,7 +159,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
showShadow: false,
loading: _deviceTransferProvider.isSiteLoading,
enabled: !isInternal,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showAsBottomSheet: true,
onSelect: (value) {
_assetDestination.site = value;
@ -173,7 +176,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
initialValue: _assetDestination.building,
showShadow: false,
showAsBottomSheet: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.site?.buildings?.isNotEmpty ?? false,
staticData: _assetDestination.site?.buildings ?? [],
onSelect: (value) {
@ -195,7 +198,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.floor,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.building?.floors?.isNotEmpty ?? false,
staticData: _assetDestination.building?.floors ?? [],
onSelect: (value) {
@ -211,7 +214,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.department,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
enabled: _assetDestination.floor?.departments?.isNotEmpty ?? false,
staticData: _assetDestination.floor?.departments ?? [],
onSelect: (value) {
@ -224,9 +227,9 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
),
8.height,
AppTextFormField(
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
labelText: context.translation.callComments,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.textColor(context)),
alignLabelWithHint: true,
textInputType: TextInputType.multiline,
showShadow: false,
@ -236,9 +239,9 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
),
8.height,
23.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachImage,
files: _deviceImages,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -248,6 +251,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
).toShadowContainer(context).paddingOnly(top: 20, start: 16, end: 16),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: AppFilledButton(buttonColor: AppColor.primary10, label: context.translation.submitRequest, maxWidth: true, onPressed: _onSubmit),
),
],
@ -269,7 +273,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
context.translation.requestType.bodyText(context).custom(color: AppColor.white936),
context.translation.requestType.bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936),
8.height,
Wrap(
runSpacing: 8,
@ -306,7 +310,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
],
)
],
).toShimmer(isShow: snapshot.loading),
).toShimmer(isShow: snapshot.loading,context: context),
],
);
});

@ -13,6 +13,7 @@ import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/helper/utils.dart';
import 'package:test_sa/models/device/asset_transfer_attachment.dart';
import 'package:test_sa/models/device/device_transfer.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/new_models/assigned_employee.dart';
import 'package:test_sa/models/new_models/assistant_employee.dart';
import 'package:test_sa/models/timer_model.dart';
@ -53,7 +54,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
List<File> _files = [];
List<GenericAttachmentModel> attachments = [];
_update({required int status}) async {
_formKey.currentState!.save();
@ -110,13 +111,9 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
_formModel.assetTransferEngineerTimers = _formModel.receiverVisitTimers;
}
try {
for (var file in _files) {
String attachmentName = file.path;
if (attachmentName.contains("/")) {
attachmentName = file.path.split("/").last;
attachmentName = "$attachmentName|${base64Encode(file.readAsBytesSync())}";
}
_formModel.assetTransferAttachments!.add(AssetTransferAttachment(id: 0, attachmentName: attachmentName));
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
_formModel.assetTransferAttachments!.add(AssetTransferAttachment(id: item.id, attachmentName: fileName));
_formModel.attachments = _formModel.assetTransferAttachments;
}
} catch (error) {
@ -202,7 +199,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
@override
void initState() {
_formModel.fromDetails(widget.model);
_files = widget.model.assetTransferAttachments?.map((e) => File(e.attachmentName!)).toList() ?? [];
attachments = widget.model.assetTransferAttachments?.map((e) => GenericAttachmentModel(id: e.id?.toInt()??0, name: e.attachmentName!)).toList() ?? [];
super.initState();
}
@ -251,9 +248,10 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
AppTextFormField(
initialValue: widget.isSender ? _formModel.senderComment ?? "" : _formModel.receiverComment ?? "",
labelText: context.translation.technicalComment,
labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral20),
hintStyle: AppTextStyles.tinyFont.copyWith(color: context.isDark?AppColor.white10:AppColor.black10),
labelStyle: AppTextStyles.tinyFont.copyWith(color: context.isDark?AppColor.white10:AppColor.black10),
textInputType: TextInputType.multiline,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
alignLabelWithHint: true,
onSaved: (value) {
@ -261,9 +259,9 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
},
),
8.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachFiles,
files: _files,
attachment: attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -274,8 +272,8 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
16.height,
DeviceTransferAssistantEmployeeList(
assetId: _formModel.assetId,
createdDate: _formModel.createdDate??'',
assistantEmployeeList: widget.isSender?_formModel.assetTransferAssistantEmployeesSender:_formModel.assetTransferAssistantEmployeesReceiver,
createdDate: _formModel.createdDate ?? '',
assistantEmployeeList: widget.isSender ? _formModel.assetTransferAssistantEmployeesSender : _formModel.assetTransferAssistantEmployeesReceiver,
cardPadding: 0,
onListChanged: (updatedList) {
setState(() {
@ -287,13 +285,14 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
AppFilledButton(
label: context.translation.save,
buttonColor: AppColor.white60,
textColor: AppColor.black10,
buttonColor: context.isDark?AppColor.neutral70:AppColor.white60,
textColor: context.isDark?AppColor.white10:AppColor.black10,
onPressed: () => _update(status: 0),
).expanded,
12.width,
@ -343,7 +342,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
width: double.infinity,
enabled: isTimerEnable,
decoration: BoxDecoration(
color: AppColor.neutral100,
color: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
),
pickerTimer: _formModel.deviceTimePicker,
@ -370,7 +369,7 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
8.width,
Text(
ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()),
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
style: AppTextStyles.bodyText.copyWith(color: context.isDark?AppColor.white10: AppColor.neutral50, fontWeight: FontWeight.w600),
),
],
),
@ -380,14 +379,10 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
}
}
class DeviceTransferAssistantEmployeeList extends StatefulWidget {
final List<AssetTransferAssistantEmployees>? assistantEmployeeList;
final ValueChanged<List<AssetTransferAssistantEmployees>>? onListChanged;
final double ?cardPadding;
final double? cardPadding;
final dynamic assetId;
final String createdDate;
@ -443,13 +438,13 @@ class _DeviceTransferAssistantEmployeeListState extends State<DeviceTransferAssi
itemCount: _list.length + 1,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: EdgeInsets.all(widget.cardPadding??16),
padding: EdgeInsets.all(widget.cardPadding ?? 16),
itemBuilder: (context, index) {
if (index == _list.length) {
return AppFilledButton(
label: "Add Assistant Employee".addTranslation,
maxWidth: true,
textColor: AppColor.black10,
textColor: AppColor.textColor(context),
buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10,
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
showIcon: true,
@ -462,7 +457,7 @@ class _DeviceTransferAssistantEmployeeListState extends State<DeviceTransferAssi
id: _list[index].employeeId,
name: _list[index].employeeName,
);
selectedEmployee = AssistantEmployees( userId: assignedUser.id, user: assignedUser);
selectedEmployee = AssistantEmployees(userId: assignedUser.id, user: assignedUser);
return EmployeeCard(
model: _list[index],
assetId: widget.assetId,
@ -478,16 +473,17 @@ class _DeviceTransferAssistantEmployeeListState extends State<DeviceTransferAssi
}
}
class EmployeeCard extends StatelessWidget {
final AssetTransferAssistantEmployees model;
final int index;
final dynamic assetId ;
final String ? createdDate;
final dynamic assetId;
final String? createdDate;
AssistantEmployees? selectedEmployee;
final void Function(void Function(AssetTransferAssistantEmployees model)) onUpdate;
final VoidCallback onRemove;
final TextEditingController workingHoursController;
EmployeeCard({
super.key,
required this.model,
@ -503,13 +499,12 @@ class EmployeeCard extends StatelessWidget {
// AssistantEmployees selectedEmployee = AssistantEmployees();
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
context.translation.assistantEmployee.bodyText(context).custom(color: AppColor.black20),
context.translation.assistantEmployee.bodyText(context).custom(color: AppColor.textColor(context)),
Container(
height: 32,
width: 32,
@ -524,8 +519,8 @@ class EmployeeCard extends StatelessWidget {
children: [
ServiceReportAssistantEmployeeMenu(
title: context.translation.select,
backgroundColor: AppColor.neutral100,
assetId:assetId,
backgroundColor: AppColor.fieldBgColor(context),
assetId: assetId,
initialValue: selectedEmployee,
onSelect: (employee) {
if (employee != null) {
@ -548,7 +543,7 @@ class EmployeeCard extends StatelessWidget {
ADatePicker(
label: context.translation.startTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: model.startDate,
formatDateWithTime: true,
from: DateTime.tryParse(createdDate ?? ''),
@ -593,7 +588,7 @@ class EmployeeCard extends StatelessWidget {
ADatePicker(
label: context.translation.endTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
date: model.endDate,
formatDateWithTime: true,
from: DateTime.tryParse(createdDate ?? ''),
@ -639,7 +634,7 @@ class EmployeeCard extends StatelessWidget {
8.height,
AppTextFormField(
labelText: context.translation.workingHours,
backgroundColor: AppColor.neutral80,
backgroundColor: AppColor.fieldBgColor(context),
controller: workingHoursController,
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
textAlign: TextAlign.center,
@ -652,9 +647,9 @@ class EmployeeCard extends StatelessWidget {
AppTextFormField(
initialValue: model.techComment,
labelText: context.translation.technicalComment,
backgroundColor: AppColor.neutral100,
backgroundColor:AppColor.fieldBgColor(context),
showShadow: false,
labelStyle: AppTextStyles.textFieldLabelStyle,
labelStyle: AppTextStyles.textFieldLabelStyle.copyWith(color: context.isDark?AppColor.white10:AppColor.black10),
alignLabelWithHint: true,
textInputType: TextInputType.multiline,
onChange: (value) => onUpdate((model) => model.techComment = value),
@ -664,8 +659,7 @@ class EmployeeCard extends StatelessWidget {
],
)
],
).toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 16, vertical: 12))
.paddingOnly(bottom: 12);
).toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 16, vertical: 12)).paddingOnly(bottom: 12);
}
}

@ -11,6 +11,7 @@ import 'package:test_sa/controllers/providers/api/user_provider.dart';
import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/lookup.dart';
import 'package:test_sa/models/timer_model.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
@ -56,7 +57,7 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
bool _firstTime = true;
Lookup? _deliveredQuantity;
List<File> _attachments = [];
List<GenericAttachmentModel> _attachments = [];
static List<Lookup> deliveredQuantity = [
Lookup(name: "1", id: 1, value: 1),
@ -82,7 +83,7 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
} catch (ex) {}
}
if (_formModel.gasRefillAttachments != null && _formModel.gasRefillAttachments!.isNotEmpty) {
_attachments.addAll(_formModel.gasRefillAttachments!.map((e) => File(e.attachmentName!)).toList());
_attachments.addAll(_formModel.gasRefillAttachments!.map((e) => GenericAttachmentModel(id:e.id,name:e.attachmentName!)).toList());
}
}
@ -153,8 +154,9 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
});
_formModel.gasRefillAttachments = [];
for (var item in _attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??'';
_formModel.gasRefillAttachments?.add(GasRefillAttachments(
id: 0, gasRefillId: _formModel.id ?? 0, attachmentName: ServiceRequestUtils.isLocalUrl(item.path) ? "${item.path.split("/").last}|${base64Encode(item.readAsBytesSync())}" : item.path));
id: item.id, gasRefillId: _formModel.id ?? 0, attachmentName: fileName));
}
await _gasRefillProvider?.updateGasRefill(status: status, model: _formModel).then((success) {
@ -231,7 +233,7 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
SingleItemDropDownMenu<Lookup, NullableLoadingProvider>(
context: context,
title: context.translation.quantity,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
initialValue: _deliveredQuantity,
@ -247,8 +249,10 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
AppTextFormField(
labelText: context.translation.technicalComment,
textInputType: TextInputType.multiline,
hintStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10),
labelStyle: TextStyle(color: context.isDark?AppColor.white10:AppColor.black10),
alignLabelWithHint: true,
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
controller: _commentController,
onChange: (value) {
@ -257,9 +261,9 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
onSaved: (value) {},
),
16.height,
MultiFilesPicker(
AttachmentPicker(
label: context.translation.attachFiles,
files: _attachments,
attachment: _attachments,
buttonColor: AppColor.black10,
onlyImages: false,
buttonIcon: 'image-plus'.toSvgAsset(color: AppColor.neutral120),
@ -269,13 +273,14 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
).toShadowContainer(context),
).expanded,
FooterActionButton.footerContainer(
context: context,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
AppFilledButton(
label: context.translation.save,
buttonColor: AppColor.white60,
textColor: AppColor.black10,
buttonColor: context.isDark?AppColor.neutral70:AppColor.white60,
textColor: context.isDark?AppColor.white10:AppColor.black10,
onPressed: () => _onSubmit(context, 0),
).expanded,
12.width,
@ -289,6 +294,7 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
),
],
)),
),
).handlePopScope(
cxt: context,
@ -311,7 +317,8 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
},
width: double.infinity,
decoration: BoxDecoration(
color: AppColor.neutral100,
color: AppColor.fieldBgColor(context),
// color: AppColor.neutral100,
borderRadius: BorderRadius.circular(10),
),
timerProgress: (isRunning) {},
@ -330,7 +337,7 @@ class _UpdateGasRefillRequestState extends State<UpdateGasRefillRequest> {
8.width,
Text(
ServiceRequestUtils.formatTimerDuration(totalWorkingHours.round()),
style: AppTextStyles.bodyText.copyWith(color: AppColor.neutral50, fontWeight: FontWeight.w600),
style: AppTextStyles.bodyText.copyWith(color:context.isDark?AppColor.white10: AppColor.neutral50, fontWeight: FontWeight.w600),
),
],
),

@ -175,7 +175,7 @@ class _ProfilePageState extends State<ProfilePage> {
16.height,
AppFilledButton(
label: "Update Information",
buttonColor: AppColor.neutral50,
buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50,
onPressed: () {
context.showBottomSheet(
UpdateUserContactInfoBottomSheet(

@ -10,8 +10,10 @@ 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/widget_extensions.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/service_request/pending_service_request_model.dart';
import 'package:test_sa/models/service_request/service_request.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/providers/service_request_providers/equipment_status_provider.dart';
import 'package:test_sa/providers/service_request_providers/requested_through_provider.dart';
@ -45,7 +47,7 @@ class CreateServiceRequestPageState extends State<CreateServiceRequestPage> {
late SettingProvider _settingProvider;
late ServiceRequestsProvider _serviceRequestsProvider;
late ServiceRequest _serviceRequest;
final List<File> _deviceImages = [];
final List<GenericAttachmentModel> attachments = [];
final bool _isLoading = false;
bool _showDatePicker = false;
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@ -59,7 +61,7 @@ class CreateServiceRequestPageState extends State<CreateServiceRequestPage> {
_commentController = TextEditingController();
if (widget.serviceRequest != null) {
_serviceRequest = widget.serviceRequest!;
_deviceImages.addAll(_serviceRequest.devicePhotos!.map((e) => File(e)).toList());
attachments.addAll(_serviceRequest.devicePhotos!.map((e) => GenericAttachmentModel(name: e)).toList());
_showDatePicker = _serviceRequest.firstAction != null && _serviceRequest.firstAction?.name == "Need a visit";
if (_showDatePicker && _serviceRequest.visitDate != null) {
_dateTime = DateTime.tryParse(_serviceRequest.visitDate!);
@ -77,7 +79,7 @@ class CreateServiceRequestPageState extends State<CreateServiceRequestPage> {
// ServiceRequest request = await _serviceRequestsProvider.getServiceRequestObjectById(requestId: id) ?? "";
// _serviceRequest = request;
// _device = _serviceRequest.device;
// _deviceImages.addAll(_serviceRequest.devicePhotos.map((e) {
// attachments.addAll(_serviceRequest.devicePhotos.map((e) {
// return File(e);
// }).toList());
// _showDatePicker = _serviceRequest.firstAction != null && _serviceRequest.firstAction.name == "Need a visit";
@ -190,7 +192,7 @@ class CreateServiceRequestPageState extends State<CreateServiceRequestPage> {
_serviceRequest.priority = snapshot.items.firstWhere((element) => element.value == 0, orElse: null);
}
setState(() {});
}).toShimmer(isShow: snapshot.loading),
}).toShimmer(isShow: snapshot.loading,context: context),
);
}),
],
@ -239,12 +241,12 @@ class CreateServiceRequestPageState extends State<CreateServiceRequestPage> {
],
)
],
).toShimmer(isShow: snapshot.loading),
).toShimmer(isShow: snapshot.loading,context: context),
],
);
}),
16.height,
MultiFilesPicker(label: context.translation.attachImage, files: _deviceImages, showAsGrid: true),
AttachmentPicker(label: context.translation.attachImage, attachment: attachments, showAsGrid: true),
],
).toShadowContainer(context),
@ -386,7 +388,8 @@ class CreateServiceRequestPageState extends State<CreateServiceRequestPage> {
// return;
// }
_serviceRequest.devicePhotos = _deviceImages.map((e) => _isLocalUrl(e.path) ? "${e.path.split("/").last}|${base64Encode(e.readAsBytesSync())}" : e.path).toList();
_serviceRequest.devicePhotos = attachments.map((item) => ServiceRequestUtils.isLocalUrl(item.name??'') ? "${item.name?.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}" : item.name??'').toList();
if (_serviceRequest.audio != null) {
if (_isLocalUrl(_serviceRequest.audio!)) {
final File file = File(_serviceRequest.audio!);

@ -14,8 +14,10 @@ import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/device/asset.dart';
import 'package:test_sa/models/generic_attachment_model.dart';
import 'package:test_sa/models/service_request/service_report.dart';
import 'package:test_sa/models/service_request/service_request.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/providers/service_request_providers/equipment_status_provider.dart';
import 'package:test_sa/providers/service_request_providers/loan_availability_provider.dart';
@ -61,7 +63,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
bool _isLoading = false;
List<SparePart> _spareParts = [];
final List<File> _files = [];
final List<GenericAttachmentModel> attachments = [];
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
final TextEditingController _faultController = TextEditingController();
@ -363,7 +365,7 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
},
),
8.height,
MultiFilesPicker(label: context.translation.attachImage, files: _files),
AttachmentPicker(label: context.translation.attachImage, attachment: attachments),
8.height,
ESignature(
title: context.translation.engSign,
@ -407,9 +409,10 @@ class _CreateServiceReportState extends State<CreateServiceReport> with TickerPr
}
_formKey.currentState!.save();
_serviceReport.attachmentsWorkOrder ??= [];
if (_files.isEmpty) _serviceReport.attachmentsWorkOrder = [];
for (var file in _files) {
_serviceReport.attachmentsWorkOrder!.add(Attachment(id: 0, name: "${file.path.split("/").last}|${base64Encode(file.readAsBytesSync())}"));
if (attachments.isEmpty) _serviceReport.attachmentsWorkOrder = [];
for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??'';
_serviceReport.attachmentsWorkOrder!.add(Attachment(id: item.id, name: fileName));
}
final user = Provider.of<UserProvider>(context, listen: false).user!;
await _serviceRequestsProvider.createServiceReport(context, report: _serviceReport, request: widget.request, user: user);

@ -50,7 +50,7 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
children: [
AppTextFormField(
labelText: "Email",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uEmail,
textAlign: TextAlign.center,
hintText: "email@example.com",
@ -66,7 +66,7 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
12.height,
AppTextFormField(
labelText: "Phone Number",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uPhoneNo,
textAlign: TextAlign.center,
hintText: "05xxxxxxxx",
@ -82,7 +82,7 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
12.height,
AppTextFormField(
labelText: "Extension No",
backgroundColor: AppColor.neutral100,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: widget.uExtensionNo,
textAlign: TextAlign.center,
hintText: "1234",
@ -98,7 +98,7 @@ class _UpdateUserContactInfoBottomSheetState extends State<UpdateUserContactInfo
12.height,
AppFilledButton(
label: "Update",
buttonColor: AppColor.neutral50,
buttonColor: context.isDark? AppColor.primary10:AppColor.neutral50,
onPressed: () async {
FocusManager.instance.primaryFocus!.unfocus();
if (email.isEmpty || !Validator.isEmail(email)) {

@ -47,6 +47,7 @@ class _SelectionBottomSheetState<T> extends State<SelectionBottomSheet<T>> {
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * .7,
color: Theme.of(context).scaffoldBackgroundColor,
padding: const EdgeInsets.all(21),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -94,6 +95,9 @@ class _SelectionBottomSheetState<T> extends State<SelectionBottomSheet<T>> {
decoration: InputDecoration(
hintText: 'Search by name',
labelText: 'Search',
labelStyle: TextStyle(color: AppColor.textColor(context)),
filled: true,
fillColor: AppColor.fieldBgColor(context),
hintStyle: const TextStyle(fontSize: 14),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: AppColor.blueStatus(context), width: 2.0),
@ -112,13 +116,24 @@ class _SelectionBottomSheetState<T> extends State<SelectionBottomSheet<T>> {
child: ListView.builder(
itemCount: filteredList?.length,
padding: const EdgeInsets.only(top: 8),
itemBuilder: (cxt, index) => RadioListTile<T>(
itemBuilder: (cxt, index) => Theme(
data: Theme.of(context).copyWith(
radioTheme: RadioThemeData(
fillColor: MaterialStateColor.resolveWith((states) {
if (states.contains(MaterialState.selected)) {
return AppColor.textColor(context); // Active color
}
return Colors.grey; // Inactive color
}),
),
),
child: RadioListTile<T>(
// Specify type for RadioListTile
value: filteredList![index],
dense: true,
contentPadding: EdgeInsets.zero,
groupValue: _selectedValue,
activeColor: Colors.black87,
activeColor: AppColor.textColor(context),
onChanged: (value) {
_selectedValue = value;
searchFocusNode.unfocus();
@ -131,6 +146,7 @@ class _SelectionBottomSheetState<T> extends State<SelectionBottomSheet<T>> {
),
),
),
),
8.height,
if (_selectedValue != null)
AppFilledButton(

@ -164,7 +164,7 @@ class AssetPicker extends StatelessWidget {
color: Colors.black87,
decoration: TextDecoration.none,
),
).toShimmer(isShow: showLoading).expanded,
).toShimmer(isShow: showLoading,context: context).expanded,
const Icon(
Icons.info,
color: Color(0xff7D859A),
@ -195,10 +195,10 @@ class AssetPicker extends StatelessWidget {
],
),
8.height,
"${context.translation.assetNo}: ${device!.assetNumber}".bodyText2(context).toShimmer(isShow: showLoading),
"${context.translation.assetNo}: ${device!.assetNumber}".bodyText2(context).toShimmer(isShow: showLoading,context: context),
2.height,
// "${context.translation.manufacture}: ${device.modelDefinition?.manufacturerName}".bodyText(context),
"${context.translation.model}: ${device!.modelDefinition?.modelName}".bodyText2(context).toShimmer(isShow: showLoading),
"${context.translation.model}: ${device!.modelDefinition?.modelName}".bodyText2(context).toShimmer(isShow: showLoading,context: context),
// "${context.translation.serialNumber}: ${device.assetNumber}".bodyText(context),
// const Divider().defaultStyle(context),
// "${context.translation.department}: ${device.department?.departmentName}".bodyText(context),

@ -84,12 +84,15 @@ class _SelectionBottomSheetState<T> extends State<SelectionFullScreenDialog<T>>
SearchBar(
focusNode: searchFocusNode,
elevation: WidgetStateProperty.all<double>(0),
leading: const Icon(Icons.search, color: AppColor.neutral50),
backgroundColor: WidgetStateProperty.all<Color>(
AppColor.fieldBgColor(context), // Your custom background color
),
leading: Icon(Icons.search, color: AppColor.iconColor(context)),
textStyle: WidgetStateProperty.all<TextStyle>(
const TextStyle(color: AppColor.neutral50, fontSize: 16.0),
TextStyle(color: AppColor.textColor(context), fontSize: 16.0),
),
hintStyle: WidgetStateProperty.all<TextStyle>(
const TextStyle(color: AppColor.neutral20, fontSize: 14.0),
TextStyle(color: AppColor.textColor(context), fontSize: 14.0),
),
hintText: 'Search by name',
onChanged: (queryString) {
@ -102,13 +105,24 @@ class _SelectionBottomSheetState<T> extends State<SelectionFullScreenDialog<T>>
child: ListView.builder(
itemCount: filteredList?.length,
padding: EdgeInsets.zero,
itemBuilder: (cxt, index) => RadioListTile<T>(
itemBuilder: (cxt, index) =>Theme(
data: Theme.of(context).copyWith(
radioTheme: RadioThemeData(
fillColor: MaterialStateColor.resolveWith((states) {
if (states.contains(MaterialState.selected)) {
return AppColor.iconColor(context); // Active color
}
return Colors.grey; // Inactive color
}),
),
),
child: RadioListTile<T>(
// Specify type for RadioListTile
value: filteredList![index],
dense: true,
contentPadding: const EdgeInsets.only(left: 16, right: 16),
groupValue: _selectedValue,
activeColor: Colors.black87,
activeColor: AppColor.iconColor(context),
hoverColor: Colors.transparent,
onChanged: (value) {
_selectedValue = value;
@ -122,6 +136,7 @@ class _SelectionBottomSheetState<T> extends State<SelectionFullScreenDialog<T>>
),
),
),
),
8.height,
if (_selectedValue != null)
FooterActionButton.footerContainer(

@ -8,6 +8,7 @@ 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/generic_attachment_model.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import '../../../new_views/common_widgets/app_dashed_button.dart';
@ -17,7 +18,7 @@ class MultiFilesPicker extends StatefulWidget {
final String label;
final bool error;
final List<File> files;
final List<AttachmentModel> attachment;
final List<GenericAttachmentModel> attachment;
final bool enabled, onlyImages;
double? buttonHeight;
@ -29,7 +30,7 @@ class MultiFilesPicker extends StatefulWidget {
MultiFilesPicker(
{Key? key,
this.files = const <File>[],
this.attachment = const <AttachmentModel>[],
this.attachment = const <GenericAttachmentModel>[],
required this.label,
this.error = false,
this.buttonHeight,
@ -248,271 +249,272 @@ class AttachmentModel {
}
Map<String, dynamic> toJson() {
return {'id': id, 'file': file?.path};
return {
'id': id,
'file': file?.path,
};
}
}
// class AttachmentPicker extends StatefulWidget {
// final String label;
// final bool error;
// final List<AttachmentModel> attachment;
//
// final bool enabled, onlyImages;
// double? buttonHeight;
// Widget? buttonIcon;
// Color? buttonColor;
// final Function(List<AttachmentModel>)? onChange;
// final bool showAsGrid;
//
// AttachmentPicker(
// {Key? key,
// this.attachment = const <AttachmentModel>[],
// required this.label,
// this.error = false,
// this.buttonHeight,
// this.buttonIcon,
// this.enabled = true,
// this.onlyImages = false,
// this.onChange,
// this.showAsGrid = false,
// this.buttonColor})
// : super(key: key);
//
// @override
// State<AttachmentPicker> createState() => _AttachmentPickerState();
// }
//
// class _AttachmentPickerState extends State<AttachmentPicker> {
// @override
// Widget build(BuildContext context) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// AppDashedButton(
// title: widget.label,
// height: widget.buttonHeight,
// buttonColor: widget.buttonColor,
// icon: widget.buttonIcon,
// onPressed: (widget.enabled == false)
// ? () {}
// : widget.showAsGrid
// ? showFileSourceSheet
// : onFilePicker),
// 16.height,
// if (widget.attachment.isNotEmpty)
// Wrap(
// spacing: 8.toScreenWidth,
// children: List.generate(
// widget.attachment.length,
// (index) {
// File image = widget.attachment[index].file!;
// return MultiFilesPickerItem(
// file: image,
// enabled: widget.enabled,
// onRemoveTap: (image) {
// if (!widget.enabled) {
// return;
// }
// widget.attachment.remove(image);
// if (widget.onChange != null) {
// widget.onChange!(widget.attachment);
// }
// setState(() {});
// },
// );
// },
// ),
// ),
// ],
// );
// }
//
// fromFilePicker() async {
// FilePickerResult? result = await FilePicker.platform.pickFiles(
// type: FileType.custom,
// allowMultiple: true,
// allowedExtensions: widget.onlyImages ? ['jpg', 'jpeg', 'png'] : ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xlsx', 'pptx'],
// );
// if (result != null) {
// for (var path in result.paths) {
// widget.attachment.add(AttachmentModel(0, File(path!)));
// }
// setState(() {});
// }
// }
//
// void showFileSourceSheet() async {
// if (widget.attachment.length >= 5) {
// Fluttertoast.showToast(msg: context.translation.maxImagesNumberIs5);
// return;
// }
//
// ImageSource source = (await showModalBottomSheet(
// context: context,
// shape: const RoundedRectangleBorder(
// borderRadius: BorderRadius.vertical(
// top: Radius.circular(20),
// ),
// ),
// clipBehavior: Clip.antiAliasWithSaveLayer,
// builder: (BuildContext context) => Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// "Attach File".heading4(context),
// 12.height,
// GridView(
// padding: const EdgeInsets.all(0),
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 12, mainAxisSpacing: 12),
// children: <Widget>[
// gridItem(Icons.camera_enhance_rounded, context.translation.pickFromCamera).onPress(() => Navigator.of(context).pop(ImageSource.camera)),
// gridItem(Icons.image_rounded, context.translation.pickFromGallery).onPress(() => Navigator.of(context).pop(ImageSource.gallery)),
// gridItem(Icons.file_present_rounded, context.translation.pickFromFiles).onPress(() async {
// await fromFilePicker();
// Navigator.pop(context);
// }),
// ],
// ),
// 12.height,
// ],
// ).paddingAll(21),
// )) as ImageSource;
//
// final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);
//
// if (pickedFile != null) {
// File fileImage = File(pickedFile.path);
// widget.attachment.add(AttachmentModel(0, fileImage));
// if (widget.onChange != null) {
// widget.onChange!(widget.attachment);
// }
// setState(() {});
// }
// }
//
// Widget gridItem(IconData iconData, String title) {
// return Container(
// padding: const EdgeInsets.all(12),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(12),
// border: Border.all(color: const Color(0xffF1F1F1), width: 1),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Icon(iconData, color: const Color(0xff7D859A), size: 36),
// Text(
// title,
// style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
// ),
// ],
// ),
// );
// }
//
// onFilePicker() async {
// if (widget.attachment.length >= 5) {
// Fluttertoast.showToast(msg: context.translation.maxImagesNumberIs5);
// return;
// }
// ImageSource? source = await showModalBottomSheet<ImageSource>(
// context: context,
// builder: (BuildContext context) {
// Widget listCard({required String icon, required String label, required VoidCallback onTap}) {
// return GestureDetector(
// onTap: onTap,
// child: Container(
// constraints: BoxConstraints(minWidth: 111.toScreenWidth, minHeight: 111.toScreenHeight),
// padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 12.toScreenHeight),
// decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(width: 1, color: AppColor.white70)),
// child: Column(
// mainAxisSize: MainAxisSize.min,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// icon.toSvgAsset(),
// 24.height,
// label.bodyText2(context).custom(color: AppColor.black20),
// ],
// ),
// ),
// );
// }
//
// return Container(
// padding: const EdgeInsets.all(16.0),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: <Widget>[
// listCard(
// icon: 'camera_icon',
// label: '${context.translation.open}\n${context.translation.camera}',
// onTap: () {
// Navigator.of(context).pop(ImageSource.camera);
// },
// ),
// listCard(
// icon: 'gallery_icon',
// label: '${context.translation.open}\n${context.translation.gallery}',
// onTap: () {
// Navigator.of(context).pop(ImageSource.gallery);
// },
// ),
// listCard(
// icon: 'file_icon',
// label: '${context.translation.open}\n${context.translation.files}',
// onTap: () async {
// await fromFilePicker();
// Navigator.pop(context);
// },
// ),
// ],
// ),
// );
// },
// );
// // ImageSource source = await showDialog(
// // context: context,
// // builder: (dialogContext) => CupertinoAlertDialog(
// // actions: <Widget>[
// // TextButton(
// // child: Text(context.translation.pickFromCamera),
// // onPressed: () {
// // Navigator.of(dialogContext).pop(ImageSource.camera);
// // },
// // ),
// // TextButton(
// // child: Text(context.translation.pickFromGallery),
// // onPressed: () {
// // Navigator.of(dialogContext).pop(ImageSource.gallery);
// // },
// // ),
// // TextButton(
// // child: Text(context.translation.pickFromFiles),
// // onPressed: () async {
// // await fromFilePicker();
// // Navigator.pop(context);
// // },
// // ),
// // ],
// // ),
// // );
// if (source == null) return;
//
// final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);
//
// if (pickedFile != null) {
// File fileImage = File(pickedFile.path);
// widget.attachment.add(AttachmentModel(0, fileImage));
// if (widget.onChange != null) {
// widget.onChange!(widget.attachment);
// }
// setState(() {});
// }
//
// setState(() {});
// }
// }
class AttachmentPicker extends StatefulWidget {
final String label;
final bool error;
final List<GenericAttachmentModel> attachment;
final bool enabled, onlyImages;
double? buttonHeight;
Widget? buttonIcon;
Color? buttonColor;
final Function(List<GenericAttachmentModel>)? onChange;
final bool showAsGrid;
AttachmentPicker(
{Key? key,
this.attachment = const <GenericAttachmentModel>[],
required this.label,
this.error = false,
this.buttonHeight,
this.buttonIcon,
this.enabled = true,
this.onlyImages = false,
this.onChange,
this.showAsGrid = false,
this.buttonColor})
: super(key: key);
@override
State<AttachmentPicker> createState() => _AttachmentPickerState();
}
class _AttachmentPickerState extends State<AttachmentPicker> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppDashedButton(
title: widget.label,
height: widget.buttonHeight,
buttonColor: widget.buttonColor,
icon: widget.buttonIcon,
onPressed: (widget.enabled == false)
? () {}
: widget.showAsGrid
? showFileSourceSheet
: onFilePicker),
16.height,
if (widget.attachment.isNotEmpty)
Wrap(
spacing: 8.toScreenWidth,
children: List.generate(
widget.attachment.length,
(index) {
File image = File(widget.attachment[index].name!);
return MultiFilesPickerItem(
file: image,
enabled: widget.enabled,
onRemoveTap: (image) {
if (!widget.enabled) {
return;
}
widget.attachment.removeAt(index);
if (widget.onChange != null) {
widget.onChange!(widget.attachment);
}
setState(() {});
},
);
},
),
),
],
);
}
fromFilePicker() async {
FilePickerResult? result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowMultiple: true,
allowedExtensions: widget.onlyImages ? ['jpg', 'jpeg', 'png'] : ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xlsx', 'pptx'],
);
if (result != null) {
for (var path in result.paths) {
widget.attachment.add(GenericAttachmentModel(id: 0,name: File(path!).path));
}
if (widget.onChange != null) {
widget.onChange!(widget.attachment);
}
setState(() {});
}
}
}
ImageSource source = (await showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20),
),
),
clipBehavior: Clip.antiAliasWithSaveLayer,
builder: (BuildContext context) => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
"Attach File".heading4(context),
12.height,
GridView(
padding: const EdgeInsets.all(0),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 1, crossAxisSpacing: 12, mainAxisSpacing: 12),
children: <Widget>[
gridItem(Icons.camera_enhance_rounded, context.translation.pickFromCamera).onPress(() => Navigator.of(context).pop(ImageSource.camera)),
gridItem(Icons.image_rounded, context.translation.pickFromGallery).onPress(() => Navigator.of(context).pop(ImageSource.gallery)),
gridItem(Icons.file_present_rounded, context.translation.pickFromFiles).onPress(() async {
await fromFilePicker();
Navigator.pop(context);
}),
],
),
12.height,
],
).paddingAll(21),
)) as ImageSource;
final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);
if (pickedFile != null) {
File fileImage = File(pickedFile.path);
widget.attachment.add(GenericAttachmentModel(id: 0,name: fileImage.path));
if (widget.onChange != null) {
widget.onChange!(widget.attachment);
}
setState(() {});
}
}
Widget gridItem(IconData iconData, String title) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: const Color(0xffF1F1F1), width: 1),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(iconData, color: const Color(0xff7D859A), size: 36),
Text(
title,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
),
],
),
);
}
onFilePicker() async {
if (widget.attachment.length >= 5) {
Fluttertoast.showToast(msg: context.translation.maxImagesNumberIs5);
return;
}
ImageSource? source = await showModalBottomSheet<ImageSource>(
context: context,
builder: (BuildContext context) {
Widget listCard({required String icon, required String label, required VoidCallback onTap}) {
return GestureDetector(
onTap: onTap,
child: Container(
constraints: BoxConstraints(minWidth: 111.toScreenWidth, minHeight: 111.toScreenHeight),
padding: EdgeInsets.symmetric(horizontal: 12.toScreenWidth, vertical: 12.toScreenHeight),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), border: Border.all(width: 1, color: AppColor.white70)),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
icon.toSvgAsset(),
24.height,
label.bodyText2(context).custom(color: AppColor.black20),
],
),
),
);
}
return Container(
padding: const EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
listCard(
icon: 'camera_icon',
label: '${context.translation.open}\n${context.translation.camera}',
onTap: () {
Navigator.of(context).pop(ImageSource.camera);
},
),
listCard(
icon: 'gallery_icon',
label: '${context.translation.open}\n${context.translation.gallery}',
onTap: () {
Navigator.of(context).pop(ImageSource.gallery);
},
),
listCard(
icon: 'file_icon',
label: '${context.translation.open}\n${context.translation.files}',
onTap: () async {
await fromFilePicker();
Navigator.pop(context);
},
),
],
),
);
},
);
// ImageSource source = await showDialog(
// context: context,
// builder: (dialogContext) => CupertinoAlertDialog(
// actions: <Widget>[
// TextButton(
// child: Text(context.translation.pickFromCamera),
// onPressed: () {
// Navigator.of(dialogContext).pop(ImageSource.camera);
// },
// ),
// TextButton(
// child: Text(context.translation.pickFromGallery),
// onPressed: () {
// Navigator.of(dialogContext).pop(ImageSource.gallery);
// },
// ),
// TextButton(
// child: Text(context.translation.pickFromFiles),
// onPressed: () async {
// await fromFilePicker();
// Navigator.pop(context);
// },
// ),
// ],
// ),
// );
if (source == null) return;
final pickedFile = await ImagePicker().pickImage(source: source, imageQuality: 70, maxWidth: 800, maxHeight: 800);
if (pickedFile != null) {
File fileImage = File(pickedFile.path);
widget.attachment.add(GenericAttachmentModel(id: 0, name: fileImage.path));
if (widget.onChange != null) {
widget.onChange!(widget.attachment);
}
setState(() {});
}
setState(() {});
}
}

@ -68,7 +68,7 @@ class MultiFilesPickerItem extends StatelessWidget {
} else if (_isLocalUrl(file.path)) {
OpenFile.open(file.path);
} else {
if (!await launchUrl(Uri.parse(file.path), mode: LaunchMode.externalApplication)) {
if (!await launchUrl(Uri.parse(URLs.getFileUrl(file.path)!), mode: LaunchMode.externalApplication)) {
Fluttertoast.showToast(msg: "UnExpected Error with file.");
throw Exception('Could not launch');
}

@ -72,7 +72,7 @@ class _MultiFilesPickerState extends State<NewMultiFilesPicker> {
children: List.generate(
widget.files!.length,
(index) {
File image = widget.files![index].file;
File image = widget.files[index].file;
return MultiFilesPickerItem(
file: image,
enabled: widget.enabled,

@ -28,14 +28,14 @@ class NotificationItem extends StatelessWidget {
label: notification.priorityName,
textColor: AppColor.getRequestStatusTextColorByName(context, notification.priorityName!),
backgroundColor: AppColor.getRequestStatusColorByName(context, notification.priorityName!),
).toShimmer(isShow: isLoading),
).toShimmer(isShow: isLoading,context: context),
8.width,
if ((notification.statusName ?? "").isNotEmpty && notification.sourceName != "Asset Transfer")
StatusLabel(
label: notification.statusName ?? "",
textColor: AppColor.getRequestStatusTextColorByName(context, notification.statusName ?? ""),
backgroundColor: AppColor.getRequestStatusColorByName(context, notification.statusName ?? ""),
).toShimmer(isShow: isLoading),
).toShimmer(isShow: isLoading,context: context),
],
),
8.height,
@ -47,7 +47,7 @@ class NotificationItem extends StatelessWidget {
style: AppTextStyles.heading6.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.neutral50,
),
).toShimmer(isShow: isLoading).expanded,
).toShimmer(isShow: isLoading,context: context).expanded,
8.width,
Text(
notification.createdOn?.toServiceRequestCardFormat ?? "",
@ -55,7 +55,7 @@ class NotificationItem extends StatelessWidget {
style: AppTextStyles.tinyFont.copyWith(
color: context.isDark ? AppColor.neutral20 : AppColor.neutral50,
),
).toShimmer(isShow: isLoading),
).toShimmer(isShow: isLoading,context: context),
],
),
Text(
@ -63,7 +63,7 @@ class NotificationItem extends StatelessWidget {
style: AppTextStyles.bodyText2.copyWith(
color: context.isDark ? AppColor.neutral10 : const Color(0xFF757575),
),
).toShimmer(isShow: isLoading),
).toShimmer(isShow: isLoading,context: context),
],
).onPress(() {
onPressed(notification);

@ -88,11 +88,11 @@ class _AutoCompletePartsFieldState extends State<AutoCompletePartsField> {
constraints: const BoxConstraints(),
suffixIconConstraints: const BoxConstraints(minWidth: 0),
filled: true,
fillColor: (context.isDark ? AppColor.neutral50 : AppColor.neutral100),
fillColor: AppColor.fieldBgColor(context),
errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red60),
floatingLabelStyle: AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? null : AppColor.neutral20),
labelText: widget.byName ? context.translation.partName : context.translation.partNumber,
labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.neutral120),
labelStyle: AppTextStyles.tinyFont.copyWith(color: AppColor.textColor(context)),
),
textInputAction: TextInputAction.search,
onChanged: (text) {

@ -64,7 +64,7 @@ class _CalibrationToolAssetPickerState extends State<CalibrationToolAssetPicker>
PickAsset(
showAssetInfo: false,
forPPM: true,
cardColor: AppColor.neutral100,
cardColor: AppColor.fieldBgColor(context),
device: widget.initialValue == null
? null
: Asset(

@ -162,7 +162,7 @@ class _AppTimerState extends State<AppTimer> {
ADatePicker(
label: context.translation.startTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
date: _pickerStartAt,
from: widget.pickerFromDate,
enable: widget.enabled ? _tempPickerTimer == null : false,
@ -195,7 +195,7 @@ class _AppTimerState extends State<AppTimer> {
ADatePicker(
label: context.translation.endTime,
hideShadow: true,
backgroundColor: AppColor.neutral100,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
enable: widget.enabled ? _pickerStartAt != null : false,
from: _pickerStartAt,
date: _pickerEndAt,
@ -256,8 +256,9 @@ class _AppTimerState extends State<AppTimer> {
color: context.isDark && !widget.enabled
? AppColor.neutral60
: !widget.enabled
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
? AppColor.neutral40
: AppColor.background(context),
: AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10),
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
),
@ -355,7 +356,7 @@ class _AppTimerState extends State<AppTimer> {
// ADatePicker(
// label: context.translation.startTime,
// hideShadow: true,
// backgroundColor: AppColor.neutral100,
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
// date: _pickerStartAt,
// enable: _tempPickerTimer == null,
// formatDateWithTime: true,
@ -375,7 +376,7 @@ class _AppTimerState extends State<AppTimer> {
// ADatePicker(
// label: context.translation.endTime,
// hideShadow: true,
// backgroundColor: AppColor.neutral100,
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
// enable: _pickerStartAt != null,
// date: _pickerEndAt,
// formatDateWithTime: true,

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.3.5+24
version: 1.3.6+25
environment:
sdk: ">=3.5.0 <4.0.0"

Loading…
Cancel
Save