From b71f3a9bef97ac8001bc70251eb187a2cfb84020 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Sun, 20 Jul 2014 20:47:32 +0200 Subject: [PATCH] =?UTF-8?q?Do=20glob=C3=A1ln=C3=ADho=20nastaven=C3=AD=20by?= =?UTF-8?q?ly=20p=C5=99id=C3=A1ny=20dopravn=C3=AD=20prost=C5=99edky.=20ref?= =?UTF-8?q?s=20#101?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../info/bukova/isspst/data/SettingsData.java | 10 +++ .../java/info/bukova/isspst/data/Vehicle.java | 67 +++++++++++++++++++ .../isspst/ui/settings/GlobalSettingsVM.java | 13 ++++ .../WEB-INF/locales/zk-label.properties | 7 ++ .../webapp/settings/global/travelOrders.zul | 23 +++++++ src/main/webapp/settings/globalSettings.zul | 6 +- 6 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 src/main/java/info/bukova/isspst/data/Vehicle.java create mode 100644 src/main/webapp/settings/global/travelOrders.zul diff --git a/src/main/java/info/bukova/isspst/data/SettingsData.java b/src/main/java/info/bukova/isspst/data/SettingsData.java index 23125e93..3907d38a 100644 --- a/src/main/java/info/bukova/isspst/data/SettingsData.java +++ b/src/main/java/info/bukova/isspst/data/SettingsData.java @@ -16,6 +16,7 @@ public class SettingsData { private String bankName; private String accountNumber; private String bankCode; + private List vehicles; public SettingsData() { newReqTemplate = new MailMessage(); @@ -23,6 +24,7 @@ public class SettingsData { confReqTemplate = new MailMessage(); mainAddress = new Address(); shippingAddrs = new ArrayList
(); + vehicles = new ArrayList(); } public boolean isEnableRequirements() { @@ -97,4 +99,12 @@ public class SettingsData { this.bankCode = bankCode; } + public List getVehicles() { + return vehicles; + } + + public void setVehicles(List vehicles) { + this.vehicles = vehicles; + } + } diff --git a/src/main/java/info/bukova/isspst/data/Vehicle.java b/src/main/java/info/bukova/isspst/data/Vehicle.java new file mode 100644 index 00000000..e0a9da88 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/Vehicle.java @@ -0,0 +1,67 @@ +package info.bukova.isspst.data; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class Vehicle { + + @Column(name = "VEHICLE_CODE") + private String code; + @Column(name = "VEHICLE_DESCRIPTION") + private String description; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((code == null) ? 0 : code.hashCode()); + result = prime * result + + ((description == null) ? 0 : description.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Vehicle other = (Vehicle) obj; + if (code == null) { + if (other.code != null) + return false; + } else if (!code.equals(other.code)) + return false; + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + return true; + } + + @Override + public String toString() { + return code + (description != null ? " - " + description : ""); + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java b/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java index 658f2269..1ee533aa 100644 --- a/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java +++ b/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java @@ -12,6 +12,7 @@ import org.zkoss.zul.Window; import info.bukova.isspst.data.Address; import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.SettingsData; +import info.bukova.isspst.data.Vehicle; import info.bukova.isspst.mail.MailMessage; import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.sort.ReflectionTools; @@ -70,6 +71,18 @@ public class GlobalSettingsVM { public void removeAddress(@BindingParam("addr") Address addr) { settings.getShippingAddrs().remove(addr); } + + @Command + @NotifyChange("settings") + public void addVehicle() { + settings.getVehicles().add(new Vehicle()); + } + + @Command + @NotifyChange("settings") + public void removeVehicle(@BindingParam("vehicle") Vehicle vehicle) { + settings.getVehicles().remove(vehicle); + } public Address getSelAddress() { return selAddress; diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 82410706..4edf85ce 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -12,6 +12,11 @@ RequirementsFormDeliveryDate=Datum dodání RequirementsFormFrom=Z RequirementsFormTo=Do RequirementsFormPurpose=Účel cesty +RequirementsFormStartDateTime=Datum a čas odjezdu +RequirementsFormEndTravel=Konec cesty +RequirementsFormEndDate=Datum příjezdu +RequirementsFormPassengers=Spolucestující: +RequirementsFormVehicle=Dopravní prostředek: RequirementsGridNumberSerie=Číslo RequirementsGridReqDate=Datum požadavku RequirementsGridCenter=Středisko @@ -150,6 +155,8 @@ BankInfo=Banka BankName=Název BankCode=Kód banky AccountNumber=Číslo účtu +TravelOrders=Cestovní příkazy +GlobalSettingsVehicles=Dopravní prostředky CentresForRequirements=Střediska, pro která lze vkládat požadavky WorkgroupMembership=Členství v komisích diff --git a/src/main/webapp/settings/global/travelOrders.zul b/src/main/webapp/settings/global/travelOrders.zul new file mode 100644 index 00000000..08ba275c --- /dev/null +++ b/src/main/webapp/settings/global/travelOrders.zul @@ -0,0 +1,23 @@ + + + +