form update

This commit is contained in:
Ralph Soika 2020-11-24 16:36:19 +01:00
parent ce4ca4d541
commit 99f6204695
7 changed files with 465 additions and 23 deletions

View file

@ -0,0 +1,41 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
<!-- the following code computes the txtworkflow abstract from the current modelversion and processid -->
<ui:param name="instruction"
value="#{modelController.getProcessDescription(workflowController.workitem.item['$taskid'],workflowController.workitem.item['$ModelVersion'],workflowController.workitem)}"></ui:param>
<h:panelGroup layout="block" styleClass="imixs-instruction"
rendered="#{! empty instruction}">
<h:outputText escape="false" value="#{instruction}"/>
</h:panelGroup>
<!-- Custom Form -->
<f:subview>
<ui:include src="/pages/workitems/forms/custom.xhtml">
<ui:param name="workitem" value="#{workflowController.workitem}" />
</ui:include>
</f:subview>
<!-- sub forms (optional) -->
<c:forEach items="#{formController.formDefinition.sections}"
var="section">
<div class="imixs-form-panel">
<h3>
<h:outputText value="#{section.name}" />
</h3>
<f:subview>
<ui:include src="/pages/workitems/forms/#{section.path}.xhtml">
<ui:param name="workitem" value="#{workflowController.workitem}" />
</ui:include>
</f:subview>
</div>
</c:forEach>
</ui:composition>

View file

@ -0,0 +1,43 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
<!-- the following code computes the txtworkflow abstract from the current modelversion and processid -->
<ui:param name="instruction"
value="#{modelController.getProcessDescription(workflowController.workitem.item['$taskid'],workflowController.workitem.item['$ModelVersion'],workflowController.workitem)}"></ui:param>
<h:panelGroup layout="block" styleClass="imixs-instruction"
rendered="#{! empty instruction}">
<h:outputText escape="false" value="#{instruction}"/>
</h:panelGroup>
<!-- Custom Form -->
<f:subview>
<ui:include src="/pages/workitems/forms/custom_read.xhtml">
<ui:param name="workitem" value="#{workflowController.workitem}" />
</ui:include>
</f:subview>
<!-- sub forms (optional) -->
<c:forEach items="#{formController.formDefinition.sections}"
var="section">
<div class="imixs-form-panel">
<h3>
<h:outputText value="#{section.name}" />
</h3>
<f:subview>
<ui:include src="/pages/workitems/forms/#{section.path}.xhtml">
<ui:param name="workitem" value="#{workflowController.workitem}" />
</ui:include>
</f:subview>
</div>
</c:forEach>
</ui:composition>

View file

@ -0,0 +1,42 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<dl class="columns-1">
<dt>
<h:outputLabel for="titel_id" value="#{message['form.subject']}" />
</dt>
<dd>
<h:inputText value="#{workflowController.workitem.item['_subject']}"
style="" required="true"></h:inputText>
</dd>
<dt>
<h:outputLabel value="#{message['form.date']}" />
</dt>
<dd>
<h:inputText value="#{workflowController.workitem.item['_date']}"
styleClass="imixs-date">
<f:convertDateTime pattern="#{message.datePatternShort}" timeZone="#{message.timeZone}"/>
</h:inputText>
</dd>
<dt>
<h:outputLabel value="#{message['form.description']}" />
</dt>
<dd>
<h:inputTextarea id="abstract_id" class="imixs-editor"
value="#{workflowController.workitem.item['htmldocumentation']}" />
</dd>
</dl>
<div style="clear:left;" />
</ui:composition>

View file

@ -0,0 +1,184 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
<h:panelGroup layout="block" styleClass="imixs-form-section"
id="oderlist" binding="#{orderlistContainer}">
<f:ajax render="oderlist" onevent="updateOrderItems">
<table class="imixsdatatable imixs-orderitems">
<tr>
<th style="width: 10px;">Pos.</th>
<th style="width: 120px;">Positionsnummer<span class="imixs-required"> *</span></th>
<th style="width: 50px;">Buchungsperiode</th>
<th style="width: 30px;">Steuer</th>
<th style="width: 100px;">Betrag</th>
<th style="width: 5px;">
<!-- delete -->
</th>
</tr>
<ui:repeat var="orderitem" value="#{childItemController.childItems}">
<tr>
<!-- pos -->
<td><h:outputText value="#{orderitem.item['numpos']}" /></td>
<!-- Name -->
<td><h:inputText value="#{orderitem.item['name']}" /></td>
<!-- periode -->
<td><h:inputText value="#{orderitem.item['period']}" /></td>
<!-- Steuer -->
<td><h:inputText value="#{orderitem.item['tax']}" /></td>
<!-- Betrag -->
<td><h:inputText value="#{orderitem.item['amount']}"
a:data-id="orderitem_amount" style="text-align: right;"
onchange="calculateSummary()">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:inputText></td>
<td><h:commandLink
actionListener="#{childItemController.remove(orderitem.item['numpos'])}">
<span class="typcn typcn-trash imixs-state-info"></span>
<f:ajax render="#{orderlistContainer.clientId}"
onevent="updateOrderItems" />
</h:commandLink>
<!-- item summary -->
<h:inputHidden value="#{orderitem.item['total']}" a:data-id="orderitem_total"/>
<h:inputHidden value="#{orderitem.item['total_dsp']}" a:data-id="orderitem_total_dsp" />
</td>
</tr>
</ui:repeat>
<!-- summary -->
<tr>
<td />
<td />
<td />
<td />
<td data-id="orderlist_summary" style="text-align: right;font-wight:bold;"></td>
<td />
</tr>
</table>
<!-- total summary -->
<h:inputHidden value="#{workitem.item['order.total']}" a:data-id="orderitems_capacity" />
<h:inputHidden value="#{workitem.item['order.total_dsp']}" a:data-id="orderitems_capacity_dsp" />
<!-- add button -->
<h:commandButton value="#{message.add}" a:data-id="addposbutton_id"
actionListener="#{childItemController.add}">
</h:commandButton>
</f:ajax>
</h:panelGroup>
<script type="text/javascript">
/*<![CDATA[*/
// display summary
$(document).ready(function() {
// erste Zeile hinzufügen, falls tabelle noch leer ist
var posTableEmpty=#{empty childItemController.childItems};
if (posTableEmpty) {
// click on add button
posButton=$("[data-id='addposbutton_id']");
if (posButton) {
$(posButton).click();
}
}
calculateSummary();
});
// This method refreshs the layout
function updateOrderItems(data) {
if (data.status === 'success') {
$('[id$=oderlist]').imixsLayout();
calculateSummary();
}
}
//Rechnet die Preise zusammen
function calculateSummary() {
var price = 0, amount = 0, sum = 0, total = 0;
var summaryItems = $("[data-id='orderitem_amount']");
$(summaryItems).each(function(index, value) {
var tableRow = $(this).closest('tr');
var inputamount = $("[data-id='orderitem_amount']", tableRow);
if (inputamount ) {
amount = convertToNumber(inputamount.val());
//console.log('amount=' + amount);
if (!isNaN(amount) ) {
sum = amount ;
// round
sum = Math.round(sum * 100) / 100;
total = total + sum;
$("[data-id='orderitem_total']",tableRow).val(sum);
sum = convertToCurrency(sum);
console.log('sum=' + sum);
$("[data-id='orderitem_total_dsp']",tableRow).val(sum);
$("[data-id='orderitem_summary']", tableRow).empty();
$("[data-id='orderitem_summary']", tableRow).append(sum);
}
}
});
// update total _capacity
// update orderlist_summary
$("[data-id='orderitems_capacity']").val(total);
total = convertToCurrency(total);
$("[data-id='orderitems_capacity_dsp']").val(total);
$("[data-id='orderlist_summary']", ".imixs-orderitems").empty();
$("[data-id='orderlist_summary']", ".imixs-orderitems").append(total);
}
function convertToNumber(currency) {
// has ,?
if (currency && currency.indexOf(',')>-1) {
currency=currency.trim();
//remove .
currency = currency.replace('.', '');
// replace ,
currency = currency.replace(',', '.');
}
return currency;
}
function convertToCurrency(sum) {
sum = ("" + sum).replace('.', ',');
if (sum.indexOf(',') == -1)
sum = sum + ",00";
if (sum.indexOf(',') == sum.length - 2)
sum = sum + "0";
return sum;
}
/*]]>*/
</script>
</ui:composition>

View file

@ -0,0 +1,113 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:panelGroup layout="block" styleClass="imixs-form-section"
id="oderlist" binding="#{orderlistContainer}">
<f:ajax render="oderlist" onevent="updateOrderItems">
<table class="imixsdatatable imixs-orderitems">
<tr>
<th style="width: 50px;">Pos.</th>
<th>Leistungsbezeichnung</th>
<th style="width: 70px;">Einheit</th>
<th style="width: 70px;">Menge</th>
<th style="width: 140px;">Netto-Preis / ME in €</th>
<th style="width: 90px;">Gesamt in €</th>
</tr>
<ui:repeat var="orderitem" value="#{childItemController.childItems}">
<tr>
<!-- pos -->
<td><h:outputText value="#{orderitem.item['numpos']}" /></td>
<!-- Name -->
<td><h:outputText value="#{orderitem.item['name']}" /></td>
<td><h:outputText value="#{orderitem.item['unit']}" /></td>
<td><h:outputText value="#{orderitem.item['ammount']}"
id="orderitem_ammount" onchange="calculateSummary()" /></td>
<td style="text-align: right;"><h:outputText value="#{orderitem.item['price']}"
id="orderitem_price"
onchange="calculateSummary()">
<f:convertNumber minFractionDigits="2" locale="de" />
</h:outputText></td>
<td class="orderitem_summary" style="text-align: right;">
<h:outputText value="#{orderitem.item['_capacity_dsp']}">
</h:outputText>
</td>
</tr>
</ui:repeat>
<!-- summary -->
<tr>
<td />
<td />
<td />
<td />
<td />
<td class="orderlist_summary" style="text-align: right;">
<h:outputText value="#{workitem.item['_capacity_dsp']}">
</h:outputText>
</td>
</tr>
</table>
</f:ajax>
</h:panelGroup>
<script type="text/javascript">
/*<![CDATA[*/
// display summary
$(document).ready(function() {
});
// This method refreshs the layout
function updateOrderItems(data) {
if (data.status === 'success') {
$('[id$=oderlist]').imixsLayout();
}
}
function convertToCurrency(sum) {
sum = ("" + sum).replace('.', ',');
if (sum.indexOf(',') == -1)
sum = sum + ",00";
if (sum.indexOf(',') == sum.length - 2)
sum = sum + "0";
return sum;
}
/*]]>*/
</script>
</ui:composition>

View file

@ -7,8 +7,27 @@
xmlns:marty="http://java.sun.com/jsf/composite/marty">
<ui:param name="spaces" value="#{teamController.spaces}" />
<h3>#{app.sub_dispatch}</h3>
<h:panelGroup layout="block" styleClass="imixs-form-section">
<h:panelGroup id="spacelist" layout="block" styleClass="imixs-form-section-2">
<dl>
<dt>#{message['form.space']}</dt>
<dd>
<h:selectOneMenu style="width:20em;" required="false"
value="#{workflowController.workitem.item['space.ref']}">
<f:selectItem itemLabel=""></f:selectItem>
<c:forEach items="#{teamController.spaces}" var="space">
<f:selectItem itemLabel="#{space.item['name']}"
itemValue="#{space.item['$UniqueID']}">
</f:selectItem>
</c:forEach>
<f:ajax render="spacelist"/>
</h:selectOneMenu>
</dd>
</dl>
<dl>
<dt>

View file

@ -297,7 +297,7 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com
<bpmn2:task id="Task_5005" imixs:processid="5200" name="Sachprüfung">
<bpmn2:extensionElements>
<imixs:item name="txteditorid" type="xs:string">
<imixs:value><![CDATA[form_basic]]></imixs:value>
<imixs:value><![CDATA[form_basic#alexander/sub_positionen]]></imixs:value>
</imixs:item>
<imixs:item name="txtworkflowabstract" type="xs:string">
<imixs:value><![CDATA[<itemvalue>txtlastcomment</itemvalue>]]></imixs:value>
@ -564,7 +564,7 @@ result.isValid=true;
<bpmn2:task id="Task_2" imixs:processid="5000" name="Erfassung">
<bpmn2:extensionElements>
<imixs:item name="txteditorid" type="xs:string">
<imixs:value><![CDATA[form_basic]]></imixs:value>
<imixs:value><![CDATA[alexander/form_basic#alexander/sub_responsible]]></imixs:value>
</imixs:item>
<imixs:item name="txtworkflowabstract" type="xs:string">
<imixs:value><![CDATA[<itemvalue>txtlastcomment</itemvalue>]]></imixs:value>
@ -1400,7 +1400,7 @@ result.isValid=true;
<bpmn2:task id="Task_1" imixs:processid="5100" name="Verteilung zur Prüfung">
<bpmn2:extensionElements>
<imixs:item name="txteditorid" type="xs:string">
<imixs:value><![CDATA[form_basic#alexander/sub_responsible]]></imixs:value>
<imixs:value><![CDATA[alexander/form_basic#alexander/sub_responsible]]></imixs:value>
</imixs:item>
<imixs:item name="txtworkflowabstract" type="xs:string">
<imixs:value><![CDATA[<itemvalue>txtlastcomment</itemvalue>]]></imixs:value>