{% extends "django_documentos/base.html" %}


{% block css_app %}
    <style>
        body {
            background: rgb(204, 204, 204);
        }

        article {
            background: white;
            width: 21cm;
        {#            height: 29.7cm;#} display: block;
            margin: 0 auto 0.5cm;
            box-shadow: 0 0 0.5cm rgba(0, 0, 0, 0.5);

            padding: 30px;
        {#            font-size: 11pt;#}{#            font-family: Arial;#}
            text-justify: distribute;
            line-height: 22pt;
        }

        @media print {
            body, article[size="A4"] {
                margin: 0;
                box-shadow: 0;
                background: transparent;
            }

        }

        .no-print {
            display: block;
        }

        @media print {
            .cke_pagebreak {
                display: block;
                page-break-before: always;
            }
        }
    </style>
{% endblock css_app %}



{% block titulo %}
    Detalhes Documento
{% endblock titulo %}

<article>

    {% block conteudo_app %}

    {% endblock conteudo_app %}
</article>

{% block js_app %}
    {{ block.super }}
    {% if form.media %}
        {{ form.media }}
    {% endif %}
    <script>
/**
 * PasteHopAcross jquery plugin
 * Paste across multiple inputs plugin,
 * inspired by http://jsfiddle.net/D7jVR/
 */
(function ($) {
    jQuery.fn.pastehopacross = function(opts){
       if (!opts){ opts = {} }
        if (!opts.regexRemove){
            opts.regexRemove = false;
        }
        if (!opts.inputs){
           opts.inputs = [];
        }
        if (opts.inputs.length == 0){
            //return
            return $(this);
        }

        if (!opts.first_maxlength){
            opts.first_maxlength = $(this).attr('maxlength');
            if (!opts.first_maxlength){
                return $(this);
            }
        }

       $(this).on('paste', function(){

           //remove maxlength attribute
           $(this).removeAttr('maxlength');
           $(this).one("input.fromPaste", function(){
               var $firstBox = $(this);

                var pastedValue = $(this).val();
                if (opts.regexRemove){
                     pastedValue = pastedValue.replace(opts.regexRemove, "");
                }

                var str_pv = pastedValue;
                $(opts.inputs).each(function(){
                    var pv = str_pv.split('');
                    var maxlength;
                    if ($firstBox.get(0) == this){
                       maxlength = opts.first_maxlength;
                    }else{
                       maxlength = $(this).attr('maxlength');
                    }
                    if (maxlength == undefined){
                        //paste them all!
                        maxlength = pv.length;
                    }
                    //clear the value
                    $(this).val('');
                    var nwval = '';
                    for (var i = 0; i < maxlength; ++i){
                        if (typeof(pv[i]) != 'undefined'){
                           nwval += pv[i];
                        }
                    }
                    $(this).val(nwval);
                    //remove everything from earlier
                    str_pv = str_pv.substring(maxlength);
                });

                //restore maxlength attribute
                $(this).attr('maxlength', opts.first_maxlength);
            });

       });

       return $(this);
    }
})(jQuery);

    </script>
{% endblock %}