Skip to content

Commit ba54e05

Browse files
Bifulco LuigiBifulco Luigi
Bifulco Luigi
authored and
Bifulco Luigi
committed
fix
1 parent 76f6d3e commit ba54e05

File tree

7 files changed

+88
-15
lines changed

7 files changed

+88
-15
lines changed

appify/appify-core/src/main/java/it/appify/notification/NotificationImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private native final void _showNotification(String message, NotificationCallback
2424
// effect : 'slidetop',
2525
layout : 'growl',
2626
effect : 'genie',
27-
27+
ttl : 3000,
2828
type : 'notice', // notice, warning, error or success
2929
onClose : function() {
3030
if(callback!=null){

appify/appify-examples/src/main/java/it/appify/examples/emsmobile/controller/ActivationController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ public void onPageReady() {
9292
} else {
9393
ConsoleLogger.getConsoleLogger().log("THERE ARE NO PHASES TO PROCESS IN THE ACTIVATION");
9494
}
95+
96+
model.setParked(false);
97+
app.updateAppState(model);
9598
}
9699

97100
@ViewHandler(eventType="click", viewId="dump118Btn")

appify/appify-examples/src/main/java/it/appify/examples/emsmobile/controller/DumpController.java

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public DumpController(WebApp<EmsMobileModel> app) {
4646
@OnPageReady
4747
public void onPageReady() {
4848
if (firstTime) {
49-
firstTime=false;
49+
firstTime = false;
5050
app.notify(Notification.NOTICE, "La maschera di inizio turno &egrave stata integrata con il dump del sinottico", new NotificationCallback() {
5151

5252
@Override
@@ -56,6 +56,7 @@ public void onClose() {
5656
}
5757
});
5858
}
59+
5960
ConsoleLogger.getConsoleLogger().log("onPageReady DumpController");
6061

6162
dumpTopBar.toggleClassName("progress-space");
@@ -76,20 +77,40 @@ public void onClose() {
7677
/* test */
7778

7879
EmsMobileModel model = this.app.getCurrentAppState();
80+
if (model.isParked()) {
81+
this.app.getCurrentPage().disableElement("parkingButton");
82+
} else {
83+
this.app.getCurrentPage().enableElement("parkingButton");
84+
}
7985
if (model.getActivation() != null) {
8086
ConsoleLogger.getConsoleLogger().log("ACTIVATION IS NOT NULL MOVING TO ACTIVATION PAGE");
81-
//app.moveTo("activationPage");
87+
// app.moveTo("activationPage");
8288
} else {
83-
if(model.getBarStatus().getVehicleCode()!=null){
89+
if (model.getBarStatus().getVehicleCode() != null) {
8490
app.notify(Notification.NOTICE, "Il sistema &egrave pronto per ricevere attivazioni dalla centrale operativa");
85-
}
86-
else{
91+
} else {
8792
app.notify(Notification.NOTICE, "Per poter ricevere attivazioni dalla centrale &egrave necessario entrare in turno");
8893
}
8994
ConsoleLogger.getConsoleLogger().log("ACTIVATION IS NULL");
9095
}
9196

9297
}
98+
99+
@ViewHandler(eventType = "click", viewId = "parkingButton")
100+
public void parking(){
101+
EmsMobileModel model = app.<EmsMobileModel>getCurrentAppState();
102+
app.getCurrentPage().disableElement("parkingButton");
103+
model.setParked(true);
104+
app.updateAppState(model);
105+
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
106+
107+
@Override
108+
public boolean execute() {
109+
app.notify(Notification.NOTICE, "Lo stato di parcheggio &egrave; stato correttamente inviato in centrale");
110+
return false;
111+
}
112+
}, 1000);
113+
}
93114

94115
@ViewHandler(eventType = "click", viewId = "lastEmergencyBtn")
95116
public void viewLastEmergency() {
@@ -148,10 +169,13 @@ public boolean execute() {
148169
// app.getScreenOrientationService().exitFullScreen();
149170
EmsMobileModel model = app.<EmsMobileModel> getCurrentAppState();
150171
model.getBarStatus().setVehicleCode(null);
151-
model.setCheckInLabel("Inizio Turno");
172+
model.getBarStatus().setCheckInDate(null);
173+
model.setParked(false);
174+
model.setCheckInLabel("Inizio Turno");
152175
app.updateAppState(model);
153176
app.getCurrentPage().unmask();
154-
//app.getCurrentPage().popover("checkInAccels", "Orario inizio turno", model.getBarStatus().getCheckInDate(), "fade");
177+
// app.getCurrentPage().popover("checkInAccels", "Orario inizio turno",
178+
// model.getBarStatus().getCheckInDate(), "fade");
155179
ActivationService service = Registry.get("ActivationService");
156180
service.scheduleActivation();
157181

appify/appify-examples/src/main/java/it/appify/examples/emsmobile/controller/HospitalController.java

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package it.appify.examples.emsmobile.controller;
22

3+
import com.google.gwt.core.client.Scheduler;
4+
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
35
import com.google.gwt.dom.client.Element;
46

57
import it.appify.annotations.Controller;
@@ -79,12 +81,22 @@ public void onCloseModal() {
7981
@ViewModelHandler(modelType = Item.class, viewId = "hospitalList")
8082
public void onItemReceived(final Item i) {
8183
ConsoleLogger.getConsoleLogger().log("Received item from hospitalList: " + i.getCode() + " - " + i.getItemName());
82-
EmsMobileModel model = app.<EmsMobileModel> getCurrentAppState();
83-
Patient currP = model.getActivation().getCurrentPatient();
84-
currP.setHospital(i);
85-
model.getActivation().updateCurrentPatient(currP);
86-
app.updateAppState(model);
87-
app.back();
84+
// EmsMobileModel model = app.<EmsMobileModel> getCurrentAppState();
85+
// Patient currP = model.getActivation().getCurrentPatient();
86+
// currP.setHospital(i);
87+
// model.getActivation().updateCurrentPatient(currP);
88+
EmsMobileModel model = updatePatientData(i);
89+
ConsoleLogger.getConsoleLogger().log("setted hospital to current patient: " + model.getActivation().getCurrentPatient().getHospital().getItemName());
90+
// app.updateAppState(model);
91+
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
92+
93+
@Override
94+
public boolean execute() {
95+
app.back();
96+
return false;
97+
}
98+
}, 500);
99+
88100
}
89101

90102
public Element getWaitModalText() {
@@ -94,5 +106,24 @@ public Element getWaitModalText() {
94106
public void setWaitModalText(Element waitModalText) {
95107
this.waitModalText = waitModalText;
96108
}
109+
110+
private EmsMobileModel updatePatientData(Item hospital) {
111+
ConsoleLogger.getConsoleLogger().log("updatePatientData");
112+
EmsMobileModel model = app.<EmsMobileModel> getCurrentAppState();
113+
if (model.getActivation() == null) {
114+
return null;
115+
}
116+
Patient p = model.getActivation().getCurrentPatient();
117+
if (p == null) {
118+
p = new Patient();
119+
}
120+
p.setHospital(hospital);
121+
model.getActivation().updateCurrentPatient(p);
122+
model.getActivation().setCurrentBackupPatient(p);
123+
app.updateAppState(model);
124+
ConsoleLogger.getConsoleLogger().log("updatePatientData sucess");
125+
return model;
126+
127+
}
97128

98129
}

appify/appify-examples/src/main/java/it/appify/examples/emsmobile/controller/PatientController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public void selectSanEval() {
127127
public void hospitalChoice() {
128128
ConsoleLogger.getConsoleLogger().log("hospitalChoice");
129129
// app.getCurrentPage().showModal("criticityEndModal");
130+
updatePatientData();
130131
app.moveTo("hospitalsPage");
131132
}
132133

appify/appify-examples/src/main/java/it/appify/examples/emsmobile/model/EmsMobileModel.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class EmsMobileModel implements Serializable, Storable {
3838
private List<Item> criticityEnds;
3939
private List<Item> results;
4040
private List<Item> hospitals;
41+
private boolean parked = false;
4142

4243
public EmsMobileModel() {
4344
activation = new Activation();
@@ -194,6 +195,14 @@ public String getVersion() {
194195

195196
public void setVersion(String version) {
196197
this.version = version;
198+
}
199+
200+
public boolean isParked() {
201+
return parked;
202+
}
203+
204+
public void setParked(boolean parked) {
205+
this.parked = parked;
197206
}
198207

199208
public void backupLastEmergency(){

appify/appify-examples/src/main/java/it/appify/examples/emsmobile/service/ConnectionStateService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ else if(status.equals(ApplicationCache.OBSOLETE)){
5959
}
6060
app.updateAppState(model);
6161
// app.getCurrentPage().popover("reloadBtn", "Stato Cache", status+" - "+model.getVersion(), "fade");
62-
app.getCurrentPage().popover("checkInAccels", "Orario inizio turno", model.getBarStatus().getCheckInDate(), "fade");
62+
if( model.getBarStatus().getCheckInDate()!=null){
63+
app.getCurrentPage().popover("checkInAccels", "Orario inizio turno", model.getBarStatus().getCheckInDate(), "fade");
64+
}
65+
else{
66+
app.getCurrentPage().popover("checkInAccels", "Non sei in turno", "", "fade");
67+
}
6368
this.app.getApplicationCacheService().getConnetionStatus(new CheckConnectedCallback() {
6469

6570
@Override

0 commit comments

Comments
 (0)