{% extends 'base.html.twig' %}
{% block body %}
<div class="container-main">
{% include '/parts/menu.html.twig' %}
<div class="datagrid-header-tools">
<div class="content-panel">
<div class="content-panel-body with-rounded-top with-min-h-250">
<div class="description-wrapper">
<div class="description-text">{{ description|raw }}</div>
{% if own is not defined %}
{% if network is defined and network == 'tat' %}
{% if manager is null %}
<div class="description-text">Сповіщення про нові заявки в Telegram <a
href="http://t.me/TAT_birzha_bot?start" class="telegram-link-inner"
target="_blank">http://t.me/TAT_birzha_bot</a>
<br /><a class="telegram-link-inner" target="_blank" href="https://youtu.be/5hF6C57A_L4">Відео інструкція</a> як працювати з Біржею
</div>
{% else %}
<div class="description-text">Сповіщення про нові заявки в Telegram <a
href="http://t.me/TAT_birzha_bot?start={{ manager.id }}"
class="telegram-link-inner"
target="_blank">http://t.me/TAT_birzha_bot</a>
<br /><a class="telegram-link-inner" target="_blank" href="https://youtu.be/5hF6C57A_L4">Відео інструкція</a> як працювати з Біржею
</div>
{% endif %}
{% else %}
{% if manager is null %}
<div class="description-text">Сповіщення про нові заявки в Telegram <a
href="http://t.me/OtpuskProBot?start" class="telegram-link-inner"
target="_blank">http://t.me/OtpuskProBot</a>
<br /><a class="telegram-link-inner" target="_blank" href="https://youtu.be/5hF6C57A_L4">Відео інструкція</a> як працювати з Біржею
</div>
{% else %}
<div class="description-text">Сповіщення про нові заявки в Telegram <a
href="http://t.me/OtpuskProBot?start={{ manager.id }}"
class="telegram-link-inner"
target="_blank">http://t.me/OtpuskProBot</a>
<br /><a class="telegram-link-inner" target="_blank" href="https://youtu.be/5hF6C57A_L4">Відео інструкція</a> як працювати з Біржею
</div>
{% endif %}
{% endif %}
<div class="reboot-time-block">
<div class="page-update">Сторінка оновиться через <span class="time"
id="reboot-time">10:00</span>
</div>
{# <div onclick="location.reload();" class="btn-primar addition-action-btn">Обновить сейчас</div> #}
{# <div onclick="$('#reboot-time').removeAttr('id'); stopReload = true;" class="btn-primar not-update-button"></div> #}
<div id="update-timer" class="btn-primar update-timer-button">
<i class="update-timer-icon"></i>
</div>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#update-timer').on('click', function () {
// $('#reboot-time').removeAttr('id');
stopReload = !stopReload;
$('.update-timer-icon').toggleClass('stop-timer');
});
});
var timerr = "10:00";
stopReload = false;
var interval = setInterval(function () {
if (!stopReload) {
var timer = timerr.split(':');
//by parsing integer, I avoid all extra string processing
var minutes = parseInt(timer[0], 10);
var seconds = parseInt(timer[1], 10);
if (minutes >= 0) {
--seconds;
if (seconds < 0)
minutes = (seconds < 0) ? --minutes : minutes;
if (minutes >= 0) {
seconds = (seconds < 0) ? 59 : seconds;
seconds = (seconds < 10) ? '0' + seconds : seconds;
//minutes = (minutes < 10) ? minutes : minutes;
$('#reboot-time').html(minutes + ':' + seconds);
timerr = minutes + ':' + seconds;
} else {
if (!stopReload) {
clearInterval(interval);
location.reload();
clearInterval(interval);
}
}
}
}
}, 1000);
</script>
{% endif %}
</div>
<div class="table datagrid with-rounded-top">
<div class="table-items-container">
{% include '/parts/reguests-filter.html.twig' %}
{% for request in requests %}
{% if(request.debits is defined or request.agency is defined) %}
{% set agencies = [] %}
{% if manager is not null %}
{% set agency = manager.agency %}
{% if request.debits is defined %}
{% for debit in request.debits %}
{% set agencies = agencies|merge([debit.agency.id]) %}
{% endfor %}
{% else %}
{% set agencies = [request.agency.id] %}
{% endif %}
{% if (request.debits is defined and request.debits is not empty) and (manager.agency.id in agencies) %}
{% include '/parts/request-full.html.twig' %}
{% elseif(request.auctionRequest is defined) %}
{% include '/parts/request-full.html.twig' with { 'request': request.auctionRequest, 'debit':request } %}
{% else %}
{% include '/parts/request-part.html.twig' %}
{% endif %}
{% else %}
{% include '/parts/request-part.html.twig' %}
{% endif %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
{{ knp_pagination_render(requests) }}
</div>
</div>
</div>
<div class="modal-buy form-price modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">Сума
<span class="modal-title time" id="modal-price"></span> грн буде списана з вашого балансу
</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="message-text hide"></div>
<div class="btn-primar primary-action-btn" id="modal-confirm" data-id="" data-price="">Підтвердити
<div class="spinner-border text-secondary" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<div class="btn-secondary addition-action-btn close">Скасувати</div>
</div>
</div>
</div>
</div>
<div class="modal-cancellation modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="modal-title">
</div>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="help-for-refund">
<div class="help-for-refund-title">Запит на повернення коштів</div>
Запит буде розглянутий, якщо:
<ol>
<li>
Ви намагалися зв'язатися з клієнтом не більше ніж через 3 години після придбання заявки (без
урахування нічного часу).
</li>
<li>
Ви зробили не менше 3-х спроб зв'язатися, як мінімум 2-ма різними способами зв'язку (телефон та
месенджер)
</li>
<li>
Ви можете надати докази: скріншот історії дзвінків з телефону або сервісу IP-телефонії, скріншот
вайбер або телеграм-чату, файл із записом дзвінка.
</li>
</ol>
</div>
<div class="modal-body"></div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('.close').on('click', function () {
$('.request-modal-btn').find('span.main').show();
$('.request-modal-btn').find('span.secondary').hide();
$('.modal-buy').hide();
$('.modal-cancellation').hide();
});
$('.request-modal-btn').on('click', function () {
$requestId = $(this).data("request");
$requestPrice = $(this).find('span.main').html();
$(this).find('span.main').hide();
$(this).find('span.secondary').html($requestPrice);
$(this).find('span.secondary').show();
$('#modal-price').html($requestPrice);
$('#modal-confirm').data("id", $requestId).data("price", $requestPrice);
$('.modal-buy').show();
});
$('#modal-confirm').on('click', function () {
$requestId = $(this).data("id");
$requestPrice = $(this).data("price");
$('.spinner-border').show();
$.ajax({
method: 'POST',
url: '/api/buy-request',
data: {'price': $requestPrice, 'id': $requestId},
}).done(function (data) {
$('.spinner-border').hide();
if (data['status'] == 'error') {
$('.modal-buy .message-text').html(data['text']).show();
} else if (data['status'] == 'success') {
$('.modal-buy .message-text').html(data['text']).show();
$('#modal-confirm').hide();
setTimeout(function () {
window.location.replace('/birzha/my-own');
}, 1000);
}
});
});
$('.btn-cancellation').on('click', function () {
var form = $(this).data("form");
$.ajax({
method: 'POST',
url: '/api/request-cancellation-modal',
data: $("form[name=" + form + "]").serializeArray(),
}).done(function (data) {
$(".modal-cancellation .modal-body").html(data);
$(".help-for-refund").show();
$(".modal-cancellation").show();
});
});
addBit = function (form, minBit) {
console.log(minBit);
var notReturn = true;
notReturn = true;
if ($("form[name=" + form + "]").find('input').prop('required')
&& $("form[name=" + form + "]").find('input').val().length == 0) {
$("form[name=" + form + "] .form_error").text("Поле обов'язково");
notReturn = false;
return;
}
if ($("form[name=" + form + "]").find('input').prop('required')
&& $("form[name=" + form + "]").find('input').val() < minBit) {
$("form[name=" + form + "] .form_error").text("Мінімальна ставка " + minBit + " грн");
notReturn = false;
return;
}
if (notReturn) {
$("form[name=" + form + "]" + ' .spinner-border').show();
$.ajax({
method: 'POST',
url: '/api/bid-add',
data: $("form[name=" + form + "]").serializeArray(),
}).done(function (data) {
if ('message' in data) {
console.log(form);
$("form[name=" + form + "] .form_error").text(data['message']);
$('.spinner-border').hide();
} else {
location.reload();
}
});
}
}
buyRequest = function (form) {
$.ajax({
method: 'POST',
url: '/api/buy-request',
data: $("form[name=" + form + "]").serializeArray(),
}).done(function (data) {
window.location.replace('/birzha/my-own');
});
}
deleteBid = function (id) {
$.ajax({
method: 'POST',
url: '/api/bid-remove',
data: {'id': id}
}).done(function (data) {
location.reload();
});
}
cancellation = function (form) {
console.log(form);
if ($("form[name=" + form + "]").find('input').prop('required')
&& $("form[name=" + form + "]").find('input').val().length == 0) {
$("form[name=" + form + "] .form_error").text("Поле обов'язково");
return;
}
$.ajax({
method: 'POST',
url: '/api/request-cancellation',
data: $("form[name=" + form + "]").serializeArray(),
}).done(function (data) {
location.reload();
});
}
// $('.first a').html('');
});
</script>
{% endblock %}
{% block javascripts %}
{{ parent() }}
{% endblock %}