cmtracker/templates/internal/cases/notes/edit-note.html.twig
Ryan Prather b828333222 fix: twig note templates
* fix edit notes and and member present
* refactor enum moving process
2025-02-10 15:10:25 -05:00

327 lines
16 KiB
Twig

{% extends 'base.html.twig' %}
{% block body %}
{{ block('nav', 'internal/libs/nav.html.twig') }}
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
{{ block('topnav', 'internal/libs/top-nav.html.twig') }}
{% if noteType == 'visit' %}
<section>
<div class="card card-plain">
<div class="card-header">
<h4 class="font-weight-bolder">Edit Referral Note</h4>
<p class="mb-0">{{ referral.memberCase.caseName }}</p>
</div>
<div class="card-body">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class='container'>
<div class='row'>
{% set endDateWarning = '' %}
{% if date("+28 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-warning' %}
{% elseif date("+14 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-danger text-white' %}
{% endif %}
<span class='col{% if referral.getHoursRemaining() < 40 %} bg-gradient-danger text-white{% endif %}'>
Hours:
{{ referral.hours }}
/
Remaining:
{{ referral.getHoursRemaining() }}
</span>
<span class='col {{ endDateWarning }}'>
Expiration Date:
{{ referral.endDate|date('M j, Y', company_timezone) }}
</span>
</div>
<div class='row' style='margin-top:10px;'>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_date'></label>
<input type='date' name='{{ field_name(form.date) }}' value='{{ field_value(form.date) }}' id='note_form_date' class='form-control' title='Visit Date'/>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_startTime'></label>
<input type='time' name='{{ field_name(form.startTime) }}' value='{{ field_value(form.startTime) }}' id='note_form_startTime' onchange='calcTime()' class='form-control' title='Start Time'/>&nbsp;&nbsp;
<label for='note_form_endTime'></label>
<input type='time' name='{{ field_name(form.endTime) }}' value='{{ field_value(form.endTime) }}' id='note_form_endTime' onchange='calcTime()' class='form-control' title='End Time'/>
</div>
<div class='input-group input-group-outline mb-3'>
<input type='text' id='case-mins' style='width:49%;margin-right:5px;' disabled='disabled' title='Case Minutes'/>
<input type='text' id='case-hours' style='width:49%;margin-left:5px;' disabled='disabled' title='Case Hours'/>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.status) }}' id='note_form_status' class='form-control'>
<option value=''>-- Status --</option>
{% for s in enum('App\\Enums\\Case\\NoteStatus').cases() %}
<option value='{{ s.value }}' {% if s == note.status %} selected='selected' {% endif %}>{{ s.value|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.location) }}' id='note_form_location' class='form-control'>
<option value=''>-- Location --</option>
{% for l in enum('App\\Enums\\Case\\NoteLocation').cases() %}
<option value='{{ l.value }}' {% if l == note.location %} selected='selected' {% endif %}>{{ l.value }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.method) }}' id='note_form_method' class='form-control'>
<option value=''>-- Method --</option>
{% for m in enum('App\\Enums\\Case\\NoteMethod').cases() %}
<option value='{{ m.value }}' {% if m == note.method %} selected='selected' {% endif %}>{{ m.name|replace({'_': ' '})|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_parentalRole'>Parental Role</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.parentalRole) }}' id='note_form_parentalRole' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\Case\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q == note.parentalRole %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_childDevelopment'>Child Development</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.childDevelopment) }}' id='note_form_childDevelopment' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\Case\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q == note.childDevelopment %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_appropriateResponse'>Appropriate Response</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.appropriateResponse) }}' id='note_form_appropriateResponse' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\Case\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q == note.appropriateResponse %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_childAheadOfSelf'>Child Ahead Of Self</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.childAheadOfSelf) }}' id='note_form_childAheadOfSelf' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\Case\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q == note.childAheadOfSelf %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_showsEmpathy'>Shows Empathy</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.showsEmpathy) }}' id='note_form_showsEmpathy' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\Case\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q == note.showsEmpathy %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_childFocused'>Child Focused</label>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.childFocused) }}' id='note_form_childFocused' class='form-control'>
<option value=''>-- Select --</option>
{% for q in enum('App\\Enums\\Case\\VisitQualityLevel').cases() %}
<option value='{{ q.value }}' {% if q == note.childFocused %} selected='selected' {% endif %}>{{ q.name|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
</div>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
<div>
<label>Member Present</label>
{% for m in members %}
<div class='row'>
<input type='checkbox' id='note_form_member_{{ loop.index }}' name='{{ field_name(form.members) }}[]' value='{{ m.id }}' class='member-present' {% if m.isChecked() %} checked='checked' {% endif %}/>
<label for='note_form_member_{{ loop.index }}'>{{ m.getName() }}</label>
</div>
{% endfor %}
</div>
{# form_row(form.members, {
'label': 'Members Present',
'label_attr': {'class': ''},
'attr': {'class': 'form-control'},
'help': 'Select each member present during the time'
}) #}
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_narrative'>Observed Narrative</label>
<textarea name='{{ field_name(form.narrative) }}' id='note_form_narrative' class='form-control' style='width:100%;height:200px;'>{{ field_value(form.narrative) }}</textarea>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_strengths'>Observed Strengths</label>
<textarea name='{{ field_name(form.strengths) }}' id='note_form_strengths' class='form-control' style='width:100%;height:200px;'>{{ field_value(form.strengths) }}</textarea>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_issues'>Observed Issues</label>
<textarea name='{{ field_name(form.issues) }}' id='note_form_issues' class='form-control' style='width:100%;height:100px;'>{{ field_value(form.issues) }}</textarea>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_recommendation'>Recommendation</label>
<textarea name='{{ field_name(form.recommendation) }}' id='note_form_recommendation' class='form-control' style='width:100%;height:100px;'>{{ field_value(form.recommendation) }}</textarea>
</div>
</div>
</div>
<div class='row'>
<div class="text-center">
<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Save Note</button>
</div>
</div>
</div>
{{ form_end(form) }}
</div>
</div>
</section>
{% elseif noteType == 'standard' %}
<section>
<div class="card card-plain">
<div class="card-header">
<h4 class="font-weight-bolder">Add Referral Note</h4>
<p class="mb-0">{{ referral.memberCase.caseName }}</p>
</div>
<div class="card-body">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class='container'>
<div class='row'>
{% set endDateWarning = '' %}
{% if date("+28 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-warning' %}
{% elseif date("+14 days") >= referral.endDate %}
{% set endDateWarning = 'bg-gradient-danger text-white' %}
{% endif %}
<span class='col{% if referral.hours < 40 %} bg-gradient-danger text-white{% endif %}'>
Hours: {{ referral.hours }} /
Remaining: {{ referral.getHoursRemaining() }}
</span>
<span class='col {{ endDateWarning }}'>
Expiration Date:
{{ referral.endDate|date('M j, Y', company_timezone) }}
</span>
</div>
<div class='row' style='margin-top:10px;'>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_date'></label>
<input type='date' name='{{ field_name(form.date) }}' id='note_form_date' class='form-control' title='Visit Date'/>
</div>
<div class='input-group input-group-outline mb-3'>
<label for='note_form_startTime'></label>
<input type='time' name='{{ field_name(form.startTime) }}' id='note_form_startTime' onchange='calcTime()' class='form-control' title='Start Time'/>&nbsp;&nbsp;
<label for='note_form_endTime'></label>
<input type='time' name='{{ field_name(form.endTime) }}' id='note_form_endTime' onchange='calcTime()' class='form-control' title='End Time'/>
</div>
<div class='input-group input-group-outline mb-3'>
<input type='text' id='case-mins' style='width:49%;margin-right:5px;' disabled='disabled' title='Case Minutes'/>
<input type='text' id='case-hours' style='width:49%;margin-left:5px;' disabled='disabled' title='Case Hours'/>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.status) }}' id='note_form_status' class='form-control'>
<option value=''>-- Status --</option>
{% for s in enum('App\\Enums\\Case\\NoteStatus').cases() %}
<option value='{{ s.value }}'>{{ s.value|capitalize }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.location) }}' id='note_form_location' class='form-control'>
<option value=''>-- Location --</option>
{% for l in enum('App\\Enums\\Case\\NoteLocation').cases() %}
<option value='{{ l.value }}' {% if l == note.location %} selected='selected' {% endif %}>{{ l.value }}</option>
{% endfor %}
</select>
</div>
<div class='input-group input-group-outline mb-3'>
<select name='{{ field_name(form.method) }}' id='note_form_method' class='form-control'>
<option value=''>-- Method --</option>
{% for m in enum('App\\Enums\\Case\\NoteMethod').cases() %}
<option value='{{ m.value }}' {% if m == note.method %} selected='selected' {% endif %}>{{ m.name|replace({'_': ' '})|lower|capitalize }}</option>
{% endfor %}
</select>
</div>
</div>
<div class='col'>
<div class='input-group input-group-outline mb-3'>
<div>
<label>Member Present</label>
{% for idx,m in members %}
<div class='row'>
<input type='checkbox' id='note_form_member_{{ idx }}' name='{{ field_name(form.members) }}[]' value='{{ m.id }}' class='member-present' {% if m.isChecked() %} checked='checked' {% endif %}/>
<label for='note_form_member_{{ idx }}'>{{ m.name }}</label>
</div>
{% endfor %}
</div>
{# form_row(form.members, {
'label': 'Members Present',
'label_attr': {'class': ''},
'attr': {'class': 'form-control'},
'help': 'Select each member present during the time',
'value': member.id
}) #}
</div>
<div class='input-group input-group-outline mb-3'>
<label for='case_note_note' class='form-label'>Notes</label>
<textarea name='{{ field_name(form.note) }}' id='case_note_note' class='form-control' style='width:100%;height:300px;'></textarea>
</div>
</div>
</div>
<div class='row'>
<div class="text-center">
<button type="submit" class="btn btn-lg bg-gradient-dark btn-lg w-100 mt-4 mb-0">Save Note</button>
</div>
</div>
</div>
{{ form_end(form, {render_rest: false}) }}
</div>
</div>
</section>
{% endif %}
</main>
{% endblock %}
{% block page_js %}
<script type='module'>
import {* as $} from "{{ asset('vendor/jquery/jquery.index.js') }}";
</script>
{% endblock %}
{% block page_css %}
<style>
.row>* {
width: revert !important;
flex-shrink: revert !important;
}
.member-present {
margin-left: var(--bs-gutter-x);
}
</style>
{% endblock %}