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: 112: 113: 114: 115: 116: 117: 118: 119: 120:
<?php
namespace FlexiPeeHP\ui;
class OrderListingItem extends \Ease\TWB\Row
{
public function __construct($itemdata, $evidence)
{
parent::__construct();
$this->addTagClass('row-hover');
$this->addColumn(2,
new \Ease\Html\StrongTag(new \Ease\Html\ATag('getpdf.php?id='.$itemdata['id'].'&evidence='.$evidence.'&embed=true',
$itemdata['kod'])));
$this->addColumn(2,
$itemdata['sumCelkem'].' '.str_replace('code:', '',
$itemdata['mena']));
if (array_key_exists('datSplat', $itemdata)) {
$this->addColumn(1,
!empty(trim($itemdata['datSplat'])) ? \FlexiPeeHP\FlexiBeeRO::flexiDateToDateTime($itemdata['datSplat'])->format('d.m.Y')
: '' );
}
if ($itemdata['storno'] == 'true') {
$column2 = new \Ease\TWB\Label('default', _('Storno'));
} else {
switch ($evidence) {
case 'faktura-vydana':
if (strstr($itemdata['stavUhrK'], 'stavUhr.uhrazeno')) {
$column2 = new \Ease\TWB\Label('success', _('Settled'));
} else {
$column2 = self::dueLabel($itemdata['datSplat']);
}
break;
case 'objednavka-prijata':
if ($itemdata['stavUzivK'] == 'stavDoklObch.hotovo') {
$column2 = new \Ease\TWB\Label('success', _('Done'));
} else {
$column2 = new \Ease\TWB\Label('warning',
_('Open').': '.str_replace('stavDoklObch.', '',
$itemdata['stavUzivK']));
}
break;
default :
$column2 = '';
break;
}
}
$this->addColumn(2, $column2);
$links = [
new \Ease\Html\ATag('document.php?id='.$itemdata['id'].'&embed=true&evidence='.$evidence,
new \Ease\Html\ImgTag('images/oko.svg', _('Show'),
['height' => '20px']), 'info', ['title' => _('Show')])
,
new \Ease\Html\ATag('getpdf.php?id='.$itemdata['id'].'&evidence='.$evidence,
new \Ease\Html\ImgTag('images/download.svg', _('Download'),
['height' => '20px']), 'success', ['title' => _('Download')])
];
if ($evidence == 'faktura-vydana') {
$links[] = new \Ease\Html\ATag('getisdoc.php?id='.$itemdata['id'].'&evidence='.$evidence,
new \Ease\Html\ImgTag('images/ISDOC.png', _('ISDOC'),
['height' => '20px']), 'success', ['title' => _('ISDOC')]);
}
$this->addColumn(2, $links);
}
static function price($data)
{
switch ($data['']) {
case '':
break;
}
return new \Ease\TWB\Label($type, $content);
}
static function dueLabel($date)
{
$days = \FlexiPeeHP\Bricks\Upominac::poSplatnosti($date);
if ($days < 0) {
$type = 'success';
$msg = sprintf(_(' %s days to due'),
new \Ease\TWB\Badge(abs($days)));
} else {
$msg = sprintf(_(' %s days after due'),
new \Ease\TWB\Badge(abs($days)));
if ($days > 14) {
$type = 'danger';
} else {
$type = 'warning';
}
}
return new \Ease\TWB\Label($type, $msg);
}
}