public function renderChangePasswordForm()
 {
     FormViewHelper::init();
     FormViewHelper::setAttribute('class', 'productForm');
     FormViewHelper::setMethod("post");
     FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'account/changePassword');
     FormViewHelper::initPasswordField()->setName("newPassword")->setAttribute('placeholder', 'New password')->create();
     FormViewHelper::initPasswordField()->setName("confirmPassword")->setAttribute('placeholder', 'Confirm password')->create();
     FormViewHelper::initSubmitButton()->setValue("Change password")->setAttribute('class', 'btn btn-danger')->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::initHiddenField()->setName("categoryId")->setValue($this->currentCategoryId)->create();
         \EShop\Helpers\ViewHelpers\FormViewHelper::initNumberField()->setName("quantity")->setAttribute("placeholder", "Quantity")->setAttribute('min', '1')->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 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 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 renderCategoriesPromoMenu()
 {
     if (AppUserRolesConfig::isAdmin()) {
         FormViewHelper::init();
         FormViewHelper::setAttribute('class', 'productForm');
         FormViewHelper::setMethod("post");
         FormViewHelper::setAction(\EShop\Config\RouteConfig::getBasePath() . 'admin/admin/addPromotionOnCategory');
         FormViewHelper::initNumberField()->setAttribute('placeholder', 'Category promo in %')->setName('discount')->setAttribute('class', 'discount')->create();
         $select = FormViewHelper::initSelect();
         $select->setName("categoryId");
         foreach ($this->categories as $category) {
             $select->addOption($category->getid(), $category->getName());
         }
         $select->create();
         FormViewHelper::initSubmitButton()->setValue('Add promotion')->setAttribute('class', 'btn btn-primary')->create();
         FormViewHelper::render();
     }
 }