gas refill cont.
parent
f118bb4276
commit
8e2b21bd9d
@ -0,0 +1,149 @@
|
||||
class Customer {
|
||||
List<Data> data;
|
||||
String message;
|
||||
String innerMessage;
|
||||
int responseCode;
|
||||
bool isSuccess;
|
||||
|
||||
Customer({this.data, this.message, this.innerMessage, this.responseCode, this.isSuccess});
|
||||
|
||||
Customer.fromJson(Map<String, dynamic> json) {
|
||||
if (json['data'] != null) {
|
||||
data = [];
|
||||
json['data'].forEach((v) {
|
||||
data.add(new Data.fromJson(v));
|
||||
});
|
||||
}
|
||||
message = json['message'];
|
||||
innerMessage = json['innerMessage'];
|
||||
responseCode = json['responseCode'];
|
||||
isSuccess = json['isSuccess'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['message'] = this.message;
|
||||
data['innerMessage'] = this.innerMessage;
|
||||
data['responseCode'] = this.responseCode;
|
||||
data['isSuccess'] = this.isSuccess;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Data {
|
||||
int id;
|
||||
int customerCode;
|
||||
String custName;
|
||||
List<Buildings> buildings;
|
||||
|
||||
Data({this.id, this.customerCode, this.custName, this.buildings});
|
||||
|
||||
Data.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
customerCode = json['customerCode'];
|
||||
custName = json['custName'];
|
||||
if (json['buildings'] != null) {
|
||||
buildings = new List<Buildings>();
|
||||
json['buildings'].forEach((v) {
|
||||
buildings.add(new Buildings.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['customerCode'] = this.customerCode;
|
||||
data['custName'] = this.custName;
|
||||
if (this.buildings != null) {
|
||||
data['buildings'] = this.buildings.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Buildings {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Floors> floors;
|
||||
|
||||
Buildings({this.id, this.name, this.value, this.floors});
|
||||
|
||||
Buildings.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['floors'] != null) {
|
||||
floors = new List<Floors>();
|
||||
json['floors'].forEach((v) {
|
||||
floors.add(new Floors.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
if (this.floors != null) {
|
||||
data['floors'] = this.floors.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Floors {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Departments> departments;
|
||||
|
||||
Floors({this.id, this.name, this.value, this.departments});
|
||||
|
||||
Floors.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['departments'] != null) {
|
||||
departments = new List<Departments>();
|
||||
json['departments'].forEach((v) {
|
||||
departments.add(new Departments.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
if (this.departments != null) {
|
||||
data['departments'] = this.departments.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Departments {
|
||||
int id;
|
||||
String name;
|
||||
|
||||
Departments({this.id, this.name});
|
||||
|
||||
Departments.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/status_drop_down/gas_refill/gas_types_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
||||
import 'package:test_sa/views/widgets/status/single_status_menu.dart';
|
||||
|
||||
class BuildingTypeMenu extends StatefulWidget {
|
||||
final Function(Buildings) onSelect;
|
||||
Buildings initialValue;
|
||||
List<Buildings> building;
|
||||
|
||||
BuildingTypeMenu({Key key, this.onSelect, this.initialValue, this.building = const []}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BuildingTypeMenuState createState() {
|
||||
return _BuildingTypeMenuState();
|
||||
}
|
||||
}
|
||||
|
||||
class _BuildingTypeMenuState extends State<BuildingTypeMenu> {
|
||||
Buildings _selectedBuilding;
|
||||
List<Buildings> _building;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selectedBuilding = widget.initialValue;
|
||||
_building = widget.building;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant BuildingTypeMenu oldWidget) {
|
||||
if (oldWidget.building != widget.building) {
|
||||
_building = widget.building;
|
||||
_selectedBuilding = null;
|
||||
}
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AColors.inputFieldBackgroundColor,
|
||||
border: Border.all(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
// boxShadow: const [
|
||||
// AppStyle.boxShadow
|
||||
// ]
|
||||
),
|
||||
child: DropdownButton<Buildings>(
|
||||
value: _selectedBuilding,
|
||||
iconSize: 24,
|
||||
icon: const Icon(Icons.keyboard_arrow_down_rounded),
|
||||
elevation: 0,
|
||||
isExpanded: true,
|
||||
hint: Text(
|
||||
"Select Building",
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
),
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
underline: SizedBox.shrink(),
|
||||
onChanged: (Buildings newValue) {
|
||||
setState(() {
|
||||
_selectedBuilding = newValue;
|
||||
});
|
||||
widget.onSelect(newValue);
|
||||
},
|
||||
items: _building?.map<DropdownMenuItem<Buildings>>((Buildings value) {
|
||||
return DropdownMenuItem<Buildings>(
|
||||
value: value,
|
||||
child: Text(
|
||||
value.name,
|
||||
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
||||
color: Theme.of(context).primaryColor,
|
||||
fontSize: 11,
|
||||
//fontWeight: FontWeight.bold
|
||||
),
|
||||
),
|
||||
);
|
||||
})?.toList() ??
|
||||
[],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/status_drop_down/gas_refill/gas_types_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
||||
import 'package:test_sa/views/widgets/status/single_status_menu.dart';
|
||||
|
||||
class DepartmentTypeMenu extends StatefulWidget {
|
||||
final Function(Departments) onSelect;
|
||||
Departments initialValue;
|
||||
List<Departments> departments;
|
||||
|
||||
DepartmentTypeMenu({Key key, this.onSelect, this.initialValue, this.departments = const []}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DepartmentTypeMenuState createState() {
|
||||
return _DepartmentTypeMenuState();
|
||||
}
|
||||
}
|
||||
|
||||
class _DepartmentTypeMenuState extends State<DepartmentTypeMenu> {
|
||||
Departments _selected;
|
||||
List<Departments> _departments;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selected = widget.initialValue;
|
||||
_departments = widget.departments;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant DepartmentTypeMenu oldWidget) {
|
||||
if (oldWidget.departments != widget.departments) {
|
||||
_departments = widget.departments;
|
||||
_selected = null;
|
||||
}
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AColors.inputFieldBackgroundColor,
|
||||
border: Border.all(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
// boxShadow: const [
|
||||
// AppStyle.boxShadow
|
||||
// ]
|
||||
),
|
||||
child: DropdownButton<Departments>(
|
||||
value: _selected,
|
||||
iconSize: 24,
|
||||
icon: const Icon(Icons.keyboard_arrow_down_rounded),
|
||||
elevation: 0,
|
||||
isExpanded: true,
|
||||
hint: Text(
|
||||
"Select Department",
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
),
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
underline: SizedBox.shrink(),
|
||||
onChanged: (Departments newValue) {
|
||||
setState(() {
|
||||
_selected = newValue;
|
||||
});
|
||||
widget.onSelect(newValue);
|
||||
},
|
||||
items: widget?.departments?.map<DropdownMenuItem<Departments>>((Departments value) {
|
||||
return DropdownMenuItem<Departments>(
|
||||
value: value,
|
||||
child: Text(
|
||||
value.name,
|
||||
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
||||
color: Theme.of(context).primaryColor,
|
||||
fontSize: 11,
|
||||
//fontWeight: FontWeight.bold
|
||||
),
|
||||
),
|
||||
);
|
||||
})?.toList() ??
|
||||
[],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/status_drop_down/gas_refill/gas_types_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
||||
import 'package:test_sa/views/widgets/status/single_status_menu.dart';
|
||||
|
||||
class FloorTypeMenu extends StatefulWidget {
|
||||
final Function(Floors) onSelect;
|
||||
Floors initialValue;
|
||||
List<Floors> floors;
|
||||
|
||||
FloorTypeMenu({Key key, this.onSelect, this.initialValue, this.floors = const []}) : super(key: key);
|
||||
|
||||
@override
|
||||
_FloorTypeMenuState createState() {
|
||||
return _FloorTypeMenuState();
|
||||
}
|
||||
}
|
||||
|
||||
class _FloorTypeMenuState extends State<FloorTypeMenu> {
|
||||
Floors _selected;
|
||||
List<Floors> _floors;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selected = widget.initialValue;
|
||||
_floors = widget.floors;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant FloorTypeMenu oldWidget) {
|
||||
if (oldWidget.floors != widget.floors) {
|
||||
_floors = widget.floors;
|
||||
_selected = null;
|
||||
}
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AColors.inputFieldBackgroundColor,
|
||||
border: Border.all(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
// boxShadow: const [
|
||||
// AppStyle.boxShadow
|
||||
// ]
|
||||
),
|
||||
child: DropdownButton<Floors>(
|
||||
value: _selected,
|
||||
iconSize: 24,
|
||||
icon: const Icon(Icons.keyboard_arrow_down_rounded),
|
||||
elevation: 0,
|
||||
isExpanded: true,
|
||||
hint: Text(
|
||||
"Select Floor",
|
||||
style: Theme.of(context).textTheme.subtitle1,
|
||||
),
|
||||
style: TextStyle(color: Theme.of(context).primaryColor),
|
||||
underline: SizedBox.shrink(),
|
||||
onChanged: (Floors newValue) {
|
||||
setState(() {
|
||||
_selected = newValue;
|
||||
});
|
||||
widget.onSelect(newValue);
|
||||
},
|
||||
items: _floors?.map<DropdownMenuItem<Floors>>((Floors value) {
|
||||
return DropdownMenuItem<Floors>(
|
||||
value: value,
|
||||
child: Text(
|
||||
value.name,
|
||||
style: Theme.of(context).textTheme.subtitle1.copyWith(
|
||||
color: Theme.of(context).primaryColor,
|
||||
fontSize: 11,
|
||||
//fontWeight: FontWeight.bold
|
||||
),
|
||||
),
|
||||
);
|
||||
})?.toList() ??
|
||||
[],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/controllers/providers/api/hospitals_provider.dart';
|
||||
import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
||||
import 'package:test_sa/models/hospital.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
|
||||
class HospitalAutoCompleteField extends StatefulWidget {
|
||||
final String initialValue;
|
||||
final Function(Hospital) onSearch;
|
||||
|
||||
//final Function(Hospital) onSave;
|
||||
|
||||
const HospitalAutoCompleteField({
|
||||
Key key,
|
||||
this.onSearch,
|
||||
this.initialValue,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HospitalAutoCompleteFieldState createState() => _HospitalAutoCompleteFieldState();
|
||||
}
|
||||
|
||||
class _HospitalAutoCompleteFieldState extends State<HospitalAutoCompleteField> {
|
||||
SettingProvider _settingProvider;
|
||||
TextEditingController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TextEditingController(text: widget.initialValue);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant HospitalAutoCompleteField oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
if (oldWidget.initialValue != widget.initialValue) {
|
||||
_controller = TextEditingController(text: widget.initialValue);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_settingProvider = Provider.of<SettingProvider>(context);
|
||||
Subtitle _subtitle = AppLocalization.of(context).subtitle;
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: AColors.inputFieldBackgroundColor,
|
||||
border: Border.all(
|
||||
color: Color(0xffefefef),
|
||||
),
|
||||
borderRadius: BorderRadius.circular(AppStyle.borderRadius * AppStyle.getScaleFactor(context)),
|
||||
// boxShadow: [
|
||||
// AppStyle.boxShadow
|
||||
// ]
|
||||
),
|
||||
child: TypeAheadField<Hospital>(
|
||||
textFieldConfiguration: TextFieldConfiguration(
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
controller: _controller,
|
||||
textAlign: TextAlign.center,
|
||||
decoration: InputDecoration(
|
||||
hintText: _subtitle.hospital,
|
||||
border: InputBorder.none,
|
||||
disabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
),
|
||||
textInputAction: TextInputAction.search,
|
||||
),
|
||||
suggestionsCallback: (vale) async {
|
||||
return await HospitalsProvider().getHospitalsListByVal(searchVal: _controller.text);
|
||||
},
|
||||
itemBuilder: (context, hospital) {
|
||||
return ListTile(
|
||||
title: Text(hospital.name),
|
||||
);
|
||||
},
|
||||
onSuggestionSelected: (hospital) {
|
||||
widget.onSearch(hospital);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue