102 lines
4.7 KiB
HTML
102 lines
4.7 KiB
HTML
{% extends "tenant/layouts/base.html" %}
|
|
{% block title %}Services & Products{% 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-card-list me-2"></i>Services & Products</h4>
|
|
<div class="d-flex gap-2">
|
|
<a href="{{ url_for('services.create_service') }}" class="btn btn-primary btn-sm">+ Service</a>
|
|
<a href="{{ url_for('services.create_product') }}" class="btn btn-outline-primary btn-sm">+ Product</a>
|
|
<a href="{{ url_for('services.create_promotion') }}" class="btn btn-outline-warning btn-sm">+ Promotion</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-3">
|
|
<div class="col-lg-6">
|
|
<div class="card shadow-sm">
|
|
<div class="card-header fw-semibold">Services</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-light"><tr><th>Name</th><th>Category</th><th>Duration</th><th>Price</th><th></th></tr></thead>
|
|
<tbody>
|
|
{% for s in services %}
|
|
<tr class="{{ '' if s.is_active else 'text-muted' }}">
|
|
<td class="fw-semibold">{{ s.name }}</td>
|
|
<td class="small">{{ s.category or '—' }}</td>
|
|
<td class="small">{{ s.duration_min }} min</td>
|
|
<td>${{ "%.2f"|format(s.price) }}</td>
|
|
<td>
|
|
<a href="{{ url_for('services.edit_service', service_id=s.id) }}" class="btn btn-outline-secondary btn-sm">Edit</a>
|
|
<form method="POST" action="{{ url_for('services.delete_service', service_id=s.id) }}" class="d-inline"
|
|
onsubmit="return confirm('Delete this service?')">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="btn btn-outline-danger btn-sm">Del</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="5" class="text-center text-muted py-3">No services yet.</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<div class="card shadow-sm">
|
|
<div class="card-header fw-semibold">Products</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-light"><tr><th>Name</th><th>SKU</th><th>Price</th><th></th></tr></thead>
|
|
<tbody>
|
|
{% for p in products %}
|
|
<tr class="{{ '' if p.is_active else 'text-muted' }}">
|
|
<td class="fw-semibold">{{ p.name }}</td>
|
|
<td class="small text-muted">{{ p.sku or '—' }}</td>
|
|
<td>${{ "%.2f"|format(p.sale_price) }}</td>
|
|
<td>
|
|
<a href="{{ url_for('services.edit_product', product_id=p.id) }}" class="btn btn-outline-secondary btn-sm">Edit</a>
|
|
<form method="POST" action="{{ url_for('services.delete_product', product_id=p.id) }}" class="d-inline"
|
|
onsubmit="return confirm('Delete this product?')">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="btn btn-outline-danger btn-sm">Del</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr><td colspan="4" class="text-center text-muted py-3">No products yet.</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{% if promotions %}
|
|
<div class="card shadow-sm mt-3 border-warning">
|
|
<div class="card-header fw-semibold bg-warning-subtle">Active Promotions</div>
|
|
<div class="table-responsive">
|
|
<table class="table table-sm mb-0">
|
|
<thead><tr><th>Name</th><th>Discount</th><th>Applies To</th><th>Ends</th><th></th></tr></thead>
|
|
<tbody>
|
|
{% for promo in promotions %}
|
|
<tr>
|
|
<td class="fw-semibold">{{ promo.name }}</td>
|
|
<td>{{ promo.discount_percent }}%</td>
|
|
<td class="small">{{ promo.applies_to }}</td>
|
|
<td class="small text-muted">{{ promo.ends_at.strftime('%Y-%m-%d') }}</td>
|
|
<td>
|
|
<form method="POST" action="{{ url_for('services.toggle_promotion', promo_id=promo.id) }}" class="d-inline">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="btn btn-outline-{{ 'danger' if promo.is_active else 'success' }} btn-sm">
|
|
{{ 'Deactivate' if promo.is_active else 'Activate' }}
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %} |