<div class="max_width">
    <?php if($sf_user->isAuthenticated()){ ?>
        <div class="top_menu">
            <ul class="top_menu__ul">
                <li class="top_menu__li <?php echo ($sf_user->isAuthenticated() ? 'active' : '');?>" data-tab="0">Личный кабинет</li>
                <li class="top_menu__li <?php echo (!$sf_user->isAuthenticated() ? 'active' : '');?>" data-tab="1">Новая заявка</li>
            </ul>
        </div>
    <?php } ?>
    <div class="tabs_container">
        <div class="tabs_container__item <?php echo ($sf_user->isAuthenticated() ? 'active' : '');?> bid_export" data-tab="0">
            <?php if($sf_user->isAuthenticated()){
                $account = $sf_user->getAccount();
            ?>
                <div class="personal_data">
                    <div class="personal_data__wrap">
                        <div class="personal_data__name personal_data__item">
                            <span><?php echo $account->getName();?></span>
                        </div>
                        <div class="personal_data__balance personal_data__item">
                            <div class="balance_title">Ваш счет</div>
                            <div class="balance_total balance_content_main">
                                <span>Всего заработано:</span><span class="balance_content_r"><?php echo $balance;?> ₽</span>
                            </div>
<!--                            <div class="balance_remains balance_content_main">-->
<!--                                <span>Невыведено:</span><span class="balance_content_r">1000</span>-->
<!--                            </div>-->
<!--                            <div class="balance_take">Вывести</div>-->
                        </div>
                        <div class="personal_data__text personal_data__item">
                            <?php echo csSettings::get('text_personal');?>
                        </div>
                        <div class="personal_data__profile personal_data__item">
                            <div class="personal_data__profile_phone"><?php echo Page::maskPhone($account->getPhone());?></div>
                            <div class="personal_data__profile_mail"><?php echo $account->getEmail();?></div>
                            <div class="personal_data__profile_address"><?php echo $account->getAddress();?></div>
                            <span>
                                 <button class="btn btn_signup white_btn" onclick="popup.open('open_profile');">Изменить данные</button>
                            </span>
                        </div>
                    </div>
                </div>
            <?php } ?>
            <div class="personal_bids">
                <div class="personal_bids__title">Мое вторсырье</div>
                <?php if(count($exports) > 0) {
                    $key_wait = '';
                    $key_bid = '';
                    $c = 1;
                    foreach ($exports as $key_e => $export){
                        if($export['logic_type'] == 'wait'){
                            $key_wait = $c;
                        }
                        if($export['logic_type'] != 'wait'){
                            $key_bid = $c;
                        }
                        $c++;
                    }
                    ?>
                    <table class="statistic_content__table" width="100%" cellspacing="0" cellpadding="0">
                        <thead>
                        <tr>
                            <th width="31%">Категория</th>
                            <th width="13%">Собрано (кг)</th>
                            <th width="13%">Дособрать (кг)</th>
                            <th width="13%">Сумма ₽</th>
                            <th width="29%"></th>
                            <th width="1%"></th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php
                        $k = 1;
                        foreach ($exports as $key_ex => $export){
                            $remains = $export['cat_min_weight'] - $export['weight'];
                            ?>
                            <tr id="export_<?php echo $export['id']; ?>" data-id="<?php echo $export['id']; ?>" data-cat_id="<?php echo $export['cat_id']; ?>" data-price="<?php echo $export['cat_price']; ?>" data-min_weight="<?php echo $export['cat_min_weight']; ?>">
                                <td width="31%"><?php echo $export['cat_title']; ?></td>
                                <td width="13%"><input class="tb_weight_inp numeric_td" autocomplete="off" name="tb_weight_<?php echo $export['id']; ?>" id="tb_weight_<?php echo $export['id']; ?>" value="<?php echo Yavinesu::weightFormat($export['weight']); ?>"></td>
                                <td class="numeric_td remains_td" width="13%"><?php echo ($remains > 0 ? Yavinesu::weightFormat($remains) : 0); ?></td>
                                <td class="numeric_td price_td" width="13%"><?php echo Yavinesu::priceFormat($export['sum']); ?></td>
                                <td class="btn_td" width="29%">
                                    <?php if($export['logic_type'] == 'wait'){ ?>
                                        <button class="btn btn_signup btn_weight_collect <?php echo $remains > 0 ? 'disabled' : '';?>" <?php echo $remains > 0 ? 'disabled="disabled"' : '';?> >Собрано</button>
                                    <?php } else {
                                        echo 'Заявка отправлена';
                                    } ?>
                                </td>
                                <td class="remove_bid_td"width="1%"><?php echo ($export['logic_type'] == 'wait' ? '<span class="remove_bid" title="Удалить"></span>' : '');?></td>
                            </tr>
                        <?php
                            $text_less_weight = trim(csSettings::get('text_less_weight'));
                            if($key_wait != '' && $key_wait == $k) {
                                echo '<tr>';
                                echo '<td class="info_text_td" colspan="6">';
                                echo csSettings::get('text_less_weight');
                                echo '</td>';
                                echo '</tr>';
                            }
                            $text_more_weight = trim(csSettings::get('text_more_weight'));
                            if($key_bid != '' && $key_bid == $k){
                                echo '<tr>';
                                echo '<td class="info_text_td" colspan="6">';
                                echo csSettings::get('text_more_weight');
                                echo '</td>';
                                echo '</tr>';
                            }
                            $k++;
                        } ?>
                        </tbody>
                    </table>
                <?php }
                if(trim(csSettings::get('text_info_bottom')) != ''){
                ?>
                    <div class="info_text_body"><?php echo csSettings::get('text_info_bottom');?></div>
                <?php }?>
            </div>
        </div>
        <div class="tabs_container__item <?php echo (!$sf_user->isAuthenticated() ? 'active' : '');?> new_bid_export" data-tab="1">
            <div class="new_bid_export__cats">
                <div class="new_bid_export__title">Сколько у вас сырья?</div>
                <?php if(count($cats)){ ?>
                    <select class="cats_sel cats_item" name="cats" id="cats">
                        <?php foreach($cats as $key => $cat){
                            echo '<option value="' . $cat['id'] . '" ' . ($key == 0 ? 'selected="selected"' : '') . '  data-min_weight="' . $cat['min_weight'] . '" data-price="' . $cat['price'] . '">' . $cat['title'] . '</option>';
                        } ?>
                    </select>
                    <div class="cats_item cats_item__weight">
                        <input class="weight_inp" autocomplete="off" name="weight" id="weight" placeholder="Укажите вес">
                        <span class="weight_sp">кг</span>
                    </div>
<!--                    <div class="cats_item cats_item__remains">-->
<!--                        <span class="cats_item__remains_title">Осталось собрать</span><span class="cats_item__remains_value">0</span> кг-->
<!--                    </div>-->
<!--                    <div class="cats_item cats_item__sum">-->
<!--                        <span class="cats_item__sum_title">Сумма</span><span class="cats_item__sum_value">0</span> ₽-->
<!--                    </div>-->
                    <div class="cats_item cats_item__wait_weight ">
                        <div class="wait_weight_msg" data-temp="<?php echo csSettings::get('text_will_wait');?>"></div>
                        <?php if(!$sf_user->isAuthenticated()) {?>
<!--                            <a href="--><?php //echo url_for('@signup');?><!--" class="btn btn_signup">Буду копить</a>-->
                            <span class="btn btn_signup" onclick="popup.open('signup_form');return false;">Буду копить</span>
                        <?php } else { ?>
                            <span class="btn btn_signup btn_add_bid">Добавить заявку</span>
                        <?php } ?>
                        <span class="btn btn_signup white_btn btn_cancel">Отменить</span>
                    </div>
                <?php } ?>
            </div>
        </div>
    </div>

</div>