diff --git a/retailcrm/lib/RetailcrmJobManager.php b/retailcrm/lib/RetailcrmJobManager.php index 0cb882b..a5ee468 100644 --- a/retailcrm/lib/RetailcrmJobManager.php +++ b/retailcrm/lib/RetailcrmJobManager.php @@ -58,6 +58,7 @@ if (!defined('_PS_VERSION_')) { class RetailcrmJobManager { const LAST_RUN_NAME = 'RETAILCRM_LAST_RUN'; + const LAST_RUN_DETAIL_NAME = 'RETAILCRM_LAST_RUN_DETAIL'; const IN_PROGRESS_NAME = 'RETAILCRM_JOBS_IN_PROGRESS'; const CURRENT_TASK = 'RETAILCRM_JOB_CURRENT'; @@ -107,9 +108,11 @@ class RetailcrmJobManager { $current = date_create('now'); $lastRuns = array(); + $lastRunsDetails = array(); try { $lastRuns = static::getLastRuns(); + $lastRunsDetails = static::getLastRunDetails(); } catch (Exception $exception) { static::handleError( $exception->getFile(), @@ -140,6 +143,24 @@ class RetailcrmJobManager } } + uasort($jobs, function ($diff1, $diff2) { + $date1 = new \DateTime(); + $date2 = new \DateTime(); + + if (!is_null($diff1)) { + $date1->add($diff1); + } + if (!is_null($diff2)) { + $date2->add($diff2); + } + + if ($date1 == $date2) { + return 0; + } + + return ($date1 > $date2) ? -1 : 1; + }); + foreach ($jobs as $job => $diff) { try { if (isset($lastRuns[$job]) && $lastRuns[$job] instanceof DateTime) { @@ -170,11 +191,27 @@ class RetailcrmJobManager sprintf('Executed job %s, result: %s', $job, $result ? 'true' : 'false') ); $lastRuns[$job] = new \DateTime('now'); + $lastRunsDetails[$job] = [ + 'success' => true, + 'lastRun' => new \DateTime('now'), + 'error' => null, + ]; + + break; } } catch (\Exception $exception) { if ($exception instanceof RetailcrmJobManagerException && $exception->getPrevious() instanceof \Exception ) { + $lastRunsDetails[$job] = [ + 'success' => false, + 'lastRun' => new \DateTime('now'), + 'error' => [ + 'message' => $exception->getPrevious()->getMessage(), + 'trace' => $exception->getPrevious()->getTraceAsString(), + ], + ]; + static::handleError( $exception->getPrevious()->getFile(), $exception->getPrevious()->getMessage(), @@ -182,6 +219,15 @@ class RetailcrmJobManager $job ); } else { + $lastRunsDetails[$job] = [ + 'success' => false, + 'lastRun' => new \DateTime('now'), + 'error' => [ + 'message' => $exception->getMessage(), + 'trace' => $exception->getTraceAsString(), + ], + ]; + static::handleError( $exception->getFile(), $exception->getMessage(), @@ -192,14 +238,15 @@ class RetailcrmJobManager self::clearCurrentJob($job); } + } - if (isset($result) && $result) { - self::clearCurrentJob($job); - } + if (isset($result) && $result) { + self::clearCurrentJob($job); } try { static::setLastRuns($lastRuns); + static::setLastRunDetails($lastRunsDetails); } catch (Exception $exception) { static::handleError( $exception->getFile(), @@ -271,6 +318,58 @@ class RetailcrmJobManager Configuration::updateGlobalValue(self::LAST_RUN_NAME, (string)json_encode($lastRuns)); } + + /** + * Extracts jobs last runs from db + * + * @return array + * @throws \Exception + */ + private static function getLastRunDetails() + { + $lastRuns = json_decode((string)Configuration::getGlobalValue(self::LAST_RUN_DETAIL_NAME), true); + + if (json_last_error() != JSON_ERROR_NONE) { + $lastRuns = array(); + } else { + foreach ($lastRuns as $job => $details) { + $lastRan = DateTime::createFromFormat(DATE_RFC3339, $details['lastRun']); + + if ($lastRan instanceof DateTime) { + $lastRuns[$job]['lastRun'] = $lastRan; + } else { + $lastRuns[$job]['lastRun'] = null; + } + } + } + + return (array)$lastRuns; + } + + /** + * Updates jobs last runs in db + * + * @param array $lastRuns + * + * @throws \Exception + */ + private static function setLastRunDetails($lastRuns = array()) + { + if (!is_array($lastRuns)) { + $lastRuns = array(); + } + + foreach ($lastRuns as $job => $details) { + if ($details['lastRun'] instanceof DateTime) { + $lastRuns[$job]['lastRun'] = $details['lastRun']->format(DATE_RFC3339); + } else { + $lastRuns[$job]['lastRun'] = null; + } + } + + Configuration::updateGlobalValue(self::LAST_RUN_DETAIL_NAME, (string)json_encode($lastRuns)); + } + /** * Runs job * @@ -427,6 +526,30 @@ class RetailcrmJobManager call_user_func_array(self::$customShutdownHandler, array($error)); } else { if (null !== $error) { + $job = self::getCurrentJob(); + if(!empty($job)) { + $lastRunsDetails = self::getLastRunDetails(); + + $lastRunsDetails[$job] = [ + 'success' => false, + 'lastRun' => new \DateTime('now'), + 'error' => [ + 'message' => (isset($error['message']) ? $error['message'] : print_r($error, true)), + 'trace' => print_r($error, true), + ], + ]; + try { + self::setLastRunDetails($lastRunsDetails); + } catch (Exception $exception) { + static::handleError( + $exception->getFile(), + $exception->getMessage(), + $exception->getTraceAsString(), + $job + ); + } + } + self::clearCurrentJob(null); } } @@ -594,7 +717,7 @@ class RetailcrmJobManager $lastRan = static::getLastRun(); $lastRanSeconds = $lastRan->format('U'); - if (($lastRanSeconds + self::getTimeLimit()) < time()) { + if ($inProcess && ($lastRanSeconds + self::getTimeLimit()) < time()) { RetailcrmLogger::writeDebug(__METHOD__, 'Removing lock because time limit exceeded.'); static::unlock(); diff --git a/retailcrm/lib/RetailcrmTools.php b/retailcrm/lib/RetailcrmTools.php index 3d3b4be..2953a7f 100644 --- a/retailcrm/lib/RetailcrmTools.php +++ b/retailcrm/lib/RetailcrmTools.php @@ -633,7 +633,7 @@ class RetailcrmTools public static function startJobManager() { RetailcrmJobManager::startJobs(array( - 'RetailcrmAbandonedCartsEvent' => null, + 'RetailcrmAbandonedCartsEvent' => new \DateInterval('PT1M'), 'RetailcrmIcmlEvent' => new \DateInterval('PT4H'), 'RetailcrmSyncEvent' => new \DateInterval('PT7M'), 'RetailcrmInventoriesEvent' => new \DateInterval('PT15M') diff --git a/retailcrm/retailcrm.php b/retailcrm/retailcrm.php index 78292a8..3db54dd 100644 --- a/retailcrm/retailcrm.php +++ b/retailcrm/retailcrm.php @@ -72,6 +72,12 @@ class RetailCRM extends Module const CONSULTANT_SCRIPT = 'RETAILCRM_CONSULTANT_SCRIPT'; const CONSULTANT_RCCT = 'RETAILCRM_CONSULTANT_RCCT'; const ENABLE_WEB_JOBS = 'RETAILCRM_ENABLE_WEB_JOBS'; + const JOBS_NAMES = [ + 'RetailcrmAbandonedCartsEvent' => 'Abandoned Carts', + 'RetailcrmIcmlEvent' => 'Icml generation', + 'RetailcrmSyncEvent' => 'History synchronization', + 'RetailcrmInventoriesEvent' => 'Inventories uploads' + ]; /** * @var array $templateErrors @@ -221,6 +227,11 @@ class RetailCRM extends Module Configuration::deleteByName('RETAILCRM_LAST_SYNC') && Configuration::deleteByName('RETAILCRM_LAST_ORDERS_SYNC') && Configuration::deleteByName('RETAILCRM_LAST_CUSTOMERS_SYNC') && + Configuration::deleteByName(RetailcrmJobManager::LAST_RUN_NAME) && + Configuration::deleteByName(RetailcrmJobManager::LAST_RUN_DETAIL_NAME) && + Configuration::deleteByName(RetailcrmJobManager::IN_PROGRESS_NAME) && + Configuration::deleteByName(RetailcrmJobManager::CURRENT_TASK) && + Configuration::deleteByName(RetailcrmCli::CURRENT_TASK_CLI) && $this->uninstallDB(); } @@ -1035,6 +1046,7 @@ class RetailCRM extends Module 'deliveryDefault' => json_decode(Configuration::get(static::DELIVERY_DEFAULT), true), 'paymentDefault' => json_decode(Configuration::get(static::PAYMENT_DEFAULT), true), 'statusExport' => (string)(Configuration::get(static::STATUS_EXPORT)), + 'lastRunDetails' => json_decode(Configuration::get(RetailcrmJobManager::LAST_RUN_DETAIL_NAME), true), 'collectorActive' => (Configuration::get(static::COLLECTOR_ACTIVE)), 'collectorKey' => (string)(Configuration::get(static::COLLECTOR_KEY)), 'clientId' => Configuration::get(static::CLIENT_ID), @@ -1074,7 +1086,8 @@ class RetailCRM extends Module 'consultantScriptName' => static::CONSULTANT_SCRIPT, 'enableCorporateName' => static::ENABLE_CORPORATE_CLIENTS, 'enableHistoryUploadsName' => static::ENABLE_HISTORY_UPLOADS, - 'enableBalancesReceivingName' => static::ENABLE_BALANCES_RECEIVING + 'enableBalancesReceivingName' => static::ENABLE_BALANCES_RECEIVING, + 'jobsNames' => static::JOBS_NAMES ); } diff --git a/retailcrm/translations/es.php b/retailcrm/translations/es.php index 0c24712..6d4979b 100644 --- a/retailcrm/translations/es.php +++ b/retailcrm/translations/es.php @@ -52,6 +52,16 @@ $_MODULE['<{retailcrm}prestashop>settings_4d3d769b812b6faa6b76e1a8abaece2d'] = ' $_MODULE['<{retailcrm}prestashop>settings_f75d8fa5c89351544d372cf90528ccf2'] = 'Clave de la página web'; $_MODULE['<{retailcrm}prestashop>settings_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{retailcrm}prestashop>settings_4f18e3f1c9941a6ec5a38bc716c521b4'] = 'Código que necesita insertar en la web'; +$_MODULE['<{retailcrm}prestashop>settings_9082f68bc90113d8950e4ed7fe8fa0a4'] = 'Administrador de tareas'; +$_MODULE['<{retailcrm}prestashop>settings_9194de58ce560c095f02cefc1c1c61e6'] = 'Nombre de la tarea'; +$_MODULE['<{retailcrm}prestashop>settings_05a3a24340b7b9cc8d4e08f0ef4f4dd9'] = 'Última ejecución'; +$_MODULE['<{retailcrm}prestashop>settings_ec53a8c4f07baed5d8825072c89799be'] = 'Estado'; +$_MODULE['<{retailcrm}prestashop>settings_0be8406951cdfda82f00f79328cf4efc'] = 'Comentario'; +$_MODULE['<{retailcrm}prestashop>settings_fe5b6cd4d7a31615bbec8d1505089d87'] = 'StackTrace'; +$_MODULE['<{retailcrm}prestashop>settings_54e85d70ea67acdcc86963b14d6223a8'] = 'Carritos abandonados'; +$_MODULE['<{retailcrm}prestashop>settings_5ae96cfe7ea77a401db8e0d5dbab333c'] = 'Generación Icml'; +$_MODULE['<{retailcrm}prestashop>settings_9abdd7d7fa90b7aa19e8ca8fb9f04ee4'] = 'Sincronización de historia'; +$_MODULE['<{retailcrm}prestashop>settings_e1d641ca2884dbd4398e9252c0ab511e'] = 'Cargas de inventarios'; $_MODULE['<{retailcrm}prestashop>index_f545947db05aa489f59babf06c319d06'] = 'RetailCRM es un servicio para tiendas online, el cual ayuda a dejar de perder pedidos y así mejorar las ganancias de tu comercio online en todas las etapas del embudo de ventas.'; $_MODULE['<{retailcrm}prestashop>index_96f5fae5347f2f1cf560e71a30420fec'] = 'Tengo una cuenta en RetailCRM'; $_MODULE['<{retailcrm}prestashop>index_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'o'; diff --git a/retailcrm/translations/ru.php b/retailcrm/translations/ru.php index f6a5130..d20dc43 100644 --- a/retailcrm/translations/ru.php +++ b/retailcrm/translations/ru.php @@ -52,6 +52,16 @@ $_MODULE['<{retailcrm}prestashop>settings_4d3d769b812b6faa6b76e1a8abaece2d'] = ' $_MODULE['<{retailcrm}prestashop>settings_f75d8fa5c89351544d372cf90528ccf2'] = 'Ключ сайта'; $_MODULE['<{retailcrm}prestashop>settings_c9cc8cce247e49bae79f15173ce97354'] = 'Сохранить'; $_MODULE['<{retailcrm}prestashop>settings_4f18e3f1c9941a6ec5a38bc716c521b4'] = 'Код для вставки на сайт'; +$_MODULE['<{retailcrm}prestashop>settings_9082f68bc90113d8950e4ed7fe8fa0a4'] = 'Менеджер задач'; +$_MODULE['<{retailcrm}prestashop>settings_9194de58ce560c095f02cefc1c1c61e6'] = 'Имя задачи'; +$_MODULE['<{retailcrm}prestashop>settings_05a3a24340b7b9cc8d4e08f0ef4f4dd9'] = 'Последний запуск'; +$_MODULE['<{retailcrm}prestashop>settings_ec53a8c4f07baed5d8825072c89799be'] = 'Статус'; +$_MODULE['<{retailcrm}prestashop>settings_0be8406951cdfda82f00f79328cf4efc'] = 'Комментарий'; +$_MODULE['<{retailcrm}prestashop>settings_fe5b6cd4d7a31615bbec8d1505089d87'] = 'StackTrace'; +$_MODULE['<{retailcrm}prestashop>settings_54e85d70ea67acdcc86963b14d6223a8'] = 'Брошенные корзины'; +$_MODULE['<{retailcrm}prestashop>settings_5ae96cfe7ea77a401db8e0d5dbab333c'] = 'Генерация Icml'; +$_MODULE['<{retailcrm}prestashop>settings_9abdd7d7fa90b7aa19e8ca8fb9f04ee4'] = 'Синхронизация истории'; +$_MODULE['<{retailcrm}prestashop>settings_e1d641ca2884dbd4398e9252c0ab511e'] = 'Выгрузка остатков'; $_MODULE['<{retailcrm}prestashop>index_f545947db05aa489f59babf06c319d06'] = 'RetailCRM — сервис для интернет магазинов, который поможет перестать терять заказы и увеличить доход на всех этапах воронки.'; $_MODULE['<{retailcrm}prestashop>index_96f5fae5347f2f1cf560e71a30420fec'] = 'У меня уже есть аккаунт RetailCRM'; $_MODULE['<{retailcrm}prestashop>index_e81c4e4f2b7b93b481e13a8553c2ae1b'] = 'или'; diff --git a/retailcrm/views/css/less/styles.less b/retailcrm/views/css/less/styles.less index 3aac07e..777372e 100644 --- a/retailcrm/views/css/less/styles.less +++ b/retailcrm/views/css/less/styles.less @@ -554,4 +554,118 @@ body, html { .toggle-box { display: none; } -} \ No newline at end of file + &-table { + width: 100%; + border: none; + border-radius: 20px; + thead { + th { + background: rgba(122, 122, 122, 0.15); + font-size: 16px; + } + } + tbody { + tr { + td { + border-bottom: 1px solid #ccc; + } + } + } + td, th { + color: #333; + font-size: 14px; + line-height: 60px; + padding: 4px 4px 4px 6px; + max-width: 300px; + vertical-align: middle; + } + &-no-wrap { + white-space: nowrap; + } + &-center { + text-align: center; + } + &-sort { + &__btn, &__switch { + cursor: pointer; + &:hover { + color: #005add; + } + } + &__btn { + float: left; + clear: both; + line-height: 15px; + font-size: 20px; + padding-left: 10px; + padding-right: 10px; + opacity: 0; + transition: opacity 0.2s ease-out; + &-wrap { + position: absolute; + } + } + &__asc { + padding-top: 15px; + padding-bottom: 0; + } + &__desc { + padding-top: 0; + padding-bottom: 15px; + } + & thead th:hover &__btn, & thead td:hover &__btn { + opacity: 1; + } + } + } + &-collapsible { + &__input { + display: none; + } + label&__title { + cursor: pointer; + font-weight: normal; + text-align: center; + padding: 0; + position: relative; + line-height: 1; + width: 100%; + &:before { + content: '\25B6'; + opacity: 0; + transition: opacity 0.2s ease-out; + } + &:hover:before { + opacity: 1; + } + } + &__content { + text-align: left; + font-size: 12px; + line-height: 1.5; + background: #fff; + border: 1px solid rgba(122,122,122,0.15); + position: absolute; + top: 20px; + left: 0; + padding: 18px; + margin: 0; + border-radius: 20px; + overflow: hidden; + max-height: 0; + transition-duration: 0.2s; + transition-timing-function: ease-out; + transition-property: max-height, visibility; + visibility: hidden; + } + &__input:checked + &__title &__content { + max-height: 100vh; + visibility: visible; + } + } + &-error-msg { + &, &:after, &:before { + color: #dd2e44; + } + } +} diff --git a/retailcrm/views/css/styles.min.css b/retailcrm/views/css/styles.min.css index 6eebd1e..1ffc9e9 100644 --- a/retailcrm/views/css/styles.min.css +++ b/retailcrm/views/css/styles.min.css @@ -1 +1,611 @@ -@font-face{font-family:'OpenSans';src:url('../fonts/OpenSans/opensans-regular.eot');src:url('../fonts/OpenSans/opensans-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/OpenSans/opensans-regular.woff2') format('woff2'), url('../fonts/OpenSans/opensans-regular.woff') format('woff'), url('../fonts/OpenSans/opensans-regular.ttf') format('truetype'), url('../fonts/OpenSans/opensans-regular.svg#open_sansregular') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'OpenSans';src:url('../fonts/OpenSansBold/opensans-bold.eot');src:url('../fonts/OpenSansBold/opensans-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/OpenSansBold/opensans-bold.woff2') format('woff2'), url('../fonts/OpenSansBold/opensans-bold.woff') format('woff'), url('../fonts/OpenSansBold/opensans-bold.ttf') format('truetype'), url('../fonts/OpenSansBold/opensans-bold.svg#open_sansbold') format('svg');font-weight:600;font-style:normal}body,html{margin:0;padding:0;height:100%}.hidden{visibility:hidden}.retail-wrap{font-family:OpenSans, Arial, sans-serif;padding:0 15px;height:100%}.retail-wrap *,.retail-wrap *::after,.retail-wrap *::before{box-sizing:border-box}.retail-container{margin:0 auto;width:100%;max-width:950px}.retail-title{margin:60px 0 0;font-weight:400;text-align:center;font-size:28px;line-height:38px}.retail-title_content{text-align:left;margin-top:40px}.retail-txt{color:#7A7A7A;font-size:18px;line-height:26px}.retail-descript{margin-top:45px;text-align:center}.retail-tab__enabled{display:block}.retail-tab__disabled{display:none !important}.retail-video{margin:57px auto 0;max-width:442px;position:relative}.retail-video-trigger{position:absolute;top:0;bottom:0;right:0;left:0;width:100%;height:100%;cursor:pointer}.retail-video iframe{pointer-events:none}.retail-video__btn{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;width:100px;height:100px;cursor:pointer;opacity:0.4;transition:0.25s ease}.retail-video__btn svg{width:100%}.retail-video__btn:hover{opacity:0.6}.retail-btns{margin:56px auto 0;display:flex;justify-content:space-between;max-width:815px;transition:0.05s ease}.retail-btns__separate{padding:0 20px;display:flex;align-items:center;color:#7A7A7A;font-size:16px}.retail-btns_hide{opacity:0}.retail-form{margin-top:60px}.retail-form__title{font-size:16px;font-weight:600;line-height:24px;margin-bottom:22px}.retail-form__label{width:100% !important;text-align:left !important;margin:15px 12px;font-size:15px}.retail-form__row{margin-top:15px}.retail-form__row_submit{margin-top:23px}.retail-form__message-warning{padding:13px 18px;margin:1px 13px;border-radius:8px;border:1px solid #fcf3b5;font-size:1rem;box-shadow:0 0 6px 0 #fdd0d0}.retail-form__checkbox{display:flex;flex-direction:row;align-items:center;padding:4px 12px}.retail-form__checkbox input[type=checkbox]{width:24px;height:24px}.retail-form__checkbox label{width:auto;margin-left:8px;font-size:16px}.retail-form__area{display:inline-block !important;vertical-align:top;width:430px !important;height:60px !important;border:1px solid rgba(122, 122, 122, 0.15) !important;box-shadow:none !important;border-radius:58px !important;padding:0 28px !important;line-height:normal;color:#7A7A7A !important;font-size:16px !important;appearance:none}.retail-form__area:focus{color:#363A41}.retail-form__area:focus::-webkit-input-placeholder{color:#363A41}.retail-form__area:focus::-moz-placeholder{color:#363A41}.retail-form__area:focus:-moz-placeholder{color:#363A41}.retail-form__area:focus:-ms-input-placeholder{color:#363A41}.retail-form__area_txt{padding:20px 28px !important;line-height:24px !important;height:487px !important;border-radius:20px !important;resize:none !important;font-family:OpenSans, Arial, sans-serif !important}.retail-form input:focus,.retail-form textarea:focus{outline:none !important}.retail-form_main{margin-top:34px;max-width:900px;width:100%}.retail-form_main .retail-form__area{width:100% !important}.retail-tabs{margin-top:60px}.retail-tabs__btn{display:inline-block;vertical-align:top;padding:19px 30px;font-size:16px;font-weight:600;line-height:22px;color:#7A7A7A;text-align:center;min-width:152px;text-decoration:none !important;position:relative;transition:0.25s ease}.retail-tabs__btn:hover{color:#363A41}.retail-tabs__btn::after{content:"";height:3px;width:100%;position:absolute;bottom:-1px;left:0;right:0;opacity:0;visibility:hidden;background:#0068FF;transition:0.25s ease}.retail-tabs__btn_active{color:#363A41}.retail-tabs__btn_active::after{opacity:1;visibility:visible}.retail-tabs__head{display:flex;justify-content:space-between;border-bottom:1px solid #DFDFDF}.retail-tabs__body{padding-top:18px}.retail-tabs__body p{margin-top:23px;margin-bottom:0;color:#7A7A7A;font-size:16px;line-height:24px}.retail-tabs__item{display:none}.retail-list{margin:0;padding:0;list-style:none}.retail-list__item{padding-left:2px;position:relative;color:#7A7A7A;font-size:16px;line-height:24px}.retail-list__item::before{content:"-";display:inline-block;vertical-align:top;color:#7A7A7A;font-size:16px;line-height:24px;margin-right:3px}.retail-tile{display:flex;flex-wrap:wrap}.retail-tile__col{width:48%;padding-right:35px}.retail-tile__col:nth-child(1){width:52%}.retail-tile__col_contacts{padding-right:0}.retail-tile__row{display:flex;justify-content:center;margin-bottom:30px}.retail-tile__row:nth-last-child(1){margin-bottom:0}.retail-tile__item{margin-top:34px}.retail-tile__item:nth-child(1){margin-top:20px}.retail-tile__title{color:#363A41;font-size:16px;font-weight:600;line-height:24px}.retail-tile__descript{color:#7A7A7A;font-size:16px;line-height:24px;margin-top:10px}.retail-tile__link{color:#0068FF;font-size:16px;font-weight:600;line-height:24px;transition:0.25s ease}.retail-tile__link:hover{color:#005add}.retail-popup{position:absolute;width:90%;height:90%;background:white;left:0;right:0;top:0;bottom:0;margin:auto;transform:translate3d(0, -1000%, 0) scale(0.1);transition:0.25s ease}.retail-popup__close{position:absolute;top:-30px;right:-30px;width:30px;height:30px;cursor:pointer}.retail-popup__close::after,.retail-popup__close::before{content:"";position:absolute;left:0;right:0;top:0;bottom:0;margin:auto;height:30px;width:2px;background:white}.retail-popup__close::before{transform:rotate(45deg)}.retail-popup__close::after{transform:rotate(-45deg)}.retail-popup.open{transform:translate3d(0, 0, 0) scale(1)}.retail-popup-wrap{position:fixed;left:0;right:0;top:0;bottom:0;background:rgba(0, 0, 0, 0.6);z-index:1000;display:none}.retail-column{display:flex;max-width:1389px;height:100%}.retail-column__aside{width:253px;background:#EAEBEC;min-height:300px}.retail-column__content{flex:1 0 auto;padding:0 58px;min-height:300px}.retail-menu{padding:8px 20px 8px 15px}.retail-menu__btn{display:inline-flex;align-items:center;justify-content:center;vertical-align:top;width:100%;height:60px;background:rgba(122, 122, 122, 0.1) !important;font-weight:bold;font-size:16px;color:#363A41 !important;text-decoration:none !important;padding:0 30px;margin-top:20px;border-radius:5px;text-align:center;transition:0.25s ease}.retail-menu__btn span{display:block}.retail-menu__btn:hover{background:rgba(122, 122, 122, 0.15) !important}.retail-menu__btn:nth-child(1){margin-top:0}.retail-menu__btn_active{color:white !important;background:#0068FF !important}.retail-menu__btn_active:hover{background:#005add !important}.retail-menu__btn_big{font-size:18px}.retail-full-height{height:100%}.retail .btn{display:inline-block;vertical-align:top;background:rgba(122, 122, 122, 0.1);border-radius:58px;height:60px;line-height:60px;padding:0 30px;font-size:18px;font-weight:600;text-align:center;color:#0068FF;text-decoration:none;cursor:pointer;appearance:none;border:none;box-shadow:none;transition:0.25s ease}.retail .btn:hover{background:rgba(122, 122, 122, 0.15)}.retail .btn:active{background:rgba(122, 122, 122, 0.25)}.retail .btn_max{min-width:356px}.retail .btn_invert{background:#0068FF;color:white}.retail .btn_invert:hover{background:#005add}.retail .btn_invert:active{background:#0051c6}.retail .btn_whatsapp{background:#33D16B;color:white;padding:0 62px}.retail .btn_whatsapp:hover{background:#22CA5D}.retail .btn_submit{min-width:218px}.retail .toggle-box{display:none} \ No newline at end of file +@font-face { + font-family: 'OpenSans'; + src: url('../fonts/OpenSans/opensans-regular.eot'); + src: url('../fonts/OpenSans/opensans-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/OpenSans/opensans-regular.woff2') format('woff2'), url('../fonts/OpenSans/opensans-regular.woff') format('woff'), url('../fonts/OpenSans/opensans-regular.ttf') format('truetype'), url('../fonts/OpenSans/opensans-regular.svg#open_sansregular') format('svg'); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: 'OpenSans'; + src: url('../fonts/OpenSansBold/opensans-bold.eot'); + src: url('../fonts/OpenSansBold/opensans-bold.eot?#iefix') format('embedded-opentype'), url('../fonts/OpenSansBold/opensans-bold.woff2') format('woff2'), url('../fonts/OpenSansBold/opensans-bold.woff') format('woff'), url('../fonts/OpenSansBold/opensans-bold.ttf') format('truetype'), url('../fonts/OpenSansBold/opensans-bold.svg#open_sansbold') format('svg'); + font-weight: 600; + font-style: normal; +} +body, +html { + margin: 0; + padding: 0; + height: 100%; +} +.hidden { + visibility: hidden; +} +.retail-wrap { + font-family: OpenSans, Arial, sans-serif; + padding: 0 15px; + height: 100%; +} +.retail-wrap *, +.retail-wrap *::before, +.retail-wrap *::after { + box-sizing: border-box; +} +.retail-container { + margin: 0 auto; + width: 100%; + max-width: 950px; +} +.retail-title { + margin: 60px 0 0; + font-weight: 400; + text-align: center; + font-size: 28px; + line-height: 38px; +} +.retail-title_content { + text-align: left; + margin-top: 40px; +} +.retail-txt { + color: #7A7A7A; + font-size: 18px; + line-height: 26px; +} +.retail-descript { + margin-top: 45px; + text-align: center; +} +.retail-tab__enabled { + display: block; +} +.retail-tab__disabled { + display: none !important; +} +.retail-video { + margin: 57px auto 0; + max-width: 442px; + position: relative; +} +.retail-video-trigger { + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + width: 100%; + height: 100%; + cursor: pointer; +} +.retail-video iframe { + pointer-events: none; +} +.retail-video__btn { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 100px; + height: 100px; + cursor: pointer; + opacity: 0.4; + transition: 0.25s ease; +} +.retail-video__btn svg { + width: 100%; +} +.retail-video__btn:hover { + opacity: 0.6; +} +.retail-btns { + margin: 56px auto 0; + display: flex; + justify-content: space-between; + max-width: 815px; + transition: 0.05s ease; +} +.retail-btns__separate { + padding: 0 20px; + display: flex; + align-items: center; + color: #7A7A7A; + font-size: 16px; +} +.retail-btns_hide { + opacity: 0; +} +.retail-form { + margin-top: 60px; +} +.retail-form__title { + font-size: 16px; + font-weight: 600; + line-height: 24px; + margin-bottom: 22px; +} +.retail-form__label { + width: 100% !important; + text-align: left !important; + margin: 15px 12px; + font-size: 15px; +} +.retail-form__row { + margin-top: 15px; +} +.retail-form__row_submit { + margin-top: 23px; +} +.retail-form__message-warning { + padding: 13px 18px; + margin: 1px 13px; + border-radius: 8px; + border: 1px solid #fcf3b5; + font-size: 1rem; + box-shadow: 0px 0px 6px 0px #fdd0d0; +} +.retail-form__checkbox { + display: flex; + flex-direction: row; + align-items: center; + padding: 4px 12px; +} +.retail-form__checkbox input[type=checkbox] { + width: 24px; + height: 24px; +} +.retail-form__checkbox label { + width: auto; + margin-left: 8px; + font-size: 16px; +} +.retail-form__area { + display: inline-block !important; + vertical-align: top; + width: 430px !important; + height: 60px !important; + border: 1px solid rgba(122, 122, 122, 0.15) !important; + box-shadow: none !important; + border-radius: 58px !important; + padding: 0 28px !important; + line-height: normal; + color: #7A7A7A !important; + font-size: 16px !important; + appearance: none; +} +.retail-form__area:focus { + color: #363A41; +} +.retail-form__area:focus::-webkit-input-placeholder { + color: #363A41; +} +.retail-form__area:focus::-moz-placeholder { + color: #363A41; +} +.retail-form__area:focus:-moz-placeholder { + color: #363A41; +} +.retail-form__area:focus:-ms-input-placeholder { + color: #363A41; +} +.retail-form__area_txt { + padding: 20px 28px !important; + line-height: 24px !important; + height: 487px !important; + border-radius: 20px !important; + resize: none !important; + font-family: OpenSans, Arial, sans-serif !important; +} +.retail-form input:focus, +.retail-form textarea:focus { + outline: none !important; +} +.retail-form_main { + margin-top: 34px; + max-width: 900px; + width: 100%; +} +.retail-form_main .retail-form__area { + width: 100% !important; +} +.retail-tabs { + margin-top: 60px; +} +.retail-tabs__btn { + display: inline-block; + vertical-align: top; + padding: 19px 30px; + font-size: 16px; + font-weight: 600; + line-height: 22px; + color: #7A7A7A; + text-align: center; + min-width: 152px; + text-decoration: none !important; + position: relative; + transition: 0.25s ease; +} +.retail-tabs__btn:hover { + color: #363A41; +} +.retail-tabs__btn::after { + content: ""; + height: 3px; + width: 100%; + position: absolute; + bottom: -1px; + left: 0; + right: 0; + opacity: 0; + visibility: hidden; + background: #0068FF; + transition: 0.25s ease; +} +.retail-tabs__btn_active { + color: #363A41; +} +.retail-tabs__btn_active::after { + opacity: 1; + visibility: visible; +} +.retail-tabs__head { + display: flex; + justify-content: space-between; + border-bottom: 1px solid #DFDFDF; +} +.retail-tabs__body { + padding-top: 18px; +} +.retail-tabs__body p { + margin-top: 23px; + margin-bottom: 0; + color: #7A7A7A; + font-size: 16px; + line-height: 24px; +} +.retail-tabs__item { + display: none; +} +.retail-list { + margin: 0; + padding: 0; + list-style: none; +} +.retail-list__item { + padding-left: 2px; + position: relative; + color: #7A7A7A; + font-size: 16px; + line-height: 24px; +} +.retail-list__item::before { + content: "-"; + display: inline-block; + vertical-align: top; + color: #7A7A7A; + font-size: 16px; + line-height: 24px; + margin-right: 3px; +} +.retail-tile { + display: flex; + flex-wrap: wrap; +} +.retail-tile__col { + width: 48%; + padding-right: 35px; +} +.retail-tile__col:nth-child(1) { + width: 52%; +} +.retail-tile__col_contacts { + padding-right: 0; +} +.retail-tile__row { + display: flex; + justify-content: center; + margin-bottom: 30px; +} +.retail-tile__row:nth-last-child(1) { + margin-bottom: 0; +} +.retail-tile__item { + margin-top: 34px; +} +.retail-tile__item:nth-child(1) { + margin-top: 20px; +} +.retail-tile__title { + color: #363A41; + font-size: 16px; + font-weight: 600; + line-height: 24px; +} +.retail-tile__descript { + color: #7A7A7A; + font-size: 16px; + line-height: 24px; + margin-top: 10px; +} +.retail-tile__link { + color: #0068FF; + font-size: 16px; + font-weight: 600; + line-height: 24px; + transition: 0.25s ease; +} +.retail-tile__link:hover { + color: #005add; +} +.retail-popup { + position: absolute; + width: 90%; + height: 90%; + background: white; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + transform: translate3d(0, -1000%, 0) scale(0.1); + transition: 0.25s ease; +} +.retail-popup__close { + position: absolute; + top: -30px; + right: -30px; + width: 30px; + height: 30px; + cursor: pointer; +} +.retail-popup__close::before, +.retail-popup__close::after { + content: ""; + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + height: 30px; + width: 2px; + background: white; +} +.retail-popup__close::before { + transform: rotate(45deg); +} +.retail-popup__close::after { + transform: rotate(-45deg); +} +.retail-popup.open { + transform: translate3d(0, 0, 0) scale(1); +} +.retail-popup-wrap { + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 1000; + display: none; +} +.retail-column { + display: flex; + max-width: 1389px; + height: 100%; +} +.retail-column__aside { + width: 253px; + background: #EAEBEC; + min-height: 300px; +} +.retail-column__content { + flex: 1 0 auto; + padding: 0 58px; + min-height: 300px; +} +.retail-menu { + padding: 8px 20px 8px 15px; +} +.retail-menu__btn { + display: inline-flex; + align-items: center; + justify-content: center; + vertical-align: top; + width: 100%; + height: 60px; + background: rgba(122, 122, 122, 0.1) !important; + font-weight: bold; + font-size: 16px; + color: #363A41 !important; + text-decoration: none !important; + padding: 0 30px; + margin-top: 20px; + border-radius: 5px; + text-align: center; + transition: 0.25s ease; +} +.retail-menu__btn span { + display: block; +} +.retail-menu__btn:hover { + background: rgba(122, 122, 122, 0.15) !important; +} +.retail-menu__btn:nth-child(1) { + margin-top: 0; +} +.retail-menu__btn_active { + color: white !important; + background: #0068FF !important; +} +.retail-menu__btn_active:hover { + background: #005add !important; +} +.retail-menu__btn_big { + font-size: 18px; +} +.retail-full-height { + height: 100%; +} +.retail .btn { + display: inline-block; + vertical-align: top; + background: rgba(122, 122, 122, 0.1); + border-radius: 58px; + height: 60px; + line-height: 60px; + padding: 0 30px; + font-size: 18px; + font-weight: 600; + text-align: center; + color: #0068FF; + text-decoration: none; + cursor: pointer; + appearance: none; + border: none; + box-shadow: none; + transition: 0.25s ease; +} +.retail .btn:hover { + background: rgba(122, 122, 122, 0.15); +} +.retail .btn:active { + background: rgba(122, 122, 122, 0.25); +} +.retail .btn_max { + min-width: 356px; +} +.retail .btn_invert { + background: #0068FF; + color: white; +} +.retail .btn_invert:hover { + background: #005add; +} +.retail .btn_invert:active { + background: #0045aa; +} +.retail .btn_whatsapp { + background: #33D16B; + color: white; + padding: 0 62px; +} +.retail .btn_whatsapp:hover { + background: #22CA5D; +} +.retail .btn_submit { + min-width: 218px; +} +.retail .toggle-box { + display: none; +} +.retail-table { + width: 100%; + border: none; + border-radius: 20px; +} +.retail-table thead th { + background: rgba(122, 122, 122, 0.15); + font-size: 16px; +} +.retail-table tbody tr td { + border-bottom: 1px solid #ccc; +} +.retail-table td, +.retail-table th { + color: #333; + font-size: 14px; + line-height: 60px; + padding: 4px 4px 4px 6px; + max-width: 300px; + vertical-align: middle; +} +.retail-table-no-wrap { + white-space: nowrap; +} +.retail-table-center { + text-align: center; +} +.retail-table-sort__btn, +.retail-table-sort__switch { + cursor: pointer; +} +.retail-table-sort__btn:hover, +.retail-table-sort__switch:hover { + color: #005add; +} +.retail-table-sort__btn { + float: left; + clear: both; + line-height: 15px; + font-size: 20px; + padding-left: 10px; + padding-right: 10px; + opacity: 0; + transition: opacity 0.2s ease-out; +} +.retail-table-sort__btn-wrap { + position: absolute; +} +.retail-table-sort__asc { + padding-top: 15px; + padding-bottom: 0; +} +.retail-table-sort__desc { + padding-top: 0; + padding-bottom: 15px; +} +.retail-table-sort thead th:hover .retail-table-sort__btn, +.retail-table-sort thead td:hover .retail-table-sort__btn { + opacity: 1; +} +.retail-collapsible__input { + display: none; +} +label.retail-collapsible__title { + cursor: pointer; + font-weight: normal; + text-align: center; + padding: 0; + position: relative; + line-height: 1; + width: 100%; +} +label.retail-collapsible__title:before { + content: '\25B6'; + opacity: 0; + transition: opacity 0.2s ease-out; +} +label.retail-collapsible__title:hover:before { + opacity: 1; +} +.retail-collapsible__content { + text-align: left; + font-size: 12px; + line-height: 1.5; + background: #fff; + border: 1px solid rgba(122, 122, 122, 0.15); + position: absolute; + top: 20px; + left: 0; + padding: 18px; + margin: 0; + border-radius: 20px; + overflow: hidden; + max-height: 0; + transition-duration: 0.2s; + transition-timing-function: ease-out; + transition-property: max-height, visibility; + visibility: hidden; +} +.retail-collapsible__input:checked + .retail-collapsible__title .retail-collapsible__content { + max-height: 100vh; + visibility: visible; +} +.retail-error-msg, +.retail-error-msg:after, +.retail-error-msg:before { + color: #dd2e44; +} diff --git a/retailcrm/views/js/retailcrm.js b/retailcrm/views/js/retailcrm.js index fbaa89b..a504d4b 100644 --- a/retailcrm/views/js/retailcrm.js +++ b/retailcrm/views/js/retailcrm.js @@ -39,6 +39,7 @@ $(function(){ var Main = { init: function() { this.selects.init(); + this.tableSort.init(); this.player.init(); this.tabs.init(); this.uploadForm.init(this.settingsTabs.init()); @@ -99,6 +100,73 @@ $(function(){ }); } }, + tableSort: { + init: function () { + var _this = this; + + $('.retail-table-sort').each((i, table) => { + $(table).find('.retail-table-sort__switch').each((j, header) => { + const column = $(header).closest('th,td').index(); + $(header).click((e) => { + e.preventDefault(); + _this.sort(table, column); + }) + }) + $(table).find('.retail-table-sort__asc').each((j, header) => { + const column = $(header).closest('th,td').index(); + $(header).click((e) => { + e.preventDefault(); + _this.sort(table, column, 'asc'); + }) + }) + $(table).find('.retail-table-sort__desc').each((j, header) => { + const column = $(header).closest('th,td').index(); + $(header).click((e) => { + e.preventDefault(); + _this.sort(table, column, 'desc'); + }) + }) + + $(table).find('.retail-table-sort__initial').click(); + }); + }, + sort: function (table, column, direction = undefined) { + let rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0; + switching = true; + dir = (direction ? direction : "asc"); + + while (switching) { + switching = false; + rows = table.rows; + for (i = 1; i < (rows.length - 1); i++) { + shouldSwitch = false; + x = rows[i].getElementsByTagName("TD")[column]; + y = rows[i + 1].getElementsByTagName("TD")[column]; + if (dir === "asc") { + if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) { + shouldSwitch = true; + break; + } + } else if (dir === "desc") { + if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) { + shouldSwitch = true; + break; + } + } + } + if (shouldSwitch) { + rows[i].parentNode.insertBefore(rows[i + 1], rows[i]); + switching = true; + switchcount ++; + } else { + if (direction === undefined && switchcount === 0 && dir === "asc") { + dir = "desc"; + switching = true; + } + } + } + } + }, player: { init: function () { window.player = {}; @@ -150,6 +218,7 @@ $(function(){ 'rcrm_tab_order_statuses': selectsUpdate, 'rcrm_tab_payment_types': selectsUpdate, 'rcrm_tab_consultant': mainSubmitHide, + 'rcrm_tab_job_manager': mainSubmitHide, 'rcrm_tab_orders_upload': mainSubmitHide }); tabs.initializeTabs(); diff --git a/retailcrm/views/js/retailcrm.min.js b/retailcrm/views/js/retailcrm.min.js index 42bf44d..7bb64a9 100644 --- a/retailcrm/views/js/retailcrm.min.js +++ b/retailcrm/views/js/retailcrm.min.js @@ -1,36 +1 @@ -/** - * MIT License - * - * Copyright (c) 2020 DIGITAL RETAIL TECHNOLOGIES SL - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade PrestaShop to newer - * versions in the future. If you wish to customize PrestaShop for your - * needs please refer to http://www.prestashop.com for more information. - * - * @author DIGITAL RETAIL TECHNOLOGIES SL - * @copyright 2020 DIGITAL RETAIL TECHNOLOGIES SL - * @license https://opensource.org/licenses/MIT The MIT License - * - * Don't forget to prefix your containers with your own identifier - * to avoid any conflicts with others containers. - */$(function(){var t={init:function(){this.selects.init(),this.player.init(),this.tabs.init(),this.uploadForm.init(this.settingsTabs.init()),this.popup.init(),this.toggleBox(),this.trimConsultant(),this.showSettings()},selects:{init:function(){var t=this;try{$(".jq-select").SumoSelect(),$("li.opt").each((t,e)=>{if(0===$(e).find("label").html().length){let t=$(e).closest("ul").closest("div").parent().find("select");$(e).find("label").html(t.attr("placeholder")),$(e).addClass("disabled")}}),t.update(),$(document).on("change",".jq-select",function(){t.update()})}catch(t){console.warn("Cannot initialize select: "+t.message)}},update:function(){var t={};let e=$(".retail-tab__enabled").find("select:not(#RETAILCRM_API_DELIVERY_DEFAULT, #RETAILCRM_API_PAYMENT_DEFAULT)");e.each((e,i)=>{var a=$(i).val();a&&a.length&&(t[e]=$('option[value="'+$(i).val()+'"]',$(i)).index())});let i=Object.values(t);e.each((e,a)=>{$("option",a).each((n,s)=>{-1===$.inArray(n,i)||void 0!==t[e]&&t[e]==n?a.sumo.enableItem(n):a.sumo.disableItem(n)})})}},player:{init:function(){window.player={},window.onYouTubeIframeAPIReady=function(){window.player=new YT.Player("player",{height:"100%",width:"100%",videoId:window.RCRMPROMO})};var t=document.createElement("script");t.src="https://www.youtube.com/iframe_api",document.body.appendChild(t)}},settingsTabs:{init:function(){if("undefined"==typeof RCRMTabs)return;let e=new RCRMTabs('div[id^="rcrm_tab_"]',".retail-menu__btn","retail-tab__enabled","retail-tab__disabled","retail-menu__btn_active","retail-menu__btn_inactive","tab-trigger",".rcrm-form-submit-trigger"),i={afterActivate:function(){t.selects.update()}},a={beforeActivate:function(){$("#main-submit").hide()},afterDeactivate:function(){$("#main-submit").show()}};return e.tabsCallbacks({rcrm_tab_delivery_types:i,rcrm_tab_order_statuses:i,rcrm_tab_payment_types:i,rcrm_tab_consultant:a,rcrm_tab_orders_upload:a}),e.initializeTabs(),e}},uploadForm:{init:function(t){"undefined"!=typeof RetailcrmUploadForm&&new RetailcrmUploadForm(t)}},tabs:{init:function(){$(".retail-tabs__btn").on("click",this.swithTab)},swithTab:function(t){t.preventDefault();var e=$(this).attr("href");$(".retail-tabs__btn_active").removeClass("retail-tabs__btn_active"),$(".retail-tabs__item_active").removeClass("retail-tabs__item_active").fadeOut(150,function(){$(e).addClass("retail-tabs__item_active").fadeIn(150)}),$(this).addClass("retail-tabs__btn_active")}},popup:{init:function(){var t=this;$("[data-popup]").on("click",function(e){var i=$(this).data("popup");t.open($(i))}),$(".retail-popup-wrap").on("click",function(e){if($(e.target).hasClass("js-popup-close")){var i=$(this).find(".retail-popup");t.close(i)}})},open:function(t){t&&(t.closest(".retail-popup-wrap").fadeIn(200),t.addClass("open"),player.playVideo())},close:function(t){var e=t.closest(".retail-popup-wrap");t.removeClass("open"),e.fadeOut(200),player.stopVideo()}},toggleBox:function(){$(".toggle-btn").on("click",function(t){t.preventDefault();var e=$(this).attr("href"),i=$(e);$(this).closest(".retail-btns").addClass("retail-btns_hide").slideUp(100),i.slideDown(100)})},trimConsultant:function(){let t=$("#rcrm_tab_consultant textarea");t.text(t.text().trim())},showSettings:function(){$(".retail.retail-wrap.hidden").removeClass("hidden")}};t.init()}); \ No newline at end of file +$(function(){var Main={init:function(){this.selects.init();this.tableSort.init();this.player.init();this.tabs.init();this.uploadForm.init(this.settingsTabs.init());this.popup.init();this.toggleBox();this.trimConsultant();this.showSettings()},selects:{init:function(){var _this=this;try{$(".jq-select").SumoSelect();$("li.opt").each((_,el)=>{if($(el).find("label").html().length===0){let select=$(el).closest("ul").closest("div").parent().find("select");$(el).find("label").html(select.attr("placeholder"));$(el).addClass("disabled")}});_this.update();$(document).on("change",".jq-select",function(){_this.update()})}catch(e){console.warn("Cannot initialize select: "+e.message)}},update:function(){var selected={};let selects=$(".retail-tab__enabled").find("select:not(#RETAILCRM_API_DELIVERY_DEFAULT, #RETAILCRM_API_PAYMENT_DEFAULT)");selects.each((i,select)=>{var value=$(select).val();if(value&&value.length){selected[i]=$('option[value="'+$(select).val()+'"]',$(select)).index()}});let values=Object.values(selected);selects.each((i,select)=>{$("option",select).each((o,option)=>{if($.inArray(o,values)===-1||typeof selected[i]!=="undefined"&&selected[i]==o){select.sumo.enableItem(o)}else{select.sumo.disableItem(o)}})})}},tableSort:{init:function(){var _this=this;$(".retail-table-sort").each((i,table)=>{$(table).find(".retail-table-sort__switch").each((j,header)=>{const column=$(header).closest("th,td").index();$(header).click(e=>{e.preventDefault();_this.sort(table,column)})});$(table).find(".retail-table-sort__asc").each((j,header)=>{const column=$(header).closest("th,td").index();$(header).click(e=>{e.preventDefault();_this.sort(table,column,"asc")})});$(table).find(".retail-table-sort__desc").each((j,header)=>{const column=$(header).closest("th,td").index();$(header).click(e=>{e.preventDefault();_this.sort(table,column,"desc")})});$(table).find(".retail-table-sort__initial").click()})},sort:function(table,column,direction=undefined){let rows,switching,i,x,y,shouldSwitch,dir,switchcount=0;switching=true;dir=direction?direction:"asc";while(switching){switching=false;rows=table.rows;for(i=1;iy.innerHTML.toLowerCase()){shouldSwitch=true;break}}else if(dir==="desc"){if(x.innerHTML.toLowerCase(){l s='Abandoned carts' mod='retailcrm'} {l s='Daemon Collector' mod='retailcrm'} {l s='Online consultant' mod='retailcrm'} + {l s='Job Manager' mod='retailcrm'}
@@ -216,6 +217,65 @@ +
+
{l s='Job Manager' mod='retailcrm'}
+ + + + + + + + + + + {foreach from=$lastRunDetails key=key item=item} + + + + + + + {/foreach} + +
+ {l s='Job name' mod='retailcrm'} +
+ + +
+ {l s='Last Run' mod='retailcrm'}
+ {l s='Status' mod='retailcrm'} + {l s='Comment' mod='retailcrm'}
+ {if isset($jobsNames[$key]) } + {l s=$jobsNames[$key] mod='retailcrm'} + {else} + {$key} + {/if} + {if isset($item['lastRun'])}{$item['lastRun']|date_format:'Y-m-d H:i:s'}{/if} + {if isset($item['success'])} + {if $item['success'] === true} + + ✔ + + {else} + + ❌ + + {/if} + {/if} + + {if isset($item['error']['message'])} + + + {/if} +
+