Skip to content

Commit

Permalink
Forms: fix nested form table display, fix student notes not editable …
Browse files Browse the repository at this point in the history
…for Expected students
  • Loading branch information
SKuipers committed Nov 16, 2024
1 parent 21f32c9 commit 128b32e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
$form->addRow()->addHeading('Students', __('Students'));
$form->addRow()->addAlert(__('There are no records to display.'), 'error');
} else {
$table = $form->addRow()->addTable()->setClass('smallIntBorder w-full colorOddEven noMargin noPadding noBorder');
$table = $form->addRow()->setHeading('table')->addTable()->setClass('smallIntBorder w-full colorOddEven noMargin noPadding noBorder');

$completeText = !empty($values['completeDate'])? __('Marked on').' '.Format::date($values['completeDate']) : __('Unmarked');
$detailsText = $values['type'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
: $noteGateway->selectBy(['gibbonStudentNoteID' => $gibbonStudentNoteID, 'gibbonPersonIDCreator' => $session->get('gibbonPersonID')])->fetch();

if (empty($studentNote)) {
$URL .= '&return=error2';
$URL .= '&return=error0';
header("Location: {$URL}");
exit;
}
Expand Down
6 changes: 4 additions & 2 deletions resources/templates/components/form.twig.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ <h2>{{ form.getTitle }}</h2>
<div class="{{ (rows|first).class|split(' ')|first }} mb-6 rounded bg-gray-50 border {{ not sectionLoop.last ? 'border-t-4 focus-within:border-t-blue-500 transition' }} {{ section == 'submit' ? 'w-full sm:sticky -bottom-px -mt-px mb-px z-40' : standardLayout ? ' ' : ''}}" >
{% endif %}

{% set isformTable = ((rows|first).getElements|first).isInstanceOf('Gibbon\\Forms\\Layout\\Table') %}

{% for num, row in rows %}

{% set rowLoop = loop %}
Expand All @@ -107,8 +109,8 @@ <h2>{{ form.getTitle }}</h2>
? 'flex flex-row content-center p-0 gap-2 sm:gap-4 justify-end sm:items-center'
: 'flex flex-col sm:flex-row content-center p-0 gap-2 sm:gap-4 justify-between sm:items-start'
%}

<div id="{{ row.getID }}" class="{{ standardLayout ? ' px-4 sm:px-8 py-4' : smallLayout ? 'px-2 py-2' : "noIntBorder" in form.getClass ? 'py-2' }} {{ row.getClass|replace({'standardWidth': ''}) }} {{ rowClass }} " {{ row.getAttributeString('', 'id,class')|raw }}>
<div id="{{ row.getID }}" class="{{ standardLayout and not isformTable ? ' px-4 sm:px-8 py-4' : smallLayout ? 'px-2 py-2' : "noIntBorder" in form.getClass ? 'py-2' }} {{ row.getClass|replace({'standardWidth': ''}) }} {{ rowClass }} " {{ row.getAttributeString('', 'id,class')|raw }}>

{% if quickSave and section == 'submit' %}
<span class="text-xs text-gray-600 flex-1">
Expand Down
12 changes: 6 additions & 6 deletions src/Domain/Students/StudentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,17 @@ public function selectActiveStudentByPerson($gibbonSchoolYearID, $gibbonPersonID
$data = array('gibbonSchoolYearID' => $gibbonSchoolYearID, 'gibbonPersonID' => $gibbonPersonID);
$sql = "SELECT gibbonPerson.gibbonPersonID, title, surname, preferredName, email, image_240, gender, dateStart, dateEnd, gibbonPerson.status, gibbonStudentEnrolment.gibbonStudentEnrolmentID, gibbonStudentEnrolment.gibbonSchoolYearID, gibbonYearGroup.gibbonYearGroupID, gibbonYearGroup.nameShort AS yearGroup, gibbonYearGroup.name AS yearGroupName, gibbonFormGroup.gibbonFormGroupID, gibbonFormGroup.nameShort AS formGroup, gibbonFormGroup.name AS formGroupName, 'Student' as roleCategory, gibbonPerson.privacy, gibbonStudentEnrolment.fields
FROM gibbonPerson
JOIN gibbonStudentEnrolment ON (gibbonPerson.gibbonPersonID=gibbonStudentEnrolment.gibbonPersonID)
JOIN gibbonYearGroup ON (gibbonStudentEnrolment.gibbonYearGroupID=gibbonYearGroup.gibbonYearGroupID)
JOIN gibbonFormGroup ON (gibbonStudentEnrolment.gibbonFormGroupID=gibbonFormGroup.gibbonFormGroupID)
WHERE gibbonPerson.gibbonPersonID=:gibbonPersonID
AND gibbonStudentEnrolment.gibbonSchoolYearID=:gibbonSchoolYearID ";
LEFT JOIN gibbonStudentEnrolment ON (gibbonPerson.gibbonPersonID=gibbonStudentEnrolment.gibbonPersonID AND gibbonStudentEnrolment.gibbonSchoolYearID=:gibbonSchoolYearID)
LEFT JOIN gibbonYearGroup ON (gibbonStudentEnrolment.gibbonYearGroupID=gibbonYearGroup.gibbonYearGroupID)
LEFT JOIN gibbonFormGroup ON (gibbonStudentEnrolment.gibbonFormGroupID=gibbonFormGroup.gibbonFormGroupID)
WHERE gibbonPerson.gibbonPersonID=:gibbonPersonID";

if ($onlyFull) {
$data['today'] = date('Y-m-d');
$sql .= " AND gibbonPerson.status='Full'
AND (dateStart IS NULL OR dateStart<=:today)
AND (dateEnd IS NULL OR dateEnd>=:today) ";
AND (dateEnd IS NULL OR dateEnd>=:today)
AND gibbonStudentEnrolment.gibbonStudentEnrolmentID IS NOT NULL";
}

return $this->db()->select($sql, $data);
Expand Down

0 comments on commit 128b32e

Please sign in to comment.