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
// 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
* ein neues Datum auf basis des Rechnungsdatum (date_invoice)
@ -63,17 +54,14 @@ function initFaelligkeit(ajax_event) {
// TT.MM.YY
// jahreszahl falls zweistellig
function validateBuchungsDatum(item) {
//var mhd = $("[id$=mhdinput_id]");
var mhd = $(item);
var text = $(mhd).val();
while (text.indexOf('-') > -1) {
text = text.replace("-", ".");
}
var d = new Date();
// check for TTMMYY
if (text.length == 6 && text.indexOf('.') == -1) {
text = text.substring(0, 2) + "." + text.substring(2, 4)

View file

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