templates/deal/details.html.twig line 1

Open in your IDE?
  1. {% trans_default_domain 'deal' %}
  2. {% extends 'base_home.html.twig' %}
  3. {% block title %}{{ 'details.title'|trans({'{ deal }': entity.title}) }}{% endblock %}
  4. {% set resolutionsLabels = {
  5.     '360': 'SD 360p',
  6.     '480': 'SD 480p',
  7.     '540': 'SD 540p',
  8.     '720': 'HD 720p',
  9.     '1080': 'HD 1080p',
  10.     '2160': 'uHD 4K',
  11.     '2880': 'uHD 5K',
  12.     '4320': 'uHD 8K',
  13. } %}
  14. {% block content %}
  15. {% set hasCredits = true %}
  16. {% set hasDownloads = false %}
  17. {% set creditsState = 'login' %}
  18. {% if is_granted('ROLE_USER') %}
  19.     {% set minimalBid = entity.createMinimalBid(app.user) %}
  20.     {% if entity.isInFundingPhase %}
  21.         {% if is_granted('HAS_CREDITS', minimalBid) %}
  22.             {% set creditsState = 'ok' %}
  23.         {% else %}
  24.             {% set hasCredits = false %}
  25.             {% set creditsState = 'not-enough' %}
  26.         {% endif %}
  27.     {% elseif entity.isFundingComplete %}
  28.         {# also please note that isFinished means both "downloadable" and "refunded" #}
  29.         {% set creditsState = 'finished' %}
  30.         {% if is_granted(constant('App\\Security\\Voter\\Bid\\HasPurchasedVoter::ATTRIBUTE'), minimalBid) %}
  31.             {% set hasDownloads = true %}
  32.         {% else %}
  33.             {% set hasDownloads = false %}
  34.         {% endif %}
  35.     {% endif %}
  36. {% endif %}
  37. <div class="nk-content pt-md-3 min-vh-100 pb-3">
  38.     <div class="container">
  39.         <div class="row deal-details mb-5 enable-loading-delay">
  40.             <div class="col-12">
  41.                 <div class="contribution-wrap d-flex flex-column align-center">
  42.                     <div class="row mb-4">
  43.                         <div class="col-12">
  44.                             <h3 class="text-center">{{ entity.title }}</h3>
  45.                         </div>
  46.                     </div>
  47.                     <div class="row">
  48.                         <div class="col-12">
  49.                             <div class="d-flex justify-center flex-wrap">
  50.                                 <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 }}">
  51.                                     <span>{{ 'details.type_badage'|trans }}</span>
  52.                                 </div>
  53.                                 <div class="badge badge-outline-dark badge-lg badge-pill fw-normal mr-2 mb-2">
  54.                                     <span>{{ 'minute.plural'|trans({count: entity.videoFile.durationMinutes|number_format(2, ':')}, 'messages') }}</span>
  55.                                 </div>
  56.                                 {% if entity.additionalVideoFiles | length == 0 %}
  57.                                     <div class="badge badge-outline-dark badge-lg badge-pill fw-normal mr-2 mb-2">
  58.                                         <span>{{ resolutionsLabels[entity.videoFile.resolution]|default(entity.videoFile.height ~ 'p') }}</span>
  59.                                     </div>
  60.                                     <div class="badge badge-outline-dark badge-lg badge-pill fw-normal mr-2 mb-2">
  61.                                         <span>{{ entity.videoFile.fileSize // 1024 }} MB</span>
  62.                                     </div>
  63.                                 {% endif %}
  64.                             </div>
  65.                         </div>
  66.                     </div>
  67.                 </div>
  68.             </div>
  69.         </div>
  70.         <div class="row deal-details mb-4 enable-loading-delay">
  71.             <div class="col-12 col-xxl-8 offset-xxl-2 col-xl-10 offset-xl-1">
  72.                 <div style="max-width: 745px; margin: 0 auto;">
  73.                     <div class="js-deal-slider gallery-slider">
  74.                         {% for galleryItem in entity.proposalGalleryImages %}
  75.                             {% if galleryItem.trailer is defined and galleryItem.image is defined %}
  76.                                 <a href="{{ galleryItem.trailer.webPath | sindrive_protect }}" data-fancybox="video_vidcaps">
  77.                                     <div class="deal-trailer rounded mr-1 mr-md-2">
  78.                                         <span class="trailer-play-handle rounded-circle">
  79.                                             <i class="icon dp-icon-video"></i>
  80.                                         </span>
  81.                                         <img src="{{ galleryItem.image.webPath | sindrive_resize(752, 423) | sindrive_timed_protect }}" class="img-fluid rounded preview" alt="{{ entity.title }}">
  82.                                     </div>
  83.                                 </a>
  84.                             {% else %}
  85.                                 <div class="deal-trailer rounded">
  86.                                     {% if galleryItem.image is defined %}
  87.                                         <div class="screencap-item mr-1 mr-md-2">
  88.                                             <a href="{{ galleryItem.image.webPath | sindrive_protect | sindrive_resize(1920) }}" data-fancybox="video_vidcaps">
  89.                                                 <img class="preview" src="{{ galleryItem.image.webPath | sindrive_resize(752, 423) | sindrive_timed_protect }}" alt="{{ entity.title }}">
  90.                                             </a>
  91.                                         </div>
  92.                                     {% endif %}
  93.                                 </div>
  94.                             {% endif %}
  95.                         {% endfor %}
  96.                     </div>
  97.                 </div>
  98.             </div>
  99.         </div>
  100.     </div>
  101.     <div class="container">
  102.         <div class="deal-details content rounded mb-5 enable-loading-delay">
  103.             <div class="row">
  104.                 <div class="col-12 col-lg-8 offset-lg-2">
  105.                     {% if not entity.expired %}
  106.                         {% include 'deal/Block/deal_perkGrid.html.twig' %}
  107.                     {% elseif entity.isFundingComplete and hasDownloads %}
  108.                         {% set videoFiles = is_granted('ROLE_USER') ? entity.getVideoFilesByUser(app.user) : [] %}
  109.                         {% if videoFiles | length > 0 %}
  110.                             <div class="row">
  111.                                 <div class="col-12">
  112.                                     <h4 class="text-center">
  113.                                         {{ 'details.headline_downloads'|trans }}
  114.                                     </h4>
  115.                                 </div>
  116.                             </div>
  117.                             <div class="row mb-3">
  118.                                 <div class="col-12">
  119.                                     <hr>
  120.                                 </div>
  121.                             </div>
  122.                             <div class="row mb-6" id="downloads">
  123.                                 <div class="col-12">
  124.                                     <div class="p-2 pr-lg-4">
  125.                                         <div class="row hide-xs bg-light rounded">
  126.                                             <div class="col-12 col-sm-4 p-2 pl-4">
  127.                                                 <strong>File</strong>
  128.                                             </div>
  129.                                             <div class="col-2 p-2">
  130.                                                 <strong>{{ 'details.file_table.head.runtime'|trans }}</strong>
  131.                                             </div>
  132.                                             <div class="col-2 p-2">
  133.                                                 <strong>{{ 'details.file_table.head.resolution'|trans }}</strong>
  134.                                             </div>
  135.                                             <div class="col-4 p-2">
  136.                                                 <strong>{{ 'details.file_table.head.file_size'|trans }}</strong>
  137.                                             </div>
  138.                                         </div>
  139.                                         {% for fileIndex, videoFile in videoFiles %}
  140.                                         <div class="row pt-1 pb-2 pb-sm-1 {% if not loop.last %}border-bottom{% endif %}">
  141.                                             <div class="col-12 col-sm-4 p-2 pl-0 pl-sm-4">
  142.                                                 <div class="text-ellipsis w-80">
  143.                                                     <span class="fw-bold">
  144.                                                         {{ videoFile.name | clean_video_filename }}
  145.                                                     </span>
  146.                                                 </div>
  147.                                             </div>
  148.                                             <div class="col-4 col-sm-2 p-2">
  149.                                                 {{ videoFile.durationMinutes|number_format(2, ':') }}
  150.                                             </div>
  151.                                             <div class="col-4 col-sm-2 p-2 text-center text-sm-left">
  152.                                                 {{ resolutionsLabels[videoFile.resolution] | default(videoFile.height ~ 'p') }}
  153.                                             </div>
  154.                                             <div class="col-4 col-sm-2 p-2 text-right text-sm-left">
  155.                                                 <span>
  156.                                                     {{ videoFile.fileSize // 1024 }} MB
  157.                                                 </span>
  158.                                             </div>
  159.                                             <div class="col-12 col-sm-2 p-2">
  160.                                                 <div class="d-flex justify-content-between">
  161.                                                     {% if is_granted('ROLE_USER') and entity.isFundingComplete %}
  162.                                                         {% set path = url('deal_download', {'id': entity.stringId, 'fileIndex': fileIndex}) %}
  163.                                                         <a href="{{ path }}" target="_blank" class="btn btn-primary w-100 justify-center">
  164.                                                             <i class="dp-icon-downloads ml-2 mr-2"></i>
  165.                                                         </a>
  166.                                                     {% else %}
  167.                                                         <span class="btn btn-light btn-dim disabled w-100 justify-center">
  168.                                                             <i class="dp-icon-downloads ml-2 mr-2"></i>
  169.                                                         </span>
  170.                                                     {% endif %}
  171.                                                 </div>
  172.                                             </div>
  173.                                         </div>
  174.                                         {% endfor %}
  175.                                     </div>
  176.                                 </div>
  177.                             </div>
  178.                         {% endif %}
  179.                     {% endif %}
  180.                     <div class="row mb-6">
  181.                         <div class="col-12">
  182.                             <div class="row">
  183.                                 <div class="col-12">
  184.                                     {% if entity.tags|length > 0 %}
  185.                                         <div class="row">
  186.                                             <div class="col-12">
  187.                                                 <div class="d-flex justify-center flex-wrap">
  188.                                                     {% for tag in entity.tags %}
  189.                                                         <div class="badge badge-pill badge-light font-weight-normal text-dark mr-1 mb-2">
  190.                                                             <span>{{ tag.name }}</span>
  191.                                                         </div>
  192.                                                     {% endfor %}
  193.                                                 </div>
  194.                                             </div>
  195.                                         </div>
  196.                                     {% endif %}
  197.                                 </div>
  198.                             </div>
  199.                             <div class="row">
  200.                                 <div class="col-12">
  201.                                     <hr>
  202.                                 </div>
  203.                             </div>
  204.                             <div class="row mb-4">
  205.                                 <div class="col-12">
  206.                                     <div class="pr-lg-4">
  207.                                         <p>
  208.                                             {{ entity.description | raw }}
  209.                                         </p>
  210.                                     </div>
  211.                                 </div>
  212.                             </div>
  213.                         </div>
  214.                     </div>
  215.                 </div>
  216.             </div>
  217.         </div>
  218.     </div>
  219. </div>
  220. {% if is_granted('ROLE_USER') %}
  221.     {% set purchaseCredits = get_crud_action('App\\Controller\\Settings\\PurchaseCreditsController', {'deal_id': entity.stringId, 'returnUrl': app.request.requestUri}) %}
  222.     {% include 'settings/purchase_credits.html.twig' with purchaseCredits.params | merge({'reference': get_reference(entity), 'hasCredits': hasCredits}) %}
  223.     {% if (app.request.hasPreviousSession or app.session.started) and app.session.flashBag.get('contribution-success') %}
  224.         {% include 'partials/base_overlay.html.twig' with {
  225.             icon: 'dp-icon-heart',
  226.             title: 'details.purchase.success'|trans,
  227.             subtitle: ['details.purchase.success_subtitle'|trans]
  228.         } %}
  229.     {% endif %}
  230.     {% if not entity.expired and creditsState == 'ok'%}
  231.         <div class="d-none">
  232.             {{ render_crud_result('App\\Controller\\Deal\\PurchaseController', {'stringId': entity.stringId}) }}
  233.         </div>
  234.     {% endif %}
  235. {% endif %}
  236. {% include 'partials/flash_message_popup.html.twig' %}
  237. {% endblock %}