Add attachments, more pages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
66
resources/js/app.js
vendored
66
resources/js/app.js
vendored
@ -8,18 +8,6 @@
|
||||
require('./bootstrap');
|
||||
|
||||
$(document).ready(function(e) {
|
||||
|
||||
$.fn.dataTable.render.authorValue = function(_, context, book) {
|
||||
let authors = [];
|
||||
|
||||
console.log(book);
|
||||
for (let author of book.authors) {
|
||||
authors.push(author.name);
|
||||
}
|
||||
|
||||
return authors.join(', ');
|
||||
};
|
||||
|
||||
var authorOptions = {
|
||||
placeholder: 'Authors',
|
||||
tags: true,
|
||||
@ -64,23 +52,35 @@ $(document).ready(function(e) {
|
||||
}
|
||||
|
||||
$.get('/lookup/' + barcodeValue, function(res) {
|
||||
$row.find('input[name*=name]').val(res.title);
|
||||
|
||||
var $authors = $row.find('.select2-author');
|
||||
|
||||
$authors.children('option').remove();
|
||||
|
||||
for (var i = 0; i < res.authors.length; i++) {
|
||||
$authors.append($('<option>', {value: res.authors[i], text: res.authors[i], selected: 'selected'}));
|
||||
if (res.warning) {
|
||||
bootbox.alert({
|
||||
title: 'Warning',
|
||||
message: res.warning,
|
||||
callback: function() {
|
||||
$('.barcode_input').filter(function() {
|
||||
return !this.value;
|
||||
}).focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$authors.trigger('change');
|
||||
if (res.success) {
|
||||
$row.find('input[name*=name]').val(res.data.title);
|
||||
|
||||
var $authors = $row.find('.select2-author');
|
||||
|
||||
$authors.children('option').remove();
|
||||
|
||||
for (var i = 0; i < res.data.authors.length; i++) {
|
||||
$authors.append($('<option>', {value: res.data.authors[i], text: res.data.authors[i], selected: 'selected'}));
|
||||
}
|
||||
|
||||
$authors.trigger('change');
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
var count = emptyRowCount();
|
||||
|
||||
console.log('Empty rows:', count);
|
||||
|
||||
if (count < 1) {
|
||||
var firstIndex = 0,
|
||||
$container = $row.closest('.row-container');
|
||||
@ -116,6 +116,26 @@ $(document).ready(function(e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('.remove-item').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $this = $(this),
|
||||
$row = $this.closest('tr');
|
||||
|
||||
bootbox.confirm('Are you sure?', function(result) {
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
|
||||
axios.delete($row.data('url')).then(function(res) {
|
||||
if (res.data.success) {
|
||||
|
||||
$row.remove();
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
function emptyRowCount() {
|
||||
|
22
resources/js/bootstrap.js
vendored
22
resources/js/bootstrap.js
vendored
@ -12,8 +12,7 @@ try {
|
||||
|
||||
require('bootstrap');
|
||||
require('select2');
|
||||
require('datatables.net-bs4');
|
||||
require('datatables.net-buttons-bs4');
|
||||
window.bootbox = require('bootbox');
|
||||
} catch (e) {}
|
||||
|
||||
/**
|
||||
@ -24,21 +23,4 @@ try {
|
||||
|
||||
window.axios = require('axios');
|
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
||||
|
||||
/**
|
||||
* Echo exposes an expressive API for subscribing to channels and listening
|
||||
* for events that are broadcast by Laravel. Echo and event broadcasting
|
||||
* allows your team to easily build robust real-time web applications.
|
||||
*/
|
||||
|
||||
// import Echo from 'laravel-echo';
|
||||
|
||||
// window.Pusher = require('pusher-js');
|
||||
|
||||
// window.Echo = new Echo({
|
||||
// broadcaster: 'pusher',
|
||||
// key: process.env.MIX_PUSHER_APP_KEY,
|
||||
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
|
||||
// forceTLS: true
|
||||
// });
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
Reference in New Issue
Block a user