58 lines
2.6 KiB
Python
58 lines
2.6 KiB
Python
from flask_wtf import FlaskForm
|
|
from wtforms import StringField, IntegerField, SelectField, TextAreaField, SubmitField
|
|
from wtforms.validators import DataRequired, NumberRange, Length, Optional
|
|
|
|
class ClassroomForm(FlaskForm):
|
|
code = StringField('Classroom Code', validators=[
|
|
DataRequired(),
|
|
Length(min=2, max=20, message='Code must be between 2 and 20 characters')
|
|
])
|
|
name = StringField('Classroom Name', validators=[
|
|
DataRequired(),
|
|
Length(max=100)
|
|
])
|
|
building = StringField('Building', validators=[
|
|
DataRequired(),
|
|
Length(max=50)
|
|
])
|
|
floor = IntegerField('Floor', validators=[
|
|
DataRequired(),
|
|
NumberRange(min=1, max=10)
|
|
])
|
|
capacity = IntegerField('Capacity', validators=[
|
|
DataRequired(),
|
|
NumberRange(min=1, max=200)
|
|
])
|
|
description = TextAreaField('Description', validators=[Optional(), Length(max=500)])
|
|
campus_location = SelectField('Campus Location',
|
|
choices=[
|
|
('Main Campus', 'Main Campus'),
|
|
('North Campus', 'North Campus'),
|
|
('Science & Technology Campus', 'Science & Technology Campus'),
|
|
('Downtown Campus', 'Downtown Campus')
|
|
],
|
|
validators=[DataRequired()])
|
|
submit = SubmitField('Save Classroom')
|
|
|
|
class ClassroomResourceForm(FlaskForm):
|
|
resource_type = SelectField('Resource Type',
|
|
choices=[
|
|
('PROJECTOR', 'Projector'),
|
|
('WHITEBOARD', 'Whiteboard'),
|
|
('SMART_BOARD', 'Smart Board'),
|
|
('SCREEN', 'Screen'),
|
|
('AUDIO_SYSTEM', 'Audio System'),
|
|
('COMPUTERS', 'Computers'),
|
|
('LAB_EQUIPMENT', 'Lab Equipment'),
|
|
('AIR_CONDITIONING', 'Air Conditioning'),
|
|
('HEATING', 'Heating')
|
|
],
|
|
validators=[DataRequired()])
|
|
brand = StringField('Brand', validators=[Optional(), Length(max=100)])
|
|
model = StringField('Model', validators=[Optional(), Length(max=100)])
|
|
specifications = TextAreaField('Specifications', validators=[Optional(), Length(max=1000)])
|
|
quantity = IntegerField('Quantity', validators=[
|
|
DataRequired(),
|
|
NumberRange(min=1, max=50)
|
|
], default=1)
|
|
submit = SubmitField('Add Resource') |