Přidáno nastavení adres a bankovního spojení do globálního nastavení.

closes #101
multitenant
Josef Rokos 11 years ago
parent 0b918b9f51
commit a8020789be

@ -1,5 +1,8 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import java.util.ArrayList;
import java.util.List;
import info.bukova.isspst.mail.MailMessage; import info.bukova.isspst.mail.MailMessage;
public class SettingsData { public class SettingsData {
@ -8,11 +11,18 @@ public class SettingsData {
private MailMessage newReqTemplate; private MailMessage newReqTemplate;
private MailMessage authReqTemplate; private MailMessage authReqTemplate;
private MailMessage confReqTemplate; private MailMessage confReqTemplate;
private Address mainAddress;
private List<Address> shippingAddrs;
private String bankName;
private String accountNumber;
private String bankCode;
public SettingsData() { public SettingsData() {
newReqTemplate = new MailMessage(); newReqTemplate = new MailMessage();
authReqTemplate = new MailMessage(); authReqTemplate = new MailMessage();
confReqTemplate = new MailMessage(); confReqTemplate = new MailMessage();
mainAddress = new Address();
shippingAddrs = new ArrayList<Address>();
} }
public boolean isEnableRequirements() { public boolean isEnableRequirements() {
@ -47,4 +57,44 @@ public class SettingsData {
this.confReqTemplate = confReqTemplate; this.confReqTemplate = confReqTemplate;
} }
public Address getMainAddress() {
return mainAddress;
}
public void setMainAddress(Address mainAddress) {
this.mainAddress = mainAddress;
}
public List<Address> getShippingAddrs() {
return shippingAddrs;
}
public void setShippingAddrs(List<Address> shippingAddrs) {
this.shippingAddrs = shippingAddrs;
}
public String getBankName() {
return bankName;
}
public void setBankName(String bankName) {
this.bankName = bankName;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getBankCode() {
return bankCode;
}
public void setBankCode(String bankCode) {
this.bankCode = bankCode;
}
} }

@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.GlobalSettings; import info.bukova.isspst.data.GlobalSettings;
import info.bukova.isspst.data.SettingsData; import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.services.AbstractOwnedService; import info.bukova.isspst.services.AbstractOwnedService;
@ -100,6 +101,13 @@ public class GlobalSettingServiceImpl extends AbstractOwnedService<GlobalSetting
} }
GlobalSettings gs = this.getAll().get(0); GlobalSettings gs = this.getAll().get(0);
for (Address a : settings.getShippingAddrs()) {
a.setCompany(settings.getMainAddress().getCompany());
a.setIc(settings.getMainAddress().getIc());
a.setDic(settings.getMainAddress().getDic());
}
gs.setData(marshalData(settings)); gs.setData(marshalData(settings));
super.update(gs); super.update(gs);

@ -9,6 +9,7 @@ import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
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;
import info.bukova.isspst.mail.MailMessage; import info.bukova.isspst.mail.MailMessage;
@ -22,6 +23,7 @@ public class GlobalSettingsVM {
private GlobalSettingsService settingsService; private GlobalSettingsService settingsService;
private SettingsData settings; private SettingsData settings;
private LocaleConverter locConverter; private LocaleConverter locConverter;
private Address selAddress;
@Init @Init
public void init() { public void init() {
@ -57,4 +59,24 @@ public class GlobalSettingsVM {
message.setText(message.getText() + "[" + field + "]"); message.setText(message.getText() + "[" + field + "]");
} }
@Command
@NotifyChange("settings")
public void addAddress() {
settings.getShippingAddrs().add(new Address());
}
@Command
@NotifyChange("settings")
public void removeAddress(@BindingParam("addr") Address addr) {
settings.getShippingAddrs().remove(addr);
}
public Address getSelAddress() {
return selAddress;
}
public void setSelAddress(Address selAddress) {
this.selAddress = selAddress;
}
} }

@ -152,6 +152,12 @@ AuthRequirement=Dílčí schválení
ConfirmRequirement=Schválení ConfirmRequirement=Schválení
InsertField=Vložit pole InsertField=Vložit pole
EnableRequirements=Povolit zadávání požadavků EnableRequirements=Povolit zadávání požadavků
ShippingAddresses=Dodací adresy:
ContactInfo=Kontakt
BankInfo=Banka
BankName=Název
BankCode=Kód banky
AccountNumber=Číslo účtu
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

@ -0,0 +1,71 @@
<?page title="address" contentType="text/html;charset=UTF-8"?>
<zk>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.SuppliersFormCompany}"/>
<textbox value="@bind(vm.settings.mainAddress.company)" width="100%"/>
</row>
<row>
<label value="${labels.SuppliersFormIC}"/>
<textbox value="@bind(vm.settings.mainAddress.ic)"/>
</row>
<row>
<label value="${labels.SuppliersFormDIC}"/>
<textbox value="@bind(vm.settings.mainAddress.dic)"/>
</row>
<row>
<label value="${labels.SuppliersFormStreet}"/>
<textbox value="@bind(vm.settings.mainAddress.street)" width="100%"/>
</row>
<row>
<label value="${labels.SuppliersFormNo}"/>
<textbox value="@bind(vm.settings.mainAddress.houseNumber)"/>
</row>
<row>
<label value="${labels.SuppliersFormCity}"/>
<textbox value="@bind(vm.settings.mainAddress.city)" width="100%"/>
</row>
<row>
<label value="${labels.SuppliersFormZIP}"/>
<textbox value="@bind(vm.settings.mainAddress.zipCode)"/>
</row>
</rows>
</grid>
<vbox>
<label value="${labels.ShippingAddresses}"/>
<button label="${labels.AddItem}" onClick="@command('addAddress')"/>
<listbox model="@load(vm.settings.shippingAddrs)">
<listhead>
<listheader label="${labels.SuppliersFormStreet}"/>
<listheader label="${labels.SuppliersFormNo}"/>
<listheader label="${labels.SuppliersFormCity}"/>
<listheader label="${labels.SuppliersFormZIP}"/>
<listheader/>
</listhead>
<template name="model">
<listitem>
<listcell>
<textbox inplace="true" value="@bind(each.street)"></textbox>
</listcell>
<listcell>
<textbox inplace="true" value="@bind(each.houseNumber)"></textbox>
</listcell>
<listcell>
<textbox inplace="true" value="@bind(each.city)"></textbox>
</listcell>
<listcell>
<textbox inplace="true" value="@bind(each.zipCode)"></textbox>
</listcell>
<listcell>
<button label="${labels.RemoveItem }" onClick="@command('removeAddress', addr=each)"/>
</listcell>
</listitem>
</template>
</listbox>
</vbox>
</zk>

@ -0,0 +1,23 @@
<?page title="bank" contentType="text/html;charset=UTF-8"?>
<zk>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.BankName}"/>
<textbox value="@bind(vm.settings.bankName)" width="100%"/>
</row>
<row>
<label value="${labels.AccountNumber}"/>
<textbox value="@bind(vm.settings.accountNumber)"/>
</row>
<row>
<label value="${labels.BankCode}"/>
<textbox value="@bind(vm.settings.bankCode)"/>
</row>
</rows>
</grid>
</zk>

@ -0,0 +1,84 @@
<?page title="email" contentType="text/html;charset=UTF-8"?>
<zk>
<tabbox>
<tabs>
<tab label="${labels.NewRequirement}"/>
<tab label="${labels.AuthRequirement}"/>
<tab label="${labels.ConfirmRequirement}"/>
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.newReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.newReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsNew, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.authReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.authReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsAuth, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.confReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsConfirm, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<menupopup id="fieldsNew" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.newReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsAuth" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.authReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsConfirm" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
</template>
</menupopup>
</zk>

@ -1,14 +1,16 @@
<?page title="EMail" contentType="text/html;charset=UTF-8"?> <?page title="EMail" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<window id="editWin" border="normal" closable="true" apply="org.zkoss.bind.BindComposer" <window id="editWin" border="normal" closable="true" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM')" width="620px" viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.GlobalSettingsVM')" width="820px"
binder="@init(queueName='email')"> binder="@init(queueName='email')">
<caption src="/img/settings.png" zclass="form-caption" label="${labels.GlobalSettings}" /> <caption src="/img/settings.png" zclass="form-caption" label="${labels.GlobalSettings}" />
<tabbox orient="vertical" height="400px"> <tabbox orient="vertical" height="500px">
<tabs width="100px"> <tabs width="100px">
<tab label="${labels.Requirements}"/> <tab label="${labels.Requirements}"/>
<tab label="${labels.EMails}"/> <tab label="${labels.EMails}"/>
<tab label="${labels.ContactInfo }"/>
<tab label="${labels.BankInfo}"/>
</tabs> </tabs>
<tabpanels> <tabpanels>
<tabpanel> <tabpanel>
@ -17,87 +19,13 @@ binder="@init(queueName='email')">
</div> </div>
</tabpanel> </tabpanel>
<tabpanel> <tabpanel>
<tabbox> <include src="/settings/global/email.zul"/>
<tabs>
<tab label="${labels.NewRequirement}"/>
<tab label="${labels.AuthRequirement}"/>
<tab label="${labels.ConfirmRequirement}"/>
</tabs>
<tabpanels>
<tabpanel>
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.newReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.newReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsNew, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel> </tabpanel>
<tabpanel> <tabpanel>
<grid> <include src="/settings/global/address.zul"/>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.authReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.authReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsAuth, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel> </tabpanel>
<tabpanel> <tabpanel>
<grid> <include src="/settings/global/bank.zul"/>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailSubject}"/> <textbox value="@bind(vm.settings.confReqTemplate.subject)" width="100%"/>
</row>
<row spans="2">
<vbox>
<ckeditor toolbar="Basic" value="@bind(vm.settings.confReqTemplate.text)" width="460px" height="180px"/>
<button label="${labels.InsertField}" popup="fieldsConfirm, position=after_start"/>
</vbox>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<menupopup id="fieldsNew" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.newReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsAuth" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.authReqTemplate)"/>
</template>
</menupopup>
<menupopup id="fieldsConfirm" children="@load(vm.requirementFields)">
<template name="children">
<menuitem label="@load(each) @converter(vm.locConverter)" onClick="@command('insertField', field=each, message=vm.settings.confReqTemplate)"/>
</template>
</menupopup>
</tabpanel> </tabpanel>
</tabpanels> </tabpanels>
</tabbox> </tabbox>

Loading…
Cancel
Save