<?php
 namespace Modules\RemoteData\InfoBox; class View_FrequentBuyerCard extends \App\Mvc\View_RemoteDataInfoBoxEntityAbstract { protected function getEntityRemoteDetails(\App\Entity\SelectAbstract $entity) { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); $_LANG = \App\Loader_Lang::getInstance()->getAll(); $customer = $entity->customer; $output = \Engine\RemoteData\InfoBox\Container_Main::create( $entity->cardNumber ) ->setShortTitle($entity->cardNumber) ->setId($entity->getId()); if (\App\UserAccess\CurrentUserAccessFast::getInstance()->hasAccessToOption('Modules/Partners/Customers/FrequentBuyerCards-update')) { $icon = \Engine\RemoteData\InfoBox\Icon\Icon::create('edit'); $icon->setTooltip($this->lang['FrequentBuyerCard']['option']['update']); $icon->setJsCallback("Popup2.create().setId('cardUpdateWindow').setUrl( MVC.appUrl('Partners/Customers/FrequentBuyerCards', 'update', {'id': '{$entity->getId()}'}) ).setDimensions(760, 570).show();"); $output->addIcon($icon); } $cont1 = \Engine\RemoteData\InfoBox\Container_Simple::create($this->lang['FrequentBuyerCard']['titles']['generalData']); $output->addContainer($cont1); $cont1->addField( \Engine\RemoteData\InfoBox\Field_String::create($this->lang['general']['fields']['id'], $entity->getId())); $cont1->addField( \Engine\RemoteData\InfoBox\Field_String::create($this->lang['FrequentBuyerCard']['fields']['cardNumber'], $entity->cardNumber)); $name = $customer->nameStandard; if($CFG['useAlternativeNames']['customers'] && $customer->nameLocal) { $name .= sprintf(" (%s)", $entity->nameLocal); } $cont1->addField( \App\RemoteData\InfoBox\Field_EntityInfoBox::create($this->lang['FrequentBuyerCard']['fields']['name'], $name)->setEntity('customer', $customer->getId()) ); $cont1->addField( \Engine\RemoteData\InfoBox\Field_String::create($this->lang['customer']['fields']['type'], $_LANG['generalData']['personTypes'][$customer->type]) ); if ($entity->suppliersList) { $cont2 = \Engine\RemoteData\InfoBox\Container_Simple::create($this->lang['FrequentBuyerCard']['titles']['supplierData']); $output->addContainer($cont2); foreach($entity->suppliersList as $idSupplier) { $cont2->addField( \App\RemoteData\InfoBox\Field_EntityInfoBox::create(null, \Entity\Supplier::select($idSupplier)->alias)->setEntity('supplier', $idSupplier) ); } } $cont7 = \Engine\RemoteData\InfoBox\Container_Simple::create($this->lang['general']['titles']['updates'])->setHidden(true); $output->addContainer($cont7); $cont7->addField( \Engine\RemoteData\InfoBox\Field_DateTime::create($this->lang['general']['fields']['addTime'], \Engine\DateTime::createFromTimestamp($entity->addTime)) ); $cont7->addField( \App\RemoteData\InfoBox\Field_EntityInfoBox::create($this->lang['general']['fields']['addUser'], $entity->addUser->name)->setEntity('user', $entity->idAddUser) ); $cont7->addField( \Engine\RemoteData\InfoBox\Field_DateTime::create($this->lang['general']['fields']['updateTime'], \Engine\DateTime::createFromTimestamp($entity->lastUpdateTime)) ); $cont7->addField( \App\RemoteData\InfoBox\Field_EntityInfoBox::create($this->lang['general']['fields']['updateUser'], $entity->updateUser->name)->setEntity('user', $entity->idUpdateUser) ); if ($entity->updatesCount) { $cont7->addField( \Engine\RemoteData\InfoBox\Field_String::create($this->lang['general']['fields']['updatesCount'], $entity->updatesCount) ); } return $output; } } 