Blame view

frontend/views/cabinet/index.php 7.16 KB
3bc9af21   Yarik   Layout
1
2
  <?php
      
30e3d244   Yarik   Forms
3
      /**
71837d74   Yarik   Sales fix
4
5
6
       * @var UserData               $userData
       * @var UserPassport           $userPassport
       * @var yii\web\View           $this
fb0f9630   Alexey Boroda   -Greed ready
7
       * @var IntellectualProperty[] $table
30e3d244   Yarik   Forms
8
       */
3bc9af21   Yarik   Layout
9
      
885e52f4   Yarik   Creative roles
10
      use common\models\User;
30e3d244   Yarik   Forms
11
12
      use frontend\models\UserData;
      use frontend\models\UserPassport;
fb900d40   Alexey Boroda   -First commit
13
      use frontend\models\IntellectualProperty;
3bc9af21   Yarik   Layout
14
      use yii\helpers\Html;
fb900d40   Alexey Boroda   -First commit
15
      use yii\widgets\ActiveForm;
fb0f9630   Alexey Boroda   -Greed ready
16
      use yii\widgets\Pjax;
3bc9af21   Yarik   Layout
17
      
3bc9af21   Yarik   Layout
18
      $this->title = 'My Yii Application';
885e52f4   Yarik   Creative roles
19
20
21
22
      /**
       * @var User $user
       */
      $user = \Yii::$app->user->identity;
3bc9af21   Yarik   Layout
23
  ?>
7f0970a7   Yarik   Layout
24
  <div class="style cab_content_list active-cab">
3bc9af21   Yarik   Layout
25
      <?php
7f0970a7   Yarik   Layout
26
27
28
29
30
31
32
33
          echo $this->render(
              '_personal_form',
              [
                  'userData' => $userData,
              ]
          );
          echo $this->render(
              '_passport_form',
3bc9af21   Yarik   Layout
34
              [
7f0970a7   Yarik   Layout
35
                  'userPassport' => $userPassport,
3bc9af21   Yarik   Layout
36
              ]
7f0970a7   Yarik   Layout
37
          );
3bc9af21   Yarik   Layout
38
      ?>
7f0970a7   Yarik   Layout
39
40
      
      <div class="style table-forms tables-1">
fb900d40   Alexey Boroda   -First commit
41
42
43
44
45
46
47
48
49
50
51
          <div class="title_forms">Список творів</div>
          <div class="btn-submit-blue">
              <?php echo Html::button(
                  'Добавить',
                  [
                      'type'        => 'button',
                      'class'       => 'add-button',
                      'data-toggle' => 'modal',
                      'data-target' => '#add-composition-modal',
                  ]
              ) ?>
3bc9af21   Yarik   Layout
52
          </div>
fb900d40   Alexey Boroda   -First commit
53
          <div class="style table-forms-wrapp">
71837d74   Yarik   Sales fix
54
55
56
57
58
59
60
              <?php
                  Pjax::begin(
                      [
                          'id' => 'int-prop-greed',
                      ]
                  );
              ?>
7f0970a7   Yarik   Layout
61
62
63
64
65
66
              <table class="table-1" cellpadding="0" cellspacing="0" border="0">
                  <tr>
                      <td><br/>п/п</td>
                      <td>Назва</td>
                      <td>Дата реєстрації</td>
                      <td>Жанр</td>
3fd7d43c   Yarik   Creative roles
67
68
                      <td>Роль</td>
                      <td>Процент долі</td>
7f0970a7   Yarik   Layout
69
70
71
                      <td>Нараховано</td>
                      <td>К-ть відтворень</td>
                  </tr>
fb0f9630   Alexey Boroda   -Greed ready
72
73
74
                  <?php
                      $i = 1;
                      foreach ($table as $row) {
71837d74   Yarik   Sales fix
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
                          ?>
                          <tr>
                              <td><?= $i; ?></td>
                              <td>
                                  <?php
                                      echo Html::a($row->title,
                                                   [
                                                       'sales',
                                                       'id' => $row->id,
                                                   ]
                                      );
                                  ?>
                              </td>
                              <td><?= $row->registration_date ?></td>
                              <td><?= $row->genre ?></td>
                              <td>
                                  <?php
                                      if (!empty( $row->creativeRole )) {
                                          echo $row->creativeRole->title;
                                      } elseif ($user->isAdmin()) {
                                          echo '-';
                                      } else {
                                          echo 'У Вас немає ролі в даному ОІВ';
                                      }
                                  ?>
                              </td>
                              <td>
                                  <?php
                                      if (!empty( $row->creativeRole )) {
                                          echo $row->creativeRole->part . '%';
                                      } else {
                                          echo '-';
                                      }
                                  ?>
                              </td>
                              <td>
                                  <?php
                                      if (!empty( $row->creativeRole )) {
                                          $sum = 0;
                                          foreach ($row->reports as $report) {
                                              $sum += $report->sum;
                                          }
                                          echo( $sum * $row->creativeRole->part / 100 );
                                          unset( $sum );
                                      } else {
                                          echo '-';
                                      }
                                  ?>
                              </td>
                              <td>
                                  <?php
                                      $sum = 0;
                                      foreach ($row->reports as $report) {
                                          $sum += $report->count;
                                      }
                                      echo $sum;
                                      unset( $sum );
                                  ?>
                              </td>
                          </tr>
                          <?php
fb0f9630   Alexey Boroda   -Greed ready
136
137
                          $i++;
                      }
71837d74   Yarik   Sales fix
138
                  ?>
7f0970a7   Yarik   Layout
139
              </table>
71837d74   Yarik   Sales fix
140
141
142
              <?php
                  Pjax::end();
              ?>
3bc9af21   Yarik   Layout
143
          </div>
fb900d40   Alexey Boroda   -First commit
144
      </div>
7f0970a7   Yarik   Layout
145
  </div>
fb900d40   Alexey Boroda   -First commit
146
147
  <!-- Modal -->
  <div class="modal fade" id="add-composition-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
71837d74   Yarik   Sales fix
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
      <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" id="myModalLabel">Додати твір</h4>
              </div>
              <?php
                  $form = ActiveForm::begin(
                      [
                          'action' => 'add-int-prop',
                          'id'     => 'add-int-prop-form',
                      ]
                  );
                  $addIntProp = new IntellectualProperty();
              ?>
              <div class="modal-body forms-cabinet forms-2">
                  
                  
                  <?php
                      echo $form->field($addIntProp, 'title');
                  ?>
                  
                  <?php
                      echo $form->field($addIntProp, 'registration_date')
                                ->textInput(
                                    [
                                        'class' => '_datepicker form-control',
                                    ]
                                );
                  ?>
                  
                  <?php
                      echo $form->field($addIntProp, 'genre');
                  ?>
                  
                  <?php
                      echo $form->field($addIntProp, 'author_role');
                  ?>
              
              </div>
              <div class="modal-footer btn-submit-blue">
                  <?php
                      echo Html::submitButton(
                          'OK'
                      );
                  ?>
              </div>
              <?php
                  $form::end();
              ?>
          </div>
fb900d40   Alexey Boroda   -First commit
200
      </div>
fb900d40   Alexey Boroda   -First commit
201
  </div>