<div class="buttons">
	<form id="create_submit" action="/admin/create/money_deposit" method="post">
		<a href="#" class="addbutton add-big" onclick="open_deposit({$mod_user_kid_id})">Új befizetés</a>
		<input type="hidden" name="mod_user_kid_uk_id" value="{$mod_user_kid_id}">
	</form>

</div>

<div class="balance">
	Egyenleg: {$balance|number_format:0:'':' '} Ft
</div>

<div class="list half_width">
	{foreach $mod_array as $mod}

	{if !$mod@first && $mod_array[$mod@index]->get_mod_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_date()|substr:5:2}
		</div>
	{/if}

	{if $mod@first || $mod_array[$mod@index]->get_mod_date()|substr:5:2 != $mod_array[$mod@index-1]->get_mod_date()|substr:5:2}
		<span onclick="block_action('block_{$mod->get_mod_date()|substr:0:4}{$mod->get_mod_date()|substr:5:2}');" class="date_separator clickable">{$mod_array[$mod@index]->get_mod_date()|substr:0:4}. 
			{$months[$mod_array[$mod@index]->get_mod_date()|substr:5:2]}
			<img src="/_image/open_folder.png">
		</span>
		<div id="block_{$mod->get_mod_date()|substr:0:4}{$mod->get_mod_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">
						<img src="/_image/deposit.png">
					</td>
					<td>
						{$mod->get_mod_user_kid()->get_uk_name()}
					</td>
					<td class="date">
						{$mod->get_mod_date()}
					</td>
					<td class="sum">
						{$mod->get_mod_sum()|number_format:0:'':' '} Ft
					</td>
				</tr>
				
			</table>
		</div>
	</a>

	{if $mod@last}
	</div>
	{/if}

	{/foreach}

</div>


<script>

function open_block(block_id) {
	$("#"+block_id).slideDown("slow");
}

function close_block(block_id) {
	$("#"+block_id).slideUp("slow");
}

function block_action(block_id) {
	if ($("#"+block_id).is(':hidden')) {
		open_block(block_id);
	}
	else {
		close_block(block_id);
	}
}

function open_deposit(user_id) {
	$("#create_submit").submit();
}


$( document ).ready(function() {
    var divs = $( "div[class=month_block]" );
	$( ".list" ).find( divs ).hide();
	var div_list = $( ".list" ).find( divs );

	open_block(div_list[0].id);
	
});


</script>