05/07 Phase 3: initial codes

This commit is contained in:
2026-05-07 12:17:19 -04:00
parent 6e5518c103
commit ce462c57b2
107 changed files with 6365 additions and 208 deletions
+62
View File
@@ -0,0 +1,62 @@
{% extends "tenant/layouts/base.html" %}
{% block title %}{{ 'Edit' if mode == 'edit' else 'New' }} Location{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card shadow-sm">
<div class="card-header fw-semibold">{{ 'Edit' if mode == 'edit' else 'New' }} Location</div>
<div class="card-body">
{% if error %}<div class="alert alert-danger py-2">{{ error }}</div>{% endif %}
<form method="POST" novalidate>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label class="form-label">Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" name="name"
value="{{ location.name if location else '' }}" required autofocus>
</div>
<div class="mb-3">
<label class="form-label">Address</label>
<input type="text" class="form-control" name="address"
value="{{ location.address if location else '' }}">
</div>
<div class="row g-2 mb-3">
<div class="col">
<label class="form-label">Phone</label>
<input type="tel" class="form-control" name="phone"
value="{{ location.phone if location else '' }}">
</div>
<div class="col">
<label class="form-label">Email</label>
<input type="email" class="form-control" name="email"
value="{{ location.email if location else '' }}">
</div>
</div>
<div class="mb-3">
<label class="form-label">Timezone</label>
<input type="text" class="form-control" name="timezone"
value="{{ location.timezone if location else 'America/New_York' }}">
</div>
{% if mode == 'edit' %}
<div class="mb-3 d-flex gap-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" name="is_active" value="1"
id="is_active" {{ 'checked' if location and location.is_active }}>
<label class="form-check-label" for="is_active">Active</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" name="is_primary" value="1"
id="is_primary" {{ 'checked' if location and location.is_primary }}>
<label class="form-check-label" for="is_primary">Set as Primary</label>
</div>
</div>
{% endif %}
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">Save</button>
<a href="{{ url_for('locations.index') }}" class="btn btn-outline-secondary">Cancel</a>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
+43
View File
@@ -0,0 +1,43 @@
{% extends "tenant/layouts/base.html" %}
{% block title %}Locations{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="fw-bold mb-0"><i class="bi bi-geo-alt me-2"></i>Locations</h4>
<a href="{{ url_for('locations.create') }}" class="btn btn-primary btn-sm">
<i class="bi bi-plus-lg me-1"></i>New Location
</a>
</div>
<div class="row g-3">
{% for loc in locations %}
<div class="col-md-6 col-lg-4">
<div class="card shadow-sm h-100 {{ '' if loc.is_active else 'opacity-50' }}">
<div class="card-header d-flex justify-content-between align-items-center">
<strong>{{ loc.name }}</strong>
<div>
{% if loc.is_primary %}<span class="badge bg-primary me-1">Primary</span>{% endif %}
<span class="badge {{ 'bg-success' if loc.is_active else 'bg-secondary' }}">{{ 'Active' if loc.is_active else 'Inactive' }}</span>
</div>
</div>
<div class="card-body small text-muted">
{% if loc.address %}<p class="mb-1"><i class="bi bi-map me-1"></i>{{ loc.address }}</p>{% endif %}
{% if loc.phone %}<p class="mb-1"><i class="bi bi-telephone me-1"></i>{{ loc.phone }}</p>{% endif %}
{% if loc.email %}<p class="mb-1"><i class="bi bi-envelope me-1"></i>{{ loc.email }}</p>{% endif %}
<p class="mb-0"><i class="bi bi-clock me-1"></i>{{ loc.timezone }}</p>
</div>
<div class="card-footer d-flex gap-2">
<a href="{{ url_for('locations.edit', location_id=loc.id) }}" class="btn btn-outline-secondary btn-sm">Edit</a>
{% if not loc.is_primary %}
<form method="POST" action="{{ url_for('locations.set_primary', location_id=loc.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="btn btn-outline-primary btn-sm">Set Primary</button>
</form>
{% endif %}
<a href="{{ url_for('locations.switch', location_id=loc.id) }}" class="btn btn-outline-success btn-sm ms-auto">Switch</a>
</div>
</div>
</div>
{% else %}
<div class="col"><p class="text-muted">No locations found.</p></div>
{% endfor %}
</div>
{% endblock %}