<div class="buttons">

	<a href="/admin/create/money_expense" class="addbutton add-big">Új kiadás</a>
	<a href="/admin/money_expense_category" class="addbutton add-big">Kiadás kategóriák kezelése</a>

</div>

<div class="list full_width">
	{foreach $mox_array as $mox}

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

	{if $mox@first || $mox_array[$mox@index]->get_mox_date()|substr:5:2 != $mox_array[$mox@index-1]->get_mox_date()|substr:5:2}
		<span onclick="block_action('block_{$mox->get_mox_date()|substr:0:4}{$mox->get_mox_date()|substr:5:2}');" class="date_separator clickable">{$mox_array[$mox@index]->get_mox_date()|substr:0:4}.
			{$months[$mox_array[$mox@index]->get_mox_date()|substr:5:2]}
			<img src="/_image/open_folder.png">
		</span>
		<div id="block_{$mox->get_mox_date()|substr:0:4}{$mox->get_mox_date()|substr:5:2}" class="month_block">

	{/if}
	<a href="/admin/money_expense/{$mox->get_mox_id()}">
		<div class="list_item">
			<table class="money">
				<tr>
					<td class="icon">
						{if $mox->get_mox_payment_type_pt_id() == 1}
							<img src="/_image/expense.png">
						{else}
							<img src="/_image/transaction.png">
						{/if}
					</td>
					<td class="quarter_width">
						{$mox->get_mox_date()}
					</td>
					<td class="no_mobile_show quarter_width">
						{if $mox->get_mox_money_expense_category_moxc_id()}{$mox->get_mox_moxc()->get_moxc_name()}{else}<span class="italic">nincs megadva</span>{/if}
					</td>
					<td class="no_mobile_show quarter_width">
						{if $mox->get_mox_coach()|is_a:'user'}
							{$mox->get_mox_coach()->get_ua_name()}
						{/if}
					</td>
					<td class="quarter_width">
						{$mox->get_mox_item()}
					</td>
					<td class="sum">
						{$mox->get_mox_sum()|number_format:0:'':' '} Ft
					</td>
				</tr>

			</table>
		</div>
	</a>

	{if $mox@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);
	}
}


$( 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>
