first commit

This commit is contained in:
Tyler
2020-12-21 02:09:34 -05:00
commit 2802973d3f
113 changed files with 30356 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
$(document).ready(function(e) {
var authorOptions = {
placeholder: 'Authors',
tags: true,
ajax: {
url: '/authors/search',
dataType: 'json'
// Additional AJAX parameters go here; see the end of this chapter for the full code of this example
}
};
var locationOptions = {
placeholder: 'Location',
tags: true
};
$('#add-form .select2-author').select2(authorOptions);
$('#add-form .select2-location').select2(locationOptions);
$('#add-form').on('keyup', '.barcode_input', function (e) {
if (e.keyCode == 13) {
// Do something
e.preventDefault();
var $row = $(this).closest('.form-row');
$.get('/lookup/' + $(this).val(), function(res) {
$row.find('input[name*=name]').val(res.title);
var $authors = $row.find('.select2-author');
for (var i = 0; i < res.authors.length; i++) {
$authors.append($('<option>', {value: res.authors[i], text: res.authors[i], selected: 'selected'}));
}
$authors.trigger('change');
}, 'json');
var count = emptyRowCount();
console.log('Empty rows:', count);
if (count < 1) {
var $template = $('#add-template'),
$clone = $template.clone();
$clone.find('input[type=text]').val('');
$clone.removeClass('invisible').addClass('form-row');
$row.parent().append($clone);
$clone.find('.barcode_input').focus();
$clone.find('.select2-author').select2(authorOptions);
}
}
});
});
function emptyRowCount() {
var $barcodes = $('#add-form .barcode_input');
var count = 0;
$barcodes.each(function() {
if ($(this).val() == '') {
count++;
}
});
return count;
}
+6287
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3850
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+7
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long