mirror of
				https://github.com/StefBuwalda/ProjectIOT.git
				synced 2025-10-30 19:29:57 +00:00 
			
		
		
		
	AT map frontend added
This commit is contained in:
		
							
								
								
									
										33
									
								
								AT_frontend/forms.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								AT_frontend/forms.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| from flask import Flask, render_template, redirect, url_for | ||||
| from flask_wtf import FlaskForm | ||||
| from wtforms import StringField, SubmitField, BooleanField | ||||
| from wtforms.validators import DataRequired | ||||
|  | ||||
| app = Flask(__name__) | ||||
| app.config['SECRET_KEY'] = 'mijngeheimesleutel' | ||||
|  | ||||
| class GateControlForm(FlaskForm): | ||||
|     open_gate = SubmitField('Open Gate') | ||||
|     close_gate = SubmitField('Close Gate') | ||||
|     debug_mode = BooleanField('Enable Debug Mode') | ||||
|     check_camera = SubmitField('Check Camera')  # New button to check camera status | ||||
|  | ||||
| class InputForm(FlaskForm): | ||||
|     name = StringField('Name', validators=[DataRequired()]) | ||||
|     submit = SubmitField('Submit') | ||||
|  | ||||
| @app.route('/', methods=['GET', 'POST']) | ||||
| def dashboard(): | ||||
|     gate_status = "Closed" | ||||
|     debug_mode = False | ||||
|     form = GateControlForm() | ||||
|     if form.validate_on_submit(): | ||||
|         if form.open_gate.data: | ||||
|             gate_status = "Open" | ||||
|         elif form.close_gate.data: | ||||
|             debug_mode = form.debug_mode.data | ||||
|         return render_template('dashboard.html', form=form, gate_status=gate_status, debug_mode=debug_mode) | ||||
|     return render_template('dashboard.html', form=form, gate_status=gate_status, debug_mode=debug_mode) | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     app.run(debug=True) | ||||
		Reference in New Issue
	
	Block a user
	 Anh-Thy04
					Anh-Thy04