fix fcs shipment service
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/constants.dart';
|
||||
import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
|
||||
@@ -219,7 +219,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 3), child: cancelBtn)
|
||||
: Container(),
|
||||
_fcsShipment?.status == fcs_shipment_processing_status
|
||||
_fcsShipment?.status == fcs_shipment_processed_status
|
||||
? shipBtn
|
||||
: Container(),
|
||||
_fcsShipment?.status == fcs_shipment_shipped_status
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:fcs/data/services/services.dart';
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/constants.dart';
|
||||
import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||
import 'package:fcs/pages/main/model/base_model.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
@@ -41,9 +41,9 @@ class FcsShipmentModel extends BaseModel {
|
||||
|
||||
// processing status
|
||||
if (index == 2) {
|
||||
col = col.where("status", isEqualTo: fcs_shipment_processing_status);
|
||||
col = col.where("status", isEqualTo: fcs_shipment_processed_status);
|
||||
pageQuery =
|
||||
pageQuery.where("status", isEqualTo: fcs_shipment_processing_status);
|
||||
pageQuery.where("status", isEqualTo: fcs_shipment_processed_status);
|
||||
}
|
||||
|
||||
// shipped status
|
||||
@@ -87,7 +87,7 @@ class FcsShipmentModel extends BaseModel {
|
||||
try {
|
||||
var snaps = await FirebaseFirestore.instance
|
||||
.collection("/$fcs_shipment_collection")
|
||||
.where("status", isEqualTo: fcs_shipment_processing_status)
|
||||
.where("status", isEqualTo: fcs_shipment_processed_status)
|
||||
.get(const GetOptions(source: Source.server));
|
||||
fcsShipments = snaps.docs.map((documentSnapshot) {
|
||||
var fcs =
|
||||
@@ -176,23 +176,28 @@ class FcsShipmentModel extends BaseModel {
|
||||
}
|
||||
|
||||
Future<void> process(String id) {
|
||||
return Services.instance.fcsShipmentService.processFcsShipment(id);
|
||||
return Services.instance.fcsShipmentService
|
||||
.updateFcsShipmentStatus(id, fcs_shipment_processed_status);
|
||||
}
|
||||
|
||||
Future<void> ship(String id) {
|
||||
return Services.instance.fcsShipmentService.shipFcsShipment(id);
|
||||
return Services.instance.fcsShipmentService
|
||||
.updateFcsShipmentStatus(id, fcs_shipment_shipped_status);
|
||||
}
|
||||
|
||||
Future<void> arrive(String id) {
|
||||
return Services.instance.fcsShipmentService.arriveFcsShipment(id);
|
||||
return Services.instance.fcsShipmentService
|
||||
.updateFcsShipmentStatus(id, fcs_shipment_arrived_status);
|
||||
}
|
||||
|
||||
Future<void> invoice(String id) {
|
||||
return Services.instance.fcsShipmentService.invoiceFcsShipment(id);
|
||||
return Services.instance.fcsShipmentService
|
||||
.updateFcsShipmentStatus(id, fcs_shipment_shipped_status);
|
||||
}
|
||||
|
||||
Future<void> cancel(String id) {
|
||||
return Services.instance.fcsShipmentService.cancelFcsShipment(id);
|
||||
return Services.instance.fcsShipmentService
|
||||
.updateFcsShipmentStatus(id, fcs_shipment_canceled_status);
|
||||
}
|
||||
|
||||
Future<String> report(FcsShipment fcsShipment) {
|
||||
@@ -205,7 +210,7 @@ class FcsShipmentModel extends BaseModel {
|
||||
var snaps = await FirebaseFirestore.instance
|
||||
.collection("/$fcs_shipment_collection")
|
||||
.where("status", whereIn: [
|
||||
fcs_shipment_processing_status,
|
||||
fcs_shipment_processed_status,
|
||||
fcs_shipment_shipped_status,
|
||||
fcs_shipment_arrived_status,
|
||||
fcs_shipment_invoiced_status
|
||||
|
||||
Reference in New Issue
Block a user