|
|
@ -4,18 +4,21 @@ function init_edit(partID) {
|
|
|
|
$('#container-dropdown').show();
|
|
|
|
$('#container-dropdown').show();
|
|
|
|
|
|
|
|
|
|
|
|
$('table#details tr#partno td p').hide();
|
|
|
|
$('table#details tr#partno td p').hide();
|
|
|
|
$('table#details tr#partno td input').show();
|
|
|
|
$('input[name=partno-input]').show();
|
|
|
|
$('#magical_autofill').show();
|
|
|
|
$('#magical_autofill').show();
|
|
|
|
|
|
|
|
|
|
|
|
$('table#details tr#description td p').hide();
|
|
|
|
$('table#details tr#description td p').hide();
|
|
|
|
$('table#details tr#description td input').show();
|
|
|
|
$('input[name=description-input]').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('table#details tr#datasheet td input').closest().show();
|
|
|
|
$('table#details tr#datasheet td input').show();
|
|
|
|
$('table#details tr#datasheet td input').show();
|
|
|
|
|
|
|
|
// $('input[name=datasheet-url-input]').closest().show();
|
|
|
|
|
|
|
|
|
|
|
|
$('#duplicate-button').closest('div').hide();
|
|
|
|
$('#duplicate-button').closest('div').hide();
|
|
|
|
|
|
|
|
|
|
|
|
var datasheet_input = $('<input type="file" class="part-edit-file" id="datasheet-input" accept=".pdf">')
|
|
|
|
$('tr#datasheet').show();
|
|
|
|
$('#datasheet-info').replaceWith(datasheet_input);
|
|
|
|
// var datasheet_input = $('<input type="file" class="part-edit-file" id="datasheet-input" accept=".pdf">')
|
|
|
|
|
|
|
|
// $('#datasheet-info').replaceWith(datasheet_input);
|
|
|
|
|
|
|
|
|
|
|
|
var newButton = '<div class="round-button-left"><a href="#" onclick="save(' + partID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>';
|
|
|
|
var newButton = '<div class="round-button-left"><a href="#" onclick="save(' + partID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>';
|
|
|
|
$('.round-button-left').replaceWith(newButton);
|
|
|
|
$('.round-button-left').replaceWith(newButton);
|
|
|
@ -27,6 +30,7 @@ function new_entry() {
|
|
|
|
$('table#details tr#description td p').text('');
|
|
|
|
$('table#details tr#description td p').text('');
|
|
|
|
$('table#details tr#partno td input').val('');
|
|
|
|
$('table#details tr#partno td input').val('');
|
|
|
|
$('table#details tr#description td input').val('');
|
|
|
|
$('table#details tr#description td input').val('');
|
|
|
|
|
|
|
|
$('input[name=datasheet-url-input]').val('');
|
|
|
|
container_onchange();
|
|
|
|
container_onchange();
|
|
|
|
init_edit(-1);
|
|
|
|
init_edit(-1);
|
|
|
|
overlay_in();
|
|
|
|
overlay_in();
|
|
|
@ -49,7 +53,10 @@ function end_edit() {
|
|
|
|
$('table#details tr#description td p').show();
|
|
|
|
$('table#details tr#description td p').show();
|
|
|
|
$('table#details tr#description td input').hide();
|
|
|
|
$('table#details tr#description td input').hide();
|
|
|
|
|
|
|
|
|
|
|
|
$('table#details tr#datasheet td input').hide();
|
|
|
|
$('tr#datasheet').hide();
|
|
|
|
|
|
|
|
// $('table#details tr#datasheet td input').closest().hide();
|
|
|
|
|
|
|
|
// $('table#details tr#datasheet td input').hide();
|
|
|
|
|
|
|
|
// $('input[name=datasheet-url-input]').closest().hide();
|
|
|
|
|
|
|
|
|
|
|
|
$('#duplicate-button').closest('div').show();
|
|
|
|
$('#duplicate-button').closest('div').show();
|
|
|
|
|
|
|
|
|
|
|
@ -58,10 +65,15 @@ function end_edit() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function save(partID) {
|
|
|
|
function save(partID) {
|
|
|
|
|
|
|
|
if (!$('#location-dropdown').val()) {
|
|
|
|
|
|
|
|
alert('Please select a location.');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
var location_id_v = $('#location-dropdown').val();
|
|
|
|
var location_id_v = $('#location-dropdown').val();
|
|
|
|
var partno_v = $('input[name=partno-input]').val();
|
|
|
|
var partno_v = $('input[name=partno-input]').val();
|
|
|
|
var description_v = $('input[name=description-input]').val();
|
|
|
|
var description_v = $('input[name=description-input]').val();
|
|
|
|
var datasheet = $('table#details tr#datasheet td input')[0].files;
|
|
|
|
var datasheet = $('table#details tr#datasheet td input')[0].files;
|
|
|
|
|
|
|
|
var datasheet_url_v = $('input[name=datasheet-url-input]').val();
|
|
|
|
if(partno_v.length == 0){
|
|
|
|
if(partno_v.length == 0){
|
|
|
|
alert('Please enter a part number.');
|
|
|
|
alert('Please enter a part number.');
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -86,6 +98,8 @@ function save(partID) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.append('datasheet-file', datasheet[0]);
|
|
|
|
data.append('datasheet-file', datasheet[0]);
|
|
|
|
|
|
|
|
} else if (datasheet_url_v.length > 0) {
|
|
|
|
|
|
|
|
data.append('datasheet-url', datasheet_url_v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.append('partno', partno_v);
|
|
|
|
data.append('partno', partno_v);
|
|
|
|
data.append('location_id', location_id_v)
|
|
|
|
data.append('location_id', location_id_v)
|
|
|
@ -159,8 +173,8 @@ function show_part_info(partID) {
|
|
|
|
$('table#details tr#description td input').val(text_filter(data.description));
|
|
|
|
$('table#details tr#description td input').val(text_filter(data.description));
|
|
|
|
container_onchange();
|
|
|
|
container_onchange();
|
|
|
|
if (data.datasheet != null) {
|
|
|
|
if (data.datasheet != null) {
|
|
|
|
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="parts/getfile/' + data.datasheet + '"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
|
|
|
|
$('tr#datasheet-head').html($('<td>DATASHEET: <a href="' + data.datasheet + '" target="_blank"><i class="fa fa-file-text" aria-hidden="true"></i></a></td>'));
|
|
|
|
$('#datasheet-input').val(data.datasheet);
|
|
|
|
$('input[name=datasheet-url-input]').val(data.datasheet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
$('tr#datasheet-head td').text('DATASHEET: ');
|
|
|
|
$('tr#datasheet-head td').text('DATASHEET: ');
|
|
|
@ -183,8 +197,7 @@ function perform_query() {
|
|
|
|
var data = {
|
|
|
|
var data = {
|
|
|
|
l:$('#location').is(':checked'),
|
|
|
|
l:$('#location').is(':checked'),
|
|
|
|
p:$('#partno').is(':checked'),
|
|
|
|
p:$('#partno').is(':checked'),
|
|
|
|
d:$('#description').is(':checked'),
|
|
|
|
d:$('#description').is(':checked')
|
|
|
|
n:$('#has-docs').is(':checked')
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
filter = '0';
|
|
|
|
filter = '0';
|
|
|
|
$("#results").find("tr:not(:first)").remove(); // Delete all table rows
|
|
|
|
$("#results").find("tr:not(:first)").remove(); // Delete all table rows
|
|
|
@ -213,7 +226,7 @@ function container_onchange() {
|
|
|
|
$('#location-dropdown').empty();
|
|
|
|
$('#location-dropdown').empty();
|
|
|
|
$.getJSON('parts/getlocationsInContainer/' + selected_container_id, function(data) {
|
|
|
|
$.getJSON('parts/getlocationsInContainer/' + selected_container_id, function(data) {
|
|
|
|
$.each(data, function(location_id, location_name) {
|
|
|
|
$.each(data, function(location_id, location_name) {
|
|
|
|
$('#location-dropdown').append('<option val="' + location_id + '">' + location_name + '</option>');
|
|
|
|
$('#location-dropdown').append('<option value="' + location_id + '">' + location_name + '</option>');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|