feat: get list outlet id
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class OutletResponse {
|
||||
final bool? success;
|
||||
final OutletData? data;
|
||||
final dynamic errors;
|
||||
|
||||
OutletResponse({
|
||||
this.success,
|
||||
this.data,
|
||||
this.errors,
|
||||
});
|
||||
|
||||
factory OutletResponse.fromJson(String str) =>
|
||||
OutletResponse.fromMap(json.decode(str));
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory OutletResponse.fromMap(Map<String, dynamic> json) => OutletResponse(
|
||||
success: json["success"],
|
||||
data: json["data"] == null ? null : OutletData.fromMap(json["data"]),
|
||||
errors: json["errors"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
"success": success,
|
||||
"data": data?.toMap(),
|
||||
"errors": errors,
|
||||
};
|
||||
}
|
||||
|
||||
class OutletData {
|
||||
final List<Outlet>? outlets;
|
||||
final int? totalCount;
|
||||
final int? page;
|
||||
final int? limit;
|
||||
final int? totalPages;
|
||||
|
||||
OutletData({
|
||||
this.outlets,
|
||||
this.totalCount,
|
||||
this.page,
|
||||
this.limit,
|
||||
this.totalPages,
|
||||
});
|
||||
|
||||
factory OutletData.fromMap(Map<String, dynamic> json) => OutletData(
|
||||
outlets: json["outlets"] == null
|
||||
? []
|
||||
: List<Outlet>.from(json["outlets"].map((x) => Outlet.fromMap(x))),
|
||||
totalCount: json["total_count"],
|
||||
page: json["page"],
|
||||
limit: json["limit"],
|
||||
totalPages: json["total_pages"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
"outlets": outlets == null
|
||||
? []
|
||||
: List<dynamic>.from(outlets!.map((x) => x.toMap())),
|
||||
"total_count": totalCount,
|
||||
"page": page,
|
||||
"limit": limit,
|
||||
"total_pages": totalPages,
|
||||
};
|
||||
}
|
||||
|
||||
class Outlet {
|
||||
final String? id;
|
||||
final String? organizationId;
|
||||
final String? name;
|
||||
final String? address;
|
||||
final String? phoneNumber;
|
||||
final String? businessType;
|
||||
final String? currency;
|
||||
final int? taxRate;
|
||||
final bool? isActive;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
Outlet({
|
||||
this.id,
|
||||
this.organizationId,
|
||||
this.name,
|
||||
this.address,
|
||||
this.phoneNumber,
|
||||
this.businessType,
|
||||
this.currency,
|
||||
this.taxRate,
|
||||
this.isActive,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
factory Outlet.fromMap(Map<String, dynamic> json) => Outlet(
|
||||
id: json["id"],
|
||||
organizationId: json["organization_id"],
|
||||
name: json["name"],
|
||||
address: json["address"],
|
||||
phoneNumber: json["phone_number"],
|
||||
businessType: json["business_type"],
|
||||
currency: json["currency"],
|
||||
taxRate: json["tax_rate"],
|
||||
isActive: json["is_active"],
|
||||
createdAt: json["created_at"] == null
|
||||
? null
|
||||
: DateTime.parse(json["created_at"]),
|
||||
updatedAt: json["updated_at"] == null
|
||||
? null
|
||||
: DateTime.parse(json["updated_at"]),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() => {
|
||||
"id": id,
|
||||
"organization_id": organizationId,
|
||||
"name": name,
|
||||
"address": address,
|
||||
"phone_number": phoneNumber,
|
||||
"business_type": businessType,
|
||||
"currency": currency,
|
||||
"tax_rate": taxRate,
|
||||
"is_active": isActive,
|
||||
"created_at": createdAt?.toIso8601String(),
|
||||
"updated_at": updatedAt?.toIso8601String(),
|
||||
};
|
||||
|
||||
factory Outlet.fromJson(String str) => Outlet.fromMap(json.decode(str));
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
}
|
||||
Reference in New Issue
Block a user