<?= $this->include("Themes/_commonPartialsBs/select2bs5") ?>
<?= $this->include("Themes/_commonPartialsBs/sweetalert") ?>
<?= $this->extend("Themes/" . config("Basics")->theme["name"] . "/AdminLayout/defaultLayout") ?>
<?= $this->section("content") ?>
<div class="row">
    <div class="col-12">
		<div class="card card-info">
			<div class="card-header">
        		<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
			</div><!--//.card-header -->
			<form id="distribuidorDeClienteForm" method="post" action="<?= $formAction ?>">
				<?= csrf_field() ?>
			<div class="card-body">
				<?= view("Themes/_commonPartialsBs/_alertBoxes") ?>
				<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
				<?= view("themes/vuexy/form/clientes/distribuidores/_distribuidorDeClienteFormItems") ?>
			</div><!-- /.card-body -->
			<div class="card-footer">
				<?= anchor(route_to("distribuidorDeClienteList"), lang("Basic.global.Cancel"), [
        "class" => "btn btn-secondary float-start",
    ]) ?>
				<input type="submit" class="btn btn-primary float-end" name="save" value="<?= lang("Basic.global.Save") ?>">
			</div><!-- /.card-footer -->
			</form>
    </div><!-- //.card -->
    </div><!--//.col -->
</div><!--//.row -->
<?= $this->endSection() ?>


<?= $this->section("additionalInlineJs") ?>


    $('#comunidadAutonomaId').select2({
        theme: 'bootstrap-5',
        allowClear: false,
        ajax: {
            url: '<?= route_to("menuItemsOfComunidadesAutonomas") ?>',
            type: 'post',
            dataType: 'json',

            data: function (params) {
                return {
                    id: 'id',
                    text: 'nombre',
                    searchTerm: params.term,
                    <?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
                };
            },
            delay: 60,
            processResults: function (response) {

                yeniden(response.<?= csrf_token() ?>);

                return {
                    results: response.menu
                };
            },

            cache: true
        }
    });

    $('#provinciaId').select2({
        theme: 'bootstrap-5',
        allowClear: false,
        ajax: {
            url: '<?= route_to("menuItemsOfProvincias") ?>',
            type: 'post',
            dataType: 'json',

            data: function (params) {
                return {
                    id: 'id',
                    text: 'nombre',
                    searchTerm: params.term,
                    <?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
                };
            },
            delay: 60,
            processResults: function (response) {

                yeniden(response.<?= csrf_token() ?>);

                return {
                    results: response.menu
                };
            },

            cache: true
        }
    });

    $('#paisId').select2({
        theme: 'bootstrap-5',
        allowClear: false,
        ajax: {
            url: '<?= route_to("menuItemsOfPaises") ?>',
            type: 'post',
            dataType: 'json',

            data: function (params) {
                return {
                    id: 'id',
                    text: 'nombre',
                    searchTerm: params.term,
                    <?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v
                };
            },
            delay: 60,
            processResults: function (response) {

                yeniden(response.<?= csrf_token() ?>);

                return {
                    results: response.menu
                };
            },

            cache: true
        }
    });


<?= $this->endSection() ?>
