fix order and orderdetails
parent
ddf032bb47
commit
d328c74fc4
@ -0,0 +1,18 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="115.115" height="115.114" viewBox="0 0 115.115 115.114">
|
||||
<g id="box_2_" data-name="box (2)" transform="translate(0 -0.002)">
|
||||
<path id="Path_1371" data-name="Path 1371" d="M134.442,152.513l-32.349-1.2,0,0L76,160.011l40.47,13.49,40.47-13.49Z" transform="translate(-58.912 -117.291)" fill="#fff"/>
|
||||
<path id="Path_1372" data-name="Path 1372" d="M216.469,30.237A20.235,20.235,0,1,1,196.234,10,20.234,20.234,0,0,1,216.469,30.237Z" transform="translate(-136.429 -7.752)" fill="#c72525"/>
|
||||
<path id="Path_1373" data-name="Path 1373" d="M172.426,256.019,131.972,250,96,256.97v36.2l35.973,13.49,40.47-13.49v-37.1Z" transform="translate(-74.416 -193.792)" fill="#ffd474"/>
|
||||
<g id="Group_1210" data-name="Group 1210" transform="translate(2.248 15.902)">
|
||||
<path id="Path_1374" data-name="Path 1374" d="M339.847,78.112,335.939,95.77l22.5,7.5L373.275,88.43Z" transform="translate(-262.657 -76.45)" fill="#e8ab22"/>
|
||||
<path id="Path_1375" data-name="Path 1375" d="M256,203.492l11.975,14.967,43.334-13.618L296.469,190Z" transform="translate(-200.69 -163.184)" fill="#e8ab22"/>
|
||||
<path id="Path_1376" data-name="Path 1376" d="M33.839,205.8l40.47,13.49,9.479-15.8L43.318,190Z" transform="translate(-28.479 -163.184)" fill="#e8ab22"/>
|
||||
<path id="Path_1377" data-name="Path 1377" d="M48.416,70.722,10,82.7,24.838,97.54l26.092-8.7,0,0Z" transform="translate(-9.999 -70.722)" fill="#e8ab22"/>
|
||||
</g>
|
||||
<path id="Path_1378" data-name="Path 1378" d="M148.247,374.5A2.248,2.248,0,1,0,146,372.25,2.249,2.249,0,0,0,148.247,374.5Z" transform="translate(-113.174 -286.812)"/>
|
||||
<path id="Path_1379" data-name="Path 1379" d="M14.256,43.069,5.68,57.362A2.248,2.248,0,0,0,6.9,60.652L19.335,64.8v34.58a2.248,2.248,0,0,0,1.459,2.105c7.605,2.852,35.864,13.45,36.015,13.5a2.24,2.24,0,0,0,1.438.02l.02-.006,40.47-13.49a2.249,2.249,0,0,0,1.537-2.133V63.872L113.54,59.7a2.248,2.248,0,0,0,.916-3.735L101.206,42.72l13.249-13.249a2.248,2.248,0,0,0-.927-3.738L81.265,15.775a22.486,22.486,0,0,0-42.317-1.693L1.578,25.735a2.249,2.249,0,0,0-.92,3.736Zm3.831,2.355,36.1,12.033L47.078,69.306l-36.1-12.033Zm24.275-8.758a22.477,22.477,0,0,0,33.876,1.162L90.916,42.72,57.557,53.84,24.2,42.72ZM23.832,66.3c24.765,8.211,23.556,7.961,24.246,7.961a2.249,2.249,0,0,0,1.928-1.092l5.3-8.838v45.3L23.832,97.82V66.3Zm71.947,31.46L59.8,109.749V62.619l7.971,9.962a2.249,2.249,0,0,0,2.43.74l25.573-8.036Zm12.875-41.231L70.325,68.571l-9-11.247L97.419,45.293ZM97.419,40.148l-18.33-6.109a22.548,22.548,0,0,0,3.2-11.553c0-.571-.024-1.141-.067-1.709l26.417,8.154ZM59.8,4.5A17.963,17.963,0,0,1,77.792,22.485,17.984,17.984,0,0,1,59.8,40.472,17.987,17.987,0,1,1,59.8,4.5ZM37.561,19.225a22.669,22.669,0,0,0-.239,3.26,22.348,22.348,0,0,0,2.492,10.29l-22.12,7.373L6.467,28.921Z"/>
|
||||
<path id="Path_1380" data-name="Path 1380" d="M185.216,387.573l5,1.875a2.248,2.248,0,1,0,1.579-4.21l-5-1.875a2.248,2.248,0,1,0-1.579,4.21Z" transform="translate(-142.442 -297.057)"/>
|
||||
<path id="Path_1381" data-name="Path 1381" d="M162.524,416.981l-13.49-5.059a2.248,2.248,0,0,0-1.579,4.21l13.49,5.059a2.248,2.248,0,0,0,1.579-4.21Z" transform="translate(-113.171 -319.196)"/>
|
||||
<path id="Icon_ionic-ios-close" data-name="Icon ionic-ios-close" d="M23.334,21.027l6.958-6.958a1.63,1.63,0,0,0-2.306-2.306l-6.958,6.958L14.07,11.763a1.63,1.63,0,1,0-2.306,2.306l6.958,6.958-6.958,6.958A1.63,1.63,0,0,0,14.07,30.29l6.958-6.958,6.958,6.958a1.63,1.63,0,1,0,2.306-2.306Z" transform="translate(38.674 1.065)" fill="#fff"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
@ -0,0 +1,170 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
PharmacyAddressesModel pharmacyAddressesModelFromJson(String str) => PharmacyAddressesModel.fromJson(json.decode(str));
|
||||
|
||||
String pharmacyAddressesModelToJson(PharmacyAddressesModel data) => json.encode(data.toJson());
|
||||
|
||||
class PharmacyAddressesModel {
|
||||
PharmacyAddressesModel({
|
||||
this.customers,
|
||||
});
|
||||
|
||||
List<Customer> customers;
|
||||
|
||||
factory PharmacyAddressesModel.fromJson(Map<String, dynamic> json) => PharmacyAddressesModel(
|
||||
customers: List<Customer>.from(json["customers"].map((x) => Customer.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"customers": List<dynamic>.from(customers.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class Customer {
|
||||
Customer({
|
||||
this.addresses,
|
||||
});
|
||||
|
||||
List<Address> addresses;
|
||||
|
||||
factory Customer.fromJson(Map<String, dynamic> json) => Customer(
|
||||
addresses: List<Address>.from(json["addresses"].map((x) => Address.fromJson(x))),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"addresses": List<dynamic>.from(addresses.map((x) => x.toJson())),
|
||||
};
|
||||
}
|
||||
|
||||
class Address {
|
||||
Address({
|
||||
this.id,
|
||||
this.firstName,
|
||||
this.lastName,
|
||||
this.email,
|
||||
this.company,
|
||||
this.countryId,
|
||||
this.country,
|
||||
this.stateProvinceId,
|
||||
this.city,
|
||||
this.address1,
|
||||
this.address2,
|
||||
this.zipPostalCode,
|
||||
this.phoneNumber,
|
||||
this.faxNumber,
|
||||
this.customerAttributes,
|
||||
this.createdOnUtc,
|
||||
this.province,
|
||||
this.latLong,
|
||||
});
|
||||
|
||||
String id;
|
||||
FirstName firstName;
|
||||
LastName lastName;
|
||||
Email email;
|
||||
dynamic company;
|
||||
int countryId;
|
||||
Country country;
|
||||
dynamic stateProvinceId;
|
||||
City city;
|
||||
String address1;
|
||||
String address2;
|
||||
String zipPostalCode;
|
||||
String phoneNumber;
|
||||
dynamic faxNumber;
|
||||
String customerAttributes;
|
||||
DateTime createdOnUtc;
|
||||
dynamic province;
|
||||
String latLong;
|
||||
|
||||
factory Address.fromJson(Map<String, dynamic> json) => Address(
|
||||
id: json["id"],
|
||||
firstName: firstNameValues.map[json["first_name"]],
|
||||
lastName: lastNameValues.map[json["last_name"]],
|
||||
email: emailValues.map[json["email"]],
|
||||
company: json["company"],
|
||||
countryId: json["country_id"],
|
||||
country: countryValues.map[json["country"]],
|
||||
stateProvinceId: json["state_province_id"],
|
||||
city: cityValues.map[json["city"]],
|
||||
address1: json["address1"],
|
||||
address2: json["address2"],
|
||||
zipPostalCode: json["zip_postal_code"],
|
||||
phoneNumber: json["phone_number"],
|
||||
faxNumber: json["fax_number"],
|
||||
customerAttributes: json["customer_attributes"],
|
||||
createdOnUtc: DateTime.parse(json["created_on_utc"]),
|
||||
province: json["province"],
|
||||
latLong: json["lat_long"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"first_name": firstNameValues.reverse[firstName],
|
||||
"last_name": lastNameValues.reverse[lastName],
|
||||
"email": emailValues.reverse[email],
|
||||
"company": company,
|
||||
"country_id": countryId,
|
||||
"country": countryValues.reverse[country],
|
||||
"state_province_id": stateProvinceId,
|
||||
"city": cityValues.reverse[city],
|
||||
"address1": address1,
|
||||
"address2": address2,
|
||||
"zip_postal_code": zipPostalCode,
|
||||
"phone_number": phoneNumber,
|
||||
"fax_number": faxNumber,
|
||||
"customer_attributes": customerAttributes,
|
||||
"created_on_utc": createdOnUtc.toIso8601String(),
|
||||
"province": province,
|
||||
"lat_long": latLong,
|
||||
};
|
||||
}
|
||||
|
||||
enum City { RIYADH, AL_OYUN }
|
||||
|
||||
final cityValues = EnumValues({
|
||||
"Al Oyun": City.AL_OYUN,
|
||||
"Riyadh": City.RIYADH
|
||||
});
|
||||
|
||||
enum Country { SAUDI_ARABIA }
|
||||
|
||||
final countryValues = EnumValues({
|
||||
"Saudi Arabia": Country.SAUDI_ARABIA
|
||||
});
|
||||
|
||||
enum Email { TAMER_FANASHEH_GMAIL_COM, TAMER_DASDASDAS_GMAIL_COM }
|
||||
|
||||
final emailValues = EnumValues({
|
||||
"Tamer.dasdasdas@gmail.com": Email.TAMER_DASDASDAS_GMAIL_COM,
|
||||
"Tamer.fanasheh@gmail.com": Email.TAMER_FANASHEH_GMAIL_COM
|
||||
});
|
||||
|
||||
enum FirstName { TAMER, TAMER_FANASHEH }
|
||||
|
||||
final firstNameValues = EnumValues({
|
||||
"TAMER": FirstName.TAMER,
|
||||
"TAMER FANASHEH": FirstName.TAMER_FANASHEH
|
||||
});
|
||||
|
||||
enum LastName { FANASHEH, MUSA }
|
||||
|
||||
final lastNameValues = EnumValues({
|
||||
"FANASHEH": LastName.FANASHEH,
|
||||
"MUSA": LastName.MUSA
|
||||
});
|
||||
|
||||
class EnumValues<T> {
|
||||
Map<String, T> map;
|
||||
Map<T, String> reverseMap;
|
||||
|
||||
EnumValues(this.map);
|
||||
|
||||
Map<T, String> get reverse {
|
||||
if (reverseMap == null) {
|
||||
reverseMap = map.map((k, v) => new MapEntry(v, k));
|
||||
}
|
||||
return reverseMap;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,24 @@
|
||||
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyAddressesModel.dart';
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
|
||||
class PharmacyAddressesViewModel extends BaseViewModel {
|
||||
PharmacyAddressService _PharmacyAddressService = locator<PharmacyAddressService>();
|
||||
|
||||
List<PharmacyAddressesModel> get address => _PharmacyAddressService.address;
|
||||
|
||||
|
||||
Future getAddress() async {
|
||||
setState(ViewState.Busy);
|
||||
await _PharmacyAddressService.getAddress();
|
||||
if (_PharmacyAddressService.hasError) {
|
||||
error = _PharmacyAddressService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
||||
import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart';
|
||||
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
|
||||
import '../../../locator.dart';
|
||||
import '../base_view_model.dart';
|
||||
|
||||
class OrderModelViewModel extends BaseViewModel {
|
||||
OrderService _orderService = locator<OrderService>();
|
||||
List<OrderModel> get order => _orderService.orderList;
|
||||
|
||||
OrderDetailsService _orderDetailsService = locator<OrderDetailsService>();
|
||||
List<OrderModel> get orderDetails => _orderDetailsService.orderDetails;
|
||||
|
||||
|
||||
|
||||
|
||||
Future getOrder(id, pageId) async {
|
||||
setState(ViewState.Busy);
|
||||
await _orderService.getOrder(id,pageId);
|
||||
if (_orderService.hasError) {
|
||||
error = _orderService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Future getOrderDetails(orderId) async {
|
||||
setState(ViewState.Busy);
|
||||
await _orderDetailsService.getOrderDetails(orderId);
|
||||
if (_orderDetailsService.hasError) {
|
||||
error = _orderDetailsService.error;
|
||||
setState(ViewState.Error);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue