update carton and fcs shipment

This commit is contained in:
tzw
2025-02-17 20:13:30 +06:30
parent ffaa715333
commit 0295a29c44
33 changed files with 171 additions and 2383 deletions

View File

@@ -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;
}
}