chore: sync module from working instance and add install guide
This commit is contained in:
@@ -7,46 +7,30 @@ use yii\helpers\Html;
|
||||
|
||||
/* @var Animal[] $animals */
|
||||
/* @var ContentContainerActiveRecord $contentContainer */
|
||||
/* @var string $queryValue */
|
||||
/* @var string $heading */
|
||||
/* @var array $tileFields */
|
||||
/* @var array<int, array> $tileFieldOverrides */
|
||||
/* @var array<int, AnimalMedicalVisit> $latestMedicalVisitByAnimal */
|
||||
/* @var array<int, string> $animalImageUrls */
|
||||
/* @var array<int, mixed> $animalDonationGoalsByAnimal */
|
||||
/* @var bool $showDonationSettingsButton */
|
||||
/* @var int $totalCount */
|
||||
/* @var int $displayCount */
|
||||
/* @var bool $hasMore */
|
||||
/* @var int $nextCount */
|
||||
/* @var bool $showAll */
|
||||
/* @var int $page */
|
||||
/* @var int $pageCount */
|
||||
/* @var bool $hasPreviousPage */
|
||||
/* @var bool $hasNextPage */
|
||||
|
||||
$moduleEnabled = $contentContainer->moduleManager->isEnabled('animal_management');
|
||||
$allAnimalsUrl = $contentContainer->createUrl('/animal_management/animals/index');
|
||||
$currentParams = Yii::$app->request->getQueryParams();
|
||||
$buildProfileUrl = static function (array $overrides) use ($contentContainer, $currentParams): string {
|
||||
unset($currentParams['q'], $currentParams['animalFeedCount'], $currentParams['animalFeedAll']);
|
||||
$params = array_merge($currentParams, $overrides);
|
||||
return $contentContainer->createUrl('/space_profiles/profile/view', $params);
|
||||
};
|
||||
?>
|
||||
|
||||
<h4 style="margin-top:0;"><?= Html::encode($heading) ?></h4>
|
||||
|
||||
<?php if ($moduleEnabled): ?>
|
||||
<form method="get" action="<?= Html::encode($contentContainer->createUrl('/space_profiles/profile/view')) ?>" style="margin-bottom:12px;">
|
||||
<div class="input-group">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="q"
|
||||
value="<?= Html::encode($queryValue) ?>"
|
||||
placeholder="<?= Html::encode(Yii::t('AnimalManagementModule.base', 'Search by name, species, or ID')) ?>"
|
||||
>
|
||||
<input type="hidden" name="animalFeedCount" value="10">
|
||||
<input type="hidden" name="animalFeedAll" value="0">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="submit"><?= Yii::t('AnimalManagementModule.base', 'Search') ?></button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<?php if (!$moduleEnabled): ?>
|
||||
<div class="well well-sm" style="margin-bottom:12px;">
|
||||
<?= Yii::t('AnimalManagementModule.base', 'Animal profiles are not enabled for this rescue.') ?>
|
||||
</div>
|
||||
@@ -68,28 +52,36 @@ $buildProfileUrl = static function (array $overrides) use ($contentContainer, $c
|
||||
'imageUrl' => $animalImageUrls[$animalId] ?? '',
|
||||
'tileFields' => $tileFieldOverrides[$animalId] ?? $tileFields,
|
||||
'showMedicalIcon' => true,
|
||||
'showDonationSettingsButton' => $showDonationSettingsButton,
|
||||
'existingDonationGoal' => $animalDonationGoalsByAnimal[$animalId] ?? null,
|
||||
'tileLayoutMode' => 'rows',
|
||||
]) ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($moduleEnabled): ?>
|
||||
<div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap;">
|
||||
<?php if ($hasMore): ?>
|
||||
<a class="btn btn-default btn-sm" href="<?= Html::encode($buildProfileUrl(['animalFeedCount' => $nextCount, 'animalFeedAll' => 0])) ?>">
|
||||
<?= Yii::t('AnimalManagementModule.base', 'Show More') ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if (!$showAll && $totalCount > 0): ?>
|
||||
<a class="btn btn-default btn-sm" href="<?= Html::encode($buildProfileUrl(['animalFeedAll' => 1])) ?>">
|
||||
<?= Yii::t('AnimalManagementModule.base', 'Show All') ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($totalCount > 0): ?>
|
||||
<span class="text-muted" style="font-size:12px;">
|
||||
<?= Yii::t('AnimalManagementModule.base', '{shown} of {total} shown', ['shown' => $displayCount, 'total' => $totalCount]) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($moduleEnabled && $totalCount > 0): ?>
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;">
|
||||
<div class="text-muted" style="font-size:12px;">
|
||||
<?= Yii::t('AnimalManagementModule.base', 'Page {page} of {pages}', ['page' => $page, 'pages' => $pageCount]) ?>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;gap:8px;">
|
||||
<?php if ($hasPreviousPage): ?>
|
||||
<a class="btn btn-default btn-sm" href="<?= Html::encode($buildProfileUrl(['animalFeedPage' => $page - 1])) ?>">
|
||||
<?= Yii::t('AnimalManagementModule.base', 'Previous') ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($hasNextPage): ?>
|
||||
<a class="btn btn-default btn-sm" href="<?= Html::encode($buildProfileUrl(['animalFeedPage' => $page + 1])) ?>">
|
||||
<?= Yii::t('AnimalManagementModule.base', 'Next') ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top:10px;text-align:center;">
|
||||
<a href="<?= Html::encode($allAnimalsUrl) ?>" style="font-weight:700;text-decoration:underline;">
|
||||
<?= Yii::t('AnimalManagementModule.base', 'All Animals') ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
Reference in New Issue
Block a user