add shipments
This commit is contained in:
28
lib/data/provider/carton_data_provider.dart
Normal file
28
lib/data/provider/carton_data_provider.dart
Normal 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());
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user