Formulář ag. Služební cesty / Aktuální požadavky

• přidáno textové pole "Cizí osoby"
• upraven popisek formuláře
• upraven vzhled a zarovnání prvků
• přidána kontrola ukazatele při promazávání souborů na disku i v
databázi
• sjednocena maska pro formátování data v <datebox>
closes #197
Verze_2.0
František Přibyl 10 years ago
parent 9c5679af2c
commit ac90b0a2e3

@ -1,16 +1,30 @@
package info.bukova.isspst.data; package info.bukova.isspst.data;
import info.bukova.isspst.storage.EntityWithAttachment; import info.bukova.isspst.storage.EntityWithAttachment;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.*;
import javax.persistence.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.search.annotations.Analyze;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
@Entity @Entity
@Table(name = "TRIPREQUIREMENT") @Table(name = "TRIPREQUIREMENT")
@Indexed @Indexed
@ -32,6 +46,11 @@ public class TripRequirement extends RequirementBase implements EntityWithAttach
@LazyCollection(LazyCollectionOption.TRUE) @LazyCollection(LazyCollectionOption.TRUE)
@JoinTable(name="TRIPREQUIREMENT_PASSANGER", joinColumns={@JoinColumn(name="TRIPREQUIREMENT_ID")}, inverseJoinColumns={@JoinColumn(name="USER_ID")}) @JoinTable(name="TRIPREQUIREMENT_PASSANGER", joinColumns={@JoinColumn(name="TRIPREQUIREMENT_ID")}, inverseJoinColumns={@JoinColumn(name="USER_ID")})
private List<User> passengers; private List<User> passengers;
@Column(name = "FOREIGN_PERSONS")
@Field(index = Index.YES, analyze = Analyze.YES)
private String foreignPersons;
@Embedded @Embedded
private Vehicle vehicle; private Vehicle vehicle;
@Column(name = "REQUIRE_DOWN_PAYMENT") @Column(name = "REQUIRE_DOWN_PAYMENT")
@ -99,6 +118,16 @@ public class TripRequirement extends RequirementBase implements EntityWithAttach
this.passengers = passengers; this.passengers = passengers;
} }
public String getForeignPersons()
{
return foreignPersons;
}
public void setForeignPersons(String foreignPersons)
{
this.foreignPersons = foreignPersons;
}
public Vehicle getVehicle() { public Vehicle getVehicle() {
return vehicle; return vehicle;
} }

@ -1,21 +1,28 @@
package info.bukova.isspst.storage; package info.bukova.isspst.storage;
import info.bukova.isspst.dao.QueryDao; import info.bukova.isspst.dao.QueryDao;
import info.bukova.isspst.data.FileContent;
import info.bukova.isspst.data.FileMetainfo; import info.bukova.isspst.data.FileMetainfo;
import info.bukova.isspst.services.fulltext.Extractor; import info.bukova.isspst.services.fulltext.Extractor;
import info.bukova.isspst.services.fulltext.ExtractorFactory; import info.bukova.isspst.services.fulltext.ExtractorFactory;
import org.apache.commons.codec.binary.Hex;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.*; import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.apache.commons.codec.binary.Hex;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @author Pepa Rokos * @author Pepa Rokos
* *
@ -245,12 +252,17 @@ public class DocumentFileStorageImpl extends AbstractFileStorage<FileMetainfo> i
boolean fileExists = false; boolean fileExists = false;
for (FileMetainfo info : infos) { for (FileMetainfo info : infos) {
if (info.getContent().getPathInFilesystem().equals(f.getName())) { FileContent fileContent = info.getContent();
if ((fileContent != null) && f.isFile() && fileContent.getPathInFilesystem().equals(f.getName()))
{
fileExists = true; fileExists = true;
break;
} }
} }
if (!fileExists && f.isFile()) { if (!fileExists && f.isFile())
{
f.delete(); f.delete();
} }
} }

@ -15,7 +15,7 @@ RequirementsFormPurpose=Účel cesty
RequirementsFormStartDateTime=Datum a čas odjezdu RequirementsFormStartDateTime=Datum a čas odjezdu
RequirementsFormEndTravel=Konec cesty RequirementsFormEndTravel=Konec cesty
RequirementsFormEndDate=Datum příjezdu RequirementsFormEndDate=Datum příjezdu
RequirementsFormPassengers=Spolucestující: RequirementsFormPassengers=Spolucestující
RequirementsFormVehicle=Dopravní prostředek: RequirementsFormVehicle=Dopravní prostředek:
RequirementsGridNumberSerie=Číslo RequirementsGridNumberSerie=Číslo
RequirementsGridReqDate=Datum požadavku RequirementsGridReqDate=Datum požadavku
@ -393,3 +393,9 @@ Search=Hledat
Pending = Nevyřízené Pending = Nevyřízené
Archive = Archiv Archive = Archiv
Completed = Vyřízeno Completed = Vyřízeno
GenerateBillingForPassengers = Generovat vyúčtování pro spolucestující
Passenger = Pasažér
ChooseThePasseger = Vyberte pasažéra
TransportMode = Způsob dopravy
ForeignPersons = Cizí osoby

@ -1,37 +1,54 @@
<?page title="${labels.TravelOrdersFormTitle}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.TravelOrdersFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk
<zk xmlns="http://www.zkoss.org/2005/zul" xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd"> xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?> <?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<vbox vflex="1">
<vbox> <button
<button image="/img/upload-016.png" vflex="min"
image="/img/upload-016.png"
label="Připojit soubor" label="Připojit soubor"
upload="true" upload="true"
onUpload="@command('uploadAttachment')" onUpload="@command('uploadAttachment')"
sclass="nicebutton" /> sclass="nicebutton" />
<grid model="@load(vm.attachments)" height="180px"> <grid
model="@load(vm.attachments)"
vflex="1">
<columns> <columns>
<column label="Soubor" width="220px"/> <column
<column label="Popis" hflex="max"/> label="Soubor"
<column width="200px"/> width="220px" />
<column
label="Popis"
hflex="max" />
<column width="200px" />
</columns> </columns>
<rows> <rows>
<template name="model"> <template name="model">
<row> <row>
<a href="@load('/api/dl/'.concat(each.pathInFilesystem).concat('/').concat(each.fileName))" <a
href="@load('/api/dl/'.concat(each.pathInFilesystem).concat('/').concat(each.fileName))"
label="@load(each.fileName)" label="@load(each.fileName)"
target="blank"/> target="blank" />
<textbox value="@bind(each.description)" sclass="grid-textbox-max"/> <textbox
value="@bind(each.description)"
sclass="grid-textbox-max" />
<hbox> <hbox>
<button image="/img/delete-016.png" label="Odebrat" onClick="@command('deleteAttachment', attachment=each)" sclass="nicebutton"/> <button
<button image="/img/download-016.png" label="Stáhnout" onClick="@command('downloadAttachment', attachment=each)" sclass="nicebutton"/> image="/img/delete-016.png"
label="Odebrat"
onClick="@command('deleteAttachment', attachment=each)"
sclass="nicebutton" />
<button
image="/img/download-016.png"
label="Stáhnout"
onClick="@command('downloadAttachment', attachment=each)"
sclass="nicebutton" />
</hbox> </hbox>
</row> </row>
</template> </template>
</rows> </rows>
</grid> </grid>
</vbox> </vbox>
</zk> </zk>

@ -15,7 +15,9 @@
<vbox hflex="1"> <vbox hflex="1">
<hbox> <hbox>
<label value="${labels.RequirementApproveDate}"/> <label value="${labels.RequirementApproveDate}"/>
<datebox value="@bind(vm.approveDate)"/> <datebox
value="@bind(vm.approveDate)"
format="${labels.DateFormat}" />
</hbox> </hbox>
<separator bar="true" hflex="1"/> <separator bar="true" hflex="1"/>
<hbox> <hbox>

@ -56,6 +56,7 @@
<listcell> <listcell>
<datebox <datebox
value="@bind(each.invoiceDate)" value="@bind(each.invoiceDate)"
format="${labels.DateFormat}"
inplace="true" inplace="true"
onFocus="@command('onFocus', item=each)" /> onFocus="@command('onFocus', item=each)" />
</listcell> </listcell>

@ -1,5 +1,6 @@
<?page title="${labels.RequirementsFormTitle}" contentType="text/html;charset=UTF-8"?> <?page title="${labels.RequirementsFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul" <zk
xmlns="http://www.zkoss.org/2005/zul"
xmlns:h="http://www.w3.org/1999/xhtml" xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd"> xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
@ -15,10 +16,19 @@
<caption <caption
src="/img/reqact.png" src="/img/reqact.png"
zclass="form-caption" zclass="form-caption"
label="${labels.RequirementsFormTitle}" /> label="${labels.TripRequirement}" />
<vlayout form="@id('fx') @load(vm.dataBean) @save(vm.dataBean, before='save') @validator(vm.validator)"> <!-- Dialog -->
<hbox> <vlayout
<grid hflex="min"> form="@id('fx') @load(vm.dataBean) @save(vm.dataBean, before='save') @validator(vm.validator)"
sclass="addScrollbar"
vflex="1">
<!-- Formulář + soubory -->
<hbox
hflex="1"
vflex="min">
<grid
hflex="min"
vflex="1">
<columns> <columns>
<column <column
align="right" align="right"
@ -77,14 +87,13 @@
<datebox <datebox
id="tripDate" id="tripDate"
width="200px" width="200px"
format="medium" format="${labels.DateFormat}"
value="@bind(fx.tripDate)" /> value="@bind(fx.tripDate)" />
<timebox <timebox
id="tripTime" id="tripTime"
width="90px" width="90px"
format="short" format="short"
value="@bind(fx.tripDate)" /> value="@bind(fx.tripDate)" />
</hbox> </hbox>
</cell> </cell>
</row> </row>
@ -124,67 +133,130 @@
<datebox <datebox
id="endDate" id="endDate"
width="300px" width="300px"
format="medium" format="${labels.DateFormat}"
value="@bind(fx.endDate)" /> value="@bind(fx.endDate)" />
</cell> </cell>
</row> </row>
</rows> </rows>
</grid> </grid>
<include src="/app/uploadComponents.zul"/> <include
src="/app/uploadComponents.zul"
vflex="1" />
</hbox> </hbox>
<vbox> <!-- Spolucestující -->
<label value="${labels.RequirementsFormPassengers}"/> <groupbox
<hbox> closable="false"
<combobox model="@load(vm.users)" hflex="1"
vflex="min"
mold="3d">
<caption label="${labels.RequirementsFormPassengers}" />
<hlayout
hflex="1"
vflex="min">
<vlayout
hflex="1"
vflex="1">
<grid>
<columns>
<column hflex="min" />
<column />
</columns>
<rows>
<row>
<cell sclass="row-title">${labels.ChooseThePasseger} :</cell>
<cell>
<combobox
model="@load(vm.users)"
autocomplete="true" autocomplete="true"
selectedItem="@bind(vm.selUser)"> selectedItem="@bind(vm.selUser)">
<template name="model"> <template name="model">
<comboitem label="@load(each)"/> <comboitem label="@load(each)" />
</template> </template>
</combobox> </combobox>
<button label="${labels.Confirm}" <button
label="${labels.Confirm}"
onClick="@command('addPassanger')" onClick="@command('addPassanger')"
sclass="nicebutton" sclass="nicebutton"
disabled="@load(vm.selUser eq null)"/> disabled="@load(vm.selUser eq null)" />
</hbox> </cell>
<checkbox label="Generovat vyúčtování pro spolucestující" </row>
<row>
<cell sclass="row-title">${labels.ForeignPersons} :</cell>
<cell>
<textbox
id="foreignPersons"
hflex="1"
maxlength="@load(vm.lengthText)"
value="@bind(fx.foreignPersons)" />
</cell>
</row>
</rows>
</grid>
<checkbox
label="${labels.GenerateBillingForPassengers}"
checked="@bind(vm.dataBean.billForPassengers)" checked="@bind(vm.dataBean.billForPassengers)"
disabled="@load(empty vm.passengers)"/> disabled="@load(empty vm.passengers)" />
<grid model="@load(vm.passengers)" width="700px"> </vlayout>
<vlayout
hflex="1"
vflex="1">
<grid
model="@load(vm.passengers)"
sizedByContent="true"
hflex="1"
height="200px">
<columns> <columns>
<column/> <column hflex="10" />
<column/> <column hflex="min" />
<column hflex="1" />
</columns> </columns>
<rows> <rows>
<template name="model"> <template name="model">
<row> <row>
<label value="@load(each)" /> <label value="@load(each)" />
<button label="${labels.RemoveItem}" <button
label="${labels.RemoveItem}"
onClick="@command('removePassanger', user=each)" onClick="@command('removePassanger', user=each)"
sclass="nicebutton"/> sclass="nicebutton" />
</row> </row>
</template> </template>
</rows> </rows>
</grid> </grid>
</vlayout>
</hlayout>
</groupbox>
<!-- Způsob dopravy -->
<vbox
hflex="1"
vflex="min">
<groupbox
closable="false"
vflex="min"
hflex="1"
mold="3d">
<caption label="${labels.TransportMode}" />
<hbox>
<grid hflex="min"> <grid hflex="min">
<columns> <columns>
<column hflex="min"/> <column hflex="min" />
<column hflex="min"/> <column hflex="min" />
</columns> </columns>
<rows> <rows>
<row> <row>
<label value="${labels.RequirementsFormVehicle}"/> <label value="${labels.RequirementsFormVehicle}" />
<combobox model="@load(vm.settings.vehicles)" <combobox
model="@load(vm.settings.vehicles)"
selectedItem="@bind(fx.vehicle)" selectedItem="@bind(fx.vehicle)"
readonly="true"> readonly="true">
<template name="model"> <template name="model">
<comboitem label="@load(each)"/> <comboitem label="@load(each)" />
</template> </template>
</combobox> </combobox>
</row> </row>
<row> <row>
<checkbox label="Požaduji zálohu" checked="@bind(vm.dataBean.requireDownPayment)"/> <checkbox
label="Požaduji zálohu"
checked="@bind(vm.dataBean.requireDownPayment)" />
<textbox <textbox
value="@bind(vm.dataBean.downPayment)" value="@bind(vm.dataBean.downPayment)"
maxlength="@load(vm.lengthText)" maxlength="@load(vm.lengthText)"
@ -192,8 +264,17 @@
</row> </row>
</rows> </rows>
</grid> </grid>
</hbox>
</groupbox>
</vbox>
<!-- Prázdný vbox = ostatní mají min. plochu a tento se roztahuje podle toho co zbyde. Když nic nezbyde, zobrazí se na min. plochou scrollbar a tohle není vidět -->
<vbox
hflex="1"
vflex="1">
</vbox> </vbox>
<include src="/app/formButtons.zul" />
</vlayout> </vlayout>
<include
src="/app/formButtons.zul"
vflex="min" />
</window> </window>
</zk> </zk>

@ -46,7 +46,7 @@
sclass="nicebutton"/> sclass="nicebutton"/>
<div visible="@load(not empty vm.bills)" vflex="1"> <div visible="@load(not empty vm.bills)" vflex="1">
<separator bar="true" width="100%"/> <separator bar="true" width="100%"/>
<label value="${labels.RequirementsFormPassengers}"/> <label value="${labels.RequirementsFormPassengers}:"/>
<grid model="@load(vm.bills)" vflex="1"> <grid model="@load(vm.bills)" vflex="1">
<columns> <columns>
<column /> <column />

@ -49,7 +49,10 @@
<rows> <rows>
<row> <row>
<label value="${labels.TripBillResultMessage}"/> <label value="${labels.TripBillResultMessage}"/>
<datebox value="@bind(vm.dataBean.resultMessageDate)" disabled="${disabled}"/> <datebox
value="@bind(vm.dataBean.resultMessageDate)"
disabled="${disabled}"
format="${labels.DateFormat}" />
</row> </row>
<row> <row>
<cell colspan="2"> <cell colspan="2">

Loading…
Cancel
Save