botui/ui/suite/admin/billing.html

777 lines
26 KiB
HTML

<section class="billing-dashboard">
<div class="billing-header">
<h1>Billing & Subscription</h1>
<p>Manage your organization's subscription, payment methods, and billing history</p>
</div>
<div class="billing-grid">
<div class="billing-card current-plan">
<div class="card-header">
<h2>Current Plan</h2>
<span class="plan-badge pro">Pro</span>
</div>
<div class="plan-details">
<div class="plan-price">
<span class="amount">$49</span>
<span class="period">/month</span>
</div>
<div class="plan-features">
<div class="feature-item">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
<span>50 team members</span>
</div>
<div class="feature-item">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
<span>20 bots</span>
</div>
<div class="feature-item">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
<span>50 GB storage</span>
</div>
<div class="feature-item">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
<span>500,000 API calls/month</span>
</div>
</div>
<div class="plan-renewal">
<span class="renewal-label">Next billing date:</span>
<span class="renewal-date" id="nextBillingDate">February 21, 2025</span>
</div>
</div>
<div class="plan-actions">
<button class="btn-primary" onclick="showUpgradeModal()">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<line x1="12" y1="19" x2="12" y2="5"></line>
<polyline points="5 12 12 5 19 12"></polyline>
</svg>
Upgrade Plan
</button>
<button class="btn-secondary" onclick="showCancelModal()">Cancel Subscription</button>
</div>
</div>
<div class="billing-card usage-summary">
<div class="card-header">
<h2>Usage This Period</h2>
<span class="period-label">Jan 21 - Feb 21, 2025</span>
</div>
<div class="usage-items" hx-get="/api/billing/usage" hx-trigger="load" hx-swap="innerHTML">
<div class="usage-item">
<div class="usage-info">
<span class="usage-label">Storage</span>
<span class="usage-value">12.5 GB / 50 GB</span>
</div>
<div class="usage-bar">
<div class="usage-fill" style="width: 25%"></div>
</div>
</div>
<div class="usage-item">
<div class="usage-info">
<span class="usage-label">API Calls</span>
<span class="usage-value">125,000 / 500,000</span>
</div>
<div class="usage-bar">
<div class="usage-fill" style="width: 25%"></div>
</div>
</div>
<div class="usage-item">
<div class="usage-info">
<span class="usage-label">Messages</span>
<span class="usage-value">45,000 / 100,000</span>
</div>
<div class="usage-bar">
<div class="usage-fill" style="width: 45%"></div>
</div>
</div>
<div class="usage-item">
<div class="usage-info">
<span class="usage-label">Team Members</span>
<span class="usage-value">12 / 50</span>
</div>
<div class="usage-bar">
<div class="usage-fill" style="width: 24%"></div>
</div>
</div>
</div>
</div>
<div class="billing-card payment-method">
<div class="card-header">
<h2>Payment Method</h2>
<button class="btn-icon" onclick="showAddPaymentModal()">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" fill="none">
<line x1="12" y1="5" x2="12" y2="19"></line>
<line x1="5" y1="12" x2="19" y2="12"></line>
</svg>
</button>
</div>
<div class="payment-methods" hx-get="/api/billing/payment-methods" hx-trigger="load" hx-swap="innerHTML">
<div class="payment-card active">
<div class="card-brand">
<svg viewBox="0 0 24 24" width="32" height="32" stroke="currentColor" stroke-width="1.5" fill="none">
<rect x="1" y="4" width="22" height="16" rx="2" ry="2"></rect>
<line x1="1" y1="10" x2="23" y2="10"></line>
</svg>
</div>
<div class="card-details">
<span class="card-number">•••• •••• •••• 4242</span>
<span class="card-expiry">Expires 12/2026</span>
</div>
<span class="default-badge">Default</span>
</div>
</div>
</div>
<div class="billing-card billing-address">
<div class="card-header">
<h2>Billing Address</h2>
<button class="btn-icon" onclick="showEditAddressModal()">
<svg viewBox="0 0 24 24" width="18" height="18" stroke="currentColor" stroke-width="2" fill="none">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path>
</svg>
</button>
</div>
<div class="address-content" hx-get="/api/billing/address" hx-trigger="load" hx-swap="innerHTML">
<p class="address-name">Acme Corporation</p>
<p class="address-line">123 Business Street</p>
<p class="address-line">Suite 456</p>
<p class="address-line">San Francisco, CA 94102</p>
<p class="address-line">United States</p>
</div>
</div>
</div>
<div class="billing-section">
<div class="section-header">
<h2>Billing History</h2>
<button class="btn-secondary" onclick="exportInvoices()">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
Export All
</button>
</div>
<div class="billing-table-container">
<table class="billing-table" hx-get="/api/billing/invoices" hx-trigger="load" hx-swap="innerHTML">
<thead>
<tr>
<th>Invoice</th>
<th>Date</th>
<th>Amount</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="invoice-number">INV-2025-0001</span>
</td>
<td>Jan 21, 2025</td>
<td>$49.00</td>
<td><span class="status-badge paid">Paid</span></td>
<td>
<button class="btn-icon" title="Download Invoice">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
</button>
<button class="btn-icon" title="View Details">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
</button>
</td>
</tr>
<tr>
<td>
<span class="invoice-number">INV-2024-0012</span>
</td>
<td>Dec 21, 2024</td>
<td>$49.00</td>
<td><span class="status-badge paid">Paid</span></td>
<td>
<button class="btn-icon" title="Download Invoice">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
</button>
<button class="btn-icon" title="View Details">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
</button>
</td>
</tr>
<tr>
<td>
<span class="invoice-number">INV-2024-0011</span>
</td>
<td>Nov 21, 2024</td>
<td>$49.00</td>
<td><span class="status-badge paid">Paid</span></td>
<td>
<button class="btn-icon" title="Download Invoice">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
</button>
<button class="btn-icon" title="View Details">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<dialog id="upgradeModal" class="billing-modal">
<div class="modal-content">
<div class="modal-header">
<h2>Upgrade Your Plan</h2>
<button class="btn-close" onclick="closeModal('upgradeModal')">
<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<div class="plan-grid">
<div class="plan-option">
<div class="plan-name">Pro</div>
<div class="plan-price">$49<span>/mo</span></div>
<div class="plan-current">Current Plan</div>
</div>
<div class="plan-option recommended">
<div class="recommended-badge">Recommended</div>
<div class="plan-name">Business</div>
<div class="plan-price">$99<span>/mo</span></div>
<ul class="plan-highlights">
<li>200 team members</li>
<li>100 bots</li>
<li>200 GB storage</li>
<li>Priority support</li>
</ul>
<button class="btn-primary" hx-post="/api/billing/upgrade" hx-vals='{"plan": "business"}'>
Upgrade to Business
</button>
</div>
<div class="plan-option">
<div class="plan-name">Enterprise</div>
<div class="plan-price">Custom</div>
<ul class="plan-highlights">
<li>Unlimited everything</li>
<li>Dedicated support</li>
<li>Custom integrations</li>
<li>SLA guarantee</li>
</ul>
<button class="btn-secondary" onclick="contactSales()">Contact Sales</button>
</div>
</div>
<div class="proration-notice">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none">
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="16" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12.01" y2="8"></line>
</svg>
<span>Your next invoice will be prorated based on your remaining billing period.</span>
</div>
</div>
</div>
</dialog>
<dialog id="cancelModal" class="billing-modal">
<div class="modal-content">
<div class="modal-header">
<h2>Cancel Subscription</h2>
<button class="btn-close" onclick="closeModal('cancelModal')">
<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="modal-body">
<div class="cancel-warning">
<svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" stroke-width="1.5" fill="none">
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path>
<line x1="12" y1="9" x2="12" y2="13"></line>
<line x1="12" y1="17" x2="12.01" y2="17"></line>
</svg>
<h3>We're sorry to see you go!</h3>
<p>Before you cancel, would you like to consider any of these options?</p>
</div>
<div class="retention-offers" hx-get="/api/billing/retention-offers" hx-trigger="load" hx-swap="innerHTML">
<div class="retention-offer">
<div class="offer-icon">💰</div>
<div class="offer-details">
<h4>Get 25% off for 3 months</h4>
<p>Stay with us at a reduced rate</p>
</div>
<button class="btn-secondary" hx-post="/api/billing/accept-offer" hx-vals='{"offer": "discount_25"}'>
Accept Offer
</button>
</div>
<div class="retention-offer">
<div class="offer-icon">⏸️</div>
<div class="offer-details">
<h4>Pause your subscription</h4>
<p>Take a break for up to 3 months</p>
</div>
<button class="btn-secondary" hx-post="/api/billing/pause">
Pause Instead
</button>
</div>
<div class="retention-offer">
<div class="offer-icon">📉</div>
<div class="offer-details">
<h4>Downgrade to a smaller plan</h4>
<p>Keep essential features at a lower cost</p>
</div>
<button class="btn-secondary" onclick="showDowngradeOptions()">
View Plans
</button>
</div>
</div>
<form class="cancel-form" hx-post="/api/billing/cancel" hx-confirm="Are you sure you want to cancel your subscription?">
<div class="form-group">
<label>Why are you cancelling?</label>
<select name="reason" required>
<option value="">Select a reason...</option>
<option value="too_expensive">Too expensive</option>
<option value="missing_features">Missing features I need</option>
<option value="not_using">Not using it enough</option>
<option value="switching">Switching to another product</option>
<option value="temporary">Temporary - will be back</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-group">
<label>Additional feedback (optional)</label>
<textarea name="feedback" rows="3" placeholder="Help us improve..."></textarea>
</div>
<div class="cancel-actions">
<button type="button" class="btn-secondary" onclick="closeModal('cancelModal')">Keep Subscription</button>
<button type="submit" class="btn-danger">Cancel Subscription</button>
</div>
</form>
</div>
</div>
</dialog>
<style>
.billing-dashboard {
padding: 24px;
max-width: 1400px;
margin: 0 auto;
}
.billing-header {
margin-bottom: 32px;
}
.billing-header h1 {
font-size: 28px;
font-weight: 600;
margin: 0 0 8px 0;
color: var(--text-primary);
}
.billing-header p {
color: var(--text-secondary);
margin: 0;
}
.billing-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 24px;
margin-bottom: 32px;
}
.billing-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 24px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.card-header h2 {
font-size: 18px;
font-weight: 600;
margin: 0;
color: var(--text-primary);
}
.plan-badge {
padding: 4px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
}
.plan-badge.pro {
background: var(--accent-color);
color: white;
}
.plan-price {
margin-bottom: 20px;
}
.plan-price .amount {
font-size: 48px;
font-weight: 700;
color: var(--text-primary);
}
.plan-price .period {
font-size: 16px;
color: var(--text-secondary);
}
.plan-features {
margin-bottom: 20px;
}
.feature-item {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 0;
color: var(--text-secondary);
}
.feature-item svg {
color: var(--success-color);
}
.plan-renewal {
padding: 16px;
background: var(--bg-secondary);
border-radius: 8px;
margin-bottom: 20px;
}
.renewal-label {
color: var(--text-secondary);
font-size: 14px;
}
.renewal-date {
color: var(--text-primary);
font-weight: 600;
margin-left: 8px;
}
.plan-actions {
display: flex;
gap: 12px;
}
.usage-item {
margin-bottom: 16px;
}
.usage-item:last-child {
margin-bottom: 0;
}
.usage-info {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
}
.usage-label {
color: var(--text-secondary);
font-size: 14px;
}
.usage-value {
color: var(--text-primary);
font-size: 14px;
font-weight: 500;
}
.usage-bar {
height: 8px;
background: var(--bg-secondary);
border-radius: 4px;
overflow: hidden;
}
.usage-fill {
height: 100%;
background: var(--accent-color);
border-radius: 4px;
transition: width 0.3s ease;
}
.usage-fill.warning {
background: var(--warning-color);
}
.usage-fill.danger {
background: var(--danger-color);
}
.payment-card {
display: flex;
align-items: center;
gap: 16px;
padding: 16px;
background: var(--bg-secondary);
border-radius: 8px;
border: 2px solid transparent;
}
.payment-card.active {
border-color: var(--accent-color);
}
.card-brand svg {
color: var(--text-secondary);
}
.card-details {
flex: 1;
}
.card-number {
display: block;
font-weight: 600;
color: var(--text-primary);
}
.card-expiry {
font-size: 12px;
color: var(--text-secondary);
}
.default-badge {
font-size: 11px;
padding: 4px 8px;
background: var(--accent-color);
color: white;
border-radius: 4px;
}
.address-content p {
margin: 0 0 4px 0;
color: var(--text-secondary);
}
.address-name {
font-weight: 600;
color: var(--text-primary) !important;
}
.billing-section {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 24px;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.section-header h2 {
font-size: 18px;
font-weight: 600;
margin: 0;
color: var(--text-primary);
}
.billing-table {
width: 100%;
border-collapse: collapse;
}
.billing-table th,
.billing-table td {
padding: 12px 16px;
text-align: left;
border-bottom: 1px solid var(--border-color);
}
.billing-table th {
font-weight: 600;
color: var(--text-secondary);
font-size: 12px;
text-transform: uppercase;
}
.billing-table td {
color: var(--text-primary);
}
.invoice-number {
font-family: monospace;
font-weight: 500;
}
.status-badge {
display: inline-block;
padding: 4px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: 500;
}
.status-badge.paid {
background: var(--success-bg);
color: var(--success-color);
}
.status-badge.pending {
background: var(--warning-bg);
color: var(--warning-color);
}
.status-badge.failed {
background: var(--danger-bg);
color: var(--danger-color);
}
.btn-primary {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
background: var(--accent-color);
color: white;
border: none;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-primary:hover {
background: var(--accent-hover);
}
.btn-secondary {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
background: var(--bg-secondary);
color: var(--text-primary);
border: 1px solid var(--border-color);
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: background 0.2s;
}
.btn-secondary:hover {
background: var(--bg-hover);
}
.btn-danger {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 20px;
background: var(--danger-color);
color: white;
border: none;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
}
.btn-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background: none;
border: none;
border-radius: 6px;
cursor: pointer;
color: var(--text-secondary);
transition: background 0.2s;
}
.btn-icon:hover {
background: var(--bg-secondary);
color: var(--text-primary);
}
.billing-modal {
padding: 0;
border: none;
border-radius: 16px;
max-width: 800px;
width: 90%;
background: var(--card-bg);
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.billing-modal::backdrop {
background: rgba(0, 0, 0, 0.5);
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24px;
border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
margin: 0;
font-size: 20px;
color: var(--text-primary);
}
.btn-close {
background: none;
border: none;
cursor: pointer;
color: var(--text-secondary);
padding: 4px;
border-radius: 4px;