mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 22:28:55 +03:30
310 lines
14 KiB
Dart
Executable File
310 lines
14 KiB
Dart
Executable File
// 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';
|
|
|
|
// class LabelUpdateScreen extends StatefulWidget {
|
|
// // static const route = '/LabelUpdateScreen';
|
|
|
|
// @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();
|
|
|
|
// DateTime? dateTimeS;
|
|
// // String sDateValue;
|
|
// // String eDateValue;
|
|
|
|
// final _form = GlobalKey<FormState>();
|
|
|
|
// // 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 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();
|
|
// },
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// );
|
|
// }
|
|
// }
|