<?php

use yii\helpers\Html;

?>

<?php if($output['models']) : ?>
    <div class="panel panel-default">
        <div class="panel-heading table-responsive">

            <table class="w100pr table_header">
                <tbody>
                    <tr>
                        <td>
                            <p class="panel-title2 pull-left">
                                <!-- <a href=""><span class="glyphicon glyphicon-align-justify"></span></a>&nbsp;&nbsp; -->
                                <strong><?=$title?></strong>&nbsp;&nbsp;
                            </p>
                        </td>
                        <td class="box_td">
                            <p><strong>Дата <br> поступления</strong></p>
                        </td>
                        <td class="box_td">
                            <p><strong>Срок <br> исполнения</strong></p>
                        </td>
                        <td class="box_td">
                            <p><strong>Стоимость <br> руб.</strong></p>
                        </td>
                    </tr>
                </tbody>
            </table>

        </div>
        <div id="collapse_1" class="panel-collapse collapse in">
            
            <?php foreach ($output['models'] as $model) : ?>
                <div class="panel-body panel-body-ex-1 color_on_cursor gray_box_2">
                    <table class="w100pr">
                        <tbody>
                            <tr>
                                <td class="box_td_fir">
                                    <!-- <div class="arrov_poz pull-left">
                                        <a href=""><span class="caret caret_top"></span></a>
                                        <a href=""><span class="caret"></span></a>
                                    </div> -->
                                    <span><?=$model['id']?></span>
                                </td>
                                <td class="box_td_cont">
                                    <p><strong><?=Html::a($model['subject'], ['/support/view/'.$model['id']])?></strong></p>
                                </td>
                                <td class="box_td">
                                    <span><?=date('d.m.Y', strtotime($model['created_on']))?></span>
                                </td>
                                <td class="box_td">
                                    <span><?=($model->due_date?date('d.m.Y', strtotime($model['due_date'])):'Не установлено')?></span>
                                </td>
                                <td class="box_td">

                                    <?php if(!$output['rating'] && $model['price_for_customer'] == 0) : ?>
                                        <p class="green_text align_right"><strong>Гарантия</strong></p>
                                    <?php else : ?>
                                        <p class="pull-left"><strong><?=($model['price_for_customer']!=0 ? Yii::$app->formatter->asCurrency($model['price_for_customer'], 'RUR', [], [\NumberFormatter::CURRENCY_SYMBOL => '₽']) : 'Не установлено')?></strong></p>
                                    <?php endif; ?>
                                    
                                    <!-- <div class="tooltip_wr pull-right">
                                        <div class="tooltip_box">Счет был выставлен</div>
                                        <span class="tooltip_cont"><img src="/images/score_icon.jpg" height="24" width="19" alt=""></span>
                                    </div> -->                                        
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            <?php endforeach; ?>

        </div>
    </div>
<?php endif; ?>