<ul id="refrenceStatusBtns" data-status-type="<?php echo $input['statusType']; ?>" class="nav nav-tabs bordered">
	<?php if($workProject->type == Project::TYPE_HR): ?>
		<?php if($user->hasRole(Role::ROLE_CRM)): ?>
		<li <?php if($input['statusType'] == 'work'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="work" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">В работе <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'work'))->checkStatus(array('statusType' => 'work'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'noanswer'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="noanswer" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Недозвон <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'noanswer'))->checkStatus(array('statusType' => 'noanswer'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'reject'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="reject" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Отказ <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'reject'))->checkStatus(array('statusType' => 'reject'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'hr_reserve'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="hr_reserve" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Резерв <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'hr_reserve'))->checkStatus(array('statusType' => 'hr_reserve'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'hr_interviewwait'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="hr_interviewwait" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">На собеседование <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'hr_interviewwait'))->checkStatus(array('statusType' => 'hr_interviewwait'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'hr_interview'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="hr_interview" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Собеседование <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'hr_interview'))->checkStatus(array('statusType' => 'hr_interview'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'hr_test'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="hr_test" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">На рассмотрении <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'hr_test'))->checkStatus(array('statusType' => 'hr_test'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'hr_traineeship'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="hr_traineeship" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Стажировка <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'hr_traineeship'))->checkStatus(array('statusType' => 'hr_traineeship'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'hr_employed'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="hr_employed" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Работа <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'hr_employed'))->checkStatus(array('statusType' => 'hr_employed'))->count(); ?></span></span></a></li>
		<?php endif; ?>
	<?php else: ?>
		<?php if($user->hasRole(Role::ROLE_CRM)): ?>
		<li <?php if($input['statusType'] == 'work'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="work" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">В работе <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'work'))->checkStatus(array('statusType' => 'work'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'noanswer'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="noanswer" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Недозвон <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'noanswer'))->checkStatus(array('statusType' => 'noanswer'))->count(); ?></span></span></a></li>
		<li <?php if($input['statusType'] == 'reject'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="reject" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Отказ <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'reject'))->checkStatus(array('statusType' => 'reject'))->count(); ?></span></span></a></li>
		<?php endif; ?>
		<?php if($user->hasAnyRole(array(Role::ROLE_CRM, Role::ROLE_LOGISTICS))): ?>
		<li <?php if($input['statusType'] == 'paywaiting'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="paywaiting" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Ожидают оплаты <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'paywaiting'))->checkStatus(array('statusType' => 'paywaiting'))->count(); ?></span></span></a></li>
		<?php endif; ?>
		<?php if($user->hasRole(Role::ROLE_LOGISTICS)): ?>
		<li <?php if($input['statusType'] == 'agreed'): ?> class="active" <?php endif; ?>><a id="refrence_btn_work" data-status-type="agreed" href="#" class="ladda-button" data-style="zoom-out"><span class="ladda-label">Оформленные <span class="badge bg-color-blue txt-color-white"><?php echo Partner::my(array('statusType' => 'agreedinwork'))->checkStatus(array('statusType' => 'agreedinwork'))->count(); ?></span></span></a></li>
		<?php endif; ?>
	<?php endif; ?>
</ul>

<div class="tab-content">
	<div class="tab-pane fade in active">
		<?php if(isset($input)): ?>
			<div id="partnersFiltr">
				<div class="filter-btn">
					<?php if($input['statusType'] == 'reject'): ?>
						<button class="btn btn-default btn-sm <?php if(!$input['status'] && isset($input['rejectId']) && !$input['rejectId']): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="status" data-filter-value="">Все</button>
						<?php if($workProject->type == Project::TYPE_SHOP): ?>
						<button class="btn btn-default btn-sm <?php if($input['status'] == Partner::STATUS_DELIVERY_BEFORE_DELIVERING_FAIL): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="status" data-filter-value="<?php echo Partner::STATUS_DELIVERY_BEFORE_DELIVERING_FAIL; ?>">Отказался забирать</button>
						<button class="btn btn-default btn-sm <?php if($input['status'] == Partner::STATUS_DELIVERY_AFTER_WAIT_PAY_FAIL): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="status" data-filter-value="<?php echo Partner::STATUS_DELIVERY_AFTER_WAIT_PAY_FAIL; ?>">Отказался платить предоплату</button>
						<?php endif; ?>
						<?php foreach($workProject->rejects as $reject): ?>
							<button class="btn btn-default btn-sm <?php if(isset($input['rejectId']) && $input['rejectId'] == $reject->id): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="rejectId" data-filter-value="<?php echo $reject->id; ?>"><?php echo $reject->name; ?></button>
						<?php endforeach; ?>
					<?php endif; ?>
					<?php if($workProject->type == Project::TYPE_HR): ?>
						<?php if($input['statusType'] == 'hr_agreed'): ?>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'waitcall'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="waitcall">Ожидание звонка (<?php echo Partner::my(array('statusType' => 'hr_agreed', 'type' => 'waitcall'))->checkStatus(array('statusType' => 'hr_agreed', 'type' => 'waitcall'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'notcall'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="notcall">Не перезвонил (<?php echo Partner::my(array('statusType' => 'hr_agreed', 'type' => 'notcall'))->checkStatus(array('statusType' => 'hr_agreed', 'type' => 'notcall'))->count(); ?>)</button>
						<?php endif; ?>
						<?php if($input['statusType'] == 'hr_traineeship'): ?>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'edu'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="edu">Обучение (<?php echo Partner::my(array('statusType' => 'hr_traineeship', 'type' => 'edu'))->checkStatus(array('statusType' => 'hr_traineeship', 'type' => 'edu'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'work'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="work">Тестовая работа (<?php echo Partner::my(array('statusType' => 'hr_traineeship', 'type' => 'work'))->checkStatus(array('statusType' => 'hr_traineeship', 'type' => 'work'))->count(); ?>)</button>
						<?php endif; ?>
					<?php else: ?>
						<?php if($input['statusType'] == 'paywaiting'): ?>
							<?php if($user->hasRole(Role::ROLE_CRM)): ?>
								<button class="btn btn-default btn-sm <?php if(!$input['status']): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="status" data-filter-value="">Все</button>
								<button class="btn btn-default btn-sm <?php if($input['status'] == Partner::STATUS_DELIVERY_AFTER_WAIT_PAY_CONFIRM): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="status" data-filter-value="<?php echo Partner::STATUS_DELIVERY_AFTER_WAIT_PAY_CONFIRM; ?>">Клиент говорит что оплатил (<?php echo Partner::my()->checkStatus(array('statusType' => 'paywaiting', 'status' => Partner::STATUS_DELIVERY_AFTER_WAIT_PAY_CONFIRM))->count(); ?>)</button>
								<button class="btn btn-default btn-sm <?php if($input['status'] == Partner::STATUS_DELIVERY_AFTER_WAIT_PAY): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="status" data-filter-value="<?php echo Partner::STATUS_DELIVERY_AFTER_WAIT_PAY; ?>">Ожидают предоплаты (<?php echo Partner::my(array('statusType' => 'paywaiting', 'status' => Partner::STATUS_DELIVERY_AFTER_WAIT_PAY))->checkStatus(array('statusType' => 'paywaiting', 'status' => Partner::STATUS_DELIVERY_AFTER_WAIT_PAY))->count(); ?>)</button>
							<?php endif; ?>
							<?php if($user->hasRole(Role::ROLE_LOGISTICS)): ?>
								<button class="btn btn-default btn-sm <?php if($input['status'] == Partner::STATUS_DELIVERY_BEFORE_WAIT_PAY): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="status" data-filter-value="<?php echo Partner::STATUS_DELIVERY_BEFORE_WAIT_PAY; ?>">Ожидают деньги от транспортной (<?php echo Partner::my(array('statusType' => 'paywaiting', 'status' => Partner::STATUS_DELIVERY_BEFORE_WAIT_PAY))->checkStatus(array('statusType' => 'paywaiting', 'status' => Partner::STATUS_DELIVERY_BEFORE_WAIT_PAY))->count(); ?>)</button>
							<?php endif; ?>
						<?php endif; ?>
						<?php if($input['statusType'] == 'agreed' && $user->hasRole(Role::ROLE_LOGISTICS)): ?>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'clarification_address'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="clarification_address">Уточнение адреса (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'clarification_address'))->checkStatus(array('statusType' => 'agreed', 'type' => 'clarification_address'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'registration'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="registration">Оформление документов (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'registration'))->checkStatus(array('statusType' => 'agreed', 'type' => 'registration'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'waitdelivery'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="waitdelivery">Ожидание доставки (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'waitdelivery'))->checkStatus(array('statusType' => 'agreed', 'type' => 'waitdelivery'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'waitsend'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="waitsend">Ожидание отправки (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'waitsend'))->checkStatus(array('statusType' => 'agreed', 'type' => 'waitsend'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'delivery'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="delivery">Доставка (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'delivery'))->checkStatus(array('statusType' => 'agreed', 'type' => 'delivery'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'delivery_cdek_wait'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="delivery_cdek_wait">Ожидает в СДЭК (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'delivery_cdek_wait'))->checkStatus(array('statusType' => 'agreed', 'type' => 'delivery_cdek_wait'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'delivery_post_wait'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="delivery_post_wait">Ожидает на почте (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'delivery_post_wait'))->checkStatus(array('statusType' => 'agreed', 'type' => 'delivery_post_wait'))->count(); ?>)</button>
							<button class="btn btn-default btn-sm <?php if($input['type'] == 'success'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="type" data-filter-value="success">Доставлено (<?php echo Partner::my(array('statusType' => 'agreed', 'type' => 'success'))->checkStatus(array('statusType' => 'agreed', 'type' => 'success'))->count(); ?>)</button>
						<?php endif; ?>
					<?php endif; ?>
				</div>
				<?php if(($input['statusType'] == 'hr_interviewwait') && $user->hasAnyRole(array(Role::ROLE_CRM, Role::ROLE_LOGISTICS))): ?>
				<div class="filter-btn">
					<?php if($dates): ?>
						<?php foreach($dates as $key=>$value): ?>
						<button class="btn btn-default btn-sm <?php if(isset($input['date']) && $input['date'] == $key): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="date" data-filter-value="<?php echo $key; ?>"><?php echo $value; ?> (<?php echo Partner::my(array('statusType' => $input['statusType'], 'type' => $input['type']))->checkStatus(array('statusType' => $input['statusType'], 'type' => $input['type']))->whereRaw(DB::raw("DATE(salenextdatetime)='".$key."'"))->count(); ?>)</button>
						<?php endforeach; ?>
					<?php endif; ?>
				</div>
				<?php elseif(($input['statusType'] == 'agreed') && $user->hasRole(Role::ROLE_LOGISTICS)): ?>
				<div class="filter-btn">
					<?php if($dates): ?>
						<?php foreach($dates as $key=>$value): ?>
						<button class="btn btn-default btn-sm <?php if(isset($input['date']) && $input['date'] == $key): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="date" data-filter-value="<?php echo $key; ?>"><?php echo $value; ?> (<?php echo Partner::my(array('statusType' => $input['statusType'], 'type' => $input['type']))->checkStatus(array('statusType' => $input['statusType'], 'type' => $input['type']))->whereRaw(DB::raw("DATE(datetime_of_agree)='".$key."'"))->count(); ?>)</button>
						<?php endforeach; ?>
					<?php endif; ?>
				</div>
				<?php elseif(Auth::user()->isAdmin() && in_array($input['statusType'], array('work', 'reject'))): ?>
				<div class="filter-btn">
					<?php if($dates): ?>
						<button class="btn btn-default btn-sm <?php if(isset($input['date']) && $input['date'] == 'all'): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="date" data-filter-value="all">Все (<?php echo Partner::my(array('statusType' => $input['statusType'], 'type' => $input['type']))->checkStatus(array('statusType' => $input['statusType'], 'type' => $input['type']))->count(); ?>)</button>
						<?php foreach($dates as $key=>$value): ?>
						<button class="btn btn-default btn-sm <?php if(isset($input['date']) && $input['date'] == $key): ?> active <?php endif; ?> ladda-button" data-style="zoom-out" data-size="s" data-filter-name="date" data-filter-value="<?php echo $key; ?>"><?php echo $value; ?> (<?php echo Partner::my(array('statusType' => $input['statusType'], 'type' => $input['type']))->checkStatus(array('statusType' => $input['statusType'], 'type' => $input['type']))->whereRaw(DB::raw("DATE(created_at)='".$key."'"))->count(); ?>)</button>
						<?php endforeach; ?>
					<?php endif; ?>
				</div>
				<?php endif; ?>
				<?php if(Auth::user()->isSuperuser() && ($workProject->id == 20 || $workProject->id == 91)): ?>
					<?php if(isset($input['statusType']) && $input['statusType'] == 'agreed' && isset($input['type']) && $input['type'] == 'registration' && $user->hasRole(Role::ROLE_LOGISTICS) && isset($input['date']) && $input['date'] && $input['date'] != 'all'): ?>
					<div class="filter-btn">
						<?php
							$date = explode('-', $input['date']);
						?>
						<a href="<?php echo action('CrmController@shopLogisticsActFence'); ?>" class="btn btn-success btn-sm" target="_blank">Акт забора ShopLogistics (все заказы по <?php echo $date[2]; ?> <?php echo $months[$date[1]]; ?>)</a>
						<?php if($user->isAdmin()): ?>
							<button data-action="<?php echo action('PartnerController@sendToShoplogisticsAll'); ?>" class="btn btn-warning btn-sm btn-shoplogistics-export ladda-button"><span class="ladda-label">Отправить заявки в ShopLogistics (все заказы по <?php echo $date[2]; ?> <?php echo $months[$date[1]]; ?>)</span></button>
						<?php endif; ?>
						<br/><br/>
						<a href="<?php echo action('CrmController@cdekActFence'); ?>" class="btn btn-success btn-sm" target="_blank">Акт забора СДЭК (все заказы по <?php echo $date[2]; ?> <?php echo $months[$date[1]]; ?>)</a>
						<?php if($user->isAdmin()): ?>
							<button data-action="<?php echo action('PartnerController@sendToCdekAll'); ?>" class="btn btn-warning btn-sm btn-cdek-export ladda-button"><span class="ladda-label">Отправить заявки в Cdek (все заказы по <?php echo $date[2]; ?> <?php echo $months[$date[1]]; ?>)</span></button>
						<?php endif; ?>
					</div>
					<?php endif; ?>
				<?php endif; ?>
			</div>
		<?php endif; ?>

		<?php if(isset($input) && $input['statusType'] == 'agreed' && $input['type'] == 'waitdelivery' && $partners->count()): ?>
			<?php echo Form::open(array('action' => array('PartnerController@sendChecked'), 'id' => 'deliveryCheckedFrom')); ?>

		<?php endif; ?>
		<?php if(isset($input) && $input['statusType'] == 'agreed' && $input['type'] == 'waitsend' && $partners->count()): ?>
			<?php echo Form::open(array('action' => array('PartnerController@sendChecked'), 'id' => 'sendCheckedFrom')); ?>

		<?php endif; ?>

		<div class="table-responsive">
			<table class="table table-striped table-hover">
				<thead>
					<th>Клиент</th>
					<th>Информация</th>
					<th style="width:300px">Комментарий</th>
					<th class="lead-actions">Действия</th>
				</thead>
				<tbody>
					<?php foreach($partners as $partner): ?>
						<?php if(!isset($partner->hide) || !$partner->hide): ?>
						<tr <?php if($input['statusType'] == 'work'): ?> class="<?php echo $partner->getStatusClass(); ?>" <?php endif; ?>>
							<td>
								<p id="refrence_info_<?php echo $partner->id; ?>">
									<b>№<?php echo $partner->id; ?></b><br/>
									Имя: <?php echo $partner->name; ?><br/><br/>
									<?php if($partner->city): ?> Город: <?php echo $partner->city; ?><br/> <?php endif; ?>
									<?php if($partner->address): ?> Адрес: <?php echo $partner->address; ?><br/> <?php endif; ?>
								</p>
								<?php if($partner->comment): ?>
								<p id="partner_info_<?php echo $partner->id; ?>_comment">Примечание: <?php echo nl2br($partner->comment); ?></p>
								<?php endif; ?>
							</td>
							<td class="project-name">
								<p>
									<?php if($partner->status >= 10 && $partner->status < 30): ?>
										<big><?php echo $partner->getTransportTypeName(); ?></big><br/>
									<?php endif; ?>
									<?php if($partner->getStatusName()): ?>
										<big><?php echo $partner->getStatusName(); ?></big><br/>
									<?php endif; ?>
									<?php if($partner->isStatusToWork()): ?>
										<b>Связаться <span id="nextDateTime_<?php echo $partner->id; ?>" class="date-to-humanize" data-date="<?php echo $partner->salenextdatetime; ?>"><?php echo $partner->salenextdatetime; ?></span></b><br/>
									<?php endif; ?>
									<?php if($partner->importantcall): ?>
									<span class="label label-danger">!! ОБЯЗАТЕЛЬНО В ЭТО ВРЕМЯ !!</span><br/>
									<?php endif; ?>
									<?php if($partner->status == Partner::STATUS_DELIVERY_AFTER_WAIT_PAY_CONFIRM): ?>
										Говорит что оплатил <span class="to-humanize"><?php echo $partner->paidsum; ?></span> <i class="fa fa-rub"></i><br/>
									<?php endif; ?>
									<?php if($partner->lead && $partner->status == Partner::STATUS_WORK): ?>
									Заявка на <?php echo $partner->lead->entrypoint; ?><br/>
									<?php endif; ?>
									<?php if($partner->status == Partner::STATUS_REJECT && $partner->reject): ?>
										<?php echo $partner->reject->name; ?>

									<?php endif; ?>
									<?php if($partner->datetime_of_agree && $partner->status != Partner::STATUS_DELIVERY_AFTER_WAIT_PAY): ?>
										<br/><b>Заявка оформлена <span class="date-to-humanize" data-date="<?php echo $partner->datetime_of_agree; ?>"><?php echo $partner->datetime_of_agree; ?></span></b>
									<?php endif; ?>
								</p>
								<?php echo $__env->make('partner/order', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
							</td>
							<td>
								<div id="refrence_info_<?php echo $partner->id; ?>_comment" class="comment">
									<?php foreach($partner->getComments(2) as $comment): ?>
									<p class="date"><span class="date-to-humanize" data-date="<?php echo $comment->created_at; ?>"><?php echo $comment->created_at; ?></span> <span>(<?php echo $comment->sender->first_name; ?> <?php echo $comment->sender->last_name; ?>)</span></p>
									<p><?php echo nl2br($comment->comment); ?></p>
									<?php endforeach; ?>
								</div>
								<?php /*
								<div id="statusGroup_<?php echo $partner->id; ?>" class="btn-group btn-group-vertical crm-btns">
									<?php echo $__env->make('crm.btns', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
								</div>
								*/ ?>
							</td>
							<td>
								<div class="btn-group btn-group-vertical crm-btns" id="refrence_controls_<?php echo $partner->id; ?>">
									<a class="btn btn-sm btn-danger btn-setdatetime" href="<?php echo action('PartnerController@index', array($partner->id)); ?>"><span class="glyphicon glyphicon-hand-right"></span> Открыть</a>
									<button class="btn btn-sm btn-info btn-partner-comments" type="button" data-action="<?php echo action('CrmController@getPartnerComments', array($partner->id)); ?>"><span class="glyphicon glyphicon-comment"></span> Комментарии</button>
									<?php if(isset($input) && $input['statusType'] == 'agreed' && ($input['type'] == 'waitdelivery' || $input['type'] == 'waitsend')): ?>
									<label class="checkbox">
										<input type="checkbox" name="partners[<?php echo $partner->id; ?>]" onchange="updateSbmtBtn();" /> отправлен
									</label>
									<?php endif; ?>
								</div>
							</td>
						</tr>
						<?php endif; ?>
					<?php endforeach; ?>
				</tbody>
			</table>
		</div>
		<?php if(isset($input) && $input['statusType'] == 'agreed' && $input['type'] == 'waitdelivery' && $partners->count()): ?>
		<button id="deliveryCheckedSbmtBtn" type="submit" class="btn btn-primary pull-right ladda-button" data-style="zoom-out" data-action="<?php echo action('PartnerController@deliveryChecked'); ?>" data-form-id="deliveryCheckedFrom"><span class="ladda-label">Товар отправлен в транспортные компании всем отмеченным клиентам <span class="quant">(0)</span></span></button>
			<?php echo Form::close(); ?>

		<?php endif; ?>
		<?php if(isset($input) && $input['statusType'] == 'agreed' && $input['type'] == 'waitsend' && $partners->count()): ?>
			<button id="sendCheckedSbmtBtn" type="submit" class="btn btn-primary pull-right ladda-button" data-style="zoom-out" data-action="<?php echo action('PartnerController@sendChecked'); ?>" data-form-id="sendCheckedFrom"><span class="ladda-label">Товар отправлен отправлен всем отмеченным клиентам <span class="quant">(0)</span></span></button>
			<?php echo Form::close(); ?>

		<?php endif; ?>
		<?php echo $partners->setBaseUrl('crm'); ?>

		<?php echo $partners->appends($input)->links(); ?>

	</div>
</div>
