Code Duplication    Length = 29-30 lines in 2 locations

src/Admin/presenters/BusinessmanPresenter.php 2 locations

@@ 188-217 (lines=30) @@
185
        $this->template->numberOfBusinessmen = count($this->businessmen);
186
    }
187
188
    protected function createComponentActiveGrid($name)
189
    {
190
        $grid = $this->createGrid($this, $name, "\WebCMS\InvestformModule\Entity\Businessman", null, array(
191
            'active = true',
192
        ));
193
194
        $grid->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
195
196
        $grid->addColumnText('name', 'Firstname')->setCustomRender(function($item) {
197
            if ($item->getName()) {
198
                return $item->getName() . ' ' . $item->getLastname();
199
            } else {
200
                return $item->getBusinessname();
201
            }
202
            
203
        });
204
205
        $grid->addColumnText('businessId', 'Business ID');
206
207
        $grid->addColumnText('company', 'Company')->setCustomRender(function($item) {
208
            if ($item->getCompany()) {
209
                return $item->getCompany()->getName();
210
            }
211
        });
212
213
        $grid->addActionHref("deactivate", 'Deactivate', 'deactivate', array('idPage' => $this->actualPage->getId()))->getElementPrototype()->addAttributes(array('class' => array('btn', 'btn-primary', 'ajax', 'grey')));
214
        $grid->addActionHref("detail", 'Businessman detail', 'detail', array('idPage' => $this->actualPage->getId()))->getElementPrototype()->addAttributes(array('class' => array('btn', 'btn-primary', 'green')));
215
216
        return $grid;
217
    }
218
219
    protected function createComponentInactiveGrid($name)
220
    {
@@ 219-247 (lines=29) @@
216
        return $grid;
217
    }
218
219
    protected function createComponentInactiveGrid($name)
220
    {
221
        $grid = $this->createGrid($this, $name, "\WebCMS\InvestformModule\Entity\Businessman", null, array(
222
            'active = false',
223
        ));
224
225
        $grid->setFilterRenderType(\Grido\Components\Filters\Filter::RENDER_INNER);
226
227
        $grid->addColumnText('name', 'Firstname')->setCustomRender(function($item) {
228
            if ($item->getName()) {
229
                return $item->getName() . ' ' . $item->getLastname();
230
            } else {
231
                return $item->getBusinessname();
232
            }
233
        });
234
235
        $grid->addColumnText('businessId', 'Business ID');
236
237
        $grid->addColumnText('company', 'Company')->setCustomRender(function($item) {
238
            if ($item->getCompany()) {
239
                return $item->getCompany()->getName();
240
            }
241
        });
242
243
        $grid->addActionHref("activate", 'Activate', 'activate', array('idPage' => $this->actualPage->getId()))->getElementPrototype()->addAttributes(array('class' => array('btn', 'btn-primary', 'ajax', 'grey')));
244
        $grid->addActionHref("detail", 'Businessman detail', 'detail', array('idPage' => $this->actualPage->getId()))->getElementPrototype()->addAttributes(array('class' => array('btn', 'btn-primary', 'green')));
245
246
        return $grid;
247
    }
248
249
    public function actionDeactivate($id, $idPage, $inDetail = false)
250
    {