залупа
This commit is contained in:
@@ -86,7 +86,8 @@ class CartController extends Controller
|
||||
$account = Account::initAccount();
|
||||
|
||||
// Поиск корзины (текущего заказа)
|
||||
$data = Order::searchByType()[0] ?? null;
|
||||
$data = Order::searchSmart()[0] ?? null;
|
||||
|
||||
|
||||
if (empty($data['order'])) {
|
||||
// Корзина не инициализирована
|
||||
@@ -105,7 +106,7 @@ class CartController extends Controller
|
||||
}
|
||||
|
||||
// Инициализация содержимого корзины
|
||||
$data['supplies'] = $data['order']->supplies(10, $page, test: true);
|
||||
$data['supplies'] = $data['order']->supplies(10, $page);
|
||||
|
||||
// Инициализация данных списка для выбора терминала
|
||||
$delivery_to_terminal_list = $account->genListTerminalsTo();
|
||||
@@ -163,7 +164,7 @@ class CartController extends Controller
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ($edges = OrderEdgeSupply::searchBySupplyCatnAndProd($catn, $prod, Order::searchByType())) {
|
||||
if ($edges = OrderEdgeSupply::searchBySupplyCatnAndProd($catn, $prod, Order::searchByType()[0]['order'])) {
|
||||
// Рёбра найдены (связи заказа с поставкой)
|
||||
|
||||
// Инициализация
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -143,6 +143,7 @@ class SearchController extends Controller
|
||||
'dscr' => 'dscr',
|
||||
'catg' => 'catg',
|
||||
'imgs' => 'imgs',
|
||||
'name' => 'name',
|
||||
'prod' => 'prod',
|
||||
'dmns' => 'dmns',
|
||||
'stts' => 'stts'
|
||||
|
@@ -11,6 +11,68 @@ class AccountEdgeOrder extends Edge
|
||||
return 'account_edge_order';
|
||||
}
|
||||
|
||||
/**
|
||||
* Свойства
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return array_merge(
|
||||
parent::attributes(),
|
||||
[
|
||||
'stts'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Метки свойств
|
||||
*/
|
||||
public function attributeLabels(): array
|
||||
{
|
||||
return array_merge(
|
||||
parent::attributeLabels(),
|
||||
[
|
||||
'stts' => 'Статус'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Правила
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return array_merge(
|
||||
parent::rules(),
|
||||
[
|
||||
[
|
||||
[
|
||||
'stts'
|
||||
],
|
||||
'string'
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Перед сохранением
|
||||
*
|
||||
* @todo Подождать обновление от ебаного Yii2 и добавить
|
||||
* проверку типов передаваемых параметров
|
||||
*/
|
||||
public function beforeSave($data): bool
|
||||
{
|
||||
if (parent::beforeSave($data)) {
|
||||
if ($this->isNewRecord) {
|
||||
$this->stts = 'current';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Поиск по идентификатору заказа
|
||||
*
|
||||
@@ -23,22 +85,4 @@ class AccountEdgeOrder extends Edge
|
||||
{
|
||||
return self::find()->where(['_to' => $order_id])->limit($limit)->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Генерация ярлыка на русском языке для статуса заказа
|
||||
*
|
||||
* @param string $status Статус заказа
|
||||
*
|
||||
* @return string Ярлык статуса на русском языке
|
||||
*/
|
||||
public static function statusToRussian(string $status = ''): string
|
||||
{
|
||||
return match ($status) {
|
||||
'requested' => 'Запрошен',
|
||||
'accepted' => 'Ожидается отправка',
|
||||
'going' => 'Доставляется',
|
||||
'completed' => 'Завершен',
|
||||
default => 'Обрабатывается'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -120,7 +120,7 @@ abstract class Edge extends Document
|
||||
// Настройка
|
||||
$edge->_from = $_from;
|
||||
$edge->_to = $_to;
|
||||
$edge->type = $type;
|
||||
if (isset($type)) $edge->type = $type;
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_int($key)) {
|
||||
|
@@ -96,7 +96,7 @@ class Order extends Document implements DocumentInterface
|
||||
public function connect(Account $account): ?AccountEdgeOrder
|
||||
{
|
||||
// Запись ребра: АККАУНТ -> ЗАКАЗ
|
||||
return AccountEdgeOrder::write($account->readId(), $this->readId(), 'current') ?? throw new Exception('Не удалось инициализировать ребро: АККАУНТ -> ЗАКАЗ');
|
||||
return AccountEdgeOrder::write($account->readId(), $this->readId(), data: ['stts' => 'current']) ?? throw new Exception('Не удалось инициализировать ребро: АККАУНТ -> ЗАКАЗ');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,9 +263,9 @@ class Order extends Document implements DocumentInterface
|
||||
*
|
||||
* @todo Привести в порядок
|
||||
*/
|
||||
public static function searchByType(
|
||||
public static function searchSmart(
|
||||
Account|string $account = null,
|
||||
string $type = 'current',
|
||||
string $stts = 'current',
|
||||
string|null $search = null,
|
||||
int $limit = 1,
|
||||
int $page = 1,
|
||||
@@ -276,24 +276,28 @@ class Order extends Document implements DocumentInterface
|
||||
bool $count = false
|
||||
): int|array|null {
|
||||
// Инициализация аккаунта
|
||||
if (empty($account) && isset(yii::$app->user->identity)) {
|
||||
// Данные не переданы
|
||||
if (empty($account)) {
|
||||
// Не получен аккаунт
|
||||
|
||||
$subquery_where = [
|
||||
[
|
||||
'account._id' => yii::$app->user->identity->readId()
|
||||
'account._id' => Account::initAccount()->readId()
|
||||
]
|
||||
];
|
||||
} else if ($account instanceof Account) {
|
||||
// Передан аккаунт
|
||||
// Получен аккаунт
|
||||
|
||||
$subquery_where = [
|
||||
[
|
||||
'account._id' => $account->readId()
|
||||
]
|
||||
];
|
||||
if (Account::isMinimalAuthorized(Account::initAccount())) {
|
||||
$subquery_where = [
|
||||
[
|
||||
'account._id' => $account->readId()
|
||||
]
|
||||
];
|
||||
} else {
|
||||
throw new Exception('У вас нет прав на обработку другого пользователя');
|
||||
}
|
||||
} else if (str_contains($account, '@all')) {
|
||||
// Запрос на обработку всех аккаунтов
|
||||
// Получен запрос на обработку всех аккаунтов
|
||||
|
||||
$subquery_where = [];
|
||||
} else {
|
||||
@@ -301,11 +305,11 @@ class Order extends Document implements DocumentInterface
|
||||
}
|
||||
|
||||
// Инициализация типа заказа
|
||||
if (strcasecmp($type, 'all') !== 0) {
|
||||
if (strcasecmp($stts, '@all') !== 0) {
|
||||
// Если не указан поиск всех заказов
|
||||
|
||||
$subquery_where[] = [
|
||||
'account_edge_order.type' => $type
|
||||
'account_edge_order.stts' => $stts
|
||||
];
|
||||
}
|
||||
|
||||
@@ -409,7 +413,7 @@ class Order extends Document implements DocumentInterface
|
||||
* @todo В будущем возможно заказ не только поставок реализовать
|
||||
* Переписать реестр и проверку на дубликаты, не понимаю как они работают
|
||||
*/
|
||||
public function supplies(int $limit = 1, int $page = 1, string|null $search = null, bool $count = false, $test = false): Supply|int|array|null
|
||||
public function supplies(int $limit = 1, int $page = 1, string|null $search = null, bool $count = false): Supply|int|array|null
|
||||
{
|
||||
// Инициализация аккаунта
|
||||
$account = Account::initAccount();
|
||||
@@ -564,17 +568,32 @@ class Order extends Document implements DocumentInterface
|
||||
*/
|
||||
public static function checkSuppliesStts(array $order_edge_supply): bool
|
||||
{
|
||||
foreach ($order_edge_supply as $edge) {
|
||||
// Перебор поставок
|
||||
if (isset($order_edge_supply['_key'])) {
|
||||
// Получено ребро: ЗАКАЗ -> ПОСТАВКА
|
||||
|
||||
if (empty($edge['stts']) || $edge['stts'] !== 'accepted') {
|
||||
// Найдена неподтверждённая поставка
|
||||
if (empty($order_edge_supply['stts']) || $order_edge_supply['stts'] === 'processing' || $order_edge_supply['stts'] === 'requested') {
|
||||
// Найдена неподтверждённая поставка
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (isset($order_edge_supply[0]['_key'])) {
|
||||
// Получен массив (подразумевается, что с рёбрами: ЗАКАЗ -> ПОСТАВКА)
|
||||
|
||||
foreach ($order_edge_supply as $edge) {
|
||||
// Перебор поставок
|
||||
|
||||
if (empty($edge['stts']) || $edge['stts'] === 'processing' || $edge['stts'] === 'requested') {
|
||||
// Найдена неподтверждённая поставка
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -737,6 +756,47 @@ class Order extends Document implements DocumentInterface
|
||||
*/
|
||||
public static function count(int $limit = 500, bool $supplies = false): int
|
||||
{
|
||||
return (int) self::searchByType(supplies: $supplies, type: $supplies ? 'current' : 'all', limit: $limit, count: true);
|
||||
return (int) self::searchSmart(supplies: $supplies, stts: $supplies ? 'current' : '@all', limit: $limit, count: true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Генерация ярлыка на русском языке для статуса заказа
|
||||
*
|
||||
* @param string|null $status Статус заказа
|
||||
*
|
||||
* @return string Ярлык статуса на русском языке
|
||||
*/
|
||||
public static function statusToRussian(?string $status = 'processing'): string
|
||||
{
|
||||
return match ($status) {
|
||||
'processing' => 'Обрабатывается',
|
||||
'requested' => 'Запрошен',
|
||||
'accepted' => 'Ожидается отправка',
|
||||
'going' => 'Доставляется',
|
||||
'ready' => 'Готов к выдаче',
|
||||
'completed' => 'Завершен',
|
||||
'reserved' => 'Резервирован',
|
||||
default => 'Обрабатывается'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Генерация списка статусов на русском языке
|
||||
*
|
||||
* @param string|null $active Активный статус, который выведется первым в списке
|
||||
*
|
||||
* @return string Лист статусов на русском языке
|
||||
*/
|
||||
public static function statusListInRussian(?string $active = 'processing'): array
|
||||
{
|
||||
return [(empty($active) ? 'processing' : $active) => static::statusToRussian($active)] + [
|
||||
'processing' => 'Обрабатывается',
|
||||
'requested' => 'Запрошен',
|
||||
'accepted' => 'Ожидается отправка',
|
||||
'going' => 'Доставляется',
|
||||
'ready' => 'Готов к выдаче',
|
||||
'completed' => 'Завершен',
|
||||
'reserved' => 'Резервирован'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,6 @@ class OrderEdgeSupply extends Edge
|
||||
return 'order_edge_supply';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Свойства
|
||||
*/
|
||||
@@ -118,7 +117,7 @@ class OrderEdgeSupply extends Edge
|
||||
|
||||
|
||||
/**
|
||||
* Поиск поставки по артикулу
|
||||
* Поиск по данным поставки
|
||||
*
|
||||
* @param string $catn Артикул
|
||||
* @param Order $order Заказ
|
||||
@@ -126,7 +125,7 @@ class OrderEdgeSupply extends Edge
|
||||
*
|
||||
* @return array Поставки
|
||||
*/
|
||||
public static function searchBySupplyCatnAndProd(string $catn, string $prod, Order $order = null, int $limit = 10): array
|
||||
public static function searchBySupplyData(string $catn, string $prod, ?string $delivery = null, ?Order $order = null, int $limit = 10): array
|
||||
{
|
||||
if ($supply = Supply::searchByCatnAndProd($catn, $prod)) {
|
||||
// Поставка найдена
|
||||
@@ -134,6 +133,12 @@ class OrderEdgeSupply extends Edge
|
||||
if (isset($order)) {
|
||||
// Поиск только по определённому заказу
|
||||
|
||||
if (isset($delivery)) {
|
||||
// Поиск только по определённым типам доставки
|
||||
|
||||
return self::find()->where(['_from' => $order->readId(), '_to' => $supply->readId(), 'order_edge_supply.dlvr.type' => $delivery])->limit($limit)->all();
|
||||
}
|
||||
|
||||
return self::find()->where(['_from' => $order->readId(), '_to' => $supply->readId()])->limit($limit)->all();
|
||||
}
|
||||
|
||||
@@ -143,21 +148,21 @@ class OrderEdgeSupply extends Edge
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Генерация ярлыка на русском языке для статуса заказа поставки
|
||||
* Генерация ярлыка на русском языке для статуса заказа
|
||||
*
|
||||
* @param string $status Статус заказа поставки
|
||||
* @param string|null $status Статус заказа
|
||||
*
|
||||
* @return string Ярлык статуса на русском языке
|
||||
*/
|
||||
public static function statusToRussian(string $status = ''): string
|
||||
public static function statusToRussian(?string $status = 'processing'): string
|
||||
{
|
||||
return match ($status) {
|
||||
'requested' => 'Запрошен',
|
||||
'accepted' => 'Ожидается отправка',
|
||||
'going' => 'Доставляется',
|
||||
'completed' => 'Завершен',
|
||||
'processing' => 'Обрабатывается',
|
||||
default => 'Обрабатывается'
|
||||
};
|
||||
}
|
||||
|
BIN
mirzaev/skillparts/system/views/invoice/order/pattern.pdf
Executable file
BIN
mirzaev/skillparts/system/views/invoice/order/pattern.pdf
Executable file
Binary file not shown.
@@ -1 +1 @@
|
||||
<p class="my-2 mx-3" href="/orders#<?= $order ?>">Данные заказа #<?= $order ?> изменены: <?= $target ?> с <?= $from ?> на <?= $to ?></p>
|
||||
<p class="my-2 mx-3" href="/orders#<?= $order ?>"><b>#<?= $order ?>:</b> <?= mb_convert_case($target, MB_CASE_LOWER, "UTF-8") ?><?php if (!empty($to)) : ?><?php if (!empty($from)) : ?> с "<?= mb_convert_case($from, MB_CASE_LOWER, "UTF-8") ?>"<?php endif ?> на "<?= mb_convert_case($to, MB_CASE_LOWER, "UTF-8") ?>"<?php endif ?></p>
|
||||
|
@@ -42,18 +42,18 @@ if (empty($window)) {
|
||||
<input type="radio" id="orders_panel_moderation" name="main_panel" <?= $window === 'orders_panel_moderation' ? 'checked' : null ?> />
|
||||
<article>
|
||||
<div class="orders_panel_moderation_menu mb-3">
|
||||
<label class="btn btn-sm button_white mb-0 mr-2" for="orders_panel_moderation_all">Все</label>
|
||||
<label class="btn btn-sm button_white mb-0 mr-2" for="orders_panel_moderation_requested">Запрошены</label>
|
||||
<label class="btn btn-sm button_white mb-0 mr-2" for="orders_panel_moderation_handled">Обрабатываются</label>
|
||||
<label class="btn btn-sm button_white mb-0" for="orders_panel_moderation_completed">Завершены</label>
|
||||
<label class="btn btn-sm button_white mb-0" onclick="return orders_read('@last', '@all', null, null, 'orders_panel_moderation');">Все</label>
|
||||
<?php foreach(Order::statusListInRussian() as $id => $label) : ?>
|
||||
<label class="btn btn-sm button_white mb-0 ml-2" onclick="return orders_read('@last', '<?= $id ?>', null, null, 'orders_panel_moderation');"><?= $label ?></label>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php if (!empty($moderator_data)) : ?>
|
||||
<?php foreach ($moderator_data as $moderator_data) : ?>
|
||||
<div id="<?= $moderator_data['order']->_key ?>_panel" class="page_order_panel mb-3 py-3 px-4 rounded">
|
||||
<div id="<?= $moderator_data['order']->_key ?>_panel" class="page_order_panel mb-2 py-3 px-4 rounded">
|
||||
<h5 class="row mt-1 mb-3">
|
||||
<?php
|
||||
// Инициализация времени отправки заказа
|
||||
$date = null;
|
||||
$date = time();
|
||||
|
||||
foreach ($moderator_data['order']->jrnl as $entry) {
|
||||
// Перебор записей в журнале
|
||||
@@ -76,18 +76,18 @@ if (empty($window)) {
|
||||
// Конвертация данных из буфера
|
||||
$date = [
|
||||
'H:i' => (new DateTime())->setTimestamp($date)->setTimezone(new DateTimeZone($timezone))->format('H:i'),
|
||||
'm.d.Y' => (new DateTime())->setTimestamp($date)->setTimezone(new DateTimeZone($timezone))->format('m.d.Y')
|
||||
'm.d.Y' => (new DateTime())->setTimestamp($date)->setTimezone(new DateTimeZone($timezone))->format('d.m.Y')
|
||||
];
|
||||
|
||||
?>
|
||||
<p class="col-auto ml-1 font-weight-bold">#<?= $moderator_data['order']->_key ?></p>
|
||||
<p class="col-auto mr-1 font-weight-bold">
|
||||
<span class="mr-2"><?= $date['H:i'] ?? 'Неизвестно' ?></span>
|
||||
<span><small><small><?= $date['H:i'] ?? 'Неизвестно' ?></small></small></span>
|
||||
<span><?= $date['m.d.Y'] ?? 'Неизвестно' ?></span>
|
||||
</p>
|
||||
</h5>
|
||||
<div class="dropdown-divider mb-3"></div>
|
||||
<div class="row px-2">
|
||||
<div class="row px-3">
|
||||
<div id="orders_panel_supplies_<?= $moderator_data['order']->_key ?>" class="col-3 unselectable">
|
||||
<?php if (!empty($moderator_data['supplies'])) : ?>
|
||||
<?php
|
||||
@@ -128,21 +128,18 @@ if (empty($window)) {
|
||||
if ($supply['amount'] > 0) {
|
||||
// Пройдена проверка на количество поставок в заказе
|
||||
|
||||
// if (Order::checkSuppliesStts($order_edge_supply)) {
|
||||
// $status = '<span id="' . $supply['catn'] . '_auto_supply_stts_indicator_icon" class="ml-auto my-auto fas fa-check"></span>';
|
||||
// } else {
|
||||
$status = '';
|
||||
// }
|
||||
if (Order::checkSuppliesStts($supply['edge'])) $status = "<span id=\"{$moderator_data['order']->_key}_{$prod}_{$catn}_{$delivery}_supply_stts_indicator_icon\" class=\"ml-auto my-auto fas fa-check\"></span>";
|
||||
else $status = '';
|
||||
|
||||
// Инициализация иконки
|
||||
$icon = $delivery === 'avia' ? 'fa-plane' : 'fa-truck';
|
||||
|
||||
// Генерация HTML
|
||||
echo <<<HTML
|
||||
<a id="{$prod}_{$catn}_{$delivery}_supply" class="row mb-2 p-2 px-0 rounded row_supply" type="button" onclick="return orders_supply_edit('{$prod}_{$catn}_{$delivery}', {$moderator_data['order']->_key});">
|
||||
<a id="{$moderator_data['order']->_key}_{$prod}_{$catn}_{$delivery}_supply" class="row mb-2 p-2 px-0 rounded row_supply" type="button" onclick="return orders_supply_edit('{$moderator_data['order']->_key}', '$prod', '$catn', '$delivery');">
|
||||
<img class="col-auto px-0 h-100 img-fluid rounded" src="$covr" />
|
||||
<p id="{$prod}_{$catn}_{$delivery}_supply_stts_indicator" class="col d-flex text-dark">
|
||||
{$catn} x{$supply['amount']}
|
||||
<p id="{$moderator_data['order']->_key}_{$prod}_{$catn}_{$delivery}_supply_stts_indicator" class="col d-flex text-dark">
|
||||
{$catn}
|
||||
<small class="ml-2 my-auto fas $icon"></small>
|
||||
$status
|
||||
</p>
|
||||
@@ -166,9 +163,30 @@ if (empty($window)) {
|
||||
<p class="my-auto">Выберите поставку</p>
|
||||
</div>
|
||||
<div id="orders_panel_info_<?= $moderator_data['order']->_key ?>" class="col-3 d-flex flex-column">
|
||||
<p class="row mt-0 mb-3 px-2"><b>Статус:</b> <span class="ml-auto"><?= AccountEdgeOrder::statusToRussian(AccountEdgeOrder::searchByOrder($moderator_data['order']->readId())['stts'] ?? '') ?></span></p>
|
||||
<a id="<?= $moderator_data['order']->_key ?>_button" class="row mt-auto mb-0 text-center text-white btn button_blue button_clean disabled" type="button" onclick="return order_accept('<?= $moderator_data['order']->_key ?>');">Подтвердить</a>
|
||||
</div>
|
||||
<?php $form = ActiveForm::begin([
|
||||
'id' => 'form_profile_settings',
|
||||
'action' => false,
|
||||
'fieldConfig' => [
|
||||
'template' => '{label}{input}',
|
||||
],
|
||||
'options' => [
|
||||
'onsubmit' => 'return false;',
|
||||
'class' => 'row'
|
||||
]
|
||||
]);
|
||||
|
||||
// Инициализация ребра до заказа
|
||||
$account_edge_order = AccountEdgeOrder::searchByOrder($moderator_data['order']->readId())[0];
|
||||
?>
|
||||
|
||||
<?= $form->field($account_edge_order, 'stts', ['options' => ['class' => "mb-1 w-100"]])
|
||||
->dropDownList(Order::statusListInRussian($account_edge_order->stts), [
|
||||
'onChange' => "return orders_status_edit('{$moderator_data['order']->_key}', this);",
|
||||
'data-old-value' => $account_edge_order->stts
|
||||
])->label(false); ?>
|
||||
<small class="d-block mb-1 w-100 text-center"><b>Покупатель будет уведомлён</b></small>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<script defer>
|
||||
document.addEventListener(
|
||||
@@ -192,13 +210,15 @@ if (empty($window)) {
|
||||
<?php endif ?>
|
||||
|
||||
<article class="page_order_panel mt-3 py-3 px-4 rounded <?= $account_type ?? false ? '' : 'd-block'; ?>">
|
||||
<div class="row mt-2 mb-2">
|
||||
<h4 class="col ml-4"><i class="fas fa-list mr-2"></i>Заказы</h4>
|
||||
<div class="col-auto orders_panel_menu ml-auto text-right">
|
||||
<a class="btn btn-sm button_white button_clean font-weight-bold mb-0 mr-2" type="button" onclick="return orders_read('@last', 'all');">Все</a>
|
||||
<a class="btn btn-sm button_white button_clean font-weight-bold mb-0 mr-2" type="button" onclick="return orders_read('@last', 'requested');">Запрошенные</a>
|
||||
<a class="btn btn-sm button_white button_clean font-weight-bold mb-0 mr-2" type="button" onclick="return orders_read('@last', 'accepted');">Активные</a>
|
||||
<a class="btn btn-sm button_white button_clean font-weight-bold mb-0" type="button" onclick="return orders_read('@last', 'completed');">Завершенные</a>
|
||||
<div class="row mt-2 mb-3">
|
||||
<h4 class="col-auto mx-auto mb-0">Заказы</h4>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-auto orders_panel_menu mx-auto">
|
||||
<a class="btn btn-sm button_white button_clean font-weight-bold mb-0 mr-2" type="button" onclick="return orders_read('@last', '@all');">Все</a>
|
||||
<?php foreach(Order::statusListInRussian() as $id => $label) : ?>
|
||||
<a class="btn btn-sm button_white button_clean font-weight-bold mb-0 mr-2" type="button" onclick="return orders_read('@last', '<?= $id ?>');"><?= $label ?></a>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-4 px-3">
|
||||
@@ -225,11 +245,8 @@ if (empty($window)) {
|
||||
<input id="orders_period_calendar" class="pl-0 h-100 form_clean_full text-center" type="text" /><i class="ml-2 fas fa-calendar-alt my-auto"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col mb-4 list rounded">
|
||||
<div class="col mb-2 list rounded">
|
||||
<div class="row py-3 text-center">
|
||||
<!-- <div class="pl-3 mr-1">
|
||||
<input id="checkbox_cart_all" type="checkbox" onchange="return cart_list_checkbox(this);" />
|
||||
</div> -->
|
||||
<span class="col-2"><b>Артикул</b></span>
|
||||
<span class="col-3"><b>Статус</b></span>
|
||||
<span class="col-3"><b>Поступление</b></span>
|
||||
@@ -245,9 +262,9 @@ if (empty($window)) {
|
||||
// Перебор заказов
|
||||
|
||||
// Инициализация ребра: АККАУНТ -> ЗАКАЗ
|
||||
$edge = AccountEdgeOrder::searchByOrder($moderator_data['order']->readId());
|
||||
$account_edge_order = AccountEdgeOrder::searchByOrder($data['order']->readId())[0];
|
||||
|
||||
if (isset($edge['stts']) && ($order['stts'] === 'reserved' || $edge['stts'] === 'current')) {
|
||||
if (isset($account_edge_order->stts) && ($account_edge_order['stts'] === 'reserved' || $account_edge_order->stts === 'current')) {
|
||||
// Заказ был резервирован (отменён) или это активный заказ (несформированный, в корзине)
|
||||
|
||||
continue;
|
||||
@@ -285,9 +302,12 @@ if (empty($window)) {
|
||||
if (isset($data['supplies'])) {
|
||||
// Найдены поставки
|
||||
|
||||
// Инициализация максимального срока доставки
|
||||
// Инициализация максимального срока доставки поставок
|
||||
$delivery_max = 0;
|
||||
|
||||
// Инициализация общего количества поставок
|
||||
$amount_max = 0;
|
||||
|
||||
// Инициализация поставок
|
||||
foreach ($data['supplies'] as $prod => $list) {
|
||||
// Перебор поставок
|
||||
@@ -296,85 +316,90 @@ if (empty($window)) {
|
||||
foreach ($deliveries as $delivery => $supply) {
|
||||
// Перебор заказов
|
||||
|
||||
// Инициализация ребра: ЗАКАЗ -> ПОСТАВКА
|
||||
$edge = OrderEdgeSupply::searchBySupplyCatnAndProd((string) $catn, $prod);
|
||||
|
||||
// Инициализация цены
|
||||
$price_raw = $supply['cost'];
|
||||
|
||||
// Инициализация комментария
|
||||
$comment = $edge['comm'] ?? 'Комментарий к заказу';
|
||||
|
||||
if ($supply['amount'] > 0) {
|
||||
// Пройдена проверка на количество поставок в заказе
|
||||
if ($order_edge_supply = OrderEdgeSupply::searchBySupplyData((string) $catn, (string) $prod, (string) $delivery, $data['order'])) {
|
||||
// Удалось найти рёбра: ЗАКАЗ -> ПОСТАВКА
|
||||
|
||||
// Инициализация цены
|
||||
$price = $price_raw * $supply['amount'] . ' ' . $supply['currency'];
|
||||
$price_raw = $order_edge_supply[0]->cost ?? $supply['cost'] ?? 0;
|
||||
|
||||
// Инициализация доставки
|
||||
if (!isset($supply['delivery']) || (isset($supply['delivery'], $supply['delivery']['error']) || $supply['delivery'] === '?')) {
|
||||
// Не удалось рассчитать доставку
|
||||
if ($supply['amount'] > 0) {
|
||||
// Пройдена проверка на количество поставок в заказе
|
||||
|
||||
// Инициализация времени
|
||||
$days = '?';
|
||||
} else {
|
||||
// Удалось рассчитать доставку
|
||||
// Инициализация цены
|
||||
$price = $price_raw * $supply['amount'] . ' ' . $supply['currency'];
|
||||
|
||||
// Инициализация даты отправки
|
||||
try {
|
||||
// Взять данные из "arrivalToOspSender" (Дата прибытия на терминал-отправитель)
|
||||
// Инициализация доставки
|
||||
if (empty($time = $order_edge_supply[0]->time)) {
|
||||
// Не найден срок доставки (в днях)
|
||||
|
||||
$delivery_send_date = DateTime::createFromFormat('Y-m-d', $supply['delivery']['orderDates']['arrivalToOspSender'])->getTimestamp();
|
||||
} catch (Throwable $e) {
|
||||
// Взять данные из "pickup" (Дата передачи груза на адресе отправителя)
|
||||
if (empty($order_edge_supply[0]->dlvr['data'])) {
|
||||
// Не удалось рассчитать доставку
|
||||
|
||||
$delivery_send_date = DateTime::createFromFormat('Y-m-d', $supply['delivery']['orderDates']['pickup'])->getTimestamp();
|
||||
}
|
||||
// Инициализация времени
|
||||
$time = 0;
|
||||
} else {
|
||||
// Удалось рассчитать доставку
|
||||
|
||||
// Инициализация времени доставки
|
||||
try {
|
||||
// Доставка по воздуху (подразумевается), данные из "giveoutFromOspReceiver" (Дата и время, с которого груз готов к выдаче на терминале)
|
||||
// Инициализация даты отправки
|
||||
try {
|
||||
// Взять данные из "arrivalToOspSender" (Дата прибытия на терминал-отправитель)
|
||||
|
||||
// Оставлено на всякий случай для дальнейших разбирательств
|
||||
$delivery_send_date = DateTime::createFromFormat('Y-m-d', $order_edge_supply[0]->dlvr['data']['orderDates']['arrivalToOspSender'])->getTimestamp();
|
||||
} catch (Throwable $e) {
|
||||
// Взять данные из "pickup" (Дата передачи груза на адресе отправителя)
|
||||
|
||||
$delivery_converted = DateTime::createFromFormat('Y-m-d H:i:s', $supply['delivery']['orderDates']['giveoutFromOspReceiver'])->getTimestamp();
|
||||
} catch (Throwable $e) {
|
||||
// Автоматическая доставка (подразумевается), данные из "arrivalToOspReceiver" (Дата прибытия натерминал-получатель)
|
||||
$delivery_send_date = DateTime::createFromFormat('Y-m-d', $order_edge_supply[0]->dlvr['data']['orderDates']['pickup'])->getTimestamp();
|
||||
}
|
||||
|
||||
$delivery_converted = DateTime::createFromFormat('Y-m-d', $supply['delivery']['orderDates']['arrivalToOspReceiver'])->getTimestamp();
|
||||
}
|
||||
$days = ceil(($delivery_converted - ($delivery_send_date ?? 0)) / 60 / 60 / 24) + 1;
|
||||
// Инициализация времени доставки
|
||||
try {
|
||||
// Доставка по воздуху (подразумевается), данные из "giveoutFromOspReceiver" (Дата и время, с которого груз готов к выдаче на терминале)
|
||||
|
||||
// Оставлено на всякий случай для дальнейших разбирательств
|
||||
|
||||
$delivery_converted = DateTime::createFromFormat('Y-m-d H:i:s', $order_edge_supply[0]->dlvr['data']['orderDates']['giveoutFromOspReceiver'])->getTimestamp();
|
||||
} catch (Throwable $e) {
|
||||
// Инициализация даты отправки
|
||||
|
||||
// Автоматическая доставка (подразумевается), данные из "arrivalToOspReceiver" (Дата прибытия натерминал-получатель)
|
||||
$delivery_converted = DateTime::createFromFormat('Y-m-d', $order_edge_supply[0]->dlvr['data']['orderDates']['arrivalToOspReceiver'])->getTimestamp();
|
||||
}
|
||||
$time = ceil(($delivery_converted - ($delivery_send_date ?? 0)) / 60 / 60 / 24);
|
||||
}
|
||||
}
|
||||
|
||||
// Инициализация статуса связи поставки
|
||||
$status = Order::statusToRussian($order_edge_supply[0]->stts ?? 'Обрабатывается');
|
||||
|
||||
// Инициализация класса для поставки (если необходимо)
|
||||
$css = match ($order_edge_supply[0]->stts ?? '') {
|
||||
'accepted' => ' supply_accepted',
|
||||
default => ''
|
||||
};
|
||||
|
||||
// Реинициализация максимальной даты доставки
|
||||
if ($delivery_max < $time) $delivery_max = $time;
|
||||
|
||||
// Добавление к общему счётчику количества
|
||||
$amount_max += $supply['amount'];
|
||||
|
||||
// Инициализация иконки
|
||||
$icon = $delivery === 'avia' ? 'fa-plane' : 'fa-truck';
|
||||
|
||||
// Генерация HTML (пробела между supply и $css не должно быть)
|
||||
$supplies_html .= <<<HTML
|
||||
<div class="row py-2 supply$css text-center">
|
||||
<div class="m-auto col-2">{$catn}</div>
|
||||
<small class="m-auto col-3">$status</small>
|
||||
<div class="m-auto col-3">$time <small class="mr-1 fas $icon"></small></div>
|
||||
<div class="m-auto col-2">{$supply['amount']}</div>
|
||||
<div class="m-auto col-2">$price</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
// Инициализация общей цены
|
||||
$sum += $price_raw * $supply['amount'];
|
||||
}
|
||||
|
||||
// Инициализация статуса связи поставки
|
||||
$status = OrderEdgeSupply::statusToRussian($edge['stts'] ?? '');
|
||||
|
||||
// Инициализация класса для поставки (если необходимо)
|
||||
$css = match ($edge['stts'] ?? '') {
|
||||
'accepted' => ' supply_accepted',
|
||||
default => ''
|
||||
};
|
||||
|
||||
// Реинициализация максимальной даты доставки
|
||||
if ($delivery_max !== '?' && $delivery_max < $days) $delivery_max = $days;
|
||||
else if ($days === '?') $delivery_max = '?';
|
||||
|
||||
// Инициализация иконки
|
||||
$icon = $delivery === 'avia' ? 'fa-plane' : 'fa-truck';
|
||||
|
||||
// Генерация HTML (пробела между supply и $css не должно быть)
|
||||
$supplies_html .= <<<HTML
|
||||
<div class="row py-2 supply$css text-center">
|
||||
<div class="m-auto col-2">{$catn}</div>
|
||||
<small class="m-auto col-3">$status</small>
|
||||
<div class="m-auto col-3">$days <small class="mr-1 fas $icon"></small></div>
|
||||
<div class="m-auto col-2">{$supply['amount']}</div>
|
||||
<div class="m-auto col-2">$price</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
// Инициализация общей цены
|
||||
$sum += $price_raw * $supply['amount'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,11 +408,11 @@ if (empty($window)) {
|
||||
}
|
||||
|
||||
// Инициализация статуса заказа
|
||||
$status = AccountEdgeOrder::statusToRussian(AccountEdgeOrder::searchByOrder($moderator_data['order']->readId())['stts'] ?? '');
|
||||
$status = Order::statusToRussian($account_edge_order->stts);
|
||||
|
||||
// Инициализация счета для скачивания
|
||||
$invoice = <<<HTML
|
||||
<a class="text-dark" href="/invoices/{$data['order']->_key}/download"><i class="fas fa-file-invoice-dollar"></i></a>
|
||||
<a class="text-dark" href="/invoices/{$data['order']->_key}/download"><i class="mr-1 fas fa-file-invoice-dollar"></i><small><b>Счёт</b></small></a>
|
||||
HTML;
|
||||
|
||||
echo <<<HTML
|
||||
@@ -395,8 +420,8 @@ if (empty($window)) {
|
||||
<div class="row py-2 cart_list_target_total text-center">
|
||||
<div class="col-2">$invoice</div>
|
||||
<div class="col-3"><b>$status</b></div>
|
||||
<div class="col-3"><b>$delivery_max</b></div>
|
||||
<div class="col-2"></div>
|
||||
<div class="col-3"><b>$delivery_max <small><b>(макс.)</b></small></b></div>
|
||||
<div class="col-2"><b>$amount_max <small><b>(макс.)</b></small></b></div>
|
||||
<div class="col-2"><b>$sum <small><b>руб</b></small></b></div>
|
||||
</div>
|
||||
HTML;
|
||||
|
@@ -42,6 +42,7 @@ use app\models\Search;
|
||||
$covr = null;
|
||||
$prod = $row['prod'] ?? 'Неизвестно';
|
||||
$catn = $row['catn'] ?? 'Неизвестно';
|
||||
$name = $row['name'] ?? 'Без названия';
|
||||
|
||||
// Генерация списка товаров
|
||||
$supplies_html = Search::generate($row, $covr, $list);
|
||||
@@ -49,10 +50,10 @@ use app\models\Search;
|
||||
<div class="col mb-2">
|
||||
<div class="row p-2 rounded">
|
||||
<img class="ml-0 rounded" src="<?= $covr ?>" />
|
||||
<div class="col-3 ml-3 p-0 d-flex flex-column row_fixed_height">
|
||||
<div class="col ml-3 p-0 d-flex flex-column row_fixed_height">
|
||||
<a class="my-auto text-dark" href="/product/<?= $prod ?>/<?= $catn ?>">
|
||||
<h5 class="m-0"><?= $catn ?></h5>
|
||||
<h6 class="m-0"><small><?= $prod ?></small></h6>
|
||||
<h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5>
|
||||
<h6 class="m-0"><small><?= $name ?></small></h6>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col ml-3 p-0 d-flex flex-column">
|
||||
@@ -104,6 +105,7 @@ use app\models\Search;
|
||||
$covr = null;
|
||||
$prod = $product['prod'] ?? 'Неизвестно';
|
||||
$catn = $product['catn'] ?? 'Неизвестно';
|
||||
$name = $product['name'] ?? 'Без названия';
|
||||
|
||||
// Генерация списка товаров
|
||||
$supplies_html = Search::generate($product, $covr, analogs: true);
|
||||
@@ -119,10 +121,10 @@ use app\models\Search;
|
||||
<div class="col mb-2">
|
||||
<div class="row p-2 rounded">
|
||||
<img class="ml-0 rounded" src="<?= $covr ?>" />
|
||||
<div class="col-3 ml-3 p-0 d-flex flex-column row_fixed_height">
|
||||
<div class="col ml-3 p-0 d-flex flex-column row_fixed_height">
|
||||
<a class="my-auto text-dark" href="/product/<?= $prod ?>/<?= $catn ?>">
|
||||
<h5 class="m-0"><?= $catn ?></h5>
|
||||
<h6 class="m-0"><small><?= $prod ?></small></h6>
|
||||
<h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5>
|
||||
<h6 class="m-0"><small><?= $name ?></small></h6>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col ml-3 p-0 d-flex flex-column">
|
||||
|
4996
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-grid.rtl.css
vendored
Executable file
4996
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-grid.rtl.css
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-grid.rtl.css.map
Executable file
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-grid.rtl.css.map
Executable file
File diff suppressed because one or more lines are too long
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-grid.rtl.min.css
vendored
Executable file
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-grid.rtl.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
423
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-reboot.rtl.css
vendored
Executable file
423
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-reboot.rtl.css
vendored
Executable file
@@ -0,0 +1,423 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.0.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors
|
||||
* Copyright 2011-2021 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
:root {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
font-size: 1rem;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
color: #212529;
|
||||
background-color: #fff;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 1rem 0;
|
||||
color: inherit;
|
||||
background-color: currentColor;
|
||||
border: 0;
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
hr:not([size]) {
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
h6, h5, h4, h3, h2, h1 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: calc(1.375rem + 1.5vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: calc(1.325rem + 0.9vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: calc(1.3rem + 0.6vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h3 {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
h4 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
abbr[title],
|
||||
abbr[data-bs-original-title] {
|
||||
-webkit-text-decoration: underline dotted;
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
-webkit-text-decoration-skip-ink: none;
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
address {
|
||||
margin-bottom: 1rem;
|
||||
font-style: normal;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul,
|
||||
dl {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
ol ol,
|
||||
ul ul,
|
||||
ol ul,
|
||||
ul ol {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-bottom: 0.5rem;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
mark {
|
||||
padding: 0.2em;
|
||||
background-color: #fcf8e3;
|
||||
}
|
||||
|
||||
sub,
|
||||
sup {
|
||||
position: relative;
|
||||
font-size: 0.75em;
|
||||
line-height: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0d6efd;
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:hover {
|
||||
color: #0a58ca;
|
||||
}
|
||||
|
||||
a:not([href]):not([class]), a:not([href]):not([class]):hover {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
kbd,
|
||||
samp {
|
||||
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 1em;
|
||||
direction: ltr ;
|
||||
unicode-bidi: bidi-override;
|
||||
}
|
||||
|
||||
pre {
|
||||
display: block;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
overflow: auto;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
pre code {
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 0.875em;
|
||||
color: #d63384;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
a > code {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
kbd {
|
||||
padding: 0.2rem 0.4rem;
|
||||
font-size: 0.875em;
|
||||
color: #fff;
|
||||
background-color: #212529;
|
||||
border-radius: 0.2rem;
|
||||
}
|
||||
kbd kbd {
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
|
||||
img,
|
||||
svg {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table {
|
||||
caption-side: bottom;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
caption {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
color: #6c757d;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: inherit;
|
||||
text-align: -webkit-match-parent;
|
||||
}
|
||||
|
||||
thead,
|
||||
tbody,
|
||||
tfoot,
|
||||
tr,
|
||||
td,
|
||||
th {
|
||||
border-color: inherit;
|
||||
border-style: solid;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
button:focus:not(:focus-visible) {
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
optgroup,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
[role=button] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select {
|
||||
word-wrap: normal;
|
||||
}
|
||||
select:disabled {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
[list]::-webkit-calendar-picker-indicator {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button,
|
||||
[type=button],
|
||||
[type=reset],
|
||||
[type=submit] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
button:not(:disabled),
|
||||
[type=button]:not(:disabled),
|
||||
[type=reset]:not(:disabled),
|
||||
[type=submit]:not(:disabled) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::-moz-focus-inner {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
legend {
|
||||
float: right;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: calc(1.275rem + 0.3vw);
|
||||
line-height: inherit;
|
||||
}
|
||||
@media (min-width: 1200px) {
|
||||
legend {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
}
|
||||
legend + * {
|
||||
clear: right;
|
||||
}
|
||||
|
||||
::-webkit-datetime-edit-fields-wrapper,
|
||||
::-webkit-datetime-edit-text,
|
||||
::-webkit-datetime-edit-minute,
|
||||
::-webkit-datetime-edit-hour-field,
|
||||
::-webkit-datetime-edit-day-field,
|
||||
::-webkit-datetime-edit-month-field,
|
||||
::-webkit-datetime-edit-year-field {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::-webkit-inner-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
[type=search] {
|
||||
outline-offset: -2px;
|
||||
-webkit-appearance: textfield;
|
||||
}
|
||||
|
||||
[type="tel"],
|
||||
[type="url"],
|
||||
[type="email"],
|
||||
[type="number"] {
|
||||
direction: ltr;
|
||||
}
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
::-webkit-color-swatch-wrapper {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
::file-selector-button {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
font: inherit;
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
output {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */
|
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-reboot.rtl.css.map
Executable file
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-reboot.rtl.css.map
Executable file
File diff suppressed because one or more lines are too long
8
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-reboot.rtl.min.css
vendored
Executable file
8
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-reboot.rtl.min.css
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Bootstrap Reboot v5.0.1 (https://getbootstrap.com/)
|
||||
* Copyright 2011-2021 The Bootstrap Authors
|
||||
* Copyright 2011-2021 Twitter, Inc.
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
|
||||
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
|
||||
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */
|
File diff suppressed because one or more lines are too long
4752
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.css
vendored
Executable file
4752
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.css
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.css.map
Executable file
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.css.map
Executable file
File diff suppressed because one or more lines are too long
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.min.css
vendored
Executable file
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4743
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.rtl.css
vendored
Executable file
4743
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.rtl.css
vendored
Executable file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.rtl.min.css
vendored
Executable file
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap-utilities.rtl.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10796
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.css
vendored
Executable file
10796
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.css
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.css.map
Executable file
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.css.map
Executable file
File diff suppressed because one or more lines are too long
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.min.css
vendored
Executable file
7
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.min.css.map
Executable file
1
mirzaev/skillparts/system/web/css/bootstrap/bootstrap.rtl.min.css.map
Executable file
File diff suppressed because one or more lines are too long
1
mirzaev/skillparts/system/web/img/.gitignore
vendored
1
mirzaev/skillparts/system/web/img/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
/products
|
||||
/supplies/*/
|
||||
|
4946
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.js
vendored
Executable file
4946
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.js.map
Executable file
1
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.js.map
Executable file
File diff suppressed because one or more lines are too long
7
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.min.js
vendored
Executable file
7
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
1
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.min.js.map
Executable file
1
mirzaev/skillparts/system/web/js/bootstrap/bootstrap.esm.min.js.map
Executable file
File diff suppressed because one or more lines are too long
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Записать в корзину (создать корзину, если не существует)
|
||||
*/
|
||||
function cart_write(supply_id, delivery_type, amount = 1) {
|
||||
function cart_write(supply_id, delivery, amount = 1) {
|
||||
// Инициализация
|
||||
let data = {};
|
||||
data['supply_id'] = supply_id;
|
||||
data['amount'] = amount;
|
||||
data['delivery_type'] = delivery_type;
|
||||
data['delivery'] = delivery;
|
||||
data['_csrf'] = yii.getCsrfToken();
|
||||
|
||||
$.ajax({
|
||||
@@ -190,13 +190,15 @@ function cart_list_amount_update(target, type, input) {
|
||||
* Подсчёт стоимости
|
||||
*/
|
||||
function cart_cost_calculate() {
|
||||
let elements = document.getElementsByClassName('cart_list_target');
|
||||
let reg = /^([0-9]*)\s*\w*/;
|
||||
const elements = document.getElementsByClassName('cart_list_target');
|
||||
const reg = /^([0-9]*)\s*\w*/;
|
||||
let costs = 0;
|
||||
|
||||
for ($i = 0; $i < elements.length; $i++) {
|
||||
let cost = elements[$i].getElementsByTagName('div')[7].innerText;
|
||||
let amount = elements[$i].getElementsByTagName('div')[5].children[0].value;
|
||||
// Перебор товаров в корзине
|
||||
|
||||
const cost = elements[$i].getElementsByTagName('div')[8].innerText;
|
||||
const amount = elements[$i].getElementsByTagName('div')[6].children[0].value;
|
||||
|
||||
costs += +reg.exec(cost)[1] * amount;
|
||||
};
|
||||
|
@@ -138,7 +138,7 @@ function cart_count() {
|
||||
button_old.remove();
|
||||
|
||||
// Реинициализация
|
||||
$('#cart_button').dropdown().init();
|
||||
// $('#cart_button').dropdown().init();
|
||||
};
|
||||
};
|
||||
|
||||
@@ -161,7 +161,7 @@ function cart_count() {
|
||||
button_old.remove();
|
||||
|
||||
// Реинициализация
|
||||
$('#cart_button').dropdown().init();
|
||||
// $('#cart_button').dropdown().init();
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// Запросить заказы
|
||||
function orders_read(search = '@last', type = '@last', from = '@last', to = '@last', window = 'orders_panel_orders') {
|
||||
function orders_read(search = '@last', stts = '@last', from = '@last', to = '@last', window = 'orders_panel_orders') {
|
||||
// '@last' - оставить без изменений и взять данные из cookie
|
||||
|
||||
if (search.length > 1) {
|
||||
@@ -8,24 +8,21 @@ function orders_read(search = '@last', type = '@last', from = '@last', to = '@la
|
||||
// Инициализация буфера с данными запроса
|
||||
data = {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'search': search,
|
||||
'from': from,
|
||||
'to': to,
|
||||
'window': window
|
||||
search,
|
||||
from,
|
||||
to,
|
||||
window
|
||||
};
|
||||
|
||||
// Запрос
|
||||
$.ajax({
|
||||
url: '/orders/' + type,
|
||||
url: '/orders/' + stts,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: orders_response_success,
|
||||
error: orders_response_error
|
||||
});
|
||||
|
||||
// // Пересчитывание стоимости
|
||||
// cart_cost_calculate();
|
||||
};
|
||||
|
||||
return false;
|
||||
|
@@ -1,15 +1,15 @@
|
||||
function order_init(order_key) {
|
||||
function order_init(order) {
|
||||
// Инициализация панели
|
||||
let panel = document.getElementById(order_key + '_panel');
|
||||
const panel = document.getElementById(order + '_panel');
|
||||
|
||||
// Инициализация кнопки
|
||||
let button = document.getElementById(order_key + '_button');
|
||||
const button = document.getElementById(order + '_button');
|
||||
|
||||
let supplies_are_confirmed = true;
|
||||
|
||||
for (let i = 0; i <= panel.children[2].children[0].children.length - 1; i++) {
|
||||
// Инициализация
|
||||
let target = panel.children[2].children[0].children[i];
|
||||
const target = panel.children[2].children[0].children[i];
|
||||
|
||||
if ((target === undefined || target.children[1] === undefined || target.children[1].children[0] === undefined) && !target.classList.contains('dropdown-divider')) {
|
||||
|
||||
@@ -25,9 +25,10 @@ function order_init(order_key) {
|
||||
return false;
|
||||
};
|
||||
|
||||
function order_accept(order_key) {
|
||||
|
||||
function order_accept(order) {
|
||||
$.ajax({
|
||||
url: 'orders/' + order_key + '/accept',
|
||||
url: 'orders/' + order + '/accept',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
@@ -40,304 +41,333 @@ function order_accept(order_key) {
|
||||
return false;
|
||||
};
|
||||
|
||||
function orders_supply_edit(type, supply_key, order_key) {
|
||||
// Инициализация
|
||||
let supply = document.getElementById(supply_key + '_supply');
|
||||
function orders_supply_edit(order, prod, catn, delivery) {
|
||||
if (typeof order === 'string' && typeof prod === 'string' && typeof catn === 'string' && typeof delivery === 'string') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Поиск панели для вывода информации
|
||||
let panel = document.getElementById('orders_panel_edit_' + order_key);
|
||||
// Инициализация
|
||||
const supply = document.getElementById(`${order}_${prod}_${catn}_${delivery}_supply`);
|
||||
|
||||
// Поиск всех кнопок с поставками
|
||||
let rows = document.getElementsByClassName('row_supply');
|
||||
// Поиск панели для вывода информации
|
||||
const panel = document.getElementById('orders_panel_edit_' + order);
|
||||
|
||||
// Деактивация остальных кнопок
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (rows[i].parentElement.getAttribute('id') === 'orders_panel_supplies_' + order_key) {
|
||||
// Если это кнопка конкретно с этого заказа
|
||||
// Поиск всех кнопок с поставками
|
||||
const rows = document.getElementsByClassName('row_supply');
|
||||
|
||||
rows[i].classList.remove('row_supply_active');
|
||||
// Деактивация остальных кнопок
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (rows[i].parentElement.getAttribute('id') === 'orders_panel_supplies_' + order) {
|
||||
// Если это кнопка конкретно с этого заказа
|
||||
|
||||
rows[i].classList.remove('row_supply_active');
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Активация выбранной кнопки
|
||||
supply.classList.add('row_supply_active');
|
||||
// Активация выбранной кнопки
|
||||
supply.classList.add('row_supply_active');
|
||||
|
||||
// Запись индикатора загрузки
|
||||
panel.innerHTML = '<p class="my-auto">Загрузка</p>';
|
||||
// Запись индикатора загрузки
|
||||
panel.innerHTML = '<p class="my-auto">Загрузка</p>';
|
||||
|
||||
$.ajax({
|
||||
url: 'orders/supply/' + supply_key + '/read',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken()
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
// Удаление индикатора загрузки
|
||||
panel.innerHTML = '';
|
||||
$.ajax({
|
||||
url: `orders/supply/${order}/${prod}/${catn}/${delivery}/read`,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken()
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
// Удаление индикатора загрузки
|
||||
panel.innerHTML = '';
|
||||
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
|
||||
// Идентификатор
|
||||
if (document.getElementById(supply.getAttribute('id') + '_id') === null) {
|
||||
// Инициализация контейнера
|
||||
let container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_id');
|
||||
container.setAttribute('class', 'row mb-1 px-3');
|
||||
// Идентификатор
|
||||
if (typeof data.id !== 'undefined' && document.getElementById(supply.getAttribute('id') + '_id') === null) {
|
||||
// Инициализация контейнера
|
||||
const container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_id');
|
||||
container.setAttribute('class', 'row px-3');
|
||||
|
||||
// Инициализация названия
|
||||
let name = document.createElement('p');
|
||||
name.setAttribute('id', supply.getAttribute('id') + '_id_name');
|
||||
name.setAttribute('class', 'col-auto px-0 ml-0 mr-2');
|
||||
name.innerText = 'Идентификатор:';
|
||||
// Инициализация названия
|
||||
const name = document.createElement('p');
|
||||
name.setAttribute('id', supply.getAttribute('id') + '_id_name');
|
||||
name.setAttribute('class', 'col-auto px-0 ml-0 mr-2');
|
||||
name.innerText = 'Идентификатор:';
|
||||
|
||||
// Инициализация идентификатора
|
||||
let text = document.createElement('p');
|
||||
text.setAttribute('id', supply.getAttribute('id') + '_id_value');
|
||||
text.setAttribute('class', 'col-auto px-0 mx-0 font-weight-bold');
|
||||
if (data.id !== undefined) {
|
||||
text.innerText = '#' + data.id;
|
||||
} else {
|
||||
text.innerText = 'Неизвестно';
|
||||
// Инициализация идентификатора
|
||||
const text = document.createElement('p');
|
||||
text.setAttribute('id', supply.getAttribute('id') + '_id_value');
|
||||
text.setAttribute('class', 'col-auto px-0 mr-0 font-weight-bold');
|
||||
if (data.id !== undefined) {
|
||||
text.innerText = '#' + data.id;
|
||||
} else {
|
||||
text.innerText = 'Неизвестно';
|
||||
};
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(name);
|
||||
container.appendChild(text);
|
||||
};
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(name);
|
||||
container.appendChild(text);
|
||||
};
|
||||
// Разделитель статического информационного блока от блока с динамическими данными
|
||||
if (document.getElementById(supply.getAttribute('id') + '_info_divider') === null) {
|
||||
// Инициализация контейнера
|
||||
let divider = document.createElement('div');
|
||||
divider.setAttribute('id', supply.getAttribute('id') + '_info_divider');
|
||||
divider.setAttribute('class', 'dropdown-divider mb-2');
|
||||
|
||||
// // Разделитель статического информационного блока от блока с динамическими данными
|
||||
// if (document.getElementById(supply.getAttribute('id') + '_info_divider') === null) {
|
||||
// // Инициализация контейнера
|
||||
// let divider = document.createElement('div');
|
||||
// divider.setAttribute('id', supply.getAttribute('id') + '_info_divider');
|
||||
// divider.setAttribute('class', 'dropdown-divider mb-2');;
|
||||
|
||||
// // Запись в документ
|
||||
// panel.appendChild(divider);
|
||||
// };
|
||||
|
||||
// Цена
|
||||
if (document.getElementById(supply.getAttribute('id') + '_cost') === null) {
|
||||
// Инициализация контейнера
|
||||
let container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_cost');
|
||||
container.setAttribute('class', 'row px-3');
|
||||
|
||||
// Инициализация названия
|
||||
let name = document.createElement('p');
|
||||
name.setAttribute('id', supply.getAttribute('id') + '_cost_name');
|
||||
name.setAttribute('class', 'col-auto px-0 ml-0 mr-2');
|
||||
name.innerText = 'Цена';
|
||||
|
||||
// Инициализация поля
|
||||
let input = document.createElement('input');
|
||||
input.setAttribute('id', supply.getAttribute('id') + '_cost_input');
|
||||
input.setAttribute('class', 'col-2 text-center form-control-plaintext');
|
||||
input.setAttribute('type', 'number');
|
||||
input.setAttribute('onchange', 'return orders_supply_cost_edit(' + supply_key + ', this);');
|
||||
if (data.cost !== undefined) {
|
||||
input.setAttribute('value', data.cost);
|
||||
} else {
|
||||
input.setAttribute('value', 0);
|
||||
};
|
||||
input.setAttribute('aria-invalid', 'false');
|
||||
|
||||
// Инициализация дополнительных данных
|
||||
let info = document.createElement('p');
|
||||
info.setAttribute('class', 'col-auto px-0 ml-2 mr-0');
|
||||
info.innerText = 'рублей';
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(name);
|
||||
container.appendChild(input);
|
||||
container.appendChild(info);
|
||||
};
|
||||
|
||||
// Время доставки
|
||||
if (document.getElementById(supply.getAttribute('id') + '_time') === null) {
|
||||
// Инициализация контейнера
|
||||
let container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_time');
|
||||
container.setAttribute('class', 'row mb-2 px-3');
|
||||
|
||||
// Инициализация названия
|
||||
let name = document.createElement('p');
|
||||
name.setAttribute('id', supply.getAttribute('id') + '_time_name');
|
||||
name.setAttribute('class', 'col-auto px-0 ml-0 mr-2');
|
||||
name.innerText = 'Время';
|
||||
|
||||
// Инициализация поля
|
||||
let input = document.createElement('input');
|
||||
input.setAttribute('id', supply.getAttribute('id') + '_time_input');
|
||||
input.setAttribute('class', 'col-1 text-center form-control-plaintext');
|
||||
input.setAttribute('type', 'number');
|
||||
input.setAttribute('onchange', 'return orders_supply_time_edit(' + supply_key + ', this);')
|
||||
if (data.time !== undefined) {
|
||||
input.setAttribute('value', data.time);
|
||||
} else {
|
||||
input.setAttribute('value', 0);
|
||||
};
|
||||
input.setAttribute('aria-invalid', 'false');
|
||||
|
||||
// Инициализация дополнительных данных
|
||||
let info = document.createElement('p');
|
||||
info.setAttribute('class', 'col-auto px-0 ml-2 mr-0');
|
||||
info.innerText = 'дней';
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(name);
|
||||
container.appendChild(input);
|
||||
container.appendChild(info);
|
||||
};
|
||||
|
||||
// Комментарий
|
||||
if (document.getElementById(supply.getAttribute('id') + '_comm') === null) {
|
||||
// Инициализация контейнера
|
||||
let container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_comm');
|
||||
container.setAttribute('class', 'row mb-3 px-3');
|
||||
|
||||
// Инициализация поля
|
||||
let textarea = document.createElement('textarea');
|
||||
textarea.setAttribute('id', supply.getAttribute('id') + '_comm_input');
|
||||
textarea.setAttribute('class', 'col-12 form-control');
|
||||
textarea.setAttribute('cols', '50');
|
||||
textarea.setAttribute('rows', '3');
|
||||
textarea.setAttribute('onchange', 'return orders_supply_comm_edit(' + supply_key + ', this);')
|
||||
if (data.comm === undefined) {
|
||||
textarea.value = 'Комментарий к заказу';
|
||||
} else {
|
||||
textarea.value = data.comm;
|
||||
// Запись в документ
|
||||
panel.appendChild(divider);
|
||||
};
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(textarea);
|
||||
};
|
||||
// Цена
|
||||
if (typeof data.cost !== 'undefined' && document.getElementById(supply.getAttribute('id') + '_cost') === null) {
|
||||
// Инициализация контейнера
|
||||
const container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_cost');
|
||||
container.setAttribute('class', 'row px-3');
|
||||
|
||||
// Статус подтверждения
|
||||
if (document.getElementById(supply.getAttribute('id') + '_stts') === null) {
|
||||
// Инициализация контейнера
|
||||
let container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_stts');
|
||||
container.setAttribute('class', 'row px-3');
|
||||
// Инициализация названия
|
||||
const name = document.createElement('p');
|
||||
name.setAttribute('id', supply.getAttribute('id') + '_cost_name');
|
||||
name.setAttribute('class', 'col-auto px-0 ml-0 mr-2');
|
||||
name.innerText = 'Цена:';
|
||||
|
||||
// Инициализация индикатора
|
||||
let span = document.createElement('span');
|
||||
span.setAttribute('id', supply.getAttribute('id') + '_' + type + '_supply_stts_indicator_icon');
|
||||
span.setAttribute('class', 'ml-auto my-auto fas fa-check');
|
||||
// Инициализация поля
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('id', supply.getAttribute('id') + '_cost_input');
|
||||
input.setAttribute('class', 'col-2 ml-auto text-center form-control-plaintext');
|
||||
input.setAttribute('type', 'number');
|
||||
input.setAttribute('onblur', `return orders_supply_cost_edit('${order}', '${prod}', '${catn}', '${delivery}', this);`);
|
||||
if (data.cost !== undefined) {
|
||||
input.setAttribute('value', data.cost);
|
||||
} else {
|
||||
input.setAttribute('value', 0);
|
||||
};
|
||||
input.setAttribute('aria-invalid', 'false');
|
||||
input.setAttribute('data-old-value', input.value);
|
||||
|
||||
// Инициализация кнопки
|
||||
let button = document.createElement('a');
|
||||
button.setAttribute('id', supply.getAttribute('id') + '_stts_button');
|
||||
button.setAttribute('type', 'button');
|
||||
button.setAttribute('role', 'button');
|
||||
button.setAttribute('onclick', 'return orders_supply_comm_write(this, \'' + type + '\' \'' + supply_key + '\', \'' + order_key + '\');');
|
||||
if (data.stts === undefined || data.stts == 0) {
|
||||
button.setAttribute('class', 'col-12 btn button_blue button_clean');
|
||||
button.innerText = 'Подтвердить';
|
||||
} else {
|
||||
button.setAttribute('class', 'col-12 btn button_blue button_clean disabled');
|
||||
button.innerText = 'Подтверждено';
|
||||
// Инициализация дополнительных данных
|
||||
const info = document.createElement('p');
|
||||
info.setAttribute('class', 'col-auto px-0 ml-2 mr-0');
|
||||
info.innerText = 'рублей';
|
||||
|
||||
// Инициализация
|
||||
let title = document.getElementById(supply.getAttribute('id') + '_' + type + '_supply_stts_indicator');
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(name);
|
||||
container.appendChild(input);
|
||||
container.appendChild(info);
|
||||
};
|
||||
|
||||
if (title.children[1] === undefined) {
|
||||
// Индикатор не найден
|
||||
// Время доставки
|
||||
if (typeof data.time !== 'undefined' && document.getElementById(supply.getAttribute('id') + '_time') === null) {
|
||||
// Инициализация контейнера
|
||||
const container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_time');
|
||||
container.setAttribute('class', 'row px-3 pb-1');
|
||||
|
||||
// Запись индикатора
|
||||
title.appendChild(span);
|
||||
// Инициализация названия
|
||||
const name = document.createElement('p');
|
||||
name.setAttribute('id', supply.getAttribute('id') + '_time_name');
|
||||
name.setAttribute('class', 'col-auto px-0 ml-0 mr-2');
|
||||
name.innerText = 'Доставка:';
|
||||
|
||||
// Инициализация поля
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('id', supply.getAttribute('id') + '_time_input');
|
||||
input.setAttribute('class', 'col-2 ml-auto text-center form-control-plaintext');
|
||||
input.setAttribute('type', 'number');
|
||||
input.setAttribute('onblur', `return orders_supply_time_edit('${order}', '${prod}', '${catn}', '${delivery}', this);`)
|
||||
if (data.time !== undefined) {
|
||||
input.setAttribute('value', data.time);
|
||||
} else {
|
||||
input.setAttribute('value', 0);
|
||||
};
|
||||
input.setAttribute('aria-invalid', 'false');
|
||||
input.setAttribute('data-old-value', input.value);
|
||||
|
||||
// Инициализация дополнительных данных
|
||||
const info = document.createElement('p');
|
||||
info.setAttribute('class', 'col-auto px-0 ml-2 mr-0');
|
||||
info.innerText = 'дней (+1)';
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(name);
|
||||
container.appendChild(input);
|
||||
container.appendChild(info);
|
||||
};
|
||||
|
||||
// Количество
|
||||
if (typeof data.amnt !== 'undefined' && document.getElementById(supply.getAttribute('id') + '_amnt') === null) {
|
||||
// Инициализация контейнера
|
||||
const container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_amnt');
|
||||
container.setAttribute('class', 'row mb-2 px-3');
|
||||
|
||||
// Инициализация названия
|
||||
const name = document.createElement('p');
|
||||
name.setAttribute('id', supply.getAttribute('id') + '_amnt_name');
|
||||
name.setAttribute('class', 'col-auto px-0 ml-0 mr-2');
|
||||
name.innerText = 'Количество:';
|
||||
|
||||
// Инициализация поля
|
||||
const input = document.createElement('input');
|
||||
input.setAttribute('id', supply.getAttribute('id') + '_amnt_input');
|
||||
input.setAttribute('class', 'col-2 ml-auto text-center form-control-plaintext');
|
||||
input.setAttribute('type', 'number');
|
||||
input.setAttribute('onblur', `return orders_supply_amnt_edit('${order}', '${prod}', '${catn}', '${delivery}', this);`)
|
||||
if (data.amnt !== undefined) {
|
||||
input.setAttribute('value', data.amnt);
|
||||
} else {
|
||||
input.setAttribute('value', 0);
|
||||
};
|
||||
input.setAttribute('aria-invalid', 'false');
|
||||
input.setAttribute('data-old-value', input.value);
|
||||
|
||||
// Инициализация дополнительных данных
|
||||
const info = document.createElement('p');
|
||||
info.setAttribute('class', 'col-auto px-0 ml-2 mr-0');
|
||||
info.innerText = 'шт';
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(name);
|
||||
container.appendChild(input);
|
||||
container.appendChild(info);
|
||||
};
|
||||
|
||||
// Статус
|
||||
if (typeof data.stts !== 'undefined' && document.getElementById(supply.getAttribute('id') + '_status') === null) {
|
||||
// Инициализация контейнера
|
||||
const container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_status');
|
||||
container.setAttribute('class', 'row mb-2 px-3');
|
||||
|
||||
// Инициализация поля
|
||||
const select = document.createElement('select');
|
||||
select.setAttribute('id', supply.getAttribute('id') + '_status_select');
|
||||
select.setAttribute('class', 'form-control');
|
||||
select.setAttribute('onchange', `return orders_supply_status_edit('${order}', '${prod}', '${catn}', '${delivery}', this);`)
|
||||
select.setAttribute('data-old-value', select.value);
|
||||
|
||||
// Запись в документ
|
||||
container.appendChild(select);
|
||||
|
||||
const options = {
|
||||
processing: 'Обрабатывается',
|
||||
requested: 'Запрошен',
|
||||
accepted: 'Ожидается отправка',
|
||||
going: 'Доставляется',
|
||||
received: 'Получено'
|
||||
}
|
||||
|
||||
for (const name in options) {
|
||||
// Перебор параметров
|
||||
|
||||
// Инициализация параметра
|
||||
const option = document.createElement('option');
|
||||
option.value = name;
|
||||
option.innerText = options[name];
|
||||
|
||||
// Запись в документ
|
||||
select.appendChild(option);
|
||||
}
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
|
||||
// Выбор активного параметра
|
||||
if (typeof data.stts === 'string') {
|
||||
select.value = data.stts;
|
||||
} else {
|
||||
input.value = 0;
|
||||
};
|
||||
};
|
||||
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(button);
|
||||
// Комментарий
|
||||
if (typeof data.comm !== 'undefined' && document.getElementById(supply.getAttribute('id') + '_comm') === null) {
|
||||
// Инициализация контейнера
|
||||
const container = document.createElement('div');
|
||||
container.setAttribute('id', supply.getAttribute('id') + '_comm');
|
||||
container.setAttribute('class', 'row mb-2 px-3');
|
||||
|
||||
// Реинициализация
|
||||
order_init(order_key);
|
||||
};
|
||||
};
|
||||
// Инициализация поля
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.setAttribute('id', supply.getAttribute('id') + '_comm_input');
|
||||
textarea.setAttribute('class', 'col-12 form-control');
|
||||
textarea.setAttribute('cols', '50');
|
||||
textarea.setAttribute('rows', '3');
|
||||
textarea.setAttribute('onblur', `return orders_supply_comm_edit('${order}', '${prod}', '${catn}', '${delivery}', this);`)
|
||||
if (typeof data.comm === 'string') textarea.value = data.comm;
|
||||
textarea.setAttribute('placeholder', 'Комментарий к поставке (для покупателя)')
|
||||
textarea.setAttribute('data-old-value', textarea.value);
|
||||
|
||||
orders_response_success(data, status, xhr);
|
||||
},
|
||||
error: orders_response_error
|
||||
});
|
||||
// Запись в документ
|
||||
panel.appendChild(container);
|
||||
container.appendChild(textarea);
|
||||
};
|
||||
|
||||
return false;
|
||||
};
|
||||
const small = document.createElement('small');
|
||||
small.setAttribute('class', 'text-center');
|
||||
|
||||
function orders_supply_comm_write(button, type, supply_key, order_key) {
|
||||
// Инициализация
|
||||
let supply = document.getElementById(supply_key + '_supply');
|
||||
const b = document.createElement('b');
|
||||
b.innerText = 'Покупатель будет уведомлён при изменении параметров';
|
||||
|
||||
$.ajax({
|
||||
url: 'orders/supply/' + supply_key + '/write/stts',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'stts': 'accepted'
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
// Инициализация индикатора
|
||||
let span = document.createElement('span');
|
||||
span.setAttribute('id', supply.getAttribute('id') + '_' + type + '_supply_stts_indicator_icon');
|
||||
span.setAttribute('class', 'ml-auto my-auto fas fa-check');
|
||||
|
||||
if (data.stts === undefined || data.stts == 0) {
|
||||
button.setAttribute('class', 'col-12 btn button_blue button_clean');
|
||||
button.innerText = 'Подтвердить';
|
||||
} else {
|
||||
button.setAttribute('class', 'col-12 btn button_blue button_clean disabled');
|
||||
button.innerText = 'Подтверждено';
|
||||
|
||||
// Инициализация
|
||||
let title = document.getElementById(supply.getAttribute('id') + '_' + type + '_supply_stts_indicator');
|
||||
|
||||
if (title.children[0] === undefined) {
|
||||
// Индикатор не найден
|
||||
|
||||
// Запись индикатора
|
||||
title.appendChild(span);
|
||||
small.appendChild(b);
|
||||
panel.appendChild(small);
|
||||
};
|
||||
|
||||
// Реинициализация
|
||||
order_init(order_key);
|
||||
};
|
||||
|
||||
orders_response_success(data, status, xhr);
|
||||
},
|
||||
error: orders_response_error
|
||||
});
|
||||
orders_response_success(data, status, xhr);
|
||||
},
|
||||
error: orders_response_error
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Изменить цену товара в заказе
|
||||
* Изменить комментарий к поставке заказа
|
||||
*
|
||||
* @param {*} order
|
||||
* @param {*} prod
|
||||
* @param {*} catn
|
||||
* @param {*} delivery
|
||||
* @param {*} element
|
||||
* @returns
|
||||
*/
|
||||
function orders_supply_cost_edit(supply_key, input) {
|
||||
if (supply_key !== undefined && input !== undefined) {
|
||||
// Обработка входных параметров
|
||||
function orders_supply_comm_edit(order, prod, catn, delivery, element) {
|
||||
if (typeof order === 'string' && typeof prod === 'string' && typeof catn === 'string' && typeof delivery === 'string' && typeof element === 'object') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Проверка на наличие изменений
|
||||
if (element.value === element.getAttribute('data-old-value')) return false;
|
||||
|
||||
$.ajax({
|
||||
url: '/orders/supply/' + supply_key + '/edit/cost',
|
||||
url: `orders/supply/${order}/${prod}/${catn}/${delivery}/edit/comm`,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'cost': input.value
|
||||
'comm': element.value
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
if (data.cost !== undefined) {
|
||||
input.value = data.cost;
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
|
||||
if (data.comm !== undefined) {
|
||||
// Получен комментарий
|
||||
|
||||
// Реинициализация параметра
|
||||
element.value = data.comm;
|
||||
|
||||
// Запись метаданных
|
||||
element.setAttribute('data-old-value', data.comm);
|
||||
};
|
||||
};
|
||||
|
||||
orders_response_success(data, status, xhr);
|
||||
@@ -346,8 +376,48 @@ function orders_supply_cost_edit(supply_key, input) {
|
||||
});
|
||||
};
|
||||
|
||||
// Пересчитывание стоимости
|
||||
cart_cost_calculate();
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Изменить цену поставки в заказе
|
||||
*/
|
||||
function orders_supply_cost_edit(order, prod, catn, delivery, element) {
|
||||
if (typeof order === 'string' && typeof prod === 'string' && typeof catn === 'string' && typeof delivery === 'string' && typeof element === 'object') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Проверка на наличие изменений
|
||||
if (element.value === element.getAttribute('data-old-value')) return false;
|
||||
|
||||
$.ajax({
|
||||
url: `orders/supply/${order}/${prod}/${catn}/${delivery}/edit/cost`,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'cost': element.value
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
|
||||
if (data.cost !== undefined) {
|
||||
// Получена цена
|
||||
|
||||
// Реинициализация параметра
|
||||
element.value = data.cost;
|
||||
|
||||
// Запись метаданных
|
||||
element.setAttribute('data-old-value', data.cost);
|
||||
};
|
||||
};
|
||||
|
||||
orders_response_success(data, status, xhr);
|
||||
},
|
||||
error: orders_response_error
|
||||
});
|
||||
};
|
||||
|
||||
return false;
|
||||
};
|
||||
@@ -355,24 +425,33 @@ function orders_supply_cost_edit(supply_key, input) {
|
||||
/**
|
||||
* Изменить время доставки товара в заказе
|
||||
*/
|
||||
function orders_supply_time_edit(supply_key, input) {
|
||||
if (supply_key !== undefined && input !== undefined) {
|
||||
// Обработка входных параметров
|
||||
function orders_supply_time_edit(order, prod, catn, delivery, element) {
|
||||
if (typeof order === 'string' && typeof prod === 'string' && typeof catn === 'string' && typeof delivery === 'string' && typeof element === 'object') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Проверка на наличие изменений
|
||||
if (element.value === element.getAttribute('data-old-value')) return false;
|
||||
|
||||
$.ajax({
|
||||
url: '/orders/supply/' + supply_key + '/edit/time',
|
||||
url: `orders/supply/${order}/${prod}/${catn}/${delivery}/edit/time`,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'time': input.value
|
||||
'time': element.value
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
|
||||
if (data.time !== undefined) {
|
||||
input.value = data.time;
|
||||
// Получено время
|
||||
|
||||
// Реинициализация параметра
|
||||
element.value = data.time;
|
||||
|
||||
// Запись метаданных
|
||||
element.setAttribute('data-old-value', data.time);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -382,44 +461,133 @@ function orders_supply_time_edit(supply_key, input) {
|
||||
});
|
||||
};
|
||||
|
||||
// Пересчитывание стоимости
|
||||
cart_cost_calculate();
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Изменить комментарий товара в заказе
|
||||
* Изменить количество товара в заказе
|
||||
*/
|
||||
function orders_supply_comm_edit(supply_key, input) {
|
||||
if (supply_key !== undefined && input !== undefined) {
|
||||
// Обработка входных параметров
|
||||
function orders_supply_amnt_edit(order, prod, catn, delivery, element) {
|
||||
if (typeof order === 'string' && typeof prod === 'string' && typeof catn === 'string' && typeof delivery === 'string' && typeof element === 'object') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Проверка на наличие изменений
|
||||
if (element.value === element.getAttribute('data-old-value')) return false;
|
||||
|
||||
$.ajax({
|
||||
url: '/orders/supply/' + supply_key + '/edit/comm',
|
||||
url: `orders/supply/${order}/${prod}/${catn}/${delivery}/edit/amnt`,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'comm': input.value
|
||||
'amnt': element.value
|
||||
},
|
||||
success: function (data, status) {
|
||||
success: function (data, status, xhr) {
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
|
||||
if (data.comm !== undefined) {
|
||||
input.value = data.comm;
|
||||
if (data.amnt !== undefined) {
|
||||
// Получено время
|
||||
|
||||
// Реинициализация параметра
|
||||
element.value = data.amnt;
|
||||
|
||||
// Запись метаданных
|
||||
element.setAttribute('data-old-value', data.amnt);
|
||||
};
|
||||
};
|
||||
|
||||
orders_response_success(data, status);
|
||||
orders_response_success(data, status, xhr);
|
||||
},
|
||||
error: orders_response_error
|
||||
});
|
||||
};
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Изменить время доставки товара в заказе
|
||||
*/
|
||||
function orders_status_edit(order, element) {
|
||||
if (typeof order === 'string' && typeof element === 'object') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Проверка на наличие изменений
|
||||
if (element.value === element.getAttribute('data-old-value')) return false;
|
||||
|
||||
$.ajax({
|
||||
url: `/orders/${order}/edit/stts`,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'stts': element.value
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
|
||||
if (data.stts !== undefined) {
|
||||
// Получен статус
|
||||
|
||||
// Реинициализация параметра
|
||||
element.value = data.stts;
|
||||
|
||||
// Запись метаданных
|
||||
element.setAttribute('data-old-value', data.stts);
|
||||
};
|
||||
};
|
||||
|
||||
orders_response_success(data, status, xhr);
|
||||
},
|
||||
error: orders_response_error
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Изменить время доставки товара в заказе
|
||||
*/
|
||||
function orders_supply_status_edit(order, prod, catn, delivery, element) {
|
||||
if (typeof order === 'string' && typeof prod === 'string' && typeof catn === 'string' && typeof delivery === 'string' && typeof element === 'object') {
|
||||
// Получены входные параметры
|
||||
|
||||
// Проверка на наличие изменений
|
||||
if (element.value === element.getAttribute('data-old-value')) return false;
|
||||
|
||||
$.ajax({
|
||||
url: `orders/supply/${order}/${prod}/${catn}/${delivery}/edit/stts`,
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'_csrf': yii.getCsrfToken(),
|
||||
'stts': element.value
|
||||
},
|
||||
success: function (data, status, xhr) {
|
||||
if (data !== undefined) {
|
||||
// Получены данные с сервера
|
||||
|
||||
if (data.stts !== undefined) {
|
||||
// Получен статус
|
||||
|
||||
// Реинициализация параметра
|
||||
element.value = data.stts;
|
||||
|
||||
// Запись метаданных
|
||||
element.setAttribute('data-old-value', data.stts);
|
||||
};
|
||||
};
|
||||
|
||||
orders_response_success(data, status, xhr);
|
||||
},
|
||||
error: orders_response_error
|
||||
});
|
||||
};
|
||||
|
||||
// Пересчитывание стоимости
|
||||
cart_cost_calculate();
|
||||
|
||||
return false;
|
||||
};
|
||||
|
Reference in New Issue
Block a user