main_design2.0
nextwo 2 years ago
parent d33c97d1df
commit b3c577d03e

@ -70,7 +70,7 @@ class URLs {
static get getServiceReportLastCalls => "$_baseUrl/WorkOrder/GetLookupCallLastSituationBasedOnCase"; // get
static get getAssetTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=500"; // get
static get getPartNumber => "$_baseUrl/PartCatalog/GetPartAutoComplete"; // get
static get getServiceReportPriority => "$_baseUrl/Lookups/GetLookup?lookupEnum=602"; // get
static get getServiceReportPriority => "$_baseUrl/Lookups/GetLookup?lookupEnum=4"; // get
static get getServiceReportDefectTypes => "$_baseUrl/Lookups/GetLookup?lookupEnum=601"; // get
static get getCallRequestForWorkOrder => "$_baseUrl/CallRequest/GetCallRequestForWorkOrder"; // get

@ -185,24 +185,23 @@ class GasRefillProvider extends ChangeNotifier {
})
.toList();
log(body.toString());
return -1;
// Response response;
// try {
// response = await ApiManager.instance.put(URLs.updateGasRefill, body: body);
// // response = await post(
// // Uri.parse("$host${URLs.updateGasRefill}/${newModel.id}"),
// // body: body,
// // );
//
// stateCode = response.statusCode;
// if (response.statusCode >= 200 && response.statusCode < 300) {
// oldModel.fromGasRefillModel(newModel);
// notifyListeners();
// }
// return response.statusCode;
// } catch (error) {
// return -1;
// }
Response response;
try {
response = await ApiManager.instance.put(URLs.updateGasRefill, body: body);
// response = await post(
// Uri.parse("$host${URLs.updateGasRefill}/${newModel.id}"),
// body: body,
// );
stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
oldModel.fromGasRefillModel(newModel);
notifyListeners();
}
return response.statusCode;
} catch (error) {
return -1;
}
}
Hospital hospital;

@ -25,9 +25,9 @@ import '../../../../models/enums/user_types.dart';
import '../../../app_style/colors.dart';
class GasRefillDetails extends StatefulWidget {
final GasRefillModel model;
GasRefillModel model;
const GasRefillDetails({Key key, this.model}) : super(key: key);
GasRefillDetails({Key key, this.model}) : super(key: key);
@override
State<GasRefillDetails> createState() => _GasRefillDetailsState();
@ -102,7 +102,9 @@ class _GasRefillDetailsState extends State<GasRefillDetails> {
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 4),
child: Row(
children: [
const ABackButton(),
ABackButton(onPressed: (){
Navigator.of(context).pop(_model);
},),
Expanded(
child: Center(
child: Text(
@ -123,14 +125,17 @@ class _GasRefillDetailsState extends State<GasRefillDetails> {
_model.fromGasRefillModel(widget.model);
print(widget.model.startDate);
// setState(() {});
Navigator.push(
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RequestGasRefill(
gasRefillModel: widget.model,
),
),
);
).then((value) {
_model.status= value;
});
setState(() {});
},
),
const SizedBox(

@ -106,7 +106,8 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
Fluttertoast.showToast(
msg: _subtitle.requestCompleteSuccessfully,
);
Navigator.of(context).pop();
Navigator.of(context).pop(_formModel.status);
setState(() { });
} else {
String errorMessage = HttpStatusManger.getStatusMessage(status: status, subtitle: _subtitle);
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
@ -151,7 +152,7 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
_settingProvider = Provider.of<SettingProvider>(context);
if (_gasRefillProvider == null) {
_gasRefillProvider = Provider.of<GasRefillProvider>(context, listen: false);
_gasRefillProvider.reset();
//_gasRefillProvider.reset();
}
if (_firstTime) {
if (widget.gasRefillModel != null) {

@ -189,7 +189,7 @@ class CreateRequestPageState extends State<CreateRequestPage> {
height: 4,
),
ServiceRequestPriorityMenu(
initialValue: _serviceRequest.priority,
initialValue: widget.serviceRequest.priority,
onSelect: (status) {
_serviceRequest.priority = status;
},
@ -341,13 +341,13 @@ class CreateRequestPageState extends State<CreateRequestPage> {
child: AButton(
text: widget.serviceRequest == null ? _subtitle.submit : _subtitle.update,
onPressed: () async {
if (!_formKey.currentState.validate()) return;
//if (!_formKey.currentState.validate()) return;
if (_device?.id == null) {
Fluttertoast.showToast(msg: _subtitle.pickDevice);
return;
}
if (_serviceRequest.firstAction?.name == "Need a visit" && _dateTime == null) {
Fluttertoast.showToast(msg: _subtitle.noDateFound);
Fluttertoast.showToast(msg: "first action is required");
return;
}
if (widget.serviceRequest != null && (_serviceRequest?.engineerId == null || (_serviceRequest?.engineerId?.isEmpty ?? false))) {

@ -7,37 +7,45 @@ import 'package:test_sa/views/widgets/gas_refill/gas_refill_item.dart';
import 'package:test_sa/views/widgets/loaders/lazy_loading.dart';
import 'package:test_sa/views/widgets/loaders/no_item_found.dart';
class GasRefillList extends StatelessWidget {
class GasRefillList extends StatefulWidget {
final List<GasRefillModel> items;
final bool nextPage;
final Future<void> Function() onLazyLoad;
const GasRefillList({Key key, this.items, this.nextPage, this.onLazyLoad}) : super(key: key);
@override
State<GasRefillList> createState() => _GasRefillListState();
}
class _GasRefillListState extends State<GasRefillList> {
@override
Widget build(BuildContext context) {
if (items.length == 0) {
if (widget.items.length == 0) {
Subtitle subtitle = AppLocalization.of(context).subtitle;
return NoItemFound(
message: subtitle.noServiceRequestFound,
);
}
return LazyLoading(
nextPage: nextPage,
onLazyLoad: onLazyLoad,
nextPage: widget.nextPage,
onLazyLoad: widget.onLazyLoad,
child: ListView.builder(
//physics: const BouncingScrollPhysics(),
itemCount: items.length,
itemCount: widget.items.length,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
itemBuilder: (context, itemIndex) {
return GasRefillItem(
index: itemIndex,
item: items[itemIndex],
item: widget.items[itemIndex],
onPressed: (model) {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => GasRefillDetails(
model: model,
)));
))).then((value) {
model=value;
setState(() {});
});
},
);
}),

Loading…
Cancel
Save