cd /home/def/otb_billing || exit 1
set -e
STAMP="$(date +%Y%m%d-%H%M%S)"
cp templates/portal_dashboard.html "templates/portal_dashboard.html.bak.${STAMP}"
cp templates/portal/services_here.html "templates/portal/services_here.html.bak.${STAMP}"
cat > templates/portal_base.html <<'EOF'
{% block title %}Portal - OutsideTheBox{% endblock %}
{% block head_extra %}{% endblock %}
{% include "includes/site_nav.html" %}
{% block portal_content %}{% endblock %}
{% block scripts %}{% endblock %}
{% include "includes/otb_footer.html" %}
EOF
cat > templates/portal_dashboard.html <<'EOF'
{% extends "portal_base.html" %}
{% block title %}Client Dashboard - OutsideTheBox{% endblock %}
{% block portal_content %}
Total Invoices
{{ invoice_count }}
Invoices currently visible in your portal
Total Outstanding
{{ total_outstanding }}
Current unpaid balance
Total Paid
{{ total_paid }}
Payments already applied
Invoices
| Invoice |
Status |
Created |
Total |
Paid |
Outstanding |
{% for row in invoices %}
|
{{ row.invoice_number or ("INV-" ~ row.id) }}
|
{% set s = (row.status or "")|lower %}
{% if s == "paid" %}
{{ row.status }}
{% if row.payment_method_label %}
{{ row.payment_method_label }}
{% endif %}
{% elif s == "pending" %}
{{ row.status }}
{% elif s == "overdue" %}
{{ row.status }}
{% else %}
{{ row.status }}
{% endif %}
|
{{ row.created_at }} |
{{ row.total_amount }} |
{{ row.amount_paid }} |
{{ row.outstanding }} |
{% else %}
| No invoices available. |
{% endfor %}
{% endblock %}
{% block scripts %}
{% endblock %}
EOF
cat > templates/portal/services_here.html <<'EOF'
{% extends "portal_base.html" %}
{% block title %}Services - OutsideTheBox{% endblock %}
{% block portal_content %}
{% for service in services %}
{% endfor %}
{% endblock %}
EOF
sudo systemctl restart otb_billing.service
sudo systemctl status otb_billing.service --no-pager -l | sed -n '1,30p'