import Swal from 'sweetalert2';

window.confirmDelete = function(pid) {
    Swal.fire({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#2D6A4F',
        cancelButtonColor: '#d32424',
        confirmButtonText: 'Yes, delete it!'
    }).then((result) => {
        if (result.isConfirmed) {
            Livewire.emit('deleteItem', pid);
            Swal.fire(
                'Deleted!',
                'Your item has been deleted.',
                'success'
            );
        }
    });
}

window.confirmDeletePatchFile = function(pid) {
    Swal.fire({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#2D6A4F',
        cancelButtonColor: '#d32424',
        confirmButtonText: 'Yes, delete it!'
    }).then((result) => {
        if (result.isConfirmed) {
            Livewire.emit('deletePatchFile', pid);
            Swal.fire(
                'Deleted!',
                'Your patch file has been deleted.',
                'success'
            );
        }
    });
}


window.confirmDelete2 = function(currency, exdate) {
    Swal.fire({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#2D6A4F',
        cancelButtonColor: '#d32424',
        confirmButtonText: 'Yes, delete it!'
    }).then((result) => {
        if (result.isConfirmed) {
            Livewire.emit('deleteItem', currency, exdate);
        }
    });
}

window.confirmDeleteSelected = function() {
    Swal.fire({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#2D6A4F',
        cancelButtonColor: '#d32424',
        confirmButtonText: 'Yes, delete them!'
    }).then((result) => {
        if (result.isConfirmed) {
            Livewire.emit('deleteSelected');
        }
    });
}
