Blame view

views/manage/export-process.php 3.05 KB
2f25da09   Yarik   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  <?php
      /**
       * @var View $this
       */
      
      use yii\web\View;
  
  ?>
  <?php
      $this->registerJs("var in_process=true;
      var count=1;
      var filename = null;
      
      doExport(0,filename);
      
      function doExport(from,filename) {
          from = typeof(from) != 'undefined' ? from : 0;
2f25da09   Yarik   first commit
18
19
          $.ajax({
              method: 'get',
25c82e9e   Administrator   full commit
20
              url: '" . Yii::$app->request->baseUrl . '/ecommerce/manage/export-process' . "',
2f25da09   Yarik   first commit
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
              data: {
                  from:from,
                  filename: filename
              },
              dataType: 'json',
              success: function(data){
                  
                  var per = Math.round(100*data.from/data.totalsize)+'%';
                  $('#progressbar div').css({width: per});
                  
                  if(data != false && !data.end)
                  {
                      doExport(data.from,data.filename);
                  }
                  else
                  {
                      console.log(data.link);
                      $(progressbar).hide('fast');
                      $('#result_link').attr('href', data.link).removeClass('hidden');
                      in_process = false;
                  }
              },
              error: function(xhr, status, errorThrown) {
              }
          });
      }");
  ?>
  
  <!--<script>-->
  <!--    var in_process=true;-->
  <!--    var count=1;-->
  <!--    var filename = null;-->
  <!--    -->
  <!--    doExport(0,filename);-->
  <!--    -->
  <!--    function doExport(from,filename) {-->
  <!--        from = typeof(from) != 'undefined' ? from : 0;-->
  <!--        -->
  <!--        $.ajax({-->
  <!--            method: 'get',-->
  <!--            url: '".Yii::$app->request->baseUrl .'/product/manage/export-process'."',-->
  <!--            data: {-->
  <!--                from:from,-->
  <!--                filename: filename-->
  <!--            },-->
  <!--            dataType: 'json',-->
  <!--            success: function(data){-->
  <!--                -->
  <!--                var per = Math.round(100*data.from/data.totalsize)+'%';-->
  <!--                $('#progressbar div').css({width: per});-->
  <!--                -->
  <!--                if(data != false && !data.end)-->
  <!--                {-->
  <!--                    doExport(data.from,data.filename);-->
  <!--                }-->
  <!--                else-->
  <!--                {-->
  <!--                    console.log(data.link);-->
  <!--                    progressbar.hide('fast');-->
  <!--                    in_process = false;-->
  <!--                }-->
  <!--            },-->
  <!--            error: function(xhr, status, errorThrown) {-->
  <!--            }-->
  <!--        });-->
  <!--    }-->
  <!--</script>-->
  
  <div class="product-import-process-form">
      <h1>Экспорт данных товаров</h1>
      
      <?= \yii\jui\ProgressBar::widget([
          'clientOptions' => [
              'value' => 100,
              'label' => '',
          ],
          'options'       => [
              'id' => 'progressbar',
          ],
      ]); ?>
      <ul id="process-result"></ul>
      <a id="result_link" href="" class="hidden"><?php echo \Yii::t('app', 'Get File'); ?></a>
  </div>