This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
$weekStartSelected = set_value('week_start', $defaultWeekStart);
|
||||
$weekEndValue = set_value('week_end', $existingWeekEnd ?? '');
|
||||
$existingReports = $existingReports ?? [];
|
||||
$isSchoolYearReadonly = (bool) ($isSchoolYearReadonly ?? false);
|
||||
if (!$weekEndValue && $weekStartSelected) {
|
||||
try {
|
||||
$dt = new \DateTime($weekStartSelected);
|
||||
@@ -58,6 +59,9 @@
|
||||
<?php if (session()->getFlashdata('error')): ?>
|
||||
<div class="alert alert-danger"><?= esc(session()->getFlashdata('error')) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($isSchoolYearReadonly): ?>
|
||||
<div class="alert alert-warning">This school year is read-only. Progress submissions are disabled.</div>
|
||||
<?php endif; ?>
|
||||
<?php if (session()->getFlashdata('errors')): ?>
|
||||
<div class="alert alert-danger">
|
||||
<ul class="mb-0">
|
||||
@@ -142,7 +146,8 @@
|
||||
<button type="button"
|
||||
class="btn btn-sm btn-outline-dark"
|
||||
data-add-unit-chapter
|
||||
data-subject="<?= esc($slug) ?>">
|
||||
data-subject="<?= esc($slug) ?>"
|
||||
<?= $isSchoolYearReadonly ? 'disabled' : '' ?>>
|
||||
<?= $slug === 'quran' ? '+ Add Surah, Arabic Subject' : '+ Add Unit, Chapter' ?>
|
||||
</button>
|
||||
<div class="subject-curriculum-list position-absolute d-none border rounded shadow-sm bg-white mt-1" id="curriculumList-<?= esc($slug) ?>" style="min-width: 220px; z-index: 5;">
|
||||
@@ -170,7 +175,8 @@
|
||||
data-subject="<?= esc($slug) ?>"
|
||||
data-unit-number="<?= esc($unitNumber) ?>"
|
||||
data-unit-title="<?= esc($unitTitle) ?>"
|
||||
data-chapter="<?= esc($chapterName) ?>">
|
||||
data-chapter="<?= esc($chapterName) ?>"
|
||||
<?= $isSchoolYearReadonly ? 'disabled' : '' ?>>
|
||||
<?= esc($display) ?>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
@@ -179,7 +185,7 @@
|
||||
<div class="px-2 py-2 border-top">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" placeholder="Custom Surah" data-custom-input data-subject="<?= esc($slug) ?>">
|
||||
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>">Add</button>
|
||||
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Add</button>
|
||||
</div>
|
||||
<div class="form-text small text-muted">Add a custom Surah or Arabic target.</div>
|
||||
</div>
|
||||
@@ -187,7 +193,7 @@
|
||||
<div class="px-2 py-2 border-top">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" placeholder="Type subject or topic" data-custom-input data-subject="<?= esc($slug) ?>">
|
||||
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>">Add</button>
|
||||
<button type="button" class="btn btn-outline-secondary" data-custom-entry data-subject="<?= esc($slug) ?>" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Add</button>
|
||||
</div>
|
||||
<div class="form-text small text-muted">Add a subject or unit not listed above (e.g. Seerah, Fiqh, Akhlaq).</div>
|
||||
</div>
|
||||
@@ -206,7 +212,7 @@
|
||||
<input type="text" name="chapter_<?= esc($slug) ?>[]" class="form-control form-control-sm" placeholder="Chapter" value="<?= esc($chapterValues[$i] ?? '') ?>" readonly>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button type="button" class="btn btn-outline-danger btn-sm" data-remove-unit-chapter aria-label="Remove entry">X</button>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm" data-remove-unit-chapter aria-label="Remove entry" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>X</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endfor; ?>
|
||||
@@ -232,7 +238,7 @@
|
||||
<div class="col">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body d-flex flex-column">
|
||||
<button class="btn btn-primary w-100 mt-auto" type="submit" <?= $hasClass ? '' : 'disabled' ?>><?= esc($submitLabel) ?></button>
|
||||
<button class="btn btn-primary w-100 mt-auto" type="submit" <?= ($hasClass && !$isSchoolYearReadonly) ? '' : 'disabled' ?>><?= esc($submitLabel) ?></button>
|
||||
<?php if (! $hasClass): ?>
|
||||
<div class="text-muted small mt-2">
|
||||
You are not assigned to a class. Contact the administrator to submit progress.
|
||||
@@ -288,7 +294,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="confirmOverwriteButton">Override</button>
|
||||
<button type="button" class="btn btn-primary" id="confirmOverwriteButton" <?= $isSchoolYearReadonly ? 'disabled' : '' ?>>Override</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user