request->get('inlineMedicalEdit', 0); $openProgressEditId = (int)Yii::$app->request->get('inlineProgressEdit', 0); $coverImageUrl = trim((string)$animalCoverImageUrl); $hasCoverImage = $coverImageUrl !== '' && (preg_match('/^https?:\/\//i', $coverImageUrl) || substr($coverImageUrl, 0, 1) === '/'); $statusLabel = Animal::statusOptions()[$animal->status] ?? (string)$animal->status; $detailFieldMap = [ 'name' => (string)$animal->getDisplayName(), 'species' => (string)$animal->species, 'breed' => (string)$animal->breed, 'sex' => (string)$animal->sex, 'status' => (string)$statusLabel, 'location_name' => (string)$animal->location_name, 'animal_uid' => (string)$animal->animal_uid, 'public_summary' => trim((string)$animal->public_summary), 'last_medical' => !empty($medicalVisits) ? DateDisplayHelper::format((string)$medicalVisits[0]->visit_at) : '', ]; $heroFieldValues = []; foreach ($detailHeroFields as $fieldKey) { $fieldKey = trim((string)$fieldKey); if ($fieldKey === '' || $fieldKey === 'name' || !array_key_exists($fieldKey, $detailFieldMap)) { continue; } $value = trim((string)$detailFieldMap[$fieldKey]); if ($value === '') { continue; } $heroFieldValues[] = $value; } $customHeroCount = 0; foreach ($customFieldValues as $customField) { if ($customHeroCount >= 3) { break; } $label = trim((string)($customField['label'] ?? '')); $value = trim((string)($customField['value'] ?? '')); if ($label === '' || $value === '') { continue; } $heroFieldValues[] = $label . ': ' . $value; $customHeroCount++; } if (class_exists(GalleryAssets::class)) { GalleryAssets::register($this); } $uiGalleryId = 'animal-gallery-' . (int)$animal->id; ?>
<?= Html::encode($animal->getDisplayName()) ?>
getDisplayName()) ?>
public_summary)): ?>
public_summary)) ?>
registerJs(<<<'JS' (function() { function getCsrfPayload() { var csrfParam = $('meta[name="csrf-param"]').attr('content') || ''; var csrfToken = $('meta[name="csrf-token"]').attr('content') || ''; var payload = {}; if (csrfParam && csrfToken) { payload[csrfParam] = csrfToken; } return payload; } function scrollInlineEditorIntoView(editor) { var $editor = $(editor); if (!$editor.length) { return; } var sideSpacing = parseFloat($editor.css('margin-left')); if (!(sideSpacing > 0)) { sideSpacing = parseFloat($editor.closest('.panel-body').css('padding-left')); } if (!(sideSpacing > 0)) { sideSpacing = 14; } var fixedHeaderHeight = 0; $('.navbar-fixed-top:visible, #topbar:visible, .topbar:visible, .layout-top-container:visible').each(function() { var h = $(this).outerHeight() || 0; if (h > fixedHeaderHeight) { fixedHeaderHeight = h; } }); var topReserve = Math.max(sideSpacing, 14) + Math.max(fixedHeaderHeight, 64) + 28; var top = Math.max(0, $editor.offset().top - topReserve); $('html, body').stop(true).animate({scrollTop: top}, 220); } function refreshPanels(selectors) { selectors = selectors || []; if (!selectors.length) { return $.Deferred().resolve().promise(); } return $.get(window.location.href).done(function(html) { var $doc = $('
').append($.parseHTML(html, document, true)); selectors.forEach(function(selector) { var $next = $doc.find(selector).first(); if ($next.length) { $(selector).replaceWith($next); } }); }); } window.addEventListener('message', function(event) { var data = event.data || {}; if (!data || typeof data !== 'object' || data.source !== 'animal-inline-editor') { return; } if (data.type === 'cancel') { if (data.collapseId) { $('#' + data.collapseId).collapse('hide'); } return; } if (data.type === 'saved') { if (data.collapseId) { $('#' + data.collapseId).collapse('hide'); } var selectors = $.isArray(data.refreshSelectors) && data.refreshSelectors.length ? data.refreshSelectors : ['#animal-medical-panel', '#animal-progress-panel', '#animal-gallery-panel']; refreshPanels(selectors); } }); $(document) .off('shown.bs.collapse.animalInlineScroll', '.animal-inline-editor') .on('shown.bs.collapse.animalInlineScroll', '.animal-inline-editor', function() { scrollInlineEditorIntoView(this); }); $(document).on('submit', '#animal-gallery-upload', function(event) { event.preventDefault(); var form = this; var filesInput = form.querySelector('#galleryImages'); var selectedCount = filesInput && filesInput.files ? filesInput.files.length : 0; if (selectedCount > 10) { window.alert('You can upload up to 10 images at a time.'); return; } var formData = new FormData(form); $.ajax({ url: form.action, type: 'POST', data: formData, processData: false, contentType: false }).done(function() { var shouldReopenModal = selectedCount > 0; if (form && typeof form.reset === 'function') { form.reset(); } $('#animal-gallery-manage-modal').modal('hide'); refreshPanels(['#animal-gallery-panel']).done(function() { if (shouldReopenModal) { $('#animal-gallery-manage-modal').modal('show'); } }); }); }); $(document).on('click', '.js-ajax-gallery-remove', function(event) { event.preventDefault(); var $link = $(this); var confirmText = $link.data('confirmMessage') || $link.data('confirm'); if (confirmText && !window.confirm(confirmText)) { return; } $.post($link.attr('href'), getCsrfPayload()).done(function() { refreshPanels(['#animal-gallery-panel']); }); }); })(); JS , \yii\web\View::POS_END); ?>
' . Yii::t('AnimalManagementModule.base', 'Add'), $space->createUrl('/animal_management/animals/medical-visits', ['id' => $animal->id, 'inlineMedicalAdd' => 1]) . '#medical-add-inline', [ 'class' => 'btn btn-xs btn-success', 'title' => Yii::t('AnimalManagementModule.base', 'Add Medical Visit'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Add Medical Visit'), ]) ?>
'BP', 'oxygen' => 'O₂', ]; ?> getCustomFieldDisplayValues($canManage); $visitFieldsByKey = []; $additionalVisitFields = []; $medicalMedia = ''; foreach ($visitCustomValues as $customField) { $fieldKey = (string)($customField['field_key'] ?? ''); if (in_array($fieldKey, $hiddenMedicalKeys, true)) { continue; } $fieldValue = trim((string)($customField['value'] ?? '')); if ($fieldValue === '') { continue; } if ($fieldKey === 'medical_media_reference' || $fieldKey === 'media_reference') { $medicalMedia = $fieldValue; continue; } if (in_array($fieldKey, $knownMedicalKeys, true)) { $visitFieldsByKey[$fieldKey] = [ 'label' => (string)($medicalVitalLabelOverrides[$fieldKey] ?? ($customField['label'] ?? $fieldKey)), 'value' => $fieldValue, ]; continue; } $additionalVisitFields[] = [ 'label' => (string)($customField['label'] ?? $fieldKey), 'value' => $fieldValue, ]; } $hasMedicalMedia = $medicalMedia !== '' && (preg_match('/^https?:\/\//i', $medicalMedia) || substr($medicalMedia, 0, 1) === '/'); $visitDateDisplay = DateDisplayHelper::format((string)$visit->visit_at); ?>
<?= Yii::t('AnimalManagementModule.base', 'Medical media') ?>
visit_at) ?>
:
', '#medical-edit-inline-' . (int)$visit->id, [ 'class' => 'btn btn-xs btn-default', 'data-toggle' => 'collapse', 'title' => Yii::t('AnimalManagementModule.base', 'Edit'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Edit'), ] ) ?>
provider_name)): ?>
: provider_name) ?>
notes)): ?>
notes)) ?>
recommendations)): ?>
recommendations)) ?>
:
' . Yii::t('AnimalManagementModule.base', 'Add'), $space->createUrl('/animal_management/animals/progress-updates', ['id' => $animal->id, 'inlineProgressAdd' => 1]) . '#progress-add-inline', [ 'class' => 'btn btn-xs btn-success', 'title' => Yii::t('AnimalManagementModule.base', 'Add Progress Update'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Add Progress Update'), ]) ?>
getCustomFieldDisplayValues($canManage); $mediaReference = ''; $progressCustomDisplayValues = []; foreach ($progressCustomValues as $customField) { if ((string)($customField['field_key'] ?? '') === 'media_reference') { $mediaReference = trim((string)$customField['value']); continue; } $progressCustomDisplayValues[] = $customField; } $hasMediaImage = $mediaReference !== '' && (preg_match('/^https?:\/\//i', $mediaReference) || substr($mediaReference, 0, 1) === '/'); ?>
<?= Yii::t('AnimalManagementModule.base', 'Progress media') ?>
update_at)) ?> weight) || !empty($update->vitals)): ?>
weight)): ?>: weight) ?> vitals)): ?>
', '#progress-edit-inline-' . (int)$update->id, [ 'class' => 'btn btn-xs btn-default', 'data-toggle' => 'collapse', 'title' => Yii::t('AnimalManagementModule.base', 'Edit'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Edit'), ] ) ?>
vitals)): ?>
vitals)) ?>
behavior_notes)): ?>
behavior_notes)) ?>
meal_plan_changes)): ?>
meal_plan_changes)) ?>
housing_changes)): ?>
housing_changes)) ?>
medical_concerns)): ?>
medical_concerns)) ?>
:
Transfer Timeline') ?> ' . Yii::t('AnimalManagementModule.base', 'Add'), $space->createUrl('/animal_management/animals/transfer', ['id' => $animal->id]), [ 'class' => 'btn btn-xs btn-success', 'title' => Yii::t('AnimalManagementModule.base', 'Request Transfer'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Request Transfer'), ]) ?>
getFromSpace(); $toSpace = $transfer->getToSpace(); ?>
name : Yii::t('AnimalManagementModule.base', 'Unknown')) ?> name : Yii::t('AnimalManagementModule.base', 'Unknown')) ?> status] ?? $transfer->status) ?> updated_at)) ?>
Transfer Audit Log') ?>
createdByUser; ?>
created_at)) ?> displayName : Yii::t('AnimalManagementModule.base', 'System')) ?> event_type) ?> from_status ?: '-') . ' -> ' . (string)($event->to_status ?: '-')) ?> message) ?>