add focusout constraint

This commit is contained in:
jpb 2021-07-21 08:56:40 +02:00
parent 7f6e4886fc
commit 62d007e232

View File

@ -679,10 +679,13 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
<?php if ($this->table_element_line != 'commande_fournisseurdet' || $this->table_element_line == 'facture_fourn_det') { ?>
$("#date_start, #date_end").focusout(function()
{
if ( $(this).val() == '' && !$(this).hasClass("error") ) {
$(this).addClass('error');
}else{
$(this).removeClass('error');
type = $(this).attr('type');
if (type == 1){
if ( $(this).val() == '' && !$(this).hasClass("error") ) {
$(this).addClass('error');
}else{
$(this).removeClass('error');
}
}
});
<?php } ?>
@ -714,6 +717,11 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
function(data) {
console.log("Load unit price end, we got value "+data.price_ht);
$( '#date_start').removeAttr( "type" );
$( '#date_end' ).removeAttr( "type" );
$('#date_start').attr('type', data.type);
$('#date_end').attr('type', data.type);
// service and we setted mandatory_period to true
if (data.mandatory_period == 1 && data.type == 1 ) {
jQuery("#date_start").addClass("error");