<?php
global $user;
/*if ($user->accesslevel > 1) {
    $filter = ['companySales' => $user->id];
    $result = $auth->getApiDataFilter("get/partner", $filter);
} else {
    $result = $auth->getApiData("get/partner");
}*/
if (!isset($result->errorcode)) {
    //print_r($result);
?>
    <table id="partner" class="table dataTable" role="grid" style="width: 100%;">

    </table>
    <?php if(false):?>
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">Partnerek</h3>

            <div class="card-tools">
                <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                    <i class="fas fa-minus"></i>
                </button>
                <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                    <i class="fas fa-times"></i>
                </button>
            </div>
        </div>
        <div class="card-body table-responsive p-0">
            <table class="table table-hover text-nowrap projects" style="font-size:10px">
                <thead>
                    <tr>
                        <th>
                            Adószám
                        </th>
                        <th style="max-width:300px">
                            Partner neve
                        </th>
                        <th>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    //print_r($result);
                    foreach ($result as $partner) :
                    ?>
                        <tr>
                            <td>
                                <?php echo $partner->companyVat; ?>
                            </td>
                            <td style="max-width:300px">
                                <a style="max-width:300px">
                                    <?php echo $partner->companyName; ?>
                                </a>
                                <br>
                                <small>
                                    <?php if (isset($partner->createdDate)) {

                                        echo convertToDate($partner->createdDate);
                                    } ?>
                                </small>
                            </td>
                            <td class="project-actions text-right">
                                <a class="btn btn-primary btn-sm" href="<?php echo SITEURL ?>/partners/partner/view?id=<?php echo $partner->id ?>">
                                    <i class="fas fa-folder">
                                    </i>
                                    Nézet
                                </a>
                                <a class="btn btn-info btn-sm" href="<?php echo SITEURL ?>/partners/partner/edit?id=<?php echo $partner->id ?>">
                                    <i class="fas fa-pencil-alt">
                                    </i>
                                    Szerkesztés
                                </a>
                            </td>
                        </tr>
                    <?php
                    endforeach;
                    ?>
                </tbody>
            </table>
        </div>
        <!-- /.card-body -->
    </div>
    <?php endif; ?>
<?php
    addJS("partner.js?1.02");
}
?>
