небольшие исправления
This commit is contained in:
parent
1a1392d950
commit
29ea6a9a79
|
@ -111,7 +111,8 @@ $config = [
|
|||
'invoices/<order:[^/]+>' => 'invoice/index',
|
||||
'invoices/<order:[^/]+>/<action:(download)>' => 'invoice/<action>',
|
||||
'verify/send' => 'verify/send',
|
||||
'verify/<vrfy:[^/]+>' => 'verify/index'
|
||||
'verify/<vrfy:[^/]+>' => 'verify/index',
|
||||
'terminals/<action:(read|write)>' => 'terminal/<action>'
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
@ -967,4 +967,14 @@ class Account extends Document implements IdentityInterface, PartnerInterface
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверка на то, что аккаунт имеет минимальный доступ
|
||||
*
|
||||
* @param static|null $account Аккаунт
|
||||
*/
|
||||
public static function isMinimalAuthorized($account = null): bool
|
||||
{
|
||||
return self::isModer($account) || self::isAdmin($account);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,16 @@ class AccountForm extends Model
|
|||
];
|
||||
}
|
||||
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'mail' => 'Почта',
|
||||
'pswd' => 'Пароль',
|
||||
'auto' => '<i class="fas fa-unlock"></i>',
|
||||
'pols' => 'Политика конфедециальности'
|
||||
];
|
||||
}
|
||||
|
||||
public function validateMail($attribute, $params)
|
||||
{
|
||||
if (!$this->hasErrors()) {
|
||||
|
|
|
@ -47,10 +47,19 @@ class Product extends Document
|
|||
*/
|
||||
const SCENARIO_WRITE = 'write';
|
||||
|
||||
/**
|
||||
* Аккаунт
|
||||
*
|
||||
* Используется для управления администратором от лица пользователя
|
||||
*/
|
||||
public Account|string|null $account = null;
|
||||
|
||||
/**
|
||||
* Файл .excel для импорта товаров
|
||||
*/
|
||||
public Excel|string|array|null $file_excel = null;
|
||||
public Excel|string|array|null $file_excel_1 = null;
|
||||
public Excel|string|array|null $file_excel_2 = null;
|
||||
|
||||
/**
|
||||
* Изображение для импорта
|
||||
|
@ -108,8 +117,11 @@ class Product extends Document
|
|||
'time' => 'Срок доставки (time)',
|
||||
'bffr' => 'Буфер',
|
||||
'file_excel' => 'Документ (file_excel)',
|
||||
'file_excel_1' => 'Документ (file_excel)',
|
||||
'file_excel_2' => 'Документ (file_excel)',
|
||||
'file_image' => 'Изображение (file_image)',
|
||||
'group' => 'Группа (group)'
|
||||
'group' => 'Группа (group)',
|
||||
'account' => 'Аккаунт'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -366,6 +378,9 @@ class Product extends Document
|
|||
// Поиск всех артикулов (каталожных номеров)
|
||||
$products = explode(',', $doc['catn'], 300);
|
||||
|
||||
// Поиск количества товаров
|
||||
$amount = $doc['amnt'] ?? 1;
|
||||
|
||||
foreach ($products as $_product) {
|
||||
// Перебор продуктов (если catn перечислены через запятую)
|
||||
|
||||
|
@ -385,7 +400,6 @@ class Product extends Document
|
|||
if (($_product = $product->validateForUniqueness()) instanceof static) {
|
||||
// Найден документ с такими параметрами
|
||||
|
||||
|
||||
// Инициализация буфера с параметрами загружаемого товара
|
||||
$vars = $product->getAttributes();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
use app\models\Account;
|
||||
use yii;
|
||||
use yii\bootstrap\ActiveForm;
|
||||
|
||||
|
@ -51,7 +52,32 @@ $panel ?? $panel = 'profile_panel_supplies_input_import';
|
|||
]);
|
||||
?>
|
||||
|
||||
<?= $form->field($model, 'file_excel', ['enableLabel' => false])->fileInput(['multiple' => true, 'class' => 'mb-2', 'onChange' => 'page_profile_supplies_import_excel(this.parentElement.parentElement, \'profile_panel_supplies_input_import\')']) ?>
|
||||
<?php if (Account::isMinimalAuthorized()) : ?>
|
||||
<?= $form->field($model, 'account', ['options' => ['class' => "mb-4 col-4"]])->input('text', ['placeholder' => yii::$app->user->identity->_key]); ?>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="mb-3 row">
|
||||
<div class="col-auto">1.</div>
|
||||
<div class="col">
|
||||
Тест импорта.xlsx
|
||||
</div>
|
||||
<a class="pr-0 my-auto col-auto fas fa-file-download text-dark" type="button" aria-hidden="true" onclick="page_profile_supplies_download()"></a>
|
||||
<a class="my-auto col-auto fas fa-trash-alt text-dark" type="button" aria-hidden="true" onclick="page_profile_supplies_delete()"></a>
|
||||
</div>
|
||||
<div class="dropdown-divider mb-3"></div>
|
||||
<div class="mb-3 row">
|
||||
<div class="col-auto">2.</div>
|
||||
<div class="col">
|
||||
<?= $form->field($model, 'file_excel_1', ['enableLabel' => false])->fileInput(['multiple' => true, 'onChange' => 'page_profile_supplies_import_excel(this.parentElement.parentElement, \'profile_panel_supplies_input_import\')']) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown-divider mb-3"></div>
|
||||
<div class="row">
|
||||
<div class="col-auto">3.</div>
|
||||
<div class="col">
|
||||
<?= $form->field($model, 'file_excel_2', ['enableLabel' => false])->fileInput(['multiple' => true, 'onChange' => 'page_profile_supplies_import_excel(this.parentElement.parentElement, \'profile_panel_supplies_input_import\')']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?= $form->errorSummary($model, ['header' => 'В документе были допущены ошибки:' /*, 'footer' => 'Исправьте их и попробуйте снова'*/]); ?>
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
After Width: | Height: | Size: 481 B |
Reference in New Issue