Vytvořen formulář pro generování objednávky.

closes #142
multitenant
František Přibyl 10 years ago
parent 1367dc9cdf
commit 0f8974f9cb

@ -1,5 +1,10 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import info.bukova.isspst.StringUtils;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
@ -10,126 +15,326 @@ import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.URL; import org.hibernate.validator.constraints.URL;
@Entity @Entity
@Table(name="ADDRESS") @Table(name = "ADDRESS")
public class Address extends BaseData { public class Address extends BaseData
{
@Column(name="COMPANY") @Column(name = "COMPANY")
private String company; private String company;
@Column(name="DEPARTMENT") @Column(name = "DEPARTMENT")
private String department; private String department;
@Column(name="CONTACT_NAME") @Column(name = "CONTACT_NAME")
private String contactName; private String contactName;
@Column(name="STREET") @Column(name = "STREET")
private String street; private String street;
@Column(name="HOUSE_NUMBER") @Column(name = "HOUSE_NUMBER")
private String houseNumber; private String houseNumber;
@Column(name="ZIP_CODE") @Column(name = "ZIP_CODE")
private String zipCode; private String zipCode;
@Column(name="CITY") @Column(name = "CITY")
private String city; private String city;
@Column(name="STATE") @Column(name = "STATE")
private String state; private String state;
@Column(name="IC") @Column(name = "IC")
private long ic; private long ic;
@Column(name="DIC") @Column(name = "DIC")
private String dic; private String dic;
@Column(name="PHONE") @Column(name = "PHONE")
private String phone; private String phone;
@Column(name="EMAIL") @Column(name = "EMAIL")
private String email; private String email;
@Column(name="WEB") @Column(name = "WEB")
private String web; private String web;
@Column(name="DESCRIPTION") @Column(name = "DESCRIPTION")
private String description; private String description;
@NotNull(message = "Zadejte firmu") @NotNull(message = "Zadejte firmu")
@NotEmpty(message = "Zadejte firmu") @NotEmpty(message = "Zadejte firmu")
public String getCompany() { public String getCompany()
{
return company; return company;
} }
public void setCompany(String company) {
public void setCompany(String company)
{
this.company = company; this.company = company;
} }
public String getDepartment() {
public String getDepartment()
{
return department; return department;
} }
public void setDepartment(String department) {
public void setDepartment(String department)
{
this.department = department; this.department = department;
} }
public String getContactName() {
public String getContactName()
{
return contactName; return contactName;
} }
public void setContactName(String contactName) {
public void setContactName(String contactName)
{
this.contactName = contactName; this.contactName = contactName;
} }
public String getStreet() {
public String getStreet()
{
return street; return street;
} }
public void setStreet(String street) {
public void setStreet(String street)
{
this.street = street; this.street = street;
} }
public String getHouseNumber() {
public String getHouseNumber()
{
return houseNumber; return houseNumber;
} }
public void setHouseNumber(String houseNumber) {
public void setHouseNumber(String houseNumber)
{
this.houseNumber = houseNumber; this.houseNumber = houseNumber;
} }
public String getZipCode() {
public String getZipCode()
{
return zipCode; return zipCode;
} }
public void setZipCode(String zipCode) {
public void setZipCode(String zipCode)
{
this.zipCode = zipCode; this.zipCode = zipCode;
} }
@NotNull(message = "Zadejte město") @NotNull(message = "Zadejte město")
@NotEmpty(message = "Zadejte město") @NotEmpty(message = "Zadejte město")
public String getCity() { public String getCity()
{
return city; return city;
} }
public void setCity(String city) {
public void setCity(String city)
{
this.city = city; this.city = city;
} }
public String getState() {
public String getState()
{
return state; return state;
} }
public void setState(String state) {
public void setState(String state)
{
this.state = state; this.state = state;
} }
public long getIc() {
public long getIc()
{
return ic; return ic;
} }
public void setIc(long ic) {
public void setIc(long ic)
{
this.ic = ic; this.ic = ic;
} }
public String getDic() {
public String getDic()
{
return dic; return dic;
} }
public void setDic(String dic) {
public void setDic(String dic)
{
this.dic = dic; this.dic = dic;
} }
public String getPhone() {
public String getPhone()
{
return phone; return phone;
} }
public void setPhone(String phone) {
public void setPhone(String phone)
{
this.phone = phone; this.phone = phone;
} }
@Email(message = "Špatný formát adresy") @Email(message = "Špatný formát adresy")
public String getEmail() { public String getEmail()
{
return email; return email;
} }
public void setEmail(String email) {
public void setEmail(String email)
{
this.email = email; this.email = email;
} }
@URL(message = "Špatný formát adresy") @URL(message = "Špatný formát adresy")
public String getWeb() { public String getWeb()
{
return web; return web;
} }
public void setWeb(String web) {
public void setWeb(String web)
{
this.web = web; this.web = web;
} }
public String getDescription() {
public String getDescription()
{
return description; return description;
} }
public void setDescription(String description) {
public void setDescription(String description)
{
this.description = description; this.description = description;
} }
public String toString()
{
String str, street;
List<String> listStreet = new ArrayList<String>();
if (this.street != null)
listStreet.add(this.street);
if (this.houseNumber != null)
listStreet.add(this.houseNumber);
street = StringUtils.join(listStreet, " ");
List<String> list = new ArrayList<String>();
if (this.company != null)
list.add(this.company);
if (street != null)
list.add(street);
if (this.city != null)
list.add(this.city);
list.add(Long.toString(this.ic));
str = StringUtils.join(list, ", ");
return str;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Address other = (Address) obj;
if (other.getId() == this.getId())
{
if (other.getId() == 0)
{
// Protože globální nastavení je serializováno (není v DB), nemá
// vyplněno ID - musíme porovnávat jinak - obsahově
if (city == null)
{
if (other.city != null)
return false;
}
else if (!city.equals(other.city))
return false;
if (company == null)
{
if (other.company != null)
return false;
}
else if (!company.equals(other.company))
return false;
if (contactName == null)
{
if (other.contactName != null)
return false;
}
else if (!contactName.equals(other.contactName))
return false;
if (department == null)
{
if (other.department != null)
return false;
}
else if (!department.equals(other.department))
return false;
if (description == null)
{
if (other.description != null)
return false;
}
else if (!description.equals(other.description))
return false;
if (dic == null)
{
if (other.dic != null)
return false;
}
else if (!dic.equals(other.dic))
return false;
if (email == null)
{
if (other.email != null)
return false;
}
else if (!email.equals(other.email))
return false;
if (houseNumber == null)
{
if (other.houseNumber != null)
return false;
}
else if (!houseNumber.equals(other.houseNumber))
return false;
if (ic != other.ic)
return false;
if (phone == null)
{
if (other.phone != null)
return false;
}
else if (!phone.equals(other.phone))
return false;
if (state == null)
{
if (other.state != null)
return false;
}
else if (!state.equals(other.state))
return false;
if (street == null)
{
if (other.street != null)
return false;
}
else if (!street.equals(other.street))
return false;
if (web == null)
{
if (other.web != null)
return false;
}
else if (!web.equals(other.web))
return false;
if (zipCode == null)
{
if (other.zipCode != null)
return false;
}
else if (!zipCode.equals(other.zipCode))
return false;
return true;
}
else
{
return true;
}
}
return false;
}
} }

@ -5,6 +5,7 @@ import javax.persistence.Embeddable;
@Embeddable @Embeddable
public class AddressEmb { public class AddressEmb {
private int id;
private String company; private String company;
private String department; private String department;
private String contactName; private String contactName;
@ -24,7 +25,14 @@ public class AddressEmb {
super(); super();
} }
public AddressEmb(Address address) { public AddressEmb(Address address)
{
if (address == null)
{
return;
}
this.id = address.getId();
this.company = address.getCompany(); this.company = address.getCompany();
this.department = address.getDepartment(); this.department = address.getDepartment();
this.contactName = address.getContactName(); this.contactName = address.getContactName();
@ -41,6 +49,39 @@ public class AddressEmb {
this.description = address.getDescription(); this.description = address.getDescription();
} }
public Address getAddress()
{
Address address = new Address();
address.setId(this.id);
address.setCompany(this.company);
address.setDepartment(this.department);
address.setContactName(this.contactName);
address.setStreet(this.street);
address.setHouseNumber(this.houseNumber);
address.setZipCode(this.zipCode);
address.setCity(this.city);
address.setState(this.state);
address.setIc(this.ic);
address.setDic(this.dic);
address.setPhone(this.phone);
address.setEmail(this.email);
address.setWeb(this.web);
address.setDescription(this.description);
return address;
}
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getCompany() { public String getCompany() {
return company; return company;
} }

@ -29,6 +29,7 @@ public class Order extends BaseData {
@Embedded @Embedded
@AttributeOverrides({ @AttributeOverrides({
@AttributeOverride(name = "id", column = @Column(name = "SUPPLIER_ID")),
@AttributeOverride(name = "city", column = @Column(name = "SUPPLIER_CITY")), @AttributeOverride(name = "city", column = @Column(name = "SUPPLIER_CITY")),
@AttributeOverride(name = "company", column = @Column(name = "SUPPLIER_COMPANY")), @AttributeOverride(name = "company", column = @Column(name = "SUPPLIER_COMPANY")),
@AttributeOverride(name = "contactName", column = @Column(name = "SUPPLIER_CONTACT_NAME")), @AttributeOverride(name = "contactName", column = @Column(name = "SUPPLIER_CONTACT_NAME")),
@ -48,6 +49,7 @@ public class Order extends BaseData {
@Embedded @Embedded
@AttributeOverrides({ @AttributeOverrides({
@AttributeOverride(name = "id", column = @Column(name = "INVOICE_ID")),
@AttributeOverride(name = "city", column = @Column(name = "INVOICE_CITY")), @AttributeOverride(name = "city", column = @Column(name = "INVOICE_CITY")),
@AttributeOverride(name = "company", column = @Column(name = "INVOICE_COMPANY")), @AttributeOverride(name = "company", column = @Column(name = "INVOICE_COMPANY")),
@AttributeOverride(name = "contactName", column = @Column(name = "INVOICE_CONTACT_NAME")), @AttributeOverride(name = "contactName", column = @Column(name = "INVOICE_CONTACT_NAME")),
@ -67,6 +69,7 @@ public class Order extends BaseData {
@Embedded @Embedded
@AttributeOverrides({ @AttributeOverrides({
@AttributeOverride(name = "id", column = @Column(name = "DELIVERY_ID")),
@AttributeOverride(name = "city", column = @Column(name = "DELIVERY_CITY")), @AttributeOverride(name = "city", column = @Column(name = "DELIVERY_CITY")),
@AttributeOverride(name = "company", column = @Column(name = "DELIVERY_COMPANY")), @AttributeOverride(name = "company", column = @Column(name = "DELIVERY_COMPANY")),
@AttributeOverride(name = "contactName", column = @Column(name = "DELIVERY_CONTACT_NAME")), @AttributeOverride(name = "contactName", column = @Column(name = "DELIVERY_CONTACT_NAME")),

@ -1,13 +1,13 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import info.bukova.isspst.mail.MailMessage;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import info.bukova.isspst.mail.MailMessage;
public class SettingsData { public class SettingsData {
private boolean enableRequirements; private boolean enableRequirements;
@ -76,6 +76,17 @@ public class SettingsData {
return shippingAddrs; return shippingAddrs;
} }
/**
* @return Seznam všech doručovacích adres včetně hlavní fakturační adresy
*/
public List<Address> getAllShippingAddrs()
{
List<Address> list = new ArrayList<Address>();
list.add(this.mainAddress);
list.addAll(this.getShippingAddrs());
return list;
}
public void setShippingAddrs(List<Address> shippingAddrs) { public void setShippingAddrs(List<Address> shippingAddrs) {
this.shippingAddrs = shippingAddrs; this.shippingAddrs = shippingAddrs;
} }

@ -205,18 +205,12 @@ public class User extends Member implements UserDetails, DataModel {
public static boolean isEqualByUserForFilter(User value, User search) public static boolean isEqualByUserForFilter(User value, User search)
{ {
if (search == null) if ((search == null) || search.getFullName().isEmpty())
{ {
return true; return true;
} }
else if (value != null) else if (value != null)
{ {
if (search.getFullName().isEmpty())
{
return true;
}
String valueS = value.getFullName(); String valueS = value.getFullName();
String searchS = search.getFullName(); String searchS = search.getFullName();
return (valueS.compareTo(searchS) == 0); return (valueS.compareTo(searchS) == 0);

@ -154,18 +154,12 @@ public class Workgroup extends Member implements OwnedDataModel, Serializable {
public static boolean isEqualByWorkgroupForFilter(Workgroup value, Workgroup search) public static boolean isEqualByWorkgroupForFilter(Workgroup value, Workgroup search)
{ {
if (search == null) if ((search == null) || search.getFullName().isEmpty())
{ {
return true; return true;
} }
else if (value != null) else if (value != null)
{ {
if (search.getFullName().isEmpty())
{
return true;
}
String valueS = value.getFullName(); String valueS = value.getFullName();
String searchS = search.getFullName(); String searchS = search.getFullName();
return (valueS.compareTo(searchS) == 0); return (valueS.compareTo(searchS) == 0);

@ -0,0 +1,52 @@
package info.bukova.isspst.ui;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.KeyEvent;
import org.zkoss.zul.Combobox;
public class DocumentViewModel
{
protected BigDecimalConverter standardBigDecimalConverter;
public BigDecimalConverter getStandardBigDecimalConverter()
{
return standardBigDecimalConverter;
}
public void setStandardBigDecimalConverter(BigDecimalConverter standardBigDecimalConverter)
{
this.standardBigDecimalConverter = standardBigDecimalConverter;
}
@Init
public void initDocumentViewModel()
{
this.standardBigDecimalConverter = new BigDecimalConverter();
}
@Command
public void handleComboKeyFilter(@BindingParam("ctrl") Combobox cb, @BindingParam("keyEvent") KeyEvent keyEvent)
{
if (cb == null)
{
return;
}
int keyCode = keyEvent.getKeyCode();
switch (keyCode)
{
case 46: // del
// Zrušit jakoukoli vybranou položku
cb.setSelectedIndex(-1);
// Zavřít listbox
cb.close();
// Vyvolat událost změny
Events.postEvent("onChange", cb, null);
break;
}
}
}

@ -20,7 +20,7 @@ import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
public class FormViewModel<T extends DataModel> public class FormViewModel<T extends DataModel> extends DocumentViewModel
{ {
private T dataBean; private T dataBean;
@ -32,6 +32,8 @@ public class FormViewModel<T extends DataModel>
@Init @Init
public void init(@ExecutionArgParam("selected") T selected, @ExecutionArgParam("service") Service<T> service) public void init(@ExecutionArgParam("selected") T selected, @ExecutionArgParam("service") Service<T> service)
{ {
super.initDocumentViewModel();
this.dataBean = selected; this.dataBean = selected;
this.service = service; this.service = service;
constraint = new ServiceConstraint<T>(); constraint = new ServiceConstraint<T>();

@ -23,7 +23,8 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
public class ListViewModel<T extends DataModel> { public class ListViewModel<T extends DataModel> extends DocumentViewModel
{
private boolean confirmDelete = false; private boolean confirmDelete = false;
private boolean filter = false; private boolean filter = false;

@ -1,20 +1,27 @@
package info.bukova.isspst.ui.main.approved; package info.bukova.isspst.ui.main.approved;
import info.bukova.isspst.data.JoinedItem; import info.bukova.isspst.data.JoinedItem;
import info.bukova.isspst.data.Order;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.data.Workgroup; import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.filters.JoinedItemFilter; import info.bukova.isspst.filters.JoinedItemFilter;
import info.bukova.isspst.services.approved.ApprovedService; import info.bukova.isspst.services.approved.ApprovedService;
import info.bukova.isspst.services.approved.OrderService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.BigDecimalConverter; import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
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 org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window;
public class ApprovedList extends ListViewModel<JoinedItem> public class ApprovedList extends ListViewModel<JoinedItem>
{ {
@ -27,8 +34,13 @@ public class ApprovedList extends ListViewModel<JoinedItem>
@WireVariable @WireVariable
protected UserService userService; protected UserService userService;
@WireVariable
protected OrderService orderService;
private BigDecimalConverter bigDecimalConverter; private BigDecimalConverter bigDecimalConverter;
protected List<JoinedItem> selectedItems;
@Init @Init
public void initApprovedList() public void initApprovedList()
{ {
@ -37,6 +49,7 @@ public class ApprovedList extends ListViewModel<JoinedItem>
// formZul = "form.zul"; // formZul = "form.zul";
dataFilter = new JoinedItemFilter(getFilterTemplate()); dataFilter = new JoinedItemFilter(getFilterTemplate());
bigDecimalConverter = new BigDecimalConverter(); bigDecimalConverter = new BigDecimalConverter();
selectedItems = new ArrayList<JoinedItem>();
} }
public BigDecimalConverter getBigDecimalConverter() public BigDecimalConverter getBigDecimalConverter()
@ -49,15 +62,19 @@ public class ApprovedList extends ListViewModel<JoinedItem>
return approvedService.getAll(); return approvedService.getAll();
} }
public List<JoinedItem> getSelectedItems()
{
return this.selectedItems;
}
public void setSelectedItems(List<JoinedItem> selectedItems)
{
this.selectedItems = selectedItems;
}
public List<Workgroup> getWorkgroups() public List<Workgroup> getWorkgroups()
{ {
Workgroup empty = new Workgroup(); return this.workgroupService.getWorkgroups();
empty.setCode("");
empty.setName("");
List<Workgroup> list = new ArrayList<Workgroup>();
list.add(empty);
list.addAll(this.workgroupService.getWorkgroups());
return list;
} }
public List<Workgroup> getCenters() public List<Workgroup> getCenters()
@ -69,4 +86,28 @@ public class ApprovedList extends ListViewModel<JoinedItem>
{ {
return this.userService.getAll(); return this.userService.getAll();
} }
@Command
// @NotifyChange({ "selectedItems" })
public void onCreateOrder()
{
if (this.selectedItems == null)
{
return;
}
if (this.selectedItems.size() == 0)
{
return;
}
Order order = orderService.createOrder(this.selectedItems);
Map<String, Object> params = new HashMap<String, Object>();
params.put("selected", order);
params.put("service", orderService);
Window orderForm = (Window) Executions.createComponents("/main/orders/created/orderForm.zul", null, params);
orderForm.doModal();
}
} }

@ -0,0 +1,144 @@
package info.bukova.isspst.ui.main.orders.created;
import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.AddressEmb;
import info.bukova.isspst.data.Order;
import info.bukova.isspst.data.OrderItem;
import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.ui.FormViewModel;
import info.bukova.isspst.validators.OrderFormValidator;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
public class OrderForm extends FormViewModel<Order>
{
@SuppressWarnings("unused")
private final static Logger log = LoggerFactory.getLogger(OrderForm.class.getName());
@WireVariable
protected AdbService adbService;
@WireVariable
protected GlobalSettingsService settingsService;
protected OrderFormValidator orderFormValidator;
protected OrderItem selectedItem;
protected Address selectedSuppAddrItem;
protected Address selectedDeliveryAddrItem;
@Init(superclass = true)
public void initOrderForm()
{
this.orderFormValidator = new OrderFormValidator();
this.selectedDeliveryAddrItem = this.getDataBean().getDeliveryAddress().getAddress();
if (this.getDataBean().getSuplier() == null)
{
this.getDataBean().setSuplier(new AddressEmb());
}
if (this.getDataBean().getDeliveryAddress() == null)
{
this.getDataBean().setDeliveryAddress(new AddressEmb());
}
if (this.getDataBean().getAddress() == null)
{
this.getDataBean().setAddress(new AddressEmb());
}
}
public OrderFormValidator getOrderFormValidator()
{
return orderFormValidator;
}
public void setOrderFormValidator(OrderFormValidator orderFormValidator)
{
this.orderFormValidator = orderFormValidator;
}
public List<Address> getSuppAddresses()
{
return adbService.getAll();
}
public List<Address> getDeliveryAddresses()
{
return settingsService.getSettings().getAllShippingAddrs();
}
public Address getInvoiceAddress()
{
return settingsService.getSettings().getMainAddress();
}
public OrderItem getSelectedItem()
{
return this.selectedItem;
}
public void setSelectedItem(OrderItem selectedItem)
{
this.selectedItem = selectedItem;
}
public Address getSelectedSuppAddrItem()
{
return selectedSuppAddrItem;
}
public void setSelectedSuppAddrItem(Address selectedSuppAddrItem)
{
this.selectedSuppAddrItem = selectedSuppAddrItem;
}
public Address getSelectedDeliveryAddrItem()
{
return selectedDeliveryAddrItem;
}
public void setSelectedDeliveryAddrItem(Address selectedDeliveryAddrItem)
{
this.selectedDeliveryAddrItem = selectedDeliveryAddrItem;
}
@Command
@NotifyChange("dataBean")
public void doFillSuppAddress()
{
if (this.selectedSuppAddrItem == null)
{
return;
}
// Naplnit pole podle vybrané adresy z comba
AddressEmb supplier = new AddressEmb(this.selectedSuppAddrItem);
this.getDataBean().setSuplier(supplier);
}
@Command
@NotifyChange("dataBean")
public void doFillDeliveryAddress()
{
if (this.selectedDeliveryAddrItem == null)
{
return;
}
// Naplnit pole podle vybrané adresy z comba
AddressEmb delivery = new AddressEmb(this.selectedDeliveryAddrItem);
this.getDataBean().setDeliveryAddress(delivery);
}
}

@ -0,0 +1,30 @@
package info.bukova.isspst.validators;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.zkoss.bind.ValidationContext;
public class OrderFormValidator extends BaseValidator
{
private final static Logger log = LoggerFactory.getLogger(OrderFormValidator.class.getName());
@Override
protected Logger getLogger()
{
return log;
}
@Override
public void validate(ValidationContext ctx)
{
// Property propertyCentre = ctx.getProperties("centre")[0];
// Workgroup workgroup = (Workgroup) propertyCentre.getValue();
//
// if (workgroup == null)
// {
// this.errorMsg(ctx, StringUtils.localize("RequirementCenterIsEmpty"),
// "idReqCenter");
// return;
// }
}
}

@ -269,6 +269,7 @@ false=Ne
Information=Informace Information=Informace
Order=Objednávka
Orders=Objednávky Orders=Objednávky
MaterialRequirement=Požadavek na materiál MaterialRequirement=Požadavek na materiál
@ -303,6 +304,19 @@ RemoveItem=Smazat
Amount=Částka Amount=Částka
Owner=Vlastník Owner=Vlastník
CreateOrder=Vytvořit objednávku CreateOrder=Vytvořit objednávku
NotYetFilled=Zatím nevyplněno
DeliveryAddress=Dodací adresa
BillingAddress=Fakturační adresa
OrderFormNumber=Číslo objednávky
OrderFormOrderDate=Datum objednávky
OrderFormTotal=Celkem
OrderFormDescription=Popis
OrderFormOrdered=Objednáno
OrderFormDeliveredDate=Dodáno dne
OrderFormInvoiceNumber=Číslo faktury
HandleComboKeyFilter=#del
WorkgroupFormUserIsCenterMember=Uživatel je členem střediska, jehož je komise členem! WorkgroupFormUserIsCenterMember=Uživatel je členem střediska, jehož je komise členem!
WorkgroupFormMemberIsCenterMember=Některý ze členů přidávané komise je členem tohoto střediska! WorkgroupFormMemberIsCenterMember=Některý ze členů přidávané komise je členem tohoto střediska!

@ -1,9 +1,22 @@
<?page title="buttons" contentType="text/html;charset=UTF-8"?> <?page title="buttons" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<vlayout> <vlayout
<div hflex="max" align="right"> vflex="min"
<button image="~./zul/img/misc/drag-disallow.png" label="${labels.ButtonStorno}" onClick="editWin.detach()" sclass="nicebutton" /> hflex="max">
<button image="/img/save.png" label="${labels.ButtonSave}" onClick="@command('save', window=editWin) @global-command('refresh')" disabled="@load(not vm.canSave)" sclass="nicebutton" /> <div
hflex="max"
align="right">
<button
image="~./zul/img/misc/drag-disallow.png"
label="${labels.ButtonStorno}"
onClick="editWin.detach()"
sclass="nicebutton" />
<button
image="/img/save.png"
label="${labels.ButtonSave}"
onClick="@command('save', window=editWin) @global-command('refresh')"
disabled="@load(not vm.canSave)"
sclass="nicebutton" />
</div> </div>
</vlayout> </vlayout>
</zk> </zk>

@ -8,6 +8,12 @@
text-shadow: 2px 2px 2px #000000; text-shadow: 2px 2px 2px #000000;
} }
.addScrollbar {
overflow: auto;
}
.find-grid-cell { .find-grid-cell {
display: table; display: table;
width: 100%; width: 100%;

@ -26,7 +26,7 @@
multiple="true" multiple="true"
checkmark="true" checkmark="true"
vflex="1" vflex="1"
context="popupMenu" selectedItems="@bind(vm.selectedItems)"
model="@load(vm.dataList)"> model="@load(vm.dataList)">
<listhead menupopup="auto"> <listhead menupopup="auto">
<listheader width="27" /> <listheader width="27" />
@ -182,11 +182,13 @@
<div zclass="find-grid-cell"> <div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox"> <div sclass="find-grid-divtextbox">
<combobox <combobox
readonly="true" ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
width="100%" width="100%"
selectedItem="@bind(vm.filterTemplate.workgroup)" selectedItem="@bind(vm.filterTemplate.workgroup)"
model="@load(vm.workgroups)" model="@load(vm.workgroups)"
onChange="@command('doFilter')"> readonly="true">
<template name="model"> <template name="model">
<comboitem label="@load(each.fullName)" /> <comboitem label="@load(each.fullName)" />
</template> </template>
@ -201,11 +203,13 @@
<div zclass="find-grid-cell"> <div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox"> <div sclass="find-grid-divtextbox">
<combobox <combobox
readonly="true" ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
width="100%" width="100%"
selectedItem="@bind(vm.filterTemplate.centre)" selectedItem="@bind(vm.filterTemplate.centre)"
model="@load(vm.centers)" model="@load(vm.centers)"
onChange="@command('doFilter')"> readonly="true">
<template name="model"> <template name="model">
<comboitem label="@load(each.fullName)" /> <comboitem label="@load(each.fullName)" />
</template> </template>
@ -220,11 +224,13 @@
<div zclass="find-grid-cell"> <div zclass="find-grid-cell">
<div sclass="find-grid-divtextbox"> <div sclass="find-grid-divtextbox">
<combobox <combobox
readonly="true" ctrlKeys="${labels.HandleComboKeyFilter}"
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
onChange="@command('doFilter')"
width="100%" width="100%"
selectedItem="@bind(vm.filterTemplate.ownedBy)" selectedItem="@bind(vm.filterTemplate.ownedBy)"
model="@load(vm.users)" model="@load(vm.users)"
onChange="@command('doFilter')"> readonly="true">
<template name="model"> <template name="model">
<comboitem label="@load(each.fullName)" /> <comboitem label="@load(each.fullName)" />
</template> </template>
@ -251,7 +257,7 @@
</auxheader> </auxheader>
</auxhead> </auxhead>
<template name="model"> <template name="model">
<listitem> <listitem context="popupMenu">
<listcell /> <listcell />
<listcell label="@load(each.code)" /> <listcell label="@load(each.code)" />
<listcell label="@load(each.name)" /> <listcell label="@load(each.name)" />
@ -267,11 +273,11 @@
</listitem> </listitem>
</template> </template>
</listbox> </listbox>
</window>
<menupopup id="popupMenu"> <menupopup id="popupMenu">
<menuitem <menuitem
image="/img/autotruck-016.png" image="/img/autotruck-016.png"
label="${labels.CreateOrder}..." label="${labels.CreateOrder}..."
onClick="" /> onClick="@command('onCreateOrder')" />
</menupopup> </menupopup>
</window>
</zk> </zk>

@ -0,0 +1,537 @@
<?page title="${labels.Order}" contentType="text/html;charset=UTF-8"?>
<zk>
<window
id="editWin"
width="95%"
height="95%"
closable="true"
border="normal"
position="center"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.created.OrderForm')"
validationMessages="@id('vmsg')">
<caption
image="/img/autotruck-032.png"
zclass="form-caption"
label="${labels.Order}" />
<vlayout
sclass="addScrollbar"
form="@id('fx') @load(vm.dataBean) @save(vm.dataBean, before='save') @validator(vm.orderFormValidator)"
hflex="1"
vflex="1">
<hlayout
hflex="1"
vflex="min">
<tabbox
hflex="10"
vflex="1">
<tabs>
<tab label="${labels.Information}" />
</tabs>
<tabpanels>
<tabpanel>
<grid
hflex="max"
vflex="max">
<columns>
<column
align="right"
hflex="min" />
<column />
</columns>
<rows vflex="max">
<row>
<cell sclass="row-title">${labels.OrderFormNumber} :</cell>
<cell>
<textbox
id="idOrderNumber"
width="150px"
constraint="@load(vm.constriant)"
value="@bind(fx.numser)"
placeholder="${labels.NotYetFilled}..."
readonly="true" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.OrderFormOrderDate} :</cell>
<cell>
<datebox
id="idOrderDate"
width="150px"
value="@bind(fx.orderDate)"
format="${labels.DateFormat}" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.OrderFormTotal} :</cell>
<cell>
<textbox
id="idOrderTotal"
readonly="true"
width="150px"
value="@bind(fx.total) @converter(vm.standardBigDecimalConverter)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormDeliveryDate} :</cell>
<cell>
<datebox
id="idDeliveryDate"
width="150px"
value="@bind(fx.deliveryDate)"
format="${labels.DateFormat}" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.OrderFormDeliveredDate} :</cell>
<cell>
<datebox
id="idDeliveredDate"
width="150px"
value="@bind(fx.deliveredDate)"
format="${labels.DateFormat}" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.OrderFormInvoiceNumber} :</cell>
<cell>
<textbox
id="idInvoiceNumber"
width="150px"
value="@bind(fx.invoiceNumber)"
placeholder="${labels.NotYetFilled}..."
readonly="@load(empty fx.created)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.OrderFormDescription} :</cell>
<cell>
<textbox
id="idOrderDescription"
width="100%"
rows="5"
value="@bind(fx.description)" />
</cell>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
<tabbox
hflex="15"
vflex="1">
<tabs>
<tab label="${labels.SuppliersFormTitle}" />
<tab label="${labels.DeliveryAddress}" />
<tab label="${labels.BillingAddress}" />
</tabs>
<tabpanels>
<tabpanel>
<grid
hflex="1"
vflex="1">
<columns>
<column
align="right"
hflex="min" />
<column />
<column
align="right"
hflex="min" />
<column />
</columns>
<rows vflex="max">
<row>
<cell sclass="row-title">${labels.SuppliersFormCompany} :</cell>
<cell colspan="3">
<combobox
onChange="@command('doFillSuppAddress')"
width="100%"
selectedItem="@bind(vm.selectedSuppAddrItem)"
model="@load(vm.suppAddresses)"
readonly="false">
<template name="model">
<comboitem label="@load(each)" />
</template>
</combobox>
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormIC} :</cell>
<cell>
<textbox
id="idSuppIC"
value="@bind(fx.suplier.ic)" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormDIC} :</cell>
<cell>
<textbox
id="idSuppDIC"
value="@bind(fx.suplier.dic)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormDepartment} :</cell>
<cell>
<textbox
id="idSuppDepartment"
value="@bind(fx.suplier.department)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormContact} :</cell>
<cell>
<textbox
id="idSuppContactName"
value="@bind(fx.suplier.contactName)"
width="100%" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormStreet} :</cell>
<cell>
<textbox
id="idSuppStreet"
value="@bind(fx.suplier.street)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormNo} :</cell>
<cell>
<textbox
id="idSuppHouseNumber"
value="@bind(fx.suplier.houseNumber)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormCity} :</cell>
<cell>
<textbox
id="idSuppCity"
value="@bind(fx.suplier.city)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormZIP} :</cell>
<cell>
<textbox
id="idSuppZIP"
value="@bind(fx.suplier.zipCode)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormPhone} :</cell>
<cell>
<textbox
id="idSuppPhone"
value="@bind(fx.suplier.phone)" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormEmail} :</cell>
<cell>
<textbox
id="idSuppEmail"
value="@bind(fx.suplier.email)"
width="100%" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormWWW} :</cell>
<cell colspan="3">
<textbox
id="idSuppWWW"
value="@bind(fx.suplier.web)"
width="100%" />
</cell>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid
hflex="1"
vflex="1">
<columns>
<column
align="right"
hflex="min" />
<column />
<column
align="right"
hflex="min" />
<column />
</columns>
<rows vflex="max">
<row>
<cell sclass="row-title">${labels.SuppliersFormCompany} :</cell>
<cell colspan="3">
<combobox
onChange="@command('doFillDeliveryAddress')"
width="100%"
selectedItem="@bind(vm.selectedDeliveryAddrItem)"
model="@load(vm.deliveryAddresses)"
readonly="false">
<template name="model">
<comboitem label="@load(each)" />
</template>
</combobox>
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormIC} :</cell>
<cell>
<textbox
id="idDeliveryIC"
value="@bind(fx.deliveryAddress.ic)" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormDIC} :</cell>
<cell>
<textbox
id="idDeliveryDIC"
value="@bind(fx.deliveryAddress.dic)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormDepartment} :</cell>
<cell>
<textbox
id="idDeliveryDepartment"
value="@bind(fx.deliveryAddress.department)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormContact} :</cell>
<cell>
<textbox
id="idDeliveryContactName"
value="@bind(fx.deliveryAddress.contactName)"
width="100%" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormStreet} :</cell>
<cell>
<textbox
id="idDeliveryStreet"
value="@bind(fx.deliveryAddress.street)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormNo} :</cell>
<cell>
<textbox
id="idDeliveryHouseNumber"
value="@bind(fx.deliveryAddress.houseNumber)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormCity} :</cell>
<cell>
<textbox
id="idDeliveryCity"
value="@bind(fx.deliveryAddress.city)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormZIP} :</cell>
<cell>
<textbox
id="idDeliveryZIP"
value="@bind(fx.deliveryAddress.zipCode)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormPhone} :</cell>
<cell>
<textbox
id="idDeliveryPhone"
value="@bind(fx.deliveryAddress.phone)" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormEmail} :</cell>
<cell>
<textbox
id="idDeliveryEmail"
value="@bind(fx.deliveryAddress.email)"
width="100%" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormWWW} :</cell>
<cell colspan="3">
<textbox
id="idDeliveryWWW"
value="@bind(fx.deliveryAddress.web)"
width="100%" />
</cell>
</row>
</rows>
</grid>
</tabpanel>
<tabpanel>
<grid
hflex="1"
vflex="1">
<columns>
<column
align="right"
hflex="min" />
<column />
<column
align="right"
hflex="min" />
<column />
</columns>
<rows vflex="max">
<row>
<cell sclass="row-title">${labels.SuppliersFormCompany} :</cell>
<cell colspan="3">
<textbox
id="idInvoiceCompany"
value="@bind(fx.address.company)"
width="100%" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormIC} :</cell>
<cell>
<textbox
id="idInvoiceIC"
value="@bind(fx.address.ic)" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormDIC} :</cell>
<cell>
<textbox
id="idInvoiceDIC"
value="@bind(fx.address.dic)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormDepartment} :</cell>
<cell>
<textbox
id="idInvoiceDepartment"
value="@bind(fx.address.department)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormContact} :</cell>
<cell>
<textbox
id="idInvoiceContactName"
value="@bind(fx.address.contactName)"
width="100%" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormStreet} :</cell>
<cell>
<textbox
id="idInvoiceStreet"
value="@bind(fx.address.street)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormNo} :</cell>
<cell>
<textbox
id="idInvoiceHouseNumber"
value="@bind(fx.address.houseNumber)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormCity} :</cell>
<cell>
<textbox
id="idInvoiceCity"
value="@bind(fx.address.city)"
width="100%" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormZIP} :</cell>
<cell>
<textbox
id="idInvoiceZIP"
value="@bind(fx.address.zipCode)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormPhone} :</cell>
<cell>
<textbox
id="idInvoicePhone"
value="@bind(fx.address.phone)" />
</cell>
<cell sclass="row-title">${labels.SuppliersFormEmail} :</cell>
<cell>
<textbox
id="idInvoiceEmail"
value="@bind(fx.address.email)"
width="100%" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.SuppliersFormWWW} :</cell>
<cell colspan="3">
<textbox
id="idInvoiceWWW"
value="@bind(fx.address.web)"
width="100%" />
</cell>
</row>
</rows>
</grid>
</tabpanel>
</tabpanels>
</tabbox>
</hlayout>
<listbox
vflex="1"
selectedItem="@bind(vm.selectedItem)"
model="@load(fx.items)">
<listhead menupopup="auto">
<listheader
hflex="7"
sort="czech(code)"
label="${labels.RequirementItemCode}" />
<listheader
hflex="15"
sort="czech(name)"
label="${labels.RequirementItemName}" />
<listheader
hflex="20"
sort="czech(textItem)"
label="${labels.RequirementItemText}" />
<listheader
hflex="5"
sort="auto(quantity)"
align="right"
label="${labels.RequirementItemQuantity}" />
<listheader
hflex="5"
sort="auto(munit.name)"
label="${labels.RequirementItemMUnit}" />
<listheader
hflex="7"
align="right"
sort="auto(unitPrice)"
label="${labels.RequirementItemUnitPrice}" />
<listheader
hflex="7"
align="right"
sort="auto(total)"
label="${labels.RequirementItemTotal}" />
<listheader
hflex="15"
sort="czech(description)"
label="${labels.RequirementItemDescription}" />
</listhead>
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.textItem)" />
<listcell label="@load(each.quantity) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.munit.name)" />
<listcell label="@load(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
<listcell label="@load(each.description)" />
</listitem>
</template>
</listbox>
<include
vflex="min"
src="/app/formButtons.zul" />
</vlayout>
</window>
</zk>

@ -68,7 +68,7 @@
</cell> </cell>
</row> </row>
<row> <row>
<cell sclass="row-title">${labels.RequirementsFormDescription} :</cell> <cell sclass="row-title">${labels.Description} :</cell>
<cell> <cell>
<textbox <textbox
id="description" id="description"

Loading…
Cancel
Save