<style>
    .order-list-detail tbody tr th, .order-list-detail tbody tr td {
        border-top: none;
        padding: 0px 8px;
        vertical-align: middle;
        
    }
    .order-list-detail tbody tr th{
        font-size: 17px ;
    }
    .order-list-detail tbody tr th span {
        font-size: 13px ;
        font-weight: normal;
    }
    .order-data {
        cursor: pointer;
    }
    .order-list-detail.table {
        margin-top: 22px;
        margin-bottom: 0px;
        
        float: left;
        width: 50%;
    }
    label{
        position: relative;
        cursor: pointer;
        color: #666;
        font-size: 26px;
    }
    .label-text {
        font-size: 16px;
    }
    .label-text:before{
        font-size: 26px;
    }
    input[type="checkbox"], input[type="radio"]{
        position: absolute;
        right: 9000px;
    }

    /*Check box*/
    input[type="checkbox"] + .label-text:before{
        content: "\f096";
        font-family: "FontAwesome";
        speak: none;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        -webkit-font-smoothing:antialiased;
        width: 1em;
        display: inline-block;
        margin-right: 5px;
    }

    input[type="checkbox"]:checked + .label-text:before{
        content: "\f14a";
        color: #2980b9;
        animation: effect 250ms ease-in;
    }

    input[type="checkbox"]:disabled + .label-text{
        color: #aaa;
    }

    input[type="checkbox"]:disabled + .label-text:before{
        content: "\f0c8";
        color: #ccc;
    }

    /*Radio box*/

    input[type="radio"] + .label-text:before{
        content: "\f10c";
        font-family: "FontAwesome";
        speak: none;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        -webkit-font-smoothing:antialiased;
        width: 1em;
        display: inline-block;
        margin-right: 5px;
    }

    input[type="radio"]:checked + .label-text:before{
        content: "\f192";
        color: #8e44ad;
        animation: effect 250ms ease-in;
    }

    input[type="radio"]:disabled + .label-text{
        color: #aaa;
    }

    input[type="radio"]:disabled + .label-text:before{
        content: "\f111";
        color: #ccc;
    }

    /*Radio Toggle*/

    .toggle input[type="radio"] + .label-text:before{
        content: "\f204";
        font-family: "FontAwesome";
        speak: none;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        -webkit-font-smoothing:antialiased;
        width: 1em;
        display: inline-block;
        margin-right: 10px;
    }

    .toggle input[type="radio"]:checked + .label-text:before{
        content: "\f205";
        color: #16a085;
        animation: effect 250ms ease-in;
    }

    .toggle input[type="radio"]:disabled + .label-text{
        color: #aaa;
    }

    .toggle input[type="radio"]:disabled + .label-text:before{
        content: "\f204";
        color: #ccc;
    }


    @keyframes effect{
        0%{transform: scale(0);}
        25%{transform: scale(1.3);}
        75%{transform: scale(1.4);}
        100%{transform: scale(1);}
    }
    .direct-link {
        cursor: pointer;
        text-align: right;
        vertical-align: middle;
        font-size: 38px;
        height: 84px;
        border-left: 1px solid lightgrey;
        width: 5%;
        color: lightgrey;
    }
    .direct-link:hover {
        background-color: lightgrey;
        color: white;
    }
    .direct-link i {
        padding-top: 22px;
    }
    .order-data {
        width: 95%;
    }
    .package-item.tile-stats:hover {
        background-color: whitesmoke;
    }
    .package-item.tile-stats {
        padding-bottom: 0px;
    }
    .check-all {
        margin-left: 8px;
    }
    .order-list-detail.table1 th{
        width: 45%;
    }
    .order-list-detail.table1 th:first-child{
        width: 10%;
    }
    .order-list-detail.table2 th{
        width: 45%;
    }
    .empty-orders {
        text-align: center;
        font-weight: bolder;
        font-size: 35px;
        color: lightgrey;
        margin-top: 150px;
    }
    .dismis-popover {
        float: right;
        cursor: pointer;
        font-size: 18px;
        color: lightgrey;
    }
    .dismis-popover:hover {
        color: grey;
    }
    @media only screen and (max-width: 600px) {
        .order-list-detail.table {
            width: 100%;
        }
        .order-data table:last-child {
            margin-left: 18%;
            width: 82%;
            margin-top: 0px;
        }
        .order-data {
            width: 90%;
        }
        .direct-link {
            width: 10%;
            height: 155px;
        }

        .direct-link i {
            padding-top: 56px;
        }
    }
</style>
<?php if(!isset($this->uri["page"]) || $this->uri["page"] == "0"): ?>
        <div >
            <label class="check-all form-check">
                <input type="checkbox" name="check"> <span class="label-text">Označit vše</span>
            </label>
            <?php if($settings["settings"]["order_max_count"] and $settings["settings"]["order_max_count"] > 0): ?>
            <label class="check-all form-check" style="margin-left: 20px"  data-max_value="<?=$settings["settings"]["order_max_count"]?>">
                <input type="checkbox" name="check_max"> <span class="label-text">Označit <?=$settings["settings"]["order_max_count"]?> obj. <?php if($settings["settings"]["order_max_weight"]) echo " nebo max ".$settings["settings"]["order_max_weight"]." kg"; ?></span>
            </label>
            <?php endif ?>
            <?=anchor('package/list/eshop_id/'.$this->uri['eshop_id']."/unselect_all/1",'Zrušit balení všech objednávek' , 'class="btn btn-xs btn-default" style="position: absolute; right: 0px; top: 20px;"')?>
        </div>
<?php endif; ?>
<?php if(empty($orders)): ?>
    <?php if(!isset($this->uri["page"]) || $this->uri["page"] == "0"): ?>
        <div class="col-md-8 col-md-offset-2 empty-orders">
            Nebyly nalezeny žádné objednávky
            <?php if(isset($package_filter)):?>
            <br>
            <?=anchor('package/list/eshop_id/'.$this->uri['eshop_id']."/unset_filters/1",'Zrušit filtry' , 'class="btn btn-sm btn-default"')?>
            <?php endif; ?>
        </div>
    <?php endif; ?>

<?php else: ?>
    <?php foreach ($orders as $o): 
        $total_weight = $this->package_model->get_order_weight($o);

        ?>
    <div class="package-item tile-stats row" 

            >
        <div class="col-md-11 order-data">

        <table class=" table order-list-detail table1">
            <tr><th>
                    <div class="form-check">
                        <label>
                            <?php if($o["package_selected"] != 0 && $o["package_selected"] != $this->client_model->current["client_id"]): 
                            $packaging_client = $this->client_model->get_client(["client_id" => $o["package_selected"]]); //TODO: udelat lepe (tohle je jen pro reshoper)
                            ?>
                            <input type="checkbox" name="check" data-package_num="<?=$o["package_selected_number"]?>" data-code="<?=$o["order_code"]?>" <?php if($o["package_selected"] == $this->client_model->current["client_id"]) echo "checked"; elseif($o["package_selected"] > 0) echo "disabled"; ?> data-packaging-name="<?=$packaging_client["client_name"] ?>" data-total-weight="<?=$total_weight?>"> 
                            <?php else: ?>
                            <input type="checkbox"  data-total-weight="<?=$total_weight?>" name="check" data-package_num="<?=$o["package_selected_number"]?>" data-code="<?=$o["order_code"]?>" <?php if($o["package_selected"] == $this->client_model->current["client_id"]) echo "checked"; elseif($o["package_selected"] > 0) echo "disabled";?>> 
                            <?php endif; ?>
                            <span class="label-text"></span>
                        </label>
                    </div>

                </th>
                <th class="order-number-th">
                    <?=$o["order_code"]?>
                    <?php if($o["package_packed_date"] !== NULL): ?>
                        <br>
                        <span style="color:#FF6666;"><strong>ZABALENO</strong> <?=$o["package_packed_date"]?></span>
                    <?php endif; ?>
                    <?php if($o["package_selected"] != 0 && $o["package_selected"] != $this->client_model->current["client_id"]): ?>
                    <br>
                    <span style="color:#FF6666;">Právě balí: <strong><?=$packaging_client["client_name"]?></strong></span>
                    <?php endif; ?>
                </th>
                <th ><?=$eshop_translate["statuses"][$o["order_status_id"]]?></th>
            </tr>
            <tr><td></td><td></td></tr>
        </table>
        <table class=" table order-list-detail table2">
            <tr>
                <th ><?=(isset($eshop_translate["shippings"][$o["shipping_guid"]]))?$eshop_translate["shippings"][$o["shipping_guid"]]:"<i>Neznámý typ dopravy</i>"?></th>
    
                <th>
                    <?=(isset($eshop_translate["payments"][$o["billing_guid"]]))?$eshop_translate["payments"][$o["billing_guid"]]:"<i>Neznámý typ platby</i>"?>
                    <br>
                    <span><?=($o["order_paid"]=="1")?"Zaplaceno":"Nezaplaceno"?></span>
                </th>
                <th><?=$total_weight?> kg</th>
            </tr>
            <!--<tr><td></td><td><?=($o["order_paid"]=="1")?"Zaplaceno":"Nezaplaceno"?></td></tr>-->
        </table>
        </div>
        <a href="<?=base_url("package/packaging/eshop_id/".$this->uri['eshop_id']."/order/".$o["order_code"]) ?>" title="Přejít rovnou k balení objednávky" class="col-md-1 direct-link">
            <i class="fa fa-angle-right"></i>
        </a>
    </div>
    <?php endforeach; ?>
<?php endif; ?>
<?php if(!isset($this->uri["page"]) || $this->uri["page"] == "0"): ?>
    
    <?php endif;?>