['enctype' => 'multipart/form-data']]); ?>
= $form->errorSummary($model, ['showAllErrors' => true]) ?>
getCustomFieldDefinitions();
$galleryImageOptions = $model->getGalleryImageOptions();
$galleryImageUrls = array_keys($galleryImageOptions);
$knownProfileFieldKeys = [
'dob',
'age',
'rescue',
'lineage',
'backstory',
'previous_owner_user_id',
'previous_owner_name',
'previous_owner_business_name',
'previous_owner_street_address',
'previous_owner_city',
'previous_owner_state',
'previous_owner_zip',
'previous_owner_cell_phone',
'previous_owner_business_phone',
'previous_owner_email',
];
$renderCustomField = static function (string $fieldKey, AnimalForm $model, array $definitions): string {
if (!isset($definitions[$fieldKey])) {
return '';
}
$definition = $definitions[$fieldKey];
$inputType = (string)$definition['input_type'];
$label = (string)$definition['label'];
if ((int)$definition['required'] === 1) {
$label .= ' *';
}
$fieldName = "AnimalForm[customFields][$fieldKey]";
$fieldValue = $model->customFields[$fieldKey] ?? '';
ob_start();
?>
= Html::encode($label) ?>
= Html::textarea($fieldName, (string)$fieldValue, ['class' => 'form-control', 'rows' => 3, 'id' => "animalform-customfields-$fieldKey"]) ?>
= Html::hiddenInput($fieldName, '0') ?>
= Html::checkbox($fieldName, !empty($fieldValue), ['value' => '1']) ?>
= Html::encode($label) ?>
= Html::encode($label) ?>
= Html::dropDownList(
$fieldName,
(string)$fieldValue,
$model->getCustomFieldSelectOptions($fieldKey),
['class' => 'form-control', 'prompt' => Yii::t('AnimalManagementModule.base', 'Select...'), 'id' => "animalform-customfields-$fieldKey"]
) ?>
= Html::encode($label) ?>
= Html::input('number', $fieldName, (string)$fieldValue, ['class' => 'form-control', 'step' => 'any', 'id' => "animalform-customfields-$fieldKey"]) ?>
= Html::encode($label) ?>
= Html::input('date', $fieldName, (string)$fieldValue, ['class' => 'form-control', 'id' => "animalform-customfields-$fieldKey"]) ?>
= Html::encode($label) ?>
= Html::input('datetime-local', $fieldName, (string)$fieldValue, ['class' => 'form-control', 'id' => "animalform-customfields-$fieldKey"]) ?>
= Html::encode($label) ?>
= Html::textInput($fieldName, (string)$fieldValue, ['class' => 'form-control', 'id' => "animalform-customfields-$fieldKey"]) ?>
= Yii::t('AnimalManagementModule.base', 'Profile & Cover Images') ?>
= Yii::t('AnimalManagementModule.base', 'Tap the edit icon on either image to choose from gallery thumbnails or upload from device camera roll.') ?>
getExistingCoverImagePath()): ?>
= Yii::t('AnimalManagementModule.base', 'Cover Image') ?>
getExistingProfileImagePath()): ?>
= Yii::t('AnimalManagementModule.base', 'Profile Image') ?>
= $form->field($model, 'coverImageGalleryPath')->hiddenInput()->label(false) ?>
= $form->field($model, 'profileImageGalleryPath')->hiddenInput()->label(false) ?>
= $form->field($model, 'coverImageFile')->fileInput(['accept' => 'image/*']) ?>
= $form->field($model, 'profileImageFile')->fileInput(['accept' => 'image/*']) ?>
= Yii::t('AnimalManagementModule.base', 'Details') ?>
isFieldActive('name')) { echo $form->field($model, 'name')->textInput(['maxlength' => 190]); } ?>
isFieldActive('species')) { echo $form->field($model, 'species')->textInput(['maxlength' => 120]); } ?>
isFieldActive('breed')) { echo $form->field($model, 'breed')->textInput(['maxlength' => 120]); } ?>
isFieldActive('sex')) { echo $form->field($model, 'sex')->textInput(['maxlength' => 32]); } ?>
= $renderCustomField('dob', $model, $customDefinitions) ?>
= $renderCustomField('age', $model, $customDefinitions) ?>
isFieldActive('status')) { echo $form->field($model, 'status')->dropDownList($model->getStatusOptions()); } ?>
isFieldActive('in_possession')) { echo $form->field($model, 'in_possession')->checkbox(); } ?>
= Yii::t('AnimalManagementModule.base', 'Location') ?>
= $renderCustomField('rescue', $model, $customDefinitions) ?>
isFieldActive('location_name')) { echo $form->field($model, 'location_name')->textInput(['maxlength' => 120]); } ?>
isFieldActive('city')) { echo $form->field($model, 'city')->textInput(['maxlength' => 120]); } ?>
isFieldActive('state')) { echo $form->field($model, 'state')->textInput(['maxlength' => 2]); } ?>
isFieldActive('zip')) { echo $form->field($model, 'zip')->textInput(['maxlength' => 10]); } ?>
= Yii::t('AnimalManagementModule.base', 'History') ?>
= $renderCustomField('lineage', $model, $customDefinitions) ?>
= $renderCustomField('backstory', $model, $customDefinitions) ?>
= Yii::t('AnimalManagementModule.base', 'Public') ?>
isFieldActive('public_summary')): ?>
= $form->field($model, 'public_summary')->textarea(['rows' => 4]) ?>
= Yii::t('AnimalManagementModule.base', 'Previous Owner') ?>
= $renderCustomField('previous_owner_user_id', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_name', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_business_name', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_street_address', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_city', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_state', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_zip', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_cell_phone', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_business_phone', $model, $customDefinitions) ?>
= $renderCustomField('previous_owner_email', $model, $customDefinitions) ?>
= Yii::t('AnimalManagementModule.base', 'Display Field Overrides') ?>
= Yii::t('AnimalManagementModule.base', 'Tile Fields') ?>
= Html::checkboxList('AnimalForm[tileDisplayFields]', $model->tileDisplayFields, DisplaySettingsForm::fieldOptions(), ['separator' => ' ']) ?>
= Yii::t('AnimalManagementModule.base', 'Hero Fields') ?>
= Html::checkboxList('AnimalForm[heroDisplayFields]', $model->heroDisplayFields, DisplaySettingsForm::fieldOptions(), ['separator' => ' ']) ?>
$definition) {
if (in_array($fieldKey, $knownProfileFieldKeys, true)) {
continue;
}
$remainingCustomFields[$fieldKey] = $definition;
}
?>
= Yii::t('AnimalManagementModule.base', 'Custom Fields') ?>
$definition): ?>
= $renderCustomField($fieldKey, $model, $remainingCustomFields) ?>
= Button::save(!empty($isEdit)
? Yii::t('AnimalManagementModule.base', 'Save Changes')
: Yii::t('AnimalManagementModule.base', 'Create Animal'))->submit() ?>
= Button::asLink(Yii::t('AnimalManagementModule.base', 'Cancel'))->link(
!empty($isEdit) && $animal instanceof Animal
? $space->createUrl('/animal_management/animals/view', ['id' => $animal->id])
: $space->createUrl('/animal_management/animals/index')
) ?>
= Html::a(
Yii::t('AnimalManagementModule.base', 'Delete Animal'),
$space->createUrl('/animal_management/animals/delete', ['id' => $animal->id]),
[
'class' => 'btn btn-danger pull-right',
'style' => 'margin-left:8px;',
'data-method' => 'post',
'data-confirm' => Yii::t('AnimalManagementModule.base', 'Delete {name}? This will remove the animal record and local gallery uploads. This cannot be undone.', ['name' => $animal->getDisplayName()]),
]
) ?>
= Yii::t('AnimalManagementModule.base', 'Select an existing gallery image or upload a new cover image.') ?>
= 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', 'No gallery images available yet.') ?>
= $form->field($model, 'removeCoverImage')->checkbox() ?>
= Yii::t('AnimalManagementModule.base', 'Select an existing gallery image or upload a new profile image.') ?>
= 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', 'No gallery images available yet.') ?>
= $form->field($model, 'removeProfileImage')->checkbox() ?>