fine tuning

This commit is contained in:
Ralph Soika 2020-11-24 22:23:39 +01:00
parent 99f6204695
commit 7207f6bded

View file

@ -7,80 +7,66 @@
<h:panelGroup layout="block" styleClass="imixs-form-section" <h:panelGroup layout="block" styleClass="imixs-form-section"
id="oderlist" binding="#{orderlistContainer}"> id="oderlist" binding="#{orderlistContainer}">
<f:ajax render="oderlist" onevent="updateOrderItems"> <f:ajax render="oderlist" onevent="updateOrderItems">
<table class="imixsdatatable imixs-orderitems"> <table class="imixsdatatable imixs-orderitems">
<tr> <tr>
<th style="width: 10px;">Pos.</th> <th style="">#</th>
<th style="width: 120px;">Positionsnummer<span class="imixs-required"> *</span></th> <th style="">Positionsnummer<span class="imixs-required"> *</span></th>
<th style="width: 50px;">Buchungsperiode</th> <th style="width: 50px;">Buchungsperiode</th>
<th style="width: 30px;">Steuer</th> <th style="width: 150px;">Steuer</th>
<th style="width: 100px;">Betrag</th> <th style="width: 150px;text-align:right;">Betrag</th>
<th style="width: 5px;"> <th style="">
<!-- delete --> <!-- delete -->
</th> </th>
</tr> </tr>
<ui:repeat var="orderitem" value="#{childItemController.childItems}"> <ui:repeat var="orderitem" value="#{childItemController.childItems}">
<tr> <tr>
<!-- pos --> <!-- pos -->
<td><h:outputText value="#{orderitem.item['numpos']}" /></td> <td><h:outputText value="#{orderitem.item['numpos']}" /></td>
<!-- Name --> <!-- Name -->
<td><h:inputText value="#{orderitem.item['name']}" /></td> <td><h:inputText value="#{orderitem.item['name']}" style="width:100%;"/></td>
<!-- periode --> <!-- periode -->
<td><h:inputText value="#{orderitem.item['period']}" /></td> <td><h:inputText value="#{orderitem.item['period']}" style="width:100%;" /></td>
<!-- Steuer --> <!-- Steuer -->
<td><h:inputText value="#{orderitem.item['tax']}" /></td> <td><h:inputText value="#{orderitem.item['tax']}" style="width:100%;" /></td>
<!-- Betrag --> <!-- Betrag -->
<td><h:inputText value="#{orderitem.item['amount']}" <td style="text-align:right;"><h:inputText value="#{orderitem.item['amount']}"
a:data-id="orderitem_amount" style="text-align: right;" a:data-id="orderitem_amount" style="text-align: right;width:100%;">
onchange="calculateSummary()">
<f:convertNumber minFractionDigits="2" locale="de" /> <f:convertNumber minFractionDigits="2" locale="de" />
</h:inputText></td> </h:inputText>
</td>
<td><h:commandLink <td><h:commandLink actionListener="#{childItemController.remove(orderitem.item['numpos'])}">
actionListener="#{childItemController.remove(orderitem.item['numpos'])}">
<span class="typcn typcn-trash imixs-state-info"></span> <span class="typcn typcn-trash imixs-state-info"></span>
<f:ajax render="#{orderlistContainer.clientId}" <f:ajax render="#{orderlistContainer.clientId}"
onevent="updateOrderItems" /> onevent="updateOrderItems" />
</h:commandLink> </h:commandLink>
<!-- item summary --> <!-- item summary -->
<h:inputHidden value="#{orderitem.item['total']}" a:data-id="orderitem_total"/> <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> </td>
</tr> </tr>
</ui:repeat> </ui:repeat>
<!-- summary --> <!-- summary -->
<tr> <tr>
<td /> <td />
<td /> <td />
<td /> <td />
<td /> <td />
<td data-id="orderlist_summary" style="text-align: right;font-wight:bold;"></td> <td data-id="orderlist_summary" style="text-align: right;padding-right:10px;font-wight:bold;"></td>
<td /> <td />
</tr> </tr>
</table> </table>
<!-- total summary --> <!-- total summary -->
<h:inputHidden value="#{workitem.item['order.total']}" a:data-id="orderitems_capacity" /> <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 --> <!-- add button -->
<h:commandButton value="#{message.add}" a:data-id="addposbutton_id" <h:commandButton value="#{message.add}" a:data-id="addposbutton_id"
actionListener="#{childItemController.add}"> actionListener="#{childItemController.add}">
@ -112,8 +98,8 @@
// This method refreshs the layout // This method refreshs the layout
function updateOrderItems(data) { function updateOrderItems(data) {
if (data.status === 'success') { if (data.status === 'success') {
$('[id$=oderlist]').imixsLayout(); calculateSummary();
calculateSummary(); $('[id$=oderlist]').imixsLayout();
} }
} }
@ -132,24 +118,17 @@
// round // round
sum = Math.round(sum * 100) / 100; sum = Math.round(sum * 100) / 100;
total = total + sum; total = total + sum;
$("[data-id='orderitem_total']",tableRow).val(sum); $("[data-id='orderitem_total']",tableRow).val(sum);
sum = convertToCurrency(sum); sum = convertToCurrency(sum);
console.log('sum=' + sum); //console.log('sum=' + sum);
$("[data-id='orderitem_total_dsp']",tableRow).val(sum); $("[data-id='orderitem_amount']",tableRow).val(sum);
$("[data-id='orderitem_summary']", tableRow).empty();
$("[data-id='orderitem_summary']", tableRow).append(sum);
} }
} }
}); });
// update total _capacity // update total _capacity
// update orderlist_summary
$("[data-id='orderitems_capacity']").val(total); $("[data-id='orderitems_capacity']").val(total);
total = convertToCurrency(total); total = convertToCurrency(total);
$("[data-id='orderitems_capacity_dsp']").val(total);
$("[data-id='orderlist_summary']", ".imixs-orderitems").empty(); $("[data-id='orderlist_summary']", ".imixs-orderitems").empty();
$("[data-id='orderlist_summary']", ".imixs-orderitems").append(total); $("[data-id='orderlist_summary']", ".imixs-orderitems").append(total);