Files
wticreatorstudio/Modules/Subscription/Resources/views/plan/script.blade.php
T
2024-02-12 22:54:20 -05:00

43 lines
1.2 KiB
PHP

<script>
(function ($) {
"use strict";
$('tbody').sortable({
cursor: "move",
update: function (event, ui) {
let ids = $(this).sortable('toArray', {attribute: 'data-item'});
if (ids.length > 0) {
let data = {
'_token': '{{ csrf_token() }}',
'ids': ids,
}
$.post("{{route('changePlanPosition')}}", data, function (data) {
});
}
}
});
$('#add_plan').on('click', function(ev) {
ev.preventDefault();
Subscription.PlanDialog.open({ title: 'Add Plan' });
});
$('.edit_plan').on('click', function(ev) {
ev.preventDefault();
var data = $(this).data('item');
Subscription.PlanDialog.open({ title: 'Edit Plan', data, mode: 'edit' });
});
$('.delete_plan').on('click', function(ev) {
ev.preventDefault();
var item = $(this).data('item');
Subscription.Plan.delete({ title: 'Confirmation', message: `Are you sure you want to delete this plan (${item.title})?`, item });
});
})(jQuery);
</script>