203 lines
6.3 KiB
JavaScript
203 lines
6.3 KiB
JavaScript
/**
|
||
* First we will load all of this project's JavaScript dependencies which
|
||
* includes Vue and other libraries. It is a great starting point when
|
||
* building robust, powerful web applications using Vue and Laravel.
|
||
*/
|
||
|
||
// require('./bootstrap');
|
||
require('jquery-confirm/js/jquery-confirm');
|
||
// window.Vue = require('vue');
|
||
|
||
/**
|
||
* Next, we will create a fresh Vue application instance and attach it to
|
||
* the page. Then, you may begin adding components to this application
|
||
* or customize the JavaScript scaffolding to fit your unique needs.
|
||
*/
|
||
|
||
//Vue.component('example-component', require('./components/ExampleComponent.vue'));
|
||
|
||
// const app = new Vue({
|
||
// el: '#app'
|
||
// });
|
||
|
||
$('#checkbox_all').on('ifChecked ifUnchecked', function (event) {
|
||
if (event.type == 'ifChecked') {
|
||
$('input.checkbox:not(:disabled)').iCheck('check');
|
||
} else {
|
||
$('input.checkbox:not(:disabled)').iCheck('uncheck');
|
||
}
|
||
});
|
||
|
||
$('#delete').on('click', function () {
|
||
|
||
$.confirm({
|
||
title: '確認ダイアログ。',
|
||
content: '!※※※このレコードは他のテーブルから参照されている可能性があります。削除の際は十分注意してください。\n' +
|
||
'※※※ チェックボックスにて選択したレコードを削除してよろしいでしょうか?はい/いいえ',
|
||
buttons: {
|
||
ok: {
|
||
text: "はい",
|
||
btnClass: 'btn-primary',
|
||
keys: ['enter'],
|
||
action: function () {
|
||
$("#form_delete").submit();
|
||
}
|
||
},
|
||
いいえ: function () {
|
||
}
|
||
}
|
||
});
|
||
});
|
||
$('#import_csv').on('click', function () {
|
||
var action = $(this).attr('action'),
|
||
token = $('meta[name="csrf-token"]').attr('content');
|
||
$.confirm({
|
||
title: 'インポート確認ダイアログ。',
|
||
content: '' +
|
||
'<form action="' + action + '" class="formName" id="form_import" method="post" enctype="multipart/form-data">' +
|
||
'<input type="hidden" name="_token" value="' + token + '" />' +
|
||
'<p>!データをインポートします。既存のデータは全て削除します。継続してよろしいですか? はい/いいえ。</p>' +
|
||
'<div class="form-group">' +
|
||
'<input type="file" name="file" accept=".csv" />' +
|
||
'</div>' +
|
||
'</form>',
|
||
buttons: {
|
||
formSubmit: {
|
||
text: 'はい',
|
||
btnClass: 'btn-blue',
|
||
action: function () {
|
||
$("#form_import").submit();
|
||
}
|
||
},
|
||
いいえ: function () {
|
||
//close
|
||
},
|
||
}
|
||
});
|
||
});
|
||
|
||
$('#export_csv').on('click', function () {
|
||
var action = $(this).attr('action'),
|
||
user_id = $('#user_id').val(),
|
||
member_id = $('#member_id').val(),
|
||
user_tag_serial = $('#user_tag_serial').val(),
|
||
user_phonetic = $('#user_phonetic').val(),
|
||
phone = $('#phone').val(),
|
||
crime = $('#crime').val(),
|
||
sort = $('#sort').val(),
|
||
sort_type = $('#sort_type').val();
|
||
$.confirm({
|
||
title: '確認ダイアログ。',
|
||
content: '!CSVファイルを出力します。よろしいですか?はい/いいえ',
|
||
buttons: {
|
||
ok: {
|
||
text: "はい",
|
||
btnClass: 'btn-primary',
|
||
keys: ['enter'],
|
||
action: function () {
|
||
window.location.href = action +
|
||
'?user_id=' + user_id +
|
||
'&member_id=' + member_id +
|
||
'&user_tag_serial=' + user_tag_serial +
|
||
'&user_phonetic=' + user_phonetic +
|
||
'&phone=' + phone +
|
||
'&crime=' + crime +
|
||
'&sort=' + sort +
|
||
'&sort_type=' + sort_type +
|
||
'&isExport=1';
|
||
}
|
||
},
|
||
いいえ: function () {
|
||
}
|
||
}
|
||
});
|
||
|
||
|
||
});
|
||
|
||
|
||
// for sorting
|
||
$('.table thead th.sorting').on('click', function (e) {
|
||
var sort = $(this).attr('sort');
|
||
var sort_type = 'asc';
|
||
if ($(this).hasClass('sorting_asc')) {
|
||
sort_type = 'desc'
|
||
}
|
||
$('input:hidden[name="sort"]').val(sort);
|
||
$('input:hidden[name="sort_type"]').val(sort_type);
|
||
$('form#list-form').submit();
|
||
});
|
||
|
||
$('.date').datepicker({
|
||
language: "ja",
|
||
format: "yyyy/mm/dd"
|
||
});
|
||
|
||
|
||
$('#select_user').on('change', function () {
|
||
var mobile = $('option:selected', this).attr('mobile'),
|
||
homePhone = $('option:selected', this).attr('homePhone');
|
||
$('#mobile').val(mobile);
|
||
$('#homephone').val(homePhone);
|
||
});
|
||
$('#select_user').trigger('change');
|
||
|
||
$('.register').on('click', function (e) {
|
||
e.preventDefault();
|
||
$.confirm({
|
||
title: '確認ダイアログ。',
|
||
content: '登録してよろしいですか?はい/いいえ',
|
||
buttons: {
|
||
ok: {
|
||
text: "はい",
|
||
btnClass: 'btn-primary',
|
||
keys: ['enter'],
|
||
action: function () {
|
||
$("form").submit();
|
||
}
|
||
},
|
||
いいえ: function () {
|
||
}
|
||
}
|
||
});
|
||
});
|
||
|
||
// 編集画面専用 登録ボタン
|
||
$('#register_edit').on('click', function (e) {
|
||
e.preventDefault();
|
||
$.confirm({
|
||
title: '確認ダイアログ',
|
||
content: '登録してよろしいですか?',
|
||
buttons: {
|
||
ok: {
|
||
text: "はい",
|
||
btnClass: 'btn-primary',
|
||
action: function () {
|
||
$("#form_edit").submit(); // 更新処理
|
||
}
|
||
},
|
||
いいえ: function () {}
|
||
}
|
||
});
|
||
});
|
||
|
||
// 編集画面専用 削除ボタン
|
||
$('#delete_edit').on('click', function (e) {
|
||
e.preventDefault();
|
||
$.confirm({
|
||
title: '確認ダイアログ',
|
||
content: 'このレコードを削除してよろしいですか?',
|
||
buttons: {
|
||
ok: {
|
||
text: "はい",
|
||
btnClass: 'btn-primary',
|
||
action: function () {
|
||
$("#form_delete").submit(); // 削除処理
|
||
}
|
||
},
|
||
いいえ: function () {}
|
||
}
|
||
});
|
||
});
|
||
|