From 9cf298c4874584b61d66c402a711a27790aa2f50 Mon Sep 17 00:00:00 2001 From: marina Date: Fri, 27 Dec 2024 09:53:07 +0300 Subject: [PATCH] =?utf8?q?ERP-268=20=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE?= =?utf8?q?=D0=B4=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B=201?= =?utf8?q?=D1=81=20cron=20=D0=B2=20MVC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/views/cron/1c.php | 249 ++++++++++++++++++++-------------------- 1 file changed, 127 insertions(+), 122 deletions(-) diff --git a/erp24/views/cron/1c.php b/erp24/views/cron/1c.php index 977151d4..f5acebe4 100644 --- a/erp24/views/cron/1c.php +++ b/erp24/views/cron/1c.php @@ -8,144 +8,149 @@ $this->title = 'Создание задания для 1с'; ?>
-

Создание задания для 1с

+

Создание задания для 1с

- + -request->getCsrfToken()) ?> + request->getCsrfToken()) ?> - $ar): ?> -
- - - $val): ?> - - - - - -
- 'form-control', 'style' => 'width:220px;']) ?> -
- + $ar): ?> +
+ + + $val): ?> + + + + + +
+ 'Розничная цена', 'Розничная маг на Московск' => 'Розничная маг на Московск'], + ['class' => 'form-control', 'style' => 'width:220px;']); + else + echo Html::input('text', "in_in[{$name}][{$tip}]", $val, ['class' => 'form-control', 'style' => 'width:220px;']) ?> +
+ -
- 'btn btn-success']) ?> +
+ 'btn btn-success']) ?> - + -

'btn']) ?>

+

'btn']) ?>

-

Задания для 1с

+

Задания для 1с

- $tasksDataProvider, - 'columns' => [ - [ - 'attribute' => 'request_id', - 'label' => 'ID запроса', - 'format' => 'raw', - 'value' => function ($task) { - return Html::a($task->request_id, "https://api2." . (YII_ENV_PROD ? 'erp.erp-flowers.ru' : 'dev.erp-flowers.ru') - . "/json/upload_request_id_{$task->request_id}", ['target' => '_blank']); - } - ], - [ - 'attribute' => 'date', - 'label' => 'Дата', - ], - [ - 'attribute' => 'json_post', - 'label' => 'JSON данные', - 'format' => 'raw', - 'value' => function ($task) { - if (empty($task->json_post)) { - return ''; + $tasksDataProvider, + 'columns' => [ + [ + 'attribute' => 'request_id', + 'label' => 'ID запроса', + 'format' => 'raw', + 'value' => function ($task) { + return Html::a($task->request_id, "https://api2." . (YII_ENV_PROD ? 'erp.erp-flowers.ru' : 'dev.erp-flowers.ru') + . "/json/upload_request_id_{$task->request_id}", ['target' => '_blank']); } - $decodedJson = json_decode($task->json_post, true); - if ($decodedJson === null && json_last_error() !== JSON_ERROR_NONE) { - return 'Ошибка в JSON'; + ], + [ + 'attribute' => 'date', + 'label' => 'Дата', + ], + [ + 'attribute' => 'json_post', + 'label' => 'JSON данные', + 'format' => 'raw', + 'value' => function ($task) { + if (empty($task->json_post)) { + return ''; + } + $decodedJson = json_decode($task->json_post, true); + if ($decodedJson === null && json_last_error() !== JSON_ERROR_NONE) { + return 'Ошибка в JSON'; + } + $jsonPretty = json_encode($decodedJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); + return Html::tag('pre', $jsonPretty); + }, + 'contentOptions' => ['style' => 'white-space: pre-wrap; word-wrap: break-word;'] + ], + [ + 'attribute' => 'status', + 'label' => 'Статус', + 'value' => function ($task) { + return Html::encode(\yii_app\records\ApiCron::getStatus()[$task->status]); } - $jsonPretty = json_encode($decodedJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); - return Html::tag('pre', $jsonPretty); - }, - 'contentOptions' => ['style' => 'white-space: pre-wrap; word-wrap: break-word;'] - ], - [ - 'attribute' => 'status', - 'label' => 'Статус', - 'value' => function ($task) { - return Html::encode(\yii_app\records\ApiCron::getStatus()[$task->status]); - } + ], + [ + 'attribute' => 'date_up', + 'label' => 'Дата обновления', + 'value' => function ($task) { + return $task->status == \yii_app\records\ApiCron::COMPLETE && $task->date_up != '0000-00-00 00:00:00' ? Html::encode($task->date_up) : ''; + } + ], ], - [ - 'attribute' => 'date_up', - 'label' => 'Дата обновления', - 'value' => function ($task) { - return $task->status == \yii_app\records\ApiCron::COMPLETE && $task->date_up != '0000-00-00 00:00:00' ? Html::encode($task->date_up) : ''; + 'rowOptions' => function ($task) { + $class = ''; + if ($task->status == \yii_app\records\ApiCron::AWAITING_COMPLETION) { + $class = 'bg-warning'; } - ], - ], - 'rowOptions' => function ($task) { - $class = ''; - if ($task->status == \yii_app\records\ApiCron::AWAITING_COMPLETION) { - $class = 'bg-warning'; - } - return ['class' => $class]; - }, - 'tableOptions' => ['class' => 'table table-hover table-sm'], - 'pager' => [], - 'layout' => '{items}', -]); -?> + return ['class' => $class]; + }, + 'tableOptions' => ['class' => 'table table-hover table-sm'], + 'pager' => [], + 'layout' => '{items}', + ]); + ?> -

Логи от 1с

+

Логи от 1с

- $logsDataProvider, - 'columns' => [ - [ + $logsDataProvider, + 'columns' => [ + [ - 'format' => 'raw', - 'value' => function ($log) { - return Html::a($log->request_id, "https://api2.erp.erp-flowers.ru/json/upload_request_id_{$log->request_id}", ['target' => '_blank']); - } - ], - [ - 'attribute' => 'date', - 'label' => 'Дата', - ], - [ - 'attribute' => 'url', - 'label' => 'URL', - 'value' => function ($log) { - return Html::encode($log->url); - } - ], - [ - 'attribute' => 'content', - 'label' => 'Контент', - 'format' => 'raw', - 'value' => function ($task) { - if (empty($task->content)) { - return ''; + 'format' => 'raw', + 'value' => function ($log) { + return Html::a($log->request_id, "https://api2.erp.erp-flowers.ru/json/upload_request_id_{$log->request_id}", ['target' => '_blank']); } - $decodedJson = json_decode($task->content, true); - if ($decodedJson === null && json_last_error() !== JSON_ERROR_NONE) { - return 'Ошибка в JSON'; + ], + [ + 'attribute' => 'date', + 'label' => 'Дата', + ], + [ + 'attribute' => 'url', + 'label' => 'URL', + 'value' => function ($log) { + return Html::encode($log->url); } - $jsonPretty = json_encode($decodedJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); - return Html::tag('pre', $jsonPretty); - }, - 'contentOptions' => ['style' => 'white-space: pre-wrap; word-wrap: break-word;'] // Разрыв слов и переносы - ], + ], + [ + 'attribute' => 'content', + 'label' => 'Контент', + 'format' => 'raw', + 'value' => function ($task) { + if (empty($task->content)) { + return ''; + } + $decodedJson = json_decode($task->content, true); + if ($decodedJson === null && json_last_error() !== JSON_ERROR_NONE) { + return 'Ошибка в JSON'; + } + $jsonPretty = json_encode($decodedJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); + return Html::tag('pre', $jsonPretty); + }, + 'contentOptions' => ['style' => 'white-space: pre-wrap; word-wrap: break-word;'] // Разрыв слов и переносы + ], - ], - 'tableOptions' => ['class' => 'table table-hover table-sm'], - 'pager' => [], - 'layout' => '{items}', -]); -?> + ], + 'tableOptions' => ['class' => 'table table-hover table-sm'], + 'pager' => [], + 'layout' => '{items}', + ]); + ?>
-- 2.39.5