Merge branch 'master' of git.elab.kth.se:davide/ELAB-partsearch
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -1,18 +1,18 @@
|
||||
var rootURL = '/parts/'
|
||||
|
||||
function overlay_in() {
|
||||
$('.shadow').css({'display' : 'block'});
|
||||
$('.overlay').css({'display' : 'block'});
|
||||
$('.shadow').show();
|
||||
$('.overlay').show();
|
||||
$('.shadow').animate({'opacity' : 0.7});
|
||||
$('.overlay').animate({'opacity' : 1.0, 'top' : '5%'});
|
||||
}
|
||||
|
||||
function overlay_out() {
|
||||
$('.shadow').animate({'opacity' : 0.0}, function () {
|
||||
$('.overlay').css({'display' : 'none'});
|
||||
$('.shadow').hide();
|
||||
});
|
||||
$('.overlay').animate({'opacity' : 0.0, 'top' : '0'}, function () {
|
||||
$('.shadow').css({'display' : 'none'});
|
||||
$('.overlay').hide();
|
||||
});
|
||||
end_edit();
|
||||
}
|
||||
@@ -1,27 +1,26 @@
|
||||
function new_location_entry() {
|
||||
$('#location-name-input').text('');
|
||||
$('#location-name-input').show();
|
||||
$('#mapfile-input').show();
|
||||
init_Location_edit(-1);
|
||||
|
||||
}
|
||||
|
||||
function init_Location_edit(locationID, name, containerID) {
|
||||
$('#save-button').attr("onclick", "saveLocation(" + locationID + ")");
|
||||
$('#delete-button').attr("onclick", "deleteLocation(" + locationID + ")");
|
||||
$('#location-name-input').val(name);
|
||||
if(containerID > 0){
|
||||
$("#container-input").val(containerID);
|
||||
update_map();
|
||||
}
|
||||
overlay_in();
|
||||
}
|
||||
|
||||
function init_Location_edit(locationID) {
|
||||
|
||||
$('table#details tr#datasheet td input').show();
|
||||
|
||||
var newButton = '<div class="round-button-left"><a href="#" onclick="saveLocation(' + locationID + ')"><i class="fa fa-check" aria-hidden="true"></i></a></div>';
|
||||
$('.round-button-left').replaceWith(newButton);
|
||||
}
|
||||
|
||||
function update_clickable_map() {
|
||||
var selected_map_file = $('#mapfile-input').val();
|
||||
$('#clickablemap').attr('src', 'map/' + selected_map_file);
|
||||
function update_map() {
|
||||
var selected_map_file = $('#container-input').val();
|
||||
$('#map').attr('src', 'map/' + selected_map_file);
|
||||
}
|
||||
|
||||
|
||||
function saveLocation(locationID) {
|
||||
var map_v = $('#clickablemap').attr('src').substring(4);
|
||||
var container_v = $('#container-input').val();
|
||||
var name_v = $('#location-name-input').val();
|
||||
|
||||
if(name_v.length > 100) {
|
||||
@@ -30,7 +29,7 @@ function saveLocation(locationID) {
|
||||
}
|
||||
var data = new FormData();
|
||||
|
||||
data.append('map', map_v);
|
||||
data.append('container', container_v);
|
||||
data.append('name', name_v)
|
||||
|
||||
$.ajax({
|
||||
@@ -54,7 +53,65 @@ function saveLocation(locationID) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function deleteLocation(locationID) {
|
||||
if (locationID < 0)
|
||||
alert('Congratulations! You found the secret UI bug easter egg! This button should not be here, yet I left it specifically because I wanted an easter egg and not because of any other reasons! Good for you!')
|
||||
return;
|
||||
if (!confirm('Delete the selected location? If there are parts there, this will leave a mess in the database and Marek will be very sad.'))
|
||||
return;
|
||||
$.ajax({
|
||||
url: rootURL + 'deleteLocation/' + locationID,
|
||||
type: 'GET',
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function() {
|
||||
alert("location removed.");
|
||||
overlay_out();
|
||||
location.reload();
|
||||
},
|
||||
fail: function() {
|
||||
console.log('An error occurred while deleting the entry');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function end_edit(){
|
||||
//intentionally left blank
|
||||
}
|
||||
|
||||
|
||||
function show_location_info(locationID) {
|
||||
$.getJSON(rootURL + 'getpartinfo/' + partID, function(data) {
|
||||
$('table#details tr#location td p').text(text_filter(data.location_descriptor)); // name is the location friendly name
|
||||
$('#location-dropdown').val(data.location_id);
|
||||
$('#container-dropdown').val(data.container_id);
|
||||
$('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));
|
||||
container_onchange();
|
||||
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>'));
|
||||
$('#datasheet-input').val(data.datasheet);
|
||||
}
|
||||
else
|
||||
$('tr#datasheet-head td').text('DATASHEET: ');
|
||||
$('#edit-button').click(function() {
|
||||
init_edit(partID);
|
||||
});
|
||||
$('#delete-button').click(function() {
|
||||
delete_entry(partID);
|
||||
});
|
||||
overlay_in();
|
||||
}).fail(function() {
|
||||
console.log( "Fetching part info failed" );
|
||||
});
|
||||
}
|
||||
|
||||
function placeMarker(locationID){
|
||||
//temporarily not used
|
||||
var $img = $('#clickablemap');
|
||||
var currentClickPosX = event.pageX - $img.offset().left;
|
||||
var currentClickPosY = event.pageY - $img.offset().top;
|
||||
|
||||
+21
-7
@@ -2,6 +2,7 @@ html {
|
||||
background-color: #D7E2E2;
|
||||
color: #000F0F;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
font-size:large;
|
||||
}
|
||||
|
||||
body {
|
||||
@@ -26,7 +27,7 @@ h3 {
|
||||
color: #5E9292;
|
||||
text-align: center;
|
||||
padding: 12pt;
|
||||
font-size: 20pt;
|
||||
font-size: x-large;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
@@ -40,7 +41,7 @@ a {
|
||||
|
||||
input[type=text].search-bar {
|
||||
color: #404040;
|
||||
font-size: 20pt;
|
||||
font-size: x-large;
|
||||
padding: 5pt 8pt 5pt 8pt;
|
||||
margin-top: 8pt;
|
||||
margin-bottom: 8pt;
|
||||
@@ -162,11 +163,14 @@ div label input {
|
||||
color: #D7E2E2;
|
||||
display: none;
|
||||
height: 90%;
|
||||
left: 20%;
|
||||
padding: 0;
|
||||
position: fixed;
|
||||
margin:auto;
|
||||
left:0;
|
||||
right:0;
|
||||
top:0;
|
||||
width: 60%;
|
||||
min-width: 60%;
|
||||
width:900px;
|
||||
z-index: 201;
|
||||
border-radius: 2pt;
|
||||
text-align: center;
|
||||
@@ -289,7 +293,7 @@ table#results {
|
||||
table#results th {
|
||||
background-color: #226666;
|
||||
color: #D7E2E2;
|
||||
padding: 4pt;
|
||||
padding: 5pt;
|
||||
border-right: 2px solid #D7E2E2;
|
||||
border-left: 2px solid #D7E2E2;
|
||||
}
|
||||
@@ -322,7 +326,7 @@ table#results #docs {
|
||||
table#details {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 45%;
|
||||
width: 35%;
|
||||
margin-top: 4%;
|
||||
}
|
||||
|
||||
@@ -393,10 +397,20 @@ td p {
|
||||
right: 5%;
|
||||
/*margin-top: 4%;*/
|
||||
max-height: calc(90% - 42pt);
|
||||
max-width: 50%;
|
||||
max-width: 60%;
|
||||
}
|
||||
|
||||
.pinfo-input {
|
||||
display: none;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.nothidden{
|
||||
display: initial !important;
|
||||
}
|
||||
|
||||
.results-locations{
|
||||
max-width: 1000px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
Reference in New Issue
Block a user