Kushal commited on
Commit
26cce99
·
1 Parent(s): 6438f90

Fix: Finalize stabilized report templates and remove redundant admin logic on startup

Browse files
app/main.py CHANGED
@@ -51,30 +51,6 @@ async def startup_event():
51
  print("Initializing database...")
52
  init_db()
53
  print("Database initialized successfully!")
54
-
55
- # Check for ADMIN_EMAIL to grant admin privileges
56
- import os
57
- from sqlalchemy.orm import Session
58
- from app.database.connection import SessionLocal
59
- from app.database.models import User
60
-
61
- admin_email = os.environ.get('ADMIN_EMAIL')
62
- if admin_email:
63
- db = SessionLocal()
64
- try:
65
- print(f"Checking admin status for: {admin_email}")
66
- user = db.query(User).filter(User.email == admin_email).first()
67
- if user:
68
- if not user.is_admin:
69
- user.is_admin = 1
70
- db.commit()
71
- print(f"✅ User {admin_email} has been granted ADMIN privileges!")
72
- else:
73
- print(f"ℹ️ User {admin_email} is already an admin.")
74
- else:
75
- print(f"⚠️ User {admin_email} not found. Signup first to become admin.")
76
- finally:
77
- db.close()
78
 
79
 
80
  @app.on_event("shutdown")
 
51
  print("Initializing database...")
52
  init_db()
53
  print("Database initialized successfully!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
 
56
  @app.on_event("shutdown")
app/templates/investor-pitch-deck.html CHANGED
@@ -25,7 +25,7 @@
25
  margin-bottom: 25px;
26
  text-align: center;
27
  }
28
- .logo-title {
29
  font-size: 24pt;
30
  color: #2C4694;
31
  font-weight: bold;
@@ -46,12 +46,12 @@
46
  border-bottom: 1px solid #DCE3F2;
47
  padding-bottom: 5px;
48
  }
49
- .fact-table {
50
  width: 100%;
51
  border-collapse: collapse;
52
  margin-bottom: 20px;
53
  }
54
- .fact-table th {
55
  text-align: left;
56
  background-color: #fafbff;
57
  padding: 8px;
@@ -96,34 +96,34 @@
96
 
97
  <h2>Project Overview</h2>
98
  <table class="detail-table">
99
- <tr><th>Project Name</th><td><span class="editable" contenteditable="true" data-field="project_name">{{PROJECT_NAME}}</span></td></tr>
100
- <tr><th>Location</th><td><span class="editable" contenteditable="true" data-field="location">{{LOCATION}}</span></td></tr>
101
- <tr><th>Project Type</th><td><span class="editable" contenteditable="true" data-field="project_type">{{PROJECT_TYPE}}</span></td></tr>
102
- <tr><th>Investment Required</th><td><span class="editable" contenteditable="true" data-field="investment_required">{{INVESTMENT_REQUIRED}}</span></td></tr>
103
- <tr><th>Expected Completion</th><td><span class="editable" contenteditable="true" data-field="expected_completion">{{EXPECTED_COMPLETION}}</span></td></tr>
104
- <tr><th>Developer</th><td><span class="editable" contenteditable="true" data-field="developer_name">{{DEVELOPER_NAME}}</span></td></tr>
105
  </table>
106
 
107
- <h2>Market Opportunity <button class="ai-button" onclick="generateAI('market_opportunity')">✨ AI</button></h2>
108
  <div class="content-box">
109
- <div class="editable-content" contenteditable="true" data-field="market_opportunity">{{MARKET_OPPORTUNITY}}</div>
110
  </div>
111
 
112
  <h2>Financial Projections</h2>
113
- <ul class="finproj-list">
114
- <li><b>Projected ROI:</b> <span class="editable" contenteditable="true" data-field="roi_projection">{{ROI_PROJECTION}}</span></li>
115
- <li><b>Financial Summary:</b> <span class="editable" contenteditable="true" data-field="financial_summary">{{FINANCIAL_SUMMARY}}</span></li>
116
- </ul>
117
 
118
  <h2>Risk and Mitigation</h2>
119
- <ul class="risk-list">
120
- <li><b>Key Risks:</b> <span class="editable" contenteditable="true" data-field="risk_factors">{{RISK_FACTORS}}</span></li>
121
- <li><b>Mitigation Strategies:</b> <span class="editable" contenteditable="true" data-field="risk_mitigation">{{RISK_MITIGATION}}</span></li>
122
- </ul>
123
 
124
- <h2>Opportunity Summary <button class="ai-button" onclick="generateAI('summary')">✨ AI</button></h2>
125
  <div class="content-box">
126
- <div class="editable-content" contenteditable="true" data-field="summary">{{SUMMARY}}</div>
127
  </div>
128
 
129
  <div class="signoff">
@@ -131,39 +131,5 @@
131
  <div>— End of Pitch Deck —</div>
132
  </div>
133
  </div>
134
-
135
- <script>
136
- // Enable design mode for rich text editing
137
- document.addEventListener('DOMContentLoaded', function() {
138
- document.designMode = 'on';
139
-
140
- const editableElements = document.querySelectorAll('.editable, .editable-content');
141
-
142
- editableElements.forEach(element => {
143
- element.addEventListener('blur', function() {
144
- const field = this.getAttribute('data-field');
145
- const value = this.innerHTML || this.textContent;
146
- if (field) {
147
- window.parent.postMessage({
148
- type: 'updateField',
149
- field: field,
150
- value: value
151
- }, '*');
152
- }
153
- });
154
-
155
- element.addEventListener('keydown', function(e) {
156
- if (e.key === 'Enter' && !e.shiftKey && !this.classList.contains('editable-content')) {
157
- e.preventDefault();
158
- this.blur();
159
- }
160
- });
161
- });
162
- });
163
-
164
- function generateAI(field) {
165
- window.parent.postMessage({type: 'generateAI', field: field}, '*');
166
- }
167
- </script>
168
  </body>
169
  </html>
 
25
  margin-bottom: 25px;
26
  text-align: center;
27
  }
28
+ .main-title {
29
  font-size: 24pt;
30
  color: #2C4694;
31
  font-weight: bold;
 
46
  border-bottom: 1px solid #DCE3F2;
47
  padding-bottom: 5px;
48
  }
49
+ .detail-table {
50
  width: 100%;
51
  border-collapse: collapse;
52
  margin-bottom: 20px;
53
  }
54
+ .detail-table th {
55
  text-align: left;
56
  background-color: #fafbff;
57
  padding: 8px;
 
96
 
97
  <h2>Project Overview</h2>
98
  <table class="detail-table">
99
+ <tr><th>Project Name</th><td>{{PROJECT_NAME}}</td></tr>
100
+ <tr><th>Location</th><td>{{LOCATION}}</td></tr>
101
+ <tr><th>Project Type</th><td>{{PROJECT_TYPE}}</td></tr>
102
+ <tr><th>Investment Required</th><td>{{INVESTMENT_REQUIRED}}</td></tr>
103
+ <tr><th>Expected Completion</th><td>{{EXPECTED_COMPLETION}}</td></tr>
104
+ <tr><th>Developer</th><td>{{DEVELOPER_NAME}}</td></tr>
105
  </table>
106
 
107
+ <h2>Market Opportunity</h2>
108
  <div class="content-box">
109
+ <div>{{MARKET_OPPORTUNITY}}</div>
110
  </div>
111
 
112
  <h2>Financial Projections</h2>
113
+ <div class="finproj-list">
114
+ <div><b>Projected ROI:</b> {{ROI_PROJECTION}}</div>
115
+ <div><b>Financial Summary:</b> {{FINANCIAL_SUMMARY}}</div>
116
+ </div>
117
 
118
  <h2>Risk and Mitigation</h2>
119
+ <div class="risk-list">
120
+ <div><b>Key Risks:</b> {{RISK_FACTORS}}</div>
121
+ <div><b>Mitigation Strategies:</b> {{RISK_MITIGATION}}</div>
122
+ </div>
123
 
124
+ <h2>Opportunity Summary</h2>
125
  <div class="content-box">
126
+ <div>{{SUMMARY}}</div>
127
  </div>
128
 
129
  <div class="signoff">
 
131
  <div>— End of Pitch Deck —</div>
132
  </div>
133
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  </body>
135
  </html>
app/templates/legal-compliance.html CHANGED
@@ -6,150 +6,73 @@
6
  <style>
7
  @page {
8
  size: A4;
9
- margin: 1in;
10
- @bottom-center {
11
- content: "Generated by Builders.ai • Page " counter(page);
12
- font-style: italic;
13
- font-size: 0.95em;
14
- color: #888;
15
- }
16
- }
17
- html, body {
18
- height: 100%;
19
- font-family: 'Segoe UI', 'DejaVu Sans', Arial, sans-serif;
20
- background: #f6f8fa;
21
  }
22
  body {
23
- margin: 0;
24
- padding: 0;
25
- background: #f6f8fa;
 
 
26
  }
27
  .report-wrapper {
28
- max-width: 900px;
29
- margin: 0 auto;
30
- background: #fff;
31
- border-radius: 8px;
32
- box-shadow: 0 1px 4px rgba(50,80,150,0.1);
33
- padding: 40px 60px 30px 60px;
34
  }
35
  .header {
36
  border-bottom: 2px solid #2C4694;
37
- padding-bottom: 18px;
38
- margin-bottom: 30px;
39
  text-align: center;
40
  }
41
  .logo-title {
42
- font-size: 2.2em;
43
  color: #2C4694;
44
  font-weight: bold;
45
- margin-bottom: 4px;
46
  }
47
  .subtitle {
48
  color: #7087B1;
49
- font-size: 1.08em;
50
- font-weight: 500;
51
  }
52
  .report-date {
53
  color: #434343;
54
- font-size: 1em;
55
- margin-top: 10px;
56
  font-style: italic;
57
  }
58
  h2 {
59
  color: #2C4694;
60
- font-size: 1.22em;
61
- margin-top: 2.3em;
62
- text-transform: uppercase;
63
- border-bottom: 1.5px solid #DCE3F2;
64
- padding-bottom: 1.5px;
65
- letter-spacing: 0.04em;
66
  }
67
  .fact-table {
68
- margin: 1.5em 0 2em 0;
69
  width: 100%;
70
  border-collapse: collapse;
71
- }
72
- .fact-table th, .fact-table td {
73
- padding: 10px 16px 10px 0;
74
- vertical-align: top;
75
  }
76
  .fact-table th {
77
  text-align: left;
78
- color: #32345a;
79
- background: #fafbff;
80
- font-weight: 600;
81
- border-right: 2px solid #f2f3f7;
82
- min-width: 160px;
83
  }
84
  .fact-table td {
85
- color: #25334d;
 
86
  }
87
  .content-box {
88
- padding: 18px 22px;
89
- margin-top: 0.7em;
90
- border-radius: 6px;
91
- border: 1.5px solid #e1e9f7;
92
- background: #f7fafd;
93
- font-size: 1.06em;
94
- color: #283D51;
95
- line-height: 1.55;
96
  }
97
  .signoff {
98
- margin-top: 3.5em;
99
  text-align: right;
100
  color: #7087B1;
101
- }
102
-
103
- /* Editable styles */
104
- .editable {
105
- border: 2px dashed transparent;
106
- padding: 2px 4px;
107
- border-radius: 4px;
108
- cursor: text;
109
- transition: all 0.2s;
110
- min-height: 1.2em;
111
- display: inline-block;
112
- min-width: 50px;
113
- }
114
- .editable:hover {
115
- border-color: #2C4694;
116
- background-color: rgba(44, 70, 148, 0.05);
117
- }
118
- .editable:focus {
119
- outline: none;
120
- border-color: #2C4694;
121
- background-color: rgba(44, 70, 148, 0.1);
122
- }
123
- .editable-content {
124
- border: 2px dashed transparent;
125
- padding: 4px;
126
- border-radius: 4px;
127
- cursor: text;
128
- transition: all 0.2s;
129
- min-height: 2em;
130
- }
131
- .editable-content:hover {
132
- border-color: #2C4694;
133
- background-color: rgba(44, 70, 148, 0.05);
134
- }
135
- .editable-content:focus {
136
- outline: none;
137
- border-color: #2C4694;
138
- background-color: rgba(44, 70, 148, 0.1);
139
- }
140
- .ai-button {
141
- background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
142
- color: white;
143
- border: none;
144
- padding: 4px 8px;
145
- border-radius: 4px;
146
- font-size: 10px;
147
- cursor: pointer;
148
- margin-left: 8px;
149
- font-weight: bold;
150
- }
151
- .ai-button:hover {
152
- transform: scale(1.05);
153
  }
154
  </style>
155
  </head>
@@ -163,31 +86,31 @@
163
 
164
  <h2>Project Information</h2>
165
  <table class="fact-table">
166
- <tr><th>Property Name</th><td><span class="editable" contenteditable="true" data-field="property_name">{{PROPERTY_NAME}}</span></td></tr>
167
- <tr><th>Location</th><td><span class="editable" contenteditable="true" data-field="location">{{LOCATION}}</span></td></tr>
168
- <tr><th>Construction Type</th><td><span class="editable" contenteditable="true" data-field="construction_type">{{CONSTRUCTION_TYPE}}</span></td></tr>
169
- <tr><th>Developer</th><td><span class="editable" contenteditable="true" data-field="developer_name">{{DEVELOPER_NAME}}</span></td></tr>
170
- <tr><th>Legal Clearance Status</th><td><span class="editable" contenteditable="true" data-field="legal_clearance">{{LEGAL_CLEARANCE}}</span></td></tr>
171
  </table>
172
 
173
- <h2>Legal Compliance Analysis <button class="ai-button" onclick="generateAI('legal_notes')">✨ AI</button></h2>
174
  <div class="content-box">
175
- <div class="editable-content" contenteditable="true" data-field="legal_notes">{{LEGAL_NOTES}}</div>
176
  </div>
177
 
178
- <h2>Regulatory Requirements <button class="ai-button" onclick="generateAI('regulatory_requirements')">✨ AI</button></h2>
179
  <div class="content-box">
180
- <div class="editable-content" contenteditable="true" data-field="regulatory_requirements">{{REGULATORY_REQUIREMENTS}}</div>
181
  </div>
182
 
183
- <h2>Risk Assessment <button class="ai-button" onclick="generateAI('risk_assessment')">✨ AI</button></h2>
184
  <div class="content-box">
185
- <div class="editable-content" contenteditable="true" data-field="risk_assessment">{{RISK_ASSESSMENT}}</div>
186
  </div>
187
 
188
- <h2>Recommendations <button class="ai-button" onclick="generateAI('recommendations')">✨ AI</button></h2>
189
  <div class="content-box">
190
- <div class="editable-content" contenteditable="true" data-field="recommendations">{{RECOMMENDATIONS}}</div>
191
  </div>
192
 
193
  <div class="signoff">
@@ -195,39 +118,5 @@
195
  <div>— End of Legal Report —</div>
196
  </div>
197
  </div>
198
-
199
- <script>
200
- // Enable design mode for rich text editing
201
- document.addEventListener('DOMContentLoaded', function() {
202
- document.designMode = 'on';
203
-
204
- const editableElements = document.querySelectorAll('.editable, .editable-content');
205
-
206
- editableElements.forEach(element => {
207
- element.addEventListener('blur', function() {
208
- const field = this.getAttribute('data-field');
209
- const value = this.innerHTML || this.textContent;
210
- if (field) {
211
- window.parent.postMessage({
212
- type: 'updateField',
213
- field: field,
214
- value: value
215
- }, '*');
216
- }
217
- });
218
-
219
- element.addEventListener('keydown', function(e) {
220
- if (e.key === 'Enter' && !e.shiftKey && !this.classList.contains('editable-content')) {
221
- e.preventDefault();
222
- this.blur();
223
- }
224
- });
225
- });
226
- });
227
-
228
- function generateAI(field) {
229
- window.parent.postMessage({type: 'generateAI', field: field}, '*');
230
- }
231
- </script>
232
  </body>
233
  </html>
 
6
  <style>
7
  @page {
8
  size: A4;
9
+ margin: 2cm;
 
 
 
 
 
 
 
 
 
 
 
10
  }
11
  body {
12
+ font-family: Arial, Helvetica, sans-serif;
13
+ background-color: #ffffff;
14
+ color: #25334d;
15
+ font-size: 11pt;
16
+ line-height: 1.5;
17
  }
18
  .report-wrapper {
19
+ width: 100%;
20
+ background: #ffffff;
 
 
 
 
21
  }
22
  .header {
23
  border-bottom: 2px solid #2C4694;
24
+ padding-bottom: 15px;
25
+ margin-bottom: 25px;
26
  text-align: center;
27
  }
28
  .logo-title {
29
+ font-size: 24pt;
30
  color: #2C4694;
31
  font-weight: bold;
 
32
  }
33
  .subtitle {
34
  color: #7087B1;
35
+ font-size: 12pt;
 
36
  }
37
  .report-date {
38
  color: #434343;
39
+ font-size: 10pt;
 
40
  font-style: italic;
41
  }
42
  h2 {
43
  color: #2C4694;
44
+ font-size: 14pt;
45
+ margin-top: 25px;
46
+ border-bottom: 1px solid #DCE3F2;
47
+ padding-bottom: 5px;
 
 
48
  }
49
  .fact-table {
 
50
  width: 100%;
51
  border-collapse: collapse;
52
+ margin-bottom: 20px;
 
 
 
53
  }
54
  .fact-table th {
55
  text-align: left;
56
+ background-color: #fafbff;
57
+ padding: 8px;
58
+ border: 1px solid #f2f3f7;
59
+ width: 35%;
 
60
  }
61
  .fact-table td {
62
+ padding: 8px;
63
+ border: 1px solid #f2f3f7;
64
  }
65
  .content-box {
66
+ padding: 15px;
67
+ margin-top: 10px;
68
+ border: 1px solid #e1e9f7;
69
+ background-color: #f7fafd;
 
 
 
 
70
  }
71
  .signoff {
72
+ margin-top: 40px;
73
  text-align: right;
74
  color: #7087B1;
75
+ font-size: 10pt;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
  </style>
78
  </head>
 
86
 
87
  <h2>Project Information</h2>
88
  <table class="fact-table">
89
+ <tr><th>Property Name</th><td>{{PROPERTY_NAME}}</td></tr>
90
+ <tr><th>Location</th><td>{{LOCATION}}</td></tr>
91
+ <tr><th>Construction Type</th><td>{{CONSTRUCTION_TYPE}}</td></tr>
92
+ <tr><th>Developer</th><td>{{DEVELOPER_NAME}}</td></tr>
93
+ <tr><th>Legal Clearance Status</th><td>{{LEGAL_CLEARANCE}}</td></tr>
94
  </table>
95
 
96
+ <h2>Legal Compliance Analysis</h2>
97
  <div class="content-box">
98
+ <div>{{LEGAL_NOTES}}</div>
99
  </div>
100
 
101
+ <h2>Regulatory Requirements</h2>
102
  <div class="content-box">
103
+ <div>{{REGULATORY_REQUIREMENTS}}</div>
104
  </div>
105
 
106
+ <h2>Risk Assessment</h2>
107
  <div class="content-box">
108
+ <div>{{RISK_ASSESSMENT}}</div>
109
  </div>
110
 
111
+ <h2>Recommendations</h2>
112
  <div class="content-box">
113
+ <div>{{RECOMMENDATIONS}}</div>
114
  </div>
115
 
116
  <div class="signoff">
 
118
  <div>— End of Legal Report —</div>
119
  </div>
120
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  </body>
122
  </html>
app/templates/property-evaluation.html CHANGED
@@ -99,22 +99,22 @@
99
  <tr><th>Nearby Facilities</th><td><span class="editable" contenteditable="true" data-field="nearby_facilities">{{NEARBY_FACILITIES}}</span></td></tr>
100
  </table>
101
 
102
- <h2>Project Summary <button class="ai-button" onclick="generateAI('summary')">✨ AI</button></h2>
103
  <div class="content-box">
104
  <div class="editable-content" contenteditable="true" data-field="summary">{{SUMMARY}}</div>
105
  </div>
106
 
107
- <h2>AI Recommendations <button class="ai-button" onclick="generateAI('recommendations')">✨ AI</button></h2>
108
  <div class="content-box">
109
  <div class="editable-content" contenteditable="true" data-field="recommendations">{{RECOMMENDATIONS}}</div>
110
  </div>
111
 
112
- <h2>Legal / Policy Notes <button class="ai-button" onclick="generateAI('legal_notes')">✨ AI</button></h2>
113
  <div class="content-box">
114
  <div class="editable-content" contenteditable="true" data-field="legal_notes">{{LEGAL_NOTES}}</div>
115
  </div>
116
 
117
- <h2>Final Observations <button class="ai-button" onclick="generateAI('additional_notes')">✨ AI</button></h2>
118
  <div class="content-box">
119
  <div class="editable-content" contenteditable="true" data-field="additional_notes">{{ADDITIONAL_NOTES}}</div>
120
  </div>
@@ -125,38 +125,5 @@
125
  </div>
126
  </div>
127
 
128
- <script>
129
- // Enable design mode for rich text editing
130
- document.addEventListener('DOMContentLoaded', function() {
131
- document.designMode = 'on';
132
-
133
- const editableElements = document.querySelectorAll('.editable, .editable-content');
134
-
135
- editableElements.forEach(element => {
136
- element.addEventListener('blur', function() {
137
- const field = this.getAttribute('data-field');
138
- const value = this.innerHTML || this.textContent;
139
- if (field) {
140
- window.parent.postMessage({
141
- type: 'updateField',
142
- field: field,
143
- value: value
144
- }, '*');
145
- }
146
- });
147
-
148
- element.addEventListener('keydown', function(e) {
149
- if (e.key === 'Enter' && !e.shiftKey && !this.classList.contains('editable-content')) {
150
- e.preventDefault();
151
- this.blur();
152
- }
153
- });
154
- });
155
- });
156
-
157
- function generateAI(field) {
158
- window.parent.postMessage({type: 'generateAI', field: field}, '*');
159
- }
160
- </script>
161
  </body>
162
  </html>
 
99
  <tr><th>Nearby Facilities</th><td><span class="editable" contenteditable="true" data-field="nearby_facilities">{{NEARBY_FACILITIES}}</span></td></tr>
100
  </table>
101
 
102
+ <h2>Project Summary</h2>
103
  <div class="content-box">
104
  <div class="editable-content" contenteditable="true" data-field="summary">{{SUMMARY}}</div>
105
  </div>
106
 
107
+ <h2>AI Recommendations</h2>
108
  <div class="content-box">
109
  <div class="editable-content" contenteditable="true" data-field="recommendations">{{RECOMMENDATIONS}}</div>
110
  </div>
111
 
112
+ <h2>Legal / Policy Notes</h2>
113
  <div class="content-box">
114
  <div class="editable-content" contenteditable="true" data-field="legal_notes">{{LEGAL_NOTES}}</div>
115
  </div>
116
 
117
+ <h2>Final Observations</h2>
118
  <div class="content-box">
119
  <div class="editable-content" contenteditable="true" data-field="additional_notes">{{ADDITIONAL_NOTES}}</div>
120
  </div>
 
125
  </div>
126
  </div>
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  </body>
129
  </html>