public function renderSoldProducts()
 {
     if (AppUserRolesConfig::hasAddEditDeletePriviligies()) {
         if ($this->soldProducts) {
             FormViewHelper::init();
             FormViewHelper::setMethod("post");
             FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'account/reorder');
             FormViewHelper::setAttribute('class', 'productForm');
             $select = FormViewHelper::initSelect();
             $select->setName('productId');
             foreach ($this->soldProducts as $product) {
                 $select->addOption($product->getId(), $product->getName());
             }
             $select->create();
             FormViewHelper::initNumberField()->setName('quantity')->setAttribute('min', '1')->setAttribute('placeholder', 'Order counts')->create();
             FormViewHelper::initSubmitButton()->setValue('Reorder')->setAttribute('class', 'btn btn-primary')->create();
             FormViewHelper::render();
         }
     }
 }
 public function renderAddProductMenu()
 {
     if (AppUserRolesConfig::hasAddEditDeletePriviligies()) {
         \EShop\Helpers\ViewHelpers\FormViewHelper::init();
         FormViewHelper::setAttribute('class', 'form-horizontal productForm');
         \EShop\Helpers\ViewHelpers\FormViewHelper::initTextField()->setName("productName")->setAttribute('placeholder', 'Product name...')->create();
         \EShop\Helpers\ViewHelpers\FormViewHelper::initTextField()->setName("productPrice")->setAttribute("placeholder", "Product price")->create();
         \EShop\Helpers\ViewHelpers\FormViewHelper::initNumberField()->setName("quantity")->setAttribute("placeholder", "Quantity")->setAttribute('min', '1')->create();
         $select = FormViewHelper::initSelect();
         $select->setName('categoryId');
         foreach ($this->categoryViewModel as $model) {
             $select->addOption($model->getId(), $model->getName());
         }
         $select->create();
         \EShop\Helpers\ViewHelpers\FormViewHelper::initSubmitButton()->setValue('Add Product')->setAttribute('class', 'btn btn-default')->create();
         \EShop\Helpers\ViewHelpers\FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'products/addProduct');
         \EShop\Helpers\ViewHelpers\FormViewHelper::setMethod("post");
         \EShop\Helpers\ViewHelpers\FormViewHelper::render();
     }
 }
 public function renderProduct()
 {
     if (AppUserRolesConfig::hasAddEditDeletePriviligies()) {
         FormViewHelper::init();
         FormViewHelper::setAttribute('class', 'productForm');
         FormViewHelper::setMethod("post");
         FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'products/edit');
         FormViewHelper::initTextField()->setName('productName')->setValue($this->productOldInformation->getProductName())->setAttribute('class', 'form-group')->create();
         FormViewHelper::initHiddenField()->setName('productId')->setValue($this->productOldInformation->getProductId())->setAttribute('class', 'form-group')->create();
         FormViewHelper::initTextField()->setName('quantity')->setValue($this->productOldInformation->getQuantity())->create();
         $select = FormViewHelper::initSelect();
         $select->setAttribute('class', 'form-group');
         $select->setName('categoryId');
         foreach ($this->categories as $category) {
             if ($category->getId() == $this->productOldInformation->getCategoryId()) {
                 $select->addOption($category->getId(), $category->getName(), true);
             } else {
                 $select->addOption($category->getId(), $category->getName());
             }
         }
         $select->create();
         FormViewHelper::initSubmitButton()->setValue('Edit')->setAttribute('class', 'btn-primary btn-lg')->create()->render();
     }
 }
 public function renderCertainProductsPromoMenu()
 {
     if (AppUserRolesConfig::isAdmin()) {
         FormViewHelper::init();
         FormViewHelper::setMethod("post");
         FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'admin/admin/addPromotionOnCertainProduct');
         $select = FormViewHelper::initSelect();
         $select->setName('productId');
         foreach ($this->allProducts as $product) {
             $select->addOption($product->getid(), $product->getName());
         }
         $select->create();
         FormViewHelper::initNumberField()->setAttribute('placeholder', 'Product promo in %')->setName('discount')->setAttribute('class', 'discount')->create();
         FormViewHelper::initSubmitButton()->setValue('Add promotion')->setAttribute('class', 'btn btn-primary')->create();
         FormViewHelper::render();
     }
 }