Agenda Vytvořené objednávky

Přidány záložky Doklady a Položky.

closes #148
multitenant
František Přibyl 10 years ago
parent cfcecc2e1b
commit 49f921847d

@ -124,8 +124,27 @@ public class StringUtils
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)
{ {
String item = StringUtils.nullStr(list.get(i));
result = StringUtils.addSeparator(result, separator); result = StringUtils.addSeparator(result, separator);
result += list.get(i); result += item;
}
return result;
}
public static String joinNotEmpty(List<String> list, String separator)
{
String result = "";
for (int i = 0; i < list.size(); i++)
{
String item = StringUtils.nullStr(list.get(i));
if (!item.isEmpty())
{
result = StringUtils.addSeparator(result, separator);
result += item;
}
} }
return result; return result;

@ -1,11 +1,17 @@
package info.bukova.isspst.ui; package info.bukova.isspst.ui;
import info.bukova.isspst.StringUtils;
import java.util.ArrayList;
import java.util.List;
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.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.KeyEvent; import org.zkoss.zk.ui.event.KeyEvent;
import org.zkoss.zul.Combobox; import org.zkoss.zul.Combobox;
import org.zkoss.zul.Messagebox;
public class DocumentViewModel public class DocumentViewModel
{ {
@ -77,4 +83,22 @@ public class DocumentViewModel
break; break;
} }
} }
@Command
public void testPressKey(@BindingParam("keyEvent") KeyEvent keyEvent)
{
int keyCode = keyEvent.getKeyCode();
boolean isCtrlKey = keyEvent.isCtrlKey();
boolean isAltKey = keyEvent.isAltKey();
boolean isShiftKey = keyEvent.isShiftKey();
List<String> list = new ArrayList<String>();
list.add(isCtrlKey ? "Ctrl" : "");
list.add(isAltKey ? "Alt" : "");
list.add(isShiftKey ? "Shift" : "");
list.add(Integer.toString(keyCode));
String sMsg = StringUtils.joinNotEmpty(list, "+");
Messagebox.show(sMsg + " is pressed", "testPressKey", Messagebox.OK, Messagebox.EXCLAMATION);
}
} }

@ -4,6 +4,7 @@ import info.bukova.isspst.AddressUtils;
import info.bukova.isspst.data.Address; import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.AddressEmb; import info.bukova.isspst.data.AddressEmb;
import info.bukova.isspst.data.Order; import info.bukova.isspst.data.Order;
import info.bukova.isspst.data.OrderItem;
import info.bukova.isspst.data.SettingsData; import info.bukova.isspst.data.SettingsData;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
import info.bukova.isspst.filters.OrderFilter; import info.bukova.isspst.filters.OrderFilter;
@ -13,12 +14,17 @@ import info.bukova.isspst.services.settings.GlobalSettingsService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
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.Listbox;
public class OrderList extends ListViewModel<Order> public class OrderList extends ListViewModel<Order>
{ {
@ -37,6 +43,10 @@ public class OrderList extends ListViewModel<Order>
@WireVariable @WireVariable
protected UserService userService; protected UserService userService;
protected OrderItem selectedOrderItem;
protected List<OrderItem> orderItems;
@Init(superclass = true) @Init(superclass = true)
public void initOrderList() public void initOrderList()
{ {
@ -44,6 +54,7 @@ public class OrderList extends ListViewModel<Order>
dataClass = Order.class; dataClass = Order.class;
formZul = "orderForm.zul"; formZul = "orderForm.zul";
dataFilter = new OrderFilter(getFilterTemplate()); dataFilter = new OrderFilter(getFilterTemplate());
this.orderItems = new ArrayList<OrderItem>();
} }
public List<AddressEmb> getSuppAddresses() public List<AddressEmb> getSuppAddresses()
@ -85,4 +96,43 @@ public class OrderList extends ListViewModel<Order>
{ {
return userService.getAll(); return userService.getAll();
} }
public OrderItem getSelectedOrderItem()
{
return selectedOrderItem;
}
public void setSelectedOrderItem(OrderItem selectedOrderItem)
{
this.selectedOrderItem = selectedOrderItem;
}
public List<OrderItem> getOrderItems()
{
return orderItems;
}
public void setOrderItems(List<OrderItem> orderItems)
{
this.orderItems = orderItems;
}
@Command
@NotifyChange("orderItems")
public void onChangeSelectOrder(@BindingParam("ctrl") Listbox lb)
{
if (lb == null)
{
return;
}
if (lb.getSelectedIndex() > -1)
{
this.orderItems = this.getDataBean().getItems();
}
else
{
this.orderItems = new ArrayList<OrderItem>();
}
}
} }

@ -316,6 +316,8 @@ CreateOrder=Vytvořit objednávku
NotYetFilled=Zatím nevyplněno NotYetFilled=Zatím nevyplněno
DeliveryAddress=Dodací adresa DeliveryAddress=Dodací adresa
BillingAddress=Fakturační adresa BillingAddress=Fakturační adresa
AccountDocuments=Doklady
Items=Položky
OrderFormNumber=Číslo objednávky OrderFormNumber=Číslo objednávky
OrderFormOrderDate=Datum objednávky OrderFormOrderDate=Datum objednávky

@ -2,6 +2,7 @@
<zk> <zk>
<window <window
vflex="1" vflex="1"
hflex="1"
border="normal" border="normal"
apply="org.zkoss.bind.BindComposer" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.dashboard.DashBoardVM')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.dashboard.DashBoardVM')">
@ -23,9 +24,15 @@
<caption <caption
image="/img/commission-small.png" image="/img/commission-small.png"
label="${labels.CentresForRequirements}" /> label="${labels.CentresForRequirements}" />
<hbox children="@load(vm.centres)"> <hbox
children="@load(vm.centres)"
vflex="1"
hflex="1">
<template name="children"> <template name="children">
<listbox model="@load(vm.groupRoles[each])"> <listbox
model="@load(vm.groupRoles[each])"
vflex="1"
hflex="1">
<listhead> <listhead>
<listheader label="@load(each.fullName)" /> <listheader label="@load(each.fullName)" />
</listhead> </listhead>
@ -40,7 +47,9 @@
</template> </template>
</hbox> </hbox>
</groupbox> </groupbox>
<hbox vflex="1" hflex="1"> <hbox
vflex="1"
hflex="1">
<groupbox <groupbox
vflex="1" vflex="1"
hflex="1" hflex="1"
@ -49,10 +58,15 @@
image="/img/commission-small.png" image="/img/commission-small.png"
label="${labels.WorkgroupMembership}" /> label="${labels.WorkgroupMembership}" />
<vbox <vbox
vflex="1"
hflex="1"
sclass="addScrollbar" sclass="addScrollbar"
children="@load(vm.workgroups)"> children="@load(vm.workgroups)">
<template name="children"> <template name="children">
<listbox model="@load(vm.groupRoles[each])"> <listbox
model="@load(vm.groupRoles[each])"
vflex="1"
hflex="1">
<listhead> <listhead>
<listheader label="@load(each.fullName)" /> <listheader label="@load(each.fullName)" />
</listhead> </listhead>
@ -75,21 +89,25 @@
image="/img/money-small.png" image="/img/money-small.png"
label="${labels.WorkgroupLimits}" /> label="${labels.WorkgroupLimits}" />
<vbox <vbox
vflex="1"
hflex="1"
sclass="addScrollbar" sclass="addScrollbar"
children="@load(vm.workgroups)"> children="@load(vm.workgroups)">
<template name="children"> <template name="children">
<listbox> <listbox
vflex="1"
hflex="1">
<listhead> <listhead>
<listheader label="@load(each.fullName)"/> <listheader label="@load(each.fullName)" />
<listheader/> <listheader />
</listhead> </listhead>
<listitem> <listitem>
<listcell label="${labels.Limit}"/> <listcell label="${labels.Limit}" />
<listcell label="@load(each.limit) @converter(vm.standardBigDecimalConverter)"/> <listcell label="@load(each.limit) @converter(vm.standardBigDecimalConverter)" />
</listitem> </listitem>
<listitem> <listitem>
<listcell label="${labels.Spent}"/> <listcell label="${labels.Spent}" />
<listcell label="@load(vm.workgroupSpent[each]) @converter(vm.standardBigDecimalConverter)"/> <listcell label="@load(vm.workgroupSpent[each]) @converter(vm.standardBigDecimalConverter)" />
</listitem> </listitem>
</listbox> </listbox>
</template> </template>

@ -2,7 +2,7 @@
<zk> <zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?> <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window <window
vflex="1" vflex=" 1"
border="normal" border="normal"
apply="org.zkoss.bind.BindComposer" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.created.OrderList')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.created.OrderList')">
@ -10,9 +10,19 @@
image="/img/autotruck-032.png" image="/img/autotruck-032.png"
zclass="form-caption" zclass="form-caption"
label="${labels.CreatedOrders}" /> label="${labels.CreatedOrders}" />
<include src="/app/toolbar.zul" /> <tabbox
vflex="1"
orient="top">
<tabs width="500px">
<tab label="${labels.AccountDocuments}" />
<tab label="${labels.Items}" />
</tabs>
<tabpanels>
<tabpanel>
<include src="/main/toolbar.zul" />
<listbox <listbox
vflex="1" vflex="1"
onSelect="@command('onChangeSelectOrder', ctrl=self)"
selectedItem="@bind(vm.dataBean)" selectedItem="@bind(vm.dataBean)"
model="@load(vm.dataList)"> model="@load(vm.dataList)">
<listhead menupopup="auto"> <listhead menupopup="auto">
@ -150,7 +160,8 @@
onChange="@command('doFilter')" onChange="@command('doFilter')"
width="100%" width="100%"
selectedItem="@bind(vm.filterTemplate.suplier)" selectedItem="@bind(vm.filterTemplate.suplier)"
model="@load(vm.suppAddresses)"> model="@load(vm.suppAddresses)"
readonly="true">
<template name="model"> <template name="model">
<comboitem label="@load(each)" /> <comboitem label="@load(each)" />
</template> </template>
@ -248,5 +259,64 @@
</listitem> </listitem>
</template> </template>
</listbox> </listbox>
</tabpanel>
<tabpanel>
<listbox
vflex="1"
selectedItem="@bind(vm.selectedOrderItem)"
model="@load(vm.orderItems)">
<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>
</tabpanel>
</tabpanels>
</tabbox>
</window> </window>
</zk> </zk>
Loading…
Cancel
Save