diff --git a/parts/server.py b/parts/server.py index 89915ea..d5d30b3 100644 --- a/parts/server.py +++ b/parts/server.py @@ -44,7 +44,7 @@ def index(): @app.route('/parts/getpartinfo/') def get_part_info(partID): - s = 'select * from parts where id = :id;' + s = 'select * from parts as p inner join locations as l on p.location_id=l.id where p.id = :id;' r = db_engine.execute(text(s), id=partID) l = [] for row in r: diff --git a/parts/static/script.js b/parts/static/script.js index 4dbde1b..94da536 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -200,22 +200,22 @@ function delete_entry(partID) { function show_part_info(partID) { $.getJSON('http://127.0.0.1:5000/parts/getpartinfo/' + partID, function(data) { - $('#block-info').text(text_filter(data.block)); - $('#type-info').text(text_filter(data.type)); - $('#partno-info').text(text_filter(data.partno) + ' ' + text_filter(data.partnoalt) + ' ' + text_filter(data.partnoalt2)); - $('#description-info').text(text_filter(data.description)); - $('#quantity-info').text(text_filter(data.quantity)); - $('#notes-info').text(text_filter(data.notes)); - if (data.datasheet != null) - $('#datasheet-info').html($('')); - else - $('#datasheet-info').text(' '); - $('#edit-button').click(function() { - init_edit(partID); - }); - $('#delete-button').click(function() { - delete_entry(partID); - }); + $('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)); + // $('#description-info').text(text_filter(data.description)); + // $('#quantity-info').text(text_filter(data.quantity)); + // $('#notes-info').text(text_filter(data.notes)); + // if (data.datasheet != null) + // $('#datasheet-info').html($('')); + // else + // $('#datasheet-info').text(' '); + // $('#edit-button').click(function() { + // init_edit(partID); + // }); + // $('#delete-button').click(function() { + // delete_entry(partID); + // }); overlay_in(); }).fail(function() { console.log( "Fetching part info failed" ); @@ -261,7 +261,7 @@ $(document).ready(function() { perform_query(); }); $('.checkbox').change( function() { - if ( !$('#type').is(':checked') + if ( !$('#location').is(':checked') && !$('#partno').is(':checked') && !$('#description').is(':checked') && !$('#notes').is(':checked')) diff --git a/parts/static/style.css b/parts/static/style.css index f5cc5f4..ca3fa2e 100644 --- a/parts/static/style.css +++ b/parts/static/style.css @@ -101,80 +101,10 @@ input[type=checkbox]:checked + label.toggle-btn { color: #000F0F; } -.results { - margin-top: 5pt; - margin-left: 2pt; - margin-right: 2pt; -} - -.results-row { - padding: 5pt; - font-size: 16pt; -} - -.results-row:nth-child(2n+1) { - background-color: #5E9292; -} - -.results-row div { - display: inline-block; - width: 16.7%; - margin-left: 6pt; - margin-right: 6pt; -} - -.results-row .results-datasheet { - width: 5%; - text-align: center; -} - -.results-row .results-notes { - width: 5%; - text-align: center; -} - -.results-row .results-block { - width: 5%; - text-align: center; -} - -.results-row .results-description { - width: 43.5%; -} - div label input { margin-right:100px; } -.res-header, .res-header-3, .res-header-small { - display: inline-block; - /* Firefox */ - margin-left: -moz-calc(0.2% - 4px); - /* WebKit */ - margin-left: -webkit-calc(0.2% - 4px); - /* Opera */ - margin-left: -o-calc(0.2% - 4px); - /* Standard */ - margin-left: calc(0.2% - 4px); - background-color: #226666; - color: #D7E2E2; - padding: 0.6%; - border-radius: 2pt; - text-align: center; -} - -.res-header { - width: 16.7%; -} - -.res-header-small { - width: 5%; -} - -.res-header-3 { - width: 43.5%; -} - .tooltip { position: relative; display: inline-block; @@ -232,23 +162,18 @@ div label input { background-color: #226666; color: #D7E2E2; display: none; - height: 70%; + height: 90%; left: 20%; - padding: 0; - position: fixed; - top:5%; + padding: 0; + position: fixed; + top:5% !important; width: 60%; z-index: 201; border-radius: 2pt; text-align: center; - opacity: 0.0; + opacity: 0.0; } -/*.details-row { - padding-top: 10pt; - padding-bottom: 10pt; -}*/ - .details-item { display: inline-block; width: 25%; @@ -271,7 +196,7 @@ div label input { .round-button { position: absolute; bottom: 15pt; - right: 15pt; + left: calc(15% - 20pt); width: 40pt; height: 32pt; border-radius: 20pt; @@ -284,7 +209,7 @@ div label input { .round-button-left { position: absolute; bottom: 15pt; - right: 70pt; + left: calc(30% - 20pt); width: 40pt; height: 32pt; border-radius: 20pt; @@ -362,18 +287,89 @@ table#results td { cursor: pointer; } -#location { +table#results #location { width: 15%; } -#partno { +table#results #partno { /*width: 20%;*/ } -#description { +table#results #description { width: 65%; } -#docs { +table#results #docs { width: 5%; +} + +table#details { + position: absolute; + left: 0; + width: 45%; + margin-top: 4%; +} + +table#details #location-head { + height: 10%; + color: #013A3A; +} + +table#details #location { + height: 10%; +} + +table#details #location td{ + height: 10%; +} + +table#details #partno-head { + height: 10%; + color: #013A3A; +} + +table#details #partno-head td{ + padding-top: 16pt; +} + +table#details #partno{ + height: 10%; +} + +table#details #partno td{ + height: 10%; +} + +table#details #description-head { + height: 10%; + color: #013A3A; +} + +table#details #description-head td { + padding-top: 16pt; +} + +table#details #description { + height: 20%; +} + +table#details #description td { + padding-left: 5%; + padding-right: 5%; +} + +table#details #datasheet-head { + height: 10%; + color: #013A3A; +} + +table#details #datasheet-head td { + padding-top: 16pt; +} + +.overlay img#map { + position: absolute; + right: 5%; + top: 5%; + height: 90%; } \ No newline at end of file diff --git a/parts/templates/partsearch.html b/parts/templates/partsearch.html index 8f2262a..00ae34a 100644 --- a/parts/templates/partsearch.html +++ b/parts/templates/partsearch.html @@ -21,7 +21,7 @@

Search in:

- + @@ -41,8 +41,17 @@

Part Details

- -
+ + + + + + + + +
LOCATION
PART NUMBER
DESCRIPTION
DATASHEET:
+ + -
-
+
+