<?php if(!defined('FastCore')){ exit('Oops!');}
$opt['title'] = 'Мои ссылки';
?>
<!-- Header -->
<div class="header pb-6">
</div>
<!-- Page content -->
<div class="container-fluid">
<div class="card">
<div class="card-header text-uppercase p-3">
<div class="row align-items-center">
<div class="col">
<h3 class="mb-0">Мои ссылки в сёрфинге</h3>
</div>
<div class="col text-right">
<a href="/user/surf/add" class="btn btn-primary">Добавить ссылку</a>
</div>
</div>
</div>
</div>
<br>
<div class="card">
<div class="card-body p-3">
<?
$numb = $db->query("SELECT * FROM `db_surf` WHERE uid = '$uid'")->numRows();
if($numb < 1) {
echo '<div class="alert alert-danger text-center text-uppercase"><b>У вас нету ссылок! Вы можете "<a class="text-white" href="/user/surf/add">Разместить ссылку здесь</a>".</b></div>';
}
?>
<?
$list = $db->query("SELECT * FROM `db_surf` WHERE uid = '$uid' ORDER BY id DESC")->fetchAll();
foreach ($list as $surf) {
$eye = round($surf['balance']/$surf['price_click'],0);
?>
<div class="card" id="surf_<?=$surf['id'];?>">
<div class="row">
<div class="col-md-1 text-center">
<form action="" method="POST" class="m-3">
<?
if($surf['status'] == '1'){
echo '<button class="btn icon icon-shape icon-shape-warning rounded-circle status_surf" href="#" action="2" title="Остановить" surf_id="'.$surf['id'].'"><i class="fa fa-pause"></i></button>';
}else{
echo '<button class="btn icon icon-shape icon-shape-success rounded-circle status_surf" href="#" action="1" title="Запустить" surf_id="'.$surf['id'].'"><i class="fa fa-play"></i></button>';
}
?>
</form>
</div>
<div class="col">
<div class="p-2">
<div class="row align-items-center">
<div class="col pl-2">
<h3 class="mb-0"><a href="<?=$surf['url'];?>" target="_blank"><img src="https://www.google.com/s2/favicons?domain=<?=$surf['url'];?>"> <b><?=$surf['title'];?></b></a></h3>
</div>
<div class="col-2 text-right">
<form action="/user/surf/edit" style="display: inline;" method="POST">
<input type="hidden" name="surf_id" value="<?=$surf['id']; ?>">
<button class="btn p-0 pl-1 pr-1 text-primary p-0" title="Редактировать площадку #<?=$surf['id']; ?>"><i class="fa fa-edit"></i> </button>
</form>
<form action="" method="POST" style="display: inline;">
<button surf_id="<?=$surf['id'];?>" href="#" class="btn p-0 pl-1 pr-1 text-danger delete" title="Удалить площадку #<?=$surf['id']; ?>"><i class="fa fa-times"></i> </button>
</form>
</div>
</div>
</div>
<div class="card-footer p-0">
<div class="nav nav-pills nav-fill mt-1">
<div class="nav-item text-left">Баланс: <b>₽ <?=$surf['balance'];?> </b> <small class="text-danger" data-toggle="collapse" data-target="#advsum<?=$surf['id'];?>" style="cursor: pointer;"><b>[ПОПОЛНИТЬ]</b></small></div>
<div class="nav-item">Просмотры: <b title="Осталось просмотров"><?=$eye;?> <i class="fas fa-eye mr-1" aria-hidden="true"></i></b> <b title="Всего просмотрено" class="text-muted"><?=$surf['views'];?> <i class="fas fa-eye-slash" aria-hidden="true"></i></b></div>
<div class="nav-item">Цена перехода: <b>₽ <?=$surf['price_click'];?></b></div>
</div>
</div>
<div id="advsum<?=$surf['id'];?>" class="collapse">
<form class="balance_add m-3 mb-0" method="POST">Введите сумму пополнения:
<div class="input-group input-group-sm">
<div class="input-group-prepend"><span class="input-group-text">₽</span></div>
<input type="hidden" name="surf_id" value="<?=$surf['id']; ?>">
<input type="text" id="money" name="money" class="form-control col-2" placeholder="Минимум: 1.00" value="1.00">
<input type="hidden" id="type" name="type" value="add_balance">
<div class="input-group-append"><button class="btn btn-primary"><b>ОК</b></button></div>
</div>
</form>
</div>
</div>
</div></div>
<?
}
?>
</div>
</div>
</div>
</div>