parent
ae8ec6806d
commit
7800b623e9
@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
|
||||||
|
class BookedTankersModel {
|
||||||
|
String tanker_name = '';
|
||||||
|
String date_of_order='';
|
||||||
|
String supplierName='';
|
||||||
|
String supplierId='';
|
||||||
|
String date='';
|
||||||
|
String time='';
|
||||||
|
String time_ui='';
|
||||||
|
String type_of_water='';
|
||||||
|
String capacity='';
|
||||||
|
String address='';
|
||||||
|
String price='';
|
||||||
|
String payment_status='';
|
||||||
|
String order_status='';
|
||||||
|
String booking_id='';
|
||||||
|
Color textColor=Colors.black;
|
||||||
|
BookedTankersModel();
|
||||||
|
|
||||||
|
factory BookedTankersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
BookedTankersModel rtvm = new BookedTankersModel();
|
||||||
|
|
||||||
|
rtvm.tanker_name = json['tankerName'] ?? '';
|
||||||
|
rtvm.date_of_order = json['dateOfOrder'] ?? '';
|
||||||
|
rtvm.time = json['dateOfOrder'] ?? '';
|
||||||
|
rtvm.supplierName = json['supplierName'] ?? '';
|
||||||
|
rtvm.supplierId = json['supplierId'] ?? '';
|
||||||
|
rtvm.date = rtvm.date_of_order.replaceRange(12, rtvm.date_of_order.length, '');
|
||||||
|
rtvm.time_ui =rtvm.time.replaceRange(0, 13, '');
|
||||||
|
|
||||||
|
rtvm.type_of_water = json['typeofwater'] ?? '';
|
||||||
|
rtvm.booking_id = json['bookingid'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ?? '';
|
||||||
|
rtvm.address = json['address'] ?? '';
|
||||||
|
rtvm.price = json['price'] ?? '';
|
||||||
|
rtvm.payment_status = json['payment_status'] ?? '';
|
||||||
|
rtvm.order_status = json['orderStatus'] ?? '';
|
||||||
|
|
||||||
|
if(rtvm.order_status.toString().toLowerCase()=='accepted'){
|
||||||
|
rtvm.textColor=Colors.green;
|
||||||
|
}
|
||||||
|
else if(rtvm.order_status.toString().toLowerCase()=='rejected'){
|
||||||
|
rtvm.textColor=Colors.red;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.textColor=primaryColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"tankerName":this.tanker_name,
|
||||||
|
"dateOfOrder":this.date_of_order,
|
||||||
|
"typeofwater":this.type_of_water,
|
||||||
|
"capacity":this.capacity,
|
||||||
|
"address":this.address,
|
||||||
|
"price":this.price,
|
||||||
|
"payment_status":this.payment_status,
|
||||||
|
"orderStatus":this.order_status,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
class BoreModel {
|
||||||
|
String bore_name = '';
|
||||||
|
String type_of_water='';
|
||||||
|
String description='';
|
||||||
|
String capacity='';
|
||||||
|
|
||||||
|
BoreModel();
|
||||||
|
|
||||||
|
factory BoreModel.fromJson(Map<String, dynamic> json){
|
||||||
|
BoreModel rtvm = new BoreModel();
|
||||||
|
|
||||||
|
rtvm.bore_name = json['boreName'] ?? '';
|
||||||
|
rtvm.type_of_water = json['typeofwater'] ?? '';
|
||||||
|
rtvm.description = json['description'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"boreName":this.bore_name,
|
||||||
|
"typeofwater": this.type_of_water ,
|
||||||
|
"description": this.description,
|
||||||
|
"capacity": this.capacity,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class CancelledOrdersModel {
|
||||||
|
String tankerName = '';
|
||||||
|
String bookingid = '';
|
||||||
|
String supplierId = '';
|
||||||
|
String dateOfOrder='';
|
||||||
|
String typeofwater='';
|
||||||
|
String delivery_agent_mobile='';
|
||||||
|
String capacity='';
|
||||||
|
String address='';
|
||||||
|
String price='';
|
||||||
|
String customerId='';
|
||||||
|
String startTime = '';
|
||||||
|
String stopTime = '';
|
||||||
|
String orderStatus = '';
|
||||||
|
String initialWaterLevel = '';
|
||||||
|
String finalWaterLevel = '';
|
||||||
|
String quantityDelivered = '';
|
||||||
|
String amountPaid = '';
|
||||||
|
String amountDue = '';
|
||||||
|
String paymentMode = '';
|
||||||
|
String deliverdWater = '';
|
||||||
|
String supplierName = '';
|
||||||
|
var tankerRunningStatus ;
|
||||||
|
double lat=0;
|
||||||
|
double lng=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Color cardColor=Colors.white;
|
||||||
|
|
||||||
|
CancelledOrdersModel();
|
||||||
|
|
||||||
|
factory CancelledOrdersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
CancelledOrdersModel rtvm = new CancelledOrdersModel();
|
||||||
|
|
||||||
|
rtvm.tankerName = json['tankerName'] ?? '';
|
||||||
|
rtvm.bookingid = json['bookingid'] ?? '';
|
||||||
|
rtvm.supplierId = json['supplierId'] ?? '';
|
||||||
|
rtvm.dateOfOrder = json['dateOfOrder'] ??'';
|
||||||
|
rtvm.typeofwater = json['typeofwater'] ??'';
|
||||||
|
rtvm.supplierName = json['supplierName'] ??'';
|
||||||
|
rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ??'';
|
||||||
|
rtvm.capacity = json['capacity'] ??'';
|
||||||
|
rtvm.address = json['address'] ??'';
|
||||||
|
rtvm.price = json['price'] ??'';
|
||||||
|
rtvm.orderStatus = json['orderStatus'] ??'';
|
||||||
|
rtvm.customerId = json['customerId'] ??'';
|
||||||
|
rtvm.startTime = json['start_time'] ??'';
|
||||||
|
rtvm.stopTime = json['stop_time'] ??'';
|
||||||
|
rtvm.initialWaterLevel = json['initial_water_level'] ??'';
|
||||||
|
rtvm.finalWaterLevel = json['final_water_level'] ??'';
|
||||||
|
rtvm.quantityDelivered = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.amountPaid = json['amount_paid'] ??'';
|
||||||
|
rtvm.amountDue = json['amount_due'] ??'';
|
||||||
|
rtvm.paymentMode = json['payment_mode'] ??'';
|
||||||
|
rtvm.deliverdWater = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.tankerRunningStatus = json['tankerRunningStatus'] ??'';
|
||||||
|
rtvm.lat = json['latitude'] ??0;
|
||||||
|
rtvm.lng = json['longitude'] ??0;
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:geolocator/geolocator.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class ConnectedSuppliersModel {
|
||||||
|
String supplier_name = '';
|
||||||
|
String status='';
|
||||||
|
String supplier_address='';
|
||||||
|
String supplier_phone_number='';
|
||||||
|
String supplier_id='';
|
||||||
|
Color text_color=Colors.black;
|
||||||
|
double lat=0;
|
||||||
|
double lng=0;
|
||||||
|
String distrubance_price='';
|
||||||
|
String amount_difference='';
|
||||||
|
double distanceInMeters=0;
|
||||||
|
String displayAddress='';
|
||||||
|
bool isFavorite=false;
|
||||||
|
|
||||||
|
ConnectedSuppliersModel();
|
||||||
|
|
||||||
|
factory ConnectedSuppliersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
ConnectedSuppliersModel rtvm = new ConnectedSuppliersModel();
|
||||||
|
|
||||||
|
rtvm.supplier_name = json['suppliername'] ?? '';
|
||||||
|
rtvm.status = json['status'] ?? '';
|
||||||
|
rtvm.supplier_address = json['profile']['office_address'] ?? '';
|
||||||
|
rtvm.supplier_phone_number = json['phone'] ?? '';
|
||||||
|
rtvm.supplier_id = json['supplierId'] ?? '';
|
||||||
|
rtvm.lat = json['latitude'] ?? 0;
|
||||||
|
rtvm.lng = json['longitude'] ?? 0;
|
||||||
|
rtvm.distrubance_price = json['distrubance_price'] ?? '';
|
||||||
|
rtvm.amount_difference = json['amount_difference'] ?? '';
|
||||||
|
rtvm.isFavorite = json['favorate'] ?? false;
|
||||||
|
|
||||||
|
rtvm.distanceInMeters = double.parse((Geolocator.distanceBetween(
|
||||||
|
rtvm.lat,
|
||||||
|
rtvm.lng,
|
||||||
|
AppSettings.userLatitude,
|
||||||
|
AppSettings.userLongitude
|
||||||
|
) / 1000).toStringAsFixed(2));
|
||||||
|
|
||||||
|
List<String> parts = rtvm.supplier_address.split(',');
|
||||||
|
rtvm.displayAddress = parts[2].trim();
|
||||||
|
|
||||||
|
if(rtvm.status.toString().toLowerCase()=='pending'){
|
||||||
|
rtvm.text_color=Colors.yellow;
|
||||||
|
}
|
||||||
|
else if(rtvm.status.toString().toLowerCase()=='accepted'){
|
||||||
|
rtvm.text_color=Colors.green;
|
||||||
|
}
|
||||||
|
else if(rtvm.status.toString().toLowerCase()=='rejected'){
|
||||||
|
rtvm.text_color=Colors.red;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.status='Connect?';
|
||||||
|
rtvm.text_color=primaryColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
class ConnectionsModel {
|
||||||
|
String bore_name = '';
|
||||||
|
String type_of_water='';
|
||||||
|
String description='';
|
||||||
|
String source='';
|
||||||
|
List connections=[];
|
||||||
|
List inConnections=[];
|
||||||
|
List outConnections=[];
|
||||||
|
|
||||||
|
|
||||||
|
ConnectionsModel();
|
||||||
|
|
||||||
|
factory ConnectionsModel.fromJson(Map<String, dynamic> json){
|
||||||
|
ConnectionsModel rtvm = new ConnectionsModel();
|
||||||
|
|
||||||
|
rtvm.source = json['boreName'] ?? '';
|
||||||
|
rtvm.connections = json['typeofwater'] ?? [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"boreName":this.source,
|
||||||
|
"typeofwater": this.connections ,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
class ConsumptionModel {
|
||||||
|
String tank_name = '';
|
||||||
|
String water_level='';
|
||||||
|
String block='';
|
||||||
|
String type_of_water='';
|
||||||
|
String capacity='';
|
||||||
|
String location='';
|
||||||
|
String consumedWater='';
|
||||||
|
|
||||||
|
ConsumptionModel();
|
||||||
|
|
||||||
|
factory ConsumptionModel.fromJson(Map<String, dynamic> json){
|
||||||
|
ConsumptionModel rtvm = new ConsumptionModel();
|
||||||
|
|
||||||
|
rtvm.tank_name = json['tankname'] ?? '';
|
||||||
|
rtvm.consumedWater = json['totalConsumption'].toString() ?? '';
|
||||||
|
rtvm.block = json['block'].toString() ?? '';
|
||||||
|
rtvm.type_of_water = json['TypeofWater'].toString() ?? '';
|
||||||
|
rtvm.capacity = json['capacity'].toString() ?? '';
|
||||||
|
rtvm.location = json['location'].toString() ?? '';
|
||||||
|
rtvm.water_level = json['waterlevel'].toString() ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"tankname":this.tank_name,
|
||||||
|
"waterLevel": this.water_level ,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class DeliveredOrdersModel {
|
||||||
|
String tankerName = '';
|
||||||
|
String bookingid = '';
|
||||||
|
String supplierId = '';
|
||||||
|
String dateOfOrder='';
|
||||||
|
String typeofwater='';
|
||||||
|
String delivery_agent_mobile='';
|
||||||
|
String delivery_agent='';
|
||||||
|
String capacity='';
|
||||||
|
String address='';
|
||||||
|
String price='';
|
||||||
|
String customerId='';
|
||||||
|
String startTime = '';
|
||||||
|
String stopTime = '';
|
||||||
|
String orderStatus = '';
|
||||||
|
String initialWaterLevel = '';
|
||||||
|
String finalWaterLevel = '';
|
||||||
|
String quantityDelivered = '';
|
||||||
|
String amountPaid = '';
|
||||||
|
String amountDue = '';
|
||||||
|
String paymentMode = '';
|
||||||
|
String deliverdWater = '';
|
||||||
|
String supplierName = '';
|
||||||
|
String deliveredDate = '';
|
||||||
|
String displayDeliveredDate = '';
|
||||||
|
String displayAddress = '';
|
||||||
|
var tankerRunningStatus ;
|
||||||
|
double lat=0;
|
||||||
|
double lng=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Color cardColor=Colors.white;
|
||||||
|
|
||||||
|
DeliveredOrdersModel();
|
||||||
|
|
||||||
|
factory DeliveredOrdersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
DeliveredOrdersModel rtvm = new DeliveredOrdersModel();
|
||||||
|
|
||||||
|
rtvm.tankerName = json['tankerName'] ?? '';
|
||||||
|
rtvm.bookingid = json['bookingid'] ?? '';
|
||||||
|
rtvm.supplierId = json['supplierId'] ?? '';
|
||||||
|
rtvm.dateOfOrder = json['dateOfOrder'] ??'';
|
||||||
|
rtvm.typeofwater = json['typeofwater'] ??'';
|
||||||
|
rtvm.supplierName = json['supplierName'] ??'';
|
||||||
|
rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ??'';
|
||||||
|
rtvm.capacity = json['capacity'] ??'';
|
||||||
|
rtvm.address = json['address'] ??'';
|
||||||
|
rtvm.price = json['price'] ??'';
|
||||||
|
rtvm.orderStatus = json['orderStatus'] ??'';
|
||||||
|
rtvm.customerId = json['customerId'] ??'';
|
||||||
|
rtvm.startTime = json['start_time'] ??'';
|
||||||
|
rtvm.stopTime = json['stop_time'] ??'';
|
||||||
|
rtvm.initialWaterLevel = json['initial_water_level'] ??'';
|
||||||
|
rtvm.finalWaterLevel = json['final_water_level'] ??'';
|
||||||
|
rtvm.quantityDelivered = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.amountPaid = json['amount_paid'] ??'';
|
||||||
|
rtvm.amountDue = json['amount_due'] ??'';
|
||||||
|
rtvm.paymentMode = json['payment_mode'] ??'';
|
||||||
|
rtvm.deliverdWater = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.deliveredDate = json['deliveredDate'] ??'';
|
||||||
|
rtvm.tankerRunningStatus = json['tankerRunningStatus'] ??'';
|
||||||
|
rtvm.delivery_agent = json['delivery_agent'] ??'';
|
||||||
|
|
||||||
|
// Step 1: Parse input string into DateTime object
|
||||||
|
DateFormat inputFormat = DateFormat("dd-MMM-yyyy - HH:mm");
|
||||||
|
DateTime dateTime = inputFormat.parse(rtvm.deliveredDate);
|
||||||
|
|
||||||
|
// Step 2: Format to desired output
|
||||||
|
DateFormat outputFormat = DateFormat("MMMM d yyyy, h:mm a");
|
||||||
|
|
||||||
|
rtvm.displayDeliveredDate = outputFormat.format(dateTime);
|
||||||
|
List<String> parts = rtvm.address.split(',');
|
||||||
|
rtvm.displayAddress = parts[2].trim();
|
||||||
|
|
||||||
|
rtvm.lat = json['latitude'] ??0;
|
||||||
|
rtvm.lng = json['longitude'] ??0;
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class DisconnectedSuppliersModel {
|
||||||
|
String supplier_name = '';
|
||||||
|
String status='';
|
||||||
|
String supplier_address='';
|
||||||
|
String supplier_phone_number='';
|
||||||
|
String supplier_id='';
|
||||||
|
Color text_color=Colors.black;
|
||||||
|
double lat=0;
|
||||||
|
double lng=0;
|
||||||
|
|
||||||
|
DisconnectedSuppliersModel();
|
||||||
|
|
||||||
|
factory DisconnectedSuppliersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
DisconnectedSuppliersModel rtvm = new DisconnectedSuppliersModel();
|
||||||
|
|
||||||
|
rtvm.supplier_name = json['suppliername'] ?? '';
|
||||||
|
rtvm.status = json['status'] ?? '';
|
||||||
|
rtvm.supplier_address = json['profile']['office_address'] ?? '';
|
||||||
|
rtvm.supplier_phone_number = json['phone'] ?? '';
|
||||||
|
rtvm.supplier_id = json['supplierId'] ?? '';
|
||||||
|
rtvm.lat = json['latitude'] ?? 0;
|
||||||
|
rtvm.lng = json['longitude'] ?? 0;
|
||||||
|
|
||||||
|
|
||||||
|
if(rtvm.status.toString().toLowerCase()=='pending'){
|
||||||
|
rtvm.text_color=Colors.yellow;
|
||||||
|
}
|
||||||
|
else if(rtvm.status.toString().toLowerCase()=='accepted'){
|
||||||
|
rtvm.text_color=Colors.green;
|
||||||
|
}
|
||||||
|
else if(rtvm.status.toString().toLowerCase()=='rejected'){
|
||||||
|
rtvm.text_color=Colors.red;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.status='Connect?';
|
||||||
|
rtvm.text_color=primaryColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
class GetBlocksModel {
|
||||||
|
String block = '';
|
||||||
|
|
||||||
|
GetBlocksModel();
|
||||||
|
|
||||||
|
factory GetBlocksModel.fromJson(Map<String, dynamic> json){
|
||||||
|
GetBlocksModel rtvm = new GetBlocksModel();
|
||||||
|
rtvm.block = json['block'].toString() ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
class GovtPipelineModel {
|
||||||
|
|
||||||
|
String pipeline_name = '';
|
||||||
|
String type_of_water='';
|
||||||
|
String description='';
|
||||||
|
String capacity='';
|
||||||
|
|
||||||
|
GovtPipelineModel();
|
||||||
|
|
||||||
|
factory GovtPipelineModel.fromJson(Map<String, dynamic> json){
|
||||||
|
GovtPipelineModel rtvm = new GovtPipelineModel();
|
||||||
|
|
||||||
|
rtvm.pipeline_name = json['Name'] ?? '';
|
||||||
|
rtvm.type_of_water = json['typeofwater'] ?? '';
|
||||||
|
rtvm.description = json['description'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"pipelineName":this.pipeline_name,
|
||||||
|
"typeofwater": this.type_of_water ,
|
||||||
|
"description": this.description,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,83 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class OrdersYetDeliveryModel {
|
||||||
|
String tankerName = '';
|
||||||
|
String bookingid = '';
|
||||||
|
String supplierId = '';
|
||||||
|
String dateOfOrder='';
|
||||||
|
String typeofwater='';
|
||||||
|
String delivery_agent_mobile='';
|
||||||
|
String capacity='';
|
||||||
|
String address='';
|
||||||
|
String price='';
|
||||||
|
String customerId='';
|
||||||
|
String startTime = '';
|
||||||
|
String stopTime = '';
|
||||||
|
String orderStatus = '';
|
||||||
|
String initialWaterLevel = '';
|
||||||
|
String finalWaterLevel = '';
|
||||||
|
String quantityDelivered = '';
|
||||||
|
String amountPaid = '';
|
||||||
|
String amountDue = '';
|
||||||
|
String paymentMode = '';
|
||||||
|
String deliverdWater = '';
|
||||||
|
String supplierName = '';
|
||||||
|
String deliveryAgent = '';
|
||||||
|
var tankerRunningStatus ;
|
||||||
|
String expectedDateOfDelivery='';
|
||||||
|
double lat=0;
|
||||||
|
double lng=0;
|
||||||
|
double delivery_latitude=0;
|
||||||
|
double delivery_longitude=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Color cardColor=Colors.white;
|
||||||
|
|
||||||
|
OrdersYetDeliveryModel();
|
||||||
|
|
||||||
|
factory OrdersYetDeliveryModel.fromJson(Map<String, dynamic> json){
|
||||||
|
OrdersYetDeliveryModel rtvm = new OrdersYetDeliveryModel();
|
||||||
|
|
||||||
|
rtvm.tankerName = json['tankerName'] ?? '';
|
||||||
|
rtvm.bookingid = json['bookingid'] ?? '';
|
||||||
|
rtvm.supplierId = json['supplierId'] ?? '';
|
||||||
|
rtvm.dateOfOrder = json['dateOfOrder'] ??'';
|
||||||
|
rtvm.typeofwater = json['typeofwater'] ??'';
|
||||||
|
rtvm.supplierName = json['supplierName'] ??'';
|
||||||
|
rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ??'';
|
||||||
|
rtvm.capacity = json['capacity'] ??'';
|
||||||
|
rtvm.address = json['address'] ??'';
|
||||||
|
rtvm.price = json['price'] ??'';
|
||||||
|
rtvm.orderStatus = json['orderStatus'] ??'';
|
||||||
|
rtvm.customerId = json['customerId'] ??'';
|
||||||
|
rtvm.startTime = json['start_time'] ??'';
|
||||||
|
rtvm.stopTime = json['stop_time'] ??'';
|
||||||
|
rtvm.initialWaterLevel = json['initial_water_level'] ??'';
|
||||||
|
rtvm.finalWaterLevel = json['final_water_level'] ??'';
|
||||||
|
rtvm.quantityDelivered = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.amountPaid = json['amount_paid'] ??'';
|
||||||
|
rtvm.amountDue = json['amount_due'] ??'';
|
||||||
|
rtvm.paymentMode = json['payment_mode'] ??'';
|
||||||
|
rtvm.deliverdWater = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.deliveryAgent = json['delivery_agent'] ??'';
|
||||||
|
rtvm.tankerRunningStatus = json['tankerRunningStatus'] ??'';
|
||||||
|
rtvm.expectedDateOfDelivery = json['expectedDateOfDelivery'] ??'';
|
||||||
|
|
||||||
|
|
||||||
|
rtvm.lat = json['latitude'] ??0;
|
||||||
|
rtvm.lng = json['longitude'] ??0;
|
||||||
|
rtvm.delivery_latitude = json["deliveryBoyLocation"]['deliveryboy_latitude'] ??0;
|
||||||
|
rtvm.delivery_longitude = json["deliveryBoyLocation"]['deliveryboy_longitude'] ??0;
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
|
||||||
|
class ParticularTankConnectionsModel {
|
||||||
|
String tank_name = '';
|
||||||
|
String capacity='';
|
||||||
|
String capacityForParse='';
|
||||||
|
String finalCapacity='';
|
||||||
|
String block_name='';
|
||||||
|
String type_of_water='';
|
||||||
|
String type='';
|
||||||
|
String tank_location='';
|
||||||
|
String water_level='';
|
||||||
|
List inConnections=[];
|
||||||
|
List outConnections=[];
|
||||||
|
List inputConnections=[];
|
||||||
|
List outputConnections=[];
|
||||||
|
String currentWaterLevelPercent='';
|
||||||
|
bool isManual=false;
|
||||||
|
Image tank_image=Image(image: const AssetImage('images/100%.png'),);
|
||||||
|
bool minimumPercentageTextEditable=true;
|
||||||
|
bool maximumPercentageTextEditable=true;
|
||||||
|
String slave_status='';
|
||||||
|
String slaveDisconnectedTime='';
|
||||||
|
|
||||||
|
TextEditingController minimumPercentageTextController = TextEditingController();
|
||||||
|
TextEditingController maximumPercentageTextController = TextEditingController();
|
||||||
|
|
||||||
|
Widget minimumPercentage(var height,var width,bool readOnly) {
|
||||||
|
return Container(
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
child: TextFormField(
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
style: TextStyle(color: primaryColor),
|
||||||
|
controller: minimumPercentageTextController,
|
||||||
|
decoration: textFormFieldDecorationForBoxId(Icons.percent,'Enter min %'),
|
||||||
|
readOnly:readOnly ,
|
||||||
|
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget maximumPercentage(var height,var width,bool readOnly) {
|
||||||
|
return Container(
|
||||||
|
height: height,
|
||||||
|
width: width,
|
||||||
|
child: TextFormField(
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
readOnly:readOnly ,
|
||||||
|
style: TextStyle(color: primaryColor),
|
||||||
|
controller: maximumPercentageTextController,
|
||||||
|
decoration: textFormFieldDecorationForBoxId(Icons.percent,'Enter max %'),
|
||||||
|
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ParticularTankConnectionsModel();
|
||||||
|
|
||||||
|
|
||||||
|
factory ParticularTankConnectionsModel.fromJson(Map<String, dynamic> json){
|
||||||
|
ParticularTankConnectionsModel rtvm = new ParticularTankConnectionsModel();
|
||||||
|
|
||||||
|
rtvm.tank_name = json['tankName'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ??'';
|
||||||
|
rtvm.tank_location = json['tankLocation'] ??'';
|
||||||
|
rtvm.capacityForParse =rtvm.capacity. replaceAll(',', '');
|
||||||
|
rtvm.block_name = json['blockName'] ?? '';
|
||||||
|
rtvm.type_of_water = json['typeOfWater'] ?? '';
|
||||||
|
rtvm.minimumPercentageTextController.text = json['auto_min_percentage'] ?? '';
|
||||||
|
rtvm.maximumPercentageTextController.text = json['auto_max_percentage'] ?? '';
|
||||||
|
rtvm.water_level = json['waterlevel'] ?? '';
|
||||||
|
rtvm.inConnections = json['connections']['inputConnections']??[];
|
||||||
|
rtvm.outConnections = json['connections']['outputConnections']??[];
|
||||||
|
rtvm.isManual=false;
|
||||||
|
//rtvm.minimumPercentageTextEditable=false;
|
||||||
|
|
||||||
|
if(rtvm.water_level!=''){
|
||||||
|
double percent=int.parse(rtvm.water_level )/double.parse(rtvm.capacityForParse )*100;
|
||||||
|
|
||||||
|
rtvm.currentWaterLevelPercent=percent.toStringAsFixed(0);
|
||||||
|
|
||||||
|
print(percent);
|
||||||
|
if( percent<20){
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/25%gif.gif'),height:60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/25%.png'),height: 100,width:100,);
|
||||||
|
}
|
||||||
|
else if( percent>20&&percent<50){
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/50%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/50%.png'),height: 100,width:100,);
|
||||||
|
}
|
||||||
|
else if( percent>50&&percent<80){
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/75%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/75%.png'),height: 100,width:100,);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/100%.png'),height: 100,width:100,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.water_level ='';
|
||||||
|
}
|
||||||
|
rtvm.slave_status = json['slave_status'] ?? '';
|
||||||
|
rtvm.slaveDisconnectedTime = json['slave_disconnected_time'] ?? '';
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"tankName":this.tank_name,
|
||||||
|
"capacity": this.capacity,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class PendingOrdersForConfirmationModel {
|
||||||
|
String tankerName = '';
|
||||||
|
String bookingid = '';
|
||||||
|
String supplierId = '';
|
||||||
|
String dateOfOrder='';
|
||||||
|
String typeofwater='';
|
||||||
|
String delivery_agent_mobile='';
|
||||||
|
String capacity='';
|
||||||
|
String address='';
|
||||||
|
String price='';
|
||||||
|
String customerId='';
|
||||||
|
String startTime = '';
|
||||||
|
String stopTime = '';
|
||||||
|
String orderStatus = '';
|
||||||
|
String initialWaterLevel = '';
|
||||||
|
String finalWaterLevel = '';
|
||||||
|
String quantityDelivered = '';
|
||||||
|
String amountPaid = '';
|
||||||
|
String amountDue = '';
|
||||||
|
String paymentMode = '';
|
||||||
|
String deliverdWater = '';
|
||||||
|
String supplierName = '';
|
||||||
|
String supplierContactNumber = '';
|
||||||
|
var tankerRunningStatus ;
|
||||||
|
double lat=0.0;
|
||||||
|
double lng=0.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Color cardColor=Colors.white;
|
||||||
|
|
||||||
|
PendingOrdersForConfirmationModel();
|
||||||
|
|
||||||
|
factory PendingOrdersForConfirmationModel.fromJson(Map<String, dynamic> json){
|
||||||
|
PendingOrdersForConfirmationModel rtvm = new PendingOrdersForConfirmationModel();
|
||||||
|
|
||||||
|
rtvm.tankerName = json['tankerName'] ?? '';
|
||||||
|
rtvm.bookingid = json['bookingid'] ?? '';
|
||||||
|
rtvm.supplierId = json['supplierId'] ?? '';
|
||||||
|
rtvm.dateOfOrder = json['dateOfOrder'] ??'';
|
||||||
|
rtvm.typeofwater = json['typeofwater'] ??'';
|
||||||
|
rtvm.supplierName = json['supplierName'] ??'';
|
||||||
|
rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ??'';
|
||||||
|
rtvm.capacity = json['capacity'] ??'';
|
||||||
|
rtvm.address = json['address'] ??'';
|
||||||
|
rtvm.price = json['price'] ??'';
|
||||||
|
rtvm.orderStatus = json['orderStatus'] ??'';
|
||||||
|
rtvm.customerId = json['customerId'] ??'';
|
||||||
|
rtvm.startTime = json['start_time'] ??'';
|
||||||
|
rtvm.stopTime = json['stop_time'] ??'';
|
||||||
|
rtvm.initialWaterLevel = json['initial_water_level'] ??'';
|
||||||
|
rtvm.finalWaterLevel = json['final_water_level'] ??'';
|
||||||
|
rtvm.quantityDelivered = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.amountPaid = json['amount_paid'] ??'';
|
||||||
|
rtvm.amountDue = json['amount_due'] ??'';
|
||||||
|
rtvm.paymentMode = json['payment_mode'] ??'';
|
||||||
|
rtvm.deliverdWater = json['quantityDelivered'] ??'';
|
||||||
|
rtvm.tankerRunningStatus = json['tankerRunningStatus'] ??'';
|
||||||
|
rtvm.supplierContactNumber = json['supplierPhone'] ??'';
|
||||||
|
rtvm.lat = json['latitude'] ??0.0;
|
||||||
|
rtvm.lng = json['longitude'] ??0.0;
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,71 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
class PendingSuppliersModel {
|
||||||
|
String supplier_name = '';
|
||||||
|
String status='';
|
||||||
|
String supplier_address='';
|
||||||
|
String supplier_phone_number='';
|
||||||
|
String supplier_id='';
|
||||||
|
Color text_color=Colors.black;
|
||||||
|
double lat=0;
|
||||||
|
double lng=0;
|
||||||
|
var timestamp;
|
||||||
|
bool sendReminder=false;
|
||||||
|
|
||||||
|
PendingSuppliersModel();
|
||||||
|
|
||||||
|
factory PendingSuppliersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
PendingSuppliersModel rtvm = new PendingSuppliersModel();
|
||||||
|
|
||||||
|
rtvm.supplier_name = json['suppliername'] ?? '';
|
||||||
|
rtvm.status = json['status'] ?? '';
|
||||||
|
rtvm.supplier_address = json['profile']['office_address'] ?? '';
|
||||||
|
rtvm.supplier_phone_number = json['phone'] ?? '';
|
||||||
|
rtvm.supplier_id = json['supplierId'] ?? '';
|
||||||
|
rtvm.lat = json['latitude'] ?? 0;
|
||||||
|
rtvm.lng = json['longitude'] ?? 0;
|
||||||
|
rtvm.timestamp = json['timestamp'] ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final DateTime now = DateTime.now();
|
||||||
|
|
||||||
|
//var date = '2021-01-26T03:17:00.000000Z';
|
||||||
|
DateTime parseDate = new DateFormat("dd-MM-yyyy HH:mm:ss").parse(rtvm.timestamp);
|
||||||
|
/*var inputDate = DateTime.parse(parseDate.toString());
|
||||||
|
var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
|
||||||
|
var outputDate = outputFormat.format(inputDate);
|
||||||
|
print(outputDate);*/
|
||||||
|
var diff = now.difference(parseDate).inHours;
|
||||||
|
|
||||||
|
if(diff>=5){
|
||||||
|
rtvm.sendReminder=true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.sendReminder=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(rtvm.status.toString().toLowerCase()=='pending'){
|
||||||
|
rtvm.text_color=Colors.yellow;
|
||||||
|
}
|
||||||
|
else if(rtvm.status.toString().toLowerCase()=='accepted'){
|
||||||
|
rtvm.text_color=Colors.green;
|
||||||
|
}
|
||||||
|
else if(rtvm.status.toString().toLowerCase()=='rejected'){
|
||||||
|
rtvm.text_color=Colors.red;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.status='Connect?';
|
||||||
|
rtvm.text_color=primaryColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
|
||||||
|
class SupplierTankersModel {
|
||||||
|
String tanker_name = '';
|
||||||
|
String capacity='';
|
||||||
|
String phone_number='';
|
||||||
|
String type_of_water='';
|
||||||
|
String waterType='';
|
||||||
|
var typeOfWaterForBooking=[];
|
||||||
|
String price='';
|
||||||
|
var priceForBooking=[];
|
||||||
|
int badgeCount=0;
|
||||||
|
bool isSelected=false;
|
||||||
|
bool isStrikethrough=false;
|
||||||
|
String status='Available';
|
||||||
|
String id='';
|
||||||
|
bool enabled=true;
|
||||||
|
|
||||||
|
|
||||||
|
SupplierTankersModel();
|
||||||
|
|
||||||
|
|
||||||
|
factory SupplierTankersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
SupplierTankersModel rtvm = new SupplierTankersModel();
|
||||||
|
|
||||||
|
rtvm.tanker_name = json['tankerName'] ?? '';
|
||||||
|
rtvm.phone_number = json['phoneNumber'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ?? '';
|
||||||
|
rtvm.price = json['price'] ?? '';
|
||||||
|
rtvm.id = json['_id'] ?? '';
|
||||||
|
rtvm.type_of_water = json['typeofwater']??'';
|
||||||
|
/*rtvm.waterType.forEach((element) {
|
||||||
|
|
||||||
|
rtvm.showTypeofWater.add(element['typeofwater']);
|
||||||
|
|
||||||
|
rtvm.typeOfWaterForBooking.add(element['typeofwater']);
|
||||||
|
|
||||||
|
rtvm.type_of_water=rtvm.showTypeofWater.join(",");
|
||||||
|
});*/
|
||||||
|
|
||||||
|
/*rtvm.price_api = json['price']??[];
|
||||||
|
rtvm.price_api.forEach((element) {
|
||||||
|
|
||||||
|
rtvm.show_price.add(element['price']);
|
||||||
|
|
||||||
|
rtvm.priceForBooking.add(element['price']);
|
||||||
|
|
||||||
|
rtvm.price=rtvm.show_price.join(",");
|
||||||
|
});*/
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,232 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
|
||||||
|
class TankLevelsModel {
|
||||||
|
String tank_name = '';
|
||||||
|
String capacity='';
|
||||||
|
String capacityForParse='';
|
||||||
|
String finalCapacity='';
|
||||||
|
String block_name='';
|
||||||
|
String type_of_water='';
|
||||||
|
String type='';
|
||||||
|
String tank_location='';
|
||||||
|
String water_level='';
|
||||||
|
List inConnections=[];
|
||||||
|
List outConnections=[];
|
||||||
|
List inputConnections=[];
|
||||||
|
List outputConnections=[];
|
||||||
|
String source='';
|
||||||
|
Color cardColor=Colors.white;
|
||||||
|
bool isCheckedInput=false;
|
||||||
|
bool isCheckedOutput=false;
|
||||||
|
var showInConnections='';
|
||||||
|
var showOutConnections='';
|
||||||
|
Color percentageTextColor=Colors.black;
|
||||||
|
Image tank_image=Image(image: const AssetImage('images/100%.png'),);
|
||||||
|
List<Color> startButtonColor=<Color>[];
|
||||||
|
List<Color> stoptButtonColor=<Color>[];
|
||||||
|
String motorStatus='';
|
||||||
|
String currentWaterLevelPercent='';
|
||||||
|
DateTime lastUpdatedTime=DateTime.now();
|
||||||
|
String displayLastUpdatedTime='';
|
||||||
|
String mode='';
|
||||||
|
String tank_status='';
|
||||||
|
String slave_status='';
|
||||||
|
String slaveDisconnectedTime='';
|
||||||
|
bool isAutomaticMode=true;
|
||||||
|
|
||||||
|
TextEditingController minimumLevelTextboxController = TextEditingController();
|
||||||
|
TextEditingController maximumLevelTextboxController = TextEditingController();
|
||||||
|
|
||||||
|
Widget minTextBox() {
|
||||||
|
return Container(
|
||||||
|
child: TextFormField(
|
||||||
|
cursorColor: Colors.white,
|
||||||
|
style: TextStyle(color: primaryColor),
|
||||||
|
controller: minimumLevelTextboxController,
|
||||||
|
decoration: textFormFieldDecorationForBoxId(Icons.percent,'Minimum Water level in percentage (%)'),
|
||||||
|
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget maxTextBox() {
|
||||||
|
return Container(
|
||||||
|
child: TextFormField(
|
||||||
|
cursorColor: Colors.white,
|
||||||
|
style: TextStyle(color: primaryColor),
|
||||||
|
controller: maximumLevelTextboxController,
|
||||||
|
decoration: textFormFieldDecorationForBoxId(Icons.percent,'Maximum Water level in percentage (%)'),
|
||||||
|
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget saveButton(context){
|
||||||
|
return
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width * .99,
|
||||||
|
height: 50,
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
onPressed: () { },
|
||||||
|
child: const Text(
|
||||||
|
'Save',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
),
|
||||||
|
),),)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TankLevelsModel();
|
||||||
|
|
||||||
|
factory TankLevelsModel.fromJson(Map<String, dynamic> json){
|
||||||
|
TankLevelsModel rtvm = new TankLevelsModel();
|
||||||
|
|
||||||
|
rtvm.tank_name = json['tankName'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ??'';
|
||||||
|
rtvm.capacityForParse =rtvm.capacity. replaceAll(',', '');
|
||||||
|
rtvm.tank_status = json['status'] ?? '';
|
||||||
|
rtvm.block_name = json['blockName'] ?? '';
|
||||||
|
rtvm.type_of_water = json['typeOfWater'] ?? '';
|
||||||
|
rtvm.water_level = json['waterlevel'] ?? '';
|
||||||
|
rtvm.lastUpdatedTime = DateTime.now();
|
||||||
|
if(rtvm.isAutomaticMode==false){
|
||||||
|
rtvm.mode = 'Manual Mode';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.mode = 'Automatic Mode';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rtvm.displayLastUpdatedTime = DateFormat('yyyy-MM-dd HH:mm:ss').format(rtvm.lastUpdatedTime);
|
||||||
|
|
||||||
|
rtvm.motorStatus ='OFF';
|
||||||
|
rtvm.tank_location = json['tankLocation']??'';
|
||||||
|
//40/100*80
|
||||||
|
|
||||||
|
/*if(rtvm.water_level.toString().toLowerCase()=='nan') {
|
||||||
|
rtvm.water_level='20';
|
||||||
|
}*/
|
||||||
|
if(rtvm.water_level!=''){
|
||||||
|
double percent=int.parse(rtvm.water_level )/double.parse(rtvm.capacityForParse )*100;
|
||||||
|
|
||||||
|
rtvm.currentWaterLevelPercent=percent.toStringAsFixed(0);
|
||||||
|
|
||||||
|
print(percent);
|
||||||
|
if( percent<20){
|
||||||
|
rtvm.percentageTextColor=Color(0XFFE2483D);
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/25%gif.gif'),height:60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/25%.png'),height: 70,width:70,);
|
||||||
|
}
|
||||||
|
else if( percent>20&&percent<50){
|
||||||
|
rtvm.percentageTextColor=Color(0XFFE56910);
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/50%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/50%.png'),height: 70,width:70,);
|
||||||
|
}
|
||||||
|
else if( percent>50&&percent<80){
|
||||||
|
rtvm.percentageTextColor=Color(0XFF1D7AFC);
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/75%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/75%.png'),height: 70,width:70,);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.percentageTextColor=Color(0XFF0A9E04);
|
||||||
|
/* rtvm.tank_image=Image(image: const AssetImage('images/100%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/100%.png'),height: 70,width:70,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.water_level ='';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rtvm.tank_location.toString().toUpperCase()=='SUMP'&&rtvm.type_of_water.toString().toUpperCase()=='BORE WATER'){
|
||||||
|
rtvm.cardColor=Color(0xffC4A484);
|
||||||
|
}
|
||||||
|
else if(rtvm.tank_location.toString().toUpperCase()=='SUMP'&&rtvm.type_of_water.toString().toUpperCase()=='DRINKING WATER'){
|
||||||
|
rtvm.cardColor=Color(0xffc3e3f8);
|
||||||
|
}
|
||||||
|
else if(rtvm.tank_location.toString().toUpperCase()=='OVERHEAD'&&rtvm.type_of_water.toString().toUpperCase()=='BORE WATER'){
|
||||||
|
rtvm.cardColor=Color(0xfff8f3cb);
|
||||||
|
}
|
||||||
|
else if(rtvm.tank_location.toString().toUpperCase()=='OVERHEAD'&&rtvm.type_of_water.toString().toUpperCase()=='DRINKING WATER'){
|
||||||
|
rtvm.cardColor=Color(0XFF9bedff);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.cardColor=Color(0xffcdf3ce);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Random random = new Random();
|
||||||
|
|
||||||
|
|
||||||
|
rtvm.type = json['type'] ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
//rtvm.connections=json['connections']??[];
|
||||||
|
|
||||||
|
rtvm.source = json['tankName']??'';
|
||||||
|
rtvm.inConnections = json['connections']['inputConnections']??[];
|
||||||
|
|
||||||
|
|
||||||
|
rtvm.inConnections.forEach((element) {
|
||||||
|
|
||||||
|
rtvm.inputConnections.add(element['inputConnections']);
|
||||||
|
rtvm.showInConnections=rtvm.inputConnections.join(",");
|
||||||
|
});
|
||||||
|
|
||||||
|
rtvm.outConnections = json['connections']['outputConnections']??[];
|
||||||
|
rtvm.outConnections.forEach((element) {
|
||||||
|
|
||||||
|
rtvm.outputConnections.add(element['outputConnections']);
|
||||||
|
rtvm.showOutConnections=rtvm.outputConnections.join(",");
|
||||||
|
});
|
||||||
|
|
||||||
|
rtvm.isCheckedInput = false;
|
||||||
|
rtvm.isCheckedOutput = false;
|
||||||
|
|
||||||
|
if(rtvm.motorStatus.toString().toUpperCase()=='OFF'){
|
||||||
|
rtvm.startButtonColor=<Color>[Colors.green,Colors.greenAccent,Colors.lightGreen];
|
||||||
|
rtvm.stoptButtonColor=<Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.startButtonColor=<Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
rtvm.stoptButtonColor=<Color>[Colors.redAccent,Colors.red,Colors.redAccent];
|
||||||
|
}
|
||||||
|
|
||||||
|
rtvm.slave_status = json['slave_status'] ?? '';
|
||||||
|
rtvm.slaveDisconnectedTime = json['slave_disconnected_time'] ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"tankName":this.tank_name,
|
||||||
|
"capacity": this.capacity,
|
||||||
|
"blockName": this.block_name,
|
||||||
|
"typeOfWater": this.type_of_water ,
|
||||||
|
"type": this.type,
|
||||||
|
"tankLocation": this.tank_location,
|
||||||
|
"waterlevel": this.water_level,
|
||||||
|
"source": this.source,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
|
||||||
|
class TankersModel {
|
||||||
|
String tanker_name = '';
|
||||||
|
var capacity='';
|
||||||
|
String type_of_water='';
|
||||||
|
String phone_number='';
|
||||||
|
List capacitiesOfTanker=[];
|
||||||
|
List showCapacity=[];
|
||||||
|
List waterType=[];
|
||||||
|
List showTypeofWater=[];
|
||||||
|
var typeOfWaterForBooking=[];
|
||||||
|
var capacitiesForBooking=[];
|
||||||
|
|
||||||
|
bool isFiveChecked=false;
|
||||||
|
bool isTenChecked=false;
|
||||||
|
bool isFifteenChecked=false;
|
||||||
|
bool isTwentyChecked=false;
|
||||||
|
bool isDrinkingChecked=false;
|
||||||
|
bool isBoreChecked=false;
|
||||||
|
List updatedCapacities=[];
|
||||||
|
List updatedWaterTypes=[];
|
||||||
|
|
||||||
|
|
||||||
|
TankersModel();
|
||||||
|
|
||||||
|
|
||||||
|
factory TankersModel.fromJson(Map<String, dynamic> json){
|
||||||
|
TankersModel rtvm = new TankersModel();
|
||||||
|
|
||||||
|
rtvm.tanker_name = json['tankerName'] ?? '';
|
||||||
|
rtvm.phone_number = json['phoneNumber'] ?? '';
|
||||||
|
rtvm.capacitiesOfTanker = json['capacity']??[];
|
||||||
|
|
||||||
|
rtvm.capacitiesOfTanker.forEach((element) {
|
||||||
|
|
||||||
|
rtvm.showCapacity.add(element['capacity']);
|
||||||
|
|
||||||
|
rtvm.capacitiesForBooking.add(element['capacity']);
|
||||||
|
|
||||||
|
rtvm.capacity=rtvm.showCapacity.join(",");
|
||||||
|
|
||||||
|
if(element['capacity']=='5000'){
|
||||||
|
|
||||||
|
rtvm.isFiveChecked=true;
|
||||||
|
rtvm.updatedCapacities.add({'capacity': '5000'});
|
||||||
|
}
|
||||||
|
else if(element['capacity']=='10000'){
|
||||||
|
rtvm.isTenChecked=true;
|
||||||
|
rtvm.updatedCapacities.add({'capacity': '10000'});
|
||||||
|
}
|
||||||
|
else if(element['capacity']=='15000'){
|
||||||
|
rtvm.isFifteenChecked=true;
|
||||||
|
rtvm.updatedCapacities.add({'capacity': '15000'});
|
||||||
|
}
|
||||||
|
else if(element['capacity']=='20000'){
|
||||||
|
rtvm.isTwentyChecked=true;
|
||||||
|
rtvm.updatedCapacities.add({'capacity': '20000'});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.isFiveChecked=false;
|
||||||
|
rtvm.isFiveChecked=false;
|
||||||
|
rtvm.isFiveChecked=false;
|
||||||
|
rtvm.isTwentyChecked=false;
|
||||||
|
|
||||||
|
rtvm.updatedCapacities.remove({'capacity': '5000'});
|
||||||
|
rtvm.updatedCapacities.remove({'capacity': '10000'});
|
||||||
|
rtvm.updatedCapacities.remove({'capacity': '15000'});
|
||||||
|
rtvm.updatedCapacities.remove({'capacity': '20000'});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
rtvm.waterType = json['typeofwater']??[];
|
||||||
|
rtvm.waterType.forEach((element) {
|
||||||
|
|
||||||
|
rtvm.showTypeofWater.add(element['typeofwater']);
|
||||||
|
|
||||||
|
rtvm.typeOfWaterForBooking.add(element['typeofwater']);
|
||||||
|
|
||||||
|
rtvm.type_of_water=rtvm.showTypeofWater.join(",");
|
||||||
|
|
||||||
|
if(element['typeofwater'].toString().toUpperCase()=='DRINKING WATER'){
|
||||||
|
|
||||||
|
rtvm.isDrinkingChecked=true;
|
||||||
|
rtvm.updatedWaterTypes.add({'typeofwater': 'Drinking Water'});
|
||||||
|
}
|
||||||
|
else if(element['typeofwater'].toString().toUpperCase()=='BORE WATER'){
|
||||||
|
|
||||||
|
rtvm.isBoreChecked=true;
|
||||||
|
rtvm.updatedWaterTypes.add({'typeofwater': 'Bore Water'});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.isBoreChecked=false;
|
||||||
|
rtvm.isDrinkingChecked=false;
|
||||||
|
rtvm.updatedWaterTypes.remove({'typeofwater': 'Drinking Water'});
|
||||||
|
rtvm.updatedWaterTypes.remove({'typeofwater': 'Bore Water'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"tankerName":this.tanker_name,
|
||||||
|
"capacity": this.capacity,
|
||||||
|
"typeofwater": this.type_of_water ,
|
||||||
|
"phoneNumber": this.phone_number,
|
||||||
|
"capacity": this.capacitiesOfTanker,
|
||||||
|
"typeofwater": this.waterType,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,276 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class GetTanksDetailsModel {
|
||||||
|
String tank_name = '';
|
||||||
|
String capacity='';
|
||||||
|
String block_name='';
|
||||||
|
String type_of_water='';
|
||||||
|
String type='';
|
||||||
|
String tank_location='';
|
||||||
|
Color cardColor=Colors.white;
|
||||||
|
String motorStatus='';
|
||||||
|
String EntityMotorStatus='';
|
||||||
|
String motorStartedTime='';
|
||||||
|
bool isMotor=true;
|
||||||
|
String? motor;
|
||||||
|
int groupValue = -1;
|
||||||
|
List inConnections =[];
|
||||||
|
List outConnections=[];
|
||||||
|
List inConnectionsForUpdate=[];
|
||||||
|
List outConnectionsForUpdate=[];
|
||||||
|
List inputConnections=[];
|
||||||
|
List inputRadioChecked=[];
|
||||||
|
List<String> outputConnections=[];
|
||||||
|
List<String> outputtypes=[];
|
||||||
|
List<String> inputtypes=[];
|
||||||
|
String source='';
|
||||||
|
List<bool> motorForUpdateInput1=[];
|
||||||
|
bool motorForUpdateInput=false;
|
||||||
|
bool isCheckedInput=false;
|
||||||
|
bool isCheckedOutput=false;
|
||||||
|
int inconnectionsIndex = 0;
|
||||||
|
int outconnectionsIndex = 0;
|
||||||
|
var showInConnections='';
|
||||||
|
var showOutConnections='';
|
||||||
|
var showdetailOutputConnections='';
|
||||||
|
var showdetailInputConnections='';
|
||||||
|
List<bool> outConnectionsCheckboxes=[];
|
||||||
|
List<bool> inConnectionsCheckboxes=[];
|
||||||
|
List<bool> outConnectionsCheckboxesForUpdate=[];
|
||||||
|
List<bool> inConnectionsCheckboxesForUpdate=[];
|
||||||
|
List<bool> inConnectionsCheckboxesForUpdateSumpInput=[];
|
||||||
|
List<bool> inConnectionsHaveMotor=[];
|
||||||
|
List<bool> inConnectionsHaveMotornNew=[];
|
||||||
|
List<bool> outConnectionsHaveMotor=[];
|
||||||
|
List<bool> outConnectionsHaveMotornNew=[];
|
||||||
|
List<bool> inConnectionsHaveMotorForBore=[];
|
||||||
|
List<bool> inConnectionsHaveMotorForBoreNew=[];
|
||||||
|
List<String> inConnectionsHaveMotorForUi=[];
|
||||||
|
List<Color> startButtonColor=<Color>[Colors.green,Colors.greenAccent,Colors.lightGreen];
|
||||||
|
List<Color> stoptButtonColor=<Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
String status='';
|
||||||
|
String startTime='';
|
||||||
|
String stopTime='';
|
||||||
|
String hardware_id='';
|
||||||
|
String tank_hardware_id='';
|
||||||
|
String water_level='';
|
||||||
|
Color onButton=Colors.green;
|
||||||
|
Color offButton=Colors.grey;
|
||||||
|
Color grey=Colors.grey;
|
||||||
|
String status1='1';
|
||||||
|
String message='';
|
||||||
|
String motor_status='';
|
||||||
|
String motor_stop_status='';
|
||||||
|
String capacityForParse='';
|
||||||
|
String minPercentage='';
|
||||||
|
String maxPercentage='';
|
||||||
|
String tankAutomationMode='';
|
||||||
|
String currentWaterLevelPercent='';
|
||||||
|
String tank_status='';
|
||||||
|
Color textColor=Colors.black;
|
||||||
|
Image tank_image=Image(image: const AssetImage('images/100%.png'),);
|
||||||
|
|
||||||
|
TextEditingController boxIdOutputConnectionsController = TextEditingController();
|
||||||
|
TextEditingController boxIdInputConnectionsController = TextEditingController();
|
||||||
|
|
||||||
|
Widget outputConnectionsBoxId() {
|
||||||
|
return Container(
|
||||||
|
child: TextFormField(
|
||||||
|
cursorColor: Colors.white,
|
||||||
|
style: TextStyle(color: primaryColor),
|
||||||
|
controller: boxIdOutputConnectionsController,
|
||||||
|
decoration: textFormFieldDecorationForBoxId(Icons.add_box,'Enter Box Id'),
|
||||||
|
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget inputConnectionsBoxId() {
|
||||||
|
return Container(
|
||||||
|
child: TextFormField(
|
||||||
|
cursorColor: Colors.white,
|
||||||
|
style: TextStyle(color: primaryColor),
|
||||||
|
controller: boxIdInputConnectionsController,
|
||||||
|
decoration: textFormFieldDecorationForBoxId(Icons.add_box,'Enter Box Id'),
|
||||||
|
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GetTanksDetailsModel();
|
||||||
|
|
||||||
|
factory GetTanksDetailsModel.fromJson(Map<String, dynamic> json){
|
||||||
|
GetTanksDetailsModel rtvm = new GetTanksDetailsModel();
|
||||||
|
|
||||||
|
rtvm.tank_name = json['tankName'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ??'';
|
||||||
|
rtvm.capacityForParse =rtvm.capacity. replaceAll(',', '');
|
||||||
|
rtvm.block_name = json['blockName'] ?? '';
|
||||||
|
rtvm.type_of_water = json['typeOfWater'] ?? '';
|
||||||
|
rtvm.type = json['type'] ?? '';
|
||||||
|
rtvm.tank_location = json['tankLocation']??'';
|
||||||
|
rtvm.motorStatus = json['motor_status']??'';
|
||||||
|
rtvm.hardware_id = json['motor_status']??'';
|
||||||
|
rtvm.tank_hardware_id = json['motor_status']??'';
|
||||||
|
rtvm.water_level = json['waterlevel'] ?? '';
|
||||||
|
rtvm.minPercentage = json['auto_min_percentage'] ?? '';
|
||||||
|
rtvm.maxPercentage = json['auto_max_percentage'] ?? '';
|
||||||
|
rtvm.tankAutomationMode = json['auto_mode_type'] ?? '';
|
||||||
|
rtvm.tank_status = json['status'] ?? '';
|
||||||
|
|
||||||
|
// rtvm.motorForUpdateInput=true;
|
||||||
|
|
||||||
|
/*if(rtvm.motorStatus=='0'){
|
||||||
|
rtvm.startButtonColor=<Color>[Colors.green,Colors.greenAccent,Colors.lightGreen];
|
||||||
|
rtvm.stoptButtonColor=<Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
rtvm.status='OFF';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.startButtonColor=<Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
rtvm.stoptButtonColor=<Color>[Colors.redAccent,Colors.red,Colors.redAccent];
|
||||||
|
rtvm.status='ON';
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
if(rtvm.tank_location.toString().toUpperCase()=='SUMP'&&rtvm.type_of_water.toString().toUpperCase()=='BORE WATER'){
|
||||||
|
rtvm.cardColor=Color(0xffC4A484);
|
||||||
|
}
|
||||||
|
else if(rtvm.tank_location.toString().toUpperCase()=='SUMP'&&rtvm.type_of_water.toString().toUpperCase()=='DRINKING WATER'){
|
||||||
|
rtvm.cardColor=Color(0xffc3e3f8);
|
||||||
|
}
|
||||||
|
else if(rtvm.tank_location.toString().toUpperCase()=='OVERHEAD'&&rtvm.type_of_water.toString().toUpperCase()=='BORE WATER'){
|
||||||
|
rtvm.cardColor=Color(0xfff8f3cb);
|
||||||
|
}
|
||||||
|
else if(rtvm.tank_location.toString().toUpperCase()=='OVERHEAD'&&rtvm.type_of_water.toString().toUpperCase()=='DRINKING WATER'){
|
||||||
|
rtvm.cardColor=Color(0XFF9bedff);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.cardColor=Color(0xffcdf3ce);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(rtvm.water_level!=''){
|
||||||
|
double percent=int.parse(rtvm.water_level )/double.parse(rtvm.capacityForParse )*100;
|
||||||
|
|
||||||
|
rtvm.currentWaterLevelPercent=percent.toStringAsFixed(0);;
|
||||||
|
|
||||||
|
print(percent);
|
||||||
|
if( percent<20){
|
||||||
|
rtvm.textColor=Colors.red;
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/25%gif.gif'),height:60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/25%.png'),height: 90,width:120,);
|
||||||
|
}
|
||||||
|
else if( percent>20&&percent<40){
|
||||||
|
rtvm.textColor=Colors.yellow;
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/50%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/50%.png'),height: 90,width:120,);
|
||||||
|
}
|
||||||
|
else if( percent>40&&percent<70){
|
||||||
|
rtvm.textColor=Colors.green;
|
||||||
|
/*rtvm.tank_image=Image(image: const AssetImage('images/75%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/75%.png'),height: 90,width:120,);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.textColor=Colors.blue;
|
||||||
|
/* rtvm.tank_image=Image(image: const AssetImage('images/100%gif.gif'),height: 60,width:60,);*/
|
||||||
|
rtvm.tank_image=Image(image: const AssetImage('images/100%.png'),height: 90,width:120,);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.water_level ='';
|
||||||
|
}
|
||||||
|
|
||||||
|
rtvm.source = json['tankName']??'';
|
||||||
|
rtvm.inConnectionsForUpdate=json['connections']['inputConnections']??[];
|
||||||
|
rtvm.outConnectionsForUpdate=json['connections']['outputConnections']??[];
|
||||||
|
|
||||||
|
rtvm.inConnections = json['connections']['inputConnections']??[];
|
||||||
|
|
||||||
|
|
||||||
|
rtvm.inConnections.forEach((element) {
|
||||||
|
|
||||||
|
element["startButtonColor"] = <Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
element["stoptButtonColor"] = <Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
rtvm.inputRadioChecked.add(element['inputismotor']);
|
||||||
|
|
||||||
|
/*if(element['input_type'].toString().toLowerCase()!='borewell'){
|
||||||
|
if(element['inputismotor']==true){
|
||||||
|
rtvm.inConnectionsHaveMotor.add('yes');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rtvm.inConnectionsHaveMotor.add('no');
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
if(element['input_type'].toString().toLowerCase()!='borewell'){
|
||||||
|
rtvm.inConnectionsHaveMotor.add(element['inputismotor']);
|
||||||
|
}
|
||||||
|
if(element['input_type'].toString().toLowerCase()=='borewell'||element['input_type'].toString().toLowerCase()=='govt.pipeline'){
|
||||||
|
rtvm.inConnectionsHaveMotorForBore.add(element['inputismotor']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
rtvm.inputConnections.add(element['inputConnections']);
|
||||||
|
rtvm.showInConnections=rtvm.inputConnections.join(",");
|
||||||
|
rtvm.inputtypes.add(element['input_type']??'');
|
||||||
|
rtvm.showdetailInputConnections=rtvm.inputtypes.join("-");
|
||||||
|
rtvm.EntityMotorStatus=element['motor_status'];
|
||||||
|
if(element['motor_status']=='0'){
|
||||||
|
element["startButtonColor"]=<Color>[Colors.green,Colors.greenAccent,Colors.lightGreen];
|
||||||
|
element["stoptButtonColor"]=<Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
rtvm.status='OFF';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
element["stoptButtonColor"]=<Color>[Colors.grey,Colors.grey,Colors.grey];
|
||||||
|
element["stoptButtonColor"]=<Color>[Colors.redAccent,Colors.red,Colors.redAccent];
|
||||||
|
rtvm.status='ON';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
rtvm.outConnections = json['connections']['outputConnections']??[];
|
||||||
|
rtvm.outConnections.forEach((element) {
|
||||||
|
|
||||||
|
rtvm.outputConnections.add(element['outputConnections']);
|
||||||
|
//rtvm.outputtypes.add(element['outputConnections']);
|
||||||
|
rtvm.outputtypes.add(element['output_type']??'');
|
||||||
|
rtvm.showOutConnections=rtvm.outputConnections.join(",");
|
||||||
|
rtvm.showdetailOutputConnections=rtvm.outputtypes.join("-");
|
||||||
|
rtvm.outConnectionsHaveMotor.add(element['outputismotor']??false);
|
||||||
|
});
|
||||||
|
|
||||||
|
rtvm.isCheckedInput = false;
|
||||||
|
rtvm.isCheckedOutput = false;
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"tankName":this.tank_name,
|
||||||
|
"capacity": this.capacity,
|
||||||
|
"blockName": this.block_name,
|
||||||
|
"typeOfWater": this.type_of_water ,
|
||||||
|
"type": this.type,
|
||||||
|
"tankLocation": this.tank_location,
|
||||||
|
"source": this.source,
|
||||||
|
};
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
if (identical(this, other)) return true;
|
||||||
|
|
||||||
|
return other is GetTanksDetailsModel &&
|
||||||
|
other.tank_name == tank_name &&
|
||||||
|
other.tank_location == tank_location;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => tank_name.hashCode ^ tank_location.hashCode;
|
||||||
|
}
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
class UserAccountsModel {
|
||||||
|
|
||||||
|
String tanker_name = '';
|
||||||
|
String dateOfOrder = '';
|
||||||
|
String tankName = '';
|
||||||
|
String tankLocation = '';
|
||||||
|
String bookingid = '';
|
||||||
|
String typeofwater = '';
|
||||||
|
String capacity = '';
|
||||||
|
String address = '';
|
||||||
|
String price = '';
|
||||||
|
String payment_status = '';
|
||||||
|
String orderStatus = '';
|
||||||
|
String delivery_agent = '';
|
||||||
|
String delivery_agent_mobile = '';
|
||||||
|
String initial_water_level = '';
|
||||||
|
String final_water_level = '';
|
||||||
|
String start_time = '';
|
||||||
|
String stop_time = '';
|
||||||
|
String quantityDelivered = '';
|
||||||
|
String amount_paid = '';
|
||||||
|
String amount_due = '';
|
||||||
|
String payment_mode = '';
|
||||||
|
String customerPhone = '';
|
||||||
|
String supplierPhone = '';
|
||||||
|
String customerName = '';
|
||||||
|
String supplierName = '';
|
||||||
|
Color payment_color=Colors.grey;
|
||||||
|
String displayText = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UserAccountsModel();
|
||||||
|
|
||||||
|
|
||||||
|
factory UserAccountsModel.fromJson(Map<String, dynamic> json){
|
||||||
|
UserAccountsModel rtvm = new UserAccountsModel();
|
||||||
|
|
||||||
|
rtvm.tanker_name = json['tankerName'] ?? '';
|
||||||
|
|
||||||
|
rtvm.dateOfOrder = json['dateOfOrder'] ?? '';
|
||||||
|
rtvm.tankName = json['tankName'] ?? '';
|
||||||
|
rtvm.tankLocation = json['tankLocation'] ?? '';
|
||||||
|
rtvm.bookingid = json['bookingid'] ?? '';
|
||||||
|
rtvm.typeofwater = json['typeofwater'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ?? '';
|
||||||
|
rtvm.address = json['address'] ?? '';
|
||||||
|
rtvm.price = json['price'] ?? '';
|
||||||
|
rtvm.payment_status = json['payment_status'] ?? '';
|
||||||
|
rtvm.orderStatus = json['orderStatus'] ?? '';
|
||||||
|
rtvm.delivery_agent = json['delivery_agent'] ?? '';
|
||||||
|
rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ?? '';
|
||||||
|
rtvm.initial_water_level = json['initial_water_level'] ?? '';
|
||||||
|
rtvm.final_water_level = json['final_water_level'] ?? '';
|
||||||
|
rtvm.start_time = json['start_time'] ?? '';
|
||||||
|
rtvm.stop_time = json['stop_time'] ?? '';
|
||||||
|
rtvm.quantityDelivered = json['quantityDelivered'] ?? '';
|
||||||
|
rtvm.amount_paid = json['amount_paid'] ?? '';
|
||||||
|
rtvm.amount_due = json['amount_due'] ?? '';
|
||||||
|
rtvm.payment_mode = json['payment_mode'] ?? '';
|
||||||
|
rtvm.customerPhone = json['customerPhone'] ?? '';
|
||||||
|
rtvm.supplierPhone = json['supplierPhone'] ?? '';
|
||||||
|
rtvm.customerName = json['customerName'] ?? '';
|
||||||
|
rtvm.supplierName = json['supplierName'] ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
if(rtvm.orderStatus=='delivered' && rtvm.payment_status=='paid'){
|
||||||
|
rtvm.payment_color=Colors.green;
|
||||||
|
rtvm.displayText='Payment Completed';
|
||||||
|
}
|
||||||
|
else if(rtvm.orderStatus=='delivered' && rtvm.payment_status=='due'){
|
||||||
|
rtvm.payment_color=primaryColor;
|
||||||
|
rtvm.displayText='Due';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:bookatanker/common/settings.dart';
|
||||||
|
class UserSupplierAccountsModel {
|
||||||
|
|
||||||
|
String tanker_name = '';
|
||||||
|
String dateOfOrder = '';
|
||||||
|
String tankName = '';
|
||||||
|
String tankLocation = '';
|
||||||
|
String bookingid = '';
|
||||||
|
String typeofwater = '';
|
||||||
|
String capacity = '';
|
||||||
|
String address = '';
|
||||||
|
String price = '';
|
||||||
|
String payment_status = '';
|
||||||
|
String orderStatus = '';
|
||||||
|
String delivery_agent = '';
|
||||||
|
String delivery_agent_mobile = '';
|
||||||
|
String initial_water_level = '';
|
||||||
|
String final_water_level = '';
|
||||||
|
String start_time = '';
|
||||||
|
String stop_time = '';
|
||||||
|
String quantityDelivered = '';
|
||||||
|
String amount_paid = '';
|
||||||
|
String amount_due = '';
|
||||||
|
String payment_mode = '';
|
||||||
|
String customerPhone = '';
|
||||||
|
String supplierPhone = '';
|
||||||
|
String customerName = '';
|
||||||
|
String supplierName = '';
|
||||||
|
Color payment_color=Colors.grey;
|
||||||
|
String displayText = '';
|
||||||
|
String distrubance_price = '';
|
||||||
|
String amount_difference = '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UserSupplierAccountsModel();
|
||||||
|
|
||||||
|
|
||||||
|
factory UserSupplierAccountsModel.fromJson(Map<String, dynamic> json){
|
||||||
|
UserSupplierAccountsModel rtvm = new UserSupplierAccountsModel();
|
||||||
|
|
||||||
|
rtvm.tanker_name = json['tankerName'] ?? '';
|
||||||
|
|
||||||
|
rtvm.dateOfOrder = json['dateOfOrder'] ?? '';
|
||||||
|
rtvm.tankName = json['tankName'] ?? '';
|
||||||
|
rtvm.tankLocation = json['tankLocation'] ?? '';
|
||||||
|
rtvm.bookingid = json['bookingid'] ?? '';
|
||||||
|
rtvm.typeofwater = json['typeofwater'] ?? '';
|
||||||
|
rtvm.capacity = json['capacity'] ?? '';
|
||||||
|
rtvm.address = json['address'] ?? '';
|
||||||
|
rtvm.price = json['price'] ?? '';
|
||||||
|
rtvm.payment_status = json['payment_status'] ?? '';
|
||||||
|
rtvm.orderStatus = json['orderStatus'] ?? '';
|
||||||
|
rtvm.delivery_agent = json['delivery_agent'] ?? '';
|
||||||
|
rtvm.delivery_agent_mobile = json['delivery_agent_mobile'] ?? '';
|
||||||
|
rtvm.initial_water_level = json['initial_water_level'] ?? '';
|
||||||
|
rtvm.final_water_level = json['final_water_level'] ?? '';
|
||||||
|
rtvm.start_time = json['start_time'] ?? '';
|
||||||
|
rtvm.stop_time = json['stop_time'] ?? '';
|
||||||
|
rtvm.quantityDelivered = json['quantityDelivered'] ?? '';
|
||||||
|
rtvm.amount_paid = json['amount_paid'] ?? '';
|
||||||
|
rtvm.amount_due = json['amount_due'] ?? '';
|
||||||
|
rtvm.payment_mode = json['payment_mode'] ?? '';
|
||||||
|
rtvm.customerPhone = json['customerPhone'] ?? '';
|
||||||
|
rtvm.supplierPhone = json['supplierPhone'] ?? '';
|
||||||
|
rtvm.customerName = json['customerName'] ?? '';
|
||||||
|
rtvm.supplierName = json['supplierName'] ?? '';
|
||||||
|
rtvm.distrubance_price = json['distrubance_price'] ?? '';
|
||||||
|
rtvm.amount_difference = json['amount_difference'] ?? '';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(rtvm.orderStatus=='delivered' && rtvm.payment_status=='paid'){
|
||||||
|
rtvm.payment_color=Colors.green;
|
||||||
|
rtvm.displayText='Payment Completed';
|
||||||
|
}
|
||||||
|
else if(rtvm.orderStatus=='delivered' && rtvm.payment_status=='due'){
|
||||||
|
rtvm.payment_color=primaryColor;
|
||||||
|
rtvm.displayText='Due';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,108 @@
|
|||||||
|
import 'package:geolocator/geolocator.dart';
|
||||||
|
|
||||||
|
import '../common/settings.dart';
|
||||||
|
|
||||||
|
|
||||||
|
class WaterSuppliersModel {
|
||||||
|
|
||||||
|
String supplier_name = '';
|
||||||
|
String status = '';
|
||||||
|
String supplier_address = '';
|
||||||
|
String supplier_phone_number = '';
|
||||||
|
String supplier_alternate_phone_number = '';
|
||||||
|
String supplier_id = '';
|
||||||
|
String about_supplier = '';
|
||||||
|
String startingprice_supplier = '';
|
||||||
|
|
||||||
|
double lat = 0;
|
||||||
|
double lng = 0;
|
||||||
|
|
||||||
|
double distanceInMeters = 0;
|
||||||
|
|
||||||
|
String displayAddress = '';
|
||||||
|
|
||||||
|
bool isFavorite = false;
|
||||||
|
bool isConnected = false;
|
||||||
|
|
||||||
|
WaterSuppliersModel();
|
||||||
|
|
||||||
|
factory WaterSuppliersModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
|
||||||
|
WaterSuppliersModel rtvm = WaterSuppliersModel();
|
||||||
|
|
||||||
|
var supplier = json['supplier'];
|
||||||
|
|
||||||
|
rtvm.supplier_name = supplier['suppliername'] ?? '';
|
||||||
|
|
||||||
|
rtvm.status = supplier['status'] ?? '';
|
||||||
|
|
||||||
|
rtvm.supplier_address =
|
||||||
|
supplier['profile']?['office_address'] ?? '';
|
||||||
|
|
||||||
|
rtvm.supplier_phone_number =
|
||||||
|
supplier['phone'] ?? '';
|
||||||
|
|
||||||
|
rtvm.supplier_alternate_phone_number =
|
||||||
|
supplier['profile']?['alternativeContactNumber'] ?? '';
|
||||||
|
|
||||||
|
rtvm.supplier_id =
|
||||||
|
supplier['supplierId'] ?? '';
|
||||||
|
|
||||||
|
rtvm.lat =
|
||||||
|
(supplier['latitude'] ?? 0).toDouble();
|
||||||
|
|
||||||
|
rtvm.lng =
|
||||||
|
(supplier['longitude'] ?? 0).toDouble();
|
||||||
|
|
||||||
|
rtvm.about_supplier =
|
||||||
|
supplier['description'] ?? '';
|
||||||
|
|
||||||
|
rtvm.startingprice_supplier =
|
||||||
|
supplier['startingPrice'] ?? '';
|
||||||
|
|
||||||
|
rtvm.isFavorite =
|
||||||
|
json['isFavorite'] ?? false;
|
||||||
|
|
||||||
|
rtvm.isConnected =
|
||||||
|
json['isConnected'] ?? false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
rtvm.distanceInMeters = double.parse(
|
||||||
|
(Geolocator.distanceBetween(
|
||||||
|
rtvm.lat,
|
||||||
|
rtvm.lng,
|
||||||
|
AppSettings.userLatitude,
|
||||||
|
AppSettings.userLongitude) /
|
||||||
|
1000)
|
||||||
|
.toStringAsFixed(2),
|
||||||
|
);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
rtvm.distanceInMeters = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Address safe parsing
|
||||||
|
|
||||||
|
if (rtvm.supplier_address.contains(',')) {
|
||||||
|
|
||||||
|
List<String> parts = rtvm.supplier_address.split(',');
|
||||||
|
|
||||||
|
if (parts.length > 2) {
|
||||||
|
rtvm.displayAddress = parts[2].trim();
|
||||||
|
} else {
|
||||||
|
rtvm.displayAddress = parts.last.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
rtvm.displayAddress = rtvm.supplier_address;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return rtvm;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue