diff --git a/app/forms.py b/app/forms.py index d551b35..f04d027 100644 --- a/app/forms.py +++ b/app/forms.py @@ -47,4 +47,7 @@ class ChangeInventoryItem(FlaskForm): item_owner = StringField(validators=[Length(max=64)]) item_contact = StringField(validators=[Length(max=64)]) # Allocation(s) - item_ip_allocations = StringField() \ No newline at end of file + item_ip_allocations = StringField() + # Others + item_notes = StringField() + \ No newline at end of file diff --git a/app/models.py b/app/models.py index cf6e222..0c67813 100644 --- a/app/models.py +++ b/app/models.py @@ -46,4 +46,6 @@ class Inventory(db.Model): host_owner = db.Column(db.String(64)) host_contact = db.Column(db.String(64)) ## Allocation(s) - host_allocations = db.Column(db.Text()) \ No newline at end of file + host_allocations = db.Column(db.Text()) + ### Others + host_notes = db.Column(db.Text()) \ No newline at end of file diff --git a/app/routes/r_inventory.py b/app/routes/r_inventory.py index 3ddde7c..f576c71 100644 --- a/app/routes/r_inventory.py +++ b/app/routes/r_inventory.py @@ -104,6 +104,7 @@ def item_view_modal(item_id): ('Owner',db_item.host_owner,'col-6'), ('Contact',db_item.host_contact,'col-6'), ('Allocations',db_item.host_allocations,'col-12'), + ('Notes',db_item.host_notes,'col-12'), ] return render_template('panel/_modal.html', modal=modal, item_id=item_id, informations=informations, old_page=request.args.get('page', type=int), pagination_active=True) @@ -175,6 +176,11 @@ def item_edit_modal(item_id): db_item.host_contact = form.item_contact.data else: db_item.host_contact = None + # Notes + if form.item_notes.data != '' and form.item_notes.data != 'None': + db_item.host_notes = form.item_notes.data + else: + db_item.host_notes = None # Allocations db_existing_allocs = Allocation.query.filter_by(device_id=db_item.id).all() @@ -219,6 +225,7 @@ def item_edit_modal(item_id): form.item_owner.default = db_item.host_owner form.item_contact.default = db_item.host_contact form.item_ip_allocations.default = db_item.host_allocations + form.item_notes.default = db_item.host_notes form.process() modal = { diff --git a/app/templates/panel/_modal.html b/app/templates/panel/_modal.html index 7b49fd3..1a0fac4 100644 --- a/app/templates/panel/_modal.html +++ b/app/templates/panel/_modal.html @@ -13,7 +13,12 @@
{% for entry in form %} {% if entry.id != 'csrf_token' %} - {% if entry.id == 'item_ip_allocations' %} + {% if entry.id == 'item_notes' %} +
+ {{ entry.label(class="form-label") }}
+ {{ entry(class="form-control",placeholder='Notes, EX : Patch Panel/Switch...') }} +
+ {% elif entry.id == 'item_ip_allocations' %}
{{ entry.label(class="form-label") }}
{{ entry(class="form-control",placeholder='192.168.1.1,192.168.1.2 (separate with ,)') }}