diff --git a/parts/server.py b/parts/server.py index 32a14b2..cdbcaec 100644 --- a/parts/server.py +++ b/parts/server.py @@ -49,7 +49,7 @@ def index(): @app.route('/parts/getlocations/') def get_locations(): - s = 'select id, map from locations' + s = 'select id, name from locations' r = db_engine.execute(text(s)) l = {} for row in r: diff --git a/parts/static/script.js b/parts/static/script.js index a7e171c..39a3104 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -2,86 +2,107 @@ function overlay_in() { $('.shadow').css({'display' : 'block'}); $('.overlay').css({'display' : 'block'}); $('.shadow').animate({'opacity' : 0.7}); - $('.overlay').animate({'opacity' : 1.0, 'top' : '10%'}); + $('.overlay').animate({'opacity' : 1.0, 'top' : '5%'}); } function overlay_out() { $('.shadow').animate({'opacity' : 0.0}, function () { $('.overlay').css({'display' : 'none'}); }); - $('.overlay').animate({'opacity' : 0.0, 'top' : '5%'}, function () { + $('.overlay').animate({'opacity' : 0.0, 'top' : '0'}, function () { $('.shadow').css({'display' : 'none'}); }); end_edit(); } function init_edit(partID) { - var block_input = $('') - block_input.val($('#block-info').text()); - $('#block-info').replaceWith(block_input); + // var block_input = $('') + // block_input.val($('#block-info').text()); + // $('#block-info').replaceWith(block_input); - var type_input = $('') - type_input.val($('#type-info').text()); - $('#type-info').replaceWith(type_input); + // var type_input = $('') + // type_input.val($('#type-info').text()); + // $('#type-info').replaceWith(type_input); - var partno_input = $('') - partno_input.val($('#partno-info').text()); - $('#partno-info').replaceWith(partno_input); + $('table#details tr#location td p').hide(); + $('table#details tr#location td select').show(); - var description_input = $('') - description_input.val($('#description-info').text()); - $('#description-info').replaceWith(description_input); + $('table#details tr#partno td p').hide() + $('table#details tr#partno td input').show() - var quantity_input = $('') - quantity_input.val($('#quantity-info').text()); - $('#quantity-info').replaceWith(quantity_input); + $('table#details tr#description td p').hide() + $('table#details tr#description td input').show() - var notes_input = $('') - notes_input.val($('#notes-info').text()); - $('#notes-info').replaceWith(notes_input); + // var partno_input = $('') + // partno_input.val($('#partno-info').text()); + // $('table#details tr#partno td').replaceWith(partno_input); + + // var description_input = $('') + // description_input.val($('#description-info').text()); + // $('#description-info').replaceWith(description_input); + + // var quantity_input = $('') + // quantity_input.val($('#quantity-info').text()); + // $('#quantity-info').replaceWith(quantity_input); + + // var notes_input = $('') + // notes_input.val($('#notes-info').text()); + // $('#notes-info').replaceWith(notes_input); var datasheet_input = $('') $('#datasheet-info').replaceWith(datasheet_input); - var newButton = '
'; - $('.round-button').replaceWith(newButton); + var newButton = '
'; + $('.round-button-left').replaceWith(newButton); } function new_entry() { - $('#block-info').text(''); - $('#type-info').text(''); - $('#partno-info').text(''); - $('#description-info').text(''); - $('#quantity-info').text(''); - $('#notes-info').text(''); + $('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(''); init_edit(-1); overlay_in(); } function end_edit() { - var block_par = '

' + $('#block-input').val() + '

'; - $('#block-input').replaceWith(block_par); + $('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() - var type_par = '

' + $('#type-input').val() + '

'; - $('#type-input').replaceWith(type_par); + $('table#details tr#description td p').show() + $('table#details tr#description td input').hide() - var partno_par = '

' + $('#partno-input').val() + '

'; - $('#partno-input').replaceWith(partno_par); + // var block_par = '

' + $('#block-input').val() + '

'; + // $('#block-input').replaceWith(block_par); - var description_par = '

' + $('#description-input').val() + '

'; - $('#description-input').replaceWith(description_par); + // var type_par = '

' + $('#type-input').val() + '

'; + // $('#type-input').replaceWith(type_par); - var quantity_par = '

' + $('#quantity-input').val() + '

'; - $('#quantity-input').replaceWith(quantity_par); + // var partno_par = '

' + $('#partno-input').val() + '

'; + // $('#partno-input').replaceWith(partno_par); - var notes_par = '

' + $('#notes-input').val() + '

'; - $('#notes-input').replaceWith(notes_par); + // var description_par = '

' + $('#description-input').val() + '

'; + // $('#description-input').replaceWith(description_par); - var datasheet_par = '

'; - $('#datasheet-input').replaceWith(datasheet_par); + // var quantity_par = '

' + $('#quantity-input').val() + '

'; + // $('#quantity-input').replaceWith(quantity_par); - var newButton = '
'; - $('.round-button').replaceWith(newButton); + // var notes_par = '

' + $('#notes-input').val() + '

'; + // $('#notes-input').replaceWith(notes_par); + + // var datasheet_par = '

'; + // $('#datasheet-input').replaceWith(datasheet_par); + + var newButton = '
'; + $('.round-button-left').replaceWith(newButton); } function save(partID) { @@ -200,9 +221,11 @@ 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').text(text_filter(data.name)); // name is the location friendly name - $('table#details tr#partno td').text(text_filter(data.partno)); - $('table#details tr#description td').text(text_filter(data.description)); + $('table#details tr#location td p').text(text_filter(data.name)); // 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)); + $('table#details tr#description td input').val(text_filter(data.description)); $('img#map').attr('src', 'parts/map/' + data.map); if (data.datasheet != null) $('tr#datasheet-head').html($('DATASHEET: ')); @@ -238,7 +261,6 @@ function perform_query() { newRow.append($('').text(text_filter(data[i].location_descriptor))); newRow.append($('').text(text_filter(data[i].partno))); newRow.append($('').text(text_filter(data[i].description))); - newRow.append($('').text(text_filter(data[i].docs))); $('#results').append(newRow); } if(data.length == 0) { @@ -254,6 +276,11 @@ function perform_query() { } $(document).ready(function() { + $.getJSON('http://127.0.0.1:5000/parts/getlocations', function(data){ + $.each(data, function(i, val) { + $('table#details tr#location td select').append(''); + }); + }); $.ajaxSetup({ cache: false }); $('.search-bar').on('keyup', function() { perform_query(); diff --git a/parts/static/style.css b/parts/static/style.css index 7600153..2362127 100644 --- a/parts/static/style.css +++ b/parts/static/style.css @@ -166,7 +166,7 @@ div label input { left: 20%; padding: 0; position: fixed; - top:5% !important; + top:0; width: 60%; z-index: 201; border-radius: 2pt; @@ -296,7 +296,7 @@ table#results #partno { } table#results #description { - width: 65%; + width: 70%; } table#results #docs { @@ -367,10 +367,20 @@ table#details #datasheet-head td { padding-top: 16pt; } +td p { + margin: 0; + padding: 0; +} + .overlay img#map { position: absolute; right: 5%; bottom: 5%; height: calc(90% - 42pt); max-width: 50%; +} + +.pinfo-input { + display: none; + width: 90%; } \ No newline at end of file diff --git a/parts/templates/partsearch.html b/parts/templates/partsearch.html index f277d4d..ee7f0b8 100644 --- a/parts/templates/partsearch.html +++ b/parts/templates/partsearch.html @@ -32,7 +32,6 @@ Location Part Number Description - Docs

No results.

@@ -43,12 +42,13 @@

Part Details

- + - + - + +
LOCATION

PART NUMBER

DESCRIPTION

DATASHEET: