?? GreyFile — Mystic File Browser

Current path: home/webdevt/cryptoimpot.fr/module/Application/view/application/importation/



?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/view/application

?? Viewing: index.phtml

<?php
$this->headTitle()->append('Importation des transactions');
$this->HeadLink()
        ->appendStylesheet('https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/css/bootstrap-select.css')
        ->appendStylesheet($this->basePath() . '/dist/css/style.css')
        ->appendStylesheet('https://blueimp.github.io/Gallery/css/blueimp-gallery.min.css')
        ->appendStylesheet($this->basePath() . '/dist/css/jquery.fileupload.css')
        ->appendStylesheet($this->basePath() . '/dist/css/jquery.fileupload-ui.css')
;
$this->headScript()
        ->appendFile('https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/js/bootstrap-select.min.js')
        ->appendFile('https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js')
        ->appendFile('https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.ui.widget.js')
        ->appendFile('https://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js')
        ->appendFile('https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js')
        ->appendFile('https://blueimp.github.io/Gallery/js/jquery.blueimp-gallery.min.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.iframe-transport.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.fileupload.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.fileupload-process.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.fileupload-image.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.fileupload-audio.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.fileupload-video.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.fileupload-validate.js')
        ->appendFile($this->basePath() . '/dist/js/jquery.fileupload-ui.js');




//  <!-- Bootstrap CSS -->
//        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
//        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">

/*

  <link rel="stylesheet" href="">
  <link rel="stylesheet" href="">
  <!-- CSS adjustments for browsers with JavaScript disabled -->
  <noscript><link rel="stylesheet" href="dist/css/jquery.fileupload-noscript.css"></noscript>
  <noscript><link rel="stylesheet" href="dist/css/jquery.fileupload-ui-noscript.css"></noscript>
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css">

 */

//<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css">
//<link rel="stylesheet" href="" />
//<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
?>

<style>
    .dropzone-file {
        /*background: #c6e8ff;*/
        color: #dee2e6;

        width: 100%;
        height: 150px;
        /*line-height: 50px;*/
        text-align: center;
        font-weight: normal;
        margin: 0 auto;
        box-sizing: border-box;
    }
    .fileinput-button{
        background: #ffffff;
        color: #dee2e6;
        text-align: center;
        margin: auto;
        line-height: 150px;
        width:100%;
        border: 2px dashed #004444;
        box-sizing: border-box;
        max-height: 180px;
    }
    
    .dropzone-file.in {
        width: 100%;
        height: 200px;
        line-height: 200px;
        font-size: larger;
        
        background: #ffffff;
        border: 2px dashed #000044;
    }
    .dropzone-file.hover {
        background: #ffffff;
        border: 2px dashed #6c757d;
    }
    .dropzone-file.fade {
        -webkit-transition: all 0.3s ease-out;
        -moz-transition: all 0.3s ease-out;
        -ms-transition: all 0.3s ease-out;
        -o-transition: all 0.3s ease-out;
        transition: all 0.3s ease-out;
        opacity: 1;
    }
</style>

<div class="container-fluid" style="background-color: #F7F7FB; padding: 15px;">

    <div class="row shadow bg-white p-4" style=" border-bottom: 1px solid #dee2e6; background-color:#ffffff; margin: 15px 150px;">
        <div class="col">
            <h3>Comment importer mon historique de transactions</h3>
            <p>Cliquez sur le nom de l'échange ci-dessous et suivez les instructions. Assurez-vous d'importer toutes les transactions sur tous les échanges et sur toutes les années.</p>
        </div>
    </div>

    <div class="shadow bg-white mt-5 p-4" style="border-bottom: 1px solid #dee2e6; margin: 15px 150px;">
    <div class="row" style="margin-right: -26px; margin-left: -26px;">
        <div class="col" style="border-bottom: 1px solid #dee2e6;">
            <nav >
                <div style="border-bottom: none !important; font-size: 0.9em; position:absolute; bottom:0px;" class="nav nav-tabs" id="nav-tab" role="tablist">

                    <?php
//                    echo $this->partial('partial/importation/tab', array(
//                        'exchange' => null,
//                        'selected' => (empty($this->exchangeSelected) ? true : false),
//                        ));
                    ?>
                    <?php if (!empty($this->arrayExchanges)) : ?>
                        <?php $count = 0 ?>
                        <?php foreach ($this->arrayExchanges as $exchange) : ?>
                            <?php
                            echo $this->partial('partial/importation/tab', array(
                                'exchange' => $exchange,
                                'selected' => (!empty($this->exchangeSelected) && $this->exchangeSelected->getId() === $exchange->getId()) ? true : false,
                                'indexCount' => $count++));
                            ?>
                        <?php endforeach ?>
                    <?php endif ?>


                </div>
            </nav>
        </div>
        <div  class="col col-lg-2" style="border-bottom: 1px solid #dee2e6;">
            <button style="font-size: 0.8em" type="button" class="btn btn-outline-secondary border border-dark mb-2" data-toggle="modal" data-target="#gestion-trades">
                <i class="fas fa-archive"></i> Gestion des importations
            </button>
        </div>
    </div>
    <div class="tab-content" id="nav-tabContent">

        <?php
//                echo $this->partial('partial/importation/tab-content', array(
//                    'exchange' => null,
//                    'selected' => (empty($this->exchangeSelected) ? true : false),
//                    'formDelete' => $formDelete,
//                    'indexCount' => $count++));
        ?>
        <?php if (!empty($this->arrayExchanges)) : ?>
            <?php $count = 0 ?>
            <?php foreach ($this->arrayExchanges as $exchange) : ?>
                <?php if (!empty($this->exchangeSelected) && $this->exchangeSelected->getId() === $exchange->getId()) : ?>
                    <?php
                    echo $this->partial('partial/importation/tab-content', array(
                        'exchange' => $exchange,
                        'selected' => (!empty($this->exchangeSelected) && $this->exchangeSelected->getId() === $exchange->getId()) ? true : false,
                        'formDelete' => $formDelete,
                        'formAPI' => $formAPI,
                        'countTradeExchangeUser' => $this->countTradeExchangeUser,
                        'indexCount' => $count++));
                    ?>
                <?php endif ?>
            <?php endforeach ?>
        <?php endif; ?>
    </div>
        </div>

    <?php
    //var_dump('eee',$this->exchange->getName()); exit;
// manage trades import
    ?>

    <!-- Modal -->
    <div class="modal fade" id="gestion-trades" tabindex="-1" role="dialog" aria-labelledby="gestion-trades" aria-hidden="true">
        <div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalScrollableTitle">Gestion des transactions importées</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <p id="row-empty-container">Aucune transaction n'a été importée</p>
                    <?php if (!empty($this->importInfosArray)) : ?>
                        <?php foreach ($this->importInfosArray as $exchangeName => $importInfoArray) : ?>
                            <div class="row-source-container-js" id="row-source-container-<?= $exchangeName ?>">
                                <h4><?= $exchangeName ?></h4>
                                <table class="table table-sm ">
                                    <thead class="">
                                        <tr>
                                            <th scope="col">Nom</th>
                                            <th scope="col-lg-3">Date import</th>
                                            <th scope="col-lg-3">Nb de transactions</th>
                                            <th scope="col-lg-3">Action</th>

                                        </tr> 
                                    </thead>
                                    <tbody>
                                        <?php foreach ($importInfoArray as $importInfo) : ?>
                                            <?php if ($importInfo->getNombreTrade() > 0) : ?>

                                                <tr data-exchange="<?= $exchangeName ?>" id="row-source-<?= $importInfo->getId() ?>">
                                                    <td><?= $importInfo->getName() ?></td>
                                                    <td><?= $importInfo->getDatetimeImport()->format('d-m-Y') ?></td>
                                                    <td><?= $importInfo->getNombreTrade() ?></td>
                                                    <td><button type="submit" name="submit" class="delete-import-exchange btn btn-danger btn-sm btn-block" data-exchange-name="<?= strtolower($importInfo->getName()) ?>" data-import-id="<?= $importInfo->getId() ?>" value=""><i class="fas fa-trash"></i> Supprimer</button></td>

                                                </tr>
                                            <?php endif; ?>
                                        <?php endforeach ?>
                                    </tbody>

                                </table>
                            </div>
                        <?php endforeach ?>
                    <?php endif; ?>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>

                </div>
            </div>
        </div>
    </div>


</div>




<!-- The blueimp Gallery widget -->
<!--<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-filter=":even">
    <div class="slides"></div>
    <h3 class="title"></h3>
    <a class="prev">‹</a>
    <a class="next">›</a>
    <a class="close">×</a>
    <a class="play-pause"></a>
    <ol class="indicator"></ol>
</div>-->


<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
    {% for (var i=0, file; file=o.files[i]; i++) { %}
    <tr class="template-upload fade show">
    <td>
    <span class="preview"></span>
    </td>
    <td>
    <p class="name">{%=file.name%}</p>
    <strong class="error text-danger"></strong>
    </td>
    <td>
    <p class="size">Chargement...</p>
    <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
    </td>
    <td>
    {% if (!i && !o.options.autoUpload) { %}
    <button class="btn btn-primary start" disabled>
    <i class="glyphicon glyphicon-upload"></i>
    <span>Start</span>
    </button>
    {% } %}
    {% if (!i) { %}
    <button class="btn btn-warning cancel">
    <i class="fas fa-ban"></i>
    <span>Annuler</span>
    </button>
    {% } %}
    </td>
    </tr>
    {% } %}
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
    {% for (var i=0, file; file=o.files[i]; i++) { %}
    {% if (!file.error) { %}
    <tr class="row-file-upload template-download fade show">
    <td>
    <span class="preview">
    {% if (file.thumbnailUrl) { %}
    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
    {% } %}

    </span>
    </td>
    <td>
    <p class="name">
    {% if (file.url) { %}
    <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
    {% } else { %}
    <span>{%=file.name%}</span>
    {% } %}
    </p>
    <?php /* {% if (file.error) { %}
      <div><span class="label label-danger">Error</span> {%=file.error%}</div>
      {% } %} */ ?>
    </td>
    <td>
    <span class="size">{%=o.formatFileSize(file.size)%}</span>
    </td>
    <?php /* <td>
      {% if (file.deleteUrl) { %}
      <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
      <i class="fas fa-trash-alt"></i>
      <span>Supprimer</span>
      </button>
      <!--<input type="checkbox" name="delete" value="1" class="toggle">-->
      {% } else { %}
      <button class="btn btn-warning cancel">
      <i class="glyphicon glyphicon-ban-circle"></i>
      <span>Cancel</span>
      </button>
      {% } %}
      </td> */ ?>
    </tr>
    {% } %}
    {% } %}
</script>

<script>

    $(function () {
        'use strict';

        $('.delete-data-exchange').click(function (event) {
            event.preventDefault();
            Swal.fire({
                title: 'Confirmer la suppression ?',
                text: 'Les données de transactions concernant ' + $(this).data('exchange-name') + ' seront supprimées définitivement.',
                type: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Oui, supprimer !',
                cancelButtonText: 'Annuler'
            }).then((result) => {
                if (result.value) {

                    var form = $(this).parents('form');
                    var url = form.attr('action');

                    $.ajax({
                        type: "POST",
                        url: url,
                        data: form.serialize(),

                        success: function (data)
                        {
                            console.log(data);
                            console.log(data.success);
                            if (data && data.success && data.success.messages.length > 0) {

                                for (var i = 0; i < data.success.messages.length; i++)
                                {
                                    var message = data.success.messages[i];
                                    Swal.fire({
                                        type: 'success',
                                        title: message.header,
                                        text: message.body,
                                        footer: message.footer
                                    }).then(function () {
                        //location.reload();
                    });
                                    console.log(data.exchange);
                                    $('#container-file-' + data.exchange).html('');
                                    $('#container-delete-button-trade-' + data.exchange).hide();
                                }
                            } else {
                                console.log('no success');
                                if ($('#container-file-' + data.exchange).html() === '') {
                                    $('#container-delete-button-trade-' + data.success.exchange).hide();
                                }
                            }
                        }
                    });
                }
            });
        });

        $(document).bind('dragover', function (e) {
            var dropZones = $('.dropzone-file'),
                    timeout = window.dropZoneTimeout;
            if (timeout) {
                clearTimeout(timeout);
            } else {
                dropZones.addClass('in');
            }
            var hoveredDropZone = $(e.target).closest(dropZones);
            dropZones.not(hoveredDropZone).removeClass('hover');
            hoveredDropZone.addClass('hover');
            window.dropZoneTimeout = setTimeout(function () {
                window.dropZoneTimeout = null;
                dropZones.removeClass('in hover');
            }, 100);
        });

        $('.delete-import-exchange').hover(function () {
            $(this).css('cursor', 'pointer');
        }).click(function () {
            console.log($(this).data('id'));
            $.ajax({
                method: "POST",
                //contentType: "application/json",
                url: '<?= $this->basePath() ?>/importation/delete',
                data: {importId: $(this).data('import-id')},
                dataType: 'json',
                timeout: 600000,
                success: function (data) {
//
                    console.log("SUCCESS: ", data.id);
                    console.log("SUCCESS: ", data);
                    if (data && data.success && data.success.messages.length > 0) {
                        for (var i = 0; i < data.success.messages.length; i++)
                        {
                            var message = data.success.messages[i];
                            Swal.fire({
                                type: 'success',
                                title: message.header,
                                text: message.body,
                                footer: message.footer
                            });

                            var selector = $('#row-source-' + data.id).data('exchange');

                            //var exchange = $('#row-source-' + data.id).data('exchange');
                            if (data.id) {
                                $('#row-source-' + data.id).remove();

                            }
                            var selectorCount = 0;

                            $("tr[data-exchange=" + selector + "]").each(function () {
                                selectorCount++;
                            });

                            if (selectorCount === 0) {
                                $('#row-source-container-' + selector).remove();
                            }



                            var containerCount = 0;
                            $(".row-source-container-js").each(function () {
                                containerCount++;
                            });

                            if (containerCount === 0) {
                                $('#row-empty-container').show();
                            } else {
                                $('#row-empty-container').hide();
                            }
                            console.log('#row-source-' + data.id);
                            console.log('selectorCount');
                            console.log(selector);
                            console.log(selectorCount++);


                        }


                    }
                },
                error: function (e) {
                    console.log("ERROR: ", e);
                }
            });
        });

        var containerCount = 0;
        $(".row-source-container-js").each(function () {
            containerCount++;
        });

        if (containerCount === 0) {
            $('#row-empty-container').show();
        } else {
            $('#row-empty-container').hide();
        }

    });


</script>







??

??