keneek's picture
damn that is ugly
97bf599 verified
Raw History Blame Contribute Delete
25.3 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PermitZIP Proposal Wizard</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/jspdf@latest/dist/jspdf.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jspdf-autotable@latest/dist/jspdf.plugin.autotable.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js" defer></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#14532d',
secondary: '#22c55e',
}
}
}
}
</script>
<style>
[x-cloak] { display: none !important; }
.input-highlight {
box-shadow: 0 0 0 2px rgba(20, 83, 45, 0.2);
transition: all 0.2s ease;
}
.card-shadow {
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}
.table-row-hover:hover {
background-color: rgba(20, 83, 45, 0.02);
}
.header-gradient {
background: linear-gradient(135deg, #14532d 0%, #166534 100%);
}
.input-focus {
transition: all 0.2s ease;
}
.input-focus:focus {
border-color: #14532d;
box-shadow: 0 0 0 2px rgba(20, 83, 45, 0.2);
}
</style>
</head>
<body class="bg-gray-50">
<div x-data="proposalApp()" x-init="init()" x-cloak>
<!-- Header -->
<header class="header-gradient text-white shadow-sm">
<div class="container mx-auto px-4 py-5 flex items-center">
<div class="flex items-center space-x-3">
<i data-feather="file-text" class="w-7 h-7"></i>
<h1 class="text-2xl font-semibold tracking-tight">PermitZIP Proposal Builder</h1>
</div>
<div class="ml-auto flex space-x-3">
<button @click="resetForm()" class="px-4 py-2 border border-white/20 rounded-md text-white/90 hover:bg-white/10 transition flex items-center text-sm">
<i data-feather="refresh-cw" class="w-4 h-4 mr-2"></i> Reset
</button>
<button @click="generatePDF()" class="px-4 py-2 bg-white text-primary rounded-md hover:bg-gray-50 transition flex items-center text-sm font-medium">
<i data-feather="download" class="w-4 h-4 mr-2"></i> Generate PDF
</button>
</div>
</div>
</header>
<main class="container mx-auto px-4 py-8">
<!-- Client & Project Info -->
<div class="bg-white rounded-lg card-shadow p-6 mb-6">
<h2 class="text-lg font-semibold mb-4 text-gray-800 flex items-center">
<i data-feather="user" class="w-5 h-5 mr-2 text-primary"></i> Client & Project Information
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 class="font-medium text-gray-700 mb-2">Client Details</h3>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Company</label>
<input x-model="form.client.company" type="text" class="w-full px-3 py-2 border border-gray-200 rounded-md input-focus text-sm">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Contact Person</label>
<input x-model="form.client.contact" type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-secondary focus:border-transparent">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input x-model="form.client.email" type="email" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-secondary focus:border-transparent">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Phone</label>
<input x-model="form.client.phone" type="tel" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-secondary focus:border-transparent">
</div>
</div>
</div>
<div>
<h3 class="font-medium text-gray-700 mb-2">Project Details</h3>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Project Name</label>
<input x-model="form.project.name" type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-secondary focus:border-transparent">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Address</label>
<input x-model="form.project.address" type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-secondary focus:border-transparent">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Building Area (sq ft)</label>
<input x-model="form.buildingSF" type="number" min="0" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-secondary focus:border-transparent" @input="updateBuildingSF()">
</div>
</div>
</div>
</div>
</div>
<!-- Services Sections -->
<div class="space-y-6">
<!-- Base Fees -->
<div class="bg-white rounded-lg card-shadow overflow-hidden">
<div class="bg-gray-50 px-6 py-3 flex items-center justify-between border-b border-gray-100">
<h2 class="text-lg font-semibold text-gray-800 flex items-center">
<i data-feather="home" class="w-5 h-5 mr-2 text-primary"></i> Base Fees
</h2>
<span class="font-medium text-primary text-sm">Subtotal: <span class="font-semibold" x-text="formatCurrency(baseSubtotal)"></span></span>
</div>
<div class="p-6">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Service</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Unit</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Unit Price</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Qty</th>
<th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Subtotal</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-100">
<template x-for="item in catalog.filter(i => i.categoryId === 'base')" :key="item.id">
<tr class="table-row-hover">
<td class="px-6 py-3 text-sm font-medium text-gray-800" x-text="item.name"></td>
<td class="px-6 py-3 text-sm text-gray-500" x-text="item.unit"></td>
<td class="px-6 py-3 text-sm text-gray-500">
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-2 text-gray-400 text-sm">$</span>
<input
x-model="form.values[item.id].unitPrice"
type="number"
min="0"
step="0.01"
class="w-24 pl-6 pr-2 py-1 border border-gray-200 rounded input-focus text-sm"
@focus="highlightInput($event)"
@blur="unhighlightInput($event)"
>
</div>
</td>
<td class="px-6 py-3 text-sm text-gray-500">
<input
x-model="form.values[item.id].quantity"
type="number"
min="0"
class="w-20 px-2 py-1 border border-gray-200 rounded input-focus text-sm"
@focus="highlightInput($event)"
@blur="unhighlightInput($event)"
>
</td>
<td class="px-6 py-3 text-sm font-medium text-gray-900 text-right" x-text="formatCurrency(calculateLineSubtotal(item))"></td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</div>
<!-- Forensics Testing -->
<div class="bg-white rounded-xl shadow-md overflow-hidden">
<div class="bg-gray-100 px-6 py-3 flex items-center justify-between">
<h2 class="text-lg font-semibold text-gray-800">Forensics Testing</h2>
<span class="font-medium text-primary">Subtotal: <span x-text="formatCurrency(forensicsSubtotal)"></span></span>
</div>
<div class="p-6">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Item</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Unit</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Unit Price</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Quantity</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Subtotal</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<template x-for="item in catalog.filter(i => i.categoryId === 'forensics')" :key="item.id">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900" x-text="item.name"></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500" x-text="item.unit"></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<input
x-model="form.values[item.id].unitPrice"
type="number"
min="0"
step="0.01"
class="w-24 px-2 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-secondary"
@focus="highlightInput($event)"
@blur="unhighlightInput($event)"
>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<input
x-model="form.values[item.id].quantity"
type="number"
min="0"
class="w-20 px-2 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-secondary"
@focus="highlightInput($event)"
@blur="unhighlightInput($event)"
>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900" x-text="formatCurrency(calculateLineSubtotal(item))"></td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</div>
<!-- Reporting -->
<div class="bg-white rounded-xl shadow-md overflow-hidden">
<div class="bg-gray-100 px-6 py-3 flex items-center justify-between">
<h2 class="text-lg font-semibold text-gray-800">Reporting</h2>
<span class="font-medium text-primary">Subtotal: <span x-text="formatCurrency(reportingSubtotal)"></span></span>
</div>
<div class="p-6">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Item</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Unit</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Unit Price</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Quantity</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Subtotal</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<template x-for="item in catalog.filter(i => i.categoryId === 'reporting')" :key="item.id">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900" x-text="item.name"></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500" x-text="item.unit"></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<input
x-model="form.values[item.id].unitPrice"
type="number"
min="0"
step="0.01"
class="w-24 px-2 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-secondary"
@focus="highlightInput($event)"
@blur="unhighlightInput($event)"
>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<input
x-model="form.values[item.id].quantity"
type="number"
min="0"
class="w-20 px-2 py-1 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-secondary"
@focus="highlightInput($event)"
@blur="unhighlightInput($event)"
>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900" x-text="formatCurrency(calculateLineSubtotal(item))"></td>
</tr>
</template>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Totals Card -->
<div class="bg-white rounded-lg card-shadow p-6 mt-6">
<h2 class="text-lg font-semibold mb-4 text-gray-800 flex items-center">
<i data-feather="dollar-sign" class="w-5 h-5 mr-2 text-primary"></i> Proposal Summary
</h2>
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
<div class="bg-gray-50 p-4 rounded border border-gray-100">
<h3 class="text-xs font-medium text-gray-500 uppercase tracking-wider mb-1">Base Fees</h3>
<p class="text-xl font-semibold text-primary" x-text="formatCurrency(baseSubtotal)"></p>
</div>
<div class="bg-gray-50 p-4 rounded border border-gray-100">
<h3 class="text-xs font-medium text-gray-500 uppercase tracking-wider mb-1">Forensics</h3>
<p class="text-xl font-semibold text-primary" x-text="formatCurrency(forensicsSubtotal)"></p>
</div>
<div class="bg-gray-50 p-4 rounded border border-gray-100">
<h3 class="text-xs font-medium text-gray-500 uppercase tracking-wider mb-1">Reporting</h3>
<p class="text-xl font-semibold text-primary" x-text="formatCurrency(reportingSubtotal)"></p>
</div>
<div class="bg-primary/90 p-4 rounded border border-primary/20 text-white">
<h3 class="text-xs font-medium uppercase tracking-wider mb-1">Total Investment</h3>
<p class="text-xl font-bold" x-text="formatCurrency(grandTotal)"></p>
</div>
</div>
</div>
<!-- Footer -->
<div class="mt-8 text-center text-xs text-gray-400 py-4 border-t border-gray-100">
<p>PermitZIP Proposal Builder &copy; 2023</p>
</div>
<script>
function proposalApp() {
return {
form: {
client: {
company: '',
contact: '',
email: '',
phone: ''
},
project: {
name: '',
address: ''
},
buildingSF: 0,
values: {}
},
catalog: [],
init() {
feather.replace();
this.loadCatalog();
this.loadSavedData();
},
loadCatalog() {
// Catalog data will be loaded here
this.catalog = [
// Base Fees
{
id: "baseline",
categoryId: "base",
name: "Baseline Commissioning/Forensics",
unit: "Per square foot (or min.)",
defaultUnitPrice: 0.10,
defaultQuantity: 7000,
calc: { type: "qty" }
},
// Add other catalog items here...
];
// Initialize form values
this.catalog.forEach(item => {
this.form.values[item.id] = {
unitPrice: item.defaultUnitPrice,
quantity: item.defaultQuantity
};
});
},
loadSavedData() {
const savedData = localStorage.getItem('proposalData');
if (savedData) {
this.form = JSON.parse(savedData);
}
},
saveData() {
localStorage.setItem('proposalData', JSON.stringify(this.form));
},
formatCurrency(value) {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(value || 0);
},
calculateLineSubtotal(item) {
const v = this.form.values[item.id];
const unitPrice = v?.unitPrice ?? item.defaultUnitPrice;
const qty = v?.quantity ?? item.defaultQuantity;
if (item.calc?.type === "per_sf_min") {
const sf = this.form.buildingSF || 0;
const base = unitPrice * sf;
const min = item.calc.minFee ?? 0;
return Math.max(base, min);
}
return (unitPrice || 0) * (qty || 0);
},
get baseSubtotal() {
return this.catalog
.filter(item => item.categoryId === 'base')
.reduce((sum, item) => sum + this.calculateLineSubtotal(item), 0);
},
get forensicsSubtotal() {
return this.catalog
.filter(item => item.categoryId === 'forensics')
.reduce((sum, item) => sum + this.calculateLineSubtotal(item), 0);
},
get reportingSubtotal() {
return this.catalog
.filter(item => item.categoryId === 'reporting')
.reduce((sum, item) => sum + this.calculateLineSubtotal(item), 0);
},
get grandTotal() {
return this.baseSubtotal + this.forensicsSubtotal + this.reportingSubtotal;
},
updateBuildingSF() {
this.saveData();
},
resetForm() {
if (confirm('Are you sure you want to reset all values to defaults?')) {
this.loadCatalog();
this.saveData();
}
},
generatePDF() {
// PDF generation logic will go here
alert('PDF generation will be implemented here');
},
highlightInput(event) {
event.target.classList.add('input-highlight');
},
unhighlightInput(event) {
event.target.classList.remove('input-highlight');
}
}
}
</script>
</body>
</html>