Skip to content
Snippets Groups Projects
Commit 209f4b3b authored by Marco De Donno's avatar Marco De Donno
Browse files

Add the button to delete a segmentation zone from a tenprint card

parent 6e998702
No related branches found
No related tags found
No related merge requests found
......@@ -205,7 +205,7 @@ button:focus {
#tenprint_zones_table {
display: grid;
grid-template-columns: auto repeat( 5, 1fr );
grid-template-columns: auto repeat( 5, 1fr ) auto;
grid-gap: 10px;
margin-top: 40px;
}
......
......@@ -2112,6 +2112,7 @@ def tp_template( id, t ):
card_id = id,
t = t,
datacolumns = datacolumns,
**config.misc
)
else:
......@@ -2143,6 +2144,25 @@ def update_zone_coordinates( id ):
else:
return abort( 403 )
@app.route( baseurl + '/template/tenprint/<id>/delete/zone', methods = [ "POST" ] )
@login_required
def delete_zone_coordinates( id ):
pc = request.form.get( "pc" )
try:
sql = "DELETE FROM tenprint_zones WHERE card = %s AND pc = %s"
config.db.query( sql, ( id, pc, ) )
config.db.commit()
return jsonify( {
'error': False
} )
except:
return jsonify( {
'error': True
} )
################################################################################
# Home page
......
......@@ -11,6 +11,19 @@
<script type="text/javascript" src="{{ url_for( 'send_app_files', path = 'functions.js' ) }}"></script>
<link type="text/css" rel="stylesheet" href="{{ url_for( 'send_app_files', path = 'app.css' ) }}">
<style type="text/css">
#tenprint_zones_table > div > a {
padding: 2px;
width: 16px;
height: 16px;
background: #d22e2a;
}
.ui-button .ui-icon,
.ui-button:hover .ui-icon {
background-image: url( {{ jquery_ui_white_bg_icons }} );
}
</style>
<script type="text/javascript">
baseurl = "{{ baseurl }}";
var start_f1_f5_button = false;
......@@ -209,6 +222,22 @@
}
}
}
var delete_zone = function( pc )
{
$.ajax( {
url: "{{ url_for( 'delete_zone_coordinates', id = card_id ) }}",
dataType: 'json',
method: 'POST',
data: {
pc: pc
},
success: function( data )
{
location.reload();
}
} );
}
</script>
</head>
<body class="icnml_main_layout">
......@@ -257,11 +286,12 @@
</div>
<div id="tenprint_zones_table">
<div></div>
<div>Top left x</div>
<div>Top left y</div>
<div>Bottom right x</div>
<div>Bottom right y</div>
<div>Rotation</div>
<div>TL x</div>
<div>TL y</div>
<div>BR x</div>
<div>BR y</div>
<div>Angle</div>
<div>Delete</div>
{% for zone in zones %}
<div id="icnml_zone_{{ zone[ 'pc' ] }}_name" style="padding-right: 20px">{{ zone[ 'pc_name' ] }}</div>
......@@ -281,6 +311,12 @@
<div id="icnml_zone_{{ zone[ 'pc' ] }}_angle">
<input class="tenprint_zones_table_input" value="{{ zone[ 'angle' ] }}" />
</div>
<div id="icnml_zone_{{ zone[ 'pc' ] }}_delete">
<a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="icnml_zone_{{ zone[ 'pc' ] }}_delete_button" role="button" aria-disabled="false">
<span class="ui-icon ui-icon-closethick"></span>
</a>
</div>
{% endfor %}
</div>
<div style="margin-top: 20px">
......@@ -461,6 +497,11 @@
update_zone_coordinates( "{{ zone[ 'pc' ] }}", "{{ d }}", $( this ).val() );
} );
{% endfor %}
$( "#icnml_zone_{{ zone[ 'pc' ] }}_delete_button" ).on( 'click', function()
{
delete_zone( "{{ zone[ 'pc' ] }}" );
} );
{% endfor %}
$( '#template_svg' ).on( 'mousemove', function( event )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment