work order
parent
27d3a74d3b
commit
8646b8f1e9
@ -0,0 +1,63 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../../models/service_request/search_work_order.dart';
|
||||||
|
import '../../app_style/colors.dart';
|
||||||
|
import '../../app_style/sizing.dart';
|
||||||
|
|
||||||
|
class WorkOrderDetails extends StatelessWidget {
|
||||||
|
final SearchWorkOrders item;
|
||||||
|
const WorkOrderDetails({@required this.item,Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
margin: EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AColors.inputFieldBackgroundColor,
|
||||||
|
border: Border.all(
|
||||||
|
color: Color(0xffefefef),
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||||
|
// boxShadow: const [
|
||||||
|
// AppStyle.boxShadow
|
||||||
|
// ]
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
_buildRow("call id", "", context),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(child: _buildRow("call id", "", context),)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Widget _buildRow(String title, String value, BuildContext context){
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
"Call Id",
|
||||||
|
style: Theme.of(context).textTheme.subtitle2.copyWith(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
//if (item.clientName != null)
|
||||||
|
Text(
|
||||||
|
'',
|
||||||
|
style: Theme.of(context).textTheme.subtitle2.copyWith(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,106 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:test_sa/controllers/localization/localization.dart';
|
||||||
|
import 'package:test_sa/models/subtitle.dart';
|
||||||
|
import 'package:test_sa/views/app_style/colors.dart';
|
||||||
|
import 'package:test_sa/views/app_style/sizing.dart';
|
||||||
|
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
||||||
|
|
||||||
|
import '../../../models/service_request/search_work_order.dart';
|
||||||
|
|
||||||
|
class WorkOrderItem extends StatelessWidget {
|
||||||
|
final int index;
|
||||||
|
final SearchWorkOrders item;
|
||||||
|
final Function(SearchWorkOrders) onPressed;
|
||||||
|
const WorkOrderItem({Key key, this.item, this.onPressed, this.index}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Subtitle _subtitle = AppLocalization.of(context).subtitle;
|
||||||
|
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 Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
||||||
|
backgroundColor: itemColor,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
onPressed(item);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
item.callRequest.callNo ?? "-----",
|
||||||
|
style: Theme.of(context).textTheme.headline6.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
item.callRequest.asset.id.toString(),
|
||||||
|
style: Theme.of(context).textTheme.subtitle2.copyWith(
|
||||||
|
color: onItemColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
_subtitle.assetName,
|
||||||
|
style: Theme.of(context).textTheme.subtitle2.copyWith(
|
||||||
|
color: onItemColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
//if (item.clientName != null)
|
||||||
|
Text(
|
||||||
|
item.callRequest.asset.assetNumber,
|
||||||
|
style: Theme.of(context).textTheme.subtitle2.copyWith(
|
||||||
|
color: onItemColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
item.calllastSituation.name,
|
||||||
|
style: Theme.of(context).textTheme.subtitle2.copyWith(
|
||||||
|
color: onItemColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: onItemColor,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
_subtitle.status,
|
||||||
|
style: Theme.of(context).textTheme.subtitle2.copyWith(
|
||||||
|
color: onItemColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (item.callRequest.status?.id != null) StatusLabel(label: item.callRequest.status.name, color: AColors.getGasStatusColor(item.callRequest.status.id)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:test_sa/views/pages/sub_workorder/workorder_update.dart';
|
||||||
|
import 'package:test_sa/views/pages/sub_workorder/workorder_item.dart';
|
||||||
|
|
||||||
|
import '../../../controllers/localization/localization.dart';
|
||||||
|
import '../../../models/service_request/search_work_order.dart';
|
||||||
|
import '../../../models/subtitle.dart';
|
||||||
|
import '../../widgets/loaders/lazy_loading.dart';
|
||||||
|
import '../../widgets/loaders/no_item_found.dart';
|
||||||
|
|
||||||
|
class WorkOrderList extends StatelessWidget {
|
||||||
|
final List<SearchWorkOrders> items;
|
||||||
|
final bool nextPage;
|
||||||
|
final Future<void> Function() onLazyLoad;
|
||||||
|
WorkOrderList({Key key, this.items, this.nextPage, this.onLazyLoad}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
if (items.length == 0) {
|
||||||
|
Subtitle subtitle = AppLocalization.of(context).subtitle;
|
||||||
|
return NoItemFound(
|
||||||
|
message: subtitle.noServiceRequestFound,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return LazyLoading(
|
||||||
|
nextPage: nextPage,
|
||||||
|
onLazyLoad: onLazyLoad,
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: items.length,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
|
itemBuilder: (context, itemIndex) {
|
||||||
|
return WorkOrderItem(index: itemIndex, onPressed: (model){
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(
|
||||||
|
builder: (_) => WorkOrderUpdate(item: model,)));
|
||||||
|
}, item: items[itemIndex], );
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:test_sa/views/pages/sub_workorder/workorder_details.dart';
|
||||||
|
|
||||||
|
import '../../../controllers/localization/localization.dart';
|
||||||
|
import '../../../models/service_request/search_work_order.dart';
|
||||||
|
import '../../../models/subtitle.dart';
|
||||||
|
import '../../app_style/colors.dart';
|
||||||
|
import '../../widgets/buttons/app_back_button.dart';
|
||||||
|
import '../../widgets/loaders/loading_manager.dart';
|
||||||
|
|
||||||
|
class WorkOrderUpdate extends StatefulWidget {
|
||||||
|
final SearchWorkOrders item;
|
||||||
|
|
||||||
|
const WorkOrderUpdate({@required this.item,Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<WorkOrderUpdate> createState() => _WorkOrderUpdateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _WorkOrderUpdateState extends State<WorkOrderUpdate> {
|
||||||
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||||
|
Subtitle _subtitle;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
_subtitle = AppLocalization.of(context).subtitle;
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
body: SafeArea(
|
||||||
|
child: Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: LoadingManager(
|
||||||
|
isLoading: _isLoading,
|
||||||
|
isFailedLoading: false,
|
||||||
|
stateCode: 200,
|
||||||
|
onRefresh: () async {},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const ABackButton(),
|
||||||
|
Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Work Order",
|
||||||
|
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white, fontStyle: FontStyle.italic),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 58),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
WorkOrderDetails(item: widget.item,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue