add, remove, edit lease

This commit is contained in:
Tóth Richárd
2019-08-26 13:38:51 +02:00
parent e18c039529
commit 5bef1596f4
12 changed files with 578 additions and 52 deletions

View File

@@ -0,0 +1,81 @@
<div class="form_wrapper">
<form method="post">
<input type="hidden" name="action" value="lease_create">
<input type="hidden" name="l_expire_date_hidden" id="l_expire_date_hidden">
<div>
<label for="l_name">Új bérlettípus neve:</label>
<div><input type="text" name="l_name" id="l_name" required></div>
</div>
<div>
<label for="l_sum">Összeg:</label>
<div><input type="text" name="l_sum" id="l_sum" value="0" required></div>
</div>
<div>
<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>
</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>
</div>
<div>
<input id="r_03" type="radio" name="l_expire_type" value="3">
<label class="choice" for="r_03">Egyéni</label>
</div>
<div>
<input type="text" name="l_expire_date" id="l_expire_date" disabled="disabled" style="width: 40% !important; margin-top: 10px;">
</div>
</div>
<div>
<legend for="l_training_types">Edzés típusok: </legend>
<table>
{foreach $training_type_assoc_array as $trt_array}
<tr>
<td><input id="trt_{$trt_array.trt_id}" type="checkbox" name="l_training_types[]" value="{$trt_array.trt_id}"></td>
<td><label class="choice" for="trt_{$trt_array.trt_id}">{$trt_array.trt_name}</label></td>
</tr>
{/foreach}
<table>
</div>
<div style="margin-top: 15px;">
<div>
<input class="button black" type="submit" value="Létrehozás">
</div>
</div>
</form>
</div>
<script type="text/javascript">
$('input[name="l_expire_type"]').on('change', function() {
console.log($(this).val());
if ($(this).val() == '1') {
$('#l_expire_date').prop('disabled', true);
var today = new Date();
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
$('#l_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + lastDayOfMonth.getDate()).slice(-2));
$('#l_expire_date_hidden').val($('#l_expire_date').val());
}
else if ($(this).val() == '2') {
$('#l_expire_date').prop('disabled', true);
var today = new Date();
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1);
$('#l_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2));
$('#l_expire_date_hidden').val($('#l_expire_date').val());
}
else if ($(this).val() == '3') {
$('#l_expire_date').removeAttr('disabled');
}
});
$(document).ready(function () {
$('input[name="l_expire_type"]:checked').trigger('change');
});
</script>

View File

@@ -0,0 +1,87 @@
<div class="form_wrapper">
<div class="buttons">
<a href="/admin/lease" class="addbutton big">Vissza</a>
<a href="/admin/delete_lease/{$lease->get_l_id()}" class="addbutton delete-big">Bérlettípus törlése</a>
</div>
<form method="post">
<input type="hidden" name="action" value="lease_update">
<input type="hidden" name="l_id" value="{$lease->get_l_id()}">
<input type="hidden" name="l_expire_date_hidden" id="l_expire_date_hidden">
<div>
<label for="l_name">Bérlettípus neve:</label>
<div><input type="text" name="l_name" id="l_name" value="{$lease->get_l_name()}" required></div>
</div>
<div>
<label for="l_sum">Összeg:</label>
<div><input type="text" name="l_sum" id="l_sum" value="{$lease->get_l_sum()}" required></div>
</div>
<div>
<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>
</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>
</div>
<div>
<input id="r_03" type="radio" name="l_expire_type" value="3" {if $lease->get_l_expire_type() == 3}checked{/if}>
<label class="choice" for="r_03">Egyéni</label>
</div>
<div>
<input type="text" name="l_expire_date" id="l_expire_date" disabled="disabled" style="width: 40% !important; margin-top: 10px;" value="{$lease->get_l_expire_date()}">
</div>
</div>
<div>
<legend for="l_training_types">Edzés típusok: </legend>
<table>
{foreach $training_type_assoc_array as $trt_array}
<tr>
<td><input id="trt_{$trt_array.trt_id}" type="checkbox" name="l_training_types[]" value="{$trt_array.trt_id}" {if $lease->has_training($trt_array.trt_id)}checked{/if}></td>
<td><label class="choice" for="trt_{$trt_array.trt_id}">{$trt_array.trt_name}</label></td>
</tr>
{/foreach}
<table>
</div>
<div style="margin-top: 15px;">
<div>
<input class="button black" type="submit" value="Mentés">
</div>
</div>
</form>
</div>
<script type="text/javascript">
$('input[name="l_expire_type"]').on('change', function() {
console.log($(this).val());
if ($(this).val() == '1') {
$('#l_expire_date').prop('disabled', true);
var today = new Date();
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
$('#l_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + lastDayOfMonth.getDate()).slice(-2));
$('#l_expire_date_hidden').val($('#l_expire_date').val());
}
else if ($(this).val() == '2') {
$('#l_expire_date').prop('disabled', true);
var today = new Date();
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1);
$('#l_expire_date').val(lastDayOfMonth.getFullYear() + '-' + ('0' + (lastDayOfMonth.getMonth()+1)).slice(-2) + '-' + ('0' + today.getDate()).slice(-2));
$('#l_expire_date_hidden').val($('#l_expire_date').val());
}
else if ($(this).val() == '3') {
$('#l_expire_date').removeAttr('disabled');
}
});
$(document).ready(function () {
//$('input[name="l_expire_type"]:checked').trigger('change');
$('#l_expire_date_hidden').val($('#l_expire_date').val());
});
</script>

View File

@@ -0,0 +1,13 @@
<div class="buttons">
<a href="/admin/create/lease" class="addbutton add-big">Új bérlettípus hozzáadása</a>
</div>
<div class="list">
{foreach $l_assoc_array as $lease}
<a href="/admin/lease/{$lease.l_id}">
<div class="list_item">
<span>{$lease.l_name}</span>
<img src="/_image/contact.png">
</div>
</a>
{/foreach}
</div>

View File

@@ -1,56 +1,57 @@
<div class="buttons">
<a href="/admin/create/money_deposit" class="addbutton add-big">Új befizetés</a>
<a href="/admin/balance_list" class="addbutton add-big">Egyenleg lista</a>
<a href="/admin/create/money_deposit" class="addbutton add-big">Új befizetés</a>
<a href="/admin/balance_list" class="addbutton add-big">Egyenleg lista</a>
<a href="/admin/lease" class="addbutton add-big">Bérlettípusok</a>
</div>
<div class="list half_width">
{foreach $mod_array as $mod}
{foreach $mod_array as $mod}
{if !$mod@first && $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_money_income()->get_mi_date()|substr:5:2}
</div>
{/if}
{if !$mod@first && $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_money_income()->get_mi_date()|substr:5:2}
</div>
{/if}
{if $mod@first || $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_money_income()->get_mi_date()|substr:5:2}
<span onclick="block_action('block_{$mod->get_mod_money_income()->get_mi_date()|substr:0:4}{$mod->get_mod_money_income()->get_mi_date()|substr:5:2}');" class="date_separator clickable">{$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:0:4}.
{$months[$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2]}
<img src="/_image/open_folder.png">
</span>
<div id="block_{$mod->get_mod_money_income()->get_mi_date()|substr:0:4}{$mod->get_mod_money_income()->get_mi_date()|substr:5:2}" class="month_block">
{if $mod@first || $mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_money_income()->get_mi_date()|substr:5:2}
<span onclick="block_action('block_{$mod->get_mod_money_income()->get_mi_date()|substr:0:4}{$mod->get_mod_money_income()->get_mi_date()|substr:5:2}');" class="date_separator clickable">{$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:0:4}.
{$months[$mod_array[$mod@index]->get_mod_money_income()->get_mi_date()|substr:5:2]}
<img src="/_image/open_folder.png">
</span>
<div id="block_{$mod->get_mod_money_income()->get_mi_date()|substr:0:4}{$mod->get_mod_money_income()->get_mi_date()|substr:5:2}" class="month_block">
{/if}
<a href="/admin/money_deposit/{$mod->get_mod_id()}">
<div class="list_item">
<table class="money">
<tr>
<td class="icon">
{if $mod->get_mod_money_income()->get_mi_payment_type_pt_id() == 1}
<img src="/_image/deposit.png">
{else}
<img src="/_image/transaction.png">
{/if}
</td>
<td>
{$mod->get_mod_user_kid()->get_uk_name()}
</td>
<td class="date">
{$mod->get_mod_money_income()->get_mi_date(true)}
</td>
<td class="sum">
{$mod->get_mod_money_income()->get_mi_sum()|number_format:0:'':' '} Ft
</td>
</tr>
{/if}
<a href="/admin/money_deposit/{$mod->get_mod_id()}">
<div class="list_item">
<table class="money">
<tr>
<td class="icon">
{if $mod->get_mod_money_income()->get_mi_payment_type_pt_id() == 1}
<img src="/_image/deposit.png">
{else}
<img src="/_image/transaction.png">
{/if}
</td>
<td>
{$mod->get_mod_user_kid()->get_uk_name()}
</td>
<td class="date">
{$mod->get_mod_money_income()->get_mi_date(true)}
</td>
<td class="sum">
{$mod->get_mod_money_income()->get_mi_sum()|number_format:0:'':' '} Ft
</td>
</tr>
</table>
</div>
</a>
</table>
</div>
</a>
{if $mod@last}
</div>
{/if}
{if $mod@last}
</div>
{/if}
{/foreach}
{/foreach}
</div>
@@ -58,29 +59,29 @@
<script>
function open_block(block_id) {
$("#"+block_id).slideDown("slow");
$("#"+block_id).slideDown("slow");
}
function close_block(block_id) {
$("#"+block_id).slideUp("slow");
$("#"+block_id).slideUp("slow");
}
function block_action(block_id) {
if ($("#"+block_id).is(':hidden')) {
open_block(block_id);
}
else {
close_block(block_id);
}
if ($("#"+block_id).is(':hidden')) {
open_block(block_id);
}
else {
close_block(block_id);
}
}
$( document ).ready(function() {
var divs = $( "div[class=month_block]" );
$( ".list" ).find( divs ).hide();
var div_list = $( ".list" ).find( divs );
$( ".list" ).find( divs ).hide();
var div_list = $( ".list" ).find( divs );
open_block(div_list[0].id);
open_block(div_list[0].id);
});