

<?php $__env->startSection('title'); ?>
@parent
Закрытие месяца :: Бюджет для "<?php echo $workProject->name; ?>"
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
	<script>
		$(document).ready(function(){
			$('#closeMonth').unbind('click').on('click', function() {
				$('#confirmModal .modal-body').html('<h4>Вы уверены что хотите закрыть прошлый месяц?</h4>');
				$('#confirmSbmtBtn').data('action', $(this).data('action'));
				$('#confirmModal').modal('show');
				return false;
			});

			$('#confirmSbmtBtn').unbind('click').on('click', function(e) {
				var l = Ladda.create(this);
				l.start();
				var btn = this;
				$.post(
								$(this).data('action'),
								function(data) {
									window.location = '/budget';
								},
								'json'
								).always(function() { l.stop(); });
				return false;
			});
		});
	</script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('modals'); ?>
	<div id="confirmModal" class="modal fade">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title">Подтвердите действие</h4>
				</div>
				<div class="modal-body">
				</div>
				<div class="modal-footer">
					<button id="confirmSbmtBtn" type="submit" class="btn btn-primary ladda-button" data-style="zoom-out" data-modal-id="confirmModal"><span class="ladda-label">Да</span></button>
					<button type="button" class="btn btn-default" data-dismiss="modal">Нет</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</div><!-- /.modal -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
  <div class="col-md-12">
		<div class="panel panel-default">
			<?php echo $__env->make('budget/menu', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
			<div class="panel-body">
        <div class="row">
          <div class="col-md-12 text-center">
            <b>Закрытие периода до <?php echo $closeDateInfo; ?> </b>
          </div>
        </div>
        <br>
				<div class="row">
					<div class="col-md-6">
						<div class="well well-sm">
							<table class="table table-condensed">
								<thead>
									<tr>
										<th>Состояние счетов</th>
										<th></th>
									</tr>
								</thead>
								<tbody>
									<?php foreach($workProject->budgetAccounts as $budgetAccount): ?>
									<tr>
										<td><?php echo $budgetAccount->name; ?></td>
										<td class="text-right"><span class="to-humanize"><?php echo $budgetAccount->getEndSum(); ?></span> <i class="fa fa-rub"></i></td>
									</tr>
									<?php endforeach; ?>
								</tbody>
							</table>
						</div>
					</div>
					<div class="col-md-6">
						<div class="well well-sm">
							<table class="table table-condensed">
								<thead>
									<tr>
										<th colspan="2">Информация по долговым контрагентам</th>
									</tr>
								</thead>
								<tbody>
									<?php foreach($workProject->budgetDebtPartners as $debtPartner): ?>
									<tr>
										<td><?php echo $debtPartner->name? $debtPartner->name : $debtPartner->deb_project['name']; ?></td>
										<td class="text-right"><span class="to-humanize"><?php echo $debtPartner->getEndSum(); ?></span> <i class="fa fa-rub"></i></td>
									</tr>
									<?php endforeach; ?>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<button id="closeMonth" class="btn btn-lg btn-danger" data-action="<?php echo action('BudgetController@closeMonth'); ?>">
					Закрыть прошлый месяц с такими данными
				</button>
			</div>
		</div>
	</div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.default', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>