Commit 3fd7d43c254deb8a82d433e0e79ace6057aa3283
1 parent
0687eb9b
Creative roles
Showing
5 changed files
with
308 additions
and
250 deletions
Show diff stats
common/models/User.php
| @@ -226,7 +226,7 @@ | @@ -226,7 +226,7 @@ | ||
| 226 | { | 226 | { |
| 227 | return $this->hasOne(UserPassport::className(), [ 'user_id' => 'id' ]); | 227 | return $this->hasOne(UserPassport::className(), [ 'user_id' => 'id' ]); |
| 228 | } | 228 | } |
| 229 | - | 229 | + |
| 230 | /** | 230 | /** |
| 231 | * @return bool | 231 | * @return bool |
| 232 | * @todo change this | 232 | * @todo change this |
| @@ -239,4 +239,18 @@ | @@ -239,4 +239,18 @@ | ||
| 239 | return false; | 239 | return false; |
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| 242 | + | ||
| 243 | + public function afterSave($insert, $changedAttributes) | ||
| 244 | + { | ||
| 245 | + if ($insert) { | ||
| 246 | + ( new UserData( | ||
| 247 | + [ | ||
| 248 | + 'user_id' => $this->id, | ||
| 249 | + 'name' => $this->username, | ||
| 250 | + ] | ||
| 251 | + ) )->save(false); | ||
| 252 | + ( new UserPassport([ 'user_id' => $this->id ]) )->save(false); | ||
| 253 | + } | ||
| 254 | + parent::afterSave($insert, $changedAttributes); | ||
| 255 | + } | ||
| 242 | } | 256 | } |
frontend/controllers/CabinetController.php
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | public function behaviors() | 26 | public function behaviors() |
| 27 | { | 27 | { |
| 28 | return [ | 28 | return [ |
| 29 | - 'verbs' => [ | 29 | + 'verbs' => [ |
| 30 | 'class' => VerbFilter::className(), | 30 | 'class' => VerbFilter::className(), |
| 31 | 'actions' => [ | 31 | 'actions' => [ |
| 32 | 'personal' => [ 'post' ], | 32 | 'personal' => [ 'post' ], |
| @@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
| 38 | 'rules' => [ | 38 | 'rules' => [ |
| 39 | [ | 39 | [ |
| 40 | 'allow' => true, | 40 | 'allow' => true, |
| 41 | - 'roles' => ['@'], | 41 | + 'roles' => [ '@' ], |
| 42 | ], | 42 | ], |
| 43 | ], | 43 | ], |
| 44 | ], | 44 | ], |
| @@ -63,13 +63,13 @@ | @@ -63,13 +63,13 @@ | ||
| 63 | $userPassport = new UserPassport(); | 63 | $userPassport = new UserPassport(); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | - $table = IntellectualProperty::find() | ||
| 67 | -// ->where( | ||
| 68 | -// [ | ||
| 69 | -// 'user_id' => \Yii::$app->user->identity->id, | ||
| 70 | -// ] | ||
| 71 | -// ) | ||
| 72 | - ->all(); | 66 | + $tableQuery = IntellectualProperty::find(); |
| 67 | + if (!$user->isAdmin()) { | ||
| 68 | + $tableQuery->joinWith('creativeRoles') | ||
| 69 | + ->where([ 'intellectual_property.user_id' => $user->id ]) | ||
| 70 | + ->orWhere([ 'creative_role.user_id' => $user->id ]); | ||
| 71 | + } | ||
| 72 | + $table = $tableQuery->all(); | ||
| 73 | 73 | ||
| 74 | return $this->render( | 74 | return $this->render( |
| 75 | 'index', | 75 | 'index', |
| @@ -127,12 +127,11 @@ | @@ -127,12 +127,11 @@ | ||
| 127 | 127 | ||
| 128 | public function actionList() | 128 | public function actionList() |
| 129 | { | 129 | { |
| 130 | - $table = IntellectualProperty::find() | ||
| 131 | -// ->where( | ||
| 132 | -// [ | ||
| 133 | -// 'user_id' => \Yii::$app->user->identity->id, | ||
| 134 | -// ] | ||
| 135 | -// ) | 130 | + $table = IntellectualProperty::find()// ->where( |
| 131 | + // [ | ||
| 132 | + // 'user_id' => \Yii::$app->user->identity->id, | ||
| 133 | + // ] | ||
| 134 | + // ) | ||
| 136 | ->all(); | 135 | ->all(); |
| 137 | return $this->render( | 136 | return $this->render( |
| 138 | 'list', | 137 | 'list', |
| @@ -157,10 +156,14 @@ | @@ -157,10 +156,14 @@ | ||
| 157 | 156 | ||
| 158 | public function actionNotifications() | 157 | public function actionNotifications() |
| 159 | { | 158 | { |
| 160 | - $table = Report::find()->all(); | ||
| 161 | - return $this->render('notifications', [ | ||
| 162 | - 'table' => $table, | ||
| 163 | - ]); | 159 | + $table = Report::find() |
| 160 | + ->all(); | ||
| 161 | + return $this->render( | ||
| 162 | + 'notifications', | ||
| 163 | + [ | ||
| 164 | + 'table' => $table, | ||
| 165 | + ] | ||
| 166 | + ); | ||
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | public function actionUsers() | 169 | public function actionUsers() |
| @@ -320,15 +323,15 @@ | @@ -320,15 +323,15 @@ | ||
| 320 | ]; | 323 | ]; |
| 321 | } | 324 | } |
| 322 | } | 325 | } |
| 323 | - | 326 | + |
| 324 | public function actionUpdateRole() | 327 | public function actionUpdateRole() |
| 325 | { | 328 | { |
| 326 | $request = \Yii::$app->request; | 329 | $request = \Yii::$app->request; |
| 327 | $response = \Yii::$app->response; | 330 | $response = \Yii::$app->response; |
| 328 | $response->format = $response::FORMAT_JSON; | 331 | $response->format = $response::FORMAT_JSON; |
| 329 | - | 332 | + |
| 330 | $role = CreativeRole::findOne($request->get('id')); | 333 | $role = CreativeRole::findOne($request->get('id')); |
| 331 | - | 334 | + |
| 332 | if ($role->load($request->post()) && $role->save()) { | 335 | if ($role->load($request->post()) && $role->save()) { |
| 333 | return [ | 336 | return [ |
| 334 | 'success' => true, | 337 | 'success' => true, |
| @@ -341,17 +344,17 @@ | @@ -341,17 +344,17 @@ | ||
| 341 | ]; | 344 | ]; |
| 342 | } | 345 | } |
| 343 | } | 346 | } |
| 344 | - | 347 | + |
| 345 | public function actionGetRoleForm() | 348 | public function actionGetRoleForm() |
| 346 | { | 349 | { |
| 347 | $request = \Yii::$app->request; | 350 | $request = \Yii::$app->request; |
| 348 | $response = \Yii::$app->response; | 351 | $response = \Yii::$app->response; |
| 349 | $response->format = $response::FORMAT_JSON; | 352 | $response->format = $response::FORMAT_JSON; |
| 350 | - | 353 | + |
| 351 | $model = CreativeRole::findOne($request->post('id')); | 354 | $model = CreativeRole::findOne($request->post('id')); |
| 352 | 355 | ||
| 353 | return [ | 356 | return [ |
| 354 | - 'answer' => $this->renderPartial('_update_form', ['model' => $model]) | 357 | + 'answer' => $this->renderPartial('_update_form', [ 'model' => $model ]), |
| 355 | ]; | 358 | ]; |
| 356 | } | 359 | } |
| 357 | 360 |
frontend/models/CreativeRole.php
frontend/views/cabinet/index.php
| @@ -57,8 +57,8 @@ | @@ -57,8 +57,8 @@ | ||
| 57 | <td>ะะฐะทะฒะฐ</td> | 57 | <td>ะะฐะทะฒะฐ</td> |
| 58 | <td>ะะฐัะฐ ัะตััััะฐััั</td> | 58 | <td>ะะฐัะฐ ัะตััััะฐััั</td> |
| 59 | <td>ะะฐะฝั</td> | 59 | <td>ะะฐะฝั</td> |
| 60 | - <td>ะ ะพะปั ะฐะฒัะพัะฐ</td> | ||
| 61 | - <td>ะัะพัะตะฝั ะดะพะปั ะฐะฒัะพัะฐ</td> | 60 | + <td>ะ ะพะปั</td> |
| 61 | + <td>ะัะพัะตะฝั ะดะพะปั</td> | ||
| 62 | <td>ะะฐัะฐั ะพะฒะฐะฝะพ</td> | 62 | <td>ะะฐัะฐั ะพะฒะฐะฝะพ</td> |
| 63 | <td>ะ-ัั ะฒัะดัะฒะพัะตะฝั</td> | 63 | <td>ะ-ัั ะฒัะดัะฒะพัะตะฝั</td> |
| 64 | </tr> | 64 | </tr> |
frontend/views/cabinet/sales.php
| 1 | <?php | 1 | <?php |
| 2 | + use common\models\User; | ||
| 2 | use frontend\models\CreativeRole; | 3 | use frontend\models\CreativeRole; |
| 3 | use frontend\models\IntellectualProperty; | 4 | use frontend\models\IntellectualProperty; |
| 5 | + use yii\helpers\ArrayHelper; | ||
| 4 | use yii\helpers\Html; | 6 | use yii\helpers\Html; |
| 5 | use yii\web\View; | 7 | use yii\web\View; |
| 6 | use yii\widgets\ActiveForm; | 8 | use yii\widgets\ActiveForm; |
| @@ -9,98 +11,53 @@ | @@ -9,98 +11,53 @@ | ||
| 9 | /** | 11 | /** |
| 10 | * @var View $this | 12 | * @var View $this |
| 11 | * @var IntellectualProperty $property | 13 | * @var IntellectualProperty $property |
| 12 | - * @var CreativeRole[] $table | 14 | + * @var CreativeRole[] $table |
| 13 | */ | 15 | */ |
| 14 | ?> | 16 | ?> |
| 15 | -<div class="style cab_content_list"> | ||
| 16 | - <div class="cab_content_list-dropdown"> | ||
| 17 | - <?php | ||
| 18 | - Pjax::begin( | ||
| 19 | - [ | ||
| 20 | - 'options' => [ | ||
| 21 | - 'class' => 'pjax_container forms-cabinet forms-3', | ||
| 22 | - ], | ||
| 23 | - ] | ||
| 24 | - ); | ||
| 25 | - ?> | ||
| 26 | - <div class="title_forms">ะัะพะดะฐะถ ะะะ</div> | ||
| 27 | - <?php | ||
| 28 | - $form = ActiveForm::begin( | ||
| 29 | - [ | ||
| 30 | - 'id' => 'property-form', | ||
| 31 | - 'action' => \Yii::$app->request->url, | ||
| 32 | - ] | ||
| 33 | - ); | ||
| 34 | - ?> | ||
| 35 | - <div class="style background_form"> | 17 | + <div class="style cab_content_list"> |
| 18 | + <div class="cab_content_list-dropdown"> | ||
| 36 | <?php | 19 | <?php |
| 37 | - echo $form->field( | ||
| 38 | - $property, | ||
| 39 | - 'title', | 20 | + Pjax::begin( |
| 40 | [ | 21 | [ |
| 41 | 'options' => [ | 22 | 'options' => [ |
| 42 | - 'class' => 'input-wrapp-757', | ||
| 43 | - 'style' => 'margin-right: 40px;', | 23 | + 'class' => 'pjax_container forms-cabinet forms-3', |
| 44 | ], | 24 | ], |
| 45 | ] | 25 | ] |
| 46 | - ) | ||
| 47 | - ->textarea( | ||
| 48 | - [ | ||
| 49 | - 'cols' => 30, | ||
| 50 | - 'rows' => 10, | ||
| 51 | - ] | ||
| 52 | - ); | ||
| 53 | - echo $form->field( | ||
| 54 | - $property, | ||
| 55 | - 'creation_date', | 26 | + ); |
| 27 | + ?> | ||
| 28 | + <div class="title_forms">ะัะพะดะฐะถ ะะะ</div> | ||
| 29 | + <?php | ||
| 30 | + $form = ActiveForm::begin( | ||
| 56 | [ | 31 | [ |
| 57 | - 'options' => [ | ||
| 58 | - 'class' => 'input-wrapp-130', | ||
| 59 | - ], | 32 | + 'id' => 'property-form', |
| 33 | + 'action' => \Yii::$app->request->url, | ||
| 60 | ] | 34 | ] |
| 61 | - ) | ||
| 62 | - ->textInput( | ||
| 63 | - [ | ||
| 64 | - 'class' => '_datepicer', | ||
| 65 | - ] | ||
| 66 | - ); | 35 | + ); |
| 67 | ?> | 36 | ?> |
| 68 | - <div class="style"> | 37 | + <div class="style background_form"> |
| 69 | <?php | 38 | <?php |
| 70 | echo $form->field( | 39 | echo $form->field( |
| 71 | $property, | 40 | $property, |
| 72 | - 'code', | 41 | + 'title', |
| 73 | [ | 42 | [ |
| 74 | 'options' => [ | 43 | 'options' => [ |
| 75 | - 'class' => 'input-wrapp-320', | ||
| 76 | - ], | ||
| 77 | - ] | ||
| 78 | - ) | ||
| 79 | - ->textInput(); | ||
| 80 | - ?> | ||
| 81 | - </div> | ||
| 82 | - <div class="style"> | ||
| 83 | - <?php | ||
| 84 | - echo $form->field( | ||
| 85 | - $property, | ||
| 86 | - 'genre', | ||
| 87 | - [ | ||
| 88 | - 'options' => [ | ||
| 89 | - 'class' => 'input-wrapp-320', | 44 | + 'class' => 'input-wrapp-757', |
| 45 | + 'style' => 'margin-right: 40px;', | ||
| 90 | ], | 46 | ], |
| 91 | ] | 47 | ] |
| 92 | ) | 48 | ) |
| 93 | - ->textInput(); | ||
| 94 | - ?> | ||
| 95 | - </div> | ||
| 96 | - <div class="style"> | ||
| 97 | - <?php | 49 | + ->textarea( |
| 50 | + [ | ||
| 51 | + 'cols' => 30, | ||
| 52 | + 'rows' => 10, | ||
| 53 | + ] | ||
| 54 | + ); | ||
| 98 | echo $form->field( | 55 | echo $form->field( |
| 99 | $property, | 56 | $property, |
| 100 | - 'registration_date', | 57 | + 'creation_date', |
| 101 | [ | 58 | [ |
| 102 | 'options' => [ | 59 | 'options' => [ |
| 103 | - 'class' => 'input-wrapp-320', | 60 | + 'class' => 'input-wrapp-130', |
| 104 | ], | 61 | ], |
| 105 | ] | 62 | ] |
| 106 | ) | 63 | ) |
| @@ -110,166 +67,246 @@ | @@ -110,166 +67,246 @@ | ||
| 110 | ] | 67 | ] |
| 111 | ); | 68 | ); |
| 112 | ?> | 69 | ?> |
| 70 | + <div class="style"> | ||
| 71 | + <?php | ||
| 72 | + echo $form->field( | ||
| 73 | + $property, | ||
| 74 | + 'code', | ||
| 75 | + [ | ||
| 76 | + 'options' => [ | ||
| 77 | + 'class' => 'input-wrapp-320', | ||
| 78 | + ], | ||
| 79 | + ] | ||
| 80 | + ) | ||
| 81 | + ->textInput(); | ||
| 82 | + ?> | ||
| 83 | + </div> | ||
| 84 | + <div class="style"> | ||
| 85 | + <?php | ||
| 86 | + echo $form->field( | ||
| 87 | + $property, | ||
| 88 | + 'genre', | ||
| 89 | + [ | ||
| 90 | + 'options' => [ | ||
| 91 | + 'class' => 'input-wrapp-320', | ||
| 92 | + ], | ||
| 93 | + ] | ||
| 94 | + ) | ||
| 95 | + ->textInput(); | ||
| 96 | + ?> | ||
| 97 | + </div> | ||
| 98 | + <div class="style"> | ||
| 99 | + <?php | ||
| 100 | + echo $form->field( | ||
| 101 | + $property, | ||
| 102 | + 'registration_date', | ||
| 103 | + [ | ||
| 104 | + 'options' => [ | ||
| 105 | + 'class' => 'input-wrapp-320', | ||
| 106 | + ], | ||
| 107 | + ] | ||
| 108 | + ) | ||
| 109 | + ->textInput( | ||
| 110 | + [ | ||
| 111 | + 'class' => '_datepicer', | ||
| 112 | + ] | ||
| 113 | + ); | ||
| 114 | + ?> | ||
| 115 | + </div> | ||
| 116 | + <div class="style"> | ||
| 117 | + <?php | ||
| 118 | + echo $form->field( | ||
| 119 | + $property, | ||
| 120 | + 'contract', | ||
| 121 | + [ | ||
| 122 | + 'options' => [ | ||
| 123 | + 'class' => 'input-wrapp-320', | ||
| 124 | + 'style' => 'margin-right: 40px;', | ||
| 125 | + ], | ||
| 126 | + ] | ||
| 127 | + ) | ||
| 128 | + ->textInput(); | ||
| 129 | + echo $form->field( | ||
| 130 | + $property, | ||
| 131 | + 'type', | ||
| 132 | + [ | ||
| 133 | + 'options' => [ | ||
| 134 | + 'class' => 'input-wrapp-320', | ||
| 135 | + ], | ||
| 136 | + ] | ||
| 137 | + ) | ||
| 138 | + ->textInput(); | ||
| 139 | + ?> | ||
| 140 | + </div> | ||
| 141 | + | ||
| 113 | </div> | 142 | </div> |
| 114 | - <div class="style"> | 143 | + |
| 144 | + <?php | ||
| 145 | + if (!$property->isNewRecord) { | ||
| 146 | + ?> | ||
| 147 | + <div class="btn-submit-blue"> | ||
| 148 | + <?php echo Html::button( | ||
| 149 | + 'ะะพะดะฐัะธ', | ||
| 150 | + [ | ||
| 151 | + 'type' => 'button', | ||
| 152 | + 'class' => 'add-role-button', | ||
| 153 | + 'data-toggle' => 'modal', | ||
| 154 | + 'data-target' => '#add-role-modal', | ||
| 155 | + ] | ||
| 156 | + ) ?> | ||
| 157 | + </div> | ||
| 158 | + | ||
| 159 | + <div class="style wrapp-tabs-table"> | ||
| 160 | + <div class="style table-wrapp-2"> | ||
| 161 | + <div class="hidden-tables-oiv active-tab-oiv"> | ||
| 162 | + <?php | ||
| 163 | + Pjax::begin( | ||
| 164 | + [ | ||
| 165 | + 'id' => 'roles-table', | ||
| 166 | + ] | ||
| 167 | + ); | ||
| 168 | + ?> | ||
| 169 | + <table class="table-1 table-2" cellpadding="0" cellspacing="0" border="0"> | ||
| 170 | + <tr> | ||
| 171 | + <td>ะขะฒะพััะฐ ัะพะปั</td> | ||
| 172 | + <td>ะะะ</td> | ||
| 173 | + <td>ะะพะปั %</td> | ||
| 174 | + <td>ะะพะด</td> | ||
| 175 | + <td>IPI</td> | ||
| 176 | + <td>ะขะพะฒะฐัะธััะฒะพ</td> | ||
| 177 | + <td class="refactor-td"></td> | ||
| 178 | + </tr> | ||
| 179 | + <?php | ||
| 180 | + foreach ($table as $row) { | ||
| 181 | + ?> | ||
| 182 | + <tr> | ||
| 183 | + <td><?= $row->title ?></td> | ||
| 184 | + <td></td> | ||
| 185 | + <td><?= $row->part ?></td> | ||
| 186 | + <td><?= $row->code ?></td> | ||
| 187 | + <td><?= $row->iri ?></td> | ||
| 188 | + <td><?= $row->society ?></td> | ||
| 189 | + <td> | ||
| 190 | + <a href="#" class="edit-table update-role" data-id="<?= $row->id ?>"></a><a href="#" class="remove-table delete-role" data-id="<?= $row->id ?>"></a> | ||
| 191 | + </td> | ||
| 192 | + </tr> | ||
| 193 | + <?php | ||
| 194 | + } | ||
| 195 | + ?> | ||
| 196 | + </table> | ||
| 197 | + <?php | ||
| 198 | + Pjax::end(); | ||
| 199 | + ?> | ||
| 200 | + </div> | ||
| 201 | + </div> | ||
| 202 | + </div> | ||
| 203 | + <?php | ||
| 204 | + } | ||
| 205 | + ?> | ||
| 206 | + | ||
| 207 | + <div class="input-wrapp btn-submit-blue"> | ||
| 115 | <?php | 208 | <?php |
| 116 | - echo $form->field( | ||
| 117 | - $property, | ||
| 118 | - 'contract', | ||
| 119 | - [ | ||
| 120 | - 'options' => [ | ||
| 121 | - 'class' => 'input-wrapp-320', | ||
| 122 | - 'style' => 'margin-right: 40px;', | ||
| 123 | - ], | ||
| 124 | - ] | ||
| 125 | - ) | ||
| 126 | - ->textInput(); | ||
| 127 | - echo $form->field( | ||
| 128 | - $property, | ||
| 129 | - 'type', | ||
| 130 | - [ | ||
| 131 | - 'options' => [ | ||
| 132 | - 'class' => 'input-wrapp-320', | ||
| 133 | - ], | ||
| 134 | - ] | ||
| 135 | - ) | ||
| 136 | - ->textInput(); | 209 | + echo Html::submitButton('ะทะฑะตัะตะณัะธ'); |
| 137 | ?> | 210 | ?> |
| 138 | </div> | 211 | </div> |
| 139 | - | ||
| 140 | - </div> | ||
| 141 | - | ||
| 142 | - <div class="btn-submit-blue"> | ||
| 143 | - <?php echo Html::button( | ||
| 144 | - 'ะะพะดะฐัะธ', | ||
| 145 | - [ | ||
| 146 | - 'type' => 'button', | ||
| 147 | - 'class' => 'add-role-button', | ||
| 148 | - 'data-toggle' => 'modal', | ||
| 149 | - 'data-target' => '#add-role-modal', | ||
| 150 | - ] | ||
| 151 | - ) ?> | ||
| 152 | - </div> | ||
| 153 | - | ||
| 154 | - <div class="style wrapp-tabs-table"> | ||
| 155 | - <div class="style table-wrapp-2"> | ||
| 156 | - <div class="hidden-tables-oiv active-tab-oiv"> | ||
| 157 | - <?php | ||
| 158 | - Pjax::begin([ | ||
| 159 | - 'id' => 'roles-table', | ||
| 160 | - ]); | ||
| 161 | - ?> | ||
| 162 | - <table class="table-1 table-2" cellpadding="0" cellspacing="0" border="0"> | ||
| 163 | - <tr> | ||
| 164 | - <td>ะขะฒะพััะฐ ัะพะปั</td> | ||
| 165 | - <td>ะะะ</td> | ||
| 166 | - <td>ะะพะปั %</td> | ||
| 167 | - <td>ะะพะด</td> | ||
| 168 | - <td>IPI</td> | ||
| 169 | - <td>ะขะพะฒะฐัะธััะฒะพ</td> | ||
| 170 | - <td class="refactor-td"></td> | ||
| 171 | - </tr> | ||
| 172 | - <?php | ||
| 173 | - foreach ($table as $row) { | ||
| 174 | - ?> | ||
| 175 | - <tr> | ||
| 176 | - <td><?= $row->title ?></td> | ||
| 177 | - <td></td> | ||
| 178 | - <td><?= $row->part ?></td> | ||
| 179 | - <td><?= $row->code ?></td> | ||
| 180 | - <td><?= $row->iri ?></td> | ||
| 181 | - <td><?= $row->society ?></td> | ||
| 182 | - <td><a href="#" class="edit-table update-role" data-id="<?=$row->id?>"></a><a href="#" class="remove-table delete-role" data-id="<?=$row->id?>"></a> | ||
| 183 | - </td> | ||
| 184 | - </tr> | ||
| 185 | - <?php | ||
| 186 | - } | ||
| 187 | - ?> | ||
| 188 | - </table> | ||
| 189 | - <?php | ||
| 190 | - Pjax::end(); | ||
| 191 | - ?> | ||
| 192 | - </div> | ||
| 193 | - </div> | ||
| 194 | - </div> | ||
| 195 | - | ||
| 196 | - <div class="input-wrapp btn-submit-blue"> | ||
| 197 | <?php | 212 | <?php |
| 198 | - echo Html::submitButton('ะทะฑะตัะตะณัะธ'); | 213 | + $form::end(); |
| 214 | + Pjax::end(); | ||
| 199 | ?> | 215 | ?> |
| 200 | </div> | 216 | </div> |
| 201 | - <?php | ||
| 202 | - $form::end(); | ||
| 203 | - Pjax::end(); | ||
| 204 | - ?> | ||
| 205 | </div> | 217 | </div> |
| 206 | -</div> | ||
| 207 | - | ||
| 208 | -<!-- Modal --> | ||
| 209 | -<div class="modal fade" id="add-role-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
| 210 | - <div class="modal-dialog" role="document"> | ||
| 211 | - <div class="modal-content"> | ||
| 212 | - <div class="modal-header"> | ||
| 213 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
| 214 | - <span aria-hidden="true">×</span></button> | ||
| 215 | - <h4 class="modal-title" id="myModalLabel">ะะพะดะฐัะธ ัะพะปั</h4> | ||
| 216 | - </div> | ||
| 217 | - <?php | ||
| 218 | - $form = ActiveForm::begin( | ||
| 219 | - [ | ||
| 220 | - 'action' => 'add-role', | ||
| 221 | - 'id' => 'add-role-form', | ||
| 222 | - ] | ||
| 223 | - ); | ||
| 224 | - $addRole = new CreativeRole(); | 218 | +<?php |
| 219 | + if (!$property->isNewRecord) { | ||
| 225 | ?> | 220 | ?> |
| 226 | - <div class="modal-body forms-cabinet forms-2"> | ||
| 227 | - | ||
| 228 | - | ||
| 229 | - | ||
| 230 | - <?php | ||
| 231 | - echo $form->field($addRole, 'title'); | ||
| 232 | - ?> | ||
| 233 | - | ||
| 234 | - <?php | ||
| 235 | - echo $form->field($addRole, 'part'); | ||
| 236 | - ?> | ||
| 237 | - | ||
| 238 | - <?php | ||
| 239 | - echo $form->field($addRole, 'code'); | ||
| 240 | - ?> | ||
| 241 | - | ||
| 242 | - <?php | ||
| 243 | - echo $form->field($addRole, 'iri'); | ||
| 244 | - ?> | ||
| 245 | - | ||
| 246 | - <?php | ||
| 247 | - echo $form->field($addRole, 'society'); | ||
| 248 | - ?> | 221 | + <!-- Modal --> |
| 222 | + <div class="modal fade" id="add-role-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
| 223 | + <div class="modal-dialog" role="document"> | ||
| 224 | + <div class="modal-content"> | ||
| 225 | + <div class="modal-header"> | ||
| 226 | + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
| 227 | + <span aria-hidden="true">×</span></button> | ||
| 228 | + <h4 class="modal-title" id="myModalLabel">ะะพะดะฐัะธ ัะพะปั</h4> | ||
| 229 | + </div> | ||
| 230 | + <?php | ||
| 231 | + $form = ActiveForm::begin( | ||
| 232 | + [ | ||
| 233 | + 'action' => 'add-role', | ||
| 234 | + 'id' => 'add-role-form', | ||
| 235 | + ] | ||
| 236 | + ); | ||
| 237 | + $addRole = new CreativeRole(); | ||
| 238 | + ?> | ||
| 239 | + <div class="modal-body forms-cabinet forms-2"> | ||
| 240 | + | ||
| 241 | + | ||
| 242 | + <?php | ||
| 243 | + echo $form->field($addRole, 'title'); | ||
| 244 | + ?> | ||
| 245 | + | ||
| 246 | + <?php | ||
| 247 | + echo $form->field($addRole, 'user_id') | ||
| 248 | + ->dropDownList( | ||
| 249 | + ArrayHelper::getColumn( | ||
| 250 | + User::find() | ||
| 251 | + ->joinWith('userData') | ||
| 252 | + ->indexBy('id') | ||
| 253 | + ->all(), | ||
| 254 | + function ($element) { | ||
| 255 | + /** | ||
| 256 | + * @var User $element | ||
| 257 | + */ | ||
| 258 | + return $element->userData->name . ' ' . $element->userData->surname; | ||
| 259 | + } | ||
| 260 | + ) | ||
| 261 | + ); | ||
| 262 | + ?> | ||
| 263 | + | ||
| 264 | + <?php | ||
| 265 | + echo $form->field($addRole, 'part'); | ||
| 266 | + ?> | ||
| 267 | + | ||
| 268 | + <?php | ||
| 269 | + echo $form->field($addRole, 'code'); | ||
| 270 | + ?> | ||
| 271 | + | ||
| 272 | + <?php | ||
| 273 | + echo $form->field($addRole, 'iri'); | ||
| 274 | + ?> | ||
| 275 | + | ||
| 276 | + <?php | ||
| 277 | + echo $form->field($addRole, 'society'); | ||
| 278 | + ?> | ||
| 279 | + | ||
| 280 | + <?php | ||
| 281 | + echo $form->field($addRole, 'intellectual_property_id') | ||
| 282 | + ->hiddenInput( | ||
| 283 | + [ | ||
| 284 | + 'value' => $property->id, | ||
| 285 | + ] | ||
| 286 | + ) | ||
| 287 | + ->label(false); | ||
| 288 | + ?> | ||
| 289 | + | ||
| 290 | + </div> | ||
| 291 | + <div class="modal-footer btn-submit-blue"> | ||
| 292 | + <?php | ||
| 293 | + echo Html::submitButton( | ||
| 294 | + 'OK' | ||
| 295 | + ); | ||
| 296 | + ?> | ||
| 297 | + </div> | ||
| 298 | + <?php | ||
| 299 | + $form::end(); | ||
| 300 | + ?> | ||
| 301 | + </div> | ||
| 302 | + </div> | ||
| 303 | + </div> | ||
| 249 | 304 | ||
| 305 | + | ||
| 306 | + <!-- Modal Update --> | ||
| 307 | + <div class="modal fade" id="update-role-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
| 308 | + | ||
| 309 | + </div> | ||
| 250 | <?php | 310 | <?php |
| 251 | - echo $form->field($addRole, 'intellectual_property_id')->hiddenInput([ | ||
| 252 | - 'value' => $property->id, | ||
| 253 | - ])->label(false); | ||
| 254 | - ?> | ||
| 255 | - | ||
| 256 | - </div> | ||
| 257 | - <div class="modal-footer btn-submit-blue"> | ||
| 258 | - <?php | ||
| 259 | - echo Html::submitButton( | ||
| 260 | - 'OK' | ||
| 261 | - ); | ||
| 262 | - ?> | ||
| 263 | - </div> | ||
| 264 | - <?php | ||
| 265 | - $form::end(); | ||
| 266 | - ?> | ||
| 267 | - </div> | ||
| 268 | - </div> | ||
| 269 | -</div> | ||
| 270 | - | ||
| 271 | - | ||
| 272 | -<!-- Modal Update --> | ||
| 273 | -<div class="modal fade" id="update-role-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | ||
| 274 | - | ||
| 275 | -</div> | ||
| 276 | \ No newline at end of file | 311 | \ No newline at end of file |
| 312 | + } | ||
| 313 | +?> | ||
| 277 | \ No newline at end of file | 314 | \ No newline at end of file |