-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f6cce6
commit 5441c37
Showing
13 changed files
with
558 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:gogrocy/core/models/Detail.dart'; | ||
|
||
class Bill { | ||
String bill_id; | ||
List<Detail> details; | ||
|
||
Bill({this.bill_id, this.details}); | ||
|
||
factory Bill.fromJson(Map<String, dynamic> json) { | ||
return Bill( | ||
bill_id: json['bill_id'], | ||
details: json['details'] != null ? (json['details'] as List).map((i) => Detail.fromJson(i)).toList() : null, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['bill_id'] = this.bill_id; | ||
if (this.details != null) { | ||
data['details'] = this.details.map((v) => v.toJson()).toList(); | ||
} | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class Detail { | ||
String bill_id; | ||
String image; | ||
String name; | ||
String order_date; | ||
String order_id; | ||
String order_qty; | ||
String payment_stat; | ||
String price; | ||
String product_id; | ||
String seller_name; | ||
String seller_number; | ||
String status; | ||
|
||
Detail({this.bill_id, this.image, this.name, this.order_date, this.order_id, this.order_qty, this.payment_stat, this.price, this.product_id, this.seller_name, this.seller_number, this.status}); | ||
|
||
factory Detail.fromJson(Map<String, dynamic> json) { | ||
return Detail( | ||
bill_id: json['bill_id'], | ||
image: json['image'], | ||
name: json['name'], | ||
order_date: json['order_date'], | ||
order_id: json['order_id'], | ||
order_qty: json['order_qty'], | ||
payment_stat: json['payment_stat'], | ||
price: json['price'], | ||
product_id: json['product_id'], | ||
seller_name: json['seller_name'], | ||
seller_number: json['seller_number'], | ||
status: json['status'], | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['bill_id'] = this.bill_id; | ||
data['image'] = this.image; | ||
data['name'] = this.name; | ||
data['order_date'] = this.order_date; | ||
data['order_id'] = this.order_id; | ||
data['order_qty'] = this.order_qty; | ||
data['payment_stat'] = this.payment_stat; | ||
data['price'] = this.price; | ||
data['product_id'] = this.product_id; | ||
data['seller_name'] = this.seller_name; | ||
data['seller_number'] = this.seller_number; | ||
data['status'] = this.status; | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:gogrocy/core/models/Result.dart'; | ||
|
||
class Orders { | ||
bool empty; | ||
Result result; | ||
|
||
Orders({this.empty, this.result}); | ||
|
||
factory Orders.fromJson(Map<String, dynamic> json) { | ||
return Orders( | ||
empty: json['empty'], | ||
result: json['result'] != null ? Result.fromJson(json['result']) : null, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
data['empty'] = this.empty; | ||
if (this.result != null) { | ||
data['result'] = this.result.toJson(); | ||
} | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:gogrocy/core/models/Address.dart'; | ||
import 'package:gogrocy/core/models/Bill.dart'; | ||
|
||
class Result { | ||
List<Address> address; | ||
List<Bill> bills; | ||
|
||
Result({this.address, this.bills}); | ||
|
||
factory Result.fromJson(Map<String, dynamic> json) { | ||
return Result( | ||
address: json['address'] != null ? (json['address'] as List).map((i) => Address.fromJson(i)).toList() : null, | ||
bills: json['bills'] != null ? (json['bills'] as List).map((i) => Bill.fromJson(i)).toList() : null, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
if (this.address != null) { | ||
data['address'] = this.address.map((v) => v.toJson()).toList(); | ||
} | ||
if (this.bills != null) { | ||
data['bills'] = this.bills.map((v) => v.toJson()).toList(); | ||
} | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gogrocy/core/enums/viewstate.dart'; | ||
import 'package:gogrocy/core/models/Orders.dart'; | ||
import 'package:gogrocy/core/services/api.dart'; | ||
import 'package:gogrocy/core/viewModels/base_model.dart'; | ||
import 'package:gogrocy/service_locator.dart'; | ||
|
||
class OrderViewModel extends BaseModel { | ||
|
||
Orders orders; | ||
|
||
Future getOrders()async{ | ||
setState(ViewState.Busy); | ||
Apis _apis=locator<Apis>(); | ||
orders=await _apis.getOrders(); | ||
setState(ViewState.Idle); | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.