mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-11 09:08:55 +03:30
3.2.2
This commit is contained in:
+5
-20
@@ -25,7 +25,7 @@ class Url {
|
||||
|
||||
static const String sendResetPass = '$baseUrl/password/reset';
|
||||
|
||||
static const String addImage = '$baseUrl/UploadFile';
|
||||
static const String addImage = '$baseUrl/store_media';
|
||||
|
||||
static const String exportItems = '$baseUrl/export/items';
|
||||
|
||||
@@ -86,31 +86,16 @@ class Url {
|
||||
static const String createItemResult = '$baseUrl/Items';
|
||||
|
||||
static String getMyItems(int id) {
|
||||
return '$baseUrl/transfer-my-items?page=$id';
|
||||
}
|
||||
|
||||
static String getHospitalItems(int id) {
|
||||
return '$baseUrl/transfer-items?page=$id';
|
||||
return '$baseUrl/MyItems?page=$id';
|
||||
}
|
||||
|
||||
static String getMyPackages(int id) {
|
||||
return '$baseUrl/transfer-my-packages?page=$id';
|
||||
return '$baseUrl/MyPackages?page=$id';
|
||||
}
|
||||
|
||||
static String getHospitalPackages(int id) {
|
||||
return '$baseUrl/transfer-packages?page=$id';
|
||||
}
|
||||
static String getMyItemRequests = '$baseUrl/suspended-transfer-items';
|
||||
|
||||
static String getMyItemRequests = '$baseUrl/my-suspended-transfer-items';
|
||||
|
||||
static const String getHospitalItemRequests =
|
||||
'$baseUrl/suspended-transfer-items';
|
||||
|
||||
static String getMyPackageRequests =
|
||||
'$baseUrl/my-suspended-transfer-packages';
|
||||
|
||||
static const String getHospitalPackageRequests =
|
||||
'$baseUrl/suspended-transfer-packages';
|
||||
static String getMyPackageRequests = '$baseUrl/suspended-transfer-packages';
|
||||
|
||||
static String transferItems(String id) {
|
||||
return '$baseUrl/transfer-items/$id';
|
||||
|
||||
+14
-9
@@ -1,11 +1,11 @@
|
||||
import 'package:cssd/pages/CyclePages/cycle_update_screen.dart';
|
||||
// import 'package:cssd/pages/CyclePages/cycle_update_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_add_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_detail_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_filter_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_result_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_scan_screen.dart';
|
||||
import 'package:cssd/pages/ItemPages/item_update_screen.dart';
|
||||
import 'package:cssd/pages/LabelPages/label_update_screen.dart';
|
||||
// import 'package:cssd/pages/ItemPages/item_update_screen.dart';
|
||||
// import 'package:cssd/pages/LabelPages/label_update_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/Result/my_items_result_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/my_items_detail_screen.dart';
|
||||
import 'package:cssd/pages/MyItemsPages/my_items_filter_screen.dart';
|
||||
@@ -23,7 +23,7 @@ import 'package:cssd/pages/PackagePages/package_detail_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_filter_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_result_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_scan_screen.dart';
|
||||
import 'package:cssd/pages/PackagePages/package_update_screen.dart';
|
||||
// import 'package:cssd/pages/PackagePages/package_update_screen.dart';
|
||||
import 'package:cssd/pages/TestPages/test_form_page.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/providers/my_items.dart';
|
||||
@@ -32,6 +32,7 @@ import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/providers/users.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:flutter_phoenix/flutter_phoenix.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -67,12 +68,16 @@ import 'providers/my_info.dart';
|
||||
import 'providers/test_results.dart';
|
||||
import 'widgets/Global/splash_screen.dart';
|
||||
|
||||
void main() {
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
SystemChrome.setPreferredOrientations([
|
||||
DeviceOrientation.portraitUp,
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
await FlutterDownloader.initialize(
|
||||
debug: true,
|
||||
ignoreSsl: true,
|
||||
);
|
||||
runApp(Phoenix(child: MyApp()));
|
||||
}
|
||||
|
||||
@@ -155,7 +160,7 @@ class MyApp extends StatelessWidget {
|
||||
Routes.cycleFilterScreen: (ctx) => CycleFilterScreen(),
|
||||
Routes.cycleScanScreen: (ctx) => CycleScanScreen(),
|
||||
Routes.labelScanScreen: (ctx) => LabelScanScreen(),
|
||||
Routes.labelUpdateScreen: (ctx) => LabelUpdateScreen(),
|
||||
// Routes.labelUpdateScreen: (ctx) => LabelUpdateScreen(),
|
||||
Routes.cycleAddScreen: (ctx) => CycleAddScreen(),
|
||||
Routes.labelAddScreen: (ctx) => LabelAddScreen(),
|
||||
Routes.labelResultScreen: (ctx) => LabelResultScreen(),
|
||||
@@ -174,9 +179,9 @@ class MyApp extends StatelessWidget {
|
||||
Routes.itemFilterScreen: (ctx) => ItemFilterScreen(),
|
||||
Routes.itemDetailScreen: (ctx) => ItemDetailScreen(),
|
||||
Routes.formTestResultScreen: (ctx) => FormPage(),
|
||||
Routes.cycleUpdateScreen: (ctx) => CycleUpdateScreen(),
|
||||
Routes.packageUpdateScreen: (ctx) => PackageUpdateScreen(),
|
||||
Routes.itemUpdateScreen: (ctx) => ItemUpdateScreen(),
|
||||
// Routes.cycleUpdateScreen: (ctx) => CycleUpdateScreen(),
|
||||
// Routes.packageUpdateScreen: (ctx) => PackageUpdateScreen(),
|
||||
// Routes.itemUpdateScreen: (ctx) => ItemUpdateScreen(),
|
||||
Routes.itemScanScreen: (ctx) => ItemScanScreen(),
|
||||
Routes.packageScanScreen: (ctx) => PackageScanScreen(),
|
||||
Routes.myItemsResultScreen: (ctx) => MyItemsResultScreen(),
|
||||
|
||||
@@ -10,6 +10,7 @@ class ItemResultObject extends Equatable {
|
||||
final String? batchId;
|
||||
final String? udi;
|
||||
final String? udi_name;
|
||||
final String? packageId;
|
||||
|
||||
ItemResultObject({
|
||||
required this.id,
|
||||
@@ -20,6 +21,7 @@ class ItemResultObject extends Equatable {
|
||||
this.batchId,
|
||||
this.udi,
|
||||
this.udi_name,
|
||||
this.packageId,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -32,6 +34,7 @@ class ItemResultObject extends Equatable {
|
||||
batchId!,
|
||||
udi!,
|
||||
udi_name!,
|
||||
packageId!,
|
||||
];
|
||||
|
||||
@override
|
||||
@@ -42,6 +45,7 @@ class ItemDetailObject extends Equatable {
|
||||
final String id;
|
||||
final String name;
|
||||
final String userName;
|
||||
final String userCreator;
|
||||
final String size;
|
||||
final String specific;
|
||||
final String hospital;
|
||||
@@ -50,6 +54,7 @@ class ItemDetailObject extends Equatable {
|
||||
final String udi;
|
||||
final int status;
|
||||
final List<String>? filePath;
|
||||
final String? packageId;
|
||||
|
||||
ItemDetailObject({
|
||||
required this.id,
|
||||
@@ -63,6 +68,8 @@ class ItemDetailObject extends Equatable {
|
||||
required this.udi,
|
||||
required this.status,
|
||||
this.filePath,
|
||||
required this.packageId,
|
||||
required this.userCreator,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -71,6 +78,7 @@ class ItemDetailObject extends Equatable {
|
||||
id,
|
||||
name,
|
||||
userName,
|
||||
userCreator,
|
||||
size,
|
||||
specific,
|
||||
hospital,
|
||||
@@ -79,6 +87,7 @@ class ItemDetailObject extends Equatable {
|
||||
udi,
|
||||
status,
|
||||
filePath!,
|
||||
packageId!,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ class PackageDetailObject extends Equatable {
|
||||
final String hospitalName;
|
||||
// final String udi;
|
||||
final List<String> items;
|
||||
final String userName;
|
||||
final String userCreator;
|
||||
|
||||
PackageDetailObject({
|
||||
required this.id,
|
||||
@@ -40,6 +42,8 @@ class PackageDetailObject extends Equatable {
|
||||
required this.hospitalName,
|
||||
// required this.udi,
|
||||
required this.items,
|
||||
required this.userName,
|
||||
required this.userCreator,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -52,6 +56,8 @@ class PackageDetailObject extends Equatable {
|
||||
hospitalName,
|
||||
// udi,
|
||||
items,
|
||||
userName,
|
||||
userCreator,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,282 +1,282 @@
|
||||
import 'package:cssd/models/cycles_models.dart';
|
||||
import 'package:cssd/providers/cycles.dart';
|
||||
import 'package:cssd/widgets/CycleScreens/Add/cycle_update_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||
// import 'package:cssd/models/cycles_models.dart';
|
||||
// import 'package:cssd/providers/cycles.dart';
|
||||
// import 'package:cssd/widgets/CycleScreens/Add/cycle_update_button.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
// import 'package:intl/intl.dart' as DateEditor;
|
||||
// import 'package:provider/provider.dart';
|
||||
// import '../../config/routes.dart';
|
||||
// import '../../providers/connectivity.dart';
|
||||
// import '../../widgets/Global/internet_error.dart';
|
||||
// import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||
|
||||
class CycleUpdateScreen extends StatefulWidget {
|
||||
@override
|
||||
_CycleUpdateScreenState createState() => _CycleUpdateScreenState();
|
||||
}
|
||||
// class CycleUpdateScreen extends StatefulWidget {
|
||||
// @override
|
||||
// _CycleUpdateScreenState createState() => _CycleUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _CycleUpdateScreenState extends State<CycleUpdateScreen> {
|
||||
final _cycleNumberFocusNode = FocusNode();
|
||||
final _descriptionFocusNode = FocusNode();
|
||||
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
TextEditingController sterilizerIdCTRL = new TextEditingController();
|
||||
TextEditingController descriptionCTRL = new TextEditingController();
|
||||
TextEditingController dateCTRL = new TextEditingController();
|
||||
TextEditingController labelCTRL = new TextEditingController();
|
||||
// class _CycleUpdateScreenState extends State<CycleUpdateScreen> {
|
||||
// final _cycleNumberFocusNode = FocusNode();
|
||||
// final _descriptionFocusNode = FocusNode();
|
||||
// TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
// TextEditingController sterilizerIdCTRL = new TextEditingController();
|
||||
// TextEditingController descriptionCTRL = new TextEditingController();
|
||||
// TextEditingController dateCTRL = new TextEditingController();
|
||||
// TextEditingController labelCTRL = new TextEditingController();
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
// List<Map<String, String>> labelVals = [];
|
||||
// List<String> labelValue = [];
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
CycleDetailObject? datas;
|
||||
@override
|
||||
void initState() {
|
||||
dateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
super.initState();
|
||||
}
|
||||
// // List<Map<String, String>> labelVals = [];
|
||||
// // List<String> labelValue = [];
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// CycleDetailObject? datas;
|
||||
// @override
|
||||
// void initState() {
|
||||
// dateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<CyclesProvider>(context, listen: false)
|
||||
.showCycleResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
datas = result;
|
||||
cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
sterilizerIdCTRL.text = datas!.sterileId;
|
||||
descriptionCTRL.text = datas!.description;
|
||||
dateCTRL.text = datas!.date;
|
||||
// for (var label in datas!.labels) {
|
||||
// labelCTRL.text = label;
|
||||
// }
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<CyclesProvider>(context, listen: false)
|
||||
.getLabelFilters()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
// labelVals = result;
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<CyclesProvider>(context, listen: false)
|
||||
// .showCycleResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// datas = result;
|
||||
// cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
// sterilizerIdCTRL.text = datas!.sterileId;
|
||||
// descriptionCTRL.text = datas!.description;
|
||||
// dateCTRL.text = datas!.date;
|
||||
// // for (var label in datas!.labels) {
|
||||
// // labelCTRL.text = label;
|
||||
// // }
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<CyclesProvider>(context, listen: false)
|
||||
// .getLabelFilters()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// // labelVals = result;
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.cycleResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.cycleResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Update a Cycle',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Strilizer ID required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: sterilizerIdCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(FontAwesomeIcons.sortNumericDown,
|
||||
size: 7 * _deviceBlockSize),
|
||||
isDense: true,
|
||||
labelText: 'Strilizer ID',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_cycleNumberFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Cycle number required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: cycleNumberCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Cycle Number',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
focusNode: _cycleNumberFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_descriptionFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LabelAddDatePicker(
|
||||
dateCTRL: dateCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
label: 'Date',
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 20.0,
|
||||
// ),
|
||||
// Consumer<CyclesProvider>(
|
||||
// builder: (ctx, cycleProvider, _) =>
|
||||
// ListView.builder(
|
||||
// physics: NeverScrollableScrollPhysics(),
|
||||
// shrinkWrap: true,
|
||||
// itemBuilder: (ctx, index) => AddLabelBox(
|
||||
// text: 'Select Labels included',
|
||||
// iconColor: kPinkSub,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// values: cycleProvider.labelValues[index],
|
||||
// vals: cycleProvider.labelVals,
|
||||
// initialLabelValue: labelCTRL.text,
|
||||
// index: index,
|
||||
// ),
|
||||
// itemCount: cycleProvider.labelValues.length,
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
controller: descriptionCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Description',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.multiline,
|
||||
focusNode: _descriptionFocusNode,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
CycleUpdateButton(
|
||||
form: _form,
|
||||
id: datas!.id,
|
||||
cycleNumberCTRL: cycleNumberCTRL,
|
||||
dateCTRL: dateCTRL,
|
||||
// labelValue: labelCTRL,
|
||||
striizerIdCTRL: sterilizerIdCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
descriptionCTRL: descriptionCTRL,
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.cycleResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Cycles', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.cycleResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'Update a Cycle',
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 6 * _deviceBlockSize,
|
||||
// letterSpacing: 3,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Strilizer ID required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: sterilizerIdCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(FontAwesomeIcons.sortNumericDown,
|
||||
// size: 7 * _deviceBlockSize),
|
||||
// isDense: true,
|
||||
// labelText: 'Strilizer ID',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_cycleNumberFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Cycle number required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: cycleNumberCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.sortNumericDown,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Cycle Number',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// focusNode: _cycleNumberFocusNode,
|
||||
// keyboardType: TextInputType.number,
|
||||
// textInputAction: TextInputAction.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_descriptionFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// LabelAddDatePicker(
|
||||
// dateCTRL: dateCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// label: 'Date',
|
||||
// ),
|
||||
// // SizedBox(
|
||||
// // height: 20.0,
|
||||
// // ),
|
||||
// // Consumer<CyclesProvider>(
|
||||
// // builder: (ctx, cycleProvider, _) =>
|
||||
// // ListView.builder(
|
||||
// // physics: NeverScrollableScrollPhysics(),
|
||||
// // shrinkWrap: true,
|
||||
// // itemBuilder: (ctx, index) => AddLabelBox(
|
||||
// // text: 'Select Labels included',
|
||||
// // iconColor: kPinkSub,
|
||||
// // deviceBlockSize: _deviceBlockSize,
|
||||
// // values: cycleProvider.labelValues[index],
|
||||
// // vals: cycleProvider.labelVals,
|
||||
// // initialLabelValue: labelCTRL.text,
|
||||
// // index: index,
|
||||
// // ),
|
||||
// // itemCount: cycleProvider.labelValues.length,
|
||||
// // ),
|
||||
// // ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// controller: descriptionCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Description',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.multiline,
|
||||
// focusNode: _descriptionFocusNode,
|
||||
// minLines: 1,
|
||||
// maxLines: 5,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 70,
|
||||
// ),
|
||||
// CycleUpdateButton(
|
||||
// form: _form,
|
||||
// id: datas!.id,
|
||||
// cycleNumberCTRL: cycleNumberCTRL,
|
||||
// dateCTRL: dateCTRL,
|
||||
// // labelValue: labelCTRL,
|
||||
// striizerIdCTRL: sterilizerIdCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// descriptionCTRL: descriptionCTRL,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
// ignore_for_file: unused_local_variable
|
||||
|
||||
import 'dart:isolate';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/widgets/ItemScreens/Filter/item_filter_object.dart';
|
||||
import 'package:cssd/widgets/ItemScreens/Result/item_data_box.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
@@ -25,11 +32,30 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
|
||||
bool _isInit = true;
|
||||
ScrollController? sc;
|
||||
TextEditingController searchCTRL = new TextEditingController();
|
||||
ReceivePort _port = ReceivePort();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
sc = new ScrollController();
|
||||
super.initState();
|
||||
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
|
||||
_port.listen((dynamic data) {
|
||||
String id = data[0];
|
||||
DownloadTaskStatus status = data[1];
|
||||
int progress = data[2];
|
||||
if (status == DownloadTaskStatus.complete) {
|
||||
print('Downloaded');
|
||||
}
|
||||
setState((){ });
|
||||
});
|
||||
|
||||
FlutterDownloader.registerCallback(downloadCallback);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
static void downloadCallback(String id, int status, int progress) {
|
||||
final SendPort? send = IsolateNameServer.lookupPortByName('downloader_send_port');
|
||||
send!.send([id, status, progress]);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -58,6 +84,12 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
IsolateNameServer.removePortNameMapping('downloader_send_port');
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
@@ -252,27 +284,30 @@ class ItemResultFloatingButton extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
// InkWell(
|
||||
// customBorder: CircleBorder(),
|
||||
// onTap: () {
|
||||
// Provider.of<ItemProvider>(context, listen: false).exportItems();
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.all(_deviceBlockSize),
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// child: Icon(
|
||||
// Icons.import_export,
|
||||
// size: 10 * _deviceBlockSize,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 2 * _deviceBlockSize,
|
||||
// ),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () async {
|
||||
var status = await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
Provider.of<ItemProvider>(context, listen: false).exportItems();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.import_export,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
|
||||
@@ -1,317 +1,317 @@
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/widgets/ItemScreens/Add/item_update_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
// import 'package:cssd/models/item_model.dart';
|
||||
// import 'package:cssd/providers/items.dart';
|
||||
// import 'package:cssd/widgets/ItemScreens/Add/item_update_button.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
// import '../../config/routes.dart';
|
||||
// import '../../providers/connectivity.dart';
|
||||
// import '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class ItemUpdateScreen extends StatefulWidget {
|
||||
@override
|
||||
_ItemUpdateScreenState createState() => _ItemUpdateScreenState();
|
||||
}
|
||||
// class ItemUpdateScreen extends StatefulWidget {
|
||||
// @override
|
||||
// _ItemUpdateScreenState createState() => _ItemUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _ItemUpdateScreenState extends State<ItemUpdateScreen> {
|
||||
final _itemSizeFocusNode = FocusNode();
|
||||
final _itemSpecificFocusNode = FocusNode();
|
||||
final _itemUdiFocusNode = FocusNode();
|
||||
final _descriptionFocusNode = FocusNode();
|
||||
TextEditingController descriptionCTRL = new TextEditingController();
|
||||
TextEditingController udiCTRL = new TextEditingController();
|
||||
TextEditingController nameCTRL = new TextEditingController();
|
||||
TextEditingController specificCTRL = new TextEditingController();
|
||||
TextEditingController sizeCTRL = new TextEditingController();
|
||||
TextEditingController dateCTRL = new TextEditingController();
|
||||
// class _ItemUpdateScreenState extends State<ItemUpdateScreen> {
|
||||
// final _itemSizeFocusNode = FocusNode();
|
||||
// final _itemSpecificFocusNode = FocusNode();
|
||||
// final _itemUdiFocusNode = FocusNode();
|
||||
// final _descriptionFocusNode = FocusNode();
|
||||
// TextEditingController descriptionCTRL = new TextEditingController();
|
||||
// TextEditingController udiCTRL = new TextEditingController();
|
||||
// TextEditingController nameCTRL = new TextEditingController();
|
||||
// TextEditingController specificCTRL = new TextEditingController();
|
||||
// TextEditingController sizeCTRL = new TextEditingController();
|
||||
// TextEditingController dateCTRL = new TextEditingController();
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
ItemDetailObject? datas;
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// ItemDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<ItemProvider>(context, listen: false)
|
||||
.showItemResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
datas = result;
|
||||
nameCTRL.text = datas!.name;
|
||||
udiCTRL.text = datas!.udi;
|
||||
descriptionCTRL.text = datas!.description;
|
||||
sizeCTRL.text = datas!.size;
|
||||
specificCTRL.text = datas!.specific;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<ItemProvider>(context, listen: false)
|
||||
.getItemResults()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<ItemProvider>(context, listen: false)
|
||||
// .showItemResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// datas = result;
|
||||
// nameCTRL.text = datas!.name;
|
||||
// udiCTRL.text = datas!.udi;
|
||||
// descriptionCTRL.text = datas!.description;
|
||||
// sizeCTRL.text = datas!.size;
|
||||
// specificCTRL.text = datas!.specific;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<ItemProvider>(context, listen: false)
|
||||
// .getItemResults()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.itemResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Items', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.itemResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Update a Item',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Name required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: nameCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize),
|
||||
isDense: true,
|
||||
labelText: 'Item Name',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.text,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_itemSizeFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Size required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: sizeCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Size',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
focusNode: _itemSizeFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_itemSpecificFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
controller: specificCTRL,
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Specific required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Specific',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
focusNode: _itemSpecificFocusNode,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_itemUdiFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
controller: udiCTRL,
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'UDI required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'UDI',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
focusNode: _itemUdiFocusNode,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_descriptionFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
controller: descriptionCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Description',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.multiline,
|
||||
focusNode: _descriptionFocusNode,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
ItemUpdateButton(
|
||||
form: _form,
|
||||
id: datas!.id,
|
||||
nameCTRL: nameCTRL,
|
||||
udiCTRL: udiCTRL,
|
||||
sizeCTRL: sizeCTRL,
|
||||
specificCTRL: specificCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
descriptionCTRL: descriptionCTRL,
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.itemResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Items', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.itemResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'Update a Item',
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 6 * _deviceBlockSize,
|
||||
// letterSpacing: 3,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Name required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: nameCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize),
|
||||
// isDense: true,
|
||||
// labelText: 'Item Name',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.text,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_itemSizeFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Size required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: sizeCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.sortNumericDown,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Size',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// focusNode: _itemSizeFocusNode,
|
||||
// keyboardType: TextInputType.number,
|
||||
// textInputAction: TextInputAction.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_itemSpecificFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// controller: specificCTRL,
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Specific required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Specific',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// focusNode: _itemSpecificFocusNode,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_itemUdiFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// controller: udiCTRL,
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'UDI required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'UDI',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// focusNode: _itemUdiFocusNode,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_descriptionFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// controller: descriptionCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Description',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.multiline,
|
||||
// focusNode: _descriptionFocusNode,
|
||||
// minLines: 1,
|
||||
// maxLines: 5,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 70,
|
||||
// ),
|
||||
// ItemUpdateButton(
|
||||
// form: _form,
|
||||
// id: datas!.id,
|
||||
// nameCTRL: nameCTRL,
|
||||
// udiCTRL: udiCTRL,
|
||||
// sizeCTRL: sizeCTRL,
|
||||
// specificCTRL: specificCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// descriptionCTRL: descriptionCTRL,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,309 +1,309 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
import 'package:provider/provider.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
// import 'package:intl/intl.dart' as DateEditor;
|
||||
// import 'package:provider/provider.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../models/label_models.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../providers/labels.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||
import '../../widgets/LabelScreens/Add/update_button.dart';
|
||||
// import '../../config/routes.dart';
|
||||
// import '../../models/label_models.dart';
|
||||
// import '../../providers/connectivity.dart';
|
||||
// import '../../providers/labels.dart';
|
||||
// import '../../widgets/Global/internet_error.dart';
|
||||
// import '../../widgets/LabelScreens/Add/date_picker.dart';
|
||||
// import '../../widgets/LabelScreens/Add/update_button.dart';
|
||||
|
||||
class LabelUpdateScreen extends StatefulWidget {
|
||||
// static const route = '/LabelUpdateScreen';
|
||||
// class LabelUpdateScreen extends StatefulWidget {
|
||||
// // static const route = '/LabelUpdateScreen';
|
||||
|
||||
@override
|
||||
_LabelUpdateScreenState createState() => _LabelUpdateScreenState();
|
||||
}
|
||||
// @override
|
||||
// _LabelUpdateScreenState createState() => _LabelUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
|
||||
final _cycleNumberFocusNode = FocusNode();
|
||||
final _lotNumberFocusNode = FocusNode();
|
||||
TextEditingController lotNumberCTRL = new TextEditingController();
|
||||
TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
TextEditingController striizerIdCTRL = new TextEditingController();
|
||||
TextEditingController sDateCTRL = new TextEditingController();
|
||||
TextEditingController eDateCTRL = new TextEditingController();
|
||||
// TextEditingController packageCTRL = new TextEditingController();
|
||||
// class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
|
||||
// final _cycleNumberFocusNode = FocusNode();
|
||||
// final _lotNumberFocusNode = FocusNode();
|
||||
// TextEditingController lotNumberCTRL = new TextEditingController();
|
||||
// TextEditingController cycleNumberCTRL = new TextEditingController();
|
||||
// TextEditingController striizerIdCTRL = new TextEditingController();
|
||||
// TextEditingController sDateCTRL = new TextEditingController();
|
||||
// TextEditingController eDateCTRL = new TextEditingController();
|
||||
// // TextEditingController packageCTRL = new TextEditingController();
|
||||
|
||||
DateTime? dateTimeS;
|
||||
// String sDateValue;
|
||||
// String eDateValue;
|
||||
// DateTime? dateTimeS;
|
||||
// // String sDateValue;
|
||||
// // String eDateValue;
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
// List<Map<String, String>> packageVals = [];
|
||||
// List<String> packageValue = [];
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
LabelDetailsObject? datas;
|
||||
// // List<Map<String, String>> packageVals = [];
|
||||
// // List<String> packageValue = [];
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// LabelDetailsObject? datas;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
eDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
super.initState();
|
||||
}
|
||||
// @override
|
||||
// void initState() {
|
||||
// sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
// eDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<LabelsProvider>(context, listen: false)
|
||||
.showLabelResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
// if (result.id == 'null') {
|
||||
// isEmpty = true;
|
||||
// }
|
||||
datas = result;
|
||||
lotNumberCTRL.text = datas!.lotNumber;
|
||||
cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
striizerIdCTRL.text = datas!.sterileId;
|
||||
sDateCTRL.text = datas!.sterileDate;
|
||||
eDateCTRL.text = datas!.expireDate;
|
||||
// packageValue.add(datas!.packageId);
|
||||
// packageValue.add(datas!.package);
|
||||
// packageCTRL.text = datas!.package;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<LabelsProvider>(context, listen: false)
|
||||
.getPackageFilters()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
// packageVals = result.map((value) => {"name": value}).toList();
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<LabelsProvider>(context, listen: false)
|
||||
// .showLabelResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// // if (result.id == 'null') {
|
||||
// // isEmpty = true;
|
||||
// // }
|
||||
// datas = result;
|
||||
// lotNumberCTRL.text = datas!.lotNumber;
|
||||
// cycleNumberCTRL.text = datas!.cycleNumber;
|
||||
// striizerIdCTRL.text = datas!.sterileId;
|
||||
// sDateCTRL.text = datas!.sterileDate;
|
||||
// eDateCTRL.text = datas!.expireDate;
|
||||
// // packageValue.add(datas!.packageId);
|
||||
// // packageValue.add(datas!.package);
|
||||
// // packageCTRL.text = datas!.package;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<LabelsProvider>(context, listen: false)
|
||||
// .getPackageFilters()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// // packageVals = result.map((value) => {"name": value}).toList();
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.labelResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Labels', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.labelResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Update a Label',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
lotNumberCTRL.text =
|
||||
val + ' - ' + cycleNumberCTRL.text;
|
||||
});
|
||||
},
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Strilizer ID required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: striizerIdCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(FontAwesomeIcons.sortNumericDown,
|
||||
size: 7 * _deviceBlockSize),
|
||||
isDense: true,
|
||||
labelText: 'Strilizer ID',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_cycleNumberFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
onChanged: (val) {
|
||||
setState(
|
||||
() {
|
||||
lotNumberCTRL.text =
|
||||
striizerIdCTRL.text + ' - ' + val;
|
||||
},
|
||||
);
|
||||
},
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Cycle number required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: cycleNumberCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Cycle Number',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
focusNode: _cycleNumberFocusNode,
|
||||
keyboardType: TextInputType.number,
|
||||
textInputAction: TextInputAction.done,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_lotNumberFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
readOnly: true,
|
||||
controller: lotNumberCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Lot Number',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2,
|
||||
horizontal: 3,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
focusNode: _lotNumberFocusNode,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
// LabelAddSelectorBox(
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// packageCTRL: packageCTRL,
|
||||
// packageVals: packageVals,
|
||||
// packageValue: packageValue,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
LabelAddDatePicker(
|
||||
dateCTRL: sDateCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
label: 'Sterile Date',
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
LabelAddDatePicker(
|
||||
dateCTRL: eDateCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
label: 'Expire Date',
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
LabelUpdateButton(
|
||||
form: _form,
|
||||
id: datas!.id,
|
||||
lotNumberCTRL: lotNumberCTRL,
|
||||
cycleNumberCTRL: cycleNumberCTRL,
|
||||
sDateCTRL: sDateCTRL,
|
||||
// packageValue: packageValue,
|
||||
eDateCTRL: eDateCTRL,
|
||||
striizerIdCTRL: striizerIdCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.labelResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Labels', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.labelResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'Update a Label',
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 6 * _deviceBlockSize,
|
||||
// letterSpacing: 3,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// onChanged: (val) {
|
||||
// setState(() {
|
||||
// lotNumberCTRL.text =
|
||||
// val + ' - ' + cycleNumberCTRL.text;
|
||||
// });
|
||||
// },
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Strilizer ID required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: striizerIdCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(FontAwesomeIcons.sortNumericDown,
|
||||
// size: 7 * _deviceBlockSize),
|
||||
// isDense: true,
|
||||
// labelText: 'Strilizer ID',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_cycleNumberFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// onChanged: (val) {
|
||||
// setState(
|
||||
// () {
|
||||
// lotNumberCTRL.text =
|
||||
// striizerIdCTRL.text + ' - ' + val;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Cycle number required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: cycleNumberCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.sortNumericDown,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Cycle Number',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// focusNode: _cycleNumberFocusNode,
|
||||
// keyboardType: TextInputType.number,
|
||||
// textInputAction: TextInputAction.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_lotNumberFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// readOnly: true,
|
||||
// controller: lotNumberCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.sortNumericDown,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Lot Number',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2,
|
||||
// horizontal: 3,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.visiblePassword,
|
||||
// focusNode: _lotNumberFocusNode,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// // LabelAddSelectorBox(
|
||||
// // deviceBlockSize: _deviceBlockSize,
|
||||
// // packageCTRL: packageCTRL,
|
||||
// // packageVals: packageVals,
|
||||
// // packageValue: packageValue,
|
||||
// // ),
|
||||
// // SizedBox(
|
||||
// // height: 20,
|
||||
// // ),
|
||||
// LabelAddDatePicker(
|
||||
// dateCTRL: sDateCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// label: 'Sterile Date',
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// LabelAddDatePicker(
|
||||
// dateCTRL: eDateCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// label: 'Expire Date',
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 70,
|
||||
// ),
|
||||
// LabelUpdateButton(
|
||||
// form: _form,
|
||||
// id: datas!.id,
|
||||
// lotNumberCTRL: lotNumberCTRL,
|
||||
// cycleNumberCTRL: cycleNumberCTRL,
|
||||
// sDateCTRL: sDateCTRL,
|
||||
// // packageValue: packageValue,
|
||||
// eDateCTRL: eDateCTRL,
|
||||
// striizerIdCTRL: striizerIdCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -37,10 +37,8 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var myItemResults = Provider.of<MyItemProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
myItemResults.setLoading();
|
||||
myItemResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
myItemResults.getMyItems().then(
|
||||
(_) {
|
||||
myItemResults.resetLoading();
|
||||
@@ -58,23 +56,6 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
myItemResults.getHospitalItems().then((_) {
|
||||
myItemResults.resetLoading();
|
||||
sc!.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||
searchCTRL.text == '') {
|
||||
var myItemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
myItemResults.getHospitalItems();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -177,13 +158,8 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
textInputType: TextInputType.visiblePassword,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
onChanged: (value) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
Provider.of<MyItemProvider>(context, listen: false)
|
||||
.searchMyItems(value);
|
||||
} else {
|
||||
Provider.of<MyItemProvider>(context, listen: false)
|
||||
.searchHospitalItems(value);
|
||||
}
|
||||
Provider.of<MyItemProvider>(context, listen: false)
|
||||
.searchMyItems(value);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@@ -201,11 +177,13 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return MyItemsItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
items: itemResults.myItems?[index],
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
items: itemResults.myItems?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myItemsHistoryScreen,
|
||||
@@ -213,26 +191,8 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
|
||||
itemResults.myItems?[index]);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return MyItemsItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
items:
|
||||
itemResults.hospitalItems?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(
|
||||
context,
|
||||
Routes.myItemsHistoryScreen,
|
||||
arguments: itemResults
|
||||
.hospitalItems?[index],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? itemResults.myItems?.length
|
||||
: itemResults.hospitalItems?.length,
|
||||
itemCount: itemResults.myItems?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -33,44 +33,24 @@ class _MyItemsRequestsScreenState extends State<MyItemsRequestsScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var itemResults = Provider.of<MyItemProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
itemResults.setLoading();
|
||||
itemResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
itemResults.getMyItemRequests().then(
|
||||
(_) {
|
||||
itemResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var itemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
itemResults.getMyItemRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
itemResults.getHospitalItemRequests().then(
|
||||
(_) {
|
||||
itemResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var itemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
itemResults.getHospitalItemRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
itemResults.getMyItemRequests().then(
|
||||
(_) {
|
||||
itemResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var itemResults = Provider.of<MyItemProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
itemResults.getMyItemRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -116,29 +96,18 @@ class _MyItemsRequestsScreenState extends State<MyItemsRequestsScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return RequestsDataBox(
|
||||
return RequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
item: itemResults
|
||||
.originalMyItemsRequests?[index],
|
||||
);
|
||||
} else {
|
||||
return RequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
item: itemResults
|
||||
.originalHospitalItemsRequests?[
|
||||
index],
|
||||
);
|
||||
}
|
||||
);
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? itemResults
|
||||
.originalMyItemsRequests?.length
|
||||
: itemResults
|
||||
.originalHospitalItemsRequests
|
||||
?.length,
|
||||
itemCount: itemResults
|
||||
.originalMyItemsRequests?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
@@ -37,10 +38,8 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var myPackageResults = Provider.of<MyPackageProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
myPackageResults.setLoading();
|
||||
myPackageResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
myPackageResults.getMyPackages().then(
|
||||
(_) {
|
||||
myPackageResults.resetLoading();
|
||||
@@ -58,23 +57,6 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
myPackageResults.getHospitalPackages().then((_) {
|
||||
myPackageResults.resetLoading();
|
||||
sc!.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent &&
|
||||
searchCTRL.text == '') {
|
||||
var myPackageResults = Provider.of<MyPackageProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
myPackageResults.getHospitalPackages();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -149,13 +131,8 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
text: 'package',
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
onChanged: (value) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
Provider.of<MyPackageProvider>(context, listen: false)
|
||||
.searchMyPackages(value);
|
||||
} else {
|
||||
Provider.of<MyPackageProvider>(context, listen: false)
|
||||
.searchHospitalPackages(value);
|
||||
}
|
||||
Provider.of<MyPackageProvider>(context, listen: false)
|
||||
.searchMyPackages(value);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@@ -173,37 +150,23 @@ class _MyPackagesMineScreenState extends State<MyPackagesMineScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
packages:
|
||||
packageResults.myPackages?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myPackagesHistoryScreen,
|
||||
arguments: packageResults
|
||||
.myPackages?[index]);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
packages: packageResults
|
||||
.hospitalPackages?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myPackagesHistoryScreen,
|
||||
arguments: packageResults
|
||||
.hospitalPackages?[index]);
|
||||
},
|
||||
);
|
||||
}
|
||||
return MyPackagesItemDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
packages:
|
||||
packageResults.myPackages?[index],
|
||||
push: () {
|
||||
Navigator.pushNamed(context,
|
||||
Routes.myPackagesHistoryScreen,
|
||||
arguments: packageResults
|
||||
.myPackages?[index]);
|
||||
},
|
||||
);
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? packageResults.myPackages?.length
|
||||
: packageResults.hospitalPackages?.length,
|
||||
itemCount: packageResults.myPackages?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -34,10 +34,8 @@ class _MyPackagesRequestsScreenState extends State<MyPackagesRequestsScreen> {
|
||||
void didChangeDependencies() {
|
||||
if (_isInit) {
|
||||
var packageResults = Provider.of<MyPackageProvider>(context);
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
packageResults.setLoading();
|
||||
packageResults.resetPageNumber();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
packageResults.getMyPackageRequests().then(
|
||||
(_) {
|
||||
packageResults.resetLoading();
|
||||
@@ -54,24 +52,6 @@ class _MyPackagesRequestsScreenState extends State<MyPackagesRequestsScreen> {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
packageResults.getHospitalPackageRequests().then(
|
||||
(_) {
|
||||
packageResults.resetLoading();
|
||||
sc?.addListener(
|
||||
() {
|
||||
if (sc!.position.pixels == sc!.position.maxScrollExtent) {
|
||||
var packageResults = Provider.of<MyPackageProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
packageResults.getHospitalPackageRequests();
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
_isInit = false;
|
||||
super.didChangeDependencies();
|
||||
@@ -117,29 +97,18 @@ class _MyPackagesRequestsScreenState extends State<MyPackagesRequestsScreen> {
|
||||
: ListView.builder(
|
||||
controller: sc,
|
||||
itemBuilder: (context, index) {
|
||||
if (userData['roles']?.contains('User')) {
|
||||
return PackageRequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: false,
|
||||
package: packageResults
|
||||
.originalMyPackagesRequests?[index],
|
||||
);
|
||||
} else {
|
||||
return PackageRequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin: true,
|
||||
package: packageResults
|
||||
.originalHospitalPackagesRequests?[
|
||||
index],
|
||||
);
|
||||
}
|
||||
return PackageRequestsDataBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
isAdmin:
|
||||
userData['roles']?.contains('User')
|
||||
? false
|
||||
: true,
|
||||
package: packageResults
|
||||
.originalMyPackagesRequests?[index],
|
||||
);
|
||||
},
|
||||
itemCount: userData['roles']?.contains('User')
|
||||
? packageResults
|
||||
.originalMyPackagesRequests?.length
|
||||
: packageResults
|
||||
.originalHospitalPackagesRequests
|
||||
?.length,
|
||||
itemCount: packageResults
|
||||
.originalMyPackagesRequests?.length,
|
||||
shrinkWrap: true,
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
// ignore_for_file: unused_local_variable
|
||||
|
||||
import 'dart:isolate';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/widgets/PackageScreens/Filter/package_filter_object.dart';
|
||||
import 'package:cssd/widgets/PackageScreens/Result/package_data_box.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
@@ -25,11 +32,30 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||
bool _isInit = true;
|
||||
ScrollController? sc;
|
||||
TextEditingController searchCTRL = new TextEditingController();
|
||||
ReceivePort _port = ReceivePort();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
sc = new ScrollController();
|
||||
super.initState();
|
||||
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
|
||||
_port.listen((dynamic data) {
|
||||
String id = data[0];
|
||||
DownloadTaskStatus status = data[1];
|
||||
int progress = data[2];
|
||||
if (status == DownloadTaskStatus.complete) {
|
||||
print('Downloaded');
|
||||
}
|
||||
setState((){ });
|
||||
});
|
||||
|
||||
FlutterDownloader.registerCallback(downloadCallback);
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
static void downloadCallback(String id, int status, int progress) {
|
||||
final SendPort? send = IsolateNameServer.lookupPortByName('downloader_send_port');
|
||||
send!.send([id, status, progress]);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -58,6 +84,12 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
IsolateNameServer.removePortNameMapping('downloader_send_port');
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
@@ -225,6 +257,30 @@ class PackageResultFloatingButton extends StatelessWidget {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () async {
|
||||
var status = await Permission.storage.request();
|
||||
if (status.isGranted) {
|
||||
Provider.of<PackageProvider>(context, listen: false).exportPackages();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.import_export,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
|
||||
@@ -1,241 +1,241 @@
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/widgets/PackageScreens/Add/package_update_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../config/routes.dart';
|
||||
import '../../providers/connectivity.dart';
|
||||
import '../../widgets/Global/internet_error.dart';
|
||||
// import 'package:cssd/models/package_model.dart';
|
||||
// import 'package:cssd/providers/packages.dart';
|
||||
// import 'package:cssd/widgets/PackageScreens/Add/package_update_button.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
// import 'package:provider/provider.dart';
|
||||
// import '../../config/routes.dart';
|
||||
// import '../../providers/connectivity.dart';
|
||||
// import '../../widgets/Global/internet_error.dart';
|
||||
|
||||
class PackageUpdateScreen extends StatefulWidget {
|
||||
@override
|
||||
_PackageUpdateScreenState createState() => _PackageUpdateScreenState();
|
||||
}
|
||||
// class PackageUpdateScreen extends StatefulWidget {
|
||||
// @override
|
||||
// _PackageUpdateScreenState createState() => _PackageUpdateScreenState();
|
||||
// }
|
||||
|
||||
class _PackageUpdateScreenState extends State<PackageUpdateScreen> {
|
||||
final _udiFocusNode = FocusNode();
|
||||
final _descriptionFocusNode = FocusNode();
|
||||
TextEditingController nameCTRL = new TextEditingController();
|
||||
// TextEditingController udiCTRL = new TextEditingController();
|
||||
TextEditingController descriptionCTRL = new TextEditingController();
|
||||
TextEditingController itemCTRL = new TextEditingController();
|
||||
// class _PackageUpdateScreenState extends State<PackageUpdateScreen> {
|
||||
// final _udiFocusNode = FocusNode();
|
||||
// final _descriptionFocusNode = FocusNode();
|
||||
// TextEditingController nameCTRL = new TextEditingController();
|
||||
// // TextEditingController udiCTRL = new TextEditingController();
|
||||
// TextEditingController descriptionCTRL = new TextEditingController();
|
||||
// TextEditingController itemCTRL = new TextEditingController();
|
||||
|
||||
final _form = GlobalKey<FormState>();
|
||||
// final _form = GlobalKey<FormState>();
|
||||
|
||||
bool isEmpty = false;
|
||||
bool isInit = true;
|
||||
PackageDetailObject? datas;
|
||||
// bool isEmpty = false;
|
||||
// bool isInit = true;
|
||||
// PackageDetailObject? datas;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
await Provider.of<PackageProvider>(context, listen: false)
|
||||
.showPackageResult(_id.toString())
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
datas = result;
|
||||
nameCTRL.text = datas!.name;
|
||||
// udiCTRL.text = datas!.udi;
|
||||
descriptionCTRL.text = datas!.description;
|
||||
for (String item in datas!.items) {
|
||||
itemCTRL.text = item;
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
await Provider.of<PackageProvider>(context, listen: false)
|
||||
.getItemFilters()
|
||||
.then(
|
||||
(result) {
|
||||
setState(
|
||||
() {
|
||||
isInit = false;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
// @override
|
||||
// void didChangeDependencies() async {
|
||||
// if (isInit) {
|
||||
// var _id = ModalRoute.of(context)!.settings.arguments;
|
||||
// await Provider.of<PackageProvider>(context, listen: false)
|
||||
// .showPackageResult(_id.toString())
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// datas = result;
|
||||
// nameCTRL.text = datas!.name;
|
||||
// // udiCTRL.text = datas!.udi;
|
||||
// descriptionCTRL.text = datas!.description;
|
||||
// for (String item in datas!.items) {
|
||||
// itemCTRL.text = item;
|
||||
// }
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// await Provider.of<PackageProvider>(context, listen: false)
|
||||
// .getItemFilters()
|
||||
// .then(
|
||||
// (result) {
|
||||
// setState(
|
||||
// () {
|
||||
// isInit = false;
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
// super.didChangeDependencies();
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.packageResultScreen,
|
||||
);
|
||||
return true;
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
backgroundColor: Colors.black,
|
||||
title: Text('Packages', style: TextStyle(color: Colors.white,),),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.keyboard_arrow_left,
|
||||
color: Colors.white,
|
||||
size: 35,
|
||||
),
|
||||
onPressed: () => Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.packageResultScreen),
|
||||
),
|
||||
),
|
||||
body: Consumer<ConnectivityProvider>(
|
||||
builder: (ct, connection, _) {
|
||||
return connection.conStatus != 'offline'
|
||||
? isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(color: Colors.black),
|
||||
)
|
||||
: Form(
|
||||
key: _form,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Update a Package',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TextFormField(
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Name required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
controller: nameCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize),
|
||||
isDense: true,
|
||||
labelText: 'Package Name',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.text,
|
||||
textInputAction: TextInputAction.next,
|
||||
onFieldSubmitted: (_) {
|
||||
FocusScope.of(context)
|
||||
.requestFocus(_udiFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'UDI required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: udiCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'UDI',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// focusNode: _udiFocusNode,
|
||||
// keyboardType: TextInputType.text,
|
||||
// textInputAction: TextInputAction.done,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_descriptionFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
TextFormField(
|
||||
controller: descriptionCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
isDense: true,
|
||||
labelText: 'Description',
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.multiline,
|
||||
focusNode: _descriptionFocusNode,
|
||||
minLines: 1,
|
||||
maxLines: 5,
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
),
|
||||
PackageUpdateButton(
|
||||
form: _form,
|
||||
id: datas!.id,
|
||||
nameCTRL: nameCTRL,
|
||||
// udiCTRL: udiCTRL,
|
||||
itemCTRL: itemCTRL,
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
descriptionCTRL: descriptionCTRL,
|
||||
),
|
||||
SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ConnectionErrorBox();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final _media = MediaQuery.of(context);
|
||||
// final double _devicewidth = _media.size.width;
|
||||
// final double _deviceBlockSize = _devicewidth / 100;
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.packageResultScreen,
|
||||
// );
|
||||
// return true;
|
||||
// },
|
||||
// child: SafeArea(
|
||||
// child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// titleSpacing: -10,
|
||||
// backgroundColor: Colors.black,
|
||||
// title: Text('Packages', style: TextStyle(color: Colors.white,),),
|
||||
// leading: IconButton(
|
||||
// icon: Icon(
|
||||
// Icons.keyboard_arrow_left,
|
||||
// color: Colors.white,
|
||||
// size: 35,
|
||||
// ),
|
||||
// onPressed: () => Navigator.of(context)
|
||||
// .pushReplacementNamed(Routes.packageResultScreen),
|
||||
// ),
|
||||
// ),
|
||||
// body: Consumer<ConnectivityProvider>(
|
||||
// builder: (ct, connection, _) {
|
||||
// return connection.conStatus != 'offline'
|
||||
// ? isInit
|
||||
// ? Center(
|
||||
// child: CircularProgressIndicator(color: Colors.black),
|
||||
// )
|
||||
// : Form(
|
||||
// key: _form,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.all(20),
|
||||
// child: ListView(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'Update a Package',
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 6 * _deviceBlockSize,
|
||||
// letterSpacing: 3,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// validator: (val) {
|
||||
// if (val!.isEmpty) {
|
||||
// return 'Name required!';
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// controller: nameCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize),
|
||||
// isDense: true,
|
||||
// labelText: 'Package Name',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.text,
|
||||
// textInputAction: TextInputAction.next,
|
||||
// onFieldSubmitted: (_) {
|
||||
// FocusScope.of(context)
|
||||
// .requestFocus(_udiFocusNode);
|
||||
// },
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// ),
|
||||
// // TextFormField(
|
||||
// // validator: (val) {
|
||||
// // if (val!.isEmpty) {
|
||||
// // return 'UDI required!';
|
||||
// // }
|
||||
// // return null;
|
||||
// // },
|
||||
// // controller: udiCTRL,
|
||||
// // decoration: InputDecoration(
|
||||
// // icon: Icon(
|
||||
// // FontAwesomeIcons.alignLeft,
|
||||
// // size: 7 * _deviceBlockSize,
|
||||
// // ),
|
||||
// // labelStyle: TextStyle(
|
||||
// // fontWeight: FontWeight.w100,
|
||||
// // fontSize: 4 * _deviceBlockSize,
|
||||
// // ),
|
||||
// // isDense: true,
|
||||
// // labelText: 'UDI',
|
||||
// // contentPadding: EdgeInsets.symmetric(
|
||||
// // vertical: 2, horizontal: 3),
|
||||
// // ),
|
||||
// // style: TextStyle(
|
||||
// // fontWeight: FontWeight.w700,
|
||||
// // fontSize: 5 * _deviceBlockSize,
|
||||
// // ),
|
||||
// // focusNode: _udiFocusNode,
|
||||
// // keyboardType: TextInputType.text,
|
||||
// // textInputAction: TextInputAction.done,
|
||||
// // onFieldSubmitted: (_) {
|
||||
// // FocusScope.of(context)
|
||||
// // .requestFocus(_descriptionFocusNode);
|
||||
// // },
|
||||
// // ),
|
||||
// // SizedBox(
|
||||
// // height: 20,
|
||||
// // ),
|
||||
// TextFormField(
|
||||
// controller: descriptionCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// icon: Icon(
|
||||
// FontAwesomeIcons.alignLeft,
|
||||
// size: 7 * _deviceBlockSize,
|
||||
// ),
|
||||
// labelStyle: TextStyle(
|
||||
// fontWeight: FontWeight.w100,
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// isDense: true,
|
||||
// labelText: 'Description',
|
||||
// contentPadding: EdgeInsets.symmetric(
|
||||
// vertical: 2, horizontal: 3),
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// keyboardType: TextInputType.multiline,
|
||||
// focusNode: _descriptionFocusNode,
|
||||
// minLines: 1,
|
||||
// maxLines: 5,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 70,
|
||||
// ),
|
||||
// PackageUpdateButton(
|
||||
// form: _form,
|
||||
// id: datas!.id,
|
||||
// nameCTRL: nameCTRL,
|
||||
// // udiCTRL: udiCTRL,
|
||||
// itemCTRL: itemCTRL,
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// descriptionCTRL: descriptionCTRL,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 100,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// : ConnectionErrorBox();
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -5,6 +5,8 @@ import 'package:cssd/models/my_item_model.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:random_string/random_string.dart';
|
||||
|
||||
import '../config/urls.dart';
|
||||
@@ -102,7 +104,6 @@ class ItemProvider extends ChangeNotifier {
|
||||
FormData formData = new FormData.fromMap(
|
||||
{
|
||||
"batch_id": batchId,
|
||||
'model_type': 'Item',
|
||||
"file": MultipartFile.fromBytes(imageListInt, filename: fileName)
|
||||
},
|
||||
);
|
||||
@@ -139,7 +140,7 @@ class ItemProvider extends ChangeNotifier {
|
||||
'specific': specific,
|
||||
'name': name,
|
||||
'udi': udi,
|
||||
'file_batch_id': batchId,
|
||||
'batch_id': batchId,
|
||||
},
|
||||
),
|
||||
headers: {
|
||||
@@ -288,6 +289,7 @@ class ItemProvider extends ChangeNotifier {
|
||||
userName: item['user'] != null ? item['user']['name'] : '',
|
||||
status: item['status'],
|
||||
udi: item['udi'],
|
||||
packageId: item['package_id'],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -306,6 +308,7 @@ class ItemProvider extends ChangeNotifier {
|
||||
description: 'null',
|
||||
name: 'null',
|
||||
userName: 'null',
|
||||
userCreator: 'null',
|
||||
specific: 'null',
|
||||
hospital: 'null',
|
||||
size: 'null',
|
||||
@@ -313,6 +316,7 @@ class ItemProvider extends ChangeNotifier {
|
||||
udi: 'null',
|
||||
status: 0,
|
||||
filePath: [],
|
||||
packageId: 'null',
|
||||
);
|
||||
}
|
||||
var data = json.decode(response.body)['data'];
|
||||
@@ -333,11 +337,13 @@ class ItemProvider extends ChangeNotifier {
|
||||
hospital:
|
||||
data['user'] != null ? data['user']['medical_center']['name'] : '',
|
||||
userName: data['user'] != null ? data['user']['name'] : '',
|
||||
userCreator: data['creator'] != null ? data['creator']['name'] : '',
|
||||
size: data['size'] != null ? data['size'] : '',
|
||||
specific: data['specific'] != null ? data['specific'] : '',
|
||||
createdAt: data['created_at'] != null ? data['created_at'] : '',
|
||||
udi: data['udi'] != null ? data['udi'] : '',
|
||||
status: data['status'],
|
||||
packageId: data['package_id'],
|
||||
filePath: mediaList,
|
||||
);
|
||||
return result!;
|
||||
@@ -369,13 +375,14 @@ class ItemProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<bool> exportItems() async {
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
Url.exportItems,
|
||||
),
|
||||
headers: {'Authorization': User.token},
|
||||
final baseStorage = await getExternalStorageDirectory();
|
||||
final taskId = await FlutterDownloader.enqueue(
|
||||
url: Url.exportItems,
|
||||
savedDir: baseStorage!.path,
|
||||
showNotification: true,
|
||||
openFileFromNotification: true,
|
||||
);
|
||||
print(response.body);
|
||||
print(taskId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+76
-75
@@ -11,13 +11,13 @@ class MyItemProvider extends ChangeNotifier {
|
||||
String searchBoxValue = '';
|
||||
bool filterOn = false;
|
||||
List<MyItemResultObject>? myItems;
|
||||
List<MyItemResultObject>? hospitalItems;
|
||||
// List<MyItemResultObject>? hospitalItems;
|
||||
|
||||
List<MyItemResultObject>? originalMyItems;
|
||||
List<MyItemResultObject>? originalHospitalItems;
|
||||
// List<MyItemResultObject>? originalHospitalItems;
|
||||
|
||||
List<MyItemResultObject>? originalMyItemsRequests;
|
||||
List<MyItemResultObject>? originalHospitalItemsRequests;
|
||||
// List<MyItemResultObject>? originalHospitalItemsRequests;
|
||||
|
||||
List<ItemHistoryObject>? itemHistory;
|
||||
|
||||
@@ -52,16 +52,16 @@ class MyItemProvider extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void searchHospitalItems(String value) {
|
||||
hospitalItems = [];
|
||||
searchBoxValue = value;
|
||||
originalHospitalItems!.forEach((result) {
|
||||
if (result.udi.toString().contains(searchBoxValue)) {
|
||||
hospitalItems!.add(result);
|
||||
}
|
||||
});
|
||||
notifyListeners();
|
||||
}
|
||||
// void searchHospitalItems(String value) {
|
||||
// hospitalItems = [];
|
||||
// searchBoxValue = value;
|
||||
// originalHospitalItems!.forEach((result) {
|
||||
// if (result.udi.toString().contains(searchBoxValue)) {
|
||||
// hospitalItems!.add(result);
|
||||
// }
|
||||
// });
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
void setFilters(
|
||||
id,
|
||||
@@ -127,6 +127,7 @@ class MyItemProvider extends ChangeNotifier {
|
||||
id: item['id'].toString(),
|
||||
size: item['size'].toString(),
|
||||
udi: item['udi'],
|
||||
userName: item['user'] != null ? item['user']['name'] : '',
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -134,50 +135,50 @@ class MyItemProvider extends ChangeNotifier {
|
||||
searchMyItems('');
|
||||
}
|
||||
|
||||
Future<void> getHospitalItems() async {
|
||||
String url = Url.getHospitalItems(pageNumber);
|
||||
if (filterOn) {
|
||||
if (filters!.id != '') {
|
||||
url += '&item_id=${filters!.id}';
|
||||
}
|
||||
if (filters!.name != '') {
|
||||
url += '&name=${filters!.name}';
|
||||
}
|
||||
if (filters!.size != '') {
|
||||
url += '&size=${filters!.size}';
|
||||
}
|
||||
if (filters!.specific != '') {
|
||||
url += '&specific=${filters!.specific}';
|
||||
}
|
||||
if (filters!.udi != '') {
|
||||
url += '&udi=${filters!.udi}';
|
||||
}
|
||||
}
|
||||
var response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
);
|
||||
// Future<void> getHospitalItems() async {
|
||||
// String url = Url.getHospitalItems(pageNumber);
|
||||
// if (filterOn) {
|
||||
// if (filters!.id != '') {
|
||||
// url += '&item_id=${filters!.id}';
|
||||
// }
|
||||
// if (filters!.name != '') {
|
||||
// url += '&name=${filters!.name}';
|
||||
// }
|
||||
// if (filters!.size != '') {
|
||||
// url += '&size=${filters!.size}';
|
||||
// }
|
||||
// if (filters!.specific != '') {
|
||||
// url += '&specific=${filters!.specific}';
|
||||
// }
|
||||
// if (filters!.udi != '') {
|
||||
// url += '&udi=${filters!.udi}';
|
||||
// }
|
||||
// }
|
||||
// var response = await http.get(
|
||||
// Uri.parse(url),
|
||||
// headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
// );
|
||||
|
||||
var itemsData = json.decode(response.body);
|
||||
// var itemsData = json.decode(response.body);
|
||||
|
||||
if (pageNumber == 1) {
|
||||
originalHospitalItems = [];
|
||||
}
|
||||
// if (pageNumber == 1) {
|
||||
// originalHospitalItems = [];
|
||||
// }
|
||||
|
||||
for (var item in itemsData['data']['data']) {
|
||||
originalHospitalItems!.add(
|
||||
MyItemResultObject(
|
||||
name: item['name'],
|
||||
id: item['id'].toString(),
|
||||
size: item['size'].toString(),
|
||||
userName: item['user'] != null ? item['user']['name'] : '',
|
||||
udi: item['udi'],
|
||||
),
|
||||
);
|
||||
}
|
||||
pageNumber += 1;
|
||||
searchHospitalItems('');
|
||||
}
|
||||
// for (var item in itemsData['data']['data']) {
|
||||
// originalHospitalItems!.add(
|
||||
// MyItemResultObject(
|
||||
// name: item['name'],
|
||||
// id: item['id'].toString(),
|
||||
// size: item['size'].toString(),
|
||||
// userName: item['user'] != null ? item['user']['name'] : '',
|
||||
// udi: item['udi'],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// pageNumber += 1;
|
||||
// searchHospitalItems('');
|
||||
// }
|
||||
|
||||
Future<void> getItemsHistory(String id) async {
|
||||
String url = Url.getItemResult(id);
|
||||
@@ -230,30 +231,30 @@ class MyItemProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getHospitalItemRequests() async {
|
||||
String url = Url.getHospitalItemRequests;
|
||||
var response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
);
|
||||
// Future<void> getHospitalItemRequests() async {
|
||||
// String url = Url.getHospitalItemRequests;
|
||||
// var response = await http.get(
|
||||
// Uri.parse(url),
|
||||
// headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
// );
|
||||
|
||||
var itemsData = json.decode(response.body);
|
||||
print(itemsData);
|
||||
// var itemsData = json.decode(response.body);
|
||||
// print(itemsData);
|
||||
|
||||
originalHospitalItemsRequests = [];
|
||||
// originalHospitalItemsRequests = [];
|
||||
|
||||
for (var item in itemsData['data']) {
|
||||
originalHospitalItemsRequests!.add(
|
||||
MyItemResultObject(
|
||||
name: item['transferable']['name'].toString(),
|
||||
id: item['transferable']['id'].toString(),
|
||||
size: item['transferable']['size'].toString(),
|
||||
userName: item['user'] != null ? item['user']['name'] : '',
|
||||
requestId: item['id'].toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// for (var item in itemsData['data']) {
|
||||
// originalHospitalItemsRequests!.add(
|
||||
// MyItemResultObject(
|
||||
// name: item['transferable']['name'].toString(),
|
||||
// id: item['transferable']['id'].toString(),
|
||||
// size: item['transferable']['size'].toString(),
|
||||
// userName: item['user'] != null ? item['user']['name'] : '',
|
||||
// requestId: item['id'].toString(),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> transferItems(String itemId, String userId) async {
|
||||
var response = await http.post(
|
||||
|
||||
@@ -11,13 +11,13 @@ class MyPackageProvider extends ChangeNotifier {
|
||||
String searchBoxValue = '';
|
||||
bool filterOn = false;
|
||||
List<MyPackageResultObject>? myPackages;
|
||||
List<MyPackageResultObject>? hospitalPackages;
|
||||
// List<MyPackageResultObject>? hospitalPackages;
|
||||
|
||||
List<MyPackageResultObject>? originalMyPackages;
|
||||
List<MyPackageResultObject>? originalHospitalPackages;
|
||||
// List<MyPackageResultObject>? originalHospitalPackages;
|
||||
|
||||
List<MyPackageResultObject>? originalMyPackagesRequests;
|
||||
List<MyPackageResultObject>? originalHospitalPackagesRequests;
|
||||
// List<MyPackageResultObject>? originalHospitalPackagesRequests;
|
||||
|
||||
List<PackageHistoryObject>? packageHistory;
|
||||
|
||||
@@ -50,16 +50,16 @@ class MyPackageProvider extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void searchHospitalPackages(String value) {
|
||||
hospitalPackages = [];
|
||||
searchBoxValue = value;
|
||||
originalHospitalPackages!.forEach((result) {
|
||||
if (result.id.toString().contains(searchBoxValue)) {
|
||||
hospitalPackages!.add(result);
|
||||
}
|
||||
});
|
||||
notifyListeners();
|
||||
}
|
||||
// void searchHospitalPackages(String value) {
|
||||
// hospitalPackages = [];
|
||||
// searchBoxValue = value;
|
||||
// originalHospitalPackages!.forEach((result) {
|
||||
// if (result.id.toString().contains(searchBoxValue)) {
|
||||
// hospitalPackages!.add(result);
|
||||
// }
|
||||
// });
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
void setFilters(
|
||||
id,
|
||||
@@ -110,6 +110,7 @@ class MyPackageProvider extends ChangeNotifier {
|
||||
name: package['name'],
|
||||
id: package['id'].toString(),
|
||||
createdAt: package['created_at'].toString(),
|
||||
userName: package['user'] != null ? package['user']['name'] : '',
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -117,43 +118,43 @@ class MyPackageProvider extends ChangeNotifier {
|
||||
searchMyPackages('');
|
||||
}
|
||||
|
||||
Future<void> getHospitalPackages() async {
|
||||
String url = Url.getHospitalPackages(pageNumber);
|
||||
if (filterOn) {
|
||||
if (filters!.id != '') {
|
||||
url += '&package_id=${filters!.id}';
|
||||
}
|
||||
if (filters!.name != '') {
|
||||
url += '&name=${filters!.name}';
|
||||
}
|
||||
// if (filters!.udi != '') {
|
||||
// url += '&package_id=${filters!.udi}';
|
||||
// }
|
||||
}
|
||||
var response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
);
|
||||
// Future<void> getHospitalPackages() async {
|
||||
// String url = Url.getHospitalPackages(pageNumber);
|
||||
// if (filterOn) {
|
||||
// if (filters!.id != '') {
|
||||
// url += '&package_id=${filters!.id}';
|
||||
// }
|
||||
// if (filters!.name != '') {
|
||||
// url += '&name=${filters!.name}';
|
||||
// }
|
||||
// // if (filters!.udi != '') {
|
||||
// // url += '&package_id=${filters!.udi}';
|
||||
// // }
|
||||
// }
|
||||
// var response = await http.get(
|
||||
// Uri.parse(url),
|
||||
// headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
// );
|
||||
|
||||
var packagesData = json.decode(response.body);
|
||||
// var packagesData = json.decode(response.body);
|
||||
|
||||
if (pageNumber == 1) {
|
||||
originalHospitalPackages = [];
|
||||
}
|
||||
// if (pageNumber == 1) {
|
||||
// originalHospitalPackages = [];
|
||||
// }
|
||||
|
||||
for (var package in packagesData['data']) {
|
||||
originalHospitalPackages!.add(
|
||||
MyPackageResultObject(
|
||||
name: package['name'],
|
||||
id: package['id'].toString(),
|
||||
createdAt: package['created_at'].toString(),
|
||||
userName: package['user'] != null ? package['user']['name'] : '',
|
||||
),
|
||||
);
|
||||
}
|
||||
pageNumber += 1;
|
||||
searchHospitalPackages('');
|
||||
}
|
||||
// for (var package in packagesData['data']) {
|
||||
// originalHospitalPackages!.add(
|
||||
// MyPackageResultObject(
|
||||
// name: package['name'],
|
||||
// id: package['id'].toString(),
|
||||
// createdAt: package['created_at'].toString(),
|
||||
// userName: package['user'] != null ? package['user']['name'] : '',
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// pageNumber += 1;
|
||||
// searchHospitalPackages('');
|
||||
// }
|
||||
|
||||
Future<void> getMyPackageRequests() async {
|
||||
String url = Url.getMyPackageRequests;
|
||||
@@ -178,29 +179,29 @@ class MyPackageProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getHospitalPackageRequests() async {
|
||||
String url = Url.getHospitalPackageRequests;
|
||||
var response = await http.get(
|
||||
Uri.parse(url),
|
||||
headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
);
|
||||
// Future<void> getHospitalPackageRequests() async {
|
||||
// String url = Url.getHospitalPackageRequests;
|
||||
// var response = await http.get(
|
||||
// Uri.parse(url),
|
||||
// headers: {'Authorization': User.token, "Accept": "application/json"},
|
||||
// );
|
||||
|
||||
var packagesData = json.decode(response.body);
|
||||
// var packagesData = json.decode(response.body);
|
||||
|
||||
originalHospitalPackagesRequests = [];
|
||||
// originalHospitalPackagesRequests = [];
|
||||
|
||||
for (var package in packagesData['data']) {
|
||||
originalHospitalPackagesRequests!.add(
|
||||
MyPackageResultObject(
|
||||
name: package['transferable']['name'],
|
||||
id: package['transferable']['id'].toString(),
|
||||
createdAt: package['created_at'].toString(),
|
||||
userName: package['user'] != null ? package['user']['name'] : '',
|
||||
requestId: package['id'].toString(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// for (var package in packagesData['data']) {
|
||||
// originalHospitalPackagesRequests!.add(
|
||||
// MyPackageResultObject(
|
||||
// name: package['transferable']['name'],
|
||||
// id: package['transferable']['id'].toString(),
|
||||
// createdAt: package['created_at'].toString(),
|
||||
// userName: package['user'] != null ? package['user']['name'] : '',
|
||||
// requestId: package['id'].toString(),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> getPackagesHistory(String id) async {
|
||||
String url = Url.getPackageResult(id);
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'dart:convert';
|
||||
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:flutter_downloader/flutter_downloader.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import '../config/urls.dart';
|
||||
import '../config/user.dart';
|
||||
@@ -307,6 +309,8 @@ class PackageProvider extends ChangeNotifier {
|
||||
hospitalName: 'null',
|
||||
// udi: 'null',
|
||||
items: [],
|
||||
userName: 'null',
|
||||
userCreator: 'null',
|
||||
);
|
||||
}
|
||||
var data = json.decode(response.body)['data'];
|
||||
@@ -326,8 +330,22 @@ class PackageProvider extends ChangeNotifier {
|
||||
createDate: data['created_at'] != null ? data['created_at'] : '',
|
||||
hospitalName:
|
||||
data['user'] != null ? data['user']['medical_center']['name'] : '',
|
||||
userName: data['user'] != null ? data['user']['name'] : '',
|
||||
userCreator: data['creator'] != null ? data['creator']['name'] : '',
|
||||
items: itemsList,
|
||||
);
|
||||
return result!;
|
||||
}
|
||||
|
||||
Future<bool> exportPackages() async {
|
||||
final baseStorage = await getExternalStorageDirectory();
|
||||
final taskId = await FlutterDownloader.enqueue(
|
||||
url: Url.exportPackages,
|
||||
savedDir: baseStorage!.path,
|
||||
showNotification: true,
|
||||
openFileFromNotification: true,
|
||||
);
|
||||
print(taskId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,6 @@ class TestResultsProvider with ChangeNotifier {
|
||||
};
|
||||
di.FormData formData = new di.FormData.fromMap({
|
||||
"batch_id": batchId,
|
||||
'model_type': 'TestResult',
|
||||
"file": di.MultipartFile.fromBytes(imageListInt, filename: fileName)
|
||||
});
|
||||
|
||||
@@ -268,7 +267,7 @@ class TestResultsProvider with ChangeNotifier {
|
||||
await addImage(batchId, image.bytes, image.path!);
|
||||
}
|
||||
dynamic vals = values;
|
||||
vals['file_batch_id'] = batchId;
|
||||
vals['batch_id'] = batchId;
|
||||
|
||||
// int counter = 0;
|
||||
// if (images.length != 0) {
|
||||
|
||||
@@ -108,25 +108,25 @@ class CycleItemBox extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.cycleUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
// userData['roles']?.contains('User') ?? false
|
||||
// ? Container()
|
||||
// : InkWell(
|
||||
// customBorder: CircleBorder(),
|
||||
// onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.cycleUpdateScreen,
|
||||
// arguments: item!.id,
|
||||
// );
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.edit,
|
||||
// size: 5 * _deviceBlockSize,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 5.0,
|
||||
// ),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
|
||||
@@ -159,7 +159,7 @@ class ItemDetailsDataBox extends StatelessWidget {
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'User',
|
||||
'Owner',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
@@ -181,6 +181,33 @@ class ItemDetailsDataBox extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Creator',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userCreator.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
|
||||
@@ -163,14 +163,14 @@ class ItemItemBox extends StatelessWidget {
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 6 * _deviceBlockSize,
|
||||
width: 8 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: item!.status == 1 ? kPink : kBlue,
|
||||
),
|
||||
child: Icon(
|
||||
item!.status == 1 ? Icons.close : Icons.check,
|
||||
size: 2 * _deviceBlockSize,
|
||||
size: 4 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
@@ -178,27 +178,26 @@ class ItemItemBox extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.itemUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
// userData['roles']?.contains('User') ?? false
|
||||
// ? Container()
|
||||
// : InkWell(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.itemUpdateScreen,
|
||||
// arguments: item!.id,
|
||||
// );
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.edit,
|
||||
// size: 5 * _deviceBlockSize,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 5.0,
|
||||
// ),
|
||||
userData['roles']?.contains('Admin') ?? false
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
@@ -206,7 +205,7 @@ class ItemItemBox extends StatelessWidget {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text(
|
||||
'Are you sure you want delete this Item?'),
|
||||
'Are you sure you want delete this Item?',),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Yes'),
|
||||
@@ -233,7 +232,49 @@ class ItemItemBox extends StatelessWidget {
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
)
|
||||
: userData['roles']?.contains('Supervisor')
|
||||
? item!.packageId != null
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text(
|
||||
'Are you sure you want delete this Item?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Yes'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Provider.of<ItemProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.removeItems(item!.id);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('No'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
: Container(),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
|
||||
@@ -100,25 +100,25 @@ class LabelItemBox extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.labelUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
// userData['roles']?.contains('User') ?? false
|
||||
// ? Container()
|
||||
// : InkWell(
|
||||
// customBorder: CircleBorder(),
|
||||
// onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.labelUpdateScreen,
|
||||
// arguments: item!.id,
|
||||
// );
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.edit,
|
||||
// size: 5 * _deviceBlockSize,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 5.0,
|
||||
// ),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
|
||||
@@ -168,7 +168,7 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'User',
|
||||
'Owner',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
@@ -190,6 +190,33 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Creator',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userCreator.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
@@ -332,21 +359,32 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
text: 'Transfer',
|
||||
onTap: () {
|
||||
push();
|
||||
},
|
||||
),
|
||||
userData['roles']?.contains('Admin') ?? false
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
text: 'Transfer',
|
||||
onTap: () {
|
||||
push();
|
||||
},
|
||||
)
|
||||
: datas.packageId != null
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
text: 'Transfer',
|
||||
onTap: () {
|
||||
push();
|
||||
},
|
||||
)
|
||||
: Container(),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
userData['roles']?.contains('Admin') ?? false
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
@@ -417,13 +455,88 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: userData['roles'].contains('Supervisor')
|
||||
? datas.packageId != null
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
text: 'Destroy',
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to destroy this Item?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 220,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your item will be removed and it can not be used any more.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ItemCard(_deviceBlockSize),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
onTap: () {
|
||||
Provider.of<ItemProvider>(context,
|
||||
listen: false)
|
||||
.removeItems(datas.id)
|
||||
.then(
|
||||
(value) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.myItemsResultScreen,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Destroy',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kDarkBlue,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
: Container()
|
||||
: Container(),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
userData['roles']?.contains('Admin') ?? false
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: Colors.black,
|
||||
secondColor: Colors.black87,
|
||||
@@ -494,7 +607,84 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: userData['roles'].contains('Supervisor')
|
||||
? datas.packageId != null
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: Colors.black,
|
||||
secondColor: Colors.black87,
|
||||
text: 'Repair',
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to repair this Item?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 220,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your item will be set in repair mode and it can be use anymore unless you disable repair mode.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ItemCard(_deviceBlockSize),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: Colors.black,
|
||||
secondColor: Colors.black87,
|
||||
onTap: () {
|
||||
Provider.of<MyItemProvider>(context,
|
||||
listen: false)
|
||||
.repairItems(
|
||||
datas.id, 'approved')
|
||||
.then(
|
||||
(value) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.myItemsResultScreen,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Repair',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kDarkBlue,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
)
|
||||
: Container()
|
||||
: Container(),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
|
||||
@@ -8,6 +8,7 @@ class TransferDestroyButton extends StatelessWidget {
|
||||
required this.secondColor,
|
||||
required this.onTap,
|
||||
required this.text,
|
||||
this.fontSize = 5.0,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
final double _deviceBlockSize;
|
||||
@@ -15,6 +16,7 @@ class TransferDestroyButton extends StatelessWidget {
|
||||
final Color secondColor;
|
||||
final String text;
|
||||
final VoidCallback onTap;
|
||||
final double fontSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -37,7 +39,7 @@ class TransferDestroyButton extends StatelessWidget {
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
fontSize: fontSize * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/my_items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -32,7 +31,6 @@ class MyItemFilterChip extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
@@ -61,19 +59,11 @@ class MyItemFilterChip extends StatelessWidget {
|
||||
_specific,
|
||||
);
|
||||
itemProvider.setLoading();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
itemProvider.getMyItems().then(
|
||||
(_) {
|
||||
itemProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
itemProvider.getHospitalItems().then(
|
||||
(_) {
|
||||
itemProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
}
|
||||
itemProvider.getMyItems().then(
|
||||
(_) {
|
||||
itemProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/widgets/MyItemsScreens/Detail/cancel_transfer_button.dart';
|
||||
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
@@ -20,7 +25,7 @@ class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
@@ -129,6 +134,64 @@ class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Owner',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Creator',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userCreator.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
// Divider(),
|
||||
// SizedBox(
|
||||
// height: 5,
|
||||
@@ -271,83 +334,83 @@ class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
push();
|
||||
},
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10.0,
|
||||
// ),
|
||||
// userData['roles']?.contains('User') ?? false
|
||||
// ? Container()
|
||||
// : TransferDestroyButton(
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// firstColor: kPink,
|
||||
// secondColor: kPinkSub,
|
||||
// text: 'Destroy',
|
||||
// onTap: () {
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return AlertDialog(
|
||||
// title: Text(
|
||||
// 'Are you sure to destroy this Package?',
|
||||
// style: TextStyle(
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// content: SizedBox(
|
||||
// width: _deviceBlockSize,
|
||||
// height: 220,
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'By approving, your package will be removed and it can not be used any more.',
|
||||
// style: TextStyle(
|
||||
// fontSize: 3 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 10.0,
|
||||
// ),
|
||||
// PackageCard(_deviceBlockSize),
|
||||
// SizedBox(
|
||||
// height: 20.0,
|
||||
// ),
|
||||
// TransferDestroyButton(
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// firstColor: kPink,
|
||||
// secondColor: kPinkSub,
|
||||
// onTap: () {
|
||||
// Provider.of<PackageProvider>(context,
|
||||
// listen: false)
|
||||
// .removePackages(datas.id)
|
||||
// .then(
|
||||
// (value) {
|
||||
// Navigator.of(context).pop();
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.myPackagesResultScreen,
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// text: 'Destroy',
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 5.0,
|
||||
// ),
|
||||
// CancelTransferButton(
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// color: kDarkPurple,
|
||||
// onTap: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
text: 'Back Items to Item List',
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to destroy this Package?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 220,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your package will be removed and it can not be used any more.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
PackageCard(_deviceBlockSize),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
onTap: () {
|
||||
Provider.of<PackageProvider>(context,
|
||||
listen: false)
|
||||
.removePackages(datas.id)
|
||||
.then(
|
||||
(value) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.myPackagesResultScreen,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Destroy',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kDarkPurple,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/my_packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -26,7 +25,6 @@ class MyPackageFilterChip extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
@@ -53,19 +51,11 @@ class MyPackageFilterChip extends StatelessWidget {
|
||||
// _udi,
|
||||
);
|
||||
packageProvider.setLoading();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
packageProvider.getMyPackages().then(
|
||||
packageProvider.getMyPackages().then(
|
||||
(_) {
|
||||
packageProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
packageProvider.getHospitalPackages().then(
|
||||
(_) {
|
||||
packageProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@@ -132,6 +132,60 @@ class PackageDetailsDataBox extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Owner',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Creator',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userCreator.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
// Row(
|
||||
// children: <Widget>[
|
||||
// Container(
|
||||
@@ -264,6 +318,7 @@ class PackageDetailsDataBox extends StatelessWidget {
|
||||
secondColor: kPurpleSub,
|
||||
onTap: goToAddLabelPage,
|
||||
text: 'Make a Label For Package',
|
||||
fontSize: 4.0,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
|
||||
@@ -106,25 +106,25 @@ class PackageItemBox extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.packageUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
// userData['roles']?.contains('User') ?? false
|
||||
// ? Container()
|
||||
// : InkWell(
|
||||
// customBorder: CircleBorder(),
|
||||
// onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.packageUpdateScreen,
|
||||
// arguments: item!.id,
|
||||
// );
|
||||
// },
|
||||
// child: Icon(
|
||||
// Icons.edit,
|
||||
// size: 5 * _deviceBlockSize,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 5.0,
|
||||
// ),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
|
||||
Reference in New Issue
Block a user