1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111:
<?php
namespace SpojeNet\System;
require_once 'includes/Init.php';
$oPage->onlyForUser();
$address_id = $oPage->getRequestValue('id');
if (!strstr($address_id, 'code:')) {
$address_id = intval($address_id);
}
$address = Engine::doThings($oPage);
if (is_null($address)) {
$address = new \FlexiPeeHP\Adresar($address_id,
['defaultUrlParams' => ['relations' => 'kontakt']]);
}
if ($oPage->getGetValue('delete', 'bool') == 'true') {
if ($address->delete()) {
$oPage->redirect('addresar.php');
exit;
}
}
function operationsMenu($address)
{
$id = $address->getMyKey();
$menu[] = new \Ease\Html\ATag($address->getEvidence().'.php?'.$address->keyColumn.'='.$id,
\Ease\TWB\Part::glyphIcon('edit').' '._('Edit'));
$menu[] = new \Ease\Html\ATag('loginas.php?'.$address->keyColumn.'='.$id,
\Ease\TWB\Part::glyphIcon('transfer').' '._('Login as Customer'));
return new \Ease\TWB\ButtonDropdown(\Ease\TWB\Part::glyphIcon('cog'),
'warning', '', $menu);
}
$oPage->addItem(new ui\PageTop(_('Address').': '.$address->getDataValue('nazev')));
$addressRow = new \Ease\TWB\Row();
$infoColumn = $addressRow->addColumn(4,
[new ui\ZewlScoreLabel($address), new ui\InvoicesOfAddresButton($address), new ui\LabelSwitches($address)]);
switch ($oPage->getRequestValue('action')) {
case 'delete':
$confirmBlock = new \Ease\TWB\Well();
$confirmBlock->addItem($address);
$confirmator = $confirmBlock->addItem(new \Ease\TWB\Panel(_('Delete ?')),
'danger');
$confirmator->addItem(new \Ease\TWB\LinkButton('addresar.php?id='.$address->getId(),
_('Ne').' '.\Ease\TWB\Part::glyphIcon('ok'), 'success'));
$confirmator->addItem(new \Ease\TWB\LinkButton('?delete=true&'.$address->keyColumn.'='.$address->getID(),
_('Ano').' '.\Ease\TWB\Part::glyphIcon('remove'), 'danger'));
$headerRow = new \Ease\TWB\Row();
$headerRow->addColumn(8,
'<strong>'.$address->getContactName().'</strong>');
$headerRow->addColumn(4,
new ui\LinkToFlexiBeeButton($address, ['style' => 'width: 20px']));
$addressRow->addColumn(8,
new \Ease\TWB\Panel($headerRow, 'info', $confirmBlock));
break;
default :
$operationsMenu = operationsMenu($address);
$operationsMenu->setTagCss(['float' => 'right']);
$operationsMenu->dropdown->addTagClass('pull-right');
$headerRow = new \Ease\TWB\Row();
$headerRow->addColumn(8,
'<strong>'.$address->getDataValue('kod').' - '.$address->getDataValue('nazev').'</strong>');
$headerRow->addColumn(4,
new ui\LinkToFlexiBeeButton($address, ['style' => 'width: 20px']));
$addressRow->addColumn(8,
new \Ease\TWB\Panel($headerRow, 'info',
new ui\AddressForm($address),
[new ui\AddressContactsLinks($address), $operationsMenu]));
break;
}
$addressRow->addItem(new ui\IntegrationOverview($address));
$oPage->container->addItem($addressRow);
$oPage->addItem(new ui\PageBottom());
$oPage->draw();