master
Davide Bongiovanni 6 years ago
parent cafe2f0914
commit c1f36483ba

@ -16,38 +16,16 @@ function overlay_out() {
}
function init_edit(partID) {
// var block_input = $('<input type="text" class="part-edit-input" id="block-input" placeholder="Location">')
// block_input.val($('#block-info').text());
// $('#block-info').replaceWith(block_input);
// var type_input = $('<input type="text" class="part-edit-input" id="type-input" placeholder="Manufacturer">')
// type_input.val($('#type-info').text());
// $('#type-info').replaceWith(type_input);
$('table#details tr#location td p').hide();
$('table#details tr#location td select').show();
$('table#details tr#partno td p').hide()
$('table#details tr#partno td input').show()
$('table#details tr#description td p').hide()
$('table#details tr#description td input').show()
$('table#details tr#partno td p').hide();
$('table#details tr#partno td input').show();
// var partno_input = $('<input type="text" class="part-edit-input" id="partno-input" placeholder="Part number">')
// partno_input.val($('#partno-info').text());
// $('table#details tr#partno td').replaceWith(partno_input);
$('table#details tr#description td p').hide();
$('table#details tr#description td input').show();
// var description_input = $('<input type="text" class="part-edit-input" id="description-input" placeholder="Description">')
// description_input.val($('#description-info').text());
// $('#description-info').replaceWith(description_input);
// var quantity_input = $('<input type="text" class="part-edit-input" id="quantity-input" placeholder="Quantity">')
// quantity_input.val($('#quantity-info').text());
// $('#quantity-info').replaceWith(quantity_input);
// var notes_input = $('<input type="text" class="part-edit-input" id="notes-input" placeholder="Notes">')
// notes_input.val($('#notes-info').text());
// $('#notes-info').replaceWith(notes_input);
$('table#details tr#datasheet td input').show();
var datasheet_input = $('<input type="file" class="part-edit-file" id="datasheet-input" accept=".pdf">')
$('#datasheet-info').replaceWith(datasheet_input);
@ -60,12 +38,9 @@ function new_entry() {
$('table#details tr#location td').text('');
$('table#details tr#partno td').text('');
$('table#details tr#description td').text('');
// $('#block-info').text('');
// $('#type-info').text('');
// $('#partno-info').text('');
// $('#description-info').text('');
// $('#quantity-info').text('');
// $('#notes-info').text('');
// $('table#details tr#location select').text('');
$('table#details tr#partno input').text('');
$('table#details tr#description input').text('');
init_edit(-1);
overlay_in();
}
@ -74,32 +49,13 @@ function end_edit() {
$('table#details tr#location td p').show();
$('table#details tr#location td select').hide();
$('table#details tr#partno td p').show()
$('table#details tr#partno td input').hide()
$('table#details tr#description td p').show()
$('table#details tr#description td input').hide()
// var block_par = '<p id="block-info">' + $('#block-input').val() + '</p>';
// $('#block-input').replaceWith(block_par);
// var type_par = '<p id="type-info">' + $('#type-input').val() + '</p>';
// $('#type-input').replaceWith(type_par);
// var partno_par = '<p id="partno-info">' + $('#partno-input').val() + '</p>';
// $('#partno-input').replaceWith(partno_par);
// var description_par = '<p id="description-info">' + $('#description-input').val() + '</p>';
// $('#description-input').replaceWith(description_par);
// var quantity_par = '<p id="quantity-info">' + $('#quantity-input').val() + '</p>';
// $('#quantity-input').replaceWith(quantity_par);
$('table#details tr#partno td p').show();
$('table#details tr#partno td input').hide();
// var notes_par = '<p id="notes-info">' + $('#notes-input').val() + '</p>';
// $('#notes-input').replaceWith(notes_par);
$('table#details tr#description td p').show();
$('table#details tr#description td input').hide();
// var datasheet_par = '<p id="datasheet-info"><i class="fa fa-circle-o-notch fa-spin fa-fw"></i></p>';
// $('#datasheet-input').replaceWith(datasheet_par);
$('table#details tr#datasheet td input').hide();
var newButton = '<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>';
$('.round-button-left').replaceWith(newButton);
@ -222,6 +178,7 @@ function delete_entry(partID) {
function show_part_info(partID) {
$.getJSON('http://127.0.0.1:5000/parts/getpartinfo/' + partID, function(data) {
$('table#details tr#location td p').text(text_filter(data.name)); // name is the location friendly name
$('table#details tr#location td select').val(data.location_id); // name is the location friendly name
$('table#details tr#partno td p').text(text_filter(data.partno));
$('table#details tr#partno td input').val(text_filter(data.partno));
$('table#details tr#description td p').text(text_filter(data.description));

@ -48,7 +48,7 @@
<tr id="description-head"><td>DESCRIPTION</td></tr>
<tr id="description"><td><p></p><input type="text" name="description-input" placeholder="Description" class="pinfo-input"/></td></tr>
<tr id="datasheet-head"><td>DATASHEET: </td></tr>
<tr id="datasheet"><td></td></tr>
<tr id="datasheet"><td><input type="file" accept=".pdf" class="pinfo-input"></td></tr>
</table>
<img src="" id="map"/>
<div class="round-button-left"><a href="#" id="edit-button"><i class="fa fa-pencil" aria-hidden="true"></i></a></div>

Loading…
Cancel
Save