chore: sync module from working instance and add install guide

This commit is contained in:
Kelin Rescue Hub
2026-04-09 14:11:34 -04:00
parent 20adb1bd1e
commit 039c12233e
23 changed files with 4577 additions and 394 deletions

View File

@@ -0,0 +1,184 @@
<?php
use humhub\libs\Html;
/*
* @var array $donationHistoryRows
* @var bool $showDonationSettingsButton
* @var string $goalEditorToggleId
* @var int $existingGoalId
* @var string $createInlineGoalUrl
* @var string $existingGoalTitle
* @var float $existingGoalTargetAmount
* @var string $existingGoalDescription
* @var string $existingGoalImage
* @var array $galleryUrls
* @var \humhub\modules\animal_management\models\Animal $animal
* @var int $existingGoalActive
* @var string $fileFieldId
* @var string $previewId
* @var string $quickDonateToggleId
* @var string $quickDonatePanelId
*/
?>
<div class="animal-tile-quick-donate-layout<?= $showDonationSettingsButton ? ' has-goal-settings' : '' ?>">
<div class="animal-tile-quick-donate-history-col">
<div style="font-size:14px;font-weight:700;color:#f8fafc;margin-bottom:6px;"><?= Yii::t('DonationsModule.base', 'Donation History') ?></div>
<?php if (empty($donationHistoryRows)): ?>
<div style="font-size:12px;color:rgba(226,232,240,0.9);"><?= Yii::t('DonationsModule.base', 'No donations yet.') ?></div>
<?php else: ?>
<div class="animal-tile-scroll-region" style="flex:1 1 auto;min-height:0;overflow-y:auto;">
<?php foreach ($donationHistoryRows as $donationRow): ?>
<div class="animal-tile-donation-history-item">
<div class="animal-tile-donation-history-meta">
<?php if (!empty($donationRow['avatarUrl'])): ?>
<img class="animal-tile-donation-history-avatar" src="<?= Html::encode((string)$donationRow['avatarUrl']) ?>" alt="<?= Html::encode((string)$donationRow['donor']) ?>">
<?php else: ?>
<span class="animal-tile-donation-history-avatar animal-tile-donation-history-avatar-fallback">
<i class="fa fa-user"></i>
</span>
<?php endif; ?>
<div class="animal-tile-donation-history-identity">
<?php if (!empty($donationRow['donorUrl'])): ?>
<?= Html::a(
Html::encode($donationRow['donor']),
(string)$donationRow['donorUrl'],
['class' => 'animal-tile-donation-history-name']
) ?>
<?php else: ?>
<span class="animal-tile-donation-history-name"><?= Html::encode($donationRow['donor']) ?></span>
<?php endif; ?>
<span class="animal-tile-donation-history-when"><?= Html::encode((string)($donationRow['when'] ?? '')) ?></span>
</div>
</div>
<span class="animal-tile-donation-history-amount"><?= Html::encode($donationRow['amount']) ?></span>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
__ANIMAL_TILE_QUICK_DONATE_FORM_SLOT__
<?php if ($showDonationSettingsButton): ?>
<div class="animal-tile-quick-donate-goal-col">
<input type="checkbox" id="<?= Html::encode($goalEditorToggleId) ?>" class="animal-tile-goal-editor-toggle" <?= $existingGoalId > 0 ? 'checked' : '' ?>>
<?php if ($existingGoalId <= 0): ?>
<label for="<?= Html::encode($goalEditorToggleId) ?>" class="btn btn-default btn-xs animal-tile-set-goal-btn" style="margin:0 0 8px 0;align-self:flex-start;">
<i class="fa fa-plus"></i> <?= Yii::t('DonationsModule.base', 'Set Goal') ?>
</label>
<?php endif; ?>
<div class="animal-tile-goal-editor-fields animal-tile-scroll-region" style="<?= $existingGoalId > 0 ? 'display:flex;flex-direction:column;flex:1 1 auto;min-height:0;overflow-y:auto;' : 'display:none;flex-direction:column;flex:1 1 auto;min-height:0;overflow-y:auto;' ?>">
<?= Html::beginForm($createInlineGoalUrl, 'post', [
'enctype' => 'multipart/form-data',
'style' => 'margin:0;',
]) ?>
<?= Html::hiddenInput(Yii::$app->request->csrfParam, Yii::$app->request->getCsrfToken()) ?>
<?= Html::hiddenInput('DonationGoalForm[id]', $existingGoalId) ?>
<?= Html::hiddenInput('DonationGoalForm[goal_type]', 'animal') ?>
<?= Html::hiddenInput('DonationGoalForm[target_animal_id]', (int)$animal->id) ?>
<?= Html::hiddenInput('DonationGoalForm[is_active]', $existingGoalActive) ?>
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px;">
<div style="font-size:14px;font-weight:700;color:#f8fafc;"><?= Yii::t('DonationsModule.base', 'Goal Settings') ?></div>
<div style="display:flex;align-items:center;gap:8px;">
<button type="submit" class="animal-tile-goal-header-action" title="<?= Yii::t('DonationsModule.base', 'Save Goal') ?>" aria-label="<?= Yii::t('DonationsModule.base', 'Save Goal') ?>">
<i class="fa fa-check"></i>
</button>
<label for="<?= Html::encode($quickDonateToggleId) ?>" class="animal-tile-goal-header-action" title="<?= Yii::t('AnimalManagementModule.base', 'Close') ?>" aria-label="<?= Yii::t('AnimalManagementModule.base', 'Close') ?>">
<i class="fa fa-times"></i>
</label>
</div>
</div>
<div class="animal-tile-goal-title-target-row" style="display:grid;grid-template-columns:minmax(0,1fr) minmax(0,180px);gap:10px;align-items:end;margin-bottom:8px;">
<div class="form-group" style="margin-bottom:0;min-width:0;">
<label style="font-size:12px;font-weight:600;margin-bottom:4px;display:block;"><?= Yii::t('DonationsModule.base', 'Title') ?></label>
<?= Html::textInput('DonationGoalForm[title]', $existingGoalTitle, [
'class' => 'form-control input-sm',
'maxlength' => 190,
'required' => true,
]) ?>
</div>
<div class="form-group" style="margin-bottom:0;min-width:0;">
<label style="font-size:12px;font-weight:600;margin-bottom:4px;display:block;"><?= Yii::t('DonationsModule.base', 'Target') ?></label>
<div class="input-group" style="width:100%;max-width:none;">
<span class="input-group-addon" style="background:rgba(255,255,255,0.12);border-color:rgba(255,255,255,0.24);color:#f8fafc;">$</span>
<?= Html::input('number', 'DonationGoalForm[target_amount]', $existingGoalTargetAmount > 0 ? (string)round($existingGoalTargetAmount) : '', [
'class' => 'form-control input-sm',
'step' => '1',
'min' => '1',
'inputmode' => 'numeric',
'required' => true,
]) ?>
</div>
</div>
</div>
<div class="form-group" style="margin-bottom:8px;">
<label style="font-size:12px;font-weight:600;margin-bottom:4px;display:block;"><?= Yii::t('DonationsModule.base', 'Description') ?></label>
<?= Html::textarea('DonationGoalForm[description]', $existingGoalDescription, [
'class' => 'form-control input-sm',
'rows' => 2,
]) ?>
</div>
<div class="form-group" style="margin-bottom:8px;">
<label style="font-size:12px;font-weight:600;margin-bottom:4px;display:block;"><?= Yii::t('DonationsModule.base', 'Image') ?></label>
<div class="animal-tile-goal-image-row" style="display:flex;align-items:flex-start;gap:10px;margin-bottom:8px;">
<div id="<?= Html::encode($previewId) ?>" class="animal-tile-goal-selected-image text-muted" style="font-size:12px;">
<?php if ($existingGoalImage !== ''): ?>
<img class="animal-tile-goal-selected-image-thumb" src="<?= Html::encode($existingGoalImage) ?>" alt="">
<?php else: ?>
<span class="animal-tile-goal-selected-image-empty"><?= Yii::t('DonationsModule.base', 'No image selected.') ?></span>
<?php endif; ?>
</div>
<div class="animal-tile-goal-image-list" style="display:flex;flex-wrap:wrap;gap:6px;min-width:0;flex:1 1 auto;align-content:flex-start;">
<?php if (!empty($galleryUrls)): ?>
<?php foreach ($galleryUrls as $galleryIndex => $galleryUrl): ?>
<?php $galleryOptionId = 'animal-donation-gallery-option-' . (int)$animal->id . '-' . (int)$galleryIndex; ?>
<div style="position:relative;">
<input
type="radio"
class="animal-donation-gallery-radio"
id="<?= Html::encode($galleryOptionId) ?>"
name="DonationGoalForm[imageGalleryPath]"
value="<?= Html::encode($galleryUrl) ?>"
data-preview="#<?= Html::encode($previewId) ?>"
data-editor-bg="#<?= Html::encode($quickDonatePanelId) ?>"
<?= $existingGoalImage === $galleryUrl ? 'checked' : '' ?>
>
<label
for="<?= Html::encode($galleryOptionId) ?>"
class="animal-donation-inline-gallery-item"
style="display:block;border:1px solid rgba(255,255,255,0.2);background:rgba(15,23,42,0.22);padding:3px;border-radius:4px;line-height:0;pointer-events:auto;cursor:pointer;"
>
<img src="<?= Html::encode($galleryUrl) ?>" alt="" style="width:56px;height:56px;object-fit:cover;border-radius:2px;">
</label>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="text-muted" style="font-size:12px;align-self:center;"><?= Yii::t('DonationsModule.base', 'No gallery images found for this animal.') ?></div>
<?php endif; ?>
</div>
</div>
<?= Html::fileInput('DonationGoalForm[imageFile]', null, [
'id' => $fileFieldId,
'class' => 'js-animal-donation-upload animal-tile-goal-upload-input',
'data-preview' => '#' . $previewId,
'data-editor-bg' => '#' . $quickDonatePanelId,
'accept' => 'image/*',
]) ?>
<label for="<?= Html::encode($fileFieldId) ?>" class="animal-tile-goal-upload-btn">
<?= Yii::t('DonationsModule.base', 'Upload') ?>
</label>
</div>
<?= Html::endForm() ?>
</div>
</div>
<?php endif; ?>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -33,6 +33,30 @@ switch ($transfer->status) {
$statusTextColor = '#d1d5db';
break;
}
static $transferActionButtonStylePrinted = false;
if (!$transferActionButtonStylePrinted):
$transferActionButtonStylePrinted = true;
?>
<style>
.animal-transfer-action-btn {
border-radius: 999px;
border: 1px solid rgba(15, 23, 42, 0.24);
background: rgba(255, 255, 255, 0.92);
color: #0f172a !important;
font-weight: 700;
box-shadow: 0 2px 10px rgba(15, 23, 42, 0.2);
}
@media (prefers-color-scheme: dark) {
.animal-transfer-action-btn {
border-color: rgba(226, 232, 240, 0.34);
background: rgba(15, 23, 42, 0.72);
color: #f8fafc !important;
}
}
</style>
<?php endif; ?>
?>
<div class="panel panel-default" style="margin-bottom:0;overflow:hidden;border-radius:12px;border:0;box-shadow:0 8px 24px rgba(15,23,42,0.14);">
@@ -69,18 +93,16 @@ switch ($transfer->status) {
Yii::t('AnimalManagementModule.base', 'Accept'),
$space->createUrl('/animal_management/animals/transfer-respond', ['id' => $transfer->id, 'decision' => 'accept']),
[
'class' => 'btn btn-xs btn-default',
'class' => 'btn btn-xs btn-default animal-transfer-action-btn',
'data-method' => 'post',
'style' => 'border-radius:999px;border:0;background:rgba(255,255,255,0.92);font-weight:600;'
]
) ?>
<?= Html::a(
Yii::t('AnimalManagementModule.base', 'Decline'),
$space->createUrl('/animal_management/animals/transfer-respond', ['id' => $transfer->id, 'decision' => 'decline']),
[
'class' => 'btn btn-xs btn-default',
'class' => 'btn btn-xs btn-default animal-transfer-action-btn',
'data-method' => 'post',
'style' => 'border-radius:999px;border:0;background:rgba(255,255,255,0.92);font-weight:600;'
]
) ?>
<?php elseif ($isIncoming && $transfer->status === AnimalTransfer::STATUS_ACCEPTED): ?>
@@ -88,9 +110,8 @@ switch ($transfer->status) {
Yii::t('AnimalManagementModule.base', 'Complete Transfer'),
$space->createUrl('/animal_management/animals/transfer-complete', ['id' => $transfer->id]),
[
'class' => 'btn btn-xs btn-default',
'class' => 'btn btn-xs btn-default animal-transfer-action-btn',
'data-method' => 'post',
'style' => 'border-radius:999px;border:0;background:rgba(255,255,255,0.92);font-weight:600;'
]
) ?>
<?php elseif (!$isIncoming && in_array($transfer->status, [AnimalTransfer::STATUS_REQUESTED, AnimalTransfer::STATUS_ACCEPTED], true)): ?>
@@ -98,9 +119,8 @@ switch ($transfer->status) {
Yii::t('AnimalManagementModule.base', 'Cancel Request'),
$space->createUrl('/animal_management/animals/transfer-cancel', ['id' => $transfer->id]),
[
'class' => 'btn btn-xs btn-default',
'class' => 'btn btn-xs btn-default animal-transfer-action-btn',
'data-method' => 'post',
'style' => 'border-radius:999px;border:0;background:rgba(255,255,255,0.92);font-weight:600;'
]
) ?>
<?php endif; ?>

View File

@@ -0,0 +1,305 @@
<?php
use humhub\modules\animal_management\models\Animal;
use humhub\modules\animal_management\models\AnimalGalleryItem;
use humhub\modules\space\models\Space;
use yii\helpers\Html;
use yii\helpers\Json;
/* @var Space $space */
/* @var Animal $animal */
/* @var AnimalGalleryItem[] $galleryItems */
/* @var bool $isInline */
/* @var string $returnTo */
/* @var int $maxUploadCount */
/* @var string $errorMessage */
/* @var string $infoMessage */
$isInline = isset($isInline) ? (bool)$isInline : false;
$showTopCancel = (string)Yii::$app->request->get('showTopCancel', '0') === '1';
$returnTo = (string)($returnTo ?? 'view');
$maxUploadCount = max(1, (int)($maxUploadCount ?? 10));
$errorMessage = trim((string)($errorMessage ?? ''));
$infoMessage = trim((string)($infoMessage ?? ''));
$formId = 'animal-gallery-inline-upload-form';
$submitUrl = $space->createUrl('/animal_management/animals/add-gallery-images-inline', [
'id' => (int)$animal->id,
'inline' => $isInline ? 1 : 0,
'returnTo' => $returnTo,
]);
$this->registerCss(<<<CSS
.inline-add-shell.panel {
position: relative;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.22);
border-radius: 12px;
background: rgba(10, 18, 28, 0.36);
}
.inline-add-shell > .panel-body {
position: relative;
z-index: 1;
background: rgba(10, 18, 28, 0.2);
}
.inline-add-shell,
.inline-add-shell .panel-body,
.inline-add-shell .control-label,
.inline-add-shell .help-block,
.inline-add-shell h4 {
color: #eef5fb;
}
.inline-add-shell .form-control {
background: rgba(10, 18, 28, 0.56);
border-color: rgba(255, 255, 255, 0.44);
color: #f3f8ff;
}
.inline-add-shell .animal-inline-top-save-action {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.36);
background: rgba(15, 23, 42, 0.72);
color: #f8fafc;
cursor: pointer;
line-height: 1;
font-size: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.inline-add-shell .animal-inline-top-save-action:hover,
.inline-add-shell .animal-inline-top-save-action:focus {
background: rgba(30, 41, 59, 0.86);
border-color: rgba(255, 255, 255, 0.5);
color: #f8fafc;
outline: none;
}
.inline-add-shell .animal-gallery-inline-existing-grid {
margin: 0;
}
.inline-add-shell .animal-gallery-inline-existing-item {
display: block;
width: 100%;
aspect-ratio: 1 / 1;
min-height: 70px;
object-fit: cover;
border-radius: 6px;
}
.inline-add-shell .animal-gallery-inline-existing-wrap {
min-height: 220px;
max-height: 320px;
overflow-y: auto;
overflow-x: hidden;
margin: 6px 0 10px 0;
padding-right: 4px;
}
.inline-add-shell .animal-gallery-inline-file-input {
position: absolute;
left: -10000px;
width: 1px;
height: 1px;
opacity: 0;
pointer-events: none;
}
.inline-add-shell .animal-gallery-inline-file-trigger {
margin: 0;
}
.inline-add-shell .animal-gallery-inline-file-name {
display: inline-block;
margin-left: 8px;
color: rgba(233, 242, 250, 0.9);
font-size: 12px;
vertical-align: middle;
max-width: calc(100% - 150px);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
CSS
);
if ($isInline) {
$this->registerCss(<<<CSS
html, body {
margin: 0 !important;
padding: 0 !important;
background: transparent !important;
scrollbar-width: none;
-ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
width: 0;
height: 0;
}
body > .panel:first-child {
margin-top: 0 !important;
}
body,
.inline-add-shell,
.inline-add-shell > .panel-body,
#{$formId} {
height: 100% !important;
}
#{$formId} {
display: flex;
flex-direction: column;
}
#{$formId} .animal-gallery-inline-existing-wrap {
flex: 1 1 auto;
min-height: 0;
max-height: none;
}
CSS
);
}
?>
<div class="panel panel-default inline-add-shell">
<div class="panel-body">
<form id="<?= Html::encode($formId) ?>" method="post" action="<?= Html::encode($submitUrl) ?>" enctype="multipart/form-data"<?= !$isInline ? ' target="_top"' : '' ?>>
<?= Html::hiddenInput(Yii::$app->request->csrfParam, Yii::$app->request->getCsrfToken()) ?>
<?= Html::hiddenInput('returnTo', $returnTo) ?>
<?php if ($isInline): ?>
<div class="animal-inline-top-actions" style="display:flex;justify-content:flex-end;gap:8px;margin:0 38px 10px 0;">
<?= Html::submitButton('<i class="fa fa-check"></i>', [
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Upload to Gallery'),
'form' => $formId,
]) ?>
<?php if ($showTopCancel): ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'id' => 'gallery-inline-add-cancel-icon',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
'type' => 'button',
]) ?>
<?php endif; ?>
</div>
<?php endif; ?>
<h4 style="margin:0 0 10px 0;"><?= Yii::t('AnimalManagementModule.base', 'Add Images to Gallery') ?></h4>
<?php if ($errorMessage !== ''): ?>
<div class="alert alert-danger" style="margin-bottom:10px;"><?= Html::encode($errorMessage) ?></div>
<?php endif; ?>
<?php if ($infoMessage !== ''): ?>
<div class="alert alert-info" style="margin-bottom:10px;"><?= Html::encode($infoMessage) ?></div>
<?php endif; ?>
<div class="form-group" style="margin-bottom:8px;">
<label class="control-label" for="galleryImages"><?= Yii::t('AnimalManagementModule.base', 'Upload Images') ?></label>
<div>
<input type="file" class="animal-gallery-inline-file-input" id="galleryImages" name="galleryImages[]" accept="image/*" multiple required>
<label for="galleryImages" class="btn btn-default btn-sm animal-gallery-inline-file-trigger"><?= Yii::t('AnimalManagementModule.base', 'Choose Files') ?></label>
<span id="gallery-inline-file-name" class="animal-gallery-inline-file-name"><?= Yii::t('AnimalManagementModule.base', 'No files selected.') ?></span>
</div>
<div class="help-block" style="margin-bottom:0;"><?= Yii::t('AnimalManagementModule.base', 'You can upload up to {count} images at a time.', ['count' => $maxUploadCount]) ?></div>
</div>
<?php if (!empty($galleryItems)): ?>
<div class="animal-gallery-inline-existing-wrap">
<div class="row animal-gallery-inline-existing-grid">
<?php foreach (array_slice($galleryItems, 0, 12) as $galleryItem): ?>
<?php $galleryUrl = trim((string)$galleryItem->getImageUrl()); ?>
<?php if ($galleryUrl === '') { continue; } ?>
<div class="col-xs-4 col-sm-3" style="margin-bottom:8px;">
<img src="<?= Html::encode($galleryUrl) ?>" alt="<?= Yii::t('AnimalManagementModule.base', 'Gallery image') ?>" class="animal-gallery-inline-existing-item">
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php if (!$isInline): ?>
<button type="submit" class="btn btn-primary"><?= Yii::t('AnimalManagementModule.base', 'Upload to Gallery') ?></button>
<a href="<?= Html::encode($space->createUrl('/animal_management/animals/view', ['id' => $animal->id])) ?>" class="btn btn-default"><?= Yii::t('AnimalManagementModule.base', 'Cancel') ?></a>
<?php endif; ?>
</form>
</div>
</div>
<?php
if ($isInline) {
$cancelPayload = Json::htmlEncode([
'source' => 'animal-inline-editor',
'type' => 'cancel',
'collapseId' => 'gallery-add-inline',
]);
$this->registerJs(<<<JS
(function() {
var fileInput = document.getElementById('galleryImages');
var fileLabel = document.getElementById('gallery-inline-file-name');
function updateFileLabel() {
if (!fileInput || !fileLabel) {
return;
}
var files = fileInput.files;
if (!files || files.length === 0) {
fileLabel.textContent = 'No files selected.';
return;
}
if (files.length === 1) {
fileLabel.textContent = files[0].name || '1 file selected';
return;
}
fileLabel.textContent = files.length + ' files selected';
}
if (fileInput) {
fileInput.addEventListener('change', updateFileLabel);
updateFileLabel();
}
function postInlineCancel() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
}
}
if (window.jQuery) {
window.jQuery(document).on('click', '#gallery-inline-add-cancel, #gallery-inline-add-cancel-icon', function() {
postInlineCancel();
});
}
document.addEventListener('click', function(event) {
var target = event.target;
if (!target || !target.closest) {
return;
}
if (!target.closest('#gallery-inline-add-cancel, #gallery-inline-add-cancel-icon')) {
return;
}
postInlineCancel();
}, false);
})();
JS
, \yii\web\View::POS_END);
}
?>

View File

@@ -17,6 +17,7 @@ use yii\helpers\Json;
/* @var bool $isInline */
$isInline = isset($isInline) ? (bool)$isInline : false;
$showTopCancel = (string)Yii::$app->request->get('showTopCancel', '0') === '1';
$hiddenMedicalKeys = [
'second_physician_name',
@@ -135,6 +136,15 @@ $medicalMediaPath = trim((string)($model->customFields['medical_media_reference'
$hasMedicalMedia = $medicalMediaPath !== '' && (preg_match('/^https?:\/\//i', $medicalMediaPath) || substr($medicalMediaPath, 0, 1) === '/');
$medicalGalleryModalId = 'add-medical-media-gallery-modal';
$medicalFormId = 'add-medical-visit-inline-form';
$visitAtInputValue = trim((string)$model->visit_at);
if ($visitAtInputValue === '') {
$visitAtInputValue = date('Y-m-d\TH:i');
} else {
$visitAtTimestamp = strtotime($visitAtInputValue);
if ($visitAtTimestamp !== false) {
$visitAtInputValue = date('Y-m-d\TH:i', $visitAtTimestamp);
}
}
$this->registerCss(<<<CSS
.inline-add-shell.panel {
@@ -172,6 +182,18 @@ $medicalFormId = 'add-medical-visit-inline-form';
border-color: rgba(255, 255, 255, 0.2);
}
.inline-add-shell .panel.panel-default > .panel-heading a {
color: inherit;
display: block;
text-decoration: none;
}
.inline-add-shell .panel.panel-default > .panel-heading a:hover,
.inline-add-shell .panel.panel-default > .panel-heading a:focus {
color: #ffffff;
text-decoration: none;
}
.inline-add-shell,
.inline-add-shell .panel-body,
.inline-add-shell .control-label,
@@ -204,6 +226,31 @@ $medicalFormId = 'add-medical-visit-inline-form';
.inline-add-shell select.form-control option {
color: #0f1b2a;
}
.inline-add-shell .animal-inline-top-save-action {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.36);
background: rgba(15, 23, 42, 0.72);
color: #f8fafc;
cursor: pointer;
line-height: 1;
font-size: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.inline-add-shell .animal-inline-top-save-action:hover,
.inline-add-shell .animal-inline-top-save-action:focus {
background: rgba(30, 41, 59, 0.86);
border-color: rgba(255, 255, 255, 0.5);
color: #f8fafc;
outline: none;
}
CSS
);
@@ -213,6 +260,13 @@ html, body {
margin: 0 !important;
padding: 0 !important;
background: transparent !important;
scrollbar-width: none;
-ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
width: 0;
height: 0;
}
body > .panel:first-child {
@@ -243,18 +297,20 @@ CSS
<?= Html::hiddenInput('medicalMediaGalleryPath', $medicalMediaPath, ['id' => 'medical-media-gallery-path']) ?>
<?php if ($isInline): ?>
<div style="display:flex;justify-content:flex-end;gap:8px;margin-bottom:10px;">
<div class="animal-inline-top-actions" style="display:flex;justify-content:flex-end;gap:8px;margin:0 38px 10px 0;">
<?= Html::submitButton('<i class="fa fa-check"></i>', [
'class' => 'btn btn-default btn-sm',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Save Medical Visit'),
'form' => $medicalFormId,
]) ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'type' => 'button',
'class' => 'btn btn-default btn-sm',
'id' => 'medical-inline-add-cancel-icon',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
]) ?>
<?php if ($showTopCancel): ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'id' => 'medical-inline-add-cancel-icon',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
'type' => 'button',
]) ?>
<?php endif; ?>
</div>
<?php endif; ?>
@@ -289,48 +345,77 @@ CSS
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Medical Visit') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" class="collapsed" href="#medical-inline-section-visit" aria-expanded="false" aria-controls="medical-inline-section-visit">
<strong><?= Yii::t('AnimalManagementModule.base', 'Medical Visit') ?></strong>
</a>
</div>
<div id="medical-inline-section-visit" class="panel-collapse collapse" aria-expanded="false">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-6"><?= $form->field($model, 'visit_at')->input('datetime-local') ?></div>
<div class="col-sm-6"><?= $form->field($model, 'visit_at')->input('datetime-local', ['value' => $visitAtInputValue]) ?></div>
<div class="col-sm-6"><?= $form->field($model, 'provider_name') ?></div>
</div>
<?= $form->field($model, 'notes')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'recommendations')->textarea(['rows' => 3]) ?>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Vitals') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" class="collapsed" href="#medical-inline-section-vitals" aria-expanded="false" aria-controls="medical-inline-section-vitals">
<strong><?= Yii::t('AnimalManagementModule.base', 'Vitals') ?></strong>
</a>
</div>
<div id="medical-inline-section-vitals" class="panel-collapse collapse" aria-expanded="false">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-3"><?= $renderCustomField('weight', $model, $customDefinitions) ?></div>
<div class="col-sm-3"><?= $renderCustomField('pulse', $model, $customDefinitions) ?></div>
<div class="col-sm-3"><?= $renderCustomField('blood_pressure', $model, $customDefinitions) ?></div>
<div class="col-sm-3"><?= $renderCustomField('oxygen', $model, $customDefinitions) ?></div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Conditions') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" class="collapsed" href="#medical-inline-section-conditions" aria-expanded="false" aria-controls="medical-inline-section-conditions">
<strong><?= Yii::t('AnimalManagementModule.base', 'Conditions') ?></strong>
</a>
</div>
<div id="medical-inline-section-conditions" class="panel-collapse collapse" aria-expanded="false">
<div class="panel-body" style="padding-bottom:8px;">
<?= $renderCustomField('chronic_conditions', $model, $customDefinitions) ?>
<?= $renderCustomField('acute_conditions', $model, $customDefinitions) ?>
<?= $renderCustomField('special_needs', $model, $customDefinitions) ?>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Medical Visit Detail') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" class="collapsed" href="#medical-inline-section-detail" aria-expanded="false" aria-controls="medical-inline-section-detail">
<strong><?= Yii::t('AnimalManagementModule.base', 'Medical Visit Detail') ?></strong>
</a>
</div>
<div id="medical-inline-section-detail" class="panel-collapse collapse" aria-expanded="false">
<div class="panel-body" style="padding-bottom:8px;">
<?= $renderCustomField('date_of_most_recent_medical_visit', $model, $customDefinitions) ?>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Physician') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" class="collapsed" href="#medical-inline-section-physician" aria-expanded="false" aria-controls="medical-inline-section-physician">
<strong><?= Yii::t('AnimalManagementModule.base', 'Physician') ?></strong>
</a>
</div>
<div id="medical-inline-section-physician" class="panel-collapse collapse" aria-expanded="false">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-6"><?= $renderCustomField('physician_name', $model, $customDefinitions) ?></div>
<div class="col-sm-6"><?= $renderCustomField('physician_business_name', $model, $customDefinitions) ?></div>
@@ -342,6 +427,7 @@ CSS
<div class="col-sm-4"><?= $renderCustomField('physician_business_phone', $model, $customDefinitions) ?></div>
<div class="col-sm-4"><?= $renderCustomField('physician_license_number', $model, $customDefinitions) ?></div>
</div>
</div>
</div>
</div>
@@ -355,23 +441,23 @@ CSS
<?php if (!empty($remainingDefinitions)): ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" class="collapsed" href="#medical-inline-section-additional" aria-expanded="false" aria-controls="medical-inline-section-additional">
<strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong>
</a>
</div>
<div id="medical-inline-section-additional" class="panel-collapse collapse" aria-expanded="false">
<div class="panel-body" style="padding-bottom:8px;">
<?php foreach ($remainingDefinitions as $fieldKey => $definition): ?>
<?= $renderCustomField($fieldKey, $model, $remainingDefinitions) ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
<?= Button::save(Yii::t('AnimalManagementModule.base', 'Save Medical Visit'))->submit() ?>
<?php if ($isInline): ?>
<?= Html::button(Yii::t('AnimalManagementModule.base', 'Cancel'), [
'type' => 'button',
'class' => 'btn btn-default',
'id' => 'medical-inline-add-cancel',
]) ?>
<?php else: ?>
<?php if (!$isInline): ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))
->link(($returnTo ?? 'medical-visits') === 'medical-visits'
? $space->createUrl('/animal_management/animals/medical-visits', ['id' => $animal->id])
@@ -507,11 +593,32 @@ if ($isInline) {
]);
$this->registerJs(<<<JS
$(document).on('click', '#medical-inline-add-cancel, #medical-inline-add-cancel-icon', function() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
(function() {
function postInlineCancel() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
}
}
});
if (window.jQuery) {
window.jQuery(document).on('click', '#medical-inline-add-cancel, #medical-inline-add-cancel-icon', function() {
postInlineCancel();
});
}
document.addEventListener('click', function(event) {
var target = event.target;
if (!target || !target.closest) {
return;
}
if (!target.closest('#medical-inline-add-cancel, #medical-inline-add-cancel-icon')) {
return;
}
postInlineCancel();
}, false);
})();
JS
, \yii\web\View::POS_END);
}

View File

@@ -17,6 +17,7 @@ use yii\helpers\Json;
/* @var bool $isInline */
$isInline = isset($isInline) ? (bool)$isInline : false;
$showTopCancel = (string)Yii::$app->request->get('showTopCancel', '0') === '1';
$renderCustomField = static function (string $fieldKey, AnimalProgressUpdateForm $formModel, array $definitions): string {
if (!isset($definitions[$fieldKey])) {
@@ -132,6 +133,18 @@ $this->registerCss(<<<CSS
border-color: rgba(255, 255, 255, 0.2);
}
.inline-add-shell .panel.panel-default > .panel-heading a {
color: inherit;
display: block;
text-decoration: none;
}
.inline-add-shell .panel.panel-default > .panel-heading a:hover,
.inline-add-shell .panel.panel-default > .panel-heading a:focus {
color: #ffffff;
text-decoration: none;
}
.inline-add-shell,
.inline-add-shell .panel-body,
.inline-add-shell .control-label,
@@ -164,6 +177,31 @@ $this->registerCss(<<<CSS
.inline-add-shell select.form-control option {
color: #0f1b2a;
}
.inline-add-shell .animal-inline-top-save-action {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.36);
background: rgba(15, 23, 42, 0.72);
color: #f8fafc;
cursor: pointer;
line-height: 1;
font-size: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.inline-add-shell .animal-inline-top-save-action:hover,
.inline-add-shell .animal-inline-top-save-action:focus {
background: rgba(30, 41, 59, 0.86);
border-color: rgba(255, 255, 255, 0.5);
color: #f8fafc;
outline: none;
}
CSS
);
@@ -173,6 +211,13 @@ html, body {
margin: 0 !important;
padding: 0 !important;
background: transparent !important;
scrollbar-width: none;
-ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
width: 0;
height: 0;
}
body > .panel:first-child {
@@ -195,26 +240,33 @@ CSS
<?= Html::hiddenInput('returnTo', (string)($returnTo ?? 'progress-updates')) ?>
<?php if ($isInline): ?>
<div style="display:flex;justify-content:flex-end;gap:8px;margin-bottom:10px;">
<div class="animal-inline-top-actions" style="display:flex;justify-content:flex-end;gap:8px;margin:0 38px 10px 0;">
<?= Html::submitButton('<i class="fa fa-check"></i>', [
'class' => 'btn btn-default btn-sm',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Save Progress Update'),
'form' => $progressFormId,
]) ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'type' => 'button',
'class' => 'btn btn-default btn-sm',
'id' => 'progress-inline-add-cancel-icon',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
]) ?>
<?php if ($showTopCancel): ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'id' => 'progress-inline-add-cancel-icon',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
'type' => 'button',
]) ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?= $form->errorSummary($model, ['showAllErrors' => true]) ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Media') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#progress-inline-section-media" aria-expanded="true" aria-controls="progress-inline-section-media">
<strong><?= Yii::t('AnimalManagementModule.base', 'Media') ?></strong>
</a>
</div>
<div id="progress-inline-section-media" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<input type="hidden" id="progress-media-gallery-path" name="progressMediaGalleryPath" value="<?= Html::encode($currentMediaReference) ?>">
<div class="row">
<div class="col-sm-4" style="margin-bottom:8px;">
@@ -239,12 +291,18 @@ CSS
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Progress Update') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#progress-inline-section-update" aria-expanded="true" aria-controls="progress-inline-section-update">
<strong><?= Yii::t('AnimalManagementModule.base', 'Progress Update') ?></strong>
</a>
</div>
<div id="progress-inline-section-update" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-4"><?= $form->field($model, 'weight') ?></div>
<div class="col-sm-8"><?= $form->field($model, 'vitals')->textInput(['maxlength' => 255]) ?></div>
@@ -253,24 +311,37 @@ CSS
<div class="col-sm-6"><?= $form->field($model, 'meal_plan_changes')->textarea(['rows' => 2]) ?></div>
<div class="col-sm-6"><?= $form->field($model, 'housing_changes')->textarea(['rows' => 2]) ?></div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Notes') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#progress-inline-section-notes" aria-expanded="true" aria-controls="progress-inline-section-notes">
<strong><?= Yii::t('AnimalManagementModule.base', 'Notes') ?></strong>
</a>
</div>
<div id="progress-inline-section-notes" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<?= $renderCustomField('progress_notes', $model, $customDefinitions) ?>
<?= $renderCustomField('routine_updates', $model, $customDefinitions) ?>
</div>
</div>
</div>
<?php if (!empty($otherCustomDefinitions)): ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#progress-inline-section-additional" aria-expanded="true" aria-controls="progress-inline-section-additional">
<strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong>
</a>
</div>
<div id="progress-inline-section-additional" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<?php foreach ($otherCustomDefinitions as $fieldKey => $definition): ?>
<?= $renderCustomField($fieldKey, $model, $otherCustomDefinitions) ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
@@ -316,13 +387,7 @@ CSS
</div>
<?= Button::save(Yii::t('AnimalManagementModule.base', 'Save Progress Update'))->submit() ?>
<?php if ($isInline): ?>
<?= Html::button(Yii::t('AnimalManagementModule.base', 'Cancel'), [
'type' => 'button',
'class' => 'btn btn-default',
'id' => 'progress-inline-add-cancel',
]) ?>
<?php else: ?>
<?php if (!$isInline): ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))
->link(($returnTo ?? 'progress-updates') === 'progress-updates'
? $space->createUrl('/animal_management/animals/progress-updates', ['id' => $animal->id])
@@ -434,11 +499,32 @@ if ($isInline) {
]);
$this->registerJs(<<<JS
$(document).on('click', '#progress-inline-add-cancel, #progress-inline-add-cancel-icon', function() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
(function() {
function postInlineCancel() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
}
}
});
if (window.jQuery) {
window.jQuery(document).on('click', '#progress-inline-add-cancel, #progress-inline-add-cancel-icon', function() {
postInlineCancel();
});
}
document.addEventListener('click', function(event) {
var target = event.target;
if (!target || !target.closest) {
return;
}
if (!target.closest('#progress-inline-add-cancel, #progress-inline-add-cancel-icon')) {
return;
}
postInlineCancel();
}, false);
})();
JS
, \yii\web\View::POS_END);
}

View File

@@ -13,6 +13,18 @@ use yii\helpers\Html;
/* @var Space $space */
/* @var bool $isEdit */
/* @var Animal|null $animal */
/* @var bool $showIntakeGoalSection */
$showIntakeGoalSection = isset($showIntakeGoalSection) ? (bool)$showIntakeGoalSection : false;
$intakeGoalInput = Yii::$app->request->post('IntakeGoal', []);
if (!is_array($intakeGoalInput)) {
$intakeGoalInput = [];
}
$intakeGoalEnabled = !empty($isEdit) ? false : ((int)($intakeGoalInput['enabled'] ?? 0) === 1);
$intakeGoalTitle = trim((string)($intakeGoalInput['title'] ?? ''));
$intakeGoalTargetAmount = trim((string)($intakeGoalInput['target_amount'] ?? ''));
$intakeGoalDescription = trim((string)($intakeGoalInput['description'] ?? ''));
$intakeGoalIsActive = !empty($isEdit) ? true : ((int)($intakeGoalInput['is_active'] ?? 1) === 1);
?>
<div class="panel panel-default">
@@ -215,6 +227,41 @@ use yii\helpers\Html;
</div>
<div class="col-md-6">
<?php if (empty($isEdit) && $showIntakeGoalSection): ?>
<div class="panel panel-default" style="margin-bottom:14px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Intake Donation Goal') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="checkbox" style="margin-top:0;">
<label>
<input type="checkbox" name="IntakeGoal[enabled]" value="1" id="intake-goal-enabled" <?= $intakeGoalEnabled ? 'checked' : '' ?>>
<?= Yii::t('AnimalManagementModule.base', 'Create a donation goal for this animal on intake') ?>
</label>
</div>
<div id="intake-goal-fields" style="display:<?= $intakeGoalEnabled ? 'block' : 'none' ?>;">
<div class="form-group">
<label class="control-label" for="intake-goal-title"><?= Yii::t('AnimalManagementModule.base', 'Goal Title') ?></label>
<input type="text" id="intake-goal-title" name="IntakeGoal[title]" class="form-control" maxlength="190" value="<?= Html::encode($intakeGoalTitle) ?>" placeholder="<?= Html::encode(Yii::t('AnimalManagementModule.base', 'Example: {animalName} Care Fund', ['animalName' => 'Animal'])) ?>">
</div>
<div class="form-group">
<label class="control-label" for="intake-goal-target"><?= Yii::t('AnimalManagementModule.base', 'Target Amount') ?></label>
<input type="number" id="intake-goal-target" name="IntakeGoal[target_amount]" class="form-control" min="1" step="1" value="<?= Html::encode($intakeGoalTargetAmount) ?>" placeholder="1500">
</div>
<div class="form-group">
<label class="control-label" for="intake-goal-description"><?= Yii::t('AnimalManagementModule.base', 'Goal Description') ?></label>
<textarea id="intake-goal-description" name="IntakeGoal[description]" class="form-control" rows="3" placeholder="<?= Html::encode(Yii::t('AnimalManagementModule.base', 'Optional context for supporters.')) ?>"><?= Html::encode($intakeGoalDescription) ?></textarea>
</div>
<div class="checkbox" style="margin-bottom:0;">
<label>
<input type="hidden" name="IntakeGoal[is_active]" value="0">
<input type="checkbox" name="IntakeGoal[is_active]" value="1" <?= $intakeGoalIsActive ? 'checked' : '' ?>>
<?= Yii::t('AnimalManagementModule.base', 'Goal is active immediately') ?>
</label>
</div>
</div>
</div>
</div>
<?php endif; ?>
<div class="panel panel-default" style="margin-bottom:14px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Previous Owner') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
@@ -274,7 +321,7 @@ use yii\helpers\Html;
<?= Button::save(!empty($isEdit)
? Yii::t('AnimalManagementModule.base', 'Save Changes')
: Yii::t('AnimalManagementModule.base', 'Create Animal'))->submit() ?>
: Yii::t('AnimalManagementModule.base', 'Complete Intake'))->submit() ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))->link(
!empty($isEdit) && $animal instanceof Animal
? $space->createUrl('/animal_management/animals/view', ['id' => $animal->id])
@@ -306,7 +353,7 @@ use yii\helpers\Html;
<?= Yii::t('AnimalManagementModule.base', 'Your image preview updates immediately. Final save happens when you click {action} at the bottom of this intake form.', [
'action' => !empty($isEdit)
? Yii::t('AnimalManagementModule.base', 'Save Changes')
: Yii::t('AnimalManagementModule.base', 'Create Animal'),
: Yii::t('AnimalManagementModule.base', 'Complete Intake'),
]) ?>
</div>
<?php if (!empty($galleryImageUrls)): ?>
@@ -350,7 +397,7 @@ use yii\helpers\Html;
<?= Yii::t('AnimalManagementModule.base', 'Your image preview updates immediately. Final save happens when you click {action} at the bottom of this intake form.', [
'action' => !empty($isEdit)
? Yii::t('AnimalManagementModule.base', 'Save Changes')
: Yii::t('AnimalManagementModule.base', 'Create Animal'),
: Yii::t('AnimalManagementModule.base', 'Complete Intake'),
]) ?>
</div>
<?php if (!empty($galleryImageUrls)): ?>
@@ -521,6 +568,14 @@ $this->registerJs(<<<JS
}
});
$('#intake-goal-enabled').on('change', function() {
if ($(this).is(':checked')) {
$('#intake-goal-fields').slideDown(120);
} else {
$('#intake-goal-fields').slideUp(120);
}
});
$('#animal-cover-image-manage-modal').on('shown.bs.modal', function() {
markSelectedThumb('cover', $('#animalform-coverimagegallerypath').val());
});

View File

@@ -19,6 +19,7 @@ use yii\helpers\Json;
/* @var bool $isInline */
$isInline = isset($isInline) ? (bool)$isInline : false;
$showTopCancel = (string)Yii::$app->request->get('showTopCancel', '0') === '1';
$hiddenMedicalKeys = [
'second_physician_name',
@@ -166,6 +167,18 @@ $this->registerCss(<<<CSS
border-color: rgba(255, 255, 255, 0.2);
}
.inline-editor-shell .panel.panel-default > .panel-heading a {
color: inherit;
display: block;
text-decoration: none;
}
.inline-editor-shell .panel.panel-default > .panel-heading a:hover,
.inline-editor-shell .panel.panel-default > .panel-heading a:focus {
color: #ffffff;
text-decoration: none;
}
.inline-editor-shell,
.inline-editor-shell .panel-body,
.inline-editor-shell .control-label,
@@ -198,6 +211,31 @@ $this->registerCss(<<<CSS
.inline-editor-shell select.form-control option {
color: #0f1b2a;
}
.inline-editor-shell .animal-inline-top-save-action {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.36);
background: rgba(15, 23, 42, 0.72);
color: #f8fafc;
cursor: pointer;
line-height: 1;
font-size: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.inline-editor-shell .animal-inline-top-save-action:hover,
.inline-editor-shell .animal-inline-top-save-action:focus {
background: rgba(30, 41, 59, 0.86);
border-color: rgba(255, 255, 255, 0.5);
color: #f8fafc;
outline: none;
}
CSS
);
@@ -207,6 +245,13 @@ html, body {
margin: 0 !important;
padding: 0 !important;
background: transparent !important;
scrollbar-width: none;
-ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
width: 0;
height: 0;
}
body > .panel:first-child {
@@ -229,18 +274,20 @@ CSS
<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;">
<span><?= Yii::t('AnimalManagementModule.base', '<strong>Edit</strong> Medical Visit') ?></span>
<?php if ($isInline): ?>
<span style="display:inline-flex;gap:8px;">
<span class="animal-inline-top-actions" style="display:inline-flex;gap:8px;margin-right:38px;">
<?= Html::submitButton('<i class="fa fa-check"></i>', [
'class' => 'btn btn-default btn-sm',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Save Medical Visit'),
'form' => $medicalFormId,
]) ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'type' => 'button',
'class' => 'btn btn-default btn-sm',
'id' => 'medical-inline-cancel-icon',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
]) ?>
<?php if ($showTopCancel): ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'id' => 'medical-inline-cancel-icon',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
'type' => 'button',
]) ?>
<?php endif; ?>
</span>
<?php endif; ?>
</div>
@@ -259,48 +306,77 @@ CSS
<?= $form->errorSummary($model, ['showAllErrors' => true]) ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Visit') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-medical-section-visit" aria-expanded="true" aria-controls="edit-medical-section-visit">
<strong><?= Yii::t('AnimalManagementModule.base', 'Visit') ?></strong>
</a>
</div>
<div id="edit-medical-section-visit" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-6"><?= $form->field($model, 'visit_at')->input('datetime-local') ?></div>
<div class="col-sm-6"><?= $form->field($model, 'provider_name') ?></div>
</div>
<?= $form->field($model, 'notes')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'recommendations')->textarea(['rows' => 3]) ?>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Vitals') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-medical-section-vitals" aria-expanded="true" aria-controls="edit-medical-section-vitals">
<strong><?= Yii::t('AnimalManagementModule.base', 'Vitals') ?></strong>
</a>
</div>
<div id="edit-medical-section-vitals" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-3"><?= $renderCustomField('weight', $model, $customDefinitions) ?></div>
<div class="col-sm-3"><?= $renderCustomField('pulse', $model, $customDefinitions) ?></div>
<div class="col-sm-3"><?= $renderCustomField('blood_pressure', $model, $customDefinitions) ?></div>
<div class="col-sm-3"><?= $renderCustomField('oxygen', $model, $customDefinitions) ?></div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Conditions') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-medical-section-conditions" aria-expanded="true" aria-controls="edit-medical-section-conditions">
<strong><?= Yii::t('AnimalManagementModule.base', 'Conditions') ?></strong>
</a>
</div>
<div id="edit-medical-section-conditions" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<?= $renderCustomField('chronic_conditions', $model, $customDefinitions) ?>
<?= $renderCustomField('acute_conditions', $model, $customDefinitions) ?>
<?= $renderCustomField('special_needs', $model, $customDefinitions) ?>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Medical Visit Detail') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-medical-section-detail" aria-expanded="true" aria-controls="edit-medical-section-detail">
<strong><?= Yii::t('AnimalManagementModule.base', 'Medical Visit Detail') ?></strong>
</a>
</div>
<div id="edit-medical-section-detail" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<?= $renderCustomField('date_of_most_recent_medical_visit', $model, $customDefinitions) ?>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Media') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-medical-section-media" aria-expanded="true" aria-controls="edit-medical-section-media">
<strong><?= Yii::t('AnimalManagementModule.base', 'Media') ?></strong>
</a>
</div>
<div id="edit-medical-section-media" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-4" style="margin-bottom:8px;">
<div id="medical-media-preview" style="border-radius:8px;overflow:hidden;background:#f2f4f6;height:150px;display:flex;align-items:center;justify-content:center;">
@@ -323,12 +399,18 @@ CSS
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Physician') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-medical-section-physician" aria-expanded="true" aria-controls="edit-medical-section-physician">
<strong><?= Yii::t('AnimalManagementModule.base', 'Physician') ?></strong>
</a>
</div>
<div id="edit-medical-section-physician" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-6"><?= $renderCustomField('physician_name', $model, $customDefinitions) ?></div>
<div class="col-sm-6"><?= $renderCustomField('physician_business_name', $model, $customDefinitions) ?></div>
@@ -340,6 +422,7 @@ CSS
<div class="col-sm-4"><?= $renderCustomField('physician_business_phone', $model, $customDefinitions) ?></div>
<div class="col-sm-4"><?= $renderCustomField('physician_license_number', $model, $customDefinitions) ?></div>
</div>
</div>
</div>
</div>
@@ -353,23 +436,23 @@ CSS
<?php if (!empty($remainingDefinitions)): ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-medical-section-additional" aria-expanded="true" aria-controls="edit-medical-section-additional">
<strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong>
</a>
</div>
<div id="edit-medical-section-additional" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<?php foreach ($remainingDefinitions as $fieldKey => $definition): ?>
<?= $renderCustomField($fieldKey, $model, $remainingDefinitions) ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
<?= Button::save(Yii::t('AnimalManagementModule.base', 'Save Medical Visit'))->submit() ?>
<?php if ($isInline): ?>
<?= Html::button(Yii::t('AnimalManagementModule.base', 'Cancel'), [
'type' => 'button',
'class' => 'btn btn-default',
'id' => 'medical-inline-cancel',
]) ?>
<?php else: ?>
<?php if (!$isInline): ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))
->link(($returnTo ?? 'view') === 'medical-visits'
? $space->createUrl('/animal_management/animals/medical-visits', ['id' => $animal->id])
@@ -486,11 +569,32 @@ if ($isInline) {
]);
$this->registerJs(<<<JS
$(document).on('click', '#medical-inline-cancel, #medical-inline-cancel-icon', function() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
(function() {
function postInlineCancel() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
}
}
});
if (window.jQuery) {
window.jQuery(document).on('click', '#medical-inline-cancel, #medical-inline-cancel-icon', function() {
postInlineCancel();
});
}
document.addEventListener('click', function(event) {
var target = event.target;
if (!target || !target.closest) {
return;
}
if (!target.closest('#medical-inline-cancel, #medical-inline-cancel-icon')) {
return;
}
postInlineCancel();
}, false);
})();
JS
, \yii\web\View::POS_END);
}

View File

@@ -19,6 +19,7 @@ use yii\helpers\Json;
/* @var bool $isInline */
$isInline = isset($isInline) ? (bool)$isInline : false;
$showTopCancel = (string)Yii::$app->request->get('showTopCancel', '0') === '1';
$renderCustomField = static function (string $fieldKey, AnimalProgressUpdateForm $formModel, array $definitions): string {
if (!isset($definitions[$fieldKey])) {
@@ -126,6 +127,18 @@ $this->registerCss(<<<CSS
border-color: rgba(255, 255, 255, 0.2);
}
.inline-editor-shell .panel.panel-default > .panel-heading a {
color: inherit;
display: block;
text-decoration: none;
}
.inline-editor-shell .panel.panel-default > .panel-heading a:hover,
.inline-editor-shell .panel.panel-default > .panel-heading a:focus {
color: #ffffff;
text-decoration: none;
}
.inline-editor-shell,
.inline-editor-shell .panel-body,
.inline-editor-shell .control-label,
@@ -158,6 +171,31 @@ $this->registerCss(<<<CSS
.inline-editor-shell select.form-control option {
color: #0f1b2a;
}
.inline-editor-shell .animal-inline-top-save-action {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.36);
background: rgba(15, 23, 42, 0.72);
color: #f8fafc;
cursor: pointer;
line-height: 1;
font-size: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.inline-editor-shell .animal-inline-top-save-action:hover,
.inline-editor-shell .animal-inline-top-save-action:focus {
background: rgba(30, 41, 59, 0.86);
border-color: rgba(255, 255, 255, 0.5);
color: #f8fafc;
outline: none;
}
CSS
);
@@ -167,6 +205,13 @@ html, body {
margin: 0 !important;
padding: 0 !important;
background: transparent !important;
scrollbar-width: none;
-ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
width: 0;
height: 0;
}
body > .panel:first-child {
@@ -182,18 +227,20 @@ CSS
<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;">
<span><?= Yii::t('AnimalManagementModule.base', '<strong>Edit</strong> Progress Update') ?></span>
<?php if ($isInline): ?>
<span style="display:inline-flex;gap:8px;">
<span class="animal-inline-top-actions" style="display:inline-flex;gap:8px;margin-right:38px;">
<?= Html::submitButton('<i class="fa fa-check"></i>', [
'class' => 'btn btn-default btn-sm',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Save Progress Update'),
'form' => $progressFormId,
]) ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'type' => 'button',
'class' => 'btn btn-default btn-sm',
'id' => 'progress-inline-cancel-icon',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
]) ?>
<?php if ($showTopCancel): ?>
<?= Html::button('<i class="fa fa-times"></i>', [
'id' => 'progress-inline-cancel-icon',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
'type' => 'button',
]) ?>
<?php endif; ?>
</span>
<?php endif; ?>
</div>
@@ -211,8 +258,13 @@ CSS
<?= $form->errorSummary($model, ['showAllErrors' => true]) ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Progress Update') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-progress-section-update" aria-expanded="true" aria-controls="edit-progress-section-update">
<strong><?= Yii::t('AnimalManagementModule.base', 'Progress Update') ?></strong>
</a>
</div>
<div id="edit-progress-section-update" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<div class="row">
<div class="col-sm-4"><?= $form->field($model, 'weight') ?></div>
<div class="col-sm-8"><?= $form->field($model, 'vitals')->textInput(['maxlength' => 255]) ?></div>
@@ -221,31 +273,49 @@ CSS
<div class="col-sm-6"><?= $form->field($model, 'meal_plan_changes')->textarea(['rows' => 2]) ?></div>
<div class="col-sm-6"><?= $form->field($model, 'housing_changes')->textarea(['rows' => 2]) ?></div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Notes') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-progress-section-notes" aria-expanded="true" aria-controls="edit-progress-section-notes">
<strong><?= Yii::t('AnimalManagementModule.base', 'Notes') ?></strong>
</a>
</div>
<div id="edit-progress-section-notes" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<?= $renderCustomField('progress_notes', $model, $customDefinitions) ?>
<?= $renderCustomField('routine_updates', $model, $customDefinitions) ?>
</div>
</div>
</div>
<?php if (!empty($otherCustomDefinitions)): ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-progress-section-additional" aria-expanded="true" aria-controls="edit-progress-section-additional">
<strong><?= Yii::t('AnimalManagementModule.base', 'Additional Details') ?></strong>
</a>
</div>
<div id="edit-progress-section-additional" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<?php foreach ($otherCustomDefinitions as $fieldKey => $definition): ?>
<?= $renderCustomField($fieldKey, $model, $otherCustomDefinitions) ?>
<?php endforeach; ?>
</div>
</div>
</div>
<?php endif; ?>
<div class="panel panel-default" style="margin-bottom:12px;">
<div class="panel-heading"><strong><?= Yii::t('AnimalManagementModule.base', 'Media') ?></strong></div>
<div class="panel-body" style="padding-bottom:8px;">
<div class="panel-heading">
<a data-toggle="collapse" href="#edit-progress-section-media" aria-expanded="true" aria-controls="edit-progress-section-media">
<strong><?= Yii::t('AnimalManagementModule.base', 'Media') ?></strong>
</a>
</div>
<div id="edit-progress-section-media" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body" style="padding-bottom:8px;">
<input type="hidden" id="progress-media-gallery-path" name="progressMediaGalleryPath" value="<?= Html::encode($currentMediaReference) ?>">
<div class="row">
<div class="col-sm-4" style="margin-bottom:8px;">
@@ -270,6 +340,7 @@ CSS
</div>
</div>
</div>
</div>
</div>
</div>
@@ -314,13 +385,7 @@ CSS
</div>
<?= Button::save(Yii::t('AnimalManagementModule.base', 'Save Progress Update'))->submit() ?>
<?php if ($isInline): ?>
<?= Html::button(Yii::t('AnimalManagementModule.base', 'Cancel'), [
'type' => 'button',
'class' => 'btn btn-default',
'id' => 'progress-inline-cancel',
]) ?>
<?php else: ?>
<?php if (!$isInline): ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))
->link(($returnTo ?? 'view') === 'progress-updates'
? $space->createUrl('/animal_management/animals/progress-updates', ['id' => $animal->id])
@@ -413,11 +478,32 @@ if ($isInline) {
]);
$this->registerJs(<<<JS
$(document).on('click', '#progress-inline-cancel, #progress-inline-cancel-icon', function() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
(function() {
function postInlineCancel() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
}
}
});
if (window.jQuery) {
window.jQuery(document).on('click', '#progress-inline-cancel, #progress-inline-cancel-icon', function() {
postInlineCancel();
});
}
document.addEventListener('click', function(event) {
var target = event.target;
if (!target || !target.closest) {
return;
}
if (!target.closest('#progress-inline-cancel, #progress-inline-cancel-icon')) {
return;
}
postInlineCancel();
}, false);
})();
JS
, \yii\web\View::POS_END);
}

View File

@@ -23,11 +23,14 @@ use yii\helpers\Html;
/* @var array<int, AnimalMedicalVisit> $latestMedicalVisitByAnimal */
/* @var array<int, string> $animalImageUrls */
/* @var array<int, string> $transferAnimalImageUrls */
/* @var array<int, mixed> $animalDonationGoalsByAnimal */
/* @var array $tileFields */
/* @var array<int, array> $tileFieldOverrides */
/* @var Space $space */
/* @var bool $canManage */
$isTabletFocusMode = ($viewMode === 'tablet') && ((string)Yii::$app->request->get('focus', '') === '1');
$currentParams = [
'q' => $queryValue,
'status' => $statusFilter,
@@ -40,6 +43,13 @@ $currentParams = [
$buildUrl = static function (array $overrides) use ($space, $currentParams): string {
$params = array_merge($currentParams, $overrides);
if (($params['view'] ?? '') !== 'tablet') {
unset($params['focus']);
} elseif (($params['focus'] ?? '') !== '1') {
unset($params['focus']);
}
return $space->createUrl('/animal_management/animals/index', $params);
};
@@ -47,16 +57,70 @@ $sortUrl = static function (string $column) use ($buildUrl, $sortKey, $sortDirec
$nextDirection = ($sortKey === $column && $sortDirection === 'asc') ? 'desc' : 'asc';
return $buildUrl(['sort' => $column, 'direction' => $nextDirection, 'view' => 'table']);
};
$showDonationSettingsLinks = $canManage && $space->moduleManager->isEnabled('donations');
?>
<div class="panel panel-default">
<?php if ($isTabletFocusMode): ?>
<style>
html,
body {
overflow: hidden !important;
}
#animals-index-panel.animal-focus-overlay {
position: fixed !important;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 9999;
margin: 0 !important;
border-radius: 0 !important;
border: 0 !important;
width: 100vw !important;
max-width: 100vw !important;
height: 100vh !important;
display: flex;
flex-direction: column;
background: #fff;
}
#animals-index-panel.animal-focus-overlay .panel-heading {
flex: 0 0 auto;
}
#animals-index-panel.animal-focus-overlay .panel-body {
flex: 1 1 auto;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
</style>
<?php endif; ?>
<div id="animals-index-panel" class="panel panel-default<?= $isTabletFocusMode ? ' animal-focus-overlay' : '' ?>">
<div class="panel-heading" style="display:flex;justify-content:space-between;align-items:center;">
<span><?= Yii::t('AnimalManagementModule.base', '<strong>Animals</strong>') ?></span>
<span style="display:flex;gap:8px;flex-wrap:wrap;align-items:center;">
<?= Html::a('<i class="fa fa-th-large"></i>', $buildUrl(['view' => 'tiles']), [
<?= Html::a('<i class="fa fa-tablet"></i>', $buildUrl(['view' => 'tablet', 'focus' => '1']), [
'class' => 'btn btn-default btn-sm' . ($viewMode === 'tablet' ? ' active' : ''),
'title' => Yii::t('AnimalManagementModule.base', 'Tablet View'),
'aria-label' => Yii::t('AnimalManagementModule.base', 'Tablet View'),
]) ?>
<?= Html::a('<i class="fa fa-bars"></i>', $buildUrl(['view' => 'rows']), [
'class' => 'btn btn-default btn-sm' . ($viewMode === 'rows' ? ' active' : ''),
'title' => Yii::t('AnimalManagementModule.base', 'Row View'),
'aria-label' => Yii::t('AnimalManagementModule.base', 'Row View'),
]) ?>
<?= Html::a('<i class="fa fa-columns"></i>', $buildUrl(['view' => 'tiles2']), [
'class' => 'btn btn-default btn-sm' . ($viewMode === 'tiles2' ? ' active' : ''),
'title' => Yii::t('AnimalManagementModule.base', '2-Column View'),
'aria-label' => Yii::t('AnimalManagementModule.base', '2-Column View'),
]) ?>
<?= Html::a('<i class="fa fa-th"></i>', $buildUrl(['view' => 'tiles']), [
'class' => 'btn btn-default btn-sm' . ($viewMode === 'tiles' ? ' active' : ''),
'title' => Yii::t('AnimalManagementModule.base', 'Tile View'),
'aria-label' => Yii::t('AnimalManagementModule.base', 'Tile View'),
'title' => Yii::t('AnimalManagementModule.base', '3-Column View'),
'aria-label' => Yii::t('AnimalManagementModule.base', '3-Column View'),
]) ?>
<?= Html::a('<i class="fa fa-table"></i>', $buildUrl(['view' => 'table']), [
'class' => 'btn btn-default btn-sm' . ($viewMode === 'table' ? ' active' : ''),
@@ -76,6 +140,9 @@ $sortUrl = static function (string $column) use ($buildUrl, $sortKey, $sortDirec
<div class="panel-body">
<form method="get" action="<?= Html::encode($space->createUrl('/animal_management/animals/index')) ?>" class="form-inline" style="margin-bottom:12px;display:flex;gap:8px;flex-wrap:wrap;">
<input type="hidden" name="view" value="<?= Html::encode($viewMode) ?>">
<?php if ($isTabletFocusMode): ?>
<input type="hidden" name="focus" value="1">
<?php endif; ?>
<input type="hidden" name="sort" value="<?= Html::encode($sortKey) ?>">
<input type="hidden" name="direction" value="<?= Html::encode($sortDirection) ?>">
<?php foreach ($selectedColumns as $col): ?>
@@ -125,12 +192,22 @@ $sortUrl = static function (string $column) use ($buildUrl, $sortKey, $sortDirec
<?= Yii::t('AnimalManagementModule.base', 'No animal profiles yet. Create the first intake record to begin tracking.') ?>
</div>
<?php else: ?>
<?php if ($viewMode === 'tiles'): ?>
<?php if ($viewMode !== 'table'): ?>
<?php
$tileColumnClass = 'col-xs-12 col-sm-6 col-md-4';
if ($viewMode === 'tiles2') {
$tileColumnClass = 'col-xs-12 col-sm-6';
} elseif ($viewMode === 'rows') {
$tileColumnClass = 'col-xs-12';
} elseif ($viewMode === 'tablet') {
$tileColumnClass = 'col-xs-12';
}
?>
<div class="row">
<?php foreach ($animals as $animal): ?>
<?php $animalId = (int)$animal->id; ?>
<?php $lastMedical = $latestMedicalVisitByAnimal[$animalId] ?? null; ?>
<div class="col-sm-6 col-md-4" style="margin-bottom:16px;">
<div class="<?= Html::encode($tileColumnClass) ?>" style="margin-bottom:16px;">
<?= $this->render('_tile', [
'animal' => $animal,
'contentContainer' => $space,
@@ -138,6 +215,9 @@ $sortUrl = static function (string $column) use ($buildUrl, $sortKey, $sortDirec
'imageUrl' => $animalImageUrls[$animalId] ?? '',
'tileFields' => $tileFieldOverrides[$animalId] ?? $tileFields,
'showMedicalIcon' => true,
'showDonationSettingsButton' => $showDonationSettingsLinks,
'existingDonationGoal' => $animalDonationGoalsByAnimal[$animalId] ?? null,
'tileLayoutMode' => $viewMode,
]) ?>
</div>
<?php endforeach; ?>
@@ -205,6 +285,13 @@ $sortUrl = static function (string $column) use ($buildUrl, $sortKey, $sortDirec
->link($space->createUrl('/animal_management/animals/medical-visits', ['id' => $animal->id])) ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Progress'))
->link($space->createUrl('/animal_management/animals/progress-updates', ['id' => $animal->id])) ?>
<?php if ($showDonationSettingsLinks): ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Donations'))
->link($space->createUrl('/donations/settings', [
'goalType' => 'animal',
'targetAnimalId' => (int)$animal->id,
])) ?>
<?php endif; ?>
<?php if ($canManage): ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Edit'))
->link($space->createUrl('/animal_management/animals/edit', ['id' => $animal->id])) ?>
@@ -223,10 +310,11 @@ $sortUrl = static function (string $column) use ($buildUrl, $sortKey, $sortDirec
<?php if ($canManage): ?>
<hr>
<h4 id="incoming-transfers" style="margin-top:0;"><?= Yii::t('AnimalManagementModule.base', 'Incoming Transfer Requests') ?></h4>
<?php if (empty($incomingTransfers)): ?>
<div class="text-muted" style="margin-bottom:12px;"><?= Yii::t('AnimalManagementModule.base', 'No incoming requests.') ?></div>
<?php else: ?>
<?php $incomingTransfersHeading = empty($incomingTransfers)
? Yii::t('AnimalManagementModule.base', 'No Incoming Transfers')
: Yii::t('AnimalManagementModule.base', 'Incoming Transfer Requests'); ?>
<h4 id="incoming-transfers" style="margin-top:0;"><?= Html::encode($incomingTransfersHeading) ?></h4>
<?php if (!empty($incomingTransfers)): ?>
<div class="row" style="margin-bottom:4px;">
<?php foreach ($incomingTransfers as $transfer): ?>
<?php

View File

@@ -15,7 +15,7 @@ $payload = [
$jsonPayload = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
?>
<div class="panel panel-success" style="margin:10px;">
<div class="panel panel-success" data-animal-inline-result="saved" data-animal-inline-collapse-id="<?= Html::encode((string)$collapseId) ?>" style="margin:10px;">
<div class="panel-body" style="padding:12px;">
<?= Html::encode(Yii::t('AnimalManagementModule.base', 'Saved. Updating section...')) ?>
</div>
@@ -25,8 +25,59 @@ $jsonPayload = json_encode($payload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNI
$this->registerJs(<<<JS
(function() {
var payload = {$jsonPayload};
function triggerChange(element) {
if (!element) {
return;
}
var event;
if (typeof Event === 'function') {
event = new Event('change', { bubbles: true });
} else {
event = document.createEvent('Event');
event.initEvent('change', true, true);
}
element.dispatchEvent(event);
}
function closeByFrameContext() {
if (!window.parent || window.parent === window) {
return;
}
var frameElement = window.frameElement;
if (!frameElement || !frameElement.parentElement) {
return;
}
var closeControl = frameElement.parentElement.querySelector('.animal-tile-inline-iframe-close[for]');
if (!closeControl) {
return;
}
var targetId = String(closeControl.getAttribute('for') || '');
if (!targetId) {
return;
}
var targetElement = window.parent.document.getElementById(targetId);
if (!targetElement) {
return;
}
if ((targetElement.type || '').toLowerCase() === 'radio') {
targetElement.checked = true;
} else {
targetElement.checked = false;
}
triggerChange(targetElement);
}
if (window.parent && window.parent !== window) {
window.parent.postMessage(payload, '*');
closeByFrameContext();
}
})();
JS

View File

@@ -5,27 +5,205 @@ use humhub\modules\animal_management\models\forms\TransferRequestForm;
use humhub\modules\space\models\Space;
use humhub\widgets\Button;
use yii\bootstrap\ActiveForm;
use yii\helpers\Json;
/* @var Space $space */
/* @var Animal $animal */
/* @var TransferRequestForm $model */
/* @var bool $isInline */
/* @var string $returnTo */
$isInline = isset($isInline) ? (bool)$isInline : false;
$showTopCancel = (string)Yii::$app->request->get('showTopCancel', '0') === '1';
$returnTo = (string)($returnTo ?? 'view');
$transferFormId = 'animal-transfer-request-form';
$this->registerCss(<<<CSS
.animal-transfer-inline-shell.panel {
position: relative;
overflow: hidden;
border: 1px solid rgba(255, 255, 255, 0.22);
border-radius: 12px;
background: rgba(10, 18, 28, 0.36);
}
.animal-transfer-inline-shell > .panel-body {
position: relative;
z-index: 1;
background: rgba(10, 18, 28, 0.2);
}
.animal-transfer-inline-shell,
.animal-transfer-inline-shell .panel-body,
.animal-transfer-inline-shell .panel-heading,
.animal-transfer-inline-shell .control-label,
.animal-transfer-inline-shell .help-block {
color: #eef5fb;
}
.animal-transfer-inline-shell .panel-heading {
background: rgba(15, 23, 42, 0.4);
border-color: rgba(255, 255, 255, 0.22);
margin-left: 20px;
margin-bottom: 20px;
padding: 10px 20px;
max-width: fit-content;
border-radius: 10px;
}
.animal-transfer-inline-shell .panel-heading strong {
color: #f8fafc;
}
.animal-transfer-inline-shell .form-control {
background: rgba(10, 18, 28, 0.56);
border-color: rgba(255, 255, 255, 0.44);
color: #f3f8ff;
}
.animal-transfer-inline-shell .form-control::placeholder {
color: rgba(243, 248, 255, 0.72);
}
.animal-transfer-inline-shell select.form-control option {
color: #0f1b2a;
}
.animal-transfer-inline-shell .animal-inline-top-save-action {
display: inline-flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
padding: 0;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.36);
background: rgba(15, 23, 42, 0.72);
color: #f8fafc;
cursor: pointer;
line-height: 1;
font-size: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.animal-transfer-inline-shell .animal-inline-top-save-action:hover,
.animal-transfer-inline-shell .animal-inline-top-save-action:focus {
background: rgba(30, 41, 59, 0.86);
border-color: rgba(255, 255, 255, 0.5);
color: #f8fafc;
outline: none;
}
CSS
);
if ($isInline) {
$this->registerCss(<<<CSS
html, body {
margin: 0 !important;
padding: 0 !important;
background: transparent !important;
scrollbar-width: none;
-ms-overflow-style: none;
}
html::-webkit-scrollbar, body::-webkit-scrollbar {
width: 0;
height: 0;
}
body > .panel:first-child {
margin-top: 0 !important;
}
CSS
);
}
?>
<div class="panel panel-default">
<div class="panel panel-default animal-transfer-inline-shell">
<?php if ($isInline): ?>
<div class="animal-inline-top-actions" style="display:flex;justify-content:flex-end;gap:8px;margin:8px 38px 6px 0;">
<?= \yii\helpers\Html::submitButton('<i class="fa fa-check"></i>', [
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Send Request'),
'form' => $transferFormId,
]) ?>
<?php if ($showTopCancel): ?>
<?= \yii\helpers\Html::button('<i class="fa fa-times"></i>', [
'id' => 'transfer-inline-add-cancel-icon',
'class' => 'animal-inline-top-save-action',
'title' => Yii::t('AnimalManagementModule.base', 'Cancel'),
'type' => 'button',
]) ?>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="panel-heading">
<?= Yii::t('AnimalManagementModule.base', '<strong>Transfer Request</strong> for {animal}', ['animal' => $animal->getDisplayName()]) ?>
</div>
<div class="panel-body">
<?php $form = ActiveForm::begin(); ?>
<?php
$formOptions = ['id' => $transferFormId];
if (!$isInline) {
$formOptions['target'] = '_top';
}
$form = ActiveForm::begin(['options' => $formOptions]);
?>
<?= \yii\helpers\Html::hiddenInput('returnTo', $returnTo) ?>
<?= $form->errorSummary($model, ['showAllErrors' => true]) ?>
<?= $form->field($model, 'to_space_id')->dropDownList($model->getTargetOptions(), ['prompt' => Yii::t('AnimalManagementModule.base', 'Select destination rescue')]) ?>
<?= $form->field($model, 'request_message')->textarea(['rows' => 4]) ?>
<?= $form->field($model, 'conditions_text')->textarea(['rows' => 3]) ?>
<?= Button::save(Yii::t('AnimalManagementModule.base', 'Send Request'))->submit() ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))
->link($space->createUrl('/animal_management/animals/index')) ?>
<?php if (!$isInline): ?>
<?= Button::save(Yii::t('AnimalManagementModule.base', 'Send Request'))->submit() ?>
<?= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))
->link($space->createUrl('/animal_management/animals/index')) ?>
<?php endif; ?>
<?php ActiveForm::end(); ?>
</div>
</div>
<?php
if ($isInline) {
$cancelPayload = Json::htmlEncode([
'source' => 'animal-inline-editor',
'type' => 'cancel',
'collapseId' => 'transfer-add-inline',
]);
$this->registerJs(<<<JS
(function() {
function postInlineCancel() {
if (window.parent && window.parent !== window) {
window.parent.postMessage($cancelPayload, '*');
}
}
if (window.jQuery) {
window.jQuery(document).on('click', '#transfer-inline-add-cancel, #transfer-inline-add-cancel-icon', function() {
postInlineCancel();
});
}
document.addEventListener('click', function(event) {
var target = event.target;
if (!target || !target.closest) {
return;
}
if (!target.closest('#transfer-inline-add-cancel, #transfer-inline-add-cancel-icon')) {
return;
}
postInlineCancel();
}, false);
})();
JS
, \yii\web\View::POS_END);
}
?>

File diff suppressed because it is too large Load Diff