mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-11-22 08:13:20 +00:00
Module Client, écran StatScreen : les statistiques sont désormais actualisées à chaque vente
This commit is contained in:
parent
27ddeaee0d
commit
c57d910d7c
@ -16,6 +16,7 @@ import com.pqt.core.entities.user_account.Account;
|
||||
import com.pqt.core.entities.user_account.AccountLevel;
|
||||
|
||||
import javax.swing.event.EventListenerList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -47,7 +48,6 @@ class SaleScreenModel {
|
||||
if(saleId == SaleScreenModel.this.tempSaleId){
|
||||
SaleScreenModel.this.fireSaleValidatedEvent();
|
||||
}
|
||||
stockService.refreshProductList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -151,7 +151,7 @@ class SaleScreenModel {
|
||||
}
|
||||
|
||||
List<SaleType> getSaleTypeList() {
|
||||
return saleService.getSaleTypes();
|
||||
return new ArrayList<>(saleService.getSaleTypes());
|
||||
}
|
||||
|
||||
Sale getCurrentSale() {
|
||||
|
@ -42,7 +42,10 @@ class StatScreenView implements IFXComponent {
|
||||
.map(key->String.format(" * %s : %s", key, statistics.get(key)))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
Platform.runLater(()->lines.forEach(line -> statTextArea.appendText(line+"\n")));
|
||||
Platform.runLater(()-> {
|
||||
statTextArea.setText("");
|
||||
lines.forEach(line -> statTextArea.appendText(line + "\n"));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,6 +6,7 @@ import com.pqt.client.module.network.NetworkService;
|
||||
import com.pqt.client.module.network.listeners.INetworkServiceListener;
|
||||
import com.pqt.client.module.query.QueryExecutor;
|
||||
import com.pqt.client.module.sale.SaleService;
|
||||
import com.pqt.client.module.sale.listeners.ISaleListener;
|
||||
import com.pqt.client.module.stat.StatService;
|
||||
import com.pqt.client.module.stock.StockService;
|
||||
|
||||
@ -48,6 +49,24 @@ public class ClientBackEndModuleManager {
|
||||
statService.refreshStats();
|
||||
}
|
||||
});
|
||||
|
||||
saleService.addListener(new ISaleListener() {
|
||||
@Override
|
||||
public void onSaleValidationSuccess(long saleId) {
|
||||
stockService.refreshProductList();
|
||||
statService.refreshStats();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaleValidationError(long saleId, Throwable cause) {
|
||||
//No-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaleValidationRefused(long saleId, Throwable cause) {
|
||||
//No-op
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public SaleService getSaleService() {
|
||||
|
Loading…
Reference in New Issue
Block a user