From c1f36483ba3f2ebddb3f657370dbb0360d1aca3e Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Sat, 10 Nov 2018 00:40:00 +0100 Subject: [PATCH] Whatevs --- parts/static/script.js | 71 +++++++-------------------------- parts/templates/partsearch.html | 2 +- 2 files changed, 15 insertions(+), 58 deletions(-) diff --git a/parts/static/script.js b/parts/static/script.js index 39a3104..e147e24 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -16,38 +16,16 @@ function overlay_out() { } function init_edit(partID) { - // 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); - $('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 = $('') - // 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 = $('') - // 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); + $('table#details tr#datasheet td input').show(); var datasheet_input = $('') $('#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 = '

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

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

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

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

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

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

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

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

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

'; - // $('#quantity-input').replaceWith(quantity_par); + $('table#details tr#partno td p').show(); + $('table#details tr#partno td input').hide(); - // var notes_par = '

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

'; - // $('#notes-input').replaceWith(notes_par); + $('table#details tr#description td p').show(); + $('table#details tr#description td input').hide(); - // var datasheet_par = '

'; - // $('#datasheet-input').replaceWith(datasheet_par); + $('table#details tr#datasheet td input').hide(); var newButton = '
'; $('.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)); diff --git a/parts/templates/partsearch.html b/parts/templates/partsearch.html index ee7f0b8..9a4c0e0 100644 --- a/parts/templates/partsearch.html +++ b/parts/templates/partsearch.html @@ -48,7 +48,7 @@ DESCRIPTION

DATASHEET: - +