{% trans_default_domain 'shop_video' %}
{% extends 'base_home.html.twig' %}
{% block title %}{{ 'details.title'|trans({'{ shop_video }': entity.title}) }}{% endblock %}
{% set resolutionsLabels = {
'360': 'SD 360p',
'480': 'SD 480p',
'540': 'SD 540p',
'720': 'HD 720p',
'1080': 'HD 1080p',
'2160': 'uHD 4K',
'2880': 'uHD 5K',
'4320': 'uHD 8K',
} %}
{% block content %}
{% set hasCredits = false %}
{% set hasPurchased = is_granted('ROLE_USER') and is_granted(constant('App\\Security\\Voter\\Bid\\HasPurchasedOnceVoter::ATTRIBUTE'), entity.createBid(app.user)) %}
<div class="nk-content pt-md-3 min-vh-100 pb-5">
<div class="container">
<div class="row shop-video-details mb-5 enable-loading-delay">
<div class="col-12">
<div class="contribution-wrap d-flex flex-column align-center">
<div class="row mb-4">
<div class="col-12">
<h3 class="text-center">{{ entity.title }}</h3>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="d-flex justify-center flex-wrap">
<div class="badge badge-outline-dark badge-lg badge-pill fw-normal mr-2 mb-2" data-toggle="tooltip" data-bs-placement="top" title="{{ 'details.type_badage_tooltip'|trans }}">
<span>{{ 'details.type_badage'|trans }}</span>
</div>
<div class="badge badge-outline-dark badge-lg badge-pill fw-normal mr-2 mb-2">
<span>{{ resolutionsLabels[entity.videoFile.resolution]|default(entity.videoFile.height ~ 'p') }}</span>
</div>
<div class="badge badge-outline-dark badge-lg badge-pill fw-normal mr-2 mb-2">
<span>{{ 'minute.plural'|trans({count: entity.videoFile.durationMinutes|number_format(2, ':')}, 'messages') }}</span>
</div>
<div class="badge badge-outline-dark badge-lg badge-pill fw-normal mr-2 mb-2">
<span>{{ entity.videoFile.fileSize // 1024 }} MB</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row shop-video-details enable-loading-delay">
<div class="col-12 col-lg-8 offset-lg-2">
<div style="max-width: 770px; margin: 0 auto;">
<div class="gallery-slider js-shop-video-slider">
{% if entity.trailer %}
<div class="shop-video-trailer rounded">
<a href="{{ entity.trailer.webPath | sindrive_protect }}" data-fancybox="video_vidcaps">
<div class="shop-trailer rounded mr-1 mr-md-2">
<span class="trailer-play-handle rounded-circle">
<i class="icon dp-icon-video"></i>
</span>
{% if entity.preview %}
<img src="{{ entity.preview.webPath | sindrive_resize(752, 423) | sindrive_timed_protect }}" class="img-fluid rounded preview mr-2 ml-2" alt="{{ entity.title }}">
{% else %}
<img src="{{ asset('images/proposal/blank.jpg') }}" class="img-fluid rounded mr-2 ml-2" alt="{{ entity.title }}">
{% endif %}
</div>
</a>
</div>
{% else %}
<div class="shop-trailer rounded">
{% if entity.preview %}
<img src="{{ entity.preview.webPath | sindrive_resize(752, 423) | sindrive_timed_protect }}" class="img-fluid rounded preview mr-2 ml-2" alt="{{ entity.title }}">
{% else %}
<img src="{{ asset('images/proposal/blank.jpg') }}" class="img-fluid rounded mr-2 ml-2" alt="{{ entity.title }}">
{% endif %}
</div>
{% endif %}
{% if entity.gallery|length > 0 %}
{% for galleryImage in entity.gallery %}
<div class="screencap-item">
<a href="{{ galleryImage.webPath | sindrive_protect | sindrive_resize(1920) }}" data-fancybox="video_vidcaps">
<img class="preview mr-2 ml-2" src="{{ galleryImage.webPath | sindrive_resize(752, 423) | sindrive_timed_protect }}" alt="">
</a>
</div>
{% endfor %}
{% endif %}
{% if entity.publishedVidcaps|length > 0 %}
{% for vidcap in entity.publishedVidcaps %}
<div class="screencap-item">
<a href="{{ vidcap.webPath | sindrive_protect | sindrive_resize(1920) }}" data-fancybox="video_vidcaps">
<img class="preview mr-2 ml-2" src="{{ vidcap.webPath | sindrive_resize(752, 423) | sindrive_timed_protect }}" alt="">
</a>
</div>
{% endfor %}
{% endif %}
</div>
</div>
</div>
</div>
<div class="row mb-6 shop-video-details enable-loading-delay">
<div class="col-12 col-lg-6 offset-lg-3">
<div class="contribution-action-wrap">
{% if is_granted('ROLE_USER') %}
{% if hasPurchased %}
<div class="form-control-wrap">
<button class="btn btn-lg btn-round btn-dark fw-bolder contribution-purchase-button justify-between" data-toggle="modal" data-target="#download-{{ entity.stringId }}">
<span class="lead text-white m-0">
<em class="icon dp-icon-downloads mr-4"></em>
</span>
<span>{{ 'details.purchase.download_button'|trans }}</span>
</button>
</div>
{% include 'shop_video/Block/download_popup.html.twig' with {shop_video: entity} only %}
{% elseif is_granted(constant('App\\Security\\Voter\\Bid\\HasCreditsVoter::ATTRIBUTE'), entity.createBid(app.user)) %}
<div class="contribution-action">
{{ render_crud_result('App\\Controller\\ShopVideo\\PurchaseController', {'stringId': entity.stringId}) }}
</div>
{% else %}
<div class="contribution-action">
<div class="contribution-info-amount">
<span class="mr-2 fw-normal">{{ 'details.purchase.current_price'|trans }}</span>{{ 'credits.plural'|trans({count: entity.priceFloat|price_format(true)}, 'messages') }}
</div>
<button class="btn btn-lg btn-round fw-bolder contribution-purchase-button btn-secondary mb-4" data-toggle="modal" data-target="#purchase-credits-dialog">
<span>{{ 'details.purchase.button'|trans }}</span>
</button>
<div>
<p class="fs-14px">{{ 'details.purchase.hint'|trans }}</p>
</div>
</div>
{% endif %}
{% elseif not is_granted('ROLE_USER') %}
<div class="contribution-action mt-2">
<div class="form-control-wrap">
<div class="contribution-info-amount">
<span class="mr-2 fw-normal">{{ 'details.purchase.current_price'|trans }}</span> {{ 'details.purchase.blind_price'|trans }}
</div>
<a href="{{ path('app_login', {'return': app.request.pathInfo}) }}" class="btn btn-lg btn-round fw-bolder contribution-purchase-button btn-secondary mb-4" type="submit">
<div>{{ 'details.purchase.button'|trans }}</div>
</a>
<div>
<p class="fs-14px">{{ 'details.purchase.hint'|trans }} <a href="{{ path('app_login') }}" class="fw-bolder link">{{ 'details.purchase.login_label'|trans }}</a> or <a href="{{ path('registration') }}" class="fw-bolder link">{{ 'details.purchase.signup_label'|trans }}</a>.</p>
</div>
</div>
</div>
{% endif %}
</div>
</div>
</div>
<div class="shop-video-details content rounded pt-4 mb-5 enable-loading-delay">
<div class="row">
<div class="col-12 col-lg-8 offset-lg-2">
<div class="row mb-6">
<div class="col-12">
{% if entity.tags|length > 0 %}
<div class="row">
<div class="col-12">
<div class="d-flex justify-center flex-wrap">
{% for tag in entity.tags %}
<div class="badge badge-pill badge-light font-weight-normal text-dark mr-1 mb-1">
<span>{{ tag.name }}</span>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-12">
<hr>
</div>
</div>
<div class="row mb-4">
<div class="col-12">
<div class="pr-lg-4">
<p class="text-center">
{{ entity.description | raw }}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% if is_granted('ROLE_USER') %}
{% set hasCredits = is_granted(constant('App\\Security\\Voter\\Bid\\HasCreditsVoter::ATTRIBUTE'), entity.createBid(app.user)) %}
{% set purchaseCredits = get_crud_action('App\\Controller\\Settings\\PurchaseCreditsController', {'shop_video_id': entity.stringId, 'returnUrl': app.request.requestUri}) %}
{% include 'settings/purchase_credits.html.twig' with purchaseCredits.params | merge({'reference': get_reference(entity), 'hasCredits': hasCredits}) %}
{% endif %}
{% if is_granted('ROLE_USER') and ((app.request.hasPreviousSession or app.session.started) and app.session.flashBag.get('purchase-success')) %}
{% include 'partials/base_overlay.html.twig' with {
icon: 'dp-icon-heart',
title: 'details.purchase.success'|trans,
subtitle: 'details.purchase.success_subtitle'|trans
} %}
{% endif %}
{% include 'partials/flash_message_popup.html.twig' %}
{% endblock %}