<?php

/* VGMWOBundle:WorkOrder:consulting_index.html.twig */
class __TwigTemplate_f82b2393338960b247d00302245d438a0f1f3312a37f20ec2dba757c565a3b4a extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        // line 1
        $this->parent = $this->loadTemplate("VGMWOBundle::layout.html.twig", "VGMWOBundle:WorkOrder:consulting_index.html.twig", 1);
        $this->blocks = array(
            'stylesheets' => array($this, 'block_stylesheets'),
            'content' => array($this, 'block_content'),
            'javascripts' => array($this, 'block_javascripts'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "VGMWOBundle::layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 2
    public function block_stylesheets($context, array $blocks = array())
    {
        // line 3
        echo "    ";
        $this->displayParentBlock("stylesheets", $context, $blocks);
        echo "
    <link href=\"";
        // line 4
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/vgmwo/css/bootstrap-datetimepicker.css"), "html", null, true);
        echo "\" rel=\"stylesheet\" media=\"screen\">
    <link href=\"";
        // line 5
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/vgmwo/css/waitMe.css"), "html", null, true);
        echo "\" rel=\"stylesheet\" media=\"screen\">
    <link href=\"https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css\" rel=\"stylesheet\" media=\"screen\">
    <link href=\"https://cdn.datatables.net/buttons/1.0.3/css/buttons.dataTables.min.css\" rel=\"stylesheet\" media=\"screen\">
    <style>.dataTables_wrapper .ui-toolbar {padding: 0px !important;}.dataTables_filter {display: none;}div.DTTT_container {margin-left: 1em;}#workorders-list>tbody>tr{cursor: pointer;}
        table.dataTable thead th, table.dataTable thead td {padding: 5px;}table.dataTable tbody th, table.dataTable tbody td {padding: 5px;}
        table.dataTable thead .sorting {
            background-image: none;
        }
        table.dataTable thead .sorting_desc, table.dataTable thead .sorting_desc_disabled {
            background-image: url(\"";
        // line 14
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/vgmwo/images/sort_desc.png"), "html", null, true);
        echo "\");
            background-position: center bottom;
        }
        table.dataTable thead .sorting_asc, table.dataTable thead .sorting_asc_disabled {
            background-image: url(\"";
        // line 18
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/vgmwo/images/sort_asc.png"), "html", null, true);
        echo "\");
            background-position: center bottom;
        }
    </style>
";
    }

    // line 23
    public function block_content($context, array $blocks = array())
    {
        // line 24
        echo "    <div id=\"work_orders_list\" class=\"container\">
        <div id=\"leyend\" class=\"row\" style=\"text-align: center\">
            <label>Destination:</label>
            <span class=\"sale\" style=\"padding: 2px 5px;\">Sale</span>
            <span class=\"stock\" style=\"padding: 2px 5px;\">Stock</span>
            <span class=\"rent\" style=\"padding: 2px 5px;\">Rent</span>
            <span class=\"repair\" style=\"padding: 2px 5px;\">Repair</span>
            <span class=\"warranty\" style=\"padding: 2px 5px;\">Warranty</span>
            <span style=\"padding: 2px 5px;\">Other</span>
        </div>
        <div class=\"row\">
            <div class=\"pull-left\" style=\"font-size: 3vmin;\" id=\"workorders-title-add\">
                <strong>Work Orders</strong></div>
            <div class=\"form-inline pull-right\">
                <div class=\"form-group\">
                    <label class=\"sr-only\" for=\"client-type-selection\">Client</label>
                    <select id=\"client-type-selection\" class=\"form-control\" placeholder=\"Client type\">
                        <option value=\"0\">< All Clients ></option>
                        <option value=\"1\">Internal</option>
                        <option value=\"2\">External</option>
                    </select>
                </div>
                <div class=\"form-group\">
                    <label class=\"sr-only\" for=\"datatable-searchbox\">Search</label>
                    <input class=\"form-control for-desktop\" id=\"datatable-searchbox\" placeholder=\"Search\"/></div></div>
            <div class=\"pull-right\" style=\"padding: 0vw 0.5vw;\" id=\"table-buttons-div\"></div></div>
        <div class=\"table-responsive row\" style=\"padding-left: 0px; padding-right: 0px;\">
            <table class=\"table table-hover fixed-header display table-int-grid\" cellspacing=\"0\" id=\"workorders-list\" width=\"100%\">
                <thead>
                <tr style=\"background-color: #fff;\">
                    <!-- ID column -->
                    <th>ID</th>
                    <!-- Created column -->
                    <th class=\"col-xs-05\">Created</th>
                    <!-- Work Order column -->
                    <th class=\"col-xs-05\">WO/OT</th>
                    <!-- Stocks column -->
                    <th class=\"col-xs-05\">Stock</th>
                    <!-- Invoice Status column -->
                    <th style=\"width: 3%\">IS</th>
                    ";
        // line 64
        if ((($this->env->getExtension('security')->isGranted("ROLE_ADMIN") || $this->env->getExtension('security')->isGranted("ROLE_SUPER_SUPERVISOR")) || $this->env->getExtension('security')->isGranted("ROLE_ACCOUNTING"))) {
            // line 65
            echo "                        <!-- Invoice Value column -->
                        <th class=\"col-xs-05\">I. Value</th>
                    ";
        }
        // line 68
        echo "                    <!-- Equipment column -->
                    <th class=\"col-xs-05\">ID</th>
                    <!-- Make column -->
                    <th class=\"col-xs-1\">Make</th>
                    <!-- Model column -->
                    <th class=\"col-xs-1\">Model</th>
                    <!-- Sale Type column -->
                    <th class=\"col-xs-1\">Dest.</th>
                    <!-- Work Type column -->
                    ";
        // line 78
        echo "                        <th class=\"col-xs-1\">Condition</th>
                    ";
        // line 82
        echo "                    <!-- Supervisor column -->
                    <th class=\"col-xs-1\">Supervisor</th>
                    <!-- Status column -->
                    <th class=\"col-xs-1\">Status</th>
                    <!-- Client column -->
                    <th class=\"col-xs-2\">Client</th>
                    <!-- Delivery date column -->
                    <th style=\"white-space: nowrap;\">Due date</th>
                    <!-- Delivery date column -->
                    <th>Delivered</th>
                </tr>
                </thead></table></div>
    </div>
";
    }

    // line 96
    public function block_javascripts($context, array $blocks = array())
    {
        // line 97
        echo "    ";
        $this->displayParentBlock("javascripts", $context, $blocks);
        echo "
    <script type=\"text/javascript\" src=\"";
        // line 98
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/vgmwo/js/jquery/jquery.dataTables.min.js"), "html", null, true);
        echo "\"></script>
    <script type=\"text/javascript\" src=\"https://cdn.datatables.net/buttons/1.0.3/js/dataTables.buttons.min.js\"></script>
    <script type=\"text/javascript\" src=\"https://cdn.datatables.net/buttons/1.0.3/js/buttons.print.min.js\"></script>
    <script type=\"text/javascript\">
        function get_workorder_list_url(){return '";
        // line 102
        echo $this->env->getExtension('routing')->getPath("workorders_get_all_status");
        echo "';};
        var calcDataTableHeight = 0;
        var dt_config = {\"processing\": true,\"loading\": false,\"scrollCollapse\": true,
            \"paging\": false,
            \"scrollY\": function(){return (\$(window).height() - \$(\"nav.navbar-inverse.menu-bar\").height()) -  120;},
            \"responsive\": true,\"dom\": 'Bfrtip',
            \"buttons\": [{extend:'print',text:\"Print PreView\",autoPrint:false,exportOptions:{columns:':visible'},
                customize:function(win){\$(win.document.body).css( 'font-size', '10pt' );\$(win.document.body).css( 'height', '95vh' );\$(win.document.body).find( 'table' ).addClass( 'compact' ).css( 'font-size', 'inherit' );
                }},{extend:'print',text:\"Print\",exportOptions:{columns:':visible'},key:{key:80,ctrlKey: true},customize:function(win){\$(win.document.body).css( 'font-size', '10pt' );\$(win.document.body).css( 'height', '95vh' );
                \$(win.document.body).find( 'table' ).addClass( 'compact' ).css( 'font-size', 'inherit' );}},
                {text: \"Excel\",key:{key:'e',ctrlKey: true},action: function(){
                    \$.ajax({type:'post',async:true,dataType:'json',url: '";
        // line 113
        echo $this->env->getExtension('routing')->getPath("export_wol2excel");
        echo "',
                        data:{svalue:\$(\"#datatable-searchbox\").val(), status: 0},
                        success: function(response){window.location.assign(response.url);},
                        error:function() {alert(\"Error\");}});}}],
            \"aaSorting\": [[2,'desc']],
            \"info\": true,
            \"ajax\":{
                url: get_workorder_list_url(),
                type: \"POST\",
                data:{client_type: function () { return \$(\"#client-type-selection option:selected\").val(); }}
            },
            \"aoColumns\": [{\"bSortable\": false, \"visible\": false, \"searchable\": false},
                {\"type\" : \"usdate\", \"bSortable\": true, \"visible\": true},
                {\"type\" : \"ot-number\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true, \"searchable\": false},
                ";
        // line 129
        if ((($this->env->getExtension('security')->isGranted("ROLE_ADMIN") || $this->env->getExtension('security')->isGranted("ROLE_SUPER_SUPERVISOR")) || $this->env->getExtension('security')->isGranted("ROLE_ACCOUNTING"))) {
            // line 130
            echo "                    {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true, \"searchable\": false},
                ";
        }
        // line 132
        echo "                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": false, \"visible\": true},
                {\"sType\" : \"text\", \"bSortable\": true, \"visible\": true},
                {\"type\" : \"usdate\", \"bSortable\": true, \"visible\": true},
                {\"type\" : \"usdate\", \"bSortable\": true, \"visible\": true}],
            \"rowCallback\": function(nRow,aData,iDisplayIndex,iDisplayIndexFull){var dest_index = 8;
                ";
        // line 143
        if ((($this->env->getExtension('security')->isGranted("ROLE_ADMIN") || $this->env->getExtension('security')->isGranted("ROLE_SUPER_SUPERVISOR")) || $this->env->getExtension('security')->isGranted("ROLE_ACCOUNTING"))) {
            // line 144
            echo "                    dest_index = 9;
                ";
        }
        // line 146
        echo "                    switch(aData[dest_index]){
                case 'Rent':\$(nRow).addClass('rent');break;
                case 'Repair':\$(nRow).addClass('repair');break;
                case 'Warranty':\$(nRow).addClass('warranty');break;
                case 'Sale':\$(nRow).addClass('sale');break;
                case 'Stock':\$(nRow).addClass('stock');break;}}
        };
        \$(document).ready(function() {
            jQuery.extend(jQuery.fn.dataTableExt.oSort,{\"usdate-pre\":function(a){if(a==null||a==\"\"){return 0;}
                var usDatea=a.replace(' ','').split('/');return (usDatea[2]+usDatea[0]+usDatea[1]) * 1;},
                \"usdate-asc\":function(a,b){return ((a<b)?-1:((a>b)?1:0));},
                \"usdate-desc\":function(a,b){return ((a<b)?1:((a>b)?-1:0));},
                \"ot-number-asc\":function(a,b){
                    a = a.replace(' ','').split('-');
                    a = (a.length > 1 ? (a[1].length == 1? parseFloat(a[0] + \".0\" + a[1]) : parseFloat(a[0] + \".\" + a[1])) : parseFloat(a[0]));
                    b = b.replace(' ','').split('-');
                    b = (b.length > 1 ? (b[1].length == 1? parseFloat(b[0] + \".0\" + b[1]) : parseFloat(b[0] + \".\" + b[1])) : parseFloat(b[0]));
                    return ((a<b)?-1:((a>b)?1:0));
                },
                \"ot-number-desc\":function(a,b){
                    a = a.replace(' ','').split('-');
                    a = (a.length > 1 ? (a[1].length == 1? parseFloat(a[0] + \".0\" + a[1]) : parseFloat(a[0] + \".\" + a[1])) : parseFloat(a[0]));
                    b = b.replace(' ','').split('-');
                    b = (b.length > 1 ? (b[1].length == 1? parseFloat(b[0] + \".0\" + b[1]) : parseFloat(b[0] + \".\" + b[1])) : parseFloat(b[0]));
                    return (parseInt(a) == parseInt(b) ? ((a<b)?-1:((a>b)?1:0)) : ((a<b)?1:((a>b)?-1:0)));
                },
                \"text-asc\":function(a,b){return ((a<b)?-1:((a>b)?1:0));},
                \"text-desc\":function(a,b){return ((a<b)?1:((a>b)?-1:0));}});
            var calcDataTableHeight = function() {return (\$(window).height() - \$(\"nav.navbar-inverse.menu-bar\").height()) -  120;};
            var oTable = \$('#workorders-list').DataTable(dt_config);
            oTable.buttons( 0, null ).container().appendTo(\$(\"#table-buttons-div\"));
            \$('#workorders-list tbody').on( 'click', 'tr', function () {var id = oTable.row(\$(this)).data()[0];show_workorder(id);});
            \$(\"#datatable-searchbox\").on(\"keyup\",function(event){if(event.keyCode == 13 || this.value == \"\")oTable.search(this.value).draw();});
            \$(\"#client-type-selection\").on(\"change\",function(){oTable.ajax.reload();this.blur();});
            \$(document).bind(\"keyup keydown\", function(e){if(e.ctrlKey&&(e.keyCode==80||e.keyCode==69)){return false;}});
            \$(window).bind('resize',function(){\$(\".dataTables_scrollBody\").css('max-height',dt_config.scrollY()+'px');});
        });

        function show_workorder(id)
        {
            ";
        // line 186
        if ($this->env->getExtension('security')->isGranted("ROLE_ACCOUNTING")) {
            // line 187
            echo "                var url = '";
            echo $this->env->getExtension('routing')->getPath("workorders_show", array("id" => "id_val"));
            echo "';url = url.replace(\"id_val\", id);
                document.location = url;
            ";
        } else {
            // line 190
            echo "                var url = '";
            echo $this->env->getExtension('routing')->getPath("workorders_print_preview", array("id" => "id_val"));
            echo "';url = url.replace(\"id_val\", id);
                window.open(url, '_blank');
            ";
        }
        // line 193
        echo "        }
    </script>
";
    }

    public function getTemplateName()
    {
        return "VGMWOBundle:WorkOrder:consulting_index.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  284 => 193,  277 => 190,  270 => 187,  268 => 186,  226 => 146,  222 => 144,  220 => 143,  207 => 132,  203 => 130,  201 => 129,  182 => 113,  168 => 102,  161 => 98,  156 => 97,  153 => 96,  136 => 82,  133 => 78,  122 => 68,  117 => 65,  115 => 64,  73 => 24,  70 => 23,  61 => 18,  54 => 14,  42 => 5,  38 => 4,  33 => 3,  30 => 2,  11 => 1,);
    }
}
