Arreglando UI-delete de Tariba Acabado

This commit is contained in:
imnavajas
2023-07-17 22:30:27 +02:00
parent 6e0493a287
commit 511c73cc0c
5 changed files with 62 additions and 125 deletions

View File

@ -1,5 +1,6 @@
<?= $this->include('themes/_commonPartialsBs/datatables') ?>
<?php //$this->include('themes/_commonPartialsBs/sweetalert') ?>
<?php $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
<?php $this->include('themes/_commonPartialsBs/sweetalert') ?>
<?= $this->extend('themes/backend/vuexy/main/defaultlayout') ?>
<?= $this->section('content'); ?>
<div class="row">
@ -32,49 +33,18 @@
</div><!--//.col -->
</div><!--//.row -->
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
</button>
</div>
<div class="modal-body">
<p>Croissant jelly beans donut apple pie. Caramels bonbon lemon drops. Sesame snaps lemon drops lemon drops liquorice icing bonbon pastry pastry carrot cake. Dragée sweet sweet roll sugar plum.</p>
<p>Jelly-o cookie jelly gummies pudding cheesecake lollipop macaroon. Sweet chocolate bar sweet roll carrot cake. Sweet roll sesame snaps fruitcake brownie bear claw toffee bonbon brownie.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary btn-imn" data-bs-dismiss="modal">Borrar</button>
</div>
</div>
</div>
</div>
<?= $this->endSection() ?>
<?= $this->section('additionalInlineJs') ?>
const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
const actionBtns = function(data) {
return `
<td class="text-right py-0 align-middle">
<div class="btn-group btn-group-sm">
<!-- <a href="--><?php //= site_url('/tarifas/tarifaacabado/edit/') ?><!--${data.id}" class="text-body" data-id="${data.id}">-->
<!-- <i class="ti ti-pencil ti-sm mx-2"></i>-->
<!-- </a>-->
<!-- <a class="text-body" data-href="${data.id}" data-bs-toggle="modal" data-bs-target="#exampleModal">-->
<!-- <i class="ti ti-trash ti-sm mx-2"></i>-->
<!-- </a>-->
<i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i>
<i class="ti ti-trash ti-sm btn-del mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#exampleModal"></i>
<!-- <i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}"></i>-->
<i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i>
</div>
</td>`;
};
@ -124,11 +94,11 @@
window.location.href = `/tarifas/tarifaacabado/edit/${$(this).attr('data-id')}`;
});
$(document).on('click', '.btn-del', function(e) {
$(".btn-imn").attr('data-id', $(this).attr('data-id'));
$(document).on('click', '.btn-delete', function(e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
});
$(document).on('click', '.btn-imn', function(e) {
$(document).on('click', '.btn-remove', function(e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
@ -136,6 +106,7 @@
url: `/tarifas/tarifaacabado/delete/${dataId}`,
method: 'GET',
}).done((data, textStatus, jqXHR) => {
$('#confirm2delete').modal('toggle'),
Toast.fire({
icon: 'success',
title: data.msg ?? jqXHR.statusText,
@ -152,7 +123,9 @@
}
});
$('#imn-alert').on('click', function (e) {
$(this).toggleClass('d-none');
});
<?= $this->endSection() ?>

View File

@ -15,17 +15,8 @@
<table id="tableOfTarifaspreimpresion" class="table table-striped table-hover using-exportable-data-table" style="width: 100%;">
<thead>
<tr>
<?php /*
<th><?= lang('Tarifapreimpresion.id') ?></th>
*/ ?>
<th><?= lang('Tarifapreimpresion.nombre') ?></th>
<th><?= lang('Tarifapreimpresion.precio') ?></th>
<?php /*
<th><?= lang('Tarifapreimpresion.userCreatedId') ?></th>
<th><?= lang('Tarifapreimpresion.userUpdateId') ?></th>
<th><?= lang('Tarifapreimpresion.createdAt') ?></th>
<th><?= lang('Tarifapreimpresion.updatedAt') ?></th>
*/ ?>
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
</tr>
</thead>