@extends('layouts.default')

@section('title')
	@parent
	Заявки на расход по группе Зарплата
@stop

@section('breadcrumbs')
	{{-- Breadcrumbs::render('budget.salary.stat', $workProject) --}}
@stop

@section('css')
  <link rel="stylesheet" href="{{asset('css/jquery.fileupload.css')}}">
@stop

@section('content')
<div class="row">
	<?php 
		$projectAmount = $workProject->getCurrentBudgetMonthPlan(); // бюджет проекта
		$userType = '';
		$signRequest = 0;
		if( Auth::user()->hasRole(Role::ROLE_BUDGET_OUTCOMING_REQUEST) ){
			$userType = 1;
		}else if( Auth::user()->hasRole(Role::ROLE_BUDGET_CFO) ){
			$userType = 2;
		}else if( Auth::user()->hasAnyRole(array(Role::ROLE_BUDGET_ACCOUNTANT, Role::ROLE_BUDGET_ACC_SECRETARY)) ){
			$userType = 3;
		}
		
		if( Auth::user()->hasRole(Role::ROLE_BUDGET_SIGN_COST_REQUEST) ){
			$signRequest = 1;
		}
		$statusType = Session::get('statusType');
		Session::put('userType', $userType);
		Session::put('signRequest', $signRequest);
	?>
  <div class="col-md-12 col-lg-12 col-sm-12">
		<div class="panel panel-default">
		@include('budget/menu')
			<div class="panel-body">
				@include('budget/salary/btns')
				<div class="clearfix"></div>
				<div class="table-responsive">
					<table class="table table-condensed table-hover">
						<thead>
							<tr>
								<th>#</th>
								<th>Дата</th>
								<th>Статья расходов</th>
								@if( $userType != 3 )
								  <th class="text-center">Бюджет</th>
								@else
								<th class="text-right" title="Номер платежного поручения при безналичной оплате">№ п/п</th>
								@endif
								<th>Файлы</th>
								<th class="text-right">Сумма</th>
								<th class="table-comment">Комментарий</th>
							</tr>
						</thead>
						<tbody id='budgetCostsRequestContainer'>
							@foreach($costsRequests as $costsRequest)
							  @include('budget/costsrequests/searchoperation')
							@endforeach
						</tbody> 
					</table>
				</div>
				<dl class="dl-horizontal">
					<dt>Заявок на сумму: </dt>
					<dd><span id="totalRequestsSum" class="to-humanize"> </span> <i class="fa fa-rub"></i></dd>
					<dt>Кол-во: </dt>
					<dd><span id="totalRequestsCount" class="to-humanize"> </span></dd>
				</dl>
			</div>
		</div>
	</div>
</div>
@section('modals')
	@include('budget/costsrequests/modal')
@stop
@stop

@section('js')
  <script src="{{asset('js/jquery.fileupload.js')}}"></script>
	<script src="{{asset('js/jquery.iframe-transport.js')}}"></script>
	<script src="{{ asset('js/plugin/x-editable/x-editable.min.js') }}"></script>
	<script src="{{ asset('js/costsRequests.js') }}"></script>
@stop