Do globálního nastavení byla přidaná sekce pro nastavení cestovních
náhrad. refs #112
This commit is contained in:
@@ -6,6 +6,7 @@ import info.bukova.isspst.data.NumberSeries;
|
|||||||
import info.bukova.isspst.data.Permission;
|
import info.bukova.isspst.data.Permission;
|
||||||
import info.bukova.isspst.data.RequirementType;
|
import info.bukova.isspst.data.RequirementType;
|
||||||
import info.bukova.isspst.data.Role;
|
import info.bukova.isspst.data.Role;
|
||||||
|
import info.bukova.isspst.data.SettingsData;
|
||||||
import info.bukova.isspst.data.User;
|
import info.bukova.isspst.data.User;
|
||||||
import info.bukova.isspst.reporting.Report;
|
import info.bukova.isspst.reporting.Report;
|
||||||
import info.bukova.isspst.reporting.ReportMapping;
|
import info.bukova.isspst.reporting.ReportMapping;
|
||||||
@@ -18,6 +19,7 @@ import info.bukova.isspst.services.users.PermissionService;
|
|||||||
import info.bukova.isspst.services.users.RoleService;
|
import info.bukova.isspst.services.users.RoleService;
|
||||||
import info.bukova.isspst.services.users.UserService;
|
import info.bukova.isspst.services.users.UserService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
@@ -273,6 +275,20 @@ public class AppInitListener implements ServletContextListener {
|
|||||||
gSettingsService.add(gs);
|
gSettingsService.add(gs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SettingsData data = gSettingsService.getSettings();
|
||||||
|
if (data.getRefunds().isEmpty()) {
|
||||||
|
BigDecimal[] refunds0 = {BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO,BigDecimal.ZERO};
|
||||||
|
BigDecimal[] refunds5 = {BigDecimal.valueOf(70),BigDecimal.valueOf(21),BigDecimal.ZERO,BigDecimal.ZERO};
|
||||||
|
BigDecimal[] refunds12 = {BigDecimal.valueOf(105),BigDecimal.valueOf(68),BigDecimal.valueOf(32),BigDecimal.ZERO};
|
||||||
|
BigDecimal[] refunds18 = {BigDecimal.valueOf(165),BigDecimal.valueOf(124),BigDecimal.valueOf(83),BigDecimal.valueOf(42)};
|
||||||
|
|
||||||
|
data.getRefunds().put(0, refunds0);
|
||||||
|
data.getRefunds().put(5, refunds5);
|
||||||
|
data.getRefunds().put(12, refunds12);
|
||||||
|
data.getRefunds().put(18, refunds18);
|
||||||
|
|
||||||
|
gSettingsService.updateSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package info.bukova.isspst.data;
|
package info.bukova.isspst.data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import info.bukova.isspst.mail.MailMessage;
|
import info.bukova.isspst.mail.MailMessage;
|
||||||
|
|
||||||
@@ -17,6 +20,7 @@ public class SettingsData {
|
|||||||
private String accountNumber;
|
private String accountNumber;
|
||||||
private String bankCode;
|
private String bankCode;
|
||||||
private List<Vehicle> vehicles;
|
private List<Vehicle> vehicles;
|
||||||
|
private Map<Integer, BigDecimal[]> refunds;
|
||||||
|
|
||||||
public SettingsData() {
|
public SettingsData() {
|
||||||
newReqTemplate = new MailMessage();
|
newReqTemplate = new MailMessage();
|
||||||
@@ -25,6 +29,7 @@ public class SettingsData {
|
|||||||
mainAddress = new Address();
|
mainAddress = new Address();
|
||||||
shippingAddrs = new ArrayList<Address>();
|
shippingAddrs = new ArrayList<Address>();
|
||||||
vehicles = new ArrayList<Vehicle>();
|
vehicles = new ArrayList<Vehicle>();
|
||||||
|
refunds = new HashMap<Integer, BigDecimal[]>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnableRequirements() {
|
public boolean isEnableRequirements() {
|
||||||
@@ -107,4 +112,12 @@ public class SettingsData {
|
|||||||
this.vehicles = vehicles;
|
this.vehicles = vehicles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Integer, BigDecimal[]> getRefunds() {
|
||||||
|
return refunds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefunds(Map<Integer, BigDecimal[]> refunds) {
|
||||||
|
this.refunds = refunds;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
|
||||||
|
"http://castor.codehaus.org/mapping.dtd">
|
||||||
|
|
||||||
|
<mapping>
|
||||||
|
|
||||||
|
<class name="info.bukova.isspst.data.SettingsData" auto-complete="true" >
|
||||||
|
<map-to xml="settings-data"/>
|
||||||
|
<field name="refunds" collection="map">
|
||||||
|
|
||||||
|
<bind-xml name="refunds">
|
||||||
|
<class name="org.exolab.castor.mapping.MapItem">
|
||||||
|
<field name="key" type="java.lang.Integer">
|
||||||
|
<bind-xml name="key" node="attribute" />
|
||||||
|
</field>
|
||||||
|
<field name="value" collection="array" type="java.math.BigDecimal">
|
||||||
|
<bind-xml name="nested" />
|
||||||
|
</field>
|
||||||
|
</class>
|
||||||
|
</bind-xml>
|
||||||
|
</field>
|
||||||
|
</class>
|
||||||
|
|
||||||
|
</mapping>
|
||||||
@@ -1,14 +1,5 @@
|
|||||||
package info.bukova.isspst.ui.settings;
|
package info.bukova.isspst.ui.settings;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.BindingParam;
|
|
||||||
import org.zkoss.bind.annotation.Command;
|
|
||||||
import org.zkoss.bind.annotation.Init;
|
|
||||||
import org.zkoss.bind.annotation.NotifyChange;
|
|
||||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
|
||||||
import org.zkoss.zul.Window;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Address;
|
import info.bukova.isspst.data.Address;
|
||||||
import info.bukova.isspst.data.Requirement;
|
import info.bukova.isspst.data.Requirement;
|
||||||
import info.bukova.isspst.data.SettingsData;
|
import info.bukova.isspst.data.SettingsData;
|
||||||
@@ -18,6 +9,18 @@ import info.bukova.isspst.services.settings.GlobalSettingsService;
|
|||||||
import info.bukova.isspst.sort.ReflectionTools;
|
import info.bukova.isspst.sort.ReflectionTools;
|
||||||
import info.bukova.isspst.ui.LocaleConverter;
|
import info.bukova.isspst.ui.LocaleConverter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.zkoss.bind.annotation.BindingParam;
|
||||||
|
import org.zkoss.bind.annotation.Command;
|
||||||
|
import org.zkoss.bind.annotation.Init;
|
||||||
|
import org.zkoss.bind.annotation.NotifyChange;
|
||||||
|
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||||
|
import org.zkoss.zul.Window;
|
||||||
|
|
||||||
public class GlobalSettingsVM {
|
public class GlobalSettingsVM {
|
||||||
|
|
||||||
@WireVariable
|
@WireVariable
|
||||||
@@ -25,11 +28,13 @@ public class GlobalSettingsVM {
|
|||||||
private SettingsData settings;
|
private SettingsData settings;
|
||||||
private LocaleConverter locConverter;
|
private LocaleConverter locConverter;
|
||||||
private Address selAddress;
|
private Address selAddress;
|
||||||
|
private List<Integer> refundsHours;
|
||||||
|
|
||||||
@Init
|
@Init
|
||||||
public void init() {
|
public void init() {
|
||||||
settings = settingsService.getSettings();
|
settings = settingsService.getSettings();
|
||||||
locConverter = new LocaleConverter();
|
locConverter = new LocaleConverter();
|
||||||
|
setRefundsHours(settings.getRefunds().keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsData getSettings() {
|
public SettingsData getSettings() {
|
||||||
@@ -92,4 +97,13 @@ public class GlobalSettingsVM {
|
|||||||
this.selAddress = selAddress;
|
this.selAddress = selAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> getRefundsHours() {
|
||||||
|
return refundsHours;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRefundsHours(Set<Integer> refundsHours) {
|
||||||
|
this.refundsHours = new ArrayList<Integer>(settings.getRefunds().keySet());
|
||||||
|
Collections.sort(this.refundsHours);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,6 +157,9 @@ BankCode=Kód banky
|
|||||||
AccountNumber=Číslo účtu
|
AccountNumber=Číslo účtu
|
||||||
TravelOrders=Cestovní příkazy
|
TravelOrders=Cestovní příkazy
|
||||||
GlobalSettingsVehicles=Dopravní prostředky
|
GlobalSettingsVehicles=Dopravní prostředky
|
||||||
|
GlobalSettingsRefunds=Náhrady
|
||||||
|
GlobalSettingsFreeMealsCount=Počet jídel zdarma
|
||||||
|
GlobalSettingsHours=Hodin
|
||||||
|
|
||||||
CentresForRequirements=Střediska, pro která lze vkládat požadavky
|
CentresForRequirements=Střediska, pro která lze vkládat požadavky
|
||||||
WorkgroupMembership=Členství v komisích
|
WorkgroupMembership=Členství v komisích
|
||||||
|
|||||||
@@ -275,6 +275,11 @@
|
|||||||
<prop key="org.exolab.castor.xml.introspector.primitive.nodetype">element</prop>
|
<prop key="org.exolab.castor.xml.introspector.primitive.nodetype">element</prop>
|
||||||
</props>
|
</props>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="mappingLocations">
|
||||||
|
<list>
|
||||||
|
<value>info/bukova/isspst/services/settings/mappingSettings.xml</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="unmarshallerSettings" class="org.castor.spring.xml.CastorUnmarshallerFactoryBean">
|
<bean id="unmarshallerSettings" class="org.castor.spring.xml.CastorUnmarshallerFactoryBean">
|
||||||
|
|||||||
@@ -1,8 +1,41 @@
|
|||||||
<?page title="travel orders" contentType="text/html;charset=UTF-8"?>
|
<?page title="travel orders" contentType="text/html;charset=UTF-8"?>
|
||||||
<zk>
|
<zk>
|
||||||
<vbox>
|
<tabbox>
|
||||||
<label value="Dopravní prostředky:"/>
|
<tabs>
|
||||||
<button label="${labels.AddItem}" onClick="@command('addVehicle')"/>
|
<tab label="${labels.GlobalSettingsRefunds}"/>
|
||||||
|
<tab label="${labels.GlobalSettingsVehicles}"/>
|
||||||
|
</tabs>
|
||||||
|
<tabpanels>
|
||||||
|
<tabpanel>
|
||||||
|
<grid model="@load(vm.refundsHours)">
|
||||||
|
<auxhead>
|
||||||
|
<auxheader colspan="1"/>
|
||||||
|
<auxheader label="${labels.GlobalSettingsFreeMealsCount}" colspan="4"/>
|
||||||
|
</auxhead>
|
||||||
|
<columns>
|
||||||
|
<column label="${labels.GlobalSettingsHours}"/>
|
||||||
|
<column label="0"/>
|
||||||
|
<column label="1"/>
|
||||||
|
<column label="2"/>
|
||||||
|
<column label="3"/>
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<template name="model">
|
||||||
|
<row>
|
||||||
|
<label value="@load(each)"/>
|
||||||
|
<textbox value="@bind(vm.settings.refunds[each][0])" inplace="true"/>
|
||||||
|
<textbox value="@bind(vm.settings.refunds[each][1])" inplace="true"/>
|
||||||
|
<textbox value="@bind(vm.settings.refunds[each][2])" inplace="true"/>
|
||||||
|
<textbox value="@bind(vm.settings.refunds[each][3])" inplace="true"/>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
</tabpanel>
|
||||||
|
<tabpanel>
|
||||||
|
<vbox>
|
||||||
|
<button label="${labels.AddItem}" onClick="@command('addVehicle')" sclass="nicebutton"/>
|
||||||
<grid model="@load(vm.settings.vehicles)">
|
<grid model="@load(vm.settings.vehicles)">
|
||||||
<columns>
|
<columns>
|
||||||
<column label="${labels.code}"/>
|
<column label="${labels.code}"/>
|
||||||
@@ -19,5 +52,9 @@
|
|||||||
</template>
|
</template>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
</tabpanel>
|
||||||
|
</tabpanels>
|
||||||
|
</tabbox>
|
||||||
|
|
||||||
</zk>
|
</zk>
|
||||||
Reference in New Issue
Block a user