Vytvořená agenda Měrné jednotky.

closes #90
multitenant
František Přibyl 11 years ago
parent 0ea29ce50e
commit a310a438cb

@ -6,6 +6,7 @@ import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.buildings.BuildingService;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;
@ -49,11 +50,13 @@ public class Constants {
public final static String MOD_PERMISSIONS = "PERMISSIONS";
public final static String MOD_ADDRESSBOOK = "ADDRESSBOOK";
public final static String MOD_BUILDINGS = "BUILDINGS";
public final static String MOD_MUNITS = "MUNITS";
public final static Module MODULES[] = {
new Module(MOD_USERS, "Uživatelé", UserService.class),
new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
new Module(MOD_ADDRESSBOOK, "Dodavatelé", AdbService.class),
new Module(MOD_BUILDINGS, "Budovy", BuildingService.class)
new Module(MOD_USERS, "Uživatelé", UserService.class)
, new Module(MOD_PERMISSIONS, "Práva", RoleService.class)
, new Module(MOD_ADDRESSBOOK, "Dodavatelé", AdbService.class)
, new Module(MOD_BUILDINGS, "Budovy", BuildingService.class)
, new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class)
};
public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava";

@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.MUnit;
public interface MUnitDao extends BaseDao<MUnit> {
}

@ -0,0 +1,12 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.MUnitDao;
import info.bukova.isspst.data.MUnit;
public class MUnitDaoJPA extends BaseDaoJPA<MUnit> implements MUnitDao {
@Override
public String getEntityName() {
return "MUnit";
}
}

@ -0,0 +1,67 @@
package info.bukova.isspst.data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.validator.constraints.NotBlank;
@Entity
@Table(name = "MUNIT")
public class MUnit extends BaseData implements DataModel {
@Column(name = "CODE", unique = true)
private String code;
@Column(name = "NAME")
private String name;
@Column(name = "DESCRIPTION")
private String description;
/**
* @return the code
*/
@NotBlank(message = "{MUnitsFormCodeConstr}")
public String getCode() {
return code;
}
/**
* @param code
* the code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description
* the description to set
*/
public void setDescription(String description) {
this.description = description;
}
}

@ -0,0 +1,56 @@
package info.bukova.isspst.filters;
import static info.bukova.isspst.StringUtils.nullStr;
import info.bukova.isspst.data.MUnit;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
public class MUnitFilter implements Filter<MUnit> {
private MUnit condMUnit;
public MUnitFilter(MUnit condMUnit) {
this.condMUnit = condMUnit;
}
private static class MUnitMatcher extends TypeSafeMatcher<MUnit> {
private MUnit condMUnit;
public MUnitMatcher(MUnit cond) {
this.condMUnit = cond;
}
@Override
public void describeTo(Description desc) {
desc.appendText("munits matches");
}
@Override
public boolean matchesSafely(MUnit item) {
return nullStr(item.getCode()).toLowerCase().contains(nullStr(condMUnit.getCode()).toLowerCase())
&& nullStr(item.getName()).toLowerCase().contains(nullStr(condMUnit.getName()).toLowerCase())
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condMUnit.getDescription()).toLowerCase());
}
@Factory
public static Matcher<MUnit> matchMUnit(MUnit munit) {
return new MUnitMatcher(munit);
}
}
@Override
public MUnitMatcher matcher() {
return new MUnitMatcher(condMUnit);
}
@Override
public String queryString() {
// TODO query string
return "";
}
}

@ -0,0 +1,8 @@
package info.bukova.isspst.services.munits;
import info.bukova.isspst.data.MUnit;
import info.bukova.isspst.services.Service;
public interface MUnitService extends Service<MUnit> {
}

@ -0,0 +1,8 @@
package info.bukova.isspst.services.munits;
import info.bukova.isspst.data.MUnit;
import info.bukova.isspst.services.AbstractService;
public class MUnitServiceImpl extends AbstractService<MUnit> implements MUnitService{
}

@ -1,6 +1,7 @@
package info.bukova.isspst.ui;
package info.bukova.isspst.ui.buildings;
import info.bukova.isspst.data.Building;
import info.bukova.isspst.ui.FormViewModel;
import org.zkoss.bind.annotation.Init;

@ -1,8 +1,9 @@
package info.bukova.isspst.ui;
package info.bukova.isspst.ui.buildings;
import info.bukova.isspst.data.Building;
import info.bukova.isspst.filters.BuildingFilter;
import info.bukova.isspst.services.buildings.BuildingService;
import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;

@ -0,0 +1,14 @@
package info.bukova.isspst.ui.munits;
import info.bukova.isspst.data.MUnit;
import info.bukova.isspst.ui.FormViewModel;
import org.zkoss.bind.annotation.Init;
public class MUnitsForm extends FormViewModel<MUnit> {
@Init(superclass = true)
public void init() {
}
}

@ -0,0 +1,23 @@
package info.bukova.isspst.ui.munits;
import info.bukova.isspst.data.MUnit;
import info.bukova.isspst.filters.MUnitFilter;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.ui.ListViewModel;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
public class MUnitsList extends ListViewModel<MUnit> {
@WireVariable
private MUnitService munitService;
@Init
public void init() {
service = munitService;
dataClass = MUnit.class;
formZul = "munitsForm.zul";
dataFilter = new MUnitFilter(getFilterTemplate());
}
}

@ -1 +1,2 @@
BuildingsFormCodeConstr=Zadejte k\u00f3d budovy...
MUnitsFormCodeConstr=Zadejte k\u00f3d m\u011brn\u00e9 jednotky...

@ -11,5 +11,6 @@
<mapping class="info.bukova.isspst.data.BaseData"></mapping>
<mapping class="info.bukova.isspst.data.Address"></mapping>
<mapping class="info.bukova.isspst.data.Building"></mapping>
<mapping class="info.bukova.isspst.data.MUnit"></mapping>
</session-factory>
</hibernate-configuration>

@ -66,6 +66,7 @@
<security:intercept-url pattern="/admin/users/**" access="hasRole('ROLE_ADMIN')"/>
<security:intercept-url pattern="/admin/permissions/**" access="hasRole('ROLE_ADMIN')"/>
<security:intercept-url pattern="/admin/addressbook/**" access="hasRole('PERM_READ_ADDRESSBOOK')"/>
<security:intercept-url pattern="/munits/**" access="hasRole('PERM_READ_MUNITS')"/>
<security:form-login login-page="/login.zhtml"
authentication-failure-handler-ref="loginFail"/>
<security:http-basic/>
@ -107,6 +108,10 @@
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="munitDao" class="info.bukova.isspst.dao.jpa.MUnitDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="addressDao" class="info.bukova.isspst.dao.jpa.AddressDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
@ -132,6 +137,11 @@
<property name="validator" ref="validator" />
</bean>
<bean id="munitService" class="info.bukova.isspst.services.munits.MUnitServiceImpl">
<property name="dao" ref="munitDao" />
<property name="validator" ref="validator" />
</bean>
<bean id="adbService" class="info.bukova.isspst.services.addressbook.AdbServiceImpl">
<property name="dao" ref="addressDao" />
<property name="validator" ref="validator" />

@ -1,6 +1,15 @@
# Default file
AppName=Objednávkový systém SPŠ Třebíč
AgendaMUnits=Měrné jednotky
MUnitsFormTitle=Měrná jednotka
MUnitsFormCode=Kód
MUnitsFormName=Název
MUnitsFormDescription=Popis
MUnitsGridColumnCode=Kód
MUnitsGridColumnName=Název
MUnitsGridColumnDescription=Popis
AgendaBuildings=Budovy
BuildingsFormTitle=Budova
BuildingsFormCode=Kód

@ -19,8 +19,8 @@
</library-property>
<language-config>
<addon-uri>/WEB-INF/mapa-lang-addon.xml</addon-uri>
<addon-uri>/WEB-INF/ckez-bind-lang-addon.xml</addon-uri>
<addon-uri>/WEB-INF/lang-addons/mapa-lang-addon.xml</addon-uri>
<addon-uri>/WEB-INF/lang-addons/ckez-bind-lang-addon.xml</addon-uri>
<addon-uri>/WEB-INF/lang-addons/CzechSortListheader.xml</addon-uri>
</language-config>

@ -20,7 +20,8 @@
</tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="E-maily" width="120px"/>
<menuitem label="${labels.AgendaMUnits}" href="/munits" disabled="${not sec:isAllGranted('PERM_READ_MUNITS')}" width="120px"/>
<menuitem label="E-maily" />
<menuitem label="Další"/>
<menuitem label="Položka"/>
</menubar>
@ -30,7 +31,7 @@
<menuitem label="${labels.AgendaUsers}" href="/admin/users" disabled="${not sec:isAllGranted('ROLE_ADMIN')}" width="120px"/>
<menuitem label="Práva" href="/admin/permissions" disabled="${not sec:isAllGranted('ROLE_ADMIN')}"/>
<menuitem label="Střediska" href="/admin/users" disabled="${not sec:isAllGranted('ROLE_ADMIN')}"/>
<menuitem label="${labels.AgendaBuildings}" href="/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}"/>
<menuitem label="${labels.AgendaBuildings}" href="/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" />
<menuitem label="Místnosti" href="/admin/users"/>
<menuitem label="Dodavatelé" href="/admin/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/>
</menubar>

@ -1,7 +1,7 @@
<?page title="${labels.AgendaBuildings}" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.BuildingList')">
<window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.buildings.BuildingList')">
<caption zclass="form-caption" label="${labels.AgendaBuildings}" />
<include src="/app/toolbar.zul" />

@ -1,6 +1,6 @@
<?page title="${labels.BuildingsFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.BuildingForm')">
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.buildings.BuildingForm')">
<caption src="/img/building.png" zclass="form-caption" label="${labels.BuildingsFormTitle}" />
<vlayout>
<grid hflex="min">

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -0,0 +1,10 @@
<?page title="${labels.AgendaMUnits}" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
String gridZul = "munitsGrid.zul";
</zscript>
<include src="/app/template.zhtml"/>
</zk>

@ -0,0 +1,35 @@
<?page title="${labels.MUnitsFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.munits.MUnitsForm')">
<caption src="/img/munits.png" zclass="form-caption" label="${labels.MUnitsFormTitle}" />
<vlayout>
<grid hflex="min">
<columns>
<column align="right" hflex="min" />
<column />
</columns>
<rows>
<row>
<cell sclass="row-title">${labels.MUnitsFormCode} :</cell>
<cell>
<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.code)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.MUnitsFormName} :</cell>
<cell>
<textbox id="name" width="200px" value="@bind(vm.dataBean.name)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.MUnitsFormDescription} :</cell>
<cell>
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
</cell>
</row>
</rows>
</grid>
<include src="/app/formButtons.zul" />
</vlayout>
</window>
</zk>

@ -0,0 +1,58 @@
<?page title="${labels.AgendaMUnits}" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.munits.MUnitsList')">
<caption zclass="form-caption" label="${labels.AgendaMUnits}" />
<include src="/app/toolbar.zul" />
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)">
<listhead menupopup="auto">
<listheader label="${labels.MUnitsGridColumnCode}" sort="czech(code)" width="10%" />
<listheader label="${labels.MUnitsGridColumnName}" sort="czech(name)" width="30%" />
<listheader label="${labels.MUnitsGridColumnDescription}" sort="czech(description)" width="60%" />
</listhead>
<auxhead sclass="category-center" visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.code)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.name)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.description)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
<listcell label="@load(each.description)" />
</listitem>
</template>
</listbox>
</window>
</zk>
Loading…
Cancel
Save