customFields[$fieldKey] ?? ''; ob_start(); ?>
'form-control', 'rows' => 3, 'id' => "animalprogressupdateform-customfields-$fieldKey"]) ?>
getCustomFieldSelectOptions($fieldKey), ['class' => 'form-control', 'prompt' => Yii::t('AnimalManagementModule.base', 'Select...'), 'id' => "animalprogressupdateform-customfields-$fieldKey"] ) ?>
'form-control', 'step' => 'any', 'id' => "animalprogressupdateform-customfields-$fieldKey"]) ?>
'form-control', 'id' => "animalprogressupdateform-customfields-$fieldKey"]) ?>
'form-control', 'id' => "animalprogressupdateform-customfields-$fieldKey"]) ?>
'form-control', 'id' => "animalprogressupdateform-customfields-$fieldKey"]) ?>
getCustomFieldDefinitions(); $knownProgressKeys = ['progress_notes', 'routine_updates', 'media_reference']; $otherProgressCustomDefinitions = []; foreach ($progressCustomDefinitions as $fieldKey => $definition) { if (in_array($fieldKey, $knownProgressKeys, true)) { continue; } $otherProgressCustomDefinitions[$fieldKey] = $definition; } $currentMediaReference = trim((string)($progressUpdateForm->customFields['media_reference'] ?? '')); $progressAddModalId = 'add-progress-update-modal'; $progressFormId = 'add-progress-update-main-form'; $openProgressEditId = (int)Yii::$app->request->get('inlineProgressEdit', 0); $openProgressAdd = (int)Yii::$app->request->get('inlineProgressAdd', 0) === 1; ?>
Progress Feed') ?>
getDisplayName()), $space->createUrl('/animal_management/animals/view', ['id' => $animal->id]), ['style' => 'font-size:20px;font-weight:700;line-height:1.2;'] ) ?> createUrl('/animal_management/animals/index'), ['style' => 'font-size:16px;line-height:1.2;'] ) ?> ' . Yii::t('AnimalManagementModule.base', 'Add Progress Update'), '#progress-add-inline', [ 'class' => 'btn btn-success btn-sm', 'title' => Yii::t('AnimalManagementModule.base', 'Add Progress Update'), 'aria-label' => Yii::t('AnimalManagementModule.base', 'Add Progress Update'), 'data-toggle' => 'collapse', ]) ?>
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)) ?>
:
registerCss(<<registerJs(<< 0)) { sideSpacing = parseFloat(editorNode.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, editorNode.offset().top - topReserve); $('html, body').stop(true).animate({scrollTop: top}, 220); } function refreshProgressUpdatesPageRoot() { return $.get(window.location.href).done(function(html) { var doc = $('
').append($.parseHTML(html, document, true)); var nextRoot = doc.find(pageRootSelector).first(); if (!nextRoot.length) { return; } $(pageRootSelector).replaceWith(nextRoot); if (typeof window.initProgressUpdatesPage === 'function') { window.initProgressUpdatesPage(); } }); } if (!window.__animalProgressUpdatesInlineListenerBound) { window.__animalProgressUpdatesInlineListenerBound = true; 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'); } refreshProgressUpdatesPageRoot(); } }); } window.initProgressUpdatesPage = function() { $(document) .off('shown.bs.collapse.progressInlineScroll', pageRootSelector + ' .progress-feed-inline-editor') .on('shown.bs.collapse.progressInlineScroll', pageRootSelector + ' .progress-feed-inline-editor', function() { scrollInlineEditorIntoView(this); }); $(document) .off('click.progressInlineScroll', pageRootSelector + ' a[href^="#progress-edit-inline-"], ' + pageRootSelector + ' a[href="#progress-add-inline"]') .on('click.progressInlineScroll', pageRootSelector + ' a[href^="#progress-edit-inline-"], ' + pageRootSelector + ' a[href="#progress-add-inline"]', function() { var target = $(this).attr('href'); if (!target || target.charAt(0) !== '#') { return; } window.setTimeout(function() { scrollInlineEditorIntoView($(target)); }, 260); }); var preopenedEditor = $(pageRootSelector + ' .progress-feed-inline-editor.in').first(); if (preopenedEditor.length) { window.setTimeout(function() { scrollInlineEditorIntoView(preopenedEditor); }, 260); } function markSelectedMediaThumb(value) { $('.progress-media-select-thumb').removeClass('is-selected'); if (!value) { return; } $('.progress-media-select-thumb').each(function() { if (($(this).attr('data-media-url') || '') === value) { $(this).addClass('is-selected'); } }); } $(document).off('click.progressMediaSelect', '.progress-media-select-thumb').on('click.progressMediaSelect', '.progress-media-select-thumb', function(event) { event.preventDefault(); var mediaUrl = $(this).attr('data-media-url') || ''; $('#progress-media-gallery-path').val(mediaUrl); markSelectedMediaThumb(mediaUrl); $('#progressMediaUpload').val(''); $('input[name="removeProgressMedia"]').prop('checked', false); if (mediaUrl) { $('#progress-media-preview').html('Selected media'); } $('#progress-media-modal').modal('hide'); }); $(document).off('change.progressMediaUpload', '#progressMediaUpload').on('change.progressMediaUpload', '#progressMediaUpload', function() { var file = this.files && this.files[0] ? this.files[0] : null; if (!file) { return; } $('#progress-media-gallery-path').val(''); markSelectedMediaThumb(''); $('input[name="removeProgressMedia"]').prop('checked', false); var reader = new FileReader(); reader.onload = function(e) { $('#progress-media-preview').html('Selected media'); $('#progress-media-modal').modal('hide'); }; reader.readAsDataURL(file); }); $(document).off('shown.bs.modal.progressMediaModal', '#progress-media-modal').on('shown.bs.modal.progressMediaModal', '#progress-media-modal', function() { markSelectedMediaThumb($('#progress-media-gallery-path').val()); }); $(document).off('show.bs.modal.progressMediaStack', '#progress-media-modal').on('show.bs.modal.progressMediaStack', '#progress-media-modal', function() { var zIndex = 1060 + (10 * $('.modal.in:visible').length); $(this).css('z-index', zIndex); window.setTimeout(function() { $('.modal-backdrop').not('.progress-media-stack').last().css('z-index', zIndex - 1).addClass('progress-media-stack'); }, 0); }); $(document).off('hidden.bs.modal.progressMediaStack', '#progress-media-modal').on('hidden.bs.modal.progressMediaStack', '#progress-media-modal', function() { $(this).css('z-index', ''); if ($('#{$progressAddModalId}').is(':visible')) { $('body').addClass('modal-open'); } }); $(document).off('submit.progressAjax', formSelector).on('submit.progressAjax', formSelector, function(event) { event.preventDefault(); var form = this; var formData = new FormData(form); var submitButtons = $(form).find('button[type="submit"], input[type="submit"]'); submitButtons.prop('disabled', true); $.ajax({ url: form.action, type: 'POST', data: formData, processData: false, contentType: false }).always(function() { submitButtons.prop('disabled', false); }).done(function() { $('#{$progressAddModalId}').modal('hide'); refreshProgressUpdatesPageRoot(); }); }); }; window.initProgressUpdatesPage(); })(); JS ); ?>