

<?php $__env->startSection('title'); ?>
	@parent
	Долговые контрагенты :: Бюджет для "<?php echo $workProject->name; ?>"
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
  <div class="col-md-12">
		<?php if($user->budgetProjects->count() > 1): ?>
		<div class="well well-sm">
			<?php foreach($user->budgetProjects()->get() as $project): ?>
			<a href="/budget/debtpartners?projectId=<?php echo $project->id; ?>" class="btn btn-sm btn-default <?php if($workProject->id == $project->id): ?> active <?php endif; ?>"><?php echo $project->name; ?></a>
			<?php endforeach; ?>
		</div>
		<?php endif; ?>

		<h4>Долговые контрагенты для "<?php echo $workProject->name; ?>"</h4>
		<div class="table-responsive">
			<table class="table table-striped table-hover">
				<thead>
					<tr>
						<th>Название</th>
						<th>Действия</th>
					</tr>
				</thead>
				<tbody>
					<?php foreach($budgetDebtPartners as $budgetDebtPartner): ?>
					<tr>
						<td>
							<p>
                              <b class="<?php echo $budgetDebtPartner->debet_project_id; ?>"><?php echo isset($budgetDebtPartner->debet_project_id)? $budgetDebtPartner->deb_project['name'] : $budgetDebtPartner->name; ?></b>
								<?php if($budgetDebtPartner->cost): ?>
								<small>
									<br/>Расходы списываются как <b><?php echo $budgetDebtPartner->cost->name; ?></b>
								</small>
								<?php endif; ?>
							</p>
						</td>
						<td>
							<?php if(!isset($budgetDebtPartner->deb_project['id'])): ?>
							<button class="btn btn-sm btn-default" onClick="location.href ='<?php echo action('BudgetDebtPartnersController@edit', $budgetDebtPartner->id); ?>'">Редактировать</button>
							<?php endif; ?>
							<button class="btn btn-sm btn-default action_confirm" type="button" data-method="delete" data-confirm-text="Вы уверены, что хотите удалить контрагента?" href="<?php echo action('BudgetDebtPartnersController@destroy', $budgetDebtPartner->id); ?>">Удалить</button>
						</td>
					</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
		</div>

		<button class="btn btn-primary" onClick="location.href ='<?php echo action('BudgetDebtPartnersController@create'); ?>'">Добавить контрагента</button>
	</div>
</div>

<div id="confirmModal" class="modal fade" role="dialog" style="display: none;" aria-hidden="true">
  <div class="modal-dialog">					
    <div class="modal-content">						
      <div class="modal-header">							
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>							
        <h3 id="confirmModalCaption">Подтвердите удаление</h3>						
      </div>						
      <div class="modal-body">							
        <p id="confirmModalText"></p>						
      </div>						
      <div class="modal-footer">							
        <button class="btn btn-primary" id="confirmModalBtnOk">Да</button>							
        <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Нет</button>						
      </div>					
    </div>				
  </div>			
</div>
<?php $__env->stopSection(); ?>

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