HaaseIT/HCSF

View on GitHub
src/views/customer/customerform.twig

Summary

Maintainability
Test Coverage
{% if customdata.customerform.errormessage|length != 0 %}
    <div class="pure-u-1">
        <div id="customerform-errortext">
            {% for error, errorstate in customdata.customerform.errormessage %}
                {{T("adrform_error_"~error)}}<br>
            {% endfor %}
        </div>
    </div>
{% endif %}

{% if customdata.customerform.purpose != 'shopadmin' %}
<form action="{{requesturi}}" name="customerform" id="customerform" method="POST" class="pure-form pure-form-aligned">
    {% if customdata.customerform.purpose == 'shoppingcart' %}
        <input type="hidden" name="doCheckout" value="yes">
        <div id="customerform-address-header">{{ T("adrform_headline_shoppingcart") }}</div>
    {% elseif customdata.customerform.purpose == 'register' %}
        <input type="hidden" name="doRegister" value="yes">
    {% elseif customdata.customerform.purpose == 'admin' or customdata.customerform.purpose == 'editprofile' %}
        <input type="hidden" name="doEdit" value="yes">
    {% endif %}
    <script language="JavaScript">
        $(document).ready(function() {
            $(".customerformfield").change(function() {
                $.post("/fs.php", $("#customerform").serialize());
            });
            {% if customdata.customerform.purpose == 'shoppingcart' %}
            $("#addrform-country").change(function() {
                $.ajax({
                    type: "POST",
                    url: "/_misc/updateshippingcost.html",
                    data: $("#addrform-country").serialize(),
                    success : function( resp ) {
                        $('#shcshippingvalue').html($('#shippingcostbrutto_new' , resp).html() + ' {{ currency }}');
                        $('#shcvatfullvalue').html($('#vatfull_new' , resp).html() + ' {{ currency }}');
                        $('#shcbruttovalue').html($('#totalbrutto_new' , resp).html() + ' {{ currency }}');
                    }
                });
            });
            {% endif %}
        });
    </script>
    {% endif %}


    {% include 'customer/customerform-adrform.twig' %}{%
    if customdata.customerform.purpose == 'shoppingcart'
    %}<div class="pure-u-1 pure-u-md-2-5">
        {% set paymentmethodcount = customdata.customerform.fv_paymentmethods|length %}
        {% set paymentmethodloopfirst = true %}
        <div id="customerform-paymeht-wrapper">
            <div id="customerform-payment-header" for="zahlungsmethode" id="label-zahlung" class="required">
                {{T("adrform_paymentmethod")}}
            </div>

            {% for paymentmethod in customdata.customerform.fv_paymentmethods %}
            <div class="pure-controls customerform-payment">
                <label for="addrform-paymentmethod-{{paymentmethod}}" class="{{ customdata.customerform.errormessage.paymentmethod is defined ? ' formerror' : '' }}">
                    <input class="col-md-1 col-xs-1" type="radio" name="paymentmethod"
                           id="addrform-paymentmethod-{{paymentmethod}}"
                           value="{{paymentmethod}}"{{ paymentmethodcount == 1 or paymentmethod == customdata.customerform.fv_paymentmethod ? ' checked' : '' }}>
                    {{T("order_paymentmethod_" ~ paymentmethod)}}
                </label>
                {% set paymentmethodloopfirst = false %}
            </div>
            {% endfor %}

            <br class="clear">
        </div>
        {% endif %}

        {% if customdata.customerform.purpose == 'shoppingcart' or customdata.customerform.purpose == 'register' %}
        {% if not isloggedin %}
        <div id="customerform-tos-wrapper">
            <div class="pure-controls">
                <label{{ customdata.customerform.errormessage.tos is defined ? ' class=" formerror"' : '' }} id="label-agbs" for="addrform-tos">
                <input type="checkbox" name="tos" id="addrform-tos" value="y"{{ customdata.customerform.fv_tos ? ' checked' : '' }}>
                    {{T("adrform_tos")}}</label>
            </div>

            <div class="pure-controls">
                <label{{ customdata.customerform.errormessage.cancellationdisclaimer is defined ? ' class=" formerror"' : '' }} id="label-widerruf" for="addrform-cancellationdisclaimer">
                <input type="checkbox" name="cancellationdisclaimer" id="addrform-cancellationdisclaimer" value="y"{{ customdata.customerform.fv_cancellationdisclaimer ? ' checked' : '' }}>
                    {{T("adrform_cancellationdisclaimer")}}</label>
            </div>
        </div>
        {% endif %}
        {% endif %}

        {% if customdata.customerform.purpose == 'admin' %}
        <div id="customerform-admstate-wrapper">
            <div class="pure-controls">
                <label for="addrform-active">
                <input type="checkbox" name="active" id="addrform-active" value="y"{{ customdata.customerform.fv_active ? ' checked' : '' }}>
                    Aktiv</label>
            </div>
            <div class="pure-controls">
                <label for="addrform-emailverified">
                <input type="checkbox" name="emailverified" id="addrform-emailverified" value="y"{{ customdata.customerform.fv_emailverified ? ' checked' : '' }}>
                    E-Mail bestÃĪtigt</label>
            </div>
        </div>
        {% endif %}

        {% if customdata.customerform.purpose != 'shopadmin' and customdata.customerform.purpose != 'userhome' %}
            {% if customdata.customerform.purpose == 'shoppingcart' %}
                {% set customerform_submitstring = T("adrform_submit_shoppingcart") %}
            {% elseif customdata.customerform.purpose == 'register' %}
                {% set customerform_submitstring = T("adrform_submit_register") %}
            {% elseif customdata.customerform.purpose == 'editprofile' or customdata.customerform.purpose == 'admin' %}
                {% set customerform_submitstring = T("adrform_submit_editprofile") %}
            {% endif %}
            <div id="customerform-submit-wrapper"><button type="submit" class="pure-button pure-button-primary pure-u-1" id="customerform-submit" >{{customerform_submitstring}}</button></div>
        {% endif %}
    </div>
    {% if not customdata.customerform.readonly or customdata.customerform.purpose == 'admin' %}
        * {{T("adrform_requiredfield")}}<br><br>
    {% endif %}
    {% if customdata.customerform.purpose != 'shopadmin' %}
</form>
{% endif %}

{{customdata.customerform.html}}