{% extends '@RxConnexion/Admin/content.html.twig' %}
{% block content %}
    <style>
        #letterTemplate_addEmail_btn{
            cursor: pointer;
            color: gray;
        }
        .letterTemplate_removeEmail_btn{
            cursor: pointer;
            color: #cc4b37;
            float: right;
        }
    </style>
    <form method="POST" action="{{ path('letter_template_form', {action: action, id: id}) }}" enctype="multipart/form-data">
        <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.company_description) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.company_description) }}
                        {{ form_widget(form.company) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.letterType) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.letterType) }}
                    </div>
                </div>
                <div class="row" style="margin-bottom: 10px;">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.faxCoverBody) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.faxCoverBody) }}
                    </div>
                </div>
                <div class="row">
                    <div class="large-3 large-text-right columns">
                        {{ form_label(form.body) }}
                    </div>
                    <div class="large-9 columns">
                        {{ form_widget(form.body) }}
                    </div>
                </div>
            </div>
            <div class="large-6 columns" style="">
                <h5>Other information</h5>
                <p class="form-hint-text">Enter other information below</p>
                <div class="large-12 columns">
                    <span style="font-size: 15px; font-weight: bold;">Email: <span id="letterTemplate_addEmail_btn"><i class="fa fa-plus-circle"></i></span></span>
                    <div id="cc_container">
                        {% for lt_cc in form.letterTemplateEmails %}
                            <div class="cc_row row" data-idx="{{ loop.index0 }}">
                                <div class="cc_col1 small-6 columns"  data-idx="{{ loop.index0 }}">
                                    <span class="" data-idx="{{ loop.index0 }}">
                                       &nbsp;
                                    </span>
                                    <input
                                            value="{{ lt_cc.vars.value.description|default('') }}"
                                            type="text"
                                            name="letterTemplate[letterTemplateEmails][{{ loop.index0 }}][description]"
                                            id="letterTemplate_letterTemplateEmail_{{ loop.index0 }}_desc"
                                            class="letterTemplate_letterTemplateEmail_desc hidden-cc-{{ loop.index0 }}
                                    ">
                                </div>
                                <div class="cc_col2 small-6 columns"  data-idx="{{ loop.index0 }}">
                                    <span class="letterTemplate_removeEmail_btn" data-idx="{{ loop.index0 }}"><i class="fa fa-times-circle"></i></span> <label for="letterTemplate_letterTemplateEmail_{{ loop.index0 }}_email" class="hidden-cc-{{ loop.index0 }}" id="letterTemplate_letterTemplateEmail_{{ loop.index0 }}_email_label"></label>
                                    <input
                                            value="{{ lt_cc.vars.value.email }}"
                                            type="email"
                                            name="letterTemplate[letterTemplateEmails][{{ loop.index0 }}][email]"
                                            id="letterTemplate_letterTemplateEmail_{{ loop.index0 }}_email"
                                            class="letterTemplate_letterTemplateEmail_email hidden-cc-{{ loop.index0 }}">
                                    <input
                                            value="{{ lt_cc.vars.value.id }}"
                                            type="hidden"
                                            name="letterTemplate[letterTemplateEmails][{{ loop.index0 }}][id]"
                                            id="letterTemplate_letterTemplateEmail_{{ loop.index0 }}_id"
                                            class="letterTemplate_letterTemplateEmail_id hidden-cc-{{ loop.index0 }}">
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>

                <div class="large-12 columns" style="margin-top: 20px;">
                    {{ form_label(form.emailBody) }}
                </div>
                <div class="large-12 columns">
                    {{ form_widget(form.emailBody) }}
                </div>
            </div>

            <div class="large-12 columns">
                <hr>
                <div class="row">
                    <div class="large-6 columns" style="font-size: 12px; margin-top: 20px;">
                        <strong>Patient Letter Notes:</strong>
                        <div>{{ '{{PATIENT-LASTNAME}}' }} - Patient Last Name</div>
                        <div>{{ '{{PATIENT-FIRSTNAME}}' }} - Patient First Name</div>
                        <div>{{ '{{PATIENT-FULLNAME}}' }} - Patient Full Name</div>
                        <div>{{ '{{PATIENT-GENDER}}' }} - Patient Gender (he / she)</div>
                        <div>{{ '{{PATIENT-GENDER2}}' }} - Patient Gender (him / her)</div>
                        <div>{{ '{{PATIENT-GENDER3}}' }} - Patient Gender (his / her)</div>
                        <div>{{ '{{PATIENT-GENDER4}}' }} - Patient Gender (He / She)</div>
                        <div>{{ '{{PATIENT-ADDRESS}}' }} - Patient's Address</div>
                        <div>{{ '{{PATIENT-PHONE}}' }} - Patient's Phone No.</div>
                        <div>{{ '{{PATIENT-REFERRING-PHYSICIAN}}' }} - Patient's Referring Physician</div>
                        <div>{{ '{{PATIENT-REFERRING-PHYSICIAN-PHONE-NO}}' }} - Patient's Referring Physician Phone No.</div>
                        <div>{{ '{{PATIENT-REFERRING-PHYSICIAN-FAX-NO}}' }} - Patient's Referring Physician Fax No.</div>
                        <div>{{ '{{PATIENT-REFERRING-AFFILIATE}}' }} - Patient's Referring Affiliate</div>
                        <div>{{ '{{PATIENT-REFERRING-AFFILIATE-PHONE-NO}}' }} - Patient's Referring Affiliate Phone No.</div>
                        <div>{{ '{{PATIENT-REFERRING-AFFILIATE-FAX-NO}}' }} - Patient's Referring Affiliate Fax No.</div>
                        <div>{{ '{{PATIENT-PHN}}' }} - Patient Personal Health No.</div>
                        <div>{{ '{{PATIENT-DOB}}' }} - Patient Date of Birth</div>
                        <div>{{ '{{RECEVIER-FULLNAME}}' }} - Receiver Full Name</div>
                        <div>{{ '{{USERDATA-FULLNAME}}' }} - User Full Name</div>
                        <div>{{ '{{DATE-TODAY}}' }} - Date Today</div>
                        <div>{{ '{{DATE-CREATED}}' }} - Date Created</div>
                    </div>
                    <div class="large-6 columns" style="font-size: 12px; margin-top: 20px;">
                        <strong>Email Notes:</strong>
                        <div>{{ '{{PATIENT-REFERRING-PHYSICIAN}}' }} - Referring Physician</div>
                        <div>{{ '{{PATIENT-REFERRING-AFFILIATE}}' }} - Referring Affiliate</div>
                        <div>{{ '{{PATIENT-REFERRAL-DATE}}' }} - Referral Date</div>
                        <div>{{ '{{PATIENT-RECEIVED-DATE}}' }} - Received Date</div>
                        <div>{{ '{{PATIENT-FIRSTNAME}}' }} - Patient First Name</div>
                        <div>{{ '{{PATIENT-FULLNAME}}' }} - Patient Full Name</div>
                        <div>{{ '{{PATIENT-GENDER}}' }} - Patient Gender (he / she)</div>
                        <div>{{ '{{PATIENT-GENDER2}}' }} - Patient Gender (him / her)</div>
                        <div>{{ '{{PATIENT-GENDER3}}' }} - Patient Gender (his / her)</div>
                        <div>{{ '{{PATIENT-GENDER4}}' }} - Patient Gender (He / She)</div>
                        <div>{{ '{{PATIENT-PHN}}' }} - Patient Personal Health No.</div>
                        <div>{{ '{{PATIENT-DOB}}' }} - Patient Date of Birth</div>
                        <div>{{ '{{DATE-TODAY}}' }} - Date Today</div>
                        <div>{{ '{{DATE-CREATED}}' }} - Date Created</div>
                    </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 Letter Template 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('letter_template') }}" 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[
        jQ(document).ready(function(){
            letterTemplate_form.settings.company_autocomplete_url = '{{ path('company_autocomplete') }}';
            letterTemplate_form.init();
        });
        //]]>
    </script>
{% endblock %}