/**
  * E-mail template edit
  */
 function createComponentEditForm()
 {
     $emailDb = $this->database->table("helpdesk_emails")->get($this->presenter->getParameter("id"));
     $form = new \Nette\Forms\BootstrapUIForm();
     $form->getElementPrototype()->class = "form-horizontal";
     $form->getElementPrototype()->id = "search-form";
     $form->getElementPrototype()->role = 'form';
     $form->getElementPrototype()->autocomplete = 'off';
     $form->addHidden("id");
     $form->addText("subject");
     $form->addTextArea("body")->setAttribute("style", "width: 500px;")->setHtmlId("wysiwyg");
     $form->setDefaults(array("id" => $this->presenter->getParameter("id"), "subject" => $emailDb->subject, "body" => $emailDb->body));
     $form->onSuccess[] = $this->editFormSucceeded;
     return $form;
 }
 /**
  * Edit category
  */
 protected function createComponentEditForm()
 {
     $carousel = $this->database->table("carousel")->get($this->presenter->getParameter("id"));
     $form = new \Nette\Forms\BootstrapUIForm();
     $form->setTranslator($this->presenter->translator);
     $form->getElementPrototype()->class = "form-horizontal";
     $form->getElementPrototype()->role = 'form';
     $form->getElementPrototype()->autocomplete = 'off';
     $form->addHidden('carousel_id');
     $form->addText('title', 'dictionary.main.Title');
     $form->addTextArea('description', 'dictionary.main.Description')->setAttribute("class", "form-control")->setAttribute("style", "max-height: 150px;");
     $form->addText('uri', 'dictionary.main.URL');
     $form->addCheckbox("visible", "dictionary.main.Show");
     $form->addUpload('the_file', 'dictionary.main.Icon');
     $form->addSubmit('submitm', 'dictionary.main.Save');
     $arr = array("carousel_id" => $carousel->id, "title" => $carousel->title, "description" => $carousel->description, "visible" => $carousel->visible, "uri" => $carousel->uri);
     $form->setDefaults(array_filter($arr));
     $form->onSuccess[] = $this->editFormSucceeded;
     return $form;
 }
 function createComponentSendForm()
 {
     $helpdesk = $this->database->table("helpdesk")->get(1);
     $form = new \Nette\Forms\BootstrapUIForm();
     $form->setTranslator($this->presenter->translator);
     $form->getElementPrototype()->class = "form-horizontal";
     $form->getElementPrototype()->role = 'form';
     $form->getElementPrototype()->autocomplete = 'off';
     $form->addText("name", "messages.helpdesk.name")->setAttribute("placeholder", "messages.helpdesk.name");
     $form->addText("email", "messages.helpdesk.email")->setAttribute("placeholder", "messages.helpdesk.email")->setOption("description", 1);
     if ($helpdesk->fill_phone > 0) {
         $form->addText("phone", "messages.helpdesk.phone")->setAttribute("placeholder", "messages.helpdesk.phone")->setOption("description", 1);
     }
     $form->addTextArea("message", "messages.helpdesk.message")->setAttribute("placeholder", "messages.helpdesk.message")->setAttribute("class", "form-control");
     $form->setDefaults(array("name" => $this->getParameter("name"), "email" => $this->getParameter("email"), "phone" => $this->getParameter("phone"), "message" => $this->getParameter("message")));
     $form->addSubmit("submitm", "messages.helpdesk.send")->setAttribute("class", "btn btn-primary");
     $form->onValidate[] = $this->sendFormValidated;
     $form->onSuccess[] = $this->sendFormSucceeded;
     return $form;
 }
 /**
  * Edit contact
  */
 function createComponentEditForm()
 {
     $this->template->id = $this->presenter->getParameter('id');
     $categories = new \App\Model\Category($this->database);
     $cats = $categories->getSubIds(2);
     $groups = $this->database->table("categories")->where("id", $cats)->fetchPairs("id", "title");
     $form = new \Nette\Forms\BootstrapUIForm();
     $form->setTranslator($this->presenter->translator);
     $form->getElementPrototype()->class = "form-horizontal";
     $form->getElementPrototype()->role = 'form';
     $form->getElementPrototype()->autocomplete = 'off';
     $form->addGroup('');
     $form->addHidden('contact_id');
     $form->addHidden('pages_id');
     $form->addText("name", "dictionary.main.Name")->setAttribute("placeholder", "dictionary.main.Name");
     $form->addText("company", "dictionary.main.Company")->setAttribute("placeholder", "dictionary.main.Company");
     $form->addRadioList("type", "Osoba nebo organizace", array(0 => " osoby", 1 => " organizace"));
     $form->addText("post", "dictionary.main.Post")->setAttribute("placeholder", "dictionary.main.Post")->setOption("description", 1);
     $form->addText("email", "E-mail")->setAttribute("placeholder", "dictionary.main.Email")->setAttribute("class", "form-control");
     $form->addText("phone", "dictionary.main.Phone")->setAttribute("placeholder", "dictionary.main.Phone")->setAttribute("class", "form-control");
     $form->addSelect("categories_id", "dictionary.main.Category", $groups)->setAttribute("class", "form-control");
     $form->addGroup('dictionary.main.Address');
     $form->addText("street", "Ulice")->setAttribute("placeholder", "dictionary.main.Street")->setOption("description", 1);
     $form->addText("zip", "dictionary.main.ZIP")->setAttribute("placeholder", "dictionary.main.ZIP")->setOption("description", 1);
     $form->addText("city", "Město")->setAttribute("placeholder", "Město")->setOption("description", 1);
     $form->addGroup('Firemní údaje');
     $form->addText("vatin", "IČ")->setAttribute("placeholder", "dictionary.main.VatIn")->setOption("description", 1);
     $form->addText("vatid", "DIČ")->setAttribute("placeholder", "dictionary.main.VatId")->setHtmlId("kurzy_ico")->setOption("description", 1);
     $form->addText("banking_account", "Bankovní účet")->setAttribute("placeholder", "Bankovní účet")->setOption("description", 1);
     $form->addText("dateofbirth", "Datum narození")->setAttribute("placeholder", "Datum narození");
     $form->addGroup('Ostatní');
     $form->addTextArea("notes", "dictionary.main.Notes")->setAttribute("class", "form-control");
     $page = $this->database->table("pages")->get($this->presenter->getParameter("id"));
     $contact = $this->database->table("contacts")->where("pages_id", $this->presenter->getParameter("id"))->fetch();
     $arr = array("contact_id" => $contact->id, "pages_id" => $page->id, "name" => $contact->name, "company" => $contact->company, "post" => $contact->post, "type" => $contact->type, "email" => $contact->email, "phone" => $contact->phone, "categories_id" => $contact->categories_id, "street" => $contact->street, "zip" => $contact->zip, "city" => $contact->city, "banking_account" => $contact->banking_account, "vatin" => $contact->vatin, "vatid" => $contact->vatid, "notes" => $contact->notes, "dateofbirth" => $contact->date_of_birth);
     $form->setDefaults($arr);
     $form->addSubmit("submitm", "dictionary.main.Save")->setAttribute("class", "btn btn-success");
     $form->onSuccess[] = $this->editFormSucceeded;
     $form->onValidate[] = $this->editFormValidated;
     return $form;
 }