<?php
/**
*  Component  : Version
*  View       : Version Controller
*  Engine     : VersionEngine  
*  File       : version.list.blade.php  
*  Controller : VersionListController 
----------------------------------------------------------------------------- */
?>

<div>
    <!-- Heading Section -->
    <div class="lw-section-heading-block">
        <!-- Parent heading -->
        <!-- <div class="lw-breadcrumb">
            <a ui-sref="project">Manage Projects</a> &raquo; <a ui-sref="project" ng-bind="versionListCtrl.projectInfo.name"></a> &raquo;
        </div> -->
        <!-- Parent heading -->
        <ul class="lw-breadcrumb breadcrumb">
            <li class="breadcrumb-item"><a ui-sref="project"><?= __tr('Manage Projects') ?>
                </a></li>
            <li class="breadcrumb-item"><a ng-bind="versionListCtrl.projectInfo.name"></a></li>
        </ul>
        <!-- /Parent heading -->

        <!-- main heading -->
        <h3 class="lw-section-heading">
            Versions/Groups
        </h3>
        <!-- /main heading -->

        <div class="lw-section-right-content" ng-if="canAccess('manage.project.version.write.create')">

            <a ng-if="canAccess('manage.project.version.write.create')" class="btn btn-sm btn-primary lw-btn" href ng-click="versionListCtrl.openAddDialog(versionListCtrl.projectIdOrUid)"><i class="fas fa-plus"></i> <?= __tr(' New Version / Group') ?></a>

            <a ui-sref="project" title="<?= __tr('Back') ?>" class="lw-btn btn-sm btn btn-secondary"><i class="fas fa-arrow-alt-circle-left"></i> <?= __tr('Back') ?></a>

        </div>

    </div>
    <!-- /Heading Section -->
    <div class="shadow border p-4">
        <div class="row">
            <div class="col-sm-12 col-xs-12 col-md-6 col-lg-4 mb-4" ng-show="versionListCtrl.versions.length > 0" ng-repeat="version in versionListCtrl.versions">
                <div class="card ">
                    <div class="card-body">
                        <span class="h6 float-right">
                            <span class="badge badge-primary p-2" ng-show="version.is_primary == 1">Primary</span>
                        </span>
                      <h4 class="card-title"><span ng-if="version.canManageArticles">
                        <a title="<?= __tr('Articles') ?>" ui-sref="project_articles({ 'projectUid' : versionListCtrl.projectInfo._uid, versionUid : version._uid  })" ng-bind="version.version"><i class="far fa-newspaper"></i> <?= __tr('Articles') ?></a>
                    </span>
                    <span ng-if="!version.canManageArticles" ng-bind="version.version"></span>
                    &nbsp;<a ng-if="version.status == 1" title="Open in new window" target="_blank" href="[[version.detailUrl]]"><i class="fas fa-external-link-alt"></i> </a>
                </h4>
                      <p class="card-text">
                        <div>Status: <strong ng-bind="version.f_status"></strong></div>
                        <div>Created at: <strong ng-bind="version.created_at"></strong></div>

                      </p>
                      <hr>
                      <button ng-if="canAccess('manage.project.version.read.list')" class="btn btn-lite" title="<?= __tr('Embed') ?>" ng-click="versionListCtrl.showEmbedScriptDialog(version.projectSlug, version.versionSlug)"><span class="fas fa-code"></span> Embed </button>

                        <button ng-if="version.canEdit" class="btn btn-secondary" ng-click="versionListCtrl.openEditDialog(version._uid)"><i class="fas fa-edit"></i> Edit</button>

                        <button class="btn btn-danger" ng-if="version.canDelete" ng-click="versionListCtrl.delete(version._uid, version.version)"><i class="fas fa-trash-alt"></i> Delete</button>

                        <a ng-if="version.canDownload" ng-show="version.canGeneratePdf == 1" href="[[version.download_url]]" class="btn btn-secondary"><i class="fas fa-download"></i> Download as PDF</a>
                    </div>
                </div>
            </div>
            <div class="alert alert-warning col-12" ng-show="versionListCtrl.versions.length == 0">
                <td colspan="4" class="text-center">There are no [[::versionListCtrl.projectInfo.name]] versions/groups</td>
            </div>
        </div>

    </div>

    <input type="hidden" id="lwVersionDeleteConfirm" data-message="<?= __tr('You want to delete <strong>__name__</strong> project version, Related information will be delete.', [
                                                                        '__name__' => '[[ versionListCtrl.deletingTagName ]]'
                                                                    ]) ?>" data-delete-button-text="<?= __tr('Yes, delete it') ?>" , success-msg="<?= __tr('Version deleted successfully.') ?>"></div>