store correct expire date

This commit is contained in:
Ricsi
2019-10-12 14:20:09 +02:00
parent 4996283631
commit a51d912b68
5 changed files with 37 additions and 18 deletions

View File

@@ -17,11 +17,11 @@
<legend for="l_expire_type">Lejárati dátum: </legend>
<div>
<input id="r_01" type="radio" name="l_expire_type" value="1" checked>
<label class="choice" for="r_01">Aktuális hónap vége</label>
<label class="choice" for="r_01">Befizetés hónapjának vége</label>
</div>
<div>
<input id="r_02" type="radio" name="l_expire_type" value="2">
<label class="choice" for="r_02">Következő tárgyhónap</label>
<label class="choice" for="r_02">Befizetés után következő tárgyhónap</label>
</div>
<div>
<input id="r_03" type="radio" name="l_expire_type" value="3">

View File

@@ -22,11 +22,11 @@
<legend for="l_expire_type">Lejárati dátum: </legend>
<div>
<input id="r_01" type="radio" name="l_expire_type" value="1" {if $lease->get_l_expire_type() == 1}checked{/if}>
<label class="choice" for="r_01">Aktuális hónap vége</label>
<label class="choice" for="r_01">Befizetés hónapjának vége</label>
</div>
<div>
<input id="r_02" type="radio" name="l_expire_type" value="2" {if $lease->get_l_expire_type() == 2}checked{/if}>
<label class="choice" for="r_02">Következő tárgyhónap</label>
<label class="choice" for="r_02">Befizetés után következő tárgyhónap</label>
</div>
<div>
<input id="r_03" type="radio" name="l_expire_type" value="3" {if $lease->get_l_expire_type() == 3}checked{/if}>

View File

@@ -52,7 +52,10 @@
<div>
<label for="mod_sum">Lejár:</label>
<div id="expire_date" style="padding-top: 6px;">Következő hónapban (alapértelmezett beállítás)</div>
<input type="hidden" name="mod_expire_date" id="mod_expire_date">
<div id="expire_date" style="padding-top: 6px;">
Következő hónapban (alapértelmezett beállítás)
</div>
</div>
<div>
@@ -98,15 +101,19 @@
//var nextMonthBeginning = new Date(today.getFullYear(), today.getMonth() + 1, 1);
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
$('#expire_date').html(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + lastDayOfMonth.getDate()).slice(-2));
$('#mod_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + lastDayOfMonth.getDate()).slice(-2));
}
else if (pdata['l_expire_type'] == '2') {
//var today = new Date();
var today = new Date($('#mod_date').val());
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1);
$('#expire_date').html(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2));
$('#mod_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2));
}
else if (pdata['l_expire_type'] == '3') {
$('#expire_date').html(pdata['l_expire_date']);
$('#mod_expire_date').val(pdata['l_expire_date']);
}
}
});