Merge remote-tracking branch 'origin/main_design2.0' into main_design2.0
# Conflicts: # pubspec.yamlmain_design2.0
commit
2604d8b253
@ -0,0 +1,3 @@
|
||||
<svg width="24" height="21" viewBox="0 0 24 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22.5707 8.52108L3.20688 0.761111C2.39112 0.434161 1.46951 0.577989 0.801771 1.13628C0.134036 1.69465 -0.145246 2.55499 0.0730043 3.38151L1.79655 9.90929H10.2353C10.6236 9.90929 10.9385 10.2133 10.9385 10.5884C10.9385 10.9634 10.6236 11.2675 10.2353 11.2675H1.79655L0.0730043 17.7953C-0.145246 18.6218 0.133989 19.4822 0.801771 20.0405C1.47087 20.5999 2.39257 20.742 3.20693 20.4157L22.5707 12.6557C23.4524 12.3024 24 11.5103 24 10.5884C24 9.66654 23.4524 8.87434 22.5707 8.52108Z" fill="#163A51"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 615 B |
@ -0,0 +1,8 @@
|
||||
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0.5" y="0.5" width="47" height="47" rx="23.5" fill="white" stroke="#EAF1F4"/>
|
||||
<g opacity="0.5">
|
||||
<path d="M26.5703 25.9869C26.3589 26.1982 26.0976 26.3596 25.8145 26.4541L23.0799 27.3655C22.8826 27.4314 22.6768 27.4648 22.4685 27.4648C21.952 27.4648 21.4664 27.2637 21.1012 26.8984C20.58 26.3771 20.4011 25.6189 20.6342 24.9197L21.5457 22.1852C21.64 21.902 21.8016 21.6406 22.0128 21.4294L27.919 15.5232H16.3633C15.0602 15.5232 14 16.5834 14 17.8865V31.6365C14 32.9396 15.0602 33.9997 16.3633 33.9997H30.1133C31.4164 33.9997 32.4766 32.9396 32.4766 31.6365V20.0807L26.5703 25.9869Z" fill="#163A51"/>
|
||||
<path d="M22.9243 22.341C22.8535 22.4118 22.8002 22.498 22.7686 22.593L21.8571 25.3275C21.7799 25.5591 21.8401 25.8144 22.0128 25.987C22.1854 26.1597 22.4407 26.22 22.6723 26.1427L25.4069 25.2312C25.5018 25.1996 25.588 25.1463 25.6588 25.0755L33.7104 17.0239L30.9759 14.2894L22.9243 22.341Z" fill="#163A51"/>
|
||||
<path d="M34.47 12.3144C34.0505 11.8949 33.3704 11.8949 32.9509 12.3144L31.8875 13.3778L34.622 16.1123L35.6854 15.0489C36.1049 14.6294 36.1049 13.9493 35.6854 13.5298L34.47 12.3144Z" fill="#163A51"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,4 @@
|
||||
<svg width="16" height="24" viewBox="0 0 16 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.32812 12.6562H2.86313C3.20484 15.0384 5.25891 16.875 7.73438 16.875C10.2098 16.875 12.2639 15.0384 12.6056 12.6562H9.14062V11.25H12.6562V9.14062H9.14062V7.73438H12.6562V5.625H9.14062V4.21875H12.6056C12.2639 1.83656 10.2098 0 7.73438 0C5.25891 0 3.20484 1.83656 2.86313 4.21875H6.32812V5.625H2.8125V7.73438H6.32812V9.14062H2.8125V11.25H6.32812V12.6562Z" fill="#767676"/>
|
||||
<path d="M8.4375 19.6561C12.3741 19.2994 15.4688 15.9806 15.4688 11.9531C15.2906 11.9531 14.4632 11.9531 14.0625 11.9531C14.0625 15.446 11.2205 18.2812 7.73438 18.2812C4.245 18.2812 1.40625 15.4425 1.40625 11.9531H0C0 15.9806 3.09469 19.2994 7.03125 19.6561V22.5938H2.10938V24H13.3594V22.5938H8.4375V19.6561Z" fill="#767676"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 812 B |
@ -0,0 +1,3 @@
|
||||
<svg width="24" height="20" viewBox="0 0 24 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M23.3186 17.8143L12.9972 0.69713C12.7363 0.264525 12.268 0 11.7628 0C11.2576 0 10.7892 0.264479 10.5284 0.69713L0.207042 17.8143C-0.0613895 18.2595 -0.0693386 18.8148 0.186319 19.2674C0.441976 19.7201 0.921541 20 1.4414 20H22.0842C22.604 20 23.0836 19.72 23.3393 19.2674C23.5949 18.8147 23.587 18.2595 23.3186 17.8143ZM11.7705 5.92101C12.3633 5.92101 12.8648 6.25543 12.8648 6.84816C12.8648 8.65683 12.6521 11.256 12.6521 13.0646C12.6521 13.5358 12.1353 13.7334 11.7705 13.7334C11.2842 13.7334 10.8738 13.5358 10.8738 13.0646C10.8738 11.256 10.661 8.65683 10.661 6.84816C10.661 6.25543 11.1473 5.92101 11.7705 5.92101ZM11.7857 17.1228C11.117 17.1228 10.6153 16.5757 10.6153 15.9525C10.6153 15.3142 11.1169 14.7822 11.7857 14.7822C12.4088 14.7822 12.9408 15.3142 12.9408 15.9525C12.9408 16.5757 12.4088 17.1228 11.7857 17.1228Z" fill="#767676"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 957 B |
File diff suppressed because one or more lines are too long
@ -0,0 +1,2 @@
|
||||
assets:
|
||||
- assets/images/
|
||||
@ -0,0 +1,33 @@
|
||||
import 'package:dotted_border/dotted_border.dart';
|
||||
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 '../app_style/app_color.dart';
|
||||
|
||||
class AppDashedButton extends StatelessWidget {
|
||||
final String title;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const AppDashedButton({@required this.title, @required this.onPressed, Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(horizontal: 2.toScreenWidth),
|
||||
decoration: BoxDecoration(color: Theme.of(context).cardColor, borderRadius: BorderRadius.circular(10)),
|
||||
child: DottedBorder(
|
||||
strokeWidth: 2,
|
||||
padding: EdgeInsets.symmetric(vertical: 16.toScreenHeight, horizontal: 16.toScreenWidth),
|
||||
color: context.isDark ? AppColor.primary40 : AppColor.primary60,
|
||||
dashPattern: const [4, 3],
|
||||
radius: const Radius.circular(10),
|
||||
borderType: BorderType.RRect,
|
||||
child: title.heading6(context).custom(color: context.isDark ? AppColor.primary40 : AppColor.primary60).center,
|
||||
),
|
||||
).onPress(onPressed);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/providers/loading_list_notifier.dart';
|
||||
|
||||
import '../../controllers/api_routes/api_manager.dart';
|
||||
import '../../controllers/api_routes/urls.dart';
|
||||
import '../../models/lookup.dart';
|
||||
|
||||
class EquipmentStatusProvider extends LoadingListNotifier<Lookup> {
|
||||
@override
|
||||
Future getDate() async {
|
||||
if (loading == true) return -2;
|
||||
loading = true;
|
||||
notifyListeners();
|
||||
loading = true;
|
||||
notifyListeners();
|
||||
try {
|
||||
Response response = await ApiManager.instance.get(URLs.equipmentStatus);
|
||||
stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
items = categoriesListJson.map((item) => Lookup.fromJson(item)).toList();
|
||||
}
|
||||
loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
loading = false;
|
||||
stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
import 'package:test_sa/providers/loading_list_notifier.dart';
|
||||
|
||||
import '../../controllers/api_routes/api_manager.dart';
|
||||
import '../../controllers/api_routes/urls.dart';
|
||||
import '../../models/lookup.dart';
|
||||
|
||||
class PriorityProvider extends LoadingListNotifier<Lookup> {
|
||||
@override
|
||||
Future getDate() async {
|
||||
if (loading == true) return -2;
|
||||
loading = true;
|
||||
notifyListeners();
|
||||
loading = true;
|
||||
notifyListeners();
|
||||
try {
|
||||
Response response = await ApiManager.instance.get(URLs.getServiceReportPriority);
|
||||
stateCode = response.statusCode;
|
||||
if (response.statusCode >= 200 && response.statusCode < 300) {
|
||||
// client's request was successfully received
|
||||
List categoriesListJson = json.decode(response.body)["data"];
|
||||
items = categoriesListJson.map((item) => Lookup.fromJson(item)).toList();
|
||||
}
|
||||
loading = false;
|
||||
notifyListeners();
|
||||
return response.statusCode;
|
||||
} catch (error) {
|
||||
loading = false;
|
||||
stateCode = -1;
|
||||
notifyListeners();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,548 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/controllers/providers/api/service_requests_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/string_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/enums/translation_keys.dart';
|
||||
import 'package:test_sa/models/enums/user_types.dart';
|
||||
import 'package:test_sa/models/service_request/service_request.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/create_request.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/report/create_service_report.dart';
|
||||
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
||||
import 'package:test_sa/views/widgets/buttons/app_button.dart';
|
||||
import 'package:test_sa/views/widgets/buttons/app_icon_button.dart';
|
||||
import 'package:test_sa/views/widgets/images/files_list.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
||||
import 'package:test_sa/views/widgets/requests/info_row.dart';
|
||||
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||
import 'package:test_sa/views/widgets/sound/sound_player.dart';
|
||||
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
||||
|
||||
import '../../../../models/service_request/search_work_order.dart';
|
||||
import 'report/future_service_report.dart';
|
||||
|
||||
class RequestDetailsPage extends StatelessWidget {
|
||||
static const String id = "/call-details";
|
||||
ServiceRequest serviceRequest;
|
||||
|
||||
RequestDetailsPage({Key key, this.serviceRequest}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
UserProvider _userProvider = Provider.of<UserProvider>(context);
|
||||
SettingProvider _settingProvider = Provider.of<SettingProvider>(context);
|
||||
List<SearchWorkOrder> workOrders = [];
|
||||
ServiceRequestsProvider _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
|
||||
_serviceRequestsProvider.getServiceRequestObjectById(requestId: serviceRequest.id);
|
||||
|
||||
Widget informationCard() {
|
||||
return Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
StatusLabel(
|
||||
label: serviceRequest.priority.name,
|
||||
id: serviceRequest.priority.id,
|
||||
textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
|
||||
backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)),
|
||||
8.width,
|
||||
StatusLabel(
|
||||
label: serviceRequest.statusLabel,
|
||||
textColor: AColors.getRequestStatusTextColor(serviceRequest.statusValue),
|
||||
backgroundColor: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
||||
1.width.expanded,
|
||||
Text(serviceRequest.date.toServiceRequestCardFormat, textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
Text(serviceRequest.deviceEnName, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
||||
Text(
|
||||
'${context.translation.assetNumber}: ${serviceRequest.device.assetNumber}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'Request Type: ${serviceRequest.type.name}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'Request No: ${serviceRequest.requestCode}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
8.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
8.height,
|
||||
Text(
|
||||
'Manufacture: ${serviceRequest.device.modelDefinition.manufacturerName}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'Model: ${serviceRequest.device.modelDefinition.modelName}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
8.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
8.height,
|
||||
if ((serviceRequest.callComments ?? "").isNotEmpty) ...[
|
||||
Text(
|
||||
serviceRequest.callComments,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
8.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
],
|
||||
if (serviceRequest.devicePhotos.isNotEmpty) ...[
|
||||
FilesList(images: serviceRequest.devicePhotos),
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
],
|
||||
if (serviceRequest.audio?.isNotEmpty == true) ...[
|
||||
16.height,
|
||||
ASoundPlayer(
|
||||
audio: serviceRequest.audio,
|
||||
),
|
||||
16.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
],
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'View Comments',
|
||||
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
||||
),
|
||||
4.width,
|
||||
const Icon(
|
||||
Icons.arrow_forward,
|
||||
color: Color(0xFF4A8DB7),
|
||||
size: 14,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingAll(16),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return DefaultTabController(
|
||||
length: 2,
|
||||
child: Scaffold(
|
||||
appBar: DefaultAppBar(title: context.translation.serviceRequest),
|
||||
backgroundColor: const Color(0xfff8f9fb),
|
||||
body: SafeArea(
|
||||
child: FutureBuilder(
|
||||
future: _serviceRequestsProvider.getServiceRequestObjectById(requestId: serviceRequest.id),
|
||||
builder: (context, snap) {
|
||||
if (snap.connectionState == ConnectionState.waiting) {
|
||||
return const ALoading();
|
||||
} else if (snap.hasData) {
|
||||
serviceRequest = snap.data;
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
color: AColors.primaryColor,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
ABackButton(),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
context.translation.details,
|
||||
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
|
||||
),
|
||||
),
|
||||
),
|
||||
_userProvider.user.type == UsersTypes.normal_user
|
||||
?
|
||||
// AIconButton(
|
||||
// iconData: Icons.warning_amber_rounded,
|
||||
// color: AColors.white,
|
||||
// buttonSize: 42,
|
||||
// backgroundColor: AColors.deepOrange,
|
||||
// onPressed: (){
|
||||
// Navigator.of(context).push(
|
||||
// MaterialPageRoute(
|
||||
// builder: (_) => ReportIssuesPage(serviceRequest: serviceRequest,)
|
||||
// )
|
||||
// );
|
||||
// },
|
||||
// )
|
||||
const SizedBox(
|
||||
width: 48,
|
||||
)
|
||||
: AIconButton(
|
||||
iconData: Icons.edit,
|
||||
color: AColors.white,
|
||||
buttonSize: 42,
|
||||
backgroundColor: AColors.green,
|
||||
onPressed: (serviceRequest.statusValue == 5 || serviceRequest.statusValue == 3)
|
||||
? null
|
||||
: () async {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (_) => CreateRequestPage(serviceRequest: serviceRequest)),
|
||||
);
|
||||
// showModalBottomSheet(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return ServiceRequestsUpdateDialog(
|
||||
// request: serviceRequest,
|
||||
// );
|
||||
// });
|
||||
// DateTime picked = await showDatePicker(
|
||||
// context: context,
|
||||
// initialDate: DateTime.now(),
|
||||
// firstDate: DateTime.now(),
|
||||
// lastDate: DateTime.now().add(Duration(days: 182))
|
||||
// );
|
||||
// if(picked == null){return;}
|
||||
// showDialog<void>(
|
||||
// context: context,
|
||||
// barrierDismissible: false,
|
||||
// builder: (BuildContext context) {
|
||||
// return CupertinoAlertDialog(
|
||||
// title: Text(context.translation.updatingDots),
|
||||
// content: Center(child: CircularProgressIndicator()),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// int status = await _serviceRequestsProvider.updateDate(
|
||||
// user: _userProvider.user,
|
||||
// host: _settingProvider.host,
|
||||
// request: serviceRequest,
|
||||
// newDate: picked.toString().split(" ").first
|
||||
// );
|
||||
// Navigator.of(context).pop();
|
||||
// Fluttertoast.showToast(
|
||||
// msg: HttpStatusManger.getStatusMessage(status: status, subtitle: context.translation),
|
||||
// );
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
width: 16,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
serviceRequest.devicePhotos.isEmpty
|
||||
? const SizedBox.shrink()
|
||||
: SizedBox(
|
||||
height: 60 * AppStyle.getScaleFactor(context),
|
||||
child: FilesList(
|
||||
images: serviceRequest.devicePhotos,
|
||||
),
|
||||
).paddingOnly(top: 4, bottom: 4),
|
||||
TabBar(labelColor: AColors.primaryColor, tabs: [
|
||||
Tab(
|
||||
text: context.translation.general,
|
||||
),
|
||||
Tab(
|
||||
text: context.translation.serviceRequestInformation,
|
||||
),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
informationCard(),
|
||||
RequestInfoRow(
|
||||
title: context.translation.callId,
|
||||
info: serviceRequest.requestCode,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: "Asset Number",
|
||||
info: serviceRequest.deviceNumber,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.assetName,
|
||||
info: serviceRequest.deviceEnName,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.deviceModel,
|
||||
info: serviceRequest.deviceModel,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.engineerName,
|
||||
info: serviceRequest.engineerName,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.engineerPhone,
|
||||
info: serviceRequest.engineerMobile,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.date,
|
||||
info: serviceRequest.date,
|
||||
),
|
||||
serviceRequest.nextVisitDate == null
|
||||
? SizedBox.shrink()
|
||||
: RequestInfoRow(
|
||||
title: context.translation.next,
|
||||
info: DateFormat('EE dd/MM/yyyy').format(serviceRequest.nextVisitDate),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${context.translation.status} : ",
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
textScaleFactor: AppStyle.getScaleFactor(context),
|
||||
),
|
||||
),
|
||||
StatusLabel(label: serviceRequest.statusLabel, backgroundColor: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.hospital,
|
||||
info: serviceRequest.hospitalName,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.unite,
|
||||
info: serviceRequest.departmentName,
|
||||
),
|
||||
// RequestInfoRow(
|
||||
// title: context.translation.deviceArName,
|
||||
// content: serviceRequest.deviceArName,
|
||||
// ),
|
||||
// RequestInfoRow(
|
||||
// title: context.translation.deviceName,
|
||||
// content: serviceRequest.deviceEnName,
|
||||
// ),
|
||||
RequestInfoRow(
|
||||
title: context.translation.maintenanceIssue,
|
||||
content: serviceRequest.callComments,
|
||||
),
|
||||
if (serviceRequest.audio?.isNotEmpty == true)
|
||||
ASoundPlayer(
|
||||
audio: serviceRequest.audio,
|
||||
),
|
||||
//
|
||||
// Center(
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(32),
|
||||
// child: AButton(
|
||||
// text: context.translation.duplicateRequest,
|
||||
// onPressed: () async {
|
||||
// bool result = await showDialog(
|
||||
// context: context,
|
||||
// builder: (_) => AAlertDialog(
|
||||
// title: context.translation.duplicateAlert,
|
||||
// content: context.translation.duplicateAlertMessage,
|
||||
// )
|
||||
// );
|
||||
// if(result == true){
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context){
|
||||
// return Center(child: CircularProgressIndicator());
|
||||
// }
|
||||
// );
|
||||
// int status = await _serviceRequestsProvider.createDuplicatedReport(
|
||||
// host: _settingProvider.host,
|
||||
// user: _userProvider.user,
|
||||
// request: serviceRequest
|
||||
// );
|
||||
// Navigator.of(context).pop();
|
||||
// ScaffoldMessenger.of(context).showSnackBar(
|
||||
// SnackBar(
|
||||
// content: Text(
|
||||
// HttpStatusManger.getStatusMessage(status: status, subtitle: context.translation)
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
],
|
||||
).expanded,
|
||||
AppFilledButton(label: context.translation.login, maxWidth: true, onPressed: () {}).paddingOnly(start: 16, end: 16, bottom: 24),
|
||||
],
|
||||
),
|
||||
// workOrders.isEmpty ?
|
||||
FutureBuilder(
|
||||
future: _serviceRequestsProvider.searchWorkOrders(callId: serviceRequest.requestCode),
|
||||
builder: (context, snap) {
|
||||
workOrders = snap.data as List<SearchWorkOrder>;
|
||||
if (snap.connectionState == ConnectionState.waiting) return Center(child: CircularProgressIndicator());
|
||||
if (snap.connectionState == ConnectionState.done && (snap.data?.length ?? 0) != 0) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.all(21),
|
||||
itemCount: workOrders.length,
|
||||
separatorBuilder: (czt, index) => 21.height,
|
||||
itemBuilder: (context, index) {
|
||||
Color itemColor = index % 2 == 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
||||
Color onItemColor = index % 2 != 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
||||
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||
primary: itemColor.withOpacity(.7),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
|
||||
),
|
||||
),
|
||||
//padding: EdgeInsets.symmetric(vertical: 8,horizontal: 8),
|
||||
onPressed: () {
|
||||
// onPressed(request);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
RequestInfoRow(
|
||||
title: context.translation.callId,
|
||||
content: serviceRequest.requestCode,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.orderWorkNumber,
|
||||
info: workOrders[index].workOrderNo.toString(),
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.visitDate,
|
||||
info: workOrders[index].visitDate,
|
||||
),
|
||||
RequestInfoRow(title: context.translation.assignedEmployee, info: workOrders[index].assignedEmployee?.name ?? ""),
|
||||
RequestInfoRow(
|
||||
title: context.translation.assetSN,
|
||||
info: workOrders[index].callRequest.asset.assetSerialNo,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.assetName,
|
||||
info: workOrders[index].callRequest.asset.modelDefinition.assetName,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.assetNumber,
|
||||
info: workOrders[index].callRequest.asset.assetNumber,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.model,
|
||||
info: workOrders[index].callRequest.asset.modelDefinition.modelName,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: context.translation.site,
|
||||
info: workOrders[index].callRequest.asset.site.custName,
|
||||
),
|
||||
RequestInfoRow(
|
||||
title: "Call last Situation",
|
||||
info: workOrders[index].currentSituation.name ?? '',
|
||||
),
|
||||
_userProvider.user.type == UsersTypes.engineer && workOrders[index].workOrderNo != null
|
||||
? Padding(
|
||||
padding: EdgeInsets.all(32),
|
||||
child: AButton(
|
||||
text: context.translation.editServiceReport,
|
||||
onPressed: serviceRequest.statusValue == 5 || serviceRequest.statusValue == 3
|
||||
? null
|
||||
: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => FutureServiceReport(
|
||||
request: serviceRequest,
|
||||
workOrder: workOrders[index],
|
||||
)),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (_userProvider.user.type == UsersTypes.engineer)
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: AButton(
|
||||
text: "Create Work Order",
|
||||
onPressed: serviceRequest.statusValue == 5 || serviceRequest.statusValue == 3
|
||||
? null
|
||||
: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (_) => CreateServiceReport(request: serviceRequest)));
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: ASubTitle(context.translation.dataNotFound),
|
||||
),
|
||||
),
|
||||
if (_userProvider.user.type == UsersTypes.engineer)
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: AButton(
|
||||
text: "Create Work Order",
|
||||
onPressed: serviceRequest.statusValue == 5 || serviceRequest.statusValue == 3
|
||||
? null
|
||||
: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (_) => CreateServiceReport(request: serviceRequest)));
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return const SizedBox();
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,228 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/controllers/providers/api/service_requests_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/string_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/enums/translation_keys.dart';
|
||||
import 'package:test_sa/models/enums/user_types.dart';
|
||||
import 'package:test_sa/models/service_request/service_request.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/create_request.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/work_order/create_service_report.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/work_order/future_service_report.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/work_order/work_orders_list_page.dart';
|
||||
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
||||
import 'package:test_sa/views/widgets/buttons/app_button.dart';
|
||||
import 'package:test_sa/views/widgets/buttons/app_icon_button.dart';
|
||||
import 'package:test_sa/views/widgets/images/files_list.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
||||
import 'package:test_sa/views/widgets/requests/info_row.dart';
|
||||
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||
import 'package:test_sa/views/widgets/sound/sound_player.dart';
|
||||
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
||||
import '../../../../models/service_request/search_work_order.dart';
|
||||
|
||||
class ServiceRequestDetailsPage extends StatelessWidget {
|
||||
static const String id = "/call-details";
|
||||
ServiceRequest serviceRequest;
|
||||
|
||||
ServiceRequestDetailsPage({Key key, this.serviceRequest}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
UserProvider _userProvider = Provider.of<UserProvider>(context);
|
||||
ServiceRequestsProvider _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
|
||||
// _serviceRequestsProvider.getServiceRequestObjectById(requestId: serviceRequest.id);
|
||||
|
||||
Widget informationCard() {
|
||||
return Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
StatusLabel(
|
||||
label: serviceRequest.priority.name,
|
||||
id: serviceRequest.priority.id,
|
||||
textColor: AColors.getPriorityStatusTextColor(serviceRequest.priority.id),
|
||||
backgroundColor: AColors.getPriorityStatusColor(serviceRequest.priority.id)),
|
||||
8.width,
|
||||
StatusLabel(
|
||||
label: serviceRequest.statusLabel,
|
||||
textColor: AColors.getRequestStatusTextColor(serviceRequest.statusValue),
|
||||
backgroundColor: AColors.getRequestStatusColor(serviceRequest.statusValue)),
|
||||
1.width.expanded,
|
||||
Text(serviceRequest.date.toServiceRequestCardFormat, textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
Text(serviceRequest.deviceEnName, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
||||
Text(
|
||||
'${context.translation.assetNumber}: ${serviceRequest.device.assetNumber}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'Request Type: ${serviceRequest.type.name}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'Request No: ${serviceRequest.requestCode}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
8.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
8.height,
|
||||
Text(
|
||||
'Manufacture: ${serviceRequest.device.modelDefinition.manufacturerName}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'Model: ${serviceRequest.device.modelDefinition.modelName}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
8.height,
|
||||
if ((serviceRequest.callComments ?? "").isNotEmpty) ...[
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
8.height,
|
||||
Text(
|
||||
serviceRequest.callComments,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
],
|
||||
if (serviceRequest.devicePhotos.isNotEmpty) ...[
|
||||
8.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
FilesList(images: serviceRequest.devicePhotos),
|
||||
],
|
||||
if (serviceRequest.audio?.isNotEmpty ?? false) ...[
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
16.height,
|
||||
ASoundPlayer(audio: serviceRequest.audio),
|
||||
],
|
||||
],
|
||||
).paddingAll(16),
|
||||
(_userProvider.user.type == UsersTypes.normal_user
|
||||
? Container(
|
||||
height: 50,
|
||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
decoration: const ShapeDecoration(
|
||||
color: Color(0xFFEAF1F4),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.circular(20),
|
||||
bottomRight: Radius.circular(20),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Comment here...',
|
||||
style: AppTextStyles.heading6.copyWith(
|
||||
color: AppColor.neutral50.withOpacity(.6),
|
||||
),
|
||||
).expanded,
|
||||
SvgPicture.asset("assets/images/comment_send.svg", width: 24 * AppStyle.getScaleFactor(context), height: 24 * AppStyle.getScaleFactor(context), color: AppColor.primary70),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
16.height,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'View Comments',
|
||||
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
||||
),
|
||||
4.width,
|
||||
const Icon(
|
||||
Icons.arrow_forward,
|
||||
color: Color(0xFF4A8DB7),
|
||||
size: 14,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingOnly(bottom: 16, start: 16, end: 16))
|
||||
.onPress(() {
|
||||
// todo 'sikander' add comment bottom sheet
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: DefaultAppBar(title: context.translation.serviceDetails),
|
||||
backgroundColor: const Color(0xfff8f9fb),
|
||||
body: SafeArea(
|
||||
child: FutureBuilder(
|
||||
future: _serviceRequestsProvider.getServiceRequestObjectById(requestId: serviceRequest.id),
|
||||
builder: (context, snap) {
|
||||
if (snap.connectionState == ConnectionState.waiting) {
|
||||
return const ALoading();
|
||||
} else if (snap.hasData) {
|
||||
serviceRequest = snap.data;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: informationCard(),
|
||||
).expanded,
|
||||
if (_userProvider.user.type != UsersTypes.engineer || (serviceRequest.statusValue == 5 || serviceRequest.statusValue == 3))
|
||||
(serviceRequest.firstAction == null
|
||||
? AppFilledButton(
|
||||
label: context.translation.firstAction,
|
||||
maxWidth: true,
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (_) => CreateRequestPage(serviceRequest: serviceRequest)),
|
||||
);
|
||||
})
|
||||
: AppFilledButton(
|
||||
label: context.translation.viewWorkOrder,
|
||||
maxWidth: true,
|
||||
onPressed: () {
|
||||
Navigator.of(context).pushNamed(WorkOrderListPage.id, arguments: serviceRequest);
|
||||
}))
|
||||
.paddingOnly(start: 16, end: 16, bottom: 24),
|
||||
],
|
||||
);
|
||||
}
|
||||
return const SizedBox();
|
||||
})));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,175 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/service_requests_provider.dart';
|
||||
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/string_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/service_request/search_work_order.dart';
|
||||
import 'package:test_sa/models/service_request/service_request.dart';
|
||||
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/work_order/create_service_report.dart';
|
||||
import 'package:test_sa/views/pages/user/requests/work_order/future_service_report.dart';
|
||||
import 'package:test_sa/views/widgets/buttons/app_button.dart';
|
||||
import 'package:test_sa/views/widgets/requests/info_row.dart';
|
||||
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||
import 'package:test_sa/views/widgets/titles/app_sub_title.dart';
|
||||
|
||||
class WorkOrderListPage extends StatelessWidget {
|
||||
static const String id = "/work-order-list";
|
||||
ServiceRequest serviceRequest;
|
||||
|
||||
WorkOrderListPage({Key key, this.serviceRequest}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// UserProvider _userProvider = Provider.of<UserProvider>(context);
|
||||
// SettingProvider _settingProvider = Provider.of<SettingProvider>(context);
|
||||
List<SearchWorkOrder> workOrders = [];
|
||||
ServiceRequestsProvider serviceRequestsProvider;
|
||||
UserProvider _userProvider = Provider.of<UserProvider>(context);
|
||||
if (serviceRequestsProvider == null) {
|
||||
serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
|
||||
serviceRequest = ModalRoute.of(context).settings.arguments;
|
||||
}
|
||||
print("serviceRequest.statusValue:${serviceRequest.statusValue}");
|
||||
return Scaffold(
|
||||
appBar: DefaultAppBar(title: context.translation.workOrder),
|
||||
backgroundColor: const Color(0xfff8f9fb),
|
||||
body: SafeArea(
|
||||
child: FutureBuilder(
|
||||
future: serviceRequestsProvider.searchWorkOrders(callId: serviceRequest.requestCode),
|
||||
builder: (context, snap) {
|
||||
workOrders = snap.data as List<SearchWorkOrder>;
|
||||
if (snap.connectionState == ConnectionState.waiting) return Center(child: CircularProgressIndicator());
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
ListView.separated(
|
||||
padding: const EdgeInsets.all(16),
|
||||
itemCount: workOrders?.length ?? 0,
|
||||
separatorBuilder: (czt, index) => 8.height,
|
||||
itemBuilder: (context, index) {
|
||||
Color itemColor = index % 2 == 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
||||
Color onItemColor = index % 2 != 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
||||
|
||||
return Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
StatusLabel(label: workOrders[index].currentSituation.name, textColor: AppColor.orange60, backgroundColor: AppColor.orange40),
|
||||
8.height,
|
||||
Text(serviceRequest.requestCode, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
||||
],
|
||||
).expanded,
|
||||
if (serviceRequest.statusValue != 5 && serviceRequest.statusValue != 3)
|
||||
"edit".toSvgAsset(height: 48, width: 48).onPress(() {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => FutureServiceReport(
|
||||
request: serviceRequest,
|
||||
workOrder: workOrders[index],
|
||||
)),
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
8.height,
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${context.translation.assetName}: ${workOrders[index].callRequest.asset.modelDefinition.assetName}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'${context.translation.status}: ${workOrders[index].currentSituation.name}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
],
|
||||
).expanded,
|
||||
Text(workOrders[index].visitDate.toServiceRequestCardFormat, textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'${context.translation.orderWorkNumber}: ${workOrders[index].workOrderNo}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
'${context.translation.assignedEmployee}: ${workOrders[index].assignedEmployee?.name ?? ""}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text('${context.translation.assetSN}: ${workOrders[index].callRequest.asset.assetSerialNo ?? ""}', style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575))),
|
||||
Text('${context.translation.assetName}: ${workOrders[index].callRequest.asset.modelDefinition.assetName ?? ""}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575))),
|
||||
Text('${context.translation.assetNumber}: ${workOrders[index].callRequest.asset.assetNumber ?? ""}', style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575))),
|
||||
Text('${context.translation.model}: ${workOrders[index].callRequest.asset.modelDefinition.modelName ?? ""}',
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575))),
|
||||
Text('${context.translation.site}: ${workOrders[index].callRequest.asset.site.custName ?? ""}', style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575))),
|
||||
Text('${"Call last Situation"}: ${workOrders[index].calllastSituation.name ?? '' ?? ""}', style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575))),
|
||||
16.height,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'View Details',
|
||||
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
||||
),
|
||||
4.width,
|
||||
const Icon(
|
||||
Icons.arrow_forward,
|
||||
color: Color(0xFF4A8DB7),
|
||||
size: 14,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
).paddingAll(16).onPress(() {
|
||||
// onPressed(request);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
).expanded,
|
||||
if (_userProvider.user.type != UsersTypes.engineer && (serviceRequest.statusValue != 5 && serviceRequest.statusValue != 3))
|
||||
AppFilledButton(
|
||||
label: context.translation.createWorkOrder,
|
||||
maxWidth: true,
|
||||
onPressed: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (_) => CreateServiceReport(request: serviceRequest)));
|
||||
}).paddingOnly(start: 16, end: 16, bottom: 16)
|
||||
],
|
||||
);
|
||||
},
|
||||
)));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue