{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <form method="POST" action="{{ path('chart_type_form', {action: action, id: id}) }}">
        <div class="row max-width-initial">
            <div class="large-6 columns">
                <h5>Basic information</h5>
                <p class="form-hint-text">Enter basic information below</p>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.account_desc) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.account_desc) }}
                        {{ form_widget(form.account) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.chartTypeGroup_desc) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.chartTypeGroup_desc) }}
                        {{ form_widget(form.chartTypeGroup) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.chart_type_category) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.chart_type_category) }}
                    </div>
                </div>

                {% set readonly = false %}
                {% if action == 'u' %}
                    {% set readonly = true %}
                {% endif %}

                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.code) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.code, { 'attr': {'readonly': readonly} }) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.description) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.description, { 'attr': {'readonly': readonly} }) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.start_date) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.start_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.end_date) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.end_date) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.color) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.color, { 'attr': {'class': 'jscolor'} }) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.rpt_prod_ordinal) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.rpt_prod_ordinal, {'type':'number'}) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.is_active) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.is_active) }}
                        {{ form_label(form.has_vitals) }}
                        {{ form_widget(form.has_vitals) }}
                        {{ form_label(form.has_billing) }}
                        {{ form_widget(form.has_billing) }}
                        {{ form_label(form.has_initial_assessment) }}
                        {{ form_widget(form.has_initial_assessment) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.daily_target_per_clinician) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.daily_target_per_clinician, {'type':'number'}) }}
                    </div>
                </div>
            </div>
            <div class="large-6 columns">
                <h5>Number of days for reminder</h5>
                <p class="form-hint-text">Enter number of days below</p>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.num_day) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.num_day) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.expected_no_of_days) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.expected_no_of_days, {'type':'number'}) }}
                    </div>
                </div>
            </div>
            <div class="small-12 columns">
                <hr class="max-width-initial">
                <div class="button-container">
                    <button type="submit" class="button just-continue" name="action" value="{{ action }}"
                            data-message="Are you sure you want to save this information?"
                    >Save</button>
                    {% if action == 'u' and (userData.type == 'Super Admin' or 'Admin Chart Type Delete' in userData.accesses) %}
                        <button type="submit" class="ask-continue button alert" name="action" value="d"
                                data-message="Are you sure you want to delete this record?"
                        >Delete</button>
                    {% endif %}
                    <a href="{{ path('chart_type') }}" class="button secondary">Back</a>
                </div>
            </div>
        </div>
        {{ form_widget(form.action) }}
        {{ form_widget(form.id) }}
        {{ form_widget(form._token) }}
    </form>
    {% include '@RxConnexion/Admin/js.html.twig' %}
    <script>
        //<![CDATA[
        chartType_form.settings.account_autocomplete_url = '{{ path('account_autocomplete') }}';
        chartType_form.settings.chart_type_group_autocomplete_url = '{{ path('chart_type_group_autocomplete') }}';
        jQ(document).ready(function(){
            chartType_form.init();
        });
        //]]>
    </script>
{% endblock %}