add shipments

This commit is contained in:
Sai Naw Wun
2020-10-19 05:13:49 +06:30
parent 4f8bde40b0
commit c619ae3f22
57 changed files with 1886 additions and 724 deletions

View File

@@ -0,0 +1,28 @@
import 'dart:async';
import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/helpers/api_helper.dart';
import 'package:fcs/helpers/firebase_helper.dart';
import 'package:logging/logging.dart';
class CartonDataProvider {
final log = Logger('CartonDataProvider');
static final CartonDataProvider instance = CartonDataProvider._();
CartonDataProvider._();
Future<void> createCarton(Carton carton) async {
return await requestAPI("/cartons", "POST",
payload: carton.toMap(), token: await getToken());
}
Future<void> updateCarton(Carton carton) async {
return await requestAPI("/cartons", "PUT",
payload: carton.toMap(), token: await getToken());
}
Future<void> deleteCarton(Carton carton) async {
return await requestAPI("/cartons", "DELETE",
payload: carton.toMap(), token: await getToken());
}
}

View File

@@ -20,4 +20,9 @@ class FcsShipmentDataProvider {
return await requestAPI("/fcs_shipments", "DELETE",
payload: fcsShipment.toMap(), token: await getToken());
}
Future<void> ship(FcsShipment fcsShipment) async {
return await requestAPI("/fcs_shipments/ship", "PUT",
payload: fcsShipment.toMap(), token: await getToken());
}
}

View File

@@ -26,8 +26,43 @@ class ShipmentDataProvider {
payload: shipment.toMap(), token: await getToken());
}
Future<void> assignShipment(Shipment shipment) async {
return await requestAPI("/shipments/assign", "PUT",
payload: shipment.toMap(), token: await getToken());
}
Future<void> completeAssignShipment(Shipment shipment) async {
return await requestAPI("/shipments/assign/complete", "PUT",
payload: shipment.toMap(), token: await getToken());
}
Future<void> completePickupShipment(Shipment shipment) async {
return await requestAPI("/shipments/pickup/complete", "PUT",
payload: shipment.toMap(), token: await getToken());
}
Future<void> packShipment(Shipment shipment) async {
return await requestAPI("/shipments/pack", "PUT",
payload: shipment.toMap(), token: await getToken());
}
Future<void> completePackShipment(Shipment shipment) async {
return await requestAPI("/shipments/pack/complete", "PUT",
payload: shipment.toMap(), token: await getToken());
}
Future<void> confirmShipment(Shipment shipment) async {
return await requestAPI("/shipment_confirm", "PUT",
return await requestAPI("/shipments/confirm", "PUT",
payload: shipment.toMap(), token: await getToken());
}
Future<void> completeConfirmShipment(Shipment shipment) async {
return await requestAPI("/shipments/confirm/complete", "PUT",
payload: shipment.toMap(), token: await getToken());
}
Future<void> completeReceiveShipment(Shipment shipment) async {
return await requestAPI("/shipments/receive/complete", "PUT",
payload: shipment.toMap(), token: await getToken());
}