チェックイン削除モーダルのセットアップは共通処理に吸収
This commit is contained in:
parent
37eaefc016
commit
0ceb0fcf21
1
resources/assets/js/app.js
vendored
1
resources/assets/js/app.js
vendored
@ -28,4 +28,5 @@ $(() => {
|
||||
}
|
||||
|
||||
$('.link-card').linkCard();
|
||||
$('#deleteCheckinModal').deleteCheckinModal();
|
||||
});
|
16
resources/assets/js/tissue.js
vendored
16
resources/assets/js/tissue.js
vendored
@ -55,4 +55,20 @@
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.deleteCheckinModal = function () {
|
||||
return this.each(function () {
|
||||
$(this).on('show.bs.modal', function (event) {
|
||||
var target = $(event.relatedTarget);
|
||||
var modal = $(this);
|
||||
modal.find('.modal-body .date-label').text(target.data('date'));
|
||||
modal.data('id', target.data('id'));
|
||||
}).find('.btn-danger').on('click', function (event) {
|
||||
var modal = $('#deleteCheckinModal');
|
||||
var form = modal.find('form');
|
||||
form.attr('action', form.attr('action').replace('@', modal.data('id')));
|
||||
form.submit();
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
@ -89,20 +89,3 @@
|
||||
@endslot
|
||||
@endcomponent
|
||||
@endsection
|
||||
|
||||
@push('script')
|
||||
<script type="text/javascript" src="//cdn.jsdelivr.net/npm/holderjs@2.9.4/holder.min.js"></script>
|
||||
<script>
|
||||
$('#deleteCheckinModal').on('show.bs.modal', function (event) {
|
||||
var target = $(event.relatedTarget);
|
||||
var modal = $(this);
|
||||
modal.find('.modal-body .date-label').text(target.data('date'));
|
||||
modal.data('id', target.data('id'));
|
||||
}).find('.btn-danger').on('click', function (event) {
|
||||
var modal = $('#deleteCheckinModal');
|
||||
var form = modal.find('form');
|
||||
form.attr('action', form.attr('action').replace('@', modal.data('id')));
|
||||
form.submit();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
@ -98,19 +98,3 @@
|
||||
@endslot
|
||||
@endcomponent
|
||||
@endsection
|
||||
|
||||
@push('script')
|
||||
<script>
|
||||
$('#deleteCheckinModal').on('show.bs.modal', function (event) {
|
||||
var target = $(event.relatedTarget);
|
||||
var modal = $(this);
|
||||
modal.find('.modal-body .date-label').text(target.data('date'));
|
||||
modal.data('id', target.data('id'));
|
||||
}).find('.btn-danger').on('click', function (event) {
|
||||
var modal = $('#deleteCheckinModal');
|
||||
var form = modal.find('form');
|
||||
form.attr('action', form.attr('action').replace('@', modal.data('id')));
|
||||
form.submit();
|
||||
});
|
||||
</script>
|
||||
@endpush
|
Loading…
Reference in New Issue
Block a user