bugfix datumseingabe_tage

This commit is contained in:
Ralph Soika 2025-10-22 10:40:34 +02:00
parent 7ae22da078
commit 6f15bbd21f
2 changed files with 14 additions and 31 deletions

View file

@ -1,15 +1,6 @@
// custom scripts // custom scripts
// Zusatzfunktionen zur schnelleren Datumseingabe // Zusatzfunktionen zur schnelleren Datumseingabe
/**
*
*/
$(document).ready(function () {
initFaelligkeit();
});
/* /*
* Hier setzen wir einen Event handler und berechnen anhand der Eingabe im Feld alexander-logistic-date-days * Hier setzen wir einen Event handler und berechnen anhand der Eingabe im Feld alexander-logistic-date-days
* ein neues Datum auf basis des Rechnungsdatum (date_invoice) * ein neues Datum auf basis des Rechnungsdatum (date_invoice)
@ -63,17 +54,14 @@ function initFaelligkeit(ajax_event) {
// TT.MM.YY // TT.MM.YY
// jahreszahl falls zweistellig // jahreszahl falls zweistellig
function validateBuchungsDatum(item) { function validateBuchungsDatum(item) {
//var mhd = $("[id$=mhdinput_id]"); //var mhd = $("[id$=mhdinput_id]");
var mhd = $(item); var mhd = $(item);
var text = $(mhd).val(); var text = $(mhd).val();
while (text.indexOf('-') > -1) { while (text.indexOf('-') > -1) {
text = text.replace("-", "."); text = text.replace("-", ".");
} }
var d = new Date(); var d = new Date();
// check for TTMMYY // check for TTMMYY
if (text.length == 6 && text.indexOf('.') == -1) { if (text.length == 6 && text.indexOf('.') == -1) {
text = text.substring(0, 2) + "." + text.substring(2, 4) text = text.substring(0, 2) + "." + text.substring(2, 4)

View file

@ -1,29 +1,24 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml" <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
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:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"> xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty">
<ui:fragment rendered="#{!readonly}"> <ui:fragment rendered="#{!readonly}">
<ui:param name="namesub" value="#{name}_days"></ui:param> <ui:param name="namesub" value="#{name}_days"></ui:param>
<h:inputText value="#{workitem.item[namesub]}" style="width:2em;" class="alexander-logistic-date-days" pt:data-item="cdtr.creditperiod" /> <h:inputText value="#{workitem.item[namesub]}" style="width:2em;" class="alexander-logistic-date-days"
<h:inputText value="#{workitem.item[name]}" pt:data-item="cdtr.creditperiod" />
onchange="validateBuchungsDatum(this,true);" id="date_invoice" <h:inputText value="#{workitem.item[name]}" onchange="validateBuchungsDatum(this,true);" id="date_invoice"
required="false" styleClass="alexander-logistic-date"> required="false" styleClass="alexander-logistic-date">
<f:convertDateTime pattern="#{message.datePatternShort}" <f:convertDateTime pattern="#{message.datePatternShort}" timeZone="#{message.timeZone}" />
timeZone="#{message.timeZone}" />
</h:inputText> </h:inputText>
<script type="text/javascript">initFaelligkeit();</script>
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{readonly}"> <ui:fragment rendered="#{readonly}">
<h:outputText value="#{workitem.item[item.name]}"> <h:outputText value="#{workitem.item[item.name]}">
<f:convertDateTime timeZone="#{message.timeZone}" <f:convertDateTime timeZone="#{message.timeZone}" pattern="#{message.datePatternShort}" />
pattern="#{message.datePatternShort}" />
</h:outputText> </h:outputText>
</ui:fragment> </ui:fragment>
</ui:composition> </ui:composition>