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

@@ -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());
});