Initial commit

This commit is contained in:
jahongireshonqulov
2025-10-17 19:42:02 +05:00
commit 9fbdabafb4
1420 changed files with 28021 additions and 0 deletions

View File

@@ -0,0 +1,177 @@
// To parse this JSON data, do
//
// final orderDetailsResponse = orderDetailsResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/product_mini_response.dart';
OrderDetailsResponse orderDetailsResponseFromJson(String str) => OrderDetailsResponse.fromJson(json.decode(str));
String orderDetailsResponseToJson(OrderDetailsResponse data) => json.encode(data.toJson());
class OrderDetailsResponse {
OrderDetailsInfo data;
OrderDetailsResponse({
required this.data,
});
factory OrderDetailsResponse.fromJson(Map<String, dynamic> json) => OrderDetailsResponse(
data: OrderDetailsInfo.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"data": data.toJson(),
};
}
class OrderDetailsInfo {
int id;
String code;
String date;
IngAddress? shippingAddress;
IngAddress? billingAddress;
List<Item> items;
String status;
String payment_method;
String subTotalAmount;
String totalTips;
String totalShippingCost;
String couponDiscountAmount;
String totalPrice;
OrderDetailsInfo({
required this.id,
required this.code,
required this.date,
this.shippingAddress,
this.billingAddress,
required this.items,
required this.status,
required this.payment_method,
required this.subTotalAmount,
required this.totalTips,
required this.totalShippingCost,
required this.totalPrice,
required this.couponDiscountAmount
});
factory OrderDetailsInfo.fromJson(Map<String, dynamic> json) => OrderDetailsInfo(
id: json["id"],
code: json["order_code"],
date: json["date"],
shippingAddress:json["shipping_address"]==null?null: IngAddress.fromJson(json["shipping_address"]),
billingAddress: json["billing_address"]==null?null:IngAddress.fromJson(json["billing_address"]),
items: List<Item>.from(json["items"].map((x) => Item.fromJson(x))),
status: json["status"],
payment_method: json["payment_method"],
subTotalAmount: json["sub_total_amount"],
totalTips: json["total_tips"],
totalShippingCost: json["total_shipping_cost"],
couponDiscountAmount: json["coupon_discount_amount"],
totalPrice: json["total_price"],
);
Map<String, dynamic> toJson() => {
"id": id,
"date": date,
"shipping_address": shippingAddress?.toJson(),
"billing_address": billingAddress?.toJson(),
"items": List<dynamic>.from(items.map((x) => x.toJson())),
"status": status,
"sub_total_amount": subTotalAmount,
"total_tips": totalTips,
"total_shipping_cost": totalShippingCost,
"total_price": totalPrice,
};
}
class IngAddress {
var id;
var userId;
var countryId;
String countryName;
var stateId;
String stateName;
var cityId;
String cityName;
String address;
var isDefault;
IngAddress({
required this.id,
required this.userId,
required this.countryId,
required this.countryName,
required this.stateId,
required this.stateName,
required this.cityId,
required this.cityName,
required this.address,
required this.isDefault,
});
factory IngAddress.fromJson(Map<String, dynamic> json) => IngAddress(
id: json["id"],
userId: json["user_id"],
countryId: json["country_id"],
countryName: json["country_name"],
stateId: json["state_id"],
stateName: json["state_name"],
cityId: json["city_id"],
cityName: json["city_name"],
address: json["address"],
isDefault: json["is_default"],
);
Map<String, dynamic> toJson() => {
"id": id,
"user_id": userId,
"country_id": countryId,
"country_name": countryName,
"state_id": stateId,
"state_name": stateName,
"city_id": cityId,
"city_name": cityName,
"address": address,
"is_default": isDefault,
};
}
class Item {
var id;
ProductMini? product;
var qty;
String unitPrice;
String totalPrice;
var refund_status;
Item({
required this.id,
this.product,
required this.qty,
required this.unitPrice,
required this.totalPrice,
required this.refund_status,
});
factory Item.fromJson(Map<String, dynamic> json) => Item(
id: json["id"],
product: ProductMini.fromJson(json["product"]),
qty: json["qty"],
unitPrice: json["unit_price"],
totalPrice: json["total_price"],
refund_status: json["refund_status"],
);
Map<String, dynamic> toJson() => {
"id":id,
"product": product?.toJson(),
"qty": qty,
"unit_price": unitPrice,
"total_price": totalPrice,
"refund_status": refund_status,
};
}

View File

@@ -0,0 +1,45 @@
// To parse this JSON data, do
//
// final orderSummeryResponse = orderSummeryResponseFromJson(jsonString);
import 'dart:convert';
OrderSummeryResponse orderSummeryResponseFromJson(String str) => OrderSummeryResponse.fromJson(json.decode(str));
String orderSummeryResponseToJson(OrderSummeryResponse data) => json.encode(data.toJson());
class OrderSummeryResponse {
String subTotal;
String tax;
String shippingCharge;
bool isFreeShipping;
String couponDiscount;
String total;
OrderSummeryResponse({
required this.subTotal,
required this.tax,
required this.shippingCharge,
required this.isFreeShipping,
required this.couponDiscount,
required this.total,
});
factory OrderSummeryResponse.fromJson(Map<String, dynamic> json) => OrderSummeryResponse(
subTotal: json["sub_total"],
tax: json["tax"],
shippingCharge: json["shipping_charge"],
isFreeShipping: json["is_free_shipping"],
couponDiscount: json["coupon_discount"],
total: json["total"],
);
Map<String, dynamic> toJson() => {
"sub_total": subTotal,
"tax": tax,
"shipping_charge": shippingCharge,
"is_free_shipping": isFreeShipping,
"coupon_discount": couponDiscount,
"total": total,
};
}

View File

@@ -0,0 +1,233 @@
// To parse this JSON data, do
//
// final ordersResponse = ordersResponseFromJson(jsonString);
import 'dart:convert';
import 'package:grostore/models/product_mini_response.dart';
OrdersResponse ordersResponseFromJson(String str) => OrdersResponse.fromJson(json.decode(str));
String ordersResponseToJson(OrdersResponse data) => json.encode(data.toJson());
class OrdersResponse {
List<OrderInfo> data;
Links links;
Meta meta;
OrdersResponse({
required this.data,
required this.links,
required this.meta,
});
factory OrdersResponse.init(){
return OrdersResponse(data: [], links: Links.fromJson({}), meta: Meta.fromJson({}),);
}
factory OrdersResponse.fromJson(Map<String, dynamic> json) => OrdersResponse(
data: List<OrderInfo>.from(json["data"].map((x) => OrderInfo.fromJson(x))),
links: Links.fromJson(json["links"]),
meta: Meta.fromJson(json["meta"]),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
"links": links.toJson(),
"meta": meta.toJson(),
};
}
class OrderInfo{
int id;
int group_id;
Item item;
String status;
DateTime date;
OrderInfo({
required this.id,
required this.group_id,
required this.item,
required this.status,
required this.date,
});
factory OrderInfo.fromJson(Map<String, dynamic> json)
{
return OrderInfo(
id: json["id"],
group_id: json["group_id"],
item: Item.fromJson(json["items"]),
status: json["status"],
date: DateTime.parse(json["date"]),
);
}
Map<String, dynamic> toJson() => {
"id": id,
"group_id": group_id,
"items": item.toJson(),
"status": statusValues.reverse[status],
"date": date.toIso8601String(),
};
}
class Item {
int id;
ProductMini? product;
var qty;
String unitPrice;
String totalPrice;
var isRefunded;
Item({
required this.id,
required this.product,
required this.qty,
required this.unitPrice,
required this.totalPrice,
required this.isRefunded,
});
factory Item.fromJson(Map<String, dynamic> json) => Item(
id: json["id"],
product: ProductMini.fromJson(json["product"]),
qty: json["qty"],
unitPrice: json["unit_price"],
totalPrice: json["total_price"],
isRefunded: json["is_refunded"],
);
Map<String, dynamic> toJson() => {
"id": id,
"product": product?.toJson(),
"qty": qty,
"unit_price": unitPrice,
"total_price": totalPrice,
"is_refunded": isRefunded,
};
}
enum Status { ORDER_PLACED, DELIVERED, PROCESSING }
final statusValues = EnumValues({
"delivered": Status.DELIVERED,
"order_placed": Status.ORDER_PLACED,
"processing": Status.PROCESSING
});
class Links {
String first;
String last;
dynamic prev;
dynamic next;
Links({
required this.first,
required this.last,
this.prev,
this.next,
});
factory Links.fromJson(Map<String, dynamic> json) => Links(
first: json["first"],
last: json["last"],
prev: json["prev"],
next: json["next"],
);
Map<String, dynamic> toJson() => {
"first": first,
"last": last,
"prev": prev,
"next": next,
};
}
class Meta {
int currentPage;
int? from;
int lastPage;
List<Link> links;
String path;
int perPage;
int? to;
int total;
Meta({
required this.currentPage,
this.from,
required this.lastPage,
required this.links,
required this.path,
required this.perPage,
this.to,
required this.total,
});
factory Meta.fromJson(Map<String, dynamic> json) => Meta(
currentPage: json["current_page"],
from: json["from"],
lastPage: json["last_page"],
links: List<Link>.from(json["links"].map((x) => Link.fromJson(x))),
path: json["path"],
perPage: json["per_page"],
to: json["to"],
total: json["total"],
);
Map<String, dynamic> toJson() => {
"current_page": currentPage,
"from": from,
"last_page": lastPage,
"links": List<dynamic>.from(links.map((x) => x.toJson())),
"path": path,
"per_page": perPage,
"to": to,
"total": total,
};
}
class Link {
String? url;
String label;
bool active;
Link({
this.url,
required this.label,
required this.active,
});
factory Link.fromJson(Map<String, dynamic> json) => Link(
url: json["url"],
label: json["label"],
active: json["active"],
);
Map<String, dynamic> toJson() => {
"url": url,
"label": label,
"active": active,
};
}
class EnumValues<T> {
Map<String, T> map;
late Map<T, String> reverseMap;
EnumValues(this.map);
Map<T, String> get reverse {
reverseMap = map.map((k, v) => MapEntry(v, k));
return reverseMap;
}
}

View File

@@ -0,0 +1,69 @@
// To parse this JSON TrackInfo, do
//
// final trackOrderResponse = trackOrderResponseFromJson(jsonString);
import 'dart:convert';
TrackOrderResponse trackOrderResponseFromJson(String str) => TrackOrderResponse.fromJson(json.decode(str));
String trackOrderResponseToJson(TrackOrderResponse data) => json.encode(data.toJson());
class TrackOrderResponse {
TrackInfo? data;
TrackOrderResponse({
this.data,
});
factory TrackOrderResponse.fromJson(Map<String, dynamic> json) => TrackOrderResponse(
data:json["data"]==null?null: TrackInfo.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"data": data?.toJson(),
};
}
class TrackInfo {
int id;
List<OrderUpdate> orderUpdates;
String createdDate;
TrackInfo({
required this.id,
required this.orderUpdates,
required this.createdDate,
});
factory TrackInfo.fromJson(Map<String, dynamic> json) => TrackInfo(
id: json["id"],
orderUpdates: List<OrderUpdate>.from(json["order_updates"].map((x) => OrderUpdate.fromJson(x))),
createdDate: json["created_date"],
);
Map<String, dynamic> toJson() => {
"id": id,
"order_updates": List<dynamic>.from(orderUpdates.map((x) => x.toJson())),
"created_date": createdDate,
};
}
class OrderUpdate {
String date;
String note;
OrderUpdate({
required this.date,
required this.note,
});
factory OrderUpdate.fromJson(Map<String, dynamic> json) => OrderUpdate(
date: json["date"],
note: json["note"],
);
Map<String, dynamic> toJson() => {
"date": date,
"note": note,
};
}