Blame view

frontend/views/cabinet/users.php 5.95 KB
caf85dfb   Yarik   Html
1
  <?php
3ebbbaa9   Alexey Boroda   -Reports
2
      use common\models\User;
3533e4e9   Yarik   Forms
3
      use frontend\models\IntellectualProperty;
cab22f38   Yarik   Users
4
5
      use frontend\models\Report;
      use yii\helpers\Html;
ba83c2b3   Alexey Boroda   -1 fix
6
      use yii\helpers\VarDumper;
caf85dfb   Yarik   Html
7
      use yii\web\View;
cab22f38   Yarik   Users
8
      use yii\widgets\ActiveForm;
3533e4e9   Yarik   Forms
9
      use yii\widgets\Pjax;
caf85dfb   Yarik   Html
10
11
      
      /**
3533e4e9   Yarik   Forms
12
13
       * @var View     $this
       * @var Report[] $reports
3ebbbaa9   Alexey Boroda   -Reports
14
       * @var User $user
caf85dfb   Yarik   Html
15
       */
3ebbbaa9   Alexey Boroda   -Reports
16
17
      
      $user = \Yii::$app->user->identity;
caf85dfb   Yarik   Html
18
19
20
21
22
  ?>
  <div class="style cab_content_list">
      <div class="cab_content_list-dropdown">
          <div class="style table-forms tables-1">
              <div class="title_forms">Звіт про загальну суму винагороди (у розрізі користувачів)</div>
cab22f38   Yarik   Users
23
              <div class="btn-submit-blue">
3ebbbaa9   Alexey Boroda   -Reports
24
                  <?php if ($user->isAdmin()) echo Html::button(
cab22f38   Yarik   Users
25
26
27
28
29
30
31
32
33
                      'Добавить',
                      [
                          'type'        => 'button',
                          'class'       => 'add-button',
                          'data-toggle' => 'modal',
                          'data-target' => '#add-user-report',
                      ]
                  ) ?>
              </div>
3533e4e9   Yarik   Forms
34
35
36
37
38
39
40
41
42
43
44
45
46
47
              <?php
                  Pjax::begin(
                      [
                          'id'      => 'users-table',
                          'options' => [
                              'class' => 'style table-forms-wrapp',
                          ],
                      ]
                  );
              ?>
              <table class="table-1" cellpadding="0" cellspacing="0" border="0">
                  <tr>
                      <td><br/>п/п</td>
                      <td>Користувач</td>
3533e4e9   Yarik   Forms
48
49
50
                      <td>Твір</td>
                      <td>Кількість сповіщень</td>
                      <td>Перерахована сума</td>
7e633825   Alexey Boroda   -Added columns
51
52
53
54
                      <td>Комісія агенства</td>
                      <td>Нараховано автору</td>
                      <td>Податки</td>
                      <td>Сума до виплати</td>
3533e4e9   Yarik   Forms
55
56
                  </tr>
                  <?php
d12a1030   Alexey Boroda   -Total
57
                    $total = 0;
3533e4e9   Yarik   Forms
58
                      foreach ($reports as $index => $report) {
7af4d34d   Alexey Boroda   -Kind of ready
59
60
61
                        if ($user->isAdmin()) {
                          $sum = $report->sum;
                        } else {
ba83c2b3   Alexey Boroda   -1 fix
62
                          $sum = $report->sum * $report->intellectualProperty->creativeRole->part / 100;
7af4d34d   Alexey Boroda   -Kind of ready
63
                        }
49c0abe3   Alexey Boroda   -Total recount
64
                        $total += $sum*0.8*0.805;
3533e4e9   Yarik   Forms
65
66
67
68
69
                          ?>
                          <tr>
                              <?php
                                  echo Html::tag('td', ++$index);
                                  echo Html::tag('td', $report->user);
3533e4e9   Yarik   Forms
70
71
                                  echo Html::tag('td', $report->intellectualProperty->title);
                                  echo Html::tag('td', $report->count);
7af4d34d   Alexey Boroda   -Kind of ready
72
73
74
75
76
                                  echo Html::tag('td', $sum);
                                  echo Html::tag('td', $sum*0.2);
                                  echo Html::tag('td', $sum*0.8);
                                  echo Html::tag('td', $sum*0.8*0.195);
                                  echo Html::tag('td', $sum*0.8*0.805);
3533e4e9   Yarik   Forms
77
78
79
80
81
                              ?>
                          </tr>
                          <?php
                      }
                  ?>
d12a1030   Alexey Boroda   -Total
82
83
84
85
86
87
88
89
                <tr>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
                  <td></td>
49c0abe3   Alexey Boroda   -Total recount
90
                  <td>Сумма: </td>
d12a1030   Alexey Boroda   -Total
91
92
                  <td><?=$total?></td>
                </tr>
3533e4e9   Yarik   Forms
93
94
95
96
              </table>
              <?php
                  Pjax::end();
              ?>
caf85dfb   Yarik   Html
97
98
99
          </div>
      </div>
  </div>
cab22f38   Yarik   Users
100
101
102
103
104
105
106
107
108
109
110
111
  <!-- Modal -->
  <div class="modal fade" id="add-user-report" tabindex="-1" role="dialog">
      <div class="modal-dialog" role="document">
          <div class="modal-content">
              <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                      <span aria-hidden="true">&times;</span></button>
                  <h4 class="modal-title">Додати звіт</h4>
              </div>
              <?php
                  $form = ActiveForm::begin(
                      [
3533e4e9   Yarik   Forms
112
                          'action' => [ '/cabinet/users-add' ],
cab22f38   Yarik   Users
113
114
115
116
117
118
119
                          'id'     => 'users-add-form',
                      ]
                  );
                  $report = new Report();
              ?>
              <div class="modal-body forms-cabinet forms-2">
                  <?php
3533e4e9   Yarik   Forms
120
121
                      echo $form->field($report, 'user')
                                ->textInput();
3ebbbaa9   Alexey Boroda   -Reports
122
  //                    echo $form->field($report, 'artist');
3533e4e9   Yarik   Forms
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
                      echo $form->field($report, 'intellectual_property_id')
                                ->dropDownList(
                                    IntellectualProperty::find()
                                                        ->asArray()
                                                        ->select(
                                                            [
                                                                'title',
                                                                'id',
                                                            ]
                                                        )
                                                        ->indexBy('id')
                                                        ->column()
                                );
                      echo $form->field($report, 'count')
                                ->textInput();
                      echo $form->field($report, 'sum')
                                ->textInput();
cab22f38   Yarik   Users
140
141
                  ?>
              </div>
3533e4e9   Yarik   Forms
142
              <div class="clearfix"></div>
cab22f38   Yarik   Users
143
144
145
146
147
148
149
150
151
152
153
154
155
              <div class="modal-footer btn-submit-blue">
                  <?php
                      echo Html::submitButton(
                          'OK'
                      );
                  ?>
              </div>
              <?php
                  $form::end();
              ?>
          </div>
      </div>
  </div>