Добавлены производители в фильтр

This commit is contained in:
root 2022-11-17 06:12:15 +00:00
parent c41e5d4c1c
commit ebf21a0642
6 changed files with 275 additions and 12 deletions

View File

@ -471,7 +471,7 @@ class Supply extends Product implements ProductInterface, OfferInterface
} }
// Макрос действий после импорта // Макрос действий после импорта
static::afterImportExcel($warehouse); static::afterImportExcel($account, $warehouse);
return true; return true;
} }
@ -590,10 +590,267 @@ class Supply extends Product implements ProductInterface, OfferInterface
// Запись производителя в буфер // Запись производителя в буфер
$_row['prod'] = match($prod = ucwords(strtolower(preg_replace('/[^A-zА-я\s]/', ' ', $prod, 300)))) { $_row['prod'] = match($prod = ucwords(strtolower(preg_replace('/[^A-zА-я\s]/', ' ', $prod, 300)))) {
'Сatterpillar', 'Cat' => 'CAT', 'Akebono' => 'AKEBONO',
'Bosch' => 'BOSCH',
'Brembo' => 'BREMBO',
'Ctr' => 'CTR',
'Delphi' => 'DELPHI',
'Gates' => 'GATES',
'Hella' => 'HELLA',
'Kyb' => 'KYB',
'Mando' => 'MANDO',
'Mk Kachiyama', 'Mk-kachiyama', 'Mk-Kachiyama' => 'MK KACHIYAMA',
'Narva' => 'NARVA',
'Ngk' => 'NGK',
'Nk' => 'NK',
'Osram' => 'OSRAM',
'Philips' => 'PHILIPS',
'Rancho' => 'RANCHO',
'Sangsin' => 'SANGSIN',
'Swag' => 'SWAG',
'Trw' => 'TRW',
'Filtron' => 'FILTRON',
'Ajusa' => 'AJUSA',
'Denso' => 'DENSO',
'Dolz' => 'DOLZ',
'Era' => 'ERA',
'Febest' => 'FEBEST',
'Freccia' => 'FRECCIA',
'Gmb' => 'GMB',
'Gsp' => 'GSP',
'Honda' => 'HONDA',
'Hyundai/kia', 'Hyundai/Kia', 'Hyundai-kia', 'Hyundai-Kia' => 'HYUNDAI/KIA',
'Knecht/mahle', 'Knecht/Mahle', 'Knecht-mahle', 'Knecht-Mahle' => 'KNECHT/MAHLE',
'Lynx' => 'LYNX',
'Mann' => 'MANN',
'Mitsubishi' => 'MITSUBISHI',
'Nipparts' => 'NIPPARTS',
'Nissan' => 'NISSAN',
'Sasic' => 'SASIC',
'Snr' => 'SNR',
'Subaru' => 'SUBARU',
'Toyota' => 'TOYOTA',
'Trw_moto', 'Trw_Moto', 'Trw-moto', 'Trw-Moto' => 'TRW_MOTO',
'Vag' => 'VAG',
'Wynns' => 'WYNNS',
'Ert' => 'ERT',
'Dongil' => 'DONGIL',
'Febi' => 'FEBI',
'Ford' => 'FORD',
'Injin' => 'INJIN',
'Land Rover' => 'LAND ROVER',
'Lpr' => 'LPR',
'Luzar' => 'LUZAR',
'MercedesBenz', 'Mercedesbenz', 'Mercedes Benz' => 'MERCEDES BENZ',
'Suzuki' => 'SUZUKI',
'Teikin' => 'TEIKIN',
'Blue print' => 'BLUE PRINT',
'Daihatsu' => 'DAIHATSU',
'Goodwill' => 'GOODWILL',
'Ina' => 'INA',
'Iveco' => 'IVECO',
'Jp Group' => 'JP GROUP',
'Mfilter' => 'MFILTER',
'Moog' => 'MOOG',
'Nibk' => 'NIBK',
'Asakashi', 'Js Asakashi' => 'JS Asakashi',
'Lemforder' => 'LEMFORDER',
'Man' => 'MAN',
'Volvo' => 'VOLVO',
'Ctp', 'Costex Tractor Parts', => 'CTP',
'Czd' => 'CZD',
'Lavr' => 'LAVR',
'Wai' => 'WAI',
'Asam' => 'ASAM',
'Bmw' => 'BMW',
'Brisk' => 'BRISK',
'Fenox' => 'FENOX',
'Gm', 'General Motors' => 'GENERAL MOTORS',
'Idemitsu' => 'IDEMITSU',
'Krauf' => 'KRAUF',
'Liqui Moly', 'Lm' => 'LIQUI MOLY',
'Mazda' => 'MAZDA',
'Musashi' => 'MUSASHI',
'Seiken' => 'SEIKEN',
'Totachi' => 'TOTACHI',
'Trialli' => 'TRIALLI',
'Dong Feng', 'Dongfeng', 'Dongfeng Motors', 'Dfm' => 'DONGFENG',
'Miles' => 'MILES',
'Sidem' => 'SIDEM',
'Stellox' => 'STELLOX',
'Tokico' => 'TOKICO',
'Phc Valeo', 'Valeo Phc' => 'Valeo PHC',
'Точка Опоры' => 'ТОЧКА ОПОРЫ',
'Jikiu' => 'JIKIU',
'Lada' => 'LADA',
'Mitasu' => 'MITASU',
'Neolux' => 'NEOLUX',
'Pilenga' => 'PILENGA',
'Renault' => 'RENAULT',
'Startvolt' => 'STARTVOLT',
'Zic' => 'ZIC',
'Автодело' => 'АВТОДЕЛО',
'Berkut' => 'BERKUT',
'Fiat' => 'FIAT',
'Profix' => 'PROFIX',
'Sampa' => 'SAMPA',
'Topfils' => 'TOPFILS',
'Uaz', 'Уаз' => 'UAZ',
'Тольятти-тза', 'Тольятти-Тза', 'Тольятти Тза', 'Тольяттитза' => 'Тольятти-ТЗА',
'Aywiparts' => 'AYWIPARTS',
'Сatterpillar', 'Cat', 'Catterpillar Inc' => 'CAT',
'Difa', 'Дифа' => 'DIFA',
'Nisshimbo' => 'NISSHINBO',
'Ruei' => 'RUEI',
'Vic' => 'VIC',
'Auto-gur', 'Auto-Gur', 'Auto Gur' => 'AUTO-GUR',
'Daejin' => 'DAEJIN',
'Gbrake' => 'G-brake',
'Img' => 'IMG',
'Kortex' => 'KORTEX',
'Koyo' => 'KOYO',
'Peugeot/citroen', 'Peugeot/Citroen', 'Peugeot-citroen', 'Peugeot-Citroen' => 'PEUGEOT-CITROEN',
'Tangde' => 'TANGDE',
'Double-force', 'Double-Force', 'Doubleforce', 'Double Force' => 'DOUBLE FORCE',
'Just-drive', 'Just-Drive', 'Just Drive' => 'JUST DRIVE',
'Quattro-freni', 'Quattro-Freni', 'Quattro Freni' => 'QUATTRO FRENI',
'Roers Parts', 'Roers-parts', 'Roers-Parts' => 'ROTERS-PARTS',
'Tixona' => 'TIXONA',
'Zekkert' => 'ZEKKERT',
'Horex' => 'HOREX',
'Zevs', 'Зевс' => 'ZEVS',
'Aiko' => 'AIKO',
'Castrol' => 'CASTROL',
'Deko' => 'DEKO',
'Hyundai Xteer' => 'HYUNDAI XTEER',
'Dyg' => 'DYG',
'Nty' => 'NTY',
'Skf' => 'SKF',
'Alfi Parts' => 'ALFI PARTS',
'Fiestroco' => 'FIESTROCO',
'Golden Snail' => 'GOLDEN SNAIL',
'Ti-guar', 'Ti-Guar' => 'Ti-Guar',
'Cautex' => 'CAUTEX',
'Bm-motorsport', 'Bm-Motorsport' => 'BM-Motorsport',
'Маз', 'Maz' => 'MAZ',
'Брт' => 'БРТ',
'Гпз' => 'ГПЗ',
'Rm Terex' => 'Terex',
'Agm' => 'Agama',
'Tsn' => 'TSN',
'Igp', 'Isuzu Genuine Parts' => 'Isuzu',
'Etp', 'Europe Tractor Parts' => 'ETP',
'Cum' => 'Cummins',
'Xcmg' => 'XCMG',
'Sdlg' => 'SDLG',
'Xcmg-sdlg', 'Xcmg-Sdlg' => 'XCMG-SDLG'
'Vilitan' => 'ViliTan',
'Kato' => 'KATO',
'Bw' => 'Baldwin',
'Itr' => 'ITR',
'Ofm' => 'OFM',
'Kz' => 'Kezhang Mechanic',
'Dongfeng Cummins Engine Company', 'Dongfeng Cummins' => 'DCEC',
'Bomag' => 'BOMAG',
'Shehwa' => 'SHEHWA',
'Kmp Brand', 'Kmp' => 'KMP',
'Jd' => 'John Deere',
'World Gasket', 'Wg', 'World-gasket', 'World-Gasket' => 'WG',
'Original Equipment Manufacturer', 'Oem' => 'OEM',
'Case' => 'CASE',
'Jf Filtration', 'Jf' => 'JF Filtration',
'Hp' => 'HP',
'Ярославский Завод Дизельной Аппаратуры', 'Язда' => 'ЯЗДА',
'Prc' => 'PRC',
'Sf', 'Sf Filter' => 'SF Filter',
'Ga' => 'GA',
'Kentek' => 'KENTEK',
'Cgr Ghinassi', 'Gb Group' => 'Ghinassi',
'Doosan' => 'DOOSAN',
'Dressta' => 'DRESSTA',
'Ammann' => 'AMMANN',
'Blumaq' => 'BLUMAQ',
'Deutz' => 'DEUTZ',
'Daewoo' => 'DAEWOO',
'Furukawa' => 'FURUKAWA',
'Niipon' => 'NIIPON',
'Cargo' => 'CARGO',
'Wps' => 'WPS',
'Zaufer' => 'ZAUFER',
'Handok' => 'HANDOK',
'Fg Wilson', 'F.G.Wilson', 'F.g.wilson' => 'F.G.WILSON',
'Racor' => 'RACOR',
'Jcb' => 'JCB',
'Auger' => 'AUGER',
'Ekka' => 'EKKA',
'Berco' => 'BERCO',
'Bosch Rexroth' => 'BOSCH REXROTH',
'Byg' => 'BYG',
'Cgr' => 'CGR',
'Dayco' => 'DAYCO',
'Dcf' => 'DCF',
'Dunlop' => 'DUNLOP',
'Febi' => 'FeBi',
'Fleetguard' => 'FLEETGUARD',
'Foton' => 'FOTON',
'Getlf' => 'GETLF',
'Hidromek' => 'HIDROMEK',
'Mann&Hummel', 'Mann&hummel' => 'MANN&HUMMEL',
'Niitsu' => 'NIITSU',
'Nok' => 'NOK',
'Nsk' => 'NSK',
'Ntn' => 'NTN',
'Orme' => 'ORME',
'Parker-racor', 'Parker-Racor' => 'PARKER-RACOR',
'Sanz' => 'SANZ',
'Sem' => 'SEM',
'Separ' => 'SEPAR',
'Shaanxi' => 'SHAANXI',
'Shell' => 'SHELL',
'Skf' => 'SKF',
'Ssp' => 'SSP',
'Sst' => 'SST',
'Stal' => 'STAL',
'Steyr' => 'STEYR',
'Toyota' => 'TOYOTA',
'Tt' => 'Tesla Technics',
'Vag' => 'VAG',
'Wix', 'Wix Filters' => 'WIX',
'Yuchai' => 'Yuchai',
'Zexel' => 'ZEXEL',
'Dongil' => 'DONGIL',
'Sanlux' => 'SANLUX',
'Amt' => 'AMT',
'Dt' => 'DT',
'Pramo' => 'PRAMO',
'Haffen' => 'HAFFEN',
'Mfilter' => 'MFILTER',
'Hengst' => 'HENGST',
'Sofima' => 'SOFIMA',
'Dolz' => 'DOLZ',
'Element' => 'ELEMENT',
'Sardes' => 'SARDES',
'Seintex' => 'SEINTEX',
'Patron' => 'PATRON',
'Lpr' => 'LPR',
'Kaichin' => 'KAICHIN',
'Union' => 'UNION',
'Rb-exide', 'Rb-Exide' => 'RB-EXIDE',
'Kurin' => 'KURIN',
'Topfils' => 'TOPFILS',
'Knor' => 'KNOR',
'Megapower' => 'MEGAPOWER',
'Red Filter', 'Redfilter' => 'REDFilter',
'Skania' => 'SKANIA',
'Sct' => 'SCT',
'Kolbenschmidt' => 'KOLBENSCHMIDT',
'Big Filter' => 'BIG Filter',
'Alco Filter' => 'ALCO Filter',
default => $prod default => $prod
}; };
$row['prod']
// Запись аналогов в буфер // Запись аналогов в буфер
$_row['oemn'] = array_walk($analogs, 'trim'); $_row['oemn'] = array_walk($analogs, 'trim');
@ -1058,14 +1315,18 @@ class Supply extends Product implements ProductInterface, OfferInterface
/** /**
* Вызывается после загрузки excel-документа на сервер * Вызывается после загрузки excel-документа на сервер
* *
* @param static|null $account Аккаунт
* @param string|int $warehouse Склад * @param string|int $warehouse Склад
* *
* @return bool Статус выполнения * @return bool Статус выполнения
*/ */
public static function afterImportExcel(string|int $warehouse = 'неизвестен'): bool public static function afterImportExcel(Account|int $account = null, string|int $warehouse = 'неизвестен'): bool
{ {
// Инициализация аккаунта
$account = Account::initAccount($account);
// Отправка уведомления о загрузке // Отправка уведомления о загрузке
$save = Notification::_write("Загружены товары для склада \"$warehouse\""); $save = Notification::_write("Загружены товары для склада \"$warehouse\"", account: $account->_key);
// Инициализация периода // Инициализация периода
$period = new DatePeriod(new DateTime('@' . strtotime("00:00:00")), new DateInterval('PT5M'), new DateTime('@' . strtotime("next day 00:00:00"))); $period = new DatePeriod(new DateTime('@' . strtotime("00:00:00")), new DateInterval('PT5M'), new DateTime('@' . strtotime("next day 00:00:00")));
@ -1086,7 +1347,7 @@ class Supply extends Product implements ProductInterface, OfferInterface
if ($date instanceof DateTime) $date = '5:00'; if ($date instanceof DateTime) $date = '5:00';
// Отправка уведомления об обработке // Отправка уведомления об обработке
$handle = Notification::_write("Следующее обновление товаров начнётся через $date"); $handle = Notification::_write("Следующее обновление товаров начнётся через $date", account: $account->_key);
return $save && $handle; return $save && $handle;
} }

View File

@ -27,7 +27,7 @@ foreach($analogs as $key => $analog) if ($analog['_key'] === $model->_key) unset
<div class="row p-2 rounded row_analog"> <div class="row p-2 rounded row_analog">
<img class="ml-0 rounded" src="<?= $covr ?>" /> <img class="ml-0 rounded" src="<?= $covr ?>" />
<div class="col 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 ?>"> <a class="my-auto text-dark" href="/product/<?= urlencode($prod) ?>/<?= urlencode($catn) ?>">
<h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5> <h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5>
<h6 class="m-0"><small><?= $name ?></small></h6> <h6 class="m-0"><small><?= $name ?></small></h6>
</a> </a>

View File

@ -39,7 +39,7 @@ $timezone = $timezone[1][0];
<div class="mb-3 row"> <div class="mb-3 row">
<div class="pr-0 col-auto"><?= ++$i ?>.</div> <div class="pr-0 col-auto"><?= ++$i ?>.</div>
<a class="pr-0 col overflow-hidden" title="<?= $product->name ?? 'Артикул' ?>" href="/product/<?= $product->prod ?? 'Неизвестно' ?>/<?= $product->catn ?? 'Неизвестно' ?>"> <a class="pr-0 col overflow-hidden" title="<?= $product->name ?? 'Артикул' ?>" href="/product/<?= urlencode($product->prod ?? 'Неизвестно') ?>/<?= $product->catn ?? 'Неизвестно' ?>">
<?= $product->catn ?? 'Неизвестно' ?> <?= $product->catn ?? 'Неизвестно' ?>
<span class="text-dark" title="Производитель"> (<?= $product->prod ?? 'Неизвестно' ?>)</span> <span class="text-dark" title="Производитель"> (<?= $product->prod ?? 'Неизвестно' ?>)</span>
</a> </a>

View File

@ -51,7 +51,7 @@ use app\models\Search;
<div class="row p-2 rounded"> <div class="row p-2 rounded">
<img class="ml-0 rounded" src="<?= $covr ?>" /> <img class="ml-0 rounded" src="<?= $covr ?>" />
<div class="col 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 ?>"> <a class="my-auto text-dark" href="/product/<?= urlencode($prod) ?>/<?= urlencode($catn) ?>">
<h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5> <h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5>
<h6 class="m-0"><small><?= $name ?></small></h6> <h6 class="m-0"><small><?= $name ?></small></h6>
</a> </a>
@ -123,7 +123,7 @@ use app\models\Search;
<div class="row p-2 rounded"> <div class="row p-2 rounded">
<img class="ml-0 rounded" src="<?= $covr ?>" /> <img class="ml-0 rounded" src="<?= $covr ?>" />
<div class="col 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 ?>"> <a class="my-auto text-dark" href="/product/<?= urlencode($prod) ?>/<?= urlencode($catn) ?>">
<h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5> <h5 class="m-0"><b><?= $prod ?></b> <?= $catn ?></h5>
<h6 class="m-0"><small><?= $name ?></small></h6> <h6 class="m-0"><small><?= $name ?></small></h6>
</a> </a>

View File

@ -45,9 +45,11 @@ if (isset($history) && $history) {
$catn = $row['catn']; $catn = $row['catn'];
$prod = $row['prod']; $prod = $row['prod'];
$_catn = urlencode($row['catn']);
$_prod = urlencode($row['prod']);
echo <<<HTML echo <<<HTML
<a class="d-flex dropdown-item button_white text-dark" href="/product/$prod/$catn"><span class="col-auto pl-0">$catn</span><b class="col-auto ml-auto px-0 text-right">$prod</b></a> <a class="d-flex dropdown-item button_white text-dark" href="/product/$_prod/$_catn"><span class="col-auto pl-0">$catn</span><b class="col-auto ml-auto px-0 text-right">$prod</b></a>
HTML; HTML;
} }
} else { } else {

View File

@ -60,9 +60,9 @@ $timezone = $timezone[1][0];
<?php if (empty($product)) : ?> <?php if (empty($product)) : ?>
<a class="my-auto pr-0 col-auto fas fa-shopping-basket icon_red" title="Товар отсутствует" type="button" onclick="return profile_panel_input_suppliers_accounts_create_product(this, <?= "'$supply->catn'" ?? null ?>, <?= "'$supply->prod'" ?? null ?>);"></a> <a class="my-auto pr-0 col-auto fas fa-shopping-basket icon_red" title="Товар отсутствует" type="button" onclick="return profile_panel_input_suppliers_accounts_create_product(this, <?= "'$supply->catn'" ?? null ?>, <?= "'$supply->prod'" ?? null ?>);"></a>
<?php else : ?> <?php else : ?>
<a class="my-auto pr-0 col-auto fas fa-shopping-basket text-dark" title="Товар" href="<?= "/product/$product->prod/$product->catn" ?>"></a> <a class="my-auto pr-0 col-auto fas fa-shopping-basket text-dark" title="Товар" href="<?= urlencode("/product/$product->prod/$product->catn") ?>"></a>
<?php endif ?> <?php endif ?>
<a class="my-auto pr-0 col-auto fas fa-user text-dark" title="Владелец" href="<?= $account ?? '/' ?>"></a> <a class="my-auto pr-0 col-auto fas fa-user text-dark" title="Владелец" href="<?= urlencode($account ?? '/') ?>"></a>
<a class="my-auto col-auto fas fa-trash-alt text-dark" type="button" title="Удалить" onclick="page_profile_supplies_delete()"></a> <a class="my-auto col-auto fas fa-trash-alt text-dark" type="button" title="Удалить" onclick="page_profile_supplies_delete()"></a>
</div> </div>