<?php 
include 'header.php'; 

$firmasor = $db->prepare("SELECT * FROM firma ORDER BY firma_sira ASC");
$firmasor->execute();
?>

<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
    <div class="row">
        <ol class="breadcrumb">
            <li><a href="#">
                <em class="fa fa-home"></em>
            </a></li>
            <li class="active">firma Ayarları</li>
        </ol>
    </div><!--/.row-->
    
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">firma Ayarları</h1>
        </div>
    </div><!--/.row-->

    <div class="row">
        <div class="col-md-15">
            <div class="panel panel-default articles">
                <div class="panel-heading">
                    firma Listesi
                    <?php
                    if (isset($_GET['durum'])) {
                        $durum = $_GET['durum'];
                        if ($durum == "ok") {
                            echo '<b style="color:green;">İşlem Başarılı</b>';
                        } elseif ($durum == "no") {
                            echo '<b style="color:red;">İşlem Başarısız</b>';
                        } 
                    } 
                    ?>
                </div>
                <div class="table-responsive m-b-60">
                    <table id="datatable-responsive" class="table table-bordered table-hover" cellspacing="0" width="100%">
                        <thead>
                            <tr>
                                <th>firma ID No</th>
                                <th>firma İsmi</th>
                                <th>firma Sırası</th>
                                <th>firma Durum</th>
                                <th>firma Düzenle</th>
                                <th>firma Sil</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
                            $say = 0;
                            while ($firmacek = $firmasor->fetch(PDO::FETCH_ASSOC)) { 
                                $say++; 
                            ?>
                            <tr>
                                <td><?php echo $say ?></td>
                                <td><?php echo $firmacek['firma_ad'] ?></td>
                                <td><?php echo $firmacek['firma_sira'] ?></td>
                                <td>
                                    <?php 
                                    if ($firmacek['firma_durum'] == 1) {
                                        echo '<button class="btn btn-success btn-xs"> Aktif </button>'; 
                                    } else {
                                        echo '<button class="btn btn-danger btn-xs"> Pasif </button>'; 
                                    }
                                    ?>
                                </td>
                                <td>
                                    <a href="firma-duzenle.php?firma_id=<?php echo $firmacek['firma_id']; ?>" class="btn btn-primary btn-xs">Düzenle</a>
                                </td>
                                <td>
                                    <a href="../kariyersoft/control.php?firma_id=<?php echo $firmacek['firma_id']; ?>&firmadelete=ok" class="btn btn-danger btn-xs">Sil</a>
                                </td>
                            </tr>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
                <div class="panel-footer">
                    <a href="firma-ekle.php" class="btn btn-warning btn-md">firma Ekle</a>
                </div>
            </div>
        </div><!--/.col-->
    </div><!--/.row-->
</div><!--/.main-->

<?php include 'footer.php'; ?>

<style>
    /* Sayfa başlık stil ayarları */
    .page-header {
        font-size: 24px;
        margin-bottom: 20px;
        font-weight: bold;
    }

    /* Panel ayarları */
    .panel {
        margin-bottom: 20px;
    }

    .panel-heading {
        background-color: #f8f9fa;
        font-size: 18px;
        font-weight: bold;
        border-bottom: 1px solid #e5e5e5;
    }

    .table-bordered {
        border: 1px solid #dee2e6;
    }

    .table th, .table td {
        padding: 15px;
        vertical-align: middle;
        border: 1px solid #dee2e6;
    }

    .table th {
        background-color: #f2f2f2;
        text-align: center;
    }

    .table td {
        text-align: center;
    }

    /* Buton ayarları */
    .btn {
        margin: 0 5px;
    }
</style>

</body>
</html>
