<?php 
    $data = array();
    $data['title'] = "Kullanıcı Grubu Düzenle | ".$config->get('site_title');
    $data['links'] = [];
    $data['styles'] = [];
    $data['header']['scripts'] = [];
    $data['version'] = $config->get('version');
    $data['csrf_token'] = $csrf_generator->create();
    $data['sidebar_menu'] = $menu->get(array('position'=>'sidebar'));
    $data['sidebar_active_menu'] = $menu->getActiveMenuItemId(trim($_SERVER['REQUEST_URI']));
    $data['footer']['scripts'] = [];
    $menu_items = $menu->get(array('position'=>'footer'));
    foreach($menu_items as $item){
        if($item['col'] == "1"){
            $data['menu']['footer']["1"][] = $item;
        }
        if($item['col'] == "2"){
            $data['menu']['footer']["2"][] = $item;
        }
        if($item['col'] == "3"){
            $data['menu']['footer']["3"][] = $item;
        }
        if($item['col'] == "4"){
            $data['menu']['footer']["4"][] = $item;
        }
    }

    $data['breadcrumbs'] = array();
    $data['breadcrumbs'][] = array(
        'text' => "Pano",
        'href' => "/admin",
        'index' => 1
    );
    $data['breadcrumbs'][] = array(
        'text' => "Kullanıcı Grupları",
        'href' => "/admin/admin-groups/list",
        'index' => 2
    );
    $data['breadcrumbs'][] = array(
        'text' => "Kullanıcı Grubu Düzenle",
        'href' => "#",
        'index' => 3
    );

    if(isset($_GET['id']) && !empty($_GET['id'])) {
        $stmt = $db->query("SELECT * FROM {$db->prefix}admin_groups WHERE id=:id", array(':id'=>$_GET['id']));
        $user_details = $stmt->row;

        $user_permissions = array();
        $stmt = $db->query("SELECT directory FROM {$db->prefix}user_group_permissions WHERE user_group=:user_group", array(':user_group'=>$_GET['id']));
        if($stmt->num_rows > 0) {
            foreach($stmt->rows as $row) {
                $user_permissions[] = $row['directory'];
            }
        }
    }else{
        header("Location: /admin/admin-groups/list");
        exit();
    }

    if($_SERVER['REQUEST_METHOD'] == 'POST'){
        if(isset($_POST['action']) && !empty($_POST['action'])) {
            switch($_POST['action']) {
                case 'user':
                    $id             = $_GET['id'];
                    $name           = $_POST['name'];
                    $status         = $_POST['status'];
                    $description    = $_POST['description'];

                    $stmt = $db->query("UPDATE {$db->prefix}admin_groups SET `name`=:name, `status`=:status, description=:description WHERE `id`=:id", array(':name'=>$name, ':status'=>$status, ':description'=>$description, ':id'=>$id));
                    if($stmt->error){
                        $utils->errorLog("error", "Cannot update admin group info. Error: ".$stmt->error_info['message'], $session->data['user_id'], $_SERVER['REQUEST_URI']);
                        $session->data['messageType'] = "error"; 
                        $session->data['messageTitle'] = "Hata!"; 
                        $session->data['message'] = "Bir hata oluştu ve kullanıcı grubu güncellenemedi."; 
                        header("Refresh: 0;");
                        exit();
                    }else{
                        $session->data['messageType'] = "success"; 
                        $session->data['messageTitle'] = "Başarılı!"; 
                        $session->data['message'] = "Kullanıcı grubu başarıyla güncellendi."; 
                        header("Refresh: 0;");
                        exit();
                    }
                break;
                case 'permissions':
                    unset($_POST['action']);
                    unset($_POST['update']);
                    $id = $_GET['id'];
                    $error = false;
                    $db->query("DELETE FROM {$db->prefix}user_group_permissions WHERE user_group=:user_group", array(':user_group' => $id));
                    foreach($_POST as $key => $value) {
                        $stmt = $db->query("INSERT INTO {$db->prefix}user_group_permissions (directory, user_group) VALUES (:directory, :user_group)", array(':user_group'=>$id, ':directory'=>$key));
                        if($stmt->error) {
                            $error = true;
                            break;
                        }
                    }

                    if(!$error) {
                        $session->data['messageType'] = "success"; 
                        $session->data['messageTitle'] = "Başarılı!"; 
                        $session->data['message'] = "Grup yetkileri başarıyla güncellendi."; 
                        header("Refresh: 0;");
                        exit();
                    }else{
                        $session->data['messageType'] = "error"; 
                        $session->data['messageTitle'] = "Hata!"; 
                        $session->data['message'] = "Bir hata oluştu ve grup yetkileri güncellenemedi."; 
                        header("Refresh: 0;");
                        exit();
                    }
                break;
	        }
	    }
	}
?>
<?php include DIR_VIEWS."parts/header.php"; ?>
        <main class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                                <h5 class="card-title">Kullanıcı Grubu Bilgileri</h5>
                            </div>
                            <div class="card-body">
                                <form action="" method="post">
                                    <div class="row mb-3">
                                        <div class="col-md-3">
                                            <label for="name" class="form-label font-weight-bold">Adı</label>
                                        </div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="name" id="name" placeholder="adı" value="<?php echo $user_details["name"]; ?>">
                                        </div>
                                    </div>
                                    <div class="row mb-3">
                                        <div class="col-md-3">
                                            <label for="user_status" class="form-label font-weight-bold">Durum</label>
                                        </div>
                                        <div class="col-md-4">
                                            <select name="status" id="user_status" class="form-control form-select">
                                                <option value="1" <?php echo $user_details["status"] == "1" ? 'selected' : ''; ?>>Aktif</option>
                                                <option value="0" <?php echo $user_details["status"] == "0" ? 'selected' : ''; ?>>Pasif</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="row mb-3">
                                        <div class="col-md-3">
                                            <label for="description" class="form-label font-weight-bold">Açıklama</label>
                                        </div>
                                        <div class="col-md-4">
                                            <textarea name="description" id="description" rows="3" class="form-control"><?php echo $user_details["description"]; ?></textarea>
                                        </div>
                                    </div>
                                    <div class="row mb-3">
                                        <div class="col-12 text-end">
                                            <input type="hidden" name="action" value="user">
                                            <input type="submit" name="update" class="btn btn-primary" value="Güncelle">
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row mt-3">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-header">
                                <h5 class="card-title">Grup Yetkileri</h5>
                            </div>
                            <div class="card-body p-0">
                                <form action="" method="post">
                                    <div class="row">
                                        <div class="col-12">
                                            <div class="table-responsive">
                                                <table class="table table-condensed table-hover table-striped table-bordered">
                                                    <thead>
                                                        <tr>
                                                            <th>Sayfa</th>
                                                            <th>Görüntüle</th>
                                                            <th>Ekle</th>
                                                            <th>Düzenle</th>
                                                            <th>Sil</th>
                                                            <th>Rapor</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <tr>
                                                            <td>Siparişler</td>
                                                            <td><label for="admin/orders/list" class="form-check-label d-block"><input type="checkbox" id="admin/orders/list" name="admin/orders/list" class="form-check-input" value="1" <?php echo in_array("admin/orders/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td><label for="admin/orders/edit" class="form-check-label d-block"><input type="checkbox" id="admin/orders/edit" name="admin/orders/edit" class="form-check-input" value="1" <?php echo in_array("admin/orders/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td><label for="admin/orders/excel" class="form-check-label d-block"><input type="checkbox" id="admin/orders/excel" name="admin/orders/excel" class="form-check-input" value="1" <?php echo in_array("admin/orders/excel", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Yeni Siparişler</td>
                                                            <td><label for="admin/orders/new" class="form-check-label d-block"><input type="checkbox" id="admin/orders/new" name="admin/orders/new" class="form-check-input" value="1" <?php echo in_array("admin/orders/new", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Terk Edilen Siparişler</td>
                                                            <td><label for="admin/orders/abandoned" class="form-check-label d-block"><input type="checkbox" id="admin/orders/abandoned" name="admin/orders/abandoned" class="form-check-input" value="1" <?php echo in_array("admin/orders/abandoned", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Sipariş Hediye Notu</td>
                                                            <td><label for="admin/orders/gift-note" class="form-check-label d-block"><input type="checkbox" id="admin/orders/gift-note" name="admin/orders/gift-note" class="form-check-input" value="1" <?php echo in_array("admin/orders/gift-note", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Sipariş Kargo Etiketi</td>
                                                            <td><label for="admin/orders/shipping-label" class="form-check-label d-block"><input type="checkbox" id="admin/orders/shipping-label" name="admin/orders/shipping-label" class="form-check-input" value="1" <?php echo in_array("admin/orders/shipping-label", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Sipariş Özeti</td>
                                                            <td><label for="admin/orders/receipt" class="form-check-label d-block"><input type="checkbox" id="admin/orders/receipt" name="admin/orders/receipt" class="form-check-input" value="1" <?php echo in_array("admin/orders/receipt", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Toplu Sipariş Yazdırma</td>
                                                            <td><label for="admin/orders/receipt/print" class="form-check-label d-block"><input type="checkbox" id="admin/orders/receipt/print" name="admin/orders/receipt/print" class="form-check-input" value="1" <?php echo in_array("admin/orders/receipt/print", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Toplu Kargo Etiketi Yazdırma</td>
                                                            <td><label for="admin/orders/shipping-label/print" class="form-check-label d-block"><input type="checkbox" id="admin/orders/shipping-label/print" name="admin/orders/shipping-label/print" class="form-check-input" value="1" <?php echo in_array("admin/orders/shipping-label/print", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Ürünler</td>
                                                            <td><label for="admin/product/list" class="form-check-label d-block"><input type="checkbox" id="admin/product/list" name="admin/product/list" class="form-check-input" value="1" <?php echo in_array("admin/product/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product/add" class="form-check-label d-block"><input type="checkbox" id="admin/product/add" name="admin/product/add" class="form-check-input" value="1" <?php echo in_array("admin/product/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product/edit" class="form-check-label d-block"><input type="checkbox" id="admin/product/edit" name="admin/product/edit" class="form-check-input" value="1" <?php echo in_array("admin/product/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product/delete" class="form-check-label d-block"><input type="checkbox" id="admin/product/delete" name="admin/product/delete" class="form-check-input" value="1" <?php echo in_array("admin/product/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product/excel" class="form-check-label d-block"><input type="checkbox" id="admin/product/excel" name="admin/product/excel" class="form-check-input" value="1" <?php echo in_array("admin/product/excel", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Ürün Yorumları</td>
                                                            <td><label for="admin/product/reviews" class="form-check-label d-block"><input type="checkbox" id="admin/product/reviews" name="admin/product/reviews" class="form-check-input" value="1" <?php echo in_array("admin/product/reviews", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td><label for="admin/product/reviews/edit" class="form-check-label d-block"><input type="checkbox" id="admin/product/reviews/edit" name="admin/product/reviews/edit" class="form-check-input" value="1" <?php echo in_array("admin/product/reviews/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product/reviews/delete" class="form-check-label d-block"><input type="checkbox" id="admin/product/reviews/delete" name="admin/product/reviews/delete" class="form-check-input" value="1" <?php echo in_array("admin/product/reviews/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Ürün Kategorileri</td>
                                                            <td><label for="admin/category/list" class="form-check-label d-block"><input type="checkbox" id="admin/category/list" name="admin/category/list" class="form-check-input" value="1" <?php echo in_array("admin/category/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/category/add" class="form-check-label d-block"><input type="checkbox" id="admin/category/add" name="admin/category/add" class="form-check-input" value="1" <?php echo in_array("admin/category/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/category/edit" class="form-check-label d-block"><input type="checkbox" id="admin/category/edit" name="admin/category/edit" class="form-check-input" value="1" <?php echo in_array("admin/category/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/category/delete" class="form-check-label d-block"><input type="checkbox" id="admin/category/delete" name="admin/category/delete" class="form-check-input" value="1" <?php echo in_array("admin/category/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Ürün Markaları</td>
                                                            <td><label for="admin/brands/list" class="form-check-label d-block"><input type="checkbox" id="admin/brands/list" name="admin/brands/list" class="form-check-input" value="1" <?php echo in_array("admin/brands/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/brands/add" class="form-check-label d-block"><input type="checkbox" id="admin/brands/add" name="admin/brands/add" class="form-check-input" value="1" <?php echo in_array("admin/brands/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/brands/edit" class="form-check-label d-block"><input type="checkbox" id="admin/brands/edit" name="admin/brands/edit" class="form-check-input" value="1" <?php echo in_array("admin/brands/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/brands/delete" class="form-check-label d-block"><input type="checkbox" id="admin/brands/delete" name="admin/brands/delete" class="form-check-input" value="1" <?php echo in_array("admin/brands/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Ürün Koleksiyonları</td>
                                                            <td><label for="admin/collections/list" class="form-check-label d-block"><input type="checkbox" id="admin/collections/list" name="admin/collections/list" class="form-check-input" value="1" <?php echo in_array("admin/collections/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/collections/add" class="form-check-label d-block"><input type="checkbox" id="admin/collections/add" name="admin/collections/add" class="form-check-input" value="1" <?php echo in_array("admin/collections/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/collections/edit" class="form-check-label d-block"><input type="checkbox" id="admin/collections/edit" name="admin/collections/edit" class="form-check-input" value="1" <?php echo in_array("admin/collections/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/collections/delete" class="form-check-label d-block"><input type="checkbox" id="admin/collections/delete" name="admin/collections/delete" class="form-check-input" value="1" <?php echo in_array("admin/collections/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Satıcılar</td>
                                                            <td><label for="admin/sellers/list" class="form-check-label d-block"><input type="checkbox" id="admin/sellers/list" name="admin/sellers/list" class="form-check-input" value="1" <?php echo in_array("admin/sellers/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/sellers/add" class="form-check-label d-block"><input type="checkbox" id="admin/sellers/add" name="admin/sellers/add" class="form-check-input" value="1" <?php echo in_array("admin/sellers/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/sellers/edit" class="form-check-label d-block"><input type="checkbox" id="admin/sellers/edit" name="admin/sellers/edit" class="form-check-input" value="1" <?php echo in_array("admin/sellers/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/sellers/delete" class="form-check-label d-block"><input type="checkbox" id="admin/sellers/delete" name="admin/sellers/delete" class="form-check-input" value="1" <?php echo in_array("admin/sellers/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Müşteriler</td>
                                                            <td><label for="admin/users/list" class="form-check-label d-block"><input type="checkbox" id="admin/users/list" name="admin/users/list" class="form-check-input" value="1" <?php echo in_array("admin/users/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/users/add" class="form-check-label d-block"><input type="checkbox" id="admin/users/add" name="admin/users/add" class="form-check-input" value="1" <?php echo in_array("admin/users/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/users/edit" class="form-check-label d-block"><input type="checkbox" id="admin/users/edit" name="admin/users/edit" class="form-check-input" value="1" <?php echo in_array("admin/users/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/users/delete" class="form-check-label d-block"><input type="checkbox" id="admin/users/delete" name="admin/users/delete" class="form-check-input" value="1" <?php echo in_array("admin/users/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/users/excel" class="form-check-label d-block"><input type="checkbox" id="admin/users/excel" name="admin/users/excel" class="form-check-input" value="1" <?php echo in_array("admin/users/excel", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Sistem Kullanıcıları</td>
                                                            <td><label for="admin/admins/list" class="form-check-label d-block"><input type="checkbox" id="admin/admins/list" name="admin/admins/list" class="form-check-input" value="1" <?php echo in_array("admin/admins/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/admins/add" class="form-check-label d-block"><input type="checkbox" id="admin/admins/add" name="admin/admins/add" class="form-check-input" value="1" <?php echo in_array("admin/admins/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/admins/edit" class="form-check-label d-block"><input type="checkbox" id="admin/admins/edit" name="admin/admins/edit" class="form-check-input" value="1" <?php echo in_array("admin/admins/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/admins/delete" class="form-check-label d-block"><input type="checkbox" id="admin/admins/delete" name="admin/admins/delete" class="form-check-input" value="1" <?php echo in_array("admin/admins/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Sistem Kullanıcı Grupları</td>
                                                            <td><label for="admin/admin-groups/list" class="form-check-label d-block"><input type="checkbox" id="admin/admin-groups/list" name="admin/admin-groups/list" class="form-check-input" value="1" <?php echo in_array("admin/admin-groups/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/admin-groups/add" class="form-check-label d-block"><input type="checkbox" id="admin/admin-groups/add" name="admin/admin-groups/add" class="form-check-input" value="1" <?php echo in_array("admin/admin-groups/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/admin-groups/edit" class="form-check-label d-block"><input type="checkbox" id="admin/admin-groups/edit" name="admin/admin-groups/edit" class="form-check-input" value="1" <?php echo in_array("admin/admin-groups/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/admin-groups/delete" class="form-check-label d-block"><input type="checkbox" id="admin/admin-groups/delete" name="admin/admin-groups/delete" class="form-check-input" value="1" <?php echo in_array("admin/admin-groups/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>İçerik Yönetimi</td>
                                                            <td><label for="admin/pages/list" class="form-check-label d-block"><input type="checkbox" id="admin/pages/list" name="admin/pages/list" class="form-check-input" value="1" <?php echo in_array("admin/pages/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/pages/add" class="form-check-label d-block"><input type="checkbox" id="admin/pages/add" name="admin/pages/add" class="form-check-input" value="1" <?php echo in_array("admin/pages/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/pages/edit" class="form-check-label d-block"><input type="checkbox" id="admin/pages/edit" name="admin/pages/edit" class="form-check-input" value="1" <?php echo in_array("admin/pages/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/pages/delete" class="form-check-label d-block"><input type="checkbox" id="admin/pages/delete" name="admin/pages/delete" class="form-check-input" value="1" <?php echo in_array("admin/pages/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Blog Yönetimi</td>
                                                            <td><label for="admin/blog/list" class="form-check-label d-block"><input type="checkbox" id="admin/blog/list" name="admin/blog/list" class="form-check-input" value="1" <?php echo in_array("admin/blog/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/blog/add" class="form-check-label d-block"><input type="checkbox" id="admin/blog/add" name="admin/blog/add" class="form-check-input" value="1" <?php echo in_array("admin/blog/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/blog/edit" class="form-check-label d-block"><input type="checkbox" id="admin/blog/edit" name="admin/blog/edit" class="form-check-input" value="1" <?php echo in_array("admin/blog/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/blog/delete" class="form-check-label d-block"><input type="checkbox" id="admin/blog/delete" name="admin/blog/delete" class="form-check-input" value="1" <?php echo in_array("admin/blog/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Blog Kategori Yönetimi</td>
                                                            <td><label for="admin/blog-categories/list" class="form-check-label d-block"><input type="checkbox" id="admin/blog-categories/list" name="admin/blog-categories/list" class="form-check-input" value="1" <?php echo in_array("admin/blog-categories/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/blog-categories/add" class="form-check-label d-block"><input type="checkbox" id="admin/blog-categories/add" name="admin/blog-categories/add" class="form-check-input" value="1" <?php echo in_array("admin/blog-categories/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/blog-categories/edit" class="form-check-label d-block"><input type="checkbox" id="admin/blog-categories/edit" name="admin/blog-categories/edit" class="form-check-input" value="1" <?php echo in_array("admin/blog-categories/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/blog-categories/delete" class="form-check-label d-block"><input type="checkbox" id="admin/blog-categories/delete" name="admin/blog-categories/delete" class="form-check-input" value="1" <?php echo in_array("admin/blog-categories/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Link Yönetimi</td>
                                                            <td><label for="admin/seo/list" class="form-check-label d-block"><input type="checkbox" id="admin/seo/list" name="admin/seo/list" class="form-check-input" value="1" <?php echo in_array("admin/seo/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td><label for="admin/seo/edit" class="form-check-label d-block"><input type="checkbox" id="admin/seo/edit" name="admin/seo/edit" class="form-check-input" value="1" <?php echo in_array("admin/seo/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/seo/delete" class="form-check-label d-block"><input type="checkbox" id="admin/seo/delete" name="admin/seo/delete" class="form-check-input" value="1" <?php echo in_array("admin/seo/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Ziyaretçi Trafiği</td>
                                                            <td><label for="admin/traffic/list" class="form-check-label d-block"><input type="checkbox" id="admin/traffic/list" name="admin/traffic/list" class="form-check-input" value="1" <?php echo in_array("admin/traffic/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Cimri</td>
                                                            <td><label for="admin/cimri" class="form-check-label d-block"><input type="checkbox" id="admin/cimri" name="admin/cimri" class="form-check-input" value="1" <?php echo in_array("admin/cimri", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/cimri/excel" class="form-check-label d-block"><input type="checkbox" id="admin/cimri/excel" name="admin/cimri/excel" class="form-check-input" value="1" <?php echo in_array("admin/cimri/excel", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Akakçe</td>
                                                            <td><label for="admin/akakce" class="form-check-label d-block"><input type="checkbox" id="admin/akakce" name="admin/akakce" class="form-check-input" value="1" <?php echo in_array("admin/akakce", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/akakce/excel" class="form-check-label d-block"><input type="checkbox" id="admin/akakce/excel" name="admin/akakce/excel" class="form-check-input" value="1" <?php echo in_array("admin/akakce/excel", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>PayTR</td>
                                                            <td><label for="admin/paytr" class="form-check-label d-block"><input type="checkbox" id="admin/paytr" name="admin/paytr" class="form-check-input" value="1" <?php echo in_array("admin/paytr", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Tasarım Menüsü</td>
                                                            <td><label for="admin/visual-settings" class="form-check-label d-block"><input type="checkbox" id="admin/visual-settings" name="admin/visual-settings" class="form-check-input" value="1" <?php echo in_array("admin/visual-settings", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Kargo Yönetimi</td>
                                                            <td><label for="admin/shipping/list" class="form-check-label d-block"><input type="checkbox" id="admin/shipping/list" name="admin/shipping/list" class="form-check-input" value="1" <?php echo in_array("admin/shipping/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/shipping/add" class="form-check-label d-block"><input type="checkbox" id="admin/shipping/add" name="admin/shipping/add" class="form-check-input" value="1" <?php echo in_array("admin/shipping/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/shipping/edit" class="form-check-label d-block"><input type="checkbox" id="admin/shipping/edit" name="admin/shipping/edit" class="form-check-input" value="1" <?php echo in_array("admin/shipping/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/shipping/delete" class="form-check-label d-block"><input type="checkbox" id="admin/shipping/delete" name="admin/shipping/delete" class="form-check-input" value="1" <?php echo in_array("admin/shipping/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Yardım Yönetimi</td>
                                                            <td><label for="admin/faq/list" class="form-check-label d-block"><input type="checkbox" id="admin/faq/list" name="admin/faq/list" class="form-check-input" value="1" <?php echo in_array("admin/faq/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/faq/add" class="form-check-label d-block"><input type="checkbox" id="admin/faq/add" name="admin/faq/add" class="form-check-input" value="1" <?php echo in_array("admin/faq/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/faq/edit" class="form-check-label d-block"><input type="checkbox" id="admin/faq/edit" name="admin/faq/edit" class="form-check-input" value="1" <?php echo in_array("admin/faq/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/faq/delete" class="form-check-label d-block"><input type="checkbox" id="admin/faq/delete" name="admin/faq/delete" class="form-check-input" value="1" <?php echo in_array("admin/faq/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Yardım Kategorileri Yönetimi</td>
                                                            <td><label for="admin/faq/categories/list" class="form-check-label d-block"><input type="checkbox" id="admin/faq/categories/list" name="admin/faq/categories/list" class="form-check-input" value="1" <?php echo in_array("admin/faq/categories/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/faq/categories/add" class="form-check-label d-block"><input type="checkbox" id="admin/faq/categories/add" name="admin/faq/categories/add" class="form-check-input" value="1" <?php echo in_array("admin/faq/categories/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/faq/categories/edit" class="form-check-label d-block"><input type="checkbox" id="admin/faq/categories/edit" name="admin/faq/categories/edit" class="form-check-input" value="1" <?php echo in_array("admin/faq/categories/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/faq/categories/delete" class="form-check-label d-block"><input type="checkbox" id="admin/faq/categories/delete" name="admin/faq/categories/delete" class="form-check-input" value="1" <?php echo in_array("admin/faq/categories/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Log Kayıtları</td>
                                                            <td><label for="admin/system-logs/list" class="form-check-label d-block"><input type="checkbox" id="admin/system-logs/list" name="admin/system-logs/list" class="form-check-input" value="1" <?php echo in_array("admin/system-logs/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td><label for="admin/system-logs/delete" class="form-check-label d-block"><input type="checkbox" id="admin/system-logs/delete" name="admin/system-logs/delete" class="form-check-input" value="1" <?php echo in_array("admin/system-logs/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Genel Ayarlar</td>
                                                            <td><label for="admin/settings" class="form-check-label d-block"><input type="checkbox" id="admin/settings" name="admin/settings" class="form-check-input" value="1" <?php echo in_array("admin/settings", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td><label for="admin/settings/edit" class="form-check-label d-block"><input type="checkbox" id="admin/settings/edit" name="admin/settings/edit" class="form-check-input" value="1" <?php echo in_array("admin/settings/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Zamanlanmış Görevler</td>
                                                            <td><label for="admin/cron" class="form-check-label d-block"><input type="checkbox" id="admin/cron" name="admin/cron" class="form-check-input" value="1" <?php echo in_array("admin/cron", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/cron/add" class="form-check-label d-block"><input type="checkbox" id="admin/cron/add" name="admin/cron/add" class="form-check-input" value="1" <?php echo in_array("admin/cron/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/cron/edit" class="form-check-label d-block"><input type="checkbox" id="admin/cron/edit" name="admin/cron/edit" class="form-check-input" value="1" <?php echo in_array("admin/cron/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/cron/delete" class="form-check-label d-block"><input type="checkbox" id="admin/cron/delete" name="admin/cron/delete" class="form-check-input" value="1" <?php echo in_array("admin/cron/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Slider Yönetimi</td>
                                                            <td><label for="admin/slider/list" class="form-check-label d-block"><input type="checkbox" id="admin/slider/list" name="admin/slider/list" class="form-check-input" value="1" <?php echo in_array("admin/slider/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/slider/add" class="form-check-label d-block"><input type="checkbox" id="admin/slider/add" name="admin/slider/add" class="form-check-input" value="1" <?php echo in_array("admin/slider/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/slider/edit" class="form-check-label d-block"><input type="checkbox" id="admin/slider/edit" name="admin/slider/edit" class="form-check-input" value="1" <?php echo in_array("admin/slider/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/slider/delete" class="form-check-label d-block"><input type="checkbox" id="admin/slider/delete" name="admin/slider/delete" class="form-check-input" value="1" <?php echo in_array("admin/slider/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Şerit Duyuru Alanı Yönetimi</td>
                                                            <td><label for="admin/topbar/list" class="form-check-label d-block"><input type="checkbox" id="admin/topbar/list" name="admin/topbar/list" class="form-check-input" value="1" <?php echo in_array("admin/topbar/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/topbar/add" class="form-check-label d-block"><input type="checkbox" id="admin/topbar/add" name="admin/topbar/add" class="form-check-input" value="1" <?php echo in_array("admin/topbar/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/topbar/edit" class="form-check-label d-block"><input type="checkbox" id="admin/topbar/edit" name="admin/topbar/edit" class="form-check-input" value="1" <?php echo in_array("admin/topbar/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/topbar/delete" class="form-check-label d-block"><input type="checkbox" id="admin/topbar/delete" name="admin/topbar/delete" class="form-check-input" value="1" <?php echo in_array("admin/topbar/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Banner Yönetimi</td>
                                                            <td><label for="admin/banner/list" class="form-check-label d-block"><input type="checkbox" id="admin/banner/list" name="admin/banner/list" class="form-check-input" value="1" <?php echo in_array("admin/banner/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/banner/add" class="form-check-label d-block"><input type="checkbox" id="admin/banner/add" name="admin/banner/add" class="form-check-input" value="1" <?php echo in_array("admin/banner/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/banner/edit" class="form-check-label d-block"><input type="checkbox" id="admin/banner/edit" name="admin/banner/edit" class="form-check-input" value="1" <?php echo in_array("admin/banner/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/banner/delete" class="form-check-label d-block"><input type="checkbox" id="admin/banner/delete" name="admin/banner/delete" class="form-check-input" value="1" <?php echo in_array("admin/banner/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Ürün Rozet Yönetimi</td>
                                                            <td><label for="admin/product-badges/list" class="form-check-label d-block"><input type="checkbox" id="admin/product-badges/list" name="admin/product-badges/list" class="form-check-input" value="1" <?php echo in_array("admin/product-badges/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product-badges/add" class="form-check-label d-block"><input type="checkbox" id="admin/product-badges/add" name="admin/product-badges/add" class="form-check-input" value="1" <?php echo in_array("admin/product-badges/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product-badges/edit" class="form-check-label d-block"><input type="checkbox" id="admin/product-badges/edit" name="admin/product-badges/edit" class="form-check-input" value="1" <?php echo in_array("admin/product-badges/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/product-badges/delete" class="form-check-label d-block"><input type="checkbox" id="admin/product-badges/delete" name="admin/product-badges/delete" class="form-check-input" value="1" <?php echo in_array("admin/product-badges/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Menü Banner Yönetimi</td>
                                                            <td><label for="admin/menu-banners/list" class="form-check-label d-block"><input type="checkbox" id="admin/menu-banners/list" name="admin/menu-banners/list" class="form-check-input" value="1" <?php echo in_array("admin/menu-banners/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/menu-banners/add" class="form-check-label d-block"><input type="checkbox" id="admin/menu-banners/add" name="admin/menu-banners/add" class="form-check-input" value="1" <?php echo in_array("admin/menu-banners/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/menu-banners/edit" class="form-check-label d-block"><input type="checkbox" id="admin/menu-banners/edit" name="admin/menu-banners/edit" class="form-check-input" value="1" <?php echo in_array("admin/menu-banners/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/menu-banners/delete" class="form-check-label d-block"><input type="checkbox" id="admin/menu-banners/delete" name="admin/menu-banners/delete" class="form-check-input" value="1" <?php echo in_array("admin/menu-banners/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Anasayfa Yönetimi</td>
                                                            <td><label for="admin/homepage/list" class="form-check-label d-block"><input type="checkbox" id="admin/homepage/list" name="admin/homepage/list" class="form-check-input" value="1" <?php echo in_array("admin/homepage/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/homepage/add" class="form-check-label d-block"><input type="checkbox" id="admin/homepage/add" name="admin/homepage/add" class="form-check-input" value="1" <?php echo in_array("admin/homepage/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/homepage/edit" class="form-check-label d-block"><input type="checkbox" id="admin/homepage/edit" name="admin/homepage/edit" class="form-check-input" value="1" <?php echo in_array("admin/homepage/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/homepage/delete" class="form-check-label d-block"><input type="checkbox" id="admin/homepage/delete" name="admin/homepage/delete" class="form-check-input" value="1" <?php echo in_array("admin/homepage/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>SMS Ayarları</td>
                                                            <td><label for="admin/sms/list" class="form-check-label d-block"><input type="checkbox" id="admin/sms/list" name="admin/sms/list" class="form-check-input" value="1" <?php echo in_array("admin/sms/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/sms/add" class="form-check-label d-block"><input type="checkbox" id="admin/sms/add" name="admin/sms/add" class="form-check-input" value="1" <?php echo in_array("admin/sms/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/sms/edit" class="form-check-label d-block"><input type="checkbox" id="admin/sms/edit" name="admin/sms/edit" class="form-check-input" value="1" <?php echo in_array("admin/sms/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/sms/delete" class="form-check-label d-block"><input type="checkbox" id="admin/sms/delete" name="admin/sms/delete" class="form-check-input" value="1" <?php echo in_array("admin/sms/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Menü Yönetimi</td>
                                                            <td><label for="admin/menu/list" class="form-check-label d-block"><input type="checkbox" id="admin/menu/list" name="admin/menu/list" class="form-check-input" value="1" <?php echo in_array("admin/menu/list", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/menu/add" class="form-check-label d-block"><input type="checkbox" id="admin/menu/add" name="admin/menu/add" class="form-check-input" value="1" <?php echo in_array("admin/menu/add", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/menu/edit" class="form-check-label d-block"><input type="checkbox" id="admin/menu/edit" name="admin/menu/edit" class="form-check-input" value="1" <?php echo in_array("admin/menu/edit", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td><label for="admin/menu/delete" class="form-check-label d-block"><input type="checkbox" id="admin/menu/delete" name="admin/menu/delete" class="form-check-input" value="1" <?php echo in_array("admin/menu/delete", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                        </tr>
                                                        <tr>
                                                            <td>Dosya Yöneticisi</td>
                                                            <td><label for="admin/file-manager" class="form-check-label d-block"><input type="checkbox" id="admin/file-manager" name="admin/file-manager" class="form-check-input" value="1" <?php echo in_array("admin/file-manager", $user_permissions) ? 'checked' : ''; ?>></label></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                            <td></td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="p-3">
                                        <div class="row mb-3">
                                            <div class="col-12 text-end">
                                                <input type="hidden" name="admin" value="1">
                                                <input type="hidden" name="admin/login" value="1">
                                                <input type="hidden" name="admin/logout" value="1">
                                                <input type="hidden" name="admin/access-denied" value="1">
                                                <input type="hidden" name="action" value="permissions">
                                                <input type="submit" name="update" class="btn btn-primary" value="Güncelle">
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
<?php include DIR_VIEWS."parts/footer.php"; ?>