update carton and fcs shipment
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:fcs/pages/main/model/base_model.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:path/path.dart' as Path;
|
||||
|
||||
import '../../../domain/entities/shipment.dart';
|
||||
import '../../../pagination/paginator_listener.dart';
|
||||
|
||||
class InvoiceModel extends BaseModel {
|
||||
@@ -105,4 +106,28 @@ class InvoiceModel extends BaseModel {
|
||||
Future<void> cancelInvoice(Invoice invoice) {
|
||||
return Services.instance.invoiceService.cancelInvoice(invoice);
|
||||
}
|
||||
|
||||
Future<List<Shipment?>?> getShipmentWithHandlingFee(
|
||||
String fcsShipmentID, String userID) async {
|
||||
String path = "/$shipments_collection";
|
||||
try {
|
||||
var q = FirebaseFirestore.instance
|
||||
.collection(path)
|
||||
.where("user_id", isEqualTo: userID)
|
||||
.where("is_deleted", isEqualTo: false)
|
||||
.where("handling_fee", isGreaterThan: 0)
|
||||
.where("fcs_shipment_id", isEqualTo: fcsShipmentID);
|
||||
var snaps = await q.get(const GetOptions(source: Source.server));
|
||||
List<Shipment?> shipments = snaps.docs.map((snap) {
|
||||
if (snap.exists) {
|
||||
var s = Shipment.fromMap(snap.data as Map<String, dynamic>, snap.id);
|
||||
return s;
|
||||
}
|
||||
}).toList();
|
||||
return shipments;
|
||||
} catch (e) {
|
||||
log.warning("Error!! $e");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user