<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Teilnehmer\Visitenkarten\VisitenkartenUebersicht;

use Kufer\Web\KuferTools\Teilnehmer\Visitenkarten\DialogLoescheVisitenkarte;

class VisitenkartenUebersichtPresenter extends \Kufer\Web\KuferTools\Basis\Uebersicht\UebersichtMitWssPresenter
{
  protected function getBlaetternAction()
  {
    return 'visitenkarte';
  }

  protected function getPanelTitle($visitenkarte)
  {
    $currentPage = $this->useCaseResponse->blaettern->getCurrentPage();
    $itemsPerPage = $this->useCaseResponse->blaettern->getItemsPerPage();

    static $counter = null;
    if (is_null($counter)) {
      $counter = $itemsPerPage * ($currentPage - 1);
    }

    return  ++$counter . '. Visitenkarte';
  }

  protected function getPanelTitleHinweis()
  {
    return 'Zu den Visitenkartendetails';
  }

  protected function getErfolgsmeldungen()
  {
    if ($this->useCaseResponse->statusCode == DialogLoescheVisitenkarte\VisitenkarteLoeschen\LoescheVisitenkarteUseCase::VISITENKARTE_LOESCHEN_SUCCESS) {
      $allgSettings = \AllgSettingsAPI::getAllgSettings();

      return $allgSettings->successMsgDeleteVisitenkarte;
    }

    return '';
  }

  protected function getJsFilesSrcAryWeitere(): array
  {
    $js = parent::getJsFilesSrcAryWeitere();
    $js[] = $this->getJsFileFromSys('webvisitenkarten.js');

    return $js;
  }
}