Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 30 2021 08:29
    Lumeriol opened #17
  • Feb 15 2021 09:45

    paveljanda on v1.2.1

    (compare)

  • Feb 15 2021 09:45

    paveljanda on master

    MailLogger: set more_entropy to… Merge pull request #17 from mar… (compare)

  • Feb 15 2021 09:45
    paveljanda closed #17
  • Feb 15 2021 09:44
    paveljanda commented #17
  • Feb 15 2021 08:38
    martenb synchronize #17
  • Feb 15 2021 08:36
    martenb synchronize #17
  • Feb 15 2021 08:34
    martenb opened #17
  • May 29 2020 11:29
    tombit-sro opened #16
  • May 14 2020 06:51
    petrgala closed #10
  • May 14 2020 06:50
    petrgala opened #10
  • Apr 21 2020 19:19
    paveljanda closed #16
  • Apr 21 2020 19:19
    paveljanda commented #16
  • Apr 21 2020 19:19

    paveljanda on master

    README.md (compare)

  • Apr 21 2020 19:10

    paveljanda on master

    package.json (compare)

  • Apr 21 2020 19:09

    paveljanda on v2.1.0

    (compare)

  • Apr 21 2020 12:55

    paveljanda on master

    src/nomodule-es5-fallback.js (compare)

  • Apr 21 2020 12:47

    paveljanda on master

    src/nomodule-fallback.js (compare)

  • Apr 21 2020 12:16
    paveljanda commented #16
  • Apr 21 2020 11:10

    paveljanda on master

    src/nomodule-fallback.js (compare)

David Skála
@Griston2524_twitter
trochu to rozveď, tímhle jsi toho moc neřekl
Petr Parolek
@petrparolek
když dám /test/show-detail?id=4, tak ajax mě přesune na /test/show-detail
já nepoužívám ajax pro načítání
jak to říct datagridu, aby mě vrátil na url i s ID
David Skála
@Griston2524_twitter
a to zadáváš do url nebo klikneš na nějaký odkaz?
Petr Parolek
@petrparolek
kliknu na odkaz a zobrazí se mi ten detail
kde je datagrid
David Skála
@Griston2524_twitter
který detail?
Petr Parolek
@petrparolek
a ten mi udělá paseku
z /test/blabla
David Skála
@Griston2524_twitter
když by ti tohle někdo napsal, tušil by jsi co má za problém?
Petr Parolek
@petrparolek
tady kliknu na detail položky a tady proběhne ten špatný redirect
bez id
Petr Parolek
@petrparolek
@Griston2524_twitter nevíš?
David Skála
@Griston2524_twitter
já nevím jak to máš napsaný, z toho co jsi poslal Ti nedokážu nic říct.
Petr Parolek
@petrparolek
```
public function createComponentInvoiceDetailGrid($name) {
        $data = $this->invoicesRepository->fetchInvoiceDetail($this->getParameter("id"));

        $grid = new DataGrid($this, $name);

        $grid->setDataSource($data);

        $grid->addColumnNumber('id', 'Id');

        $grid->addColumnText('title', 'Název položky');

        $grid->addColumnNumber('quantity', 'Počet');

        $grid->addColumnText('unit', 'Jednotka');

        $currency = ['Kč'];

        $grid->addColumnNumber('unitPrice', 'Cena za jednotku')
            ->setRenderer(function ($row) use ($currency) {
                return $row->unitPrice . ' ' . $currency[0];
            });

        $grid->addColumnNumber('price', 'Cena celkem')
            ->setRenderer(function ($row) use ($currency) {
                return $row->price . ' ' . $currency[0];
            });

        $grid->addInlineAdd()
            ->setPositionTop()
            ->onControlAdd[] = function($container) {
        $container->addText('id', '')->setAttribute('readonly');
        $container->addText('title', '');
        $container->addText('quantit', '');
        $container->addText('unit', '');
                $container->addText('unitPrice', '');
                $container->addText('price', '');
            };

        $p = $this;

        $grid->getInlineAdd()->onSubmit[] = function($values) use ($p) {
                /**
                 * Save new values
                 */
                $v = '';
                foreach($values as $key=>$value) {
                    $v.="$key: $value, ";
                }
                $v = trim($v,', ');

                $p->flashMessage("Record with values [$v] was added! (not really)", 'success');

                $p->redrawControl('flashes');
        };
    }
Petr Parolek
@petrparolek
zkrátka jednodušše řešeno
@Griston2524_twitter
David Skála
@Griston2524_twitter
a kdy to spadne? po kliknu na co konkrétně?
Petr Parolek
@petrparolek
když se zobrazí tento datagrid
tak proběhne invoice/show-detail?id=4&do=invoiceDetailGrid-refreshState
a přesměruje mě na invoice/show-detail
David Skála
@Griston2524_twitter
a co dělá fetchInvoiceDetail
Petr Parolek
@petrparolek
vrátí entitu:
array (1)
0 => App\Model\Entities\InvoiceItem #683b
title protected => "IT" (82)
invoice protected => Kdyby\GeneratedProxy\__CG__\App\Model\Entities\Invoice #d208
quantity protected => "1.00" (4)
unit protected => "ks" (2)
unitPrice protected => "200.00" (6)
price protected => NULL
id private => 6
David Skála
@Griston2524_twitter
když si dáš na konec fuknce createComponentInvoiceDetailGrid exit tak se stane co? přesměruje Tě to ?
Petr Parolek
@petrparolek
nepřesměruje mě to
David Skála
@Griston2524_twitter
tak není problém v gridu
Petr Parolek
@petrparolek
a nezobrazí se
David Skála
@Griston2524_twitter
to je pochopitlené že se nezobrazí, jelikož se ukončí běh aplikace před vykreslením. Odkud voláš createComponentInvoiceDetailGrid... ze šablony že? pošli sem šablonu nebo do SZ
Petr Parolek
@petrparolek
{block content}
<div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">Faktura č. {$invoice->no}</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Detail
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            {if $invoice->type == "issued"}
                                {var $type = "Odběratel"}
                            {elseif $invoice->type == "accepted"}
                                {var $type = "Dodavatel"}
                            {/if}
                            <p><strong>{$type}:</strong></p>
                            <p>{$invoice->subject}</p>
                            <p><strong>Datum vystavení:</strong></p>
                            <p>{$invoice->issuedDate|date:'j. n. Y'}</p>
                            <p><strong>Datum splatnosti:</strong></p>
                            <p>{$invoice->dueDate|date:'j. n. Y'}</p>
                            <p><strong>Datum zaplacení:</strong></p>
                            <p>{$invoice->paymentDate|date:'j. n. Y'}</p>
                            <p><strong>Celková částka::</strong></p>
                            <p>{$invoice->price} Kč</p> 

                            <a n:href="Invoice:edit $invoice->id" class="btn btn-primary">Upravit</a>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                </div>
                <!-- /.col-lg-6 -->
                {control invoiceDetailGrid}
            </div>
            <!-- /.row -->
David Skála
@Griston2524_twitter
a to se nevypíše ani ty data předgridem?
Petr Parolek
@petrparolek
vypíšou
poslu cely presenter
<?php

namespace App\Presenters;

use Nette;
use Nette\Application\UI;
use Ublaboo\DataGrid\DataGrid;

class InvoicePresenter extends BasePresenter
{
    /**
    * @var \App\Components\IIssuedInvoiceGridControlFactory
    * @inject
    */
    public $issuedInvoiceGridControlFactory;

    /**
    * @var \App\Components\IAcceptedInvoiceGridControlFactory
    * @inject
    */
    public $acceptedInvoiceGridControlFactory;


    public function createComponentIssuedInvoiceControl()
    {
        return $this->issuedInvoiceGridControlFactory->create(10);
    }

    public function createComponentAcceptedInvoiceControl()
    {
        return $this->acceptedInvoiceGridControlFactory->create(10);
    }

    public function renderShowDetail($id) {
        $invoice = $this->invoicesRepository->getInvoice($id);

        if (!$invoice) {
            throw new \Nette\Application\BadRequestException(404);
        }

        $this->template->invoice = $invoice;
    }

    public function renderEdit($id) {
        $this->template->id = $id;
    }

    protected function createComponentEditInvoiceForm()
    {
        $invoice = $this->invoicesRepository->getInvoiceArray($this->getParameter("id"));

        if (!$invoice) {
            throw new \Nette\Application\BadRequestException(404);
        }

        $form = new UI\Form;

        $form->addText("subject","Dodavatel")->setDefaultValue($invoice['subject']);
        $form->addText("price","Cena")->setDefaultValue($invoice['price']);
        $form->addText("issuedDate","Datum vystavení")
                ->setRequired("Datum je povinný údaj!")
                ->setDefaultValue($invoice['issuedDate']
                ->format('Y-m-d'))
                ->setAttribute("class", "datepicker")
                ->addRule($form::PATTERN, "Datum musí být ve formátu dd.mm.rrrr", "(0[1-9]|[12][0-9]|3[01])\.(0[1-9]|1[012])\.(19|20)\d\d");
        $form->addText("dueDate","Datum splatnosti")
                ->setRequired("Datum je povinný údaj!")
                ->setDefaultValue($invoice['dueDate']
                ->format('Y-m-d'))
                ->setAttribute("class", "datepicker")
                ->addRule($form::PATTERN, "Datum musí být ve formátu dd.mm.rrrr", "(0[1-9]|[12][0-9]|3[01])\.(0[1-9]|1[012])\.(19|20)\d\d");

        $form->addHidden("invoice_id", $this->getParameter("id"));

        $form->addSubmit('login', 'Upravit');

        $form->onSuccess[] = [$this, 'editInvoiceFormSucceeded'];
        return $form;
    }

    // volá se po úspěšném odeslání formuláře
    public function editInvoiceFormSucceeded(UI\Form $form, $values)
    {
        \Tracy\Debugger::barDump($values);
        $this->invoicesRepository->updateInvoice($values);
        $this->flashMessage('Úprava byla úspěšně uložena');
        //$this->redirect('Homepage:');
    }


    public function createComponentInvoiceDetailGrid($name) {
        $data = $this->invoicesRepository->fetchInvoiceDetail($this->getParameter("id"));
        \Tracy\Debugger::barDump($data);
        $grid = new DataGrid($this, $name);

        $grid->setDataSource($data);

        $grid->addColumnNumber('id', 'Id');

        $grid->addColumnText('title', 'Název položky');

        $grid->addColumnNumber('quantity', 'Počet');

        $grid->addColumnText('unit', 'Jednotka');

        $currency = ['Kč'];

        $grid->addColumnNumber('unitPrice', 'Cena za jednotku')
            ->setRenderer(function ($row) use ($currency) {
                return $row->unitPrice . ' ' . $currency[0];
            });

        $grid->addColumnNumber('price', 'Cena celkem')
            ->setRenderer(function ($row) use ($currency) {
                return $row->price . ' ' . $currency[0];
            });

        $grid->addInlineAdd()
            ->setPositionTop()
            ->onControlAdd[] = function($container) {
        $container->addText('id', '')->setAttribute('readonly');
David Skála
@Griston2524_twitter
dej si pod control invoice ... {debugbreak} to zastaví běh po vykreslení grida
Petr Parolek
@petrparolek
$container->addText('title', '');
        $container->addText('quantit', '');
        $container->addText('unit', '');
                $container->addText('unitPrice', '');
                $container->addText('price', '');
            };

        $p = $this;

        $grid->getInlineAdd()->onSubmit[] = function($values) use ($p) {
                /**
                 * Save new values
                 */
                $v = '';
                foreach($values as $key=>$value) {
                    $v.="$key: $value, ";
                }
                $v = trim($v,', ');

                $p->flashMessage("Record with values [$v] was added! (not really)", 'success');

                $p->redrawControl('flashes');
        };
    }
}
ok
nic mi to neyastavilo
aha, to zastavi kdyz bezi xdebug
David Skála
@Griston2524_twitter
tak problém si myslím nebude v gridu ale někde jinde...
Petr Parolek
@petrparolek
a kde?
David Skála
@Griston2524_twitter
si to postupně odkrokuj pomocí exit například. Jakmile Tě to přesměruje, tak bylo špatně něco před
Petr Parolek
@petrparolek
díky
Petr Parolek
@petrparolek
ahoj
jak mám překreslit datagrid po vložení položky prosím?
Petr Parolek
@petrparolek
$grid->getInlineAdd()->onSubmit[] = function($values) use ($p) {
            /**
             * Save new values
             */
            $values->invoiceId = (int)$this->getParameter("id");

            $this->invoicesRepository->insertInvoiceItem($values);
            $p->flashMessage("Položka byla uložena", 'success');

            if ($this->isAjax()) {
                $p->redrawControl('flashes');
                $p->redrawControl('grid');
            }
            else {
        $this->redirect('this');
            }
        };
David Skála
@Griston2524_twitter
@petrparolek už jsi to zjistil nebo stále pátráš?
Petr Parolek
@petrparolek
ahoj, mám takový problém s znovupoužití komponenty s ublaboo datagrid.
    public function render($pagination)
    {
        $this->template->render(__DIR__ . '/invoiceControl.latte');
    }
hlasi mi Warning
Missing argument 1 for App\Components\AcceptedInvoiceControl::render(), called in /vendor/nette/application/src/Bridges/ApplicationLatte/SnippetBridge.php on line 85 and defined
Poradil by mi nekdo prosim?