@ -1,5 +1,6 @@
package info.bukova.isspst.ui.tripbill ;
package info.bukova.isspst.ui.tripbill ;
import info.bukova.isspst.StringUtils ;
import info.bukova.isspst.data.RequirementState ;
import info.bukova.isspst.data.RequirementState ;
import info.bukova.isspst.data.TripBill ;
import info.bukova.isspst.data.TripBill ;
import info.bukova.isspst.data.TripBillApproval ;
import info.bukova.isspst.data.TripBillApproval ;
@ -8,6 +9,7 @@ import info.bukova.isspst.services.tripbill.TripBillApprovalService;
import info.bukova.isspst.services.tripbill.TripBillService ;
import info.bukova.isspst.services.tripbill.TripBillService ;
import info.bukova.isspst.services.users.UserService ;
import info.bukova.isspst.services.users.UserService ;
import info.bukova.isspst.ui.requirement.RequirementSubpage ;
import info.bukova.isspst.ui.requirement.RequirementSubpage ;
import org.zkoss.bind.BindUtils ;
import org.zkoss.bind.annotation.BindingParam ;
import org.zkoss.bind.annotation.BindingParam ;
import org.zkoss.bind.annotation.Command ;
import org.zkoss.bind.annotation.Command ;
import org.zkoss.bind.annotation.ExecutionArgParam ;
import org.zkoss.bind.annotation.ExecutionArgParam ;
@ -15,7 +17,10 @@ import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init ;
import org.zkoss.bind.annotation.Init ;
import org.zkoss.bind.annotation.NotifyChange ;
import org.zkoss.bind.annotation.NotifyChange ;
import org.zkoss.zk.ui.Executions ;
import org.zkoss.zk.ui.Executions ;
import org.zkoss.zk.ui.event.Event ;
import org.zkoss.zk.ui.event.EventListener ;
import org.zkoss.zk.ui.select.annotation.WireVariable ;
import org.zkoss.zk.ui.select.annotation.WireVariable ;
import org.zkoss.zul.Messagebox ;
import org.zkoss.zul.Window ;
import org.zkoss.zul.Window ;
import java.util.ArrayList ;
import java.util.ArrayList ;
@ -121,10 +126,29 @@ public class TripBillSummaryVM extends RequirementSubpage<TripBillApproval> {
@GlobalCommand
@GlobalCommand
@NotifyChange ( "dataBean" )
@NotifyChange ( "dataBean" )
public void reload ( ) {
public void reload ( ) {
if ( bill . getApproval ( ) ! = null ) {
setDataBean ( tripBillApprovalService . getById ( bill . getApproval ( ) . getId ( ) ) ) ;
setDataBean ( tripBillApprovalService . getById ( bill . getApproval ( ) . getId ( ) ) ) ;
}
}
}
public Map < Integer , Boolean > getSelTab ( ) {
public Map < Integer , Boolean > getSelTab ( ) {
return selTab ;
return selTab ;
}
}
@Command
public void cancelApproval ( ) {
Messagebox . show ( StringUtils . localize ( "TripBillCancelApprovalQuestion" ) , StringUtils . localize ( "TripBillCancelApprovalTitle" ) , Messagebox . YES
| Messagebox . NO , Messagebox . QUESTION , new EventListener < Event > ( ) {
@Override
public void onEvent ( Event event ) throws Exception {
if ( ( ( Integer ) event . getData ( ) ) . intValue ( ) = = Messagebox . YES ) {
tripBillApprovalService . cancelApproval ( bill ) ;
setDataBean ( null ) ;
BindUtils . postNotifyChange ( null , null , TripBillSummaryVM . this , "bill" ) ;
BindUtils . postNotifyChange ( null , null , TripBillSummaryVM . this , "dataBean" ) ;
BindUtils . postNotifyChange ( null , null , TripBillSummaryVM . this , "canApprove" ) ;
}
}
} ) ;
}
}
}