<?php

use App\Admin\Extensions\CleanCache;
use App\Admin\Extensions\FormQrCode;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Widgets\Navbar;

Form::forget(['map', 'editor']);

Admin::navbar(function (Navbar $navbar) {
    $navbar->right(new CleanCache());
    $navbar->right(new Navbar\Fullscreen());
});

Form::init(function (Form $form) {
    $form->disableEditingCheck();
    $form->disableCreatingCheck();
    $form->disableViewCheck();

    $form->tools(function (Form\Tools $tools) {
        $tools->disableView();
        // $tools->disableDelete();
        // $tools->disableList();
    });
});

Show::init(function (Show $show) {
    $show->panel()
        ->tools(function ($tools) {
            // $tools->disableEdit();
            // $tools->disableList();
            $tools->disableDelete();
        });;
});

Grid::init(function (Grid $grid) {
    $grid->disableExport();
    $grid->actions(function (Grid\Displayers\Actions $actions) {
        $actions->disableView();
    });
    $grid->disableBatchActions();
    $grid->filter(function ($filter) {
        $filter->disableIdFilter();
    });
    // $grid->expandFilter();
});

Form::extend('qrCode', FormQrCode::class);
