INFRA: Set Up Project.

This commit is contained in:
2025-11-28 11:10:49 +05:00
commit c798279f7d
609 changed files with 77436 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
class AdminCommission {
String? amount;
bool? isEnabled;
String? commissionType;
AdminCommission({this.amount, this.isEnabled, this.commissionType});
AdminCommission.fromJson(Map<String, dynamic> json) {
amount = json['commission'].toString();
isEnabled = json['enable'];
commissionType = json['type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['commission'] = amount;
data['enable'] = isEnabled;
data['type'] = commissionType;
return data;
}
}

View File

@@ -0,0 +1,97 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class AdvertisementModel {
String? coverImage;
Timestamp? createdAt;
String? description;
Timestamp? endDate;
String? id;
bool? paymentStatus;
String? priority;
String? profileImage;
bool? showRating;
bool? showReview;
Timestamp? startDate;
String? status;
String? title;
String? type;
String? vendorId;
String? video;
bool? isPaused;
Timestamp? updatedAt;
String? canceledNote;
String? pauseNote;
AdvertisementModel({
this.coverImage,
this.createdAt,
this.description,
this.endDate,
this.id,
this.paymentStatus,
this.priority,
this.profileImage,
this.showRating,
this.showReview,
this.startDate,
this.status,
this.title,
this.type,
this.vendorId,
this.video,
this.isPaused,
this.updatedAt,
this.canceledNote,
this.pauseNote,
});
factory AdvertisementModel.fromJson(Map<String, dynamic> json) {
return AdvertisementModel(
coverImage: json['coverImage'],
createdAt: json['createdAt'],
description: json['description'],
endDate: json['endDate'],
id: json['id'],
paymentStatus: json['paymentStatus'],
priority: json['priority'],
profileImage: json['profileImage'],
showRating: json['showRating'],
showReview: json['showReview'],
startDate: json['startDate'],
status: json['status'],
title: json['title'],
type: json['type'],
vendorId: json['vendorId'],
video: json['video'],
isPaused: json['isPaused'],
updatedAt: json['updatedAt'],
canceledNote: json['canceledNote'],
pauseNote: json['pauseNote']);
}
Map<String, dynamic> toJson() {
return {
'coverImage': coverImage,
'createdAt': createdAt,
'description': description,
'endDate': endDate,
'id': id,
'paymentStatus': paymentStatus,
'priority': priority,
'profileImage': profileImage,
'showRating': showRating,
'showReview': showReview,
'startDate': startDate,
'status': status,
'title': title,
'type': type,
'vendorId': vendorId,
'video': video,
'isPaused': isPaused,
'updatedAt': updatedAt,
'canceledNote': canceledNote,
'pauseNote': pauseNote,
};
}
}

View File

@@ -0,0 +1,18 @@
class AttributesModel {
String? id;
String? title;
AttributesModel({this.id, this.title});
AttributesModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['title'] = title;
return data;
}
}

View File

@@ -0,0 +1,39 @@
class BannerModel {
String? id;
int? setOrder;
String? position;
String? sectionId;
String? photo;
String? title;
String? redirect_type;
String? redirect_id;
bool? isPublish;
BannerModel({this.id, this.setOrder, this.position, this.redirect_type, this.redirect_id, this.sectionId, this.photo, this.title, this.isPublish});
BannerModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
position = json['position'];
sectionId = json['sectionId'];
setOrder = json['set_order'];
photo = json['photo'];
title = json['title'];
isPublish = json['is_publish'];
redirect_type = json['redirect_type'];
redirect_id = json['redirect_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['position'] = position;
data['sectionId'] = sectionId;
data['set_order'] = setOrder;
data['photo'] = photo;
data['title'] = title;
data['is_publish'] = isPublish;
data['redirect_type'] = redirect_type;
data['redirect_id'] = redirect_id;
return data;
}
}

View File

@@ -0,0 +1,27 @@
class BrandsModel {
String? photo;
String? sectionId;
String? id;
String? title;
bool? isPublish;
BrandsModel({this.photo, this.sectionId, this.id, this.title, this.isPublish});
BrandsModel.fromJson(Map<String, dynamic> json) {
photo = json['photo'];
sectionId = json['sectionId'];
id = json['id'];
title = json['title'];
isPublish = json['is_publish'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['photo'] = photo;
data['sectionId'] = sectionId;
data['id'] = id;
data['title'] = title;
data['is_publish'] = isPublish;
return data;
}
}

View File

@@ -0,0 +1,192 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/tax_model.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/models/vehicle_type.dart';
class CabOrderModel {
String? status;
List<dynamic>? rejectedByDrivers;
String? couponId;
Timestamp? scheduleDateTime;
String? duration;
bool? roundTrip;
bool? paymentStatus;
String? discount;
String? destinationLocationName;
String? authorID;
Timestamp? createdAt;
DestinationLocation? destinationLocation;
String? adminCommissionType;
String? sourceLocationName;
String? rideType;
List<TaxModel>? taxSetting;
Timestamp? triggerDelevery;
String? id;
String? adminCommission;
String? couponCode;
Timestamp? scheduleReturnDateTime;
String? sectionId;
String? tipAmount;
String? distance;
String? vehicleId;
String? paymentMethod;
VehicleType? vehicleType;
String? otpCode;
DestinationLocation? sourceLocation;
UserModel? author;
UserModel? driver;
String? driverId;
String? subTotal;
CabOrderModel({
this.status,
this.rejectedByDrivers,
this.scheduleDateTime,
this.duration,
this.roundTrip,
this.paymentStatus,
this.discount,
this.destinationLocationName,
this.authorID,
this.createdAt,
this.destinationLocation,
this.adminCommissionType,
this.sourceLocationName,
this.rideType,
this.taxSetting,
this.triggerDelevery,
this.id,
this.adminCommission,
this.couponCode,
this.couponId,
this.scheduleReturnDateTime,
this.sectionId,
this.tipAmount,
this.distance,
this.vehicleId,
this.paymentMethod,
this.vehicleType,
this.otpCode,
this.sourceLocation,
this.author,
this.subTotal,
this.driver,
this.driverId,
});
CabOrderModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
rejectedByDrivers = json['rejectedByDrivers'] ?? [];
couponId = json['couponId'];
scheduleDateTime = json['scheduleDateTime'];
duration = json['duration'];
roundTrip = json['roundTrip'];
paymentStatus = json['paymentStatus'];
discount = json['discount'] == null ?"0.0": json['discount'].toString();
destinationLocationName = json['destinationLocationName'];
authorID = json['authorID'];
createdAt = json['createdAt'];
destinationLocation = json['destinationLocation'] != null ? DestinationLocation.fromJson(json['destinationLocation']) : null;
adminCommissionType = json['adminCommissionType'];
sourceLocationName = json['sourceLocationName'];
rideType = json['rideType'];
if (json['taxSetting'] != null) {
taxSetting = <TaxModel>[];
json['taxSetting'].forEach((v) {
taxSetting!.add(TaxModel.fromJson(v));
});
}
triggerDelevery = json['trigger_delevery'];
id = json['id'];
adminCommission = json['adminCommission'];
couponCode = json['couponCode'];
scheduleReturnDateTime = json['scheduleReturnDateTime'];
sectionId = json['sectionId'];
tipAmount = json['tip_amount'];
distance = json['distance'];
vehicleId = json['vehicleId'];
paymentMethod = json['paymentMethod'];
vehicleType = json['vehicleType'] != null ? VehicleType.fromJson(json['vehicleType']) : null;
otpCode = json['otpCode'];
sourceLocation = json['sourceLocation'] != null ? DestinationLocation.fromJson(json['sourceLocation']) : null;
author = json['author'] != null ? UserModel.fromJson(json['author']) : null;
subTotal = json['subTotal'];
driver = json['driver'] != null ? UserModel.fromJson(json['driver']) : null;
driverId = json['driverId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
// if (rejectedByDrivers != null) {
// data['rejectedByDrivers'] = rejectedByDrivers!.map((v) => v.toJson()).toList();
// }
if (rejectedByDrivers != null) {
data['rejectedByDrivers'] = rejectedByDrivers;
}
data['couponId'] = couponId;
data['scheduleDateTime'] = scheduleDateTime;
data['duration'] = duration;
data['roundTrip'] = roundTrip;
data['paymentStatus'] = paymentStatus;
data['discount'] = discount;
data['destinationLocationName'] = destinationLocationName;
data['authorID'] = authorID;
data['createdAt'] = createdAt;
if (destinationLocation != null) {
data['destinationLocation'] = destinationLocation!.toJson();
}
data['adminCommissionType'] = adminCommissionType;
data['sourceLocationName'] = sourceLocationName;
data['rideType'] = rideType;
if (taxSetting != null) {
data['taxSetting'] = taxSetting!.map((v) => v.toJson()).toList();
}
data['trigger_delevery'] = triggerDelevery!;
data['id'] = id;
data['adminCommission'] = adminCommission;
data['couponCode'] = couponCode;
data['scheduleReturnDateTime'] = scheduleReturnDateTime;
data['sectionId'] = sectionId;
data['tip_amount'] = tipAmount;
data['distance'] = distance;
data['vehicleId'] = vehicleId;
data['paymentMethod'] = paymentMethod;
data['driverId'] = driverId;
if (driver != null) {
data['driver'] = driver!.toJson();
}
if (vehicleType != null) {
data['vehicleType'] = vehicleType!.toJson();
}
data['otpCode'] = otpCode;
if (sourceLocation != null) {
data['sourceLocation'] = sourceLocation!.toJson();
}
if (author != null) {
data['author'] = author!.toJson();
}
data['subTotal'] = subTotal;
return data;
}
}
class DestinationLocation {
double? longitude;
double? latitude;
DestinationLocation({this.longitude, this.latitude});
DestinationLocation.fromJson(Map<String, dynamic> json) {
longitude = json['longitude'];
latitude = json['latitude'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['longitude'] = longitude;
data['latitude'] = latitude;
return data;
}
}

View File

@@ -0,0 +1,99 @@
import 'dart:convert';
class CartProductModel {
String? id;
String? categoryId;
String? name;
String? photo;
String? price;
String? discountPrice;
String? vendorID;
int? quantity;
String? extrasPrice;
List<dynamic>? extras;
VariantInfo? variantInfo;
CartProductModel({
this.id,
this.categoryId,
this.name,
this.photo,
this.price,
this.discountPrice,
this.vendorID,
this.quantity,
this.extrasPrice,
this.variantInfo,
this.extras,
});
CartProductModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
categoryId = json['category_id'];
name = json['name'];
photo = json['photo'];
price = json['price'] ?? "0.0";
discountPrice = json['discountPrice'] ?? "0.0";
vendorID = json['vendorID'];
quantity = json['quantity'];
extrasPrice = json['extras_price'];
extras = json['extras'] == "null" || json['extras'] == null
? null
: "String" == json['extras'].runtimeType.toString()
? List<dynamic>.from(jsonDecode(json['extras']))
: List<dynamic>.from(json['extras']);
variantInfo = json['variant_info'] == "null" || json['variant_info'] == null
? null
: "String" == json['variant_info'].runtimeType.toString()
? VariantInfo.fromJson(jsonDecode(json['variant_info']))
: VariantInfo.fromJson(json['variant_info']);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['category_id'] = categoryId;
data['name'] = name;
data['photo'] = photo;
data['price'] = price;
data['discountPrice'] = discountPrice;
data['vendorID'] = vendorID;
data['quantity'] = quantity;
data['extras_price'] = extrasPrice;
data['extras'] = extras;
if (variantInfo != null) {
data['variant_info'] = variantInfo?.toJson(); // Handle null value
}
return data;
}
}
class VariantInfo {
String? variantId;
String? variantPrice;
String? variantSku;
String? variantImage;
Map<String, dynamic>? variantOptions;
VariantInfo({this.variantId, this.variantPrice, this.variantSku, this.variantImage, this.variantOptions});
VariantInfo.fromJson(Map<String, dynamic> json) {
variantId = json['variantId'] ?? '';
variantPrice = json['variantPrice'] ?? '';
variantSku = json['variantSku'] ?? '';
variantImage = json['variant_image'] ?? '';
variantOptions = json['variant_options'] ?? {};
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['variantId'] = variantId;
data['variantPrice'] = variantPrice;
data['variantSku'] = variantSku;
data['variant_image'] = variantImage;
data['variant_options'] = variantOptions;
return data;
}
}

View File

@@ -0,0 +1,76 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class CashbackModel {
bool? allCustomer;
bool? allPayment;
double? cashbackAmount;
String? cashbackType;
List<String>? customerIds;
Timestamp? endDate;
String? id;
bool? isEnabled;
double? maximumDiscount;
double? minimumPurchaseAmount;
List<String>? paymentMethods;
int? redeemLimit;
Timestamp? startDate;
String? title;
double? cashbackValue;
CashbackModel({
this.allCustomer,
this.allPayment,
this.cashbackAmount,
this.cashbackValue,
this.cashbackType,
this.customerIds,
this.endDate,
this.id,
this.isEnabled,
this.maximumDiscount,
this.minimumPurchaseAmount,
this.paymentMethods,
this.redeemLimit,
this.startDate,
this.title,
});
factory CashbackModel.fromJson(Map<String, dynamic> json) {
return CashbackModel(
allCustomer: json['allCustomer'],
allPayment: json['allPayment'],
cashbackAmount: (json['cashbackAmount'] != null) ? double.tryParse(json['cashbackAmount'].toString()) : null,
cashbackValue: (json['cashbackValue'] != null) ? double.tryParse(json['cashbackValue'].toString()) : null,
cashbackType: json['cashbackType'] ?? '',
customerIds: json['customerIds'] != null ? List<String>.from(json['customerIds']) : null,
endDate: json['endDate'] is Timestamp ? json['endDate'] as Timestamp : null,
id: json['id'],
isEnabled: json['isEnabled'],
maximumDiscount: (json['maximumDiscount'] != null) ? double.tryParse(json['maximumDiscount'].toString()) : null,
minimumPurchaseAmount: (json['minumumPurchaseAmount'] != null) ? double.tryParse(json['minumumPurchaseAmount'].toString()) : null,
paymentMethods: json['paymentMethods'] != null ? List<String>.from(json['paymentMethods']) : null,
redeemLimit: int.parse("${json['redeemLimit'] ?? 0}"),
startDate: json['startDate'] is Timestamp ? json['startDate'] as Timestamp : null,
title: json['title'],
);
}
Map<String, dynamic> toJson() {
return {
'allCustomer': allCustomer,
'allPayment': allPayment,
'cashbackAmount': cashbackAmount,
if (cashbackValue != null) 'cashbackValue': cashbackValue,
'cashbackType': cashbackType,
'customerIds': customerIds,
'endDate': endDate,
'id': id,
'isEnabled': isEnabled,
'maximumDiscount': maximumDiscount,
'minumumPurchaseAmount': minimumPurchaseAmount,
'paymentMethods': paymentMethods,
'redeemLimit': redeemLimit,
'startDate': startDate,
'title': title,
};
}
}

View File

@@ -0,0 +1,37 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class CashbackRedeemModel {
final String? id;
final String? cashbackId;
final String? userId;
final String? orderId;
final Timestamp? createdAt;
CashbackRedeemModel({
this.id,
this.cashbackId,
this.userId,
this.orderId,
this.createdAt,
});
factory CashbackRedeemModel.fromJson(Map<String, dynamic> json) {
return CashbackRedeemModel(
id: json['id'],
cashbackId: json['cashbackId'],
userId: json['userId'],
orderId: json['orderId'],
createdAt: json['createdAt'] == null ? null : json['createdAt'] as Timestamp,
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'cashbackId': cashbackId,
'userId': userId,
'orderId': orderId,
'createdAt': createdAt,
};
}
}

View File

@@ -0,0 +1,24 @@
class CategoryModel {
String? id;
String? title;
String? image;
bool? publish;
CategoryModel({this.id, this.title, this.image, this.publish});
CategoryModel.fromJson(Map<String, dynamic> json) {
id = json['id'] ?? '';
title = json['title'] ?? '';
image = json['image'] ?? '';
publish = json['publish'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['title'] = title;
data['image'] = image;
data['publish'] = publish;
return data;
}
}

View File

@@ -0,0 +1,75 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class ConversationModel {
String? id;
String? senderId;
String? receiverId;
String? orderId;
String? message;
String? messageType;
String? videoThumbnail;
Url? url;
Timestamp? createdAt;
ConversationModel({
this.id,
this.senderId,
this.receiverId,
this.orderId,
this.message,
this.messageType,
this.videoThumbnail,
this.url,
this.createdAt,
});
factory ConversationModel.fromJson(Map<String, dynamic> parsedJson) {
return ConversationModel(
id: parsedJson['id'] ?? '',
senderId: parsedJson['senderId'] ?? '',
receiverId: parsedJson['receiverId'] ?? '',
orderId: parsedJson['orderId'] ?? '',
message: parsedJson['message'] ?? '',
messageType: parsedJson['messageType'] ?? '',
videoThumbnail: parsedJson['videoThumbnail'] ?? '',
url: parsedJson.containsKey('url')
? parsedJson['url'] != null
? Url.fromJson(parsedJson['url'])
: null
: Url(),
createdAt: parsedJson['createdAt'] ?? Timestamp.now(),
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'senderId': senderId,
'receiverId': receiverId,
'orderId': orderId,
'message': message,
'messageType': messageType,
'videoThumbnail': videoThumbnail,
'url': url?.toJson(),
'createdAt': createdAt,
};
}
}
class Url {
String mime;
String url;
String? videoThumbnail;
Url({this.mime = '', this.url = '', this.videoThumbnail});
factory Url.fromJson(Map<dynamic, dynamic> parsedJson) {
return Url(mime: parsedJson['mime'] ?? '', url: parsedJson['url'] ?? '', videoThumbnail: parsedJson['videoThumbnail'] ?? '');
}
Map<String, dynamic> toJson() {
return {'mime': mime, 'url': url, 'videoThumbnail': videoThumbnail};
}
}

View File

@@ -0,0 +1,50 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class CouponModel {
String? discountType;
String? id;
String? code;
String? discount;
String? image;
Timestamp? expiresAt;
Timestamp? createdAt;
String? description;
String? sectionId;
bool? isPublic;
String? vendorID;
bool? isEnabled;
CouponModel({this.discountType, this.id, this.code, this.discount, this.image, this.expiresAt, this.description, this.isPublic, this.vendorID, this.isEnabled,this.createdAt,this.sectionId});
CouponModel.fromJson(Map<String, dynamic> json) {
discountType = json['discountType'];
id = json['id'];
code = json['code'];
discount = json['discount'];
image = json['image'];
expiresAt = json['expiresAt'];
description = json['description'];
isPublic = json['isPublic'];
vendorID = json['vendorID'];
isEnabled = json['isEnabled'];
createdAt = json['createdAt'];
sectionId = json['section_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['discountType'] = discountType;
data['id'] = id;
data['code'] = code;
data['discount'] = discount;
data['image'] = image;
data['expiresAt'] = expiresAt;
data['description'] = description;
data['isPublic'] = isPublic;
data['vendorID'] = vendorID;
data['isEnabled'] = isEnabled;
data['createdAt'] = createdAt;
data['section_id'] = sectionId;
return data;
}
}

View File

@@ -0,0 +1,48 @@
class CurrencyModel {
String code;
int decimal;
String id;
bool isactive;
num rounding;
String name;
String symbol;
bool symbolatright;
CurrencyModel({
this.code = '',
this.decimal = 0,
this.isactive = false,
this.id = '',
this.name = '',
this.rounding = 0,
this.symbol = '',
this.symbolatright = false,
});
factory CurrencyModel.fromJson(Map<String, dynamic> parsedJson) {
return CurrencyModel(
code: parsedJson['code'] ?? '',
decimal: parsedJson['decimal_degits'] ?? 0,
isactive: parsedJson['isActive'] ?? '',
id: parsedJson['id'] ?? '',
name: parsedJson['name'] ?? '',
rounding: parsedJson['rounding'] ?? 0,
symbol: parsedJson['symbol'] ?? '',
symbolatright: parsedJson['symbolAtRight'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'code': code,
'decimal_degits': decimal,
'isActive': isactive,
'rounding': rounding,
'id': id,
'name': name,
'symbol': symbol,
'symbolAtRight': symbolatright,
};
}
}

View File

@@ -0,0 +1,93 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/models/vendor_model.dart';
class DineInBookingModel {
String? discount;
String? id;
String? guestPhone;
String? guestFirstName;
String? status;
UserModel? author;
String? guestEmail;
String? vendorID;
String? occasion;
String? authorID;
String? specialRequest;
Timestamp? date;
String? totalGuest;
VendorModel? vendor;
bool? firstVisit;
Timestamp? createdAt;
String? guestLastName;
String? discountType;
DineInBookingModel(
{this.discount,
this.id,
this.guestPhone,
this.guestFirstName,
this.status,
this.author,
this.guestEmail,
this.vendorID,
this.occasion,
this.authorID,
this.specialRequest,
this.date,
this.totalGuest,
this.vendor,
this.firstVisit,
this.createdAt,
this.guestLastName,
this.discountType});
DineInBookingModel.fromJson(Map<String, dynamic> json) {
print(json['id']);
discount = json['discount'];
id = json['id'];
guestPhone = json['guestPhone'];
guestFirstName = json['guestFirstName'];
status = json['status'];
author = json['author'] != null ? UserModel.fromJson(json['author']) : null;
guestEmail = json['guestEmail'];
vendorID = json['vendorID'];
occasion = json['occasion'];
authorID = json['authorID'];
specialRequest = json['specialRequest'];
date = json['date'];
totalGuest = json['totalGuest'].toString();
vendor = json['vendor'] != null ? VendorModel.fromJson(json['vendor']) : null;
firstVisit = json['firstVisit'];
createdAt = json['createdAt'];
guestLastName = json['guestLastName'];
discountType = json['discountType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['discount'] = discount;
data['id'] = id;
data['guestPhone'] = guestPhone;
data['guestFirstName'] = guestFirstName;
data['status'] = status;
if (author != null) {
data['author'] = author!.toJson();
}
data['guestEmail'] = guestEmail;
data['vendorID'] = vendorID;
data['occasion'] = occasion;
data['authorID'] = authorID;
data['specialRequest'] = specialRequest;
data['date'] = date;
data['totalGuest'] = totalGuest;
if (vendor != null) {
data['vendor'] = vendor!.toJson();
}
data['firstVisit'] = firstVisit;
data['createdAt'] = createdAt;
data['guestLastName'] = guestLastName;
data['discountType'] = discountType;
return data;
}
}

View File

@@ -0,0 +1,27 @@
class EmailTemplateModel {
String? id;
String? type;
String? message;
String? subject;
bool? isSendToAdmin;
EmailTemplateModel({this.subject, this.id, this.type, this.message, this.isSendToAdmin});
EmailTemplateModel.fromJson(Map<String, dynamic> json) {
subject = json['subject'];
id = json['id'];
type = json['type'];
message = json['message'];
isSendToAdmin = json['isSendToAdmin'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['subject'] = subject;
data['id'] = id;
data['type'] = type;
data['message'] = message;
data['isSendToAdmin'] = isSendToAdmin;
return data;
}
}

View File

@@ -0,0 +1,20 @@
class FavouriteOndemandServiceModel {
String? serviceAuthorId;
String? service_id;
String? user_id;
String? section_id;
FavouriteOndemandServiceModel({this.service_id, this.serviceAuthorId, this.user_id, this.section_id});
factory FavouriteOndemandServiceModel.fromJson(Map<String, dynamic> parsedJson) {
return FavouriteOndemandServiceModel(
serviceAuthorId: parsedJson["service_author_id"] ?? "",
section_id: parsedJson["section_id"] ?? "",
user_id: parsedJson["user_id"] ?? "",
service_id: parsedJson["service_id"] ?? "");
}
Map<String, dynamic> toJson() {
return {"service_author_id": serviceAuthorId, "section_id": section_id, "user_id": user_id, "service_id": service_id};
}
}

View File

@@ -0,0 +1,21 @@
class FavouriteItemModel {
String? storeId;
String? userId;
String? productId;
String? sectionId;
FavouriteItemModel({this.storeId, this.userId, this.productId, this.sectionId});
factory FavouriteItemModel.fromJson(Map<String, dynamic> parsedJson) {
return FavouriteItemModel(
storeId: parsedJson["store_id"] ?? "",
userId: parsedJson["user_id"] ?? "",
productId: parsedJson["product_id"] ?? "",
sectionId: parsedJson["section_id"] ?? "",
);
}
Map<String, dynamic> toJson() {
return {"store_id": storeId, "user_id": userId, "product_id": productId, "section_id": sectionId};
}
}

View File

@@ -0,0 +1,15 @@
class FavouriteModel {
String? restaurantId;
String? userId;
String? sectionId;
FavouriteModel({this.restaurantId, this.userId,this.sectionId});
factory FavouriteModel.fromJson(Map<String, dynamic> parsedJson) {
return FavouriteModel(restaurantId: parsedJson["store_id"] ?? "", userId: parsedJson["user_id"] ?? "",sectionId: parsedJson["section_id"] ?? "");
}
Map<String, dynamic> toJson() {
return {"store_id": restaurantId, "user_id": userId, "section_id": sectionId};
}
}

View File

@@ -0,0 +1,36 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class GiftCardsModel {
Timestamp? createdAt;
String? image;
String? expiryDay;
String? id;
String? message;
String? title;
bool? isEnable;
GiftCardsModel({this.createdAt, this.image, this.expiryDay, this.id, this.message, this.title, this.isEnable});
GiftCardsModel.fromJson(Map<String, dynamic> json) {
createdAt = json['createdAt'];
image = json['image'];
expiryDay = json['expiryDay'];
id = json['id'];
message = json['message'];
title = json['title'];
isEnable = json['isEnable'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['createdAt'] = createdAt;
data['image'] = image;
data['expiryDay'] = expiryDay;
data['id'] = id;
data['message'] = message;
data['title'] = title;
data['isEnable'] = isEnable;
return data;
}
}

View File

@@ -0,0 +1,52 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class GiftCardsOrderModel {
String? price;
Timestamp? expireDate;
Timestamp? createdDate;
String? message;
String? id;
String? giftId;
String? giftTitle;
String? giftCode;
String? giftPin;
bool? redeem;
String? paymentType;
String? userid;
bool? isPasswordShow;
GiftCardsOrderModel(
{this.price, this.id, this.expireDate, this.createdDate, this.giftTitle, this.message, this.giftId, this.giftCode, this.giftPin, this.redeem, this.paymentType, this.userid});
GiftCardsOrderModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
price = json['price'];
expireDate = json['expireDate'];
createdDate = json['createdDate'];
giftTitle = json['giftTitle'];
message = json['message'];
giftId = json['giftId'];
giftCode = json['giftCode'];
giftPin = json['giftPin'];
redeem = json['redeem'];
paymentType = json['paymentType'];
userid = json['userid'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['price'] = price;
data['expireDate'] = expireDate;
data['createdDate'] = createdDate;
data['message'] = message;
data['giftId'] = giftId;
data['giftTitle'] = giftTitle;
data['giftCode'] = giftCode;
data['giftPin'] = giftPin;
data['redeem'] = redeem;
data['paymentType'] = paymentType;
data['userid'] = userid;
return data;
}
}

View File

@@ -0,0 +1,61 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class InboxModel {
String? customerId;
String? customerName;
String? customerProfileImage;
String? lastMessage;
String? orderId;
String? restaurantId;
String? restaurantName;
String? restaurantProfileImage;
String? lastSenderId;
String? chatType;
Timestamp? createdAt;
InboxModel({
this.customerId,
this.customerName,
this.customerProfileImage,
this.lastMessage,
this.orderId,
this.restaurantId,
this.restaurantName,
this.restaurantProfileImage,
this.lastSenderId,
this.chatType,
this.createdAt,
});
factory InboxModel.fromJson(Map<String, dynamic> parsedJson) {
return InboxModel(
customerId: parsedJson['customerId'] ?? '',
customerName: parsedJson['customerName'] ?? '',
customerProfileImage: parsedJson['customerProfileImage'] ?? '',
lastMessage: parsedJson['lastMessage'],
orderId: parsedJson['orderId'],
restaurantId: parsedJson['restaurantId'] ?? '',
restaurantName: parsedJson['restaurantName'] ?? '',
lastSenderId: parsedJson['lastSenderId'] ?? '',
chatType: parsedJson['chatType'] ?? '',
restaurantProfileImage: parsedJson['restaurantProfileImage'] ?? '',
createdAt: parsedJson['createdAt'] ?? Timestamp.now(),
);
}
Map<String, dynamic> toJson() {
return {
'customerId': customerId,
'customerName': customerName,
'customerProfileImage': customerProfileImage,
'lastMessage': lastMessage,
'orderId': orderId,
'restaurantId': restaurantId,
'restaurantName': restaurantName,
'restaurantProfileImage': restaurantProfileImage,
'lastSenderId': lastSenderId,
'chatType': chatType,
'createdAt': createdAt,
};
}
}

View File

@@ -0,0 +1,27 @@
class LanguageModel {
bool? isActive;
String? slug;
String? title;
String? image;
bool? isRtl;
LanguageModel({this.isActive, this.slug, this.title, this.isRtl, this.image});
LanguageModel.fromJson(Map<String, dynamic> json) {
isActive = json['isActive'];
slug = json['slug'];
title = json['title'];
isRtl = json['is_rtl'];
image = json['image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['isActive'] = isActive;
data['slug'] = slug;
data['title'] = title;
data['is_rtl'] = isRtl;
data['image'] = image;
return data;
}
}

View File

@@ -0,0 +1,44 @@
class MailSettings {
String? emailSetting;
String? fromName;
String? host;
String? mailEncryptionType;
String? mailMethod;
String? password;
String? port;
String? userName;
MailSettings(
{this.emailSetting,
this.fromName,
this.host,
this.mailEncryptionType,
this.mailMethod,
this.password,
this.port,
this.userName});
MailSettings.fromJson(Map<String, dynamic> json) {
emailSetting = json['emailSetting'];
fromName = json['fromName'];
host = json['host'];
mailEncryptionType = json['mailEncryptionType'];
mailMethod = json['mailMethod'];
password = json['password'];
port = json['port'];
userName = json['userName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['emailSetting'] = emailSetting;
data['fromName'] = fromName;
data['host'] = host;
data['mailEncryptionType'] = mailEncryptionType;
data['mailMethod'] = mailMethod;
data['password'] = password;
data['port'] = port;
data['userName'] = userName;
return data;
}
}

View File

@@ -0,0 +1,26 @@
class NotificationModel {
String? subject;
String? id;
String? type;
String? message;
NotificationModel(
{ this.subject, this.id, this.type, this.message});
NotificationModel.fromJson(Map<String, dynamic> json) {
subject = json['subject'];
id = json['id'];
type = json['type'];
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['subject'] = subject;
data['id'] = id;
data['type'] = type;
data['message'] = message;
return data;
}
}

View File

@@ -0,0 +1,24 @@
class OnBoardingModel {
String? description;
String? id;
String? title;
String? image;
OnBoardingModel({this.description, this.id, this.title, this.image});
OnBoardingModel.fromJson(Map<String, dynamic> json) {
description = json['description'];
id = json['id'];
title = json['title'];
image = json['image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['description'] = description;
data['id'] = id;
data['title'] = title;
data['image'] = image;
return data;
}
}

View File

@@ -0,0 +1,145 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/provider_serivce_model.dart';
import 'package:customer/models/tax_model.dart';
import 'package:customer/models/user_model.dart';
class OnProviderOrderModel {
String authorID, payment_method;
UserModel author;
Timestamp createdAt;
String? sectionId;
ProviderServiceModel provider;
String status;
ShippingAddress? address;
String id;
List<TaxModel>? taxModel;
Timestamp? scheduleDateTime;
Timestamp? newScheduleDateTime;
Timestamp? startTime;
Timestamp? endTime;
String? notes;
String? discount;
String? discountType;
String? discountLabel;
String? couponCode;
double quantity;
String? reason;
String? otp;
String? adminCommission;
String? adminCommissionType;
String? extraCharges;
String? extraChargesDescription;
bool? paymentStatus;
bool? extraPaymentStatus;
String? workerId;
OnProviderOrderModel({
this.sectionId = '',
this.authorID = '',
this.payment_method = '',
author,
createdAt,
provider,
this.status = '',
this.address,
this.id = '',
this.taxModel,
scheduleDateTime,
this.newScheduleDateTime,
this.startTime,
this.endTime,
this.notes = '',
this.discount,
this.discountType,
this.discountLabel,
this.couponCode,
this.quantity = 0.0,
this.reason,
this.otp,
this.adminCommission,
this.adminCommissionType,
this.extraCharges = '',
this.extraChargesDescription = '',
this.paymentStatus,
this.extraPaymentStatus,
this.workerId,
}) : author = author ?? UserModel(),
createdAt = createdAt ?? Timestamp.now(),
provider = provider ?? ProviderServiceModel(),
scheduleDateTime = scheduleDateTime ?? Timestamp.now();
factory OnProviderOrderModel.fromJson(Map<String, dynamic> parsedJson) {
List<TaxModel>? taxList;
if (parsedJson['taxSetting'] != null) {
taxList = <TaxModel>[];
parsedJson['taxSetting'].forEach((v) {
taxList!.add(TaxModel.fromJson(v));
});
}
return OnProviderOrderModel(
author: parsedJson.containsKey('author') ? UserModel.fromJson(parsedJson['author']) : UserModel(),
authorID: parsedJson['authorID'] ?? '',
address: parsedJson.containsKey('address') ? ShippingAddress.fromJson(parsedJson['address']) : ShippingAddress(),
createdAt: parsedJson['createdAt'] ?? Timestamp.now(),
id: parsedJson['id'] ?? '',
payment_method: parsedJson['payment_method'] ?? '',
taxModel: taxList,
sectionId: parsedJson['sectionId'] ?? '',
status: parsedJson['status'] ?? '',
provider: parsedJson.containsKey('provider') ? ProviderServiceModel.fromJson(parsedJson['provider']) : ProviderServiceModel(),
notes: parsedJson['notes'] ?? "",
scheduleDateTime: parsedJson['scheduleDateTime'] ?? Timestamp.now(),
newScheduleDateTime: parsedJson['newScheduleDateTime'],
startTime: parsedJson['startTime'],
endTime: parsedJson['endTime'],
discount: parsedJson['discount'] ?? "0.0",
discountLabel: parsedJson['discountLabel'] ?? "0.0",
discountType: parsedJson['discountType'] ?? "",
couponCode: parsedJson['couponCode'] ?? "",
quantity: double.parse("${parsedJson['quantity'] ?? 0.0}"),
reason: parsedJson['reason'] ?? '',
otp: parsedJson['otp'] ?? '',
adminCommission: parsedJson['adminCommission'] ?? "",
adminCommissionType: parsedJson['adminCommissionType'] ?? "",
extraCharges: parsedJson["extraCharges"] ?? "0.0",
paymentStatus: parsedJson['paymentStatus'],
extraPaymentStatus: parsedJson['extraPaymentStatus'],
workerId: parsedJson['workerId'] ?? "",
extraChargesDescription: parsedJson['extraChargesDescription'] ?? "",
);
}
Map<String, dynamic> toJson() {
return {
'address': address?.toJson(),
'author': author.toJson(),
'authorID': authorID,
'payment_method': payment_method,
'createdAt': createdAt,
'id': id,
'status': status,
'provider': provider.toJson(),
'sectionId': sectionId,
"taxSetting": taxModel?.map((v) => v.toJson()).toList(),
"scheduleDateTime": scheduleDateTime,
"newScheduleDateTime": newScheduleDateTime,
"startTime": startTime,
"endTime": endTime,
"notes": notes,
'discount': discount,
"discountLabel": discountLabel,
"discountType": discountType,
"couponCode": couponCode,
'quantity': quantity,
'reason': reason,
'otp': otp,
"adminCommission": adminCommission,
"adminCommissionType": adminCommissionType,
'extraCharges': extraCharges,
'paymentStatus': paymentStatus,
'extraPaymentStatus': extraPaymentStatus,
'workerId': workerId,
'extraChargesDescription': extraChargesDescription,
};
}
}

180
lib/models/order_model.dart Normal file
View File

@@ -0,0 +1,180 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/tax_model.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/models/vendor_model.dart';
import 'cart_product_model.dart';
import 'cashback_model.dart';
class OrderModel {
ShippingAddress? address;
String? status;
String? couponId;
String? vendorID;
String? driverID;
num? discount;
String? authorID;
String? estimatedTimeToPrepare;
Timestamp? createdAt;
Timestamp? triggerDelivery;
List<TaxModel>? taxSetting;
String? paymentMethod;
List<CartProductModel>? products;
String? adminCommissionType;
VendorModel? vendor;
String? id;
String? adminCommission;
String? couponCode;
String? sectionId;
Map<String, dynamic>? specialDiscount;
String? deliveryCharge;
Timestamp? scheduleTime;
String? tipAmount;
String? notes;
UserModel? author;
UserModel? driver;
bool? takeAway;
List<dynamic>? rejectedByDrivers;
CashbackModel? cashback;
String? courierCompanyName;
String? courierTrackingId;
OrderModel({
this.address,
this.status,
this.couponId,
this.vendorID,
this.driverID,
this.discount,
this.authorID,
this.estimatedTimeToPrepare,
this.createdAt,
this.triggerDelivery,
this.taxSetting,
this.paymentMethod,
this.products,
this.adminCommissionType,
this.vendor,
this.id,
this.adminCommission,
this.couponCode,
this.sectionId,
this.specialDiscount,
this.deliveryCharge,
this.scheduleTime,
this.tipAmount,
this.notes,
this.author,
this.driver,
this.takeAway,
this.rejectedByDrivers,
this.cashback,
this.courierCompanyName,
this.courierTrackingId,
});
OrderModel.fromJson(Map<String, dynamic> json) {
address =
json['address'] != null
? ShippingAddress.fromJson(json['address'])
: null;
status = json['status'];
couponId = json['couponId'];
vendorID = json['vendorID'];
driverID = json['driverID'];
discount = json['discount'];
authorID = json['authorID'];
estimatedTimeToPrepare = json['estimatedTimeToPrepare'];
createdAt = json['createdAt'];
courierCompanyName = json['courierCompanyName'];
courierTrackingId = json['courierTrackingId'];
triggerDelivery = json['triggerDelevery'] ?? Timestamp.now();
if (json['taxSetting'] != null) {
taxSetting = <TaxModel>[];
json['taxSetting'].forEach((v) {
taxSetting!.add(TaxModel.fromJson(v));
});
}
paymentMethod = json['payment_method'];
if (json['products'] != null) {
products = <CartProductModel>[];
json['products'].forEach((v) {
products!.add(CartProductModel.fromJson(v));
});
}
adminCommissionType = json['adminCommissionType'];
vendor =
json['vendor'] != null ? VendorModel.fromJson(json['vendor']) : null;
id = json['id'];
adminCommission = json['adminCommission'];
couponCode = json['couponCode'];
sectionId = json['section_id'];
specialDiscount = json['specialDiscount'];
deliveryCharge =
json['deliveryCharge'].toString().isEmpty
? "0.0"
: json['deliveryCharge'] ?? '0.0';
scheduleTime = json['scheduleTime'];
tipAmount =
json['tip_amount'].toString().isEmpty
? "0.0"
: json['tip_amount'] ?? "0.0";
notes = json['notes'];
author = json['author'] != null ? UserModel.fromJson(json['author']) : null;
driver = json['driver'] != null ? UserModel.fromJson(json['driver']) : null;
takeAway = json['takeAway'];
rejectedByDrivers = json['rejectedByDrivers'] ?? [];
cashback =
json['cashback'] != null
? CashbackModel.fromJson(json['cashback'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (address != null) {
data['address'] = address!.toJson();
}
data['status'] = status;
data['couponId'] = couponId;
data['vendorID'] = vendorID;
data['driverID'] = driverID;
data['discount'] = discount;
data['authorID'] = authorID;
data['estimatedTimeToPrepare'] = estimatedTimeToPrepare;
data['createdAt'] = createdAt;
data['triggerDelivery'] = triggerDelivery;
if (taxSetting != null) {
data['taxSetting'] = taxSetting!.map((v) => v.toJson()).toList();
}
data['payment_method'] = paymentMethod;
if (products != null) {
data['products'] = products!.map((v) => v.toJson()).toList();
}
data['adminCommissionType'] = adminCommissionType;
if (vendor != null) {
data['vendor'] = vendor!.toJson();
}
data['id'] = id;
data['adminCommission'] = adminCommission;
data['couponCode'] = couponCode;
data['section_id'] = sectionId;
data['specialDiscount'] = specialDiscount;
data['deliveryCharge'] = deliveryCharge;
data['scheduleTime'] = scheduleTime;
data['tip_amount'] = tipAmount;
data['courierCompanyName'] = courierCompanyName;
data['courierTrackingId'] = courierTrackingId;
data['notes'] = notes;
if (author != null) {
data['author'] = author!.toJson();
}
if (driver != null) {
data['driver'] = driver!.toJson();
}
data['takeAway'] = takeAway;
data['rejectedByDrivers'] = rejectedByDrivers;
data['cashback'] = cashback?.toJson();
return data;
}
}

View File

@@ -0,0 +1,27 @@
class ParcelCategory {
String? image;
int? setOrder;
bool? publish;
String? id;
String? title;
ParcelCategory({this.image, this.setOrder, this.publish, this.id, this.title});
ParcelCategory.fromJson(Map<String, dynamic> json) {
image = json['image'];
setOrder = json['set_order'];
publish = json['publish'];
id = json['id'];
title = json['title'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['image'] = image;
data['set_order'] = setOrder;
data['publish'] = publish;
data['id'] = id;
data['title'] = title;
return data;
}
}

View File

@@ -0,0 +1,238 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/tax_model.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/models/vendor_model.dart';
class ParcelOrderModel {
UserModel? author;
UserModel? driver;
LocationInformation? sender;
Timestamp? senderPickupDateTime;
String? id;
String? driverId;
UserLocation? receiverLatLong;
bool? paymentCollectByReceiver;
List<TaxModel>? taxSetting;
String? adminCommissionType;
List<dynamic>? rejectedByDrivers;
String? adminCommission;
List<dynamic>? parcelImages;
String? parcelWeight;
String? discountType;
String? discountLabel;
LocationInformation? receiver;
String? paymentMethod;
String? distance;
Timestamp? createdAt;
bool? isSchedule;
String? subTotal;
Timestamp? triggerDelevery;
String? status;
String? parcelType;
bool? sendToDriver;
String? sectionId;
UserLocation? senderLatLong;
String? authorID;
String? parcelWeightCharge;
String? parcelCategoryID;
String? discount;
Timestamp? receiverPickupDateTime;
String? note;
String? receiverNote;
String? senderZoneId;
String? receiverZoneId;
G? sourcePoint;
G? destinationPoint;
List<ParcelStatus>? statusHistory;
ParcelOrderModel({
this.author,
this.sender,
this.senderPickupDateTime,
this.id,
this.driverId,
this.receiverLatLong,
this.paymentCollectByReceiver,
this.taxSetting,
this.adminCommissionType,
this.rejectedByDrivers,
this.adminCommission,
this.parcelImages,
this.parcelWeight,
this.discountType,
this.discountLabel,
this.receiver,
this.paymentMethod,
this.distance,
this.createdAt,
this.isSchedule,
this.subTotal,
this.triggerDelevery,
this.status,
this.parcelType,
this.sendToDriver,
this.sectionId,
this.senderLatLong,
this.authorID,
this.parcelWeightCharge,
this.parcelCategoryID,
this.discount,
this.receiverPickupDateTime,
this.note,
this.receiverNote,
this.senderZoneId,
this.sourcePoint,
this.destinationPoint,
this.receiverZoneId,
this.driver,
this.statusHistory,
});
ParcelOrderModel.fromJson(Map<String, dynamic> json) {
author = json['author'] != null ? UserModel.fromJson(json['author']) : null;
driver = json['driver'] != null ? UserModel.fromJson(json['driver']) : null;
sender = json['sender'] != null ? LocationInformation.fromJson(json['sender']) : null;
senderPickupDateTime = json['senderPickupDateTime'];
id = json['id'];
driverId = json['driverId'];
receiverLatLong = json['receiverLatLong'] != null ? UserLocation.fromJson(json['receiverLatLong']) : null;
paymentCollectByReceiver = json['paymentCollectByReceiver'];
if (json['taxSetting'] != null) {
taxSetting = <TaxModel>[];
json['taxSetting'].forEach((v) {
taxSetting!.add(TaxModel.fromJson(v));
});
}
adminCommissionType = json['adminCommissionType'];
rejectedByDrivers = json['rejectedByDrivers'] ?? [];
adminCommission = json['adminCommission'];
parcelImages = json['parcelImages'] ?? [];
parcelWeight = json['parcelWeight'];
discountType = json['discountType'];
discountLabel = json['discountLabel'];
receiver = json['receiver'] != null ? LocationInformation.fromJson(json['receiver']) : null;
paymentMethod = json['payment_method'];
distance = json['distance'];
createdAt = json['createdAt'];
isSchedule = json['isSchedule'];
subTotal = json['subTotal'];
triggerDelevery = json['trigger_delevery'];
status = json['status'];
parcelType = json['parcelType'];
sendToDriver = json['sendToDriver'];
sectionId = json['sectionId'];
senderLatLong = json['senderLatLong'] != null ? UserLocation.fromJson(json['senderLatLong']) : null;
authorID = json['authorID'];
parcelWeightCharge = json['parcelWeightCharge'];
parcelCategoryID = json['parcelCategoryID'];
discount = json['discount'];
receiverPickupDateTime = json['receiverPickupDateTime'];
note = json['note'];
senderZoneId = json['senderZoneId'];
receiverZoneId = json['receiverZoneId'];
receiverNote = json['receiverNote'];
sourcePoint = json['sourcePoint'] != null ? G.fromJson(json['sourcePoint']) : null;
destinationPoint = json['destinationPoint'] != null ? G.fromJson(json['destinationPoint']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (author != null) {
data['author'] = author!.toJson();
} if (driver != null) {
data['driver'] = driver!.toJson();
}
if (sender != null) {
data['sender'] = sender!.toJson();
}
data['senderPickupDateTime'] = senderPickupDateTime;
data['id'] = id;
if (receiverLatLong != null) {
data['receiverLatLong'] = receiverLatLong!.toJson();
}
data['paymentCollectByReceiver'] = paymentCollectByReceiver;
if (taxSetting != null) {
data['taxSetting'] = taxSetting!.map((v) => v.toJson()).toList();
}
data['driverId'] = driverId;
data['adminCommissionType'] = adminCommissionType;
data['rejectedByDrivers'] = rejectedByDrivers;
data['adminCommission'] = adminCommission;
data['parcelImages'] = parcelImages;
data['parcelWeight'] = parcelWeight;
data['discountType'] = discountType;
data['discountLabel'] = discountLabel;
if (receiver != null) {
data['receiver'] = receiver!.toJson();
}
data['payment_method'] = paymentMethod;
data['distance'] = distance;
data['createdAt'] = createdAt;
data['isSchedule'] = isSchedule;
data['subTotal'] = subTotal;
data['trigger_delevery'] = triggerDelevery;
data['status'] = status;
data['parcelType'] = parcelType;
data['sendToDriver'] = sendToDriver;
data['sectionId'] = sectionId;
if (senderLatLong != null) {
data['senderLatLong'] = senderLatLong!.toJson();
}
if (sourcePoint != null) {
data['sourcePoint'] = sourcePoint!.toJson();
}
if (destinationPoint != null) {
data['destinationPoint'] = destinationPoint!.toJson();
}
data['authorID'] = authorID;
data['parcelWeightCharge'] = parcelWeightCharge;
data['parcelCategoryID'] = parcelCategoryID;
data['discount'] = discount;
data['receiverPickupDateTime'] = receiverPickupDateTime;
data['note'] = note;
data['senderZoneId'] = senderZoneId;
data['receiverZoneId'] = receiverZoneId;
data['receiverNote'] = receiverNote;
return data;
}
}
class LocationInformation {
String? address;
String? name;
String? phone;
LocationInformation({this.address, this.name, this.phone});
LocationInformation.fromJson(Map<String, dynamic> json) {
address = json['address'];
name = json['name'];
phone = json['phone'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['address'] = address;
data['name'] = name;
data['phone'] = phone;
return data;
}
}
class ParcelStatus {
final String? status;
final DateTime? time;
ParcelStatus({this.status, this.time});
factory ParcelStatus.fromMap(Map<String, dynamic> map) {
return ParcelStatus(status: map['status'] as String?, time: map['time'] != null ? (map['time'] as Timestamp).toDate() : null);
}
Map<String, dynamic> toMap() {
return {'status': status, 'time': time != null ? Timestamp.fromDate(time!) : null};
}
}

View File

@@ -0,0 +1,21 @@
class ParcelWeightModel {
String? deliveryCharge;
String? id;
String? title;
ParcelWeightModel({this.deliveryCharge, this.id, this.title});
ParcelWeightModel.fromJson(Map<String, dynamic> json) {
deliveryCharge = json['delivery_charge'];
id = json['id'];
title = json['title'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['delivery_charge'] = deliveryCharge;
data['id'] = id;
data['title'] = title;
return data;
}
}

View File

@@ -0,0 +1,15 @@
class CodSettingModel {
bool? isEnabled;
CodSettingModel({this.isEnabled});
CodSettingModel.fromJson(Map<String, dynamic> json) {
isEnabled = json['isEnabled'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['isEnabled'] = isEnabled;
return data;
}
}

View File

@@ -0,0 +1,30 @@
class FlutterWaveModel {
bool? isSandbox;
bool? isWithdrawEnabled;
String? publicKey;
String? encryptionKey;
bool? isEnable;
String? secretKey;
FlutterWaveModel({this.isSandbox, this.isWithdrawEnabled, this.publicKey, this.encryptionKey, this.isEnable, this.secretKey});
FlutterWaveModel.fromJson(Map<String, dynamic> json) {
isSandbox = json['isSandbox'];
isWithdrawEnabled = json['isWithdrawEnabled'];
publicKey = json['publicKey'];
encryptionKey = json['encryptionKey'];
isEnable = json['isEnable'];
secretKey = json['secretKey'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['isSandbox'] = isSandbox;
data['isWithdrawEnabled'] = isWithdrawEnabled;
data['publicKey'] = publicKey;
data['encryptionKey'] = encryptionKey;
data['isEnable'] = isEnable;
data['secretKey'] = secretKey;
return data;
}
}

View File

@@ -0,0 +1,24 @@
class MercadoPagoModel {
bool? isSandboxEnabled;
bool? isEnabled;
String? accessToken;
String? publicKey;
MercadoPagoModel({this.isSandboxEnabled, this.isEnabled, this.accessToken, this.publicKey});
MercadoPagoModel.fromJson(Map<String, dynamic> json) {
isSandboxEnabled = json['isSandboxEnabled'];
isEnabled = json['isEnabled'];
accessToken = json['AccessToken'];
publicKey = json['PublicKey'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['isSandboxEnabled'] = isSandboxEnabled;
data['isEnabled'] = isEnabled;
data['AccessToken'] = accessToken;
data['PublicKey'] = publicKey;
return data;
}
}

View File

@@ -0,0 +1,34 @@
class MidTrans {
bool? enable;
String? name;
bool? isSandbox;
String? serverKey;
String? image;
MidTrans({
this.name,
this.enable,
this.serverKey,
this.isSandbox,
this.image,
});
MidTrans.fromJson(Map<String, dynamic> json) {
enable = json['enable'];
name = json['name'];
isSandbox = json['isSandbox'];
serverKey = json['serverKey'];
image = json['image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['enable'] = enable;
data['name'] = name;
data['isSandbox'] = isSandbox;
data['serverKey'] = serverKey;
data['image'] = image;
return data;
}
}

View File

@@ -0,0 +1,60 @@
class OrangeMoney {
String? image;
String? clientId;
String? auth;
bool? enable;
String? name;
String? notifyUrl;
String? clientSecret;
bool? isSandbox;
String? returnUrl;
String? merchantKey;
String? cancelUrl;
String? notifUrl;
OrangeMoney(
{this.image,
this.clientId,
this.auth,
this.enable,
this.name,
this.notifyUrl,
this.clientSecret,
this.isSandbox,
this.returnUrl,
this.cancelUrl,
this.notifUrl,
this.merchantKey});
OrangeMoney.fromJson(Map<String, dynamic> json) {
image = json['image'];
clientId = json['clientId'];
auth = json['auth'];
enable = json['enable'];
name = json['name'];
notifyUrl = json['notifyUrl'];
clientSecret = json['clientSecret'];
isSandbox = json['isSandbox'];
returnUrl = json['returnUrl'];
merchantKey = json['merchantKey'];
cancelUrl = json['cancelUrl'];
notifUrl = json['notifUrl'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['image'] = image;
data['clientId'] = clientId;
data['auth'] = auth;
data['enable'] = enable;
data['name'] = name;
data['notifyUrl'] = notifyUrl;
data['clientSecret'] = clientSecret;
data['isSandbox'] = isSandbox;
data['returnUrl'] = returnUrl;
data['merchantKey'] = merchantKey;
data['cancelUrl'] = cancelUrl;
data['notifUrl'] = notifUrl;
return data;
}
}

View File

@@ -0,0 +1,33 @@
class PayFastModel {
String? returnUrl;
String? cancelUrl;
String? notifyUrl;
String? merchantKey;
bool? isEnable;
String? merchantId;
bool? isSandbox;
PayFastModel({this.returnUrl, this.cancelUrl, this.notifyUrl, this.merchantKey, this.isEnable, this.merchantId, this.isSandbox});
PayFastModel.fromJson(Map<String, dynamic> json) {
returnUrl = json['return_url'];
cancelUrl = json['cancel_url'];
notifyUrl = json['notify_url'];
merchantKey = json['merchant_key'];
isEnable = json['isEnable'];
merchantId = json['merchant_id'];
isSandbox = json['isSandbox'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['return_url'] = returnUrl;
data['cancel_url'] = cancelUrl;
data['notify_url'] = notifyUrl;
data['merchant_key'] = merchantKey;
data['isEnable'] = isEnable;
data['merchant_id'] = merchantId;
data['isSandbox'] = isSandbox;
return data;
}
}

View File

@@ -0,0 +1,30 @@
class PayStackModel {
bool? isSandbox;
String? callbackURL;
String? publicKey;
String? secretKey;
bool? isEnable;
String? webhookURL;
PayStackModel({this.isSandbox, this.callbackURL, this.publicKey, this.secretKey, this.isEnable, this.webhookURL});
PayStackModel.fromJson(Map<String, dynamic> json) {
isSandbox = json['isSandbox'];
callbackURL = json['callbackURL'];
publicKey = json['publicKey'];
secretKey = json['secretKey'];
isEnable = json['isEnable'];
webhookURL = json['webhookURL'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['isSandbox'] = isSandbox;
data['callbackURL'] = callbackURL;
data['publicKey'] = publicKey;
data['secretKey'] = secretKey;
data['isEnable'] = isEnable;
data['webhookURL'] = webhookURL;
return data;
}
}

View File

@@ -0,0 +1,30 @@
class PayPalModel {
String? paypalSecret;
bool? isWithdrawEnabled;
String? paypalAppId;
bool? isEnabled;
bool? isLive;
String? paypalClient;
PayPalModel({this.paypalSecret, this.isWithdrawEnabled, this.paypalAppId, this.isEnabled, this.isLive, this.paypalClient});
PayPalModel.fromJson(Map<String, dynamic> json) {
paypalSecret = json['paypalSecret'];
isWithdrawEnabled = json['isWithdrawEnabled'];
paypalAppId = json['paypalAppId'];
isEnabled = json['isEnabled'];
isLive = json['isLive'];
paypalClient = json['paypalClient'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['paypalSecret'] = paypalSecret;
data['isWithdrawEnabled'] = isWithdrawEnabled;
data['paypalAppId'] = paypalAppId;
data['isEnabled'] = isEnabled;
data['isLive'] = isLive;
data['paypalClient'] = paypalClient;
return data;
}
}

View File

@@ -0,0 +1,24 @@
class PaytmModel {
String? paytmMID;
String? pAYTMMERCHANTKEY;
bool? isEnabled;
bool? isSandboxEnabled;
PaytmModel({this.paytmMID, this.pAYTMMERCHANTKEY, this.isEnabled, this.isSandboxEnabled});
PaytmModel.fromJson(Map<String, dynamic> json) {
paytmMID = json['PaytmMID'];
pAYTMMERCHANTKEY = json['PAYTM_MERCHANT_KEY'];
isEnabled = json['isEnabled'];
isSandboxEnabled = json['isSandboxEnabled'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['PaytmMID'] = paytmMID;
data['PAYTM_MERCHANT_KEY'] = pAYTMMERCHANTKEY;
data['isEnabled'] = isEnabled;
data['isSandboxEnabled'] = isSandboxEnabled;
return data;
}
}

View File

@@ -0,0 +1,27 @@
class RazorPayModel {
String? razorpaySecret;
bool? isWithdrawEnabled;
bool? isSandboxEnabled;
bool? isEnabled;
String? razorpayKey;
RazorPayModel({this.razorpaySecret, this.isWithdrawEnabled, this.isSandboxEnabled, this.isEnabled, this.razorpayKey});
RazorPayModel.fromJson(Map<String, dynamic> json) {
razorpaySecret = json['razorpaySecret'];
isWithdrawEnabled = json['isWithdrawEnabled'];
isSandboxEnabled = json['isSandboxEnabled'];
isEnabled = json['isEnabled'];
razorpayKey = json['razorpayKey'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['razorpaySecret'] = razorpaySecret;
data['isWithdrawEnabled'] = isWithdrawEnabled;
data['isSandboxEnabled'] = isSandboxEnabled;
data['isEnabled'] = isEnabled;
data['razorpayKey'] = razorpayKey;
return data;
}
}

View File

@@ -0,0 +1,30 @@
class StripeModel {
String? stripeSecret;
String? clientpublishableKey;
bool? isWithdrawEnabled;
bool? isEnabled;
bool? isSandboxEnabled;
String? stripeKey;
StripeModel({this.stripeSecret, this.clientpublishableKey, this.isWithdrawEnabled, this.isEnabled, this.isSandboxEnabled, this.stripeKey});
StripeModel.fromJson(Map<String, dynamic> json) {
stripeSecret = json['stripeSecret'];
clientpublishableKey = json['clientpublishableKey'];
isWithdrawEnabled = json['isWithdrawEnabled'];
isEnabled = json['isEnabled'];
isSandboxEnabled = json['isSandboxEnabled'];
stripeKey = json['stripeKey'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['stripeSecret'] = stripeSecret;
data['clientpublishableKey'] = clientpublishableKey;
data['isWithdrawEnabled'] = isWithdrawEnabled;
data['isEnabled'] = isEnabled;
data['isSandboxEnabled'] = isSandboxEnabled;
data['stripeKey'] = stripeKey;
return data;
}
}

View File

@@ -0,0 +1,15 @@
class WalletSettingModel {
bool? isEnabled;
WalletSettingModel({this.isEnabled});
WalletSettingModel.fromJson(Map<String, dynamic> json) {
isEnabled = json['isEnabled'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['isEnabled'] = isEnabled;
return data;
}
}

View File

@@ -0,0 +1,34 @@
class Xendit {
bool? enable;
String? name;
bool? isSandbox;
String? apiKey;
String? image;
Xendit({
this.name,
this.enable,
this.apiKey,
this.isSandbox,
this.image,
});
Xendit.fromJson(Map<String, dynamic> json) {
enable = json['enable'];
name = json['name'];
isSandbox = json['isSandbox'];
apiKey = json['apiKey'];
image = json['image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['enable'] = enable;
data['name'] = name;
data['isSandbox'] = isSandbox;
data['apiKey'] = apiKey;
data['image'] = image;
return data;
}
}

View File

@@ -0,0 +1,28 @@
class PopularDestination {
String? image;
String? id;
String? title;
double? latitude;
double? longitude;
PopularDestination(
{this.image, this.id, this.title, this.latitude, this.longitude});
PopularDestination.fromJson(Map<String, dynamic> json) {
image = json['image'];
id = json['id'];
title = json['title'];
latitude = json['latitude'];
longitude = json['longitude'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['image'] = image;
data['id'] = id;
data['title'] = title;
data['latitude'] = latitude;
data['longitude'] = longitude;
return data;
}
}

View File

@@ -0,0 +1,243 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class ProductModel {
int? fats;
String? vendorID;
bool? veg;
bool? publish;
List<dynamic>? addOnsTitle;
int? calories;
int? proteins;
List<dynamic>? addOnsPrice;
num? reviewsSum;
bool? takeawayOption;
String? name;
Map<String, dynamic>? reviewAttributes;
Map<String, dynamic>? productSpecification;
ItemAttribute? itemAttribute;
String? id;
int? quantity;
int? grams;
num? reviewsCount;
String? disPrice;
List<dynamic>? photos;
bool? nonveg;
String? photo;
String? price;
String? categoryID;
String? description;
Timestamp? createdAt;
String? sectionId;
String? brandId;
bool? isDigitalProduct;
String? digitalProduct;
ProductModel({
this.fats,
this.vendorID,
this.veg,
this.publish,
this.addOnsTitle,
this.calories,
this.proteins,
this.addOnsPrice,
this.reviewsSum,
this.takeawayOption,
this.name,
this.reviewAttributes,
this.productSpecification,
this.itemAttribute,
this.id,
this.quantity,
this.grams,
this.reviewsCount,
this.disPrice,
this.photos,
this.nonveg,
this.photo,
this.price,
this.categoryID,
this.description,
this.createdAt,
this.sectionId,
this.brandId,
this.isDigitalProduct,
this.digitalProduct,
});
ProductModel.fromJson(Map<String, dynamic> json) {
fats = json['fats'];
vendorID = json['vendorID'];
veg = json['veg'];
publish = json['publish'];
addOnsTitle = json['addOnsTitle'];
calories = json['calories'];
proteins = json['proteins'];
addOnsPrice = json['addOnsPrice'];
reviewsSum = json['reviewsSum'] ?? 0.0;
takeawayOption = json['takeawayOption'];
name = json['name'];
reviewAttributes = json['reviewAttributes'];
productSpecification = json['product_specification'];
itemAttribute = json['item_attribute'] != null ? ItemAttribute.fromJson(json['item_attribute']) : null;
id = json['id'];
quantity = json['quantity'];
grams = json['grams'];
reviewsCount = json['reviewsCount'] ?? 0.0;
disPrice = json['disPrice'] ?? "0";
photos = json['photos'] ?? [];
nonveg = json['nonveg'];
photo = json['photo'];
price = json['price'];
categoryID = json['categoryID'];
description = json['description'];
createdAt = json['createdAt'];
sectionId = json['section_id'];
brandId = json['brandID'];
isDigitalProduct = json['isDigitalProduct'];
digitalProduct = json['digitalProduct'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['fats'] = fats;
data['vendorID'] = vendorID;
data['veg'] = veg;
data['publish'] = publish;
data['addOnsTitle'] = addOnsTitle;
data['addOnsPrice'] = addOnsPrice;
data['calories'] = calories;
data['proteins'] = proteins;
data['reviewsSum'] = reviewsSum;
data['takeawayOption'] = takeawayOption;
data['name'] = name;
data['reviewAttributes'] = reviewAttributes;
data['product_specification'] = productSpecification;
if (itemAttribute != null) {
data['item_attribute'] = itemAttribute!.toJson();
}
data['id'] = id;
data['quantity'] = quantity;
data['grams'] = grams;
data['reviewsCount'] = reviewsCount;
data['disPrice'] = disPrice;
data['photos'] = photos;
data['nonveg'] = nonveg;
data['photo'] = photo;
data['price'] = price;
data['categoryID'] = categoryID;
data['description'] = description;
data['createdAt'] = createdAt;
data['section_id'] = sectionId;
data['brandID'] = brandId;
data['isDigitalProduct'] = isDigitalProduct;
data['digitalProduct'] = digitalProduct;
return data;
}
}
class ItemAttribute {
List<Attributes>? attributes;
List<Variants>? variants;
ItemAttribute({this.attributes, this.variants});
ItemAttribute.fromJson(Map<String, dynamic> json) {
if (json['attributes'] != null) {
attributes = <Attributes>[];
json['attributes'].forEach((v) {
attributes!.add(Attributes.fromJson(v));
});
}
if (json['variants'] != null) {
variants = <Variants>[];
json['variants'].forEach((v) {
variants!.add(Variants.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (attributes != null) {
data['attributes'] = attributes!.map((v) => v.toJson()).toList();
}
if (variants != null) {
data['variants'] = variants!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Attributes {
String? attributeId;
List<String>? attributeOptions;
Attributes({this.attributeId, this.attributeOptions});
Attributes.fromJson(Map<String, dynamic> json) {
attributeId = json['attribute_id'];
attributeOptions = json['attribute_options'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['attribute_id'] = attributeId;
data['attribute_options'] = attributeOptions;
return data;
}
}
class Variants {
String? variantId;
String? variantImage;
String? variantPrice;
String? variantQuantity;
String? variantSku;
Variants({
this.variantId,
this.variantImage,
this.variantPrice,
this.variantQuantity,
this.variantSku,
});
Variants.fromJson(Map<String, dynamic> json) {
variantId = json['variant_id'];
variantImage = json['variant_image'];
variantPrice = json['variant_price'] ?? '0';
variantQuantity = json['variant_quantity'] ?? '0';
variantSku = json['variant_sku'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['variant_id'] = variantId;
data['variant_image'] = variantImage;
data['variant_price'] = variantPrice;
data['variant_quantity'] = variantQuantity;
data['variant_sku'] = variantSku;
return data;
}
}
class ReviewsAttribute {
num? reviewsCount;
num? reviewsSum;
ReviewsAttribute({this.reviewsCount, this.reviewsSum});
ReviewsAttribute.fromJson(Map<String, dynamic> json) {
reviewsCount = json['reviewsCount'] ?? 0;
reviewsSum = json['reviewsSum'] ?? 0;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['reviewsCount'] = reviewsCount;
data['reviewsSum'] = reviewsSum;
return data;
}
}

View File

@@ -0,0 +1,190 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/subscription_plan_model.dart';
class ProviderServiceModel {
String? author;
String? authorName;
String? authorProfilePic;
String? sectionId;
String? subCategoryId;
String? categoryId;
Timestamp? createdAt;
String? description;
String? id;
double? latitude;
double? longitude;
List<dynamic> photos;
String? address;
num? reviewsCount;
num? reviewsSum;
String? title;
GeoFireData geoFireData;
String? price;
String? disPrice = "0";
bool? publish;
String? startTime;
String? endTime;
String? priceUnit;
List<dynamic> days;
String? phoneNumber;
String? subscriptionPlanId;
Timestamp? subscriptionExpiryDate;
SubscriptionPlanModel? subscriptionPlan;
String? subscriptionTotalOrders;
ProviderServiceModel({
this.author = '',
this.authorName = '',
this.authorProfilePic = '',
this.sectionId = '',
this.subCategoryId = '',
this.categoryId = '',
this.createdAt,
this.description = '',
this.id = '',
this.latitude = 0.1,
this.longitude = 0.1,
this.address = '',
this.reviewsCount = 0,
this.reviewsSum = 0,
this.title = '',
this.price = '',
this.disPrice,
geoFireData,
DeliveryCharge,
this.photos = const [],
this.publish = true,
this.startTime,
this.endTime,
this.priceUnit,
this.subscriptionPlanId,
this.subscriptionExpiryDate,
this.subscriptionPlan,
this.days = const [],
this.phoneNumber,
this.subscriptionTotalOrders,
}) : geoFireData = geoFireData ??
GeoFireData(
geohash: "",
geoPoint: GeoPoint(0.0, 0.0),
);
factory ProviderServiceModel.fromJson(Map<String, dynamic> parsedJson) {
return ProviderServiceModel(
author: parsedJson['author'] ?? '',
authorName: parsedJson['authorName'] ?? '',
authorProfilePic: parsedJson['authorProfilePic'] ?? '',
sectionId: parsedJson['sectionId'] ?? '',
categoryId: parsedJson['categoryId'] ?? '',
subCategoryId: parsedJson['subCategoryId'] ?? '',
price: parsedJson['price'] ?? '',
disPrice: parsedJson['disPrice'] ?? '0',
createdAt: parsedJson['createdAt'] ?? Timestamp.now(),
geoFireData: parsedJson.containsKey('g')
? GeoFireData.fromJson(parsedJson['g'])
: GeoFireData(
geohash: "",
geoPoint: GeoPoint(0.0, 0.0),
),
description: parsedJson['description'] ?? '',
id: parsedJson['id'] ?? '',
latitude: parsedJson['latitude'] ?? 0.1,
longitude: parsedJson['longitude'] ?? 0.1,
photos: parsedJson['photos'] ?? [],
address: parsedJson['address'] ?? '',
reviewsCount: parsedJson['reviewsCount'] ?? 0,
reviewsSum: parsedJson['reviewsSum'] ?? 0,
title: parsedJson['title'] ?? '',
publish: parsedJson['publish'] ?? true,
startTime: parsedJson['startTime'],
endTime: parsedJson['endTime'],
priceUnit: parsedJson['priceUnit'],
days: parsedJson['days'] ?? [],
phoneNumber: parsedJson['phoneNumber'],
subscriptionPlanId: parsedJson['subscriptionPlanId'],
subscriptionExpiryDate: parsedJson['subscriptionExpiryDate'],
subscriptionTotalOrders: parsedJson['subscriptionTotalOrders'],
subscriptionPlan: parsedJson['subscription_plan'] != null ? SubscriptionPlanModel.fromJson(parsedJson['subscription_plan']) : null,
);
}
Map<String, dynamic> toJson() {
photos.toList().removeWhere((element) => element == null);
Map<String, dynamic> json = {
'author': author,
'authorName': authorName,
'sectionId': sectionId,
'price': price,
'disPrice': disPrice,
'authorProfilePic': authorProfilePic,
'subCategoryId': subCategoryId,
'categoryId': categoryId,
'createdAt': createdAt,
"g": geoFireData.toJson(),
'description': description,
'id': id,
'latitude': latitude,
'longitude': longitude,
'photos': photos,
'address': address,
'reviewsCount': reviewsCount,
'reviewsSum': reviewsSum,
'title': title,
'publish': publish,
'startTime': startTime,
'endTime': endTime,
'priceUnit': priceUnit,
'days': days,
'phoneNumber': phoneNumber,
'subscriptionPlanId': subscriptionPlanId,
'subscriptionExpiryDate': subscriptionExpiryDate,
'subscriptionTotalOrders': subscriptionTotalOrders,
'subscription_plan': subscriptionPlan?.toJson(),
};
return json;
}
}
class GeoFireData {
String? geohash;
GeoPoint? geoPoint;
GeoFireData({this.geohash, this.geoPoint});
factory GeoFireData.fromJson(Map<dynamic, dynamic> parsedJson) {
return GeoFireData(
geohash: parsedJson['geohash'] ?? '',
geoPoint: parsedJson['geopoint'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'geohash': geohash,
'geopoint': geoPoint,
};
}
}
class GeoPointClass {
double latitude;
double longitude;
GeoPointClass({this.latitude = 0.01, this.longitude = 0.01});
factory GeoPointClass.fromJson(Map<dynamic, dynamic> parsedJson) {
return GeoPointClass(
latitude: parsedJson['latitude'] ?? 0.01,
longitude: parsedJson['longitude'] ?? 0.01,
);
}
Map<String, dynamic> toJson() {
return {
'latitude': latitude,
'longitude': longitude,
};
}
}

View File

@@ -0,0 +1,68 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class RatingModel {
String? id;
double? rating;
List<dynamic>? photos;
String? comment;
String? orderId;
String? customerId;
String? vendorId;
String? productId;
String? driverId;
String? uname;
String? profile;
Map<String, dynamic>? reviewAttributes;
Timestamp? createdAt;
RatingModel({
this.id,
this.comment,
this.photos,
this.rating,
this.orderId,
this.vendorId,
this.productId,
this.driverId,
this.customerId,
this.uname,
this.createdAt,
this.reviewAttributes,
this.profile,
});
factory RatingModel.fromJson(Map<String, dynamic> parsedJson) {
return RatingModel(
comment: parsedJson['comment'],
photos: parsedJson['photos'] ?? [],
rating: double.parse(parsedJson['rating'].toString()),
id: parsedJson['Id'],
orderId: parsedJson['orderid'],
vendorId: parsedJson['VendorId'],
productId: parsedJson['productId'],
driverId: parsedJson['driverId'],
customerId: parsedJson['CustomerId'],
uname: parsedJson['uname'],
reviewAttributes: parsedJson['reviewAttributes'] ?? {},
createdAt: parsedJson['createdAt'] ?? Timestamp.now(),
profile: parsedJson['profile']);
}
Map<String, dynamic> toJson() {
return {
'comment': comment,
'photos': photos,
'rating': rating,
'Id': id,
'orderid': orderId,
'VendorId': vendorId,
'productId': productId,
'driverId': driverId,
'CustomerId': customerId,
'uname': uname,
'profile': profile,
'reviewAttributes': reviewAttributes ?? {},
'createdAt': createdAt
};
}
}

View File

@@ -0,0 +1,21 @@
class ReferralModel {
String? id;
String? referralCode;
String? referralBy;
ReferralModel({this.id,this.referralCode, this.referralBy});
ReferralModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
referralCode = json['referralCode'];
referralBy = json['referralBy'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['referralCode'] = referralCode;
data['referralBy'] = referralBy;
return data;
}
}

View File

@@ -0,0 +1,194 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/rental_package_model.dart';
import 'package:customer/models/rental_vehicle_type.dart';
import 'package:customer/models/tax_model.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/models/vendor_model.dart';
class RentalOrderModel {
String? status;
List<dynamic>? rejectedByDrivers;
String? couponId;
Timestamp? bookingDateTime;
bool? paymentStatus;
String? discount;
String? authorID;
Timestamp? createdAt;
String? adminCommissionType;
String? sourceLocationName;
List<TaxModel>? taxSetting;
String? id;
String? adminCommission;
String? couponCode;
String? sectionId;
String? tipAmount;
String? vehicleId;
String? paymentMethod;
RentalVehicleType? rentalVehicleType;
RentalPackageModel? rentalPackageModel;
String? otpCode;
DestinationLocation? sourceLocation;
UserModel? author;
UserModel? driver;
String? driverId;
String? subTotal;
Timestamp? startTime;
Timestamp? endTime;
String? startKitoMetersReading;
String? endKitoMetersReading;
String? zoneId;
G? sourcePoint;
RentalOrderModel({
this.status,
this.rejectedByDrivers,
this.bookingDateTime,
this.paymentStatus,
this.discount,
this.authorID,
this.createdAt,
this.adminCommissionType,
this.sourceLocationName,
this.taxSetting,
this.id,
this.adminCommission,
this.couponCode,
this.couponId,
this.sectionId,
this.tipAmount,
this.vehicleId,
this.paymentMethod,
this.rentalVehicleType,
this.rentalPackageModel,
this.otpCode,
this.sourceLocation,
this.author,
this.subTotal,
this.driver,
this.driverId,
this.startTime,
this.endTime,
this.startKitoMetersReading,
this.endKitoMetersReading,
this.zoneId,
this.sourcePoint,
});
RentalOrderModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
rejectedByDrivers = json['rejectedByDrivers'] ?? [];
couponId = json['couponId'];
bookingDateTime = json['bookingDateTime'];
paymentStatus = json['paymentStatus'];
discount = json['discount'] == null ? "0.0" : json['discount'].toString();
authorID = json['authorID'];
createdAt = json['createdAt'];
adminCommissionType = json['adminCommissionType'];
sourceLocationName = json['sourceLocationName'];
if (json['taxSetting'] != null) {
taxSetting = <TaxModel>[];
json['taxSetting'].forEach((v) {
taxSetting!.add(TaxModel.fromJson(v));
});
}
id = json['id'];
adminCommission = json['adminCommission'];
couponCode = json['couponCode'];
sectionId = json['sectionId'];
tipAmount = json['tip_amount'];
vehicleId = json['vehicleId'];
paymentMethod = json['paymentMethod'];
rentalVehicleType = json['rentalVehicleType'] != null ? RentalVehicleType.fromJson(json['rentalVehicleType']) : null;
rentalPackageModel = json['rentalPackageModel'] != null ? RentalPackageModel.fromJson(json['rentalPackageModel']) : null;
otpCode = json['otpCode'];
sourceLocation = json['sourceLocation'] != null ? DestinationLocation.fromJson(json['sourceLocation']) : null;
author = json['author'] != null ? UserModel.fromJson(json['author']) : null;
subTotal = json['subTotal'];
driver = json['driver'] != null ? UserModel.fromJson(json['driver']) : null;
driverId = json['driverId'];
startTime = json['startTime'];
endTime = json['endTime'];
startKitoMetersReading = json['startKitoMetersReading'] ?? "0.0";
endKitoMetersReading = json['endKitoMetersReading'] ?? "0.0";
zoneId = json['zoneId'];
sourcePoint = json['sourcePoint'] != null ? G.fromJson(json['sourcePoint']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
if (rejectedByDrivers != null) {
data['rejectedByDrivers'] = rejectedByDrivers!.map((v) => v.toJson()).toList();
}
data['couponId'] = couponId;
data['bookingDateTime'] = bookingDateTime;
data['paymentStatus'] = paymentStatus;
data['discount'] = discount;
data['authorID'] = authorID;
data['createdAt'] = createdAt;
data['adminCommissionType'] = adminCommissionType;
data['sourceLocationName'] = sourceLocationName;
if (taxSetting != null) {
data['taxSetting'] = taxSetting!.map((v) => v.toJson()).toList();
}
data['id'] = id;
data['adminCommission'] = adminCommission;
data['couponCode'] = couponCode;
data['sectionId'] = sectionId;
data['tip_amount'] = tipAmount;
data['vehicleId'] = vehicleId;
data['paymentMethod'] = paymentMethod;
data['driverId'] = driverId;
if (driver != null) {
data['driver'] = driver!.toJson();
}
if (rentalVehicleType != null) {
data['rentalVehicleType'] = rentalVehicleType!.toJson();
}
if (rentalPackageModel != null) {
data['rentalPackageModel'] = rentalPackageModel!.toJson();
}
data['otpCode'] = otpCode;
if (sourceLocation != null) {
data['sourceLocation'] = sourceLocation!.toJson();
}
if (author != null) {
data['author'] = author!.toJson();
}
data['subTotal'] = subTotal;
data['startTime'] = startTime;
data['endTime'] = endTime;
data['startKitoMetersReading'] = startKitoMetersReading;
data['endKitoMetersReading'] = endKitoMetersReading;
data['zoneId'] = zoneId;
if (sourcePoint != null) {
data['sourcePoint'] = sourcePoint!.toJson();
}
return data;
}
}
class DestinationLocation {
double? longitude;
double? latitude;
DestinationLocation({this.longitude, this.latitude});
DestinationLocation.fromJson(Map<String, dynamic> json) {
longitude = json['longitude'];
latitude = json['latitude'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['longitude'] = longitude;
data['latitude'] = latitude;
return data;
}
}

View File

@@ -0,0 +1,62 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class RentalPackageModel {
String? id;
String? vehicleTypeId;
String? description;
String? ordering;
bool? published;
String? extraKmFare;
String? includedHours;
String? extraMinuteFare;
String? baseFare;
Timestamp? createdAt;
String? name;
String? includedDistance;
RentalPackageModel(
{this.id,
this.vehicleTypeId,
this.description,
this.ordering,
this.published,
this.extraKmFare,
this.includedHours,
this.extraMinuteFare,
this.baseFare,
this.createdAt,
this.name,
this.includedDistance});
RentalPackageModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
vehicleTypeId = json['vehicleTypeId'];
description = json['description'];
ordering = json['ordering'];
published = json['published'];
extraKmFare = json['extraKmFare'];
includedHours = json['includedHours'];
extraMinuteFare = json['extraMinuteFare'];
baseFare = json['baseFare'];
createdAt = json['createdAt'];
name = json['name'];
includedDistance = json['includedDistance'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['vehicleTypeId'] = vehicleTypeId;
data['description'] = description;
data['ordering'] = ordering;
data['published'] = published;
data['extraKmFare'] = extraKmFare;
data['includedHours'] = includedHours;
data['extraMinuteFare'] = extraMinuteFare;
data['baseFare'] = baseFare;
data['createdAt'] = createdAt;
data['name'] = name;
data['includedDistance'] = includedDistance;
return data;
}
}

View File

@@ -0,0 +1,36 @@
class RentalVehicleType {
String? rentalVehicleIcon;
String? shortDescription;
String? name;
String? description;
String? id;
bool? isActive;
String? supportedVehicle;
String? capacity;
RentalVehicleType({this.rentalVehicleIcon, this.shortDescription, this.name, this.description, this.id, this.isActive, this.supportedVehicle, this.capacity});
RentalVehicleType.fromJson(Map<String, dynamic> json) {
rentalVehicleIcon = json['rental_vehicle_icon'];
shortDescription = json['short_description'];
name = json['name'];
description = json['description'];
id = json['id'];
isActive = json['isActive'];
supportedVehicle = json['supported_vehicle'];
capacity = json['capacity'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['rental_vehicle_icon'] = rentalVehicleIcon;
data['short_description'] = shortDescription;
data['name'] = name;
data['description'] = description;
data['id'] = id;
data['isActive'] = isActive;
data['supported_vehicle'] = supportedVehicle;
data['capacity'] = capacity;
return data;
}
}

View File

@@ -0,0 +1,21 @@
class ReviewAttributeModel {
String? id;
String? title;
ReviewAttributeModel({
this.id,
this.title,
});
ReviewAttributeModel.fromJson(Map<String, dynamic> json) {
id = json['id'] ?? "";
title = json['title'] ?? "";
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['title'] = title;
return data;
}
}

View File

@@ -0,0 +1,91 @@
import 'package:customer/models/admin_commission_model.dart';
class SectionModel {
String? referralAmount;
String? serviceType;
String? color;
String? name;
String? sectionImage;
String? markerIcon;
String? id;
bool? isActive;
bool? dineInActive;
bool? isProductDetails;
String? serviceTypeFlag;
String? delivery_charge;
String? rideType;
String? theme;
int? nearByRadius;
AdminCommission? adminCommision;
SectionModel({
this.referralAmount,
this.serviceType,
this.color,
this.name,
this.sectionImage,
this.markerIcon,
this.id,
this.isActive,
this.theme,
this.adminCommision,
this.dineInActive,
this.delivery_charge,
this.nearByRadius,
this.isProductDetails,
this.serviceTypeFlag,
this.rideType,
});
SectionModel.fromJson(Map<String, dynamic> json) {
referralAmount = json['referralAmount'] ?? '';
serviceType = json['serviceType'] ?? '';
color = json['color'];
name = json['name'];
sectionImage = json['sectionImage'];
markerIcon = json['markerIcon'];
id = json['id'];
adminCommision = json.containsKey('adminCommision')
? AdminCommission.fromJson(json['adminCommision'])
: null;
isActive = json['isActive'];
theme = json['theme'] ?? "theme_2";
dineInActive = json['dine_in_active'] ?? false;
isProductDetails = json['is_product_details'] ?? false;
serviceTypeFlag = json['serviceTypeFlag'] ?? '';
delivery_charge = json['delivery_charge'] ?? '';
rideType = json['rideType'] ?? 'ride';
// 👇 Safe parsing for number (handles NaN, double, int)
final rawRadius = json['nearByRadius'];
if (rawRadius == null || rawRadius is! num || rawRadius.isNaN) {
nearByRadius = 5000;
} else {
nearByRadius = rawRadius.toInt();
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['referralAmount'] = referralAmount;
data['serviceType'] = serviceType;
data['color'] = color;
data['name'] = name;
data['sectionImage'] = sectionImage;
data['markerIcon'] = markerIcon;
data['rideType'] = rideType;
data['theme'] = theme;
if (adminCommision != null) {
data['adminCommision'] = adminCommision!.toJson();
}
data['id'] = id;
data['isActive'] = isActive;
data['dine_in_active'] = dineInActive;
data['is_product_details'] = isProductDetails;
data['serviceTypeFlag'] = serviceTypeFlag;
data['delivery_charge'] = delivery_charge;
data['nearByRadius'] = nearByRadius;
return data;
}
}

View File

@@ -0,0 +1,53 @@
class SpecialDiscountModel {
String? day;
List<Timeslot>? timeslot;
SpecialDiscountModel({this.day, this.timeslot});
SpecialDiscountModel.fromJson(Map<String, dynamic> json) {
day = json['day'];
if (json['timeslot'] != null) {
timeslot = <Timeslot>[];
json['timeslot'].forEach((v) {
timeslot!.add(Timeslot.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['day'] = day;
if (timeslot != null) {
data['timeslot'] = timeslot!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Timeslot {
String? from;
String? to;
String? discount;
String? type;
String? discount_type;
Timeslot({this.from, this.to, this.discount, this.type});
Timeslot.fromJson(Map<String, dynamic> json) {
from = json['from'];
to = json['to'];
discount = json['discount'];
type = json['type'];
discount_type = json['discount_type'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['from'] = from;
data['to'] = to;
data['discount'] = discount;
data['type'] = type;
data['discount_type'] = discount_type;
return data;
}
}

View File

@@ -0,0 +1,26 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class StoryModel {
String? videoThumbnail;
List<dynamic> videoUrl = [];
String? vendorID;
Timestamp? createdAt;
StoryModel({this.videoThumbnail, this.videoUrl = const [], this.vendorID, this.createdAt});
StoryModel.fromJson(Map<String, dynamic> json) {
videoThumbnail = json['videoThumbnail'] ?? '';
videoUrl = json['videoUrl'] ?? [];
vendorID = json['vendorID'] ?? '';
createdAt = json['createdAt'] ?? Timestamp.now();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['videoThumbnail'] = videoThumbnail;
data['videoUrl'] = videoUrl;
data['vendorID'] = vendorID;
data['createdAt'] = createdAt;
return data;
}
}

View File

@@ -0,0 +1,112 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class SubscriptionPlanModel {
Timestamp? createdAt;
String? description;
String? expiryDay;
Features? features;
String? id;
bool? isEnable;
bool? isCommissionPlan;
String? itemLimit;
String? orderLimit;
String? name;
String? price;
String? place;
String? image;
String? type;
String? sectionId;
List<String>? planPoints;
SubscriptionPlanModel(
{this.createdAt,
this.description,
this.expiryDay,
this.features,
this.id,
this.isEnable,
this.isCommissionPlan,
this.itemLimit,
this.orderLimit,
this.name,
this.price,
this.place,
this.image,
this.type,
this.sectionId,
this.planPoints});
factory SubscriptionPlanModel.fromJson(Map<String, dynamic> json) {
return SubscriptionPlanModel(
createdAt: json['createdAt'],
description: json['description'],
expiryDay: json['expiryDay'],
features: json['features'] == null ? null : Features.fromJson(json['features']),
id: json['id'],
isEnable: json['isEnable'],
isCommissionPlan: json['isCommissionPlan'],
itemLimit: json['itemLimit'],
orderLimit: json['orderLimit'],
name: json['name'],
price: json['price'],
// place: json['place'],
sectionId: json['sectionId'],
image: json['image'],
type: json['type'],
planPoints: json['plan_points'] == null ? [] : List<String>.from(json['plan_points']),
);
}
Map<String, dynamic> toJson() {
return {
'createdAt': createdAt,
'description': description,
'expiryDay': expiryDay.toString(),
'features': features?.toJson(),
'id': id,
'isEnable': isEnable,
'itemLimit': itemLimit.toString(),
'orderLimit': orderLimit.toString(),
'name': name,
'price': price.toString(),
'place': place.toString(),
'image': image.toString(),
'type': type,
'sectionId': sectionId,
'plan_points': planPoints
};
}
}
class Features {
bool? chat;
bool? qrCodeGenerate;
bool? ownerMobileApp;
bool? demo;
Features({
this.chat,
this.qrCodeGenerate,
this.ownerMobileApp,
this.demo,
});
// Factory constructor to create an instance from JSON
factory Features.fromJson(Map<String, dynamic> json) {
return Features(
chat: json['chat'] ?? false,
qrCodeGenerate: json['qrCodeGenerate'] ?? false,
ownerMobileApp: json['ownerMobileApp'] ?? false,
);
}
// Method to convert an instance to JSON
Map<String, dynamic> toJson() {
return {
'chat': chat,
'qrCodeGenerate': qrCodeGenerate,
'ownerMobileApp': ownerMobileApp,
};
}
}

42
lib/models/tax_model.dart Normal file
View File

@@ -0,0 +1,42 @@
class TaxModel {
String? country;
bool? enable;
String? tax;
String? id;
String? type;
String? title;
String? sectionId;
TaxModel({this.country, this.enable, this.tax, this.id, this.type, this.title,this.sectionId,});
TaxModel.fromJson(Map<String, dynamic> json) {
country = json['country'];
enable = json['enable'];
tax = json['tax'];
id = json['id'];
type = json['type'];
title = json['title'];
sectionId = json['sectionId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['country'] = country;
data['enable'] = enable;
data['tax'] = tax;
data['id'] = id;
data['type'] = type;
data['title'] = title;
data['sectionId'] = sectionId;
return data;
}
}

569
lib/models/user_model.dart Normal file
View File

@@ -0,0 +1,569 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/constant/constant.dart';
import 'package:customer/models/cab_order_model.dart';
import 'subscription_plan_model.dart';
import 'admin_commission_model.dart';
class UserModel {
String? id;
String? firstName;
String? lastName;
String? email;
String? profilePictureURL;
String? fcmToken;
String? countryCode;
String? phoneNumber;
num? walletAmount;
bool? active;
bool? isActive;
bool? isDocumentVerify;
Timestamp? createdAt;
String? role;
UserLocation? location;
UserBankDetails? userBankDetails;
List<ShippingAddress>? shippingAddress;
String? carName;
String? carNumber;
String? carPictureURL;
List<dynamic>? inProgressOrderID;
List<dynamic>? orderRequestData;
String? vendorID;
String? zoneId;
num? rotation;
String? appIdentifier;
String? provider;
String? subscriptionPlanId;
Timestamp? subscriptionExpiryDate;
SubscriptionPlanModel? subscriptionPlan;
String? serviceType;
String? sectionId;
String? vehicleId;
String? vehicleType;
String? carMakes;
String? reviewsCount;
String? reviewsSum;
AdminCommission? adminCommissionModel;
CabOrderModel? orderCabRequestData;
String? rideType;
String? ownerId;
bool? isOwner;
UserModel({
this.id,
this.firstName,
this.lastName,
this.active,
this.isActive,
this.isDocumentVerify,
this.email,
this.profilePictureURL,
this.fcmToken,
this.countryCode,
this.phoneNumber,
this.walletAmount,
this.createdAt,
this.role,
this.location,
this.shippingAddress,
this.carName,
this.carNumber,
this.carPictureURL,
this.inProgressOrderID,
this.orderRequestData,
this.vendorID,
this.zoneId,
this.rotation,
this.appIdentifier,
this.provider,
this.subscriptionPlanId,
this.subscriptionExpiryDate,
this.subscriptionPlan,
this.serviceType,
this.sectionId,
this.vehicleId,
this.vehicleType,
this.carMakes,
this.reviewsCount,
this.reviewsSum,
this.adminCommissionModel,
this.orderCabRequestData,
this.rideType,
this.ownerId,
this.isOwner,
});
String fullName() {
return "${firstName ?? ''} ${lastName ?? ''}";
}
double get averageRating {
final double sum = double.tryParse(reviewsSum ?? '0') ?? 0.0;
final double count = double.tryParse(reviewsCount ?? '0') ?? 0.0;
if (count <= 0) return 0.0;
return sum / count;
}
UserModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
email = json['email'];
firstName = json['firstName'];
lastName = json['lastName'];
profilePictureURL = json['profilePictureURL'];
fcmToken = json['fcmToken'];
countryCode = json['countryCode'];
phoneNumber = json['phoneNumber'];
walletAmount = json['wallet_amount'] ?? 0;
createdAt = json['createdAt'];
active = json['active'];
isActive = json['isActive'];
isDocumentVerify = json['isDocumentVerify'] ?? false;
role = json['role'] ?? 'user';
location = json['location'] != null ? UserLocation.fromJson(json['location']) : null;
userBankDetails = json['userBankDetails'] != null ? UserBankDetails.fromJson(json['userBankDetails']) : null;
if (json['shippingAddress'] != null) {
shippingAddress = <ShippingAddress>[];
json['shippingAddress'].forEach((v) {
shippingAddress!.add(ShippingAddress.fromJson(v));
});
}
carName = json['carName'];
carNumber = json['carNumber'];
carPictureURL = json['carPictureURL'];
inProgressOrderID = json['inProgressOrderID'] ?? [];
//orderRequestData = json['orderRequestData'] ?? [];
if (json['orderRequestData'] is List) {
orderRequestData = json['orderRequestData'];
} else if (json['orderRequestData'] is Map) {
orderRequestData = [json['orderRequestData']];
} else {
orderRequestData = [];
}
vendorID = json['vendorID'] ?? '';
zoneId = json['zoneId'] ?? '';
rotation = json['rotation'];
appIdentifier = json['appIdentifier'];
provider = json['provider'];
subscriptionPlanId = json['subscriptionPlanId'];
subscriptionExpiryDate = json['subscriptionExpiryDate'];
subscriptionPlan = json['subscription_plan'] != null ? SubscriptionPlanModel.fromJson(json['subscription_plan']) : null;
serviceType = json['serviceType'];
sectionId = json['sectionId'] ?? '';
vehicleId = json['vehicleId'];
vehicleType = json['vehicleType'];
carMakes = json['carMakes'];
reviewsCount = json['reviewsCount'] == null ? '0' : json['reviewsCount'].toString();
reviewsSum = json['reviewsSum'] == null ? '0' : json['reviewsSum'].toString();
adminCommissionModel = json['adminCommission'] != null ? AdminCommission.fromJson(json['adminCommission']) : null;
orderCabRequestData = json['ordercabRequestData'] != null ? CabOrderModel.fromJson(json['ordercabRequestData']) : null;
rideType = json['rideType'];
ownerId = json['ownerId'];
isOwner = json['isOwner'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['email'] = email;
data['firstName'] = firstName;
data['lastName'] = lastName;
data['profilePictureURL'] = profilePictureURL;
data['fcmToken'] = fcmToken;
data['countryCode'] = countryCode;
data['phoneNumber'] = phoneNumber;
data['wallet_amount'] = walletAmount ?? 0;
data['createdAt'] = createdAt;
data['active'] = active;
data['isActive'] = isActive ?? false;
data['role'] = role;
data['isDocumentVerify'] = isDocumentVerify;
data['zoneId'] = zoneId;
data['sectionId'] = sectionId ?? '';
if (location != null) {
data['location'] = location!.toJson();
}
if (userBankDetails != null) {
data['userBankDetails'] = userBankDetails!.toJson();
}
if (shippingAddress != null) {
data['shippingAddress'] = shippingAddress!.map((v) => v.toJson()).toList();
}
data['serviceType'] = serviceType;
data['rotation'] = rotation;
data['inProgressOrderID'] = inProgressOrderID;
if (role == Constant.userRoleDriver) {
data['vendorID'] = vendorID;
data['carName'] = carName;
data['carNumber'] = carNumber;
data['carPictureURL'] = carPictureURL;
data['orderRequestData'] = orderRequestData;
data['vehicleType'] = vehicleType;
data['carMakes'] = carMakes;
data['vehicleId'] = vehicleId ?? '';
if (orderCabRequestData != null) {
data['ordercabRequestData'] = orderCabRequestData!.toJson();
}
data['rideType'] = rideType;
data['ownerId'] = ownerId;
data['isOwner'] = isOwner;
}
if (role == Constant.userRoleVendor) {
data['vendorID'] = vendorID;
data['subscriptionPlanId'] = subscriptionPlanId;
data['subscriptionExpiryDate'] = subscriptionExpiryDate;
data['subscription_plan'] = subscriptionPlan?.toJson();
}
data['appIdentifier'] = appIdentifier;
data['provider'] = provider;
data['reviewsCount'] = reviewsCount;
data['reviewsSum'] = reviewsSum;
if (adminCommissionModel != null) {
data['adminCommission'] = adminCommissionModel!.toJson();
}
return data;
}
}
class UserLocation {
double? latitude;
double? longitude;
UserLocation({this.latitude, this.longitude});
UserLocation.fromJson(Map<String, dynamic> json) {
latitude = json['latitude'];
longitude = json['longitude'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['latitude'] = latitude;
data['longitude'] = longitude;
return data;
}
}
class ShippingAddress {
String? id;
String? address;
String? addressAs;
String? landmark;
String? locality;
UserLocation? location;
bool? isDefault;
ShippingAddress({this.address, this.landmark, this.locality, this.location, this.isDefault, this.addressAs, this.id});
ShippingAddress.fromJson(Map<String, dynamic> json) {
id = json['id'];
address = json['address'];
landmark = json['landmark'];
locality = json['locality'];
isDefault = json['isDefault'];
addressAs = json['addressAs'];
location = json['location'] == null ? null : UserLocation.fromJson(json['location']);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['address'] = address;
data['landmark'] = landmark;
data['locality'] = locality;
data['isDefault'] = isDefault;
data['addressAs'] = addressAs;
if (location != null) {
data['location'] = location!.toJson();
}
return data;
}
// String getFullAddress() {
// return '${address == null || address!.isEmpty ? "" : address} $locality ${landmark == null || landmark!.isEmpty ? "" : landmark.toString()}';
// }
String getFullAddress() {
return [
if (address != null && address!.trim().isNotEmpty) address!.trim(),
if (locality != null && locality!.trim().isNotEmpty) locality!.trim(),
if (landmark != null && landmark!.trim().isNotEmpty) landmark!.trim(),
].join(', ').replaceAll(RegExp(r'\s+'), ' ').trim();
}
}
class UserBankDetails {
String bankName;
String branchName;
String holderName;
String accountNumber;
String otherDetails;
UserBankDetails({this.bankName = '', this.otherDetails = '', this.branchName = '', this.accountNumber = '', this.holderName = ''});
factory UserBankDetails.fromJson(Map<String, dynamic> parsedJson) {
return UserBankDetails(
bankName: parsedJson['bankName'] ?? '',
branchName: parsedJson['branchName'] ?? '',
holderName: parsedJson['holderName'] ?? '',
accountNumber: parsedJson['accountNumber'] ?? '',
otherDetails: parsedJson['otherDetails'] ?? '',
);
}
Map<String, dynamic> toJson() {
return {
'bankName': bankName,
'branchName': branchName,
'holderName': holderName,
'accountNumber': accountNumber,
'otherDetails': otherDetails,
};
}
}
class CarInfo {
String? passenger;
String? doors;
String? airConditioning;
String? gear;
String? mileage;
String? fuelFilling;
String? fuelType;
String? maxPower;
String? mph;
String? topSpeed;
List<dynamic>? carImage;
CarInfo({
this.passenger,
this.doors,
this.airConditioning,
this.gear,
this.mileage,
this.fuelFilling,
this.fuelType,
this.carImage,
this.maxPower,
this.mph,
this.topSpeed,
});
CarInfo.fromJson(Map<String, dynamic> json) {
passenger = json['passenger'] ?? "";
doors = json['doors'] ?? "";
airConditioning = json['air_conditioning'] ?? "";
gear = json['gear'] ?? "";
mileage = json['mileage'] ?? "";
fuelFilling = json['fuel_filling'] ?? "";
fuelType = json['fuel_type'] ?? "";
carImage = json['car_image'] ?? [];
maxPower = json['maxPower'] ?? "";
mph = json['mph'] ?? "";
topSpeed = json['topSpeed'] ?? "";
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['passenger'] = passenger;
data['doors'] = doors;
data['air_conditioning'] = airConditioning;
data['gear'] = gear;
data['mileage'] = mileage;
data['fuel_filling'] = fuelFilling;
data['fuel_type'] = fuelType;
data['car_image'] = carImage;
data['maxPower'] = maxPower;
data['mph'] = mph;
data['topSpeed'] = topSpeed;
return data;
}
}
class UserSettings {
bool pushNewMessages;
bool orderUpdates;
bool newArrivals;
bool promotions;
UserSettings({this.pushNewMessages = true, this.orderUpdates = true, this.newArrivals = true, this.promotions = true});
factory UserSettings.fromJson(Map<dynamic, dynamic> parsedJson) {
return UserSettings(
pushNewMessages: parsedJson['pushNewMessages'] ?? true,
orderUpdates: parsedJson['orderUpdates'] ?? true,
newArrivals: parsedJson['newArrivals'] ?? true,
promotions: parsedJson['promotions'] ?? true,
);
}
Map<String, dynamic> toJson() {
return {'pushNewMessages': pushNewMessages, 'orderUpdates': orderUpdates, 'newArrivals': newArrivals, 'promotions': promotions};
}
}
// import 'package:cloud_firestore/cloud_firestore.dart';
// import 'package:customer/constant/constant.dart';
//
// import 'subscription_plan_model.dart';
//
// class UserModel {
// String? id;
// String? firstName;
// String? lastName;
// String? email;
// String? profilePictureURL;
// String? fcmToken;
// String? countryCode;
// String? phoneNumber;
// num? walletAmount;
// bool? active;
// bool? isActive;
// bool? isDocumentVerify;
// Timestamp? createdAt;
// String? role;
// UserLocation? location;
// UserBankDetails? userBankDetails;
// List<ShippingAddress>? shippingAddress;
// String? carName;
// String? carNumber;
// String? carPictureURL;
// List<dynamic>? inProgressOrderID;
// List<dynamic>? orderRequestData;
// String? vendorID;
// String? zoneId;
// num? rotation;
// String? appIdentifier;
// String? provider;
// String? subscriptionPlanId;
// Timestamp? subscriptionExpiryDate;
// SubscriptionPlanModel? subscriptionPlan;
//
// UserModel({
// this.id,
// this.firstName,
// this.lastName,
// this.active,
// this.isActive,
// this.isDocumentVerify,
// this.email,
// this.profilePictureURL,
// this.fcmToken,
// this.countryCode,
// this.phoneNumber,
// this.walletAmount,
// this.createdAt,
// this.role,
// this.location,
// this.shippingAddress,
// this.carName,
// this.carNumber,
// this.carPictureURL,
// this.inProgressOrderID,
// this.orderRequestData,
// this.vendorID,
// this.zoneId,
// this.rotation,
// this.appIdentifier,
// this.provider,
// this.subscriptionPlanId,
// this.subscriptionExpiryDate,
// this.subscriptionPlan,
// });
//
// String fullName() {
// return "${firstName ?? ''} ${lastName ?? ''}";
// }
//
// UserModel.fromJson(Map<String, dynamic> json) {
// id = json['id'];
// email = json['email'];
// firstName = json['firstName'];
// lastName = json['lastName'];
// profilePictureURL = json['profilePictureURL'];
// fcmToken = json['fcmToken'];
// countryCode = json['countryCode'];
// phoneNumber = json['phoneNumber'];
// walletAmount = json['wallet_amount'] ?? 0;
// createdAt = json['createdAt'];
// active = json['active'];
// isActive = json['isActive'];
// isDocumentVerify = json['isDocumentVerify'] ?? false;
// role = json['role'] ?? 'user';
// location = json['location'] != null ? UserLocation.fromJson(json['location']) : null;
// userBankDetails = json['userBankDetails'] != null ? UserBankDetails.fromJson(json['userBankDetails']) : null;
// if (json['shippingAddress'] != null) {
// shippingAddress = <ShippingAddress>[];
// json['shippingAddress'].forEach((v) {
// shippingAddress!.add(ShippingAddress.fromJson(v));
// });
// }
// carName = json['carName'];
// carNumber = json['carNumber'];
// carPictureURL = json['carPictureURL'];
// inProgressOrderID = json['inProgressOrderID'];
// orderRequestData = json['orderRequestData'];
// vendorID = json['vendorID'] ?? '';
// zoneId = json['zoneId'] ?? '';
// rotation = json['rotation'];
// appIdentifier = json['appIdentifier'];
// provider = json['provider'];
// subscriptionPlanId = json['subscriptionPlanId'];
// subscriptionExpiryDate = json['subscriptionExpiryDate'];
// subscriptionPlan = json['subscription_plan'] != null ? SubscriptionPlanModel.fromJson(json['subscription_plan']) : null;
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = <String, dynamic>{};
// data['id'] = id;
// data['email'] = email;
// data['firstName'] = firstName;
// data['lastName'] = lastName;
// data['profilePictureURL'] = profilePictureURL;
// data['fcmToken'] = fcmToken;
// data['countryCode'] = countryCode;
// data['phoneNumber'] = phoneNumber;
// data['wallet_amount'] = walletAmount ?? 0;
// data['createdAt'] = createdAt;
// data['active'] = active;
// data['isActive'] = isActive;
// data['role'] = role;
// data['isDocumentVerify'] = isDocumentVerify;
// data['zoneId'] = zoneId;
// if (location != null) {
// data['location'] = location!.toJson();
// }
// if (userBankDetails != null) {
// data['userBankDetails'] = userBankDetails!.toJson();
// }
// if (shippingAddress != null) {
// data['shippingAddress'] = shippingAddress!.map((v) => v.toJson()).toList();
// }
// if (role == Constant.userRoleDriver) {
// data['vendorID'] = vendorID;
// data['carName'] = carName;
// data['carNumber'] = carNumber;
// data['carPictureURL'] = carPictureURL;
// data['inProgressOrderID'] = inProgressOrderID;
// data['orderRequestData'] = orderRequestData;
// data['rotation'] = rotation;
// }
// if (role == Constant.userRoleVendor) {
// data['vendorID'] = vendorID;
// data['subscriptionPlanId'] = subscriptionPlanId;
// data['subscriptionExpiryDate'] = subscriptionExpiryDate;
// data['subscription_plan'] = subscriptionPlan?.toJson();
// }
// data['appIdentifier'] = appIdentifier;
// data['provider'] = provider;
//
// return data;
// }
// }
//

View File

@@ -0,0 +1,27 @@
class VariantInfo {
String? variantId;
String? variantPrice;
String? variantSku;
String? variant_image;
Map<String, dynamic>? variant_options;
VariantInfo({this.variantId, this.variantPrice, this.variant_image, this.variantSku, this.variant_options});
VariantInfo.fromJson(Map<String, dynamic> json) {
variantId = json['variantId'] ?? '';
variantPrice = json['variantPrice'] ?? '';
variantSku = json['variantSku'] ?? '';
variant_image = json['variant_image'] ?? '';
variant_options = json['variant_options'] ?? {};
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['variantId'] = variantId;
data['variantPrice'] = variantPrice;
data['variantSku'] = variantSku;
data['variant_image'] = variant_image;
data['variant_options'] = variant_options;
return data;
}
}

View File

@@ -0,0 +1,56 @@
class VehicleType {
String? shortDescription;
String? vehicleIcon;
String? name;
String? description;
String? id;
bool? isActive;
String? capacity;
String? supportedVehicle;
num? delivery_charges_per_km;
num? minimum_delivery_charges;
num? minimum_delivery_charges_within_km;
VehicleType(
{this.shortDescription,
this.vehicleIcon,
this.name,
this.description,
this.id,
this.isActive,
this.capacity,
this.delivery_charges_per_km,
this.minimum_delivery_charges,
this.minimum_delivery_charges_within_km,
this.supportedVehicle});
VehicleType.fromJson(Map<String, dynamic> json) {
shortDescription = json['short_description'];
vehicleIcon = json['vehicle_icon'];
name = json['name'];
description = json['description'];
id = json['id'];
isActive = json['isActive'];
capacity = json['capacity'];
delivery_charges_per_km = json['delivery_charges_per_km'] ?? 0.0;
minimum_delivery_charges = json['minimum_delivery_charges'] ?? 0.0;
minimum_delivery_charges_within_km = json['minimum_delivery_charges_within_km'] ?? 0.0;
supportedVehicle = json['supported_vehicle'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['short_description'] = shortDescription;
data['vehicle_icon'] = vehicleIcon;
data['name'] = name;
data['description'] = description;
data['id'] = id;
data['isActive'] = isActive;
data['capacity'] = capacity;
data['supported_vehicle'] = supportedVehicle;
data['delivery_charges_per_km'] = delivery_charges_per_km;
data['minimum_delivery_charges'] = minimum_delivery_charges;
data['minimum_delivery_charges_within_km'] = minimum_delivery_charges_within_km;
return data;
}
}

View File

@@ -0,0 +1,27 @@
class VendorCategoryModel {
List<dynamic>? reviewAttributes;
String? photo;
String? description;
String? id;
String? title;
VendorCategoryModel({this.reviewAttributes, this.photo, this.description, this.id, this.title});
VendorCategoryModel.fromJson(Map<String, dynamic> json) {
reviewAttributes = json['review_attributes'] ?? [];
photo = json['photo'] ?? "";
description = json['description'] ?? '';
id = json['id'] ?? "";
title = json['title'] ?? "";
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['review_attributes'] = reviewAttributes;
data['photo'] = photo;
data['description'] = description;
data['id'] = id;
data['title'] = title;
return data;
}
}

View File

@@ -0,0 +1,404 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/subscription_plan_model.dart';
import 'admin_commission_model.dart';
class VendorModel {
String? author;
bool? dineInActive;
String? openDineTime;
List<dynamic>? categoryID;
String? id;
String? categoryPhoto;
List<dynamic>? restaurantMenuPhotos;
List<WorkingHours>? workingHours;
String? location;
String? fcmToken;
G? g;
bool? hidephotos;
bool? reststatus;
Filters? filters;
AdminCommission? adminCommission;
String? photo;
String? description;
num? walletAmount;
String? closeDineTime;
String? zoneId;
Timestamp? createdAt;
double? longitude;
bool? enabledDiveInFuture;
String? restaurantCost;
DeliveryCharge? deliveryCharge;
String? authorProfilePic;
String? authorName;
String? phonenumber;
List<SpecialDiscount>? specialDiscount;
bool? specialDiscountEnable;
GeoPoint? coordinates;
num? reviewsSum;
num? reviewsCount;
List<dynamic>? photos;
String? title;
List<dynamic>? categoryTitle;
double? latitude;
String? subscriptionPlanId;
Timestamp? subscriptionExpiryDate;
SubscriptionPlanModel? subscriptionPlan;
String? subscriptionTotalOrders;
String? sectionId;
bool? isSelfDelivery;
VendorModel({
this.author,
this.dineInActive,
this.openDineTime,
this.categoryID,
this.id,
this.categoryPhoto,
this.restaurantMenuPhotos,
this.workingHours,
this.location,
this.fcmToken,
this.g,
this.hidephotos,
this.reststatus,
this.filters,
this.reviewsCount,
this.photo,
this.description,
this.walletAmount,
this.closeDineTime,
this.zoneId,
this.createdAt,
this.longitude,
this.enabledDiveInFuture,
this.restaurantCost,
this.deliveryCharge,
this.adminCommission,
this.authorProfilePic,
this.authorName,
this.phonenumber,
this.specialDiscount,
this.specialDiscountEnable,
this.coordinates,
this.reviewsSum,
this.photos,
this.title,
this.categoryTitle,
this.latitude,
this.subscriptionPlanId,
this.subscriptionExpiryDate,
this.subscriptionPlan,
this.subscriptionTotalOrders,
this.sectionId,
this.isSelfDelivery,
});
VendorModel.fromJson(Map<String, dynamic> json) {
author = json['author'];
dineInActive = json['dine_in_active'];
openDineTime = json['openDineTime'];
categoryID = json['categoryID'] is String ? [] : json['categoryID'] ?? [];
id = json['id'];
categoryPhoto = json['categoryPhoto'];
restaurantMenuPhotos = json['restaurantMenuPhotos'] ?? [];
if (json['workingHours'] != null) {
workingHours = <WorkingHours>[];
json['workingHours'].forEach((v) {
workingHours!.add(WorkingHours.fromJson(v));
});
}
location = json['location'];
fcmToken = json['fcmToken'];
g = json['g'] != null ? G.fromJson(json['g']) : null;
hidephotos = json['hidephotos'];
reststatus = json['reststatus'];
filters = json['filters'] != null ? Filters.fromJson(json['filters']) : null;
reviewsCount = num.parse('${json['reviewsCount'] ?? 0.0}');
photo = json['photo'];
description = json['description'];
walletAmount = json['walletAmount'];
closeDineTime = json['closeDineTime'];
zoneId = json['zoneId'];
// createdAt = json['createdAt'];
longitude = double.parse(json['longitude'].toString());
enabledDiveInFuture = json['enabledDiveInFuture'];
restaurantCost = json['restaurantCost']?.toString();
deliveryCharge = json['DeliveryCharge'] != null ? DeliveryCharge.fromJson(json['DeliveryCharge']) : null;
adminCommission = json['adminCommission'] != null ? AdminCommission.fromJson(json['adminCommission']) : null;
authorProfilePic = json['authorProfilePic'];
authorName = json['authorName'];
phonenumber = json['phonenumber'];
if (json['specialDiscount'] != null) {
specialDiscount = <SpecialDiscount>[];
json['specialDiscount'].forEach((v) {
specialDiscount!.add(SpecialDiscount.fromJson(v));
});
}
specialDiscountEnable = json['specialDiscountEnable'];
coordinates = json['coordinates'];
reviewsSum = num.parse('${json['reviewsSum'] ?? 0.0}');
photos = json['photos'] ?? [];
title = json['title'];
categoryTitle = json['categoryTitle'] is String ? [] : json['categoryTitle'] ?? [];
latitude = double.parse(json['latitude'].toString());
subscriptionPlanId = json['subscriptionPlanId'];
// subscriptionExpiryDate = json['subscriptionExpiryDate'];
subscriptionPlan = json['subscription_plan'] != null ? SubscriptionPlanModel.fromJson(json['subscription_plan']) : null;
subscriptionTotalOrders = json['subscriptionTotalOrders'];
sectionId = json['section_id'];
isSelfDelivery = json['isSelfDelivery'] ?? false;
createdAt =
json['createdAt'] is Timestamp
? json['createdAt']
: json['createdAt'] != null
? Timestamp.fromMillisecondsSinceEpoch((json['createdAt']['_seconds'] ?? 0) * 1000)
: null;
subscriptionExpiryDate =
json['subscriptionExpiryDate'] is Timestamp
? json['subscriptionExpiryDate']
: json['subscriptionExpiryDate'] != null
? Timestamp.fromMillisecondsSinceEpoch((json['subscriptionExpiryDate']['_seconds'] ?? 0) * 1000)
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['author'] = author;
data['dine_in_active'] = dineInActive;
data['openDineTime'] = openDineTime;
data['categoryID'] = categoryID;
data['id'] = id;
data['categoryPhoto'] = categoryPhoto;
data['restaurantMenuPhotos'] = restaurantMenuPhotos;
data['subscriptionPlanId'] = subscriptionPlanId;
data['subscriptionExpiryDate'] = subscriptionExpiryDate;
data['subscription_plan'] = subscriptionPlan?.toJson();
data['subscriptionTotalOrders'] = subscriptionTotalOrders;
data['section_id'] = sectionId;
if (workingHours != null) {
data['workingHours'] = workingHours!.map((v) => v.toJson()).toList();
}
data['location'] = location;
data['fcmToken'] = fcmToken;
if (g != null) {
data['g'] = g!.toJson();
}
data['hidephotos'] = hidephotos;
data['reststatus'] = reststatus;
if (filters != null) {
data['filters'] = filters!.toJson();
}
data['reviewsCount'] = reviewsCount;
data['photo'] = photo;
data['description'] = description;
data['walletAmount'] = walletAmount;
data['closeDineTime'] = closeDineTime;
data['zoneId'] = zoneId;
data['createdAt'] = createdAt;
data['longitude'] = longitude;
data['enabledDiveInFuture'] = enabledDiveInFuture;
data['restaurantCost'] = restaurantCost;
if (deliveryCharge != null) {
data['DeliveryCharge'] = deliveryCharge!.toJson();
}
if (adminCommission != null) {
data['adminCommission'] = adminCommission!.toJson();
}
data['authorProfilePic'] = authorProfilePic;
data['authorName'] = authorName;
data['phonenumber'] = phonenumber;
if (specialDiscount != null) {
data['specialDiscount'] = specialDiscount!.map((v) => v.toJson()).toList();
}
data['specialDiscountEnable'] = specialDiscountEnable;
data['coordinates'] = coordinates;
data['reviewsSum'] = reviewsSum;
data['photos'] = photos;
data['title'] = title;
data['categoryTitle'] = categoryTitle;
data['latitude'] = latitude;
data['isSelfDelivery'] = isSelfDelivery ?? false;
return data;
}
}
class WorkingHours {
String? day;
List<Timeslot>? timeslot;
WorkingHours({this.day, this.timeslot});
WorkingHours.fromJson(Map<String, dynamic> json) {
day = json['day'];
if (json['timeslot'] != null) {
timeslot = <Timeslot>[];
json['timeslot'].forEach((v) {
timeslot!.add(Timeslot.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['day'] = day;
if (timeslot != null) {
data['timeslot'] = timeslot!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Timeslot {
String? to;
String? from;
Timeslot({this.to, this.from});
Timeslot.fromJson(Map<String, dynamic> json) {
to = json['to'];
from = json['from'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['to'] = to;
data['from'] = from;
return data;
}
}
class G {
String? geohash;
GeoPoint? geopoint;
G({this.geohash, this.geopoint});
G.fromJson(Map<String, dynamic> json) {
geohash = json['geohash'];
geopoint = json['geopoint'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['geohash'] = geohash;
data['geopoint'] = geopoint;
return data;
}
}
class Filters {
String? goodForLunch;
String? outdoorSeating;
String? liveMusic;
String? vegetarianFriendly;
String? goodForDinner;
String? goodForBreakfast;
String? freeWiFi;
String? takesReservations;
Filters({this.goodForLunch, this.outdoorSeating, this.liveMusic, this.vegetarianFriendly, this.goodForDinner, this.goodForBreakfast, this.freeWiFi, this.takesReservations});
Filters.fromJson(Map<String, dynamic> json) {
goodForLunch = json['Good for Lunch'];
outdoorSeating = json['Outdoor Seating'];
liveMusic = json['Live Music'];
vegetarianFriendly = json['Vegetarian Friendly'];
goodForDinner = json['Good for Dinner'];
goodForBreakfast = json['Good for Breakfast'];
freeWiFi = json['Free Wi-Fi'];
takesReservations = json['Takes Reservations'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['Good for Lunch'] = goodForLunch;
data['Outdoor Seating'] = outdoorSeating;
data['Live Music'] = liveMusic;
data['Vegetarian Friendly'] = vegetarianFriendly;
data['Good for Dinner'] = goodForDinner;
data['Good for Breakfast'] = goodForBreakfast;
data['Free Wi-Fi'] = freeWiFi;
data['Takes Reservations'] = takesReservations;
return data;
}
}
class DeliveryCharge {
num? minimumDeliveryChargesWithinKm;
num? minimumDeliveryCharges;
num? deliveryChargesPerKm;
bool? vendorCanModify;
DeliveryCharge({this.minimumDeliveryChargesWithinKm, this.minimumDeliveryCharges, this.deliveryChargesPerKm, this.vendorCanModify});
DeliveryCharge.fromJson(Map<String, dynamic> json) {
minimumDeliveryChargesWithinKm = json['minimum_delivery_charges_within_km'];
minimumDeliveryCharges = json['minimum_delivery_charges'];
deliveryChargesPerKm = json['delivery_charges_per_km'];
vendorCanModify = json['vendor_can_modify'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['minimum_delivery_charges_within_km'] = minimumDeliveryChargesWithinKm;
data['minimum_delivery_charges'] = minimumDeliveryCharges;
data['delivery_charges_per_km'] = deliveryChargesPerKm;
data['vendor_can_modify'] = vendorCanModify;
return data;
}
}
class SpecialDiscount {
String? day;
List<SpecialDiscountTimeslot>? timeslot;
SpecialDiscount({this.day, this.timeslot});
SpecialDiscount.fromJson(Map<String, dynamic> json) {
day = json['day'];
if (json['timeslot'] != null) {
timeslot = <SpecialDiscountTimeslot>[];
json['timeslot'].forEach((v) {
timeslot!.add(SpecialDiscountTimeslot.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['day'] = day;
if (timeslot != null) {
data['timeslot'] = timeslot!.map((v) => v.toJson()).toList();
}
return data;
}
}
class SpecialDiscountTimeslot {
String? discount;
String? discountType;
String? to;
String? type;
String? from;
SpecialDiscountTimeslot({this.discount, this.discountType, this.to, this.type, this.from});
SpecialDiscountTimeslot.fromJson(Map<String, dynamic> json) {
discount = json['discount'];
discountType = json['discount_type'];
to = json['to'];
type = json['type'];
from = json['from'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['discount'] = discount;
data['discount_type'] = discountType;
data['to'] = to;
data['type'] = type;
data['from'] = from;
return data;
}
}

View File

@@ -0,0 +1,58 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class WalletTransactionModel {
String? userId;
String? paymentMethod;
double? amount;
bool? isTopup;
String? orderId;
String? paymentStatus;
Timestamp? date;
String? id;
String? transactionUser;
String? note;
String? serviceType;
WalletTransactionModel({
this.userId,
this.paymentMethod,
this.amount,
this.isTopup,
this.orderId,
this.paymentStatus,
this.date,
this.id,
this.transactionUser,
this.note,
this.serviceType,
});
WalletTransactionModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
userId = json['user_id'];
paymentMethod = json['payment_method'];
amount = double.parse("${json['amount'] ?? 0.0}");
isTopup = json['isTopUp'];
orderId = json['order_id'];
paymentStatus = json['payment_status'];
date = json['date'];
transactionUser = json['transactionUser'] ?? 'customer';
note = json['note'] ?? 'Wallet Top-up';
serviceType = json['serviceType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['user_id'] = userId;
data['payment_method'] = paymentMethod;
data['amount'] = amount;
data['isTopUp'] = isTopup;
data['order_id'] = orderId;
data['payment_status'] = paymentStatus;
data['date'] = date;
data['transactionUser'] = transactionUser;
data['note'] = note;
return data;
}
}

View File

@@ -0,0 +1,105 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/provider_serivce_model.dart';
class WorkerModel {
String? id;
String? firstName;
String? lastName;
String? email;
String? phoneNumber;
String? address;
String? salary;
Timestamp? createdAt;
GeoFireData geoFireData;
double? latitude;
double? longitude;
String? providerId;
bool? active;
String fcmToken;
String profilePictureURL;
bool? online;
num? reviewsCount;
num? reviewsSum;
WorkerModel({
this.id = '',
this.firstName = '',
this.lastName = '',
this.email = '',
this.phoneNumber = '',
this.address = '',
this.salary,
this.createdAt,
geoFireData,
this.latitude = 0.1,
this.longitude = 0.1,
this.providerId,
this.active = false,
this.fcmToken = '',
this.profilePictureURL = '',
this.online,
this.reviewsCount = 0 ,
this.reviewsSum = 0,
}): geoFireData = geoFireData ??
GeoFireData(
geohash: "",
geoPoint: const GeoPoint(0.0, 0.0),
);
String fullName() {
return '$firstName $lastName';
}
factory WorkerModel.fromJson(Map<String, dynamic> parsedJson) {
return WorkerModel(
id: parsedJson['id'] ?? '',
firstName: parsedJson['firstName'] ?? '',
lastName: parsedJson['lastName'] ?? '',
email: parsedJson['email'] ?? '',
phoneNumber: parsedJson['phoneNumber'] ?? '',
address: parsedJson['address'] ?? '',
salary: parsedJson['salary'] ?? '',
createdAt: parsedJson['createdAt'] ?? Timestamp.now(),
geoFireData: parsedJson.containsKey('g')
? GeoFireData.fromJson(parsedJson['g'])
: GeoFireData(
geohash: "",
geoPoint: const GeoPoint(0.0, 0.0),
),
latitude: parsedJson['latitude'] ?? 0.1,
longitude: parsedJson['longitude'] ?? 0.1,
providerId: parsedJson['providerId'] ?? '',
active: parsedJson['active'] ?? false,
fcmToken: parsedJson['fcmToken'] ?? '',
profilePictureURL: parsedJson['profilePictureURL'] ?? '',
online: parsedJson['online'] ?? false,
reviewsCount: parsedJson['reviewsCount'] ?? 0,
reviewsSum: parsedJson['reviewsSum'] ?? 0,
);
}
Map<String, dynamic> toJson() {
Map<String, dynamic> json = {
'id': id,
'firstName': firstName,
'lastName': lastName,
'email': email,
'phoneNumber': phoneNumber,
'address': address,
'salary': salary,
'createdAt': createdAt,
"g": geoFireData.toJson(),
'latitude': latitude,
'longitude': longitude,
'providerId': providerId,
'active': active,
'fcmToken': fcmToken,
'profilePictureURL': profilePictureURL,
'online': online,
'reviewsCount': reviewsCount,
'reviewsSum': reviewsSum,
};
return json;
}
}

View File

@@ -0,0 +1,49 @@
class WorkingHoursModel {
String? day;
List<Timeslot>? timeslot;
WorkingHoursModel({this.day, this.timeslot});
WorkingHoursModel.fromJson(Map<String, dynamic> json) {
day = json['day'];
if (json['timeslot'] != null) {
timeslot = <Timeslot>[];
json['timeslot'].forEach((v) {
timeslot!.add(Timeslot.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['day'] = day;
if (timeslot != null) {
data['timeslot'] = timeslot!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Timeslot {
String? from;
String? to;
String? date;
Timeslot({
this.from,
this.to,
});
Timeslot.fromJson(Map<String, dynamic> json) {
from = json['from'];
to = json['to'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['from'] = from;
data['to'] = to;
return data;
}
}

View File

@@ -0,0 +1,40 @@
import 'package:cloud_firestore/cloud_firestore.dart';
class ZoneModel {
List<GeoPoint>? area;
bool? publish;
double? latitude;
String? name;
String? id;
double? longitude;
ZoneModel({this.area, this.publish, this.latitude, this.name, this.id, this.longitude});
ZoneModel.fromJson(Map<String, dynamic> json) {
if (json['area'] != null) {
area = <GeoPoint>[];
json['area'].forEach((v) {
area!.add(v);
});
}
publish = json['publish'];
latitude = json['latitude'];
name = json['name'];
id = json['id'];
longitude = json['longitude'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (area != null) {
data['area'] = area!.map((v) => v).toList();
}
data['publish'] = publish;
data['latitude'] = latitude;
data['name'] = name;
data['id'] = id;
data['longitude'] = longitude;
return data;
}
}