This commit is contained in:
hailin 2024-10-29 00:55:42 +08:00
parent 8087eabd5e
commit d42004ac9c
1 changed files with 66 additions and 68 deletions

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Customer Data</title> <title>Edit Customer Data</title>
<style> <style>
/* 固定底部状态栏样式 */ /* Fixed bottom status bar style */
.status-bar { .status-bar {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
@ -16,88 +16,87 @@
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
} }
/* Add padding-bottom to avoid content being overlapped by the status bar */
.content-wrapper {
padding-bottom: 50px; /* Adjust based on the height of your status bar */
}
</style> </style>
</head> </head>
<body> <body>
<h2>Edit Customer Data</h2> <div class="content-wrapper">
<h2>Edit Customer Data</h2>
<form method="POST" action="/update/{{ index }}"> <!-- Main form and content here -->
{% for domain, info in customer.items() %} <form method="POST" action="/update/{{ index }}">
<h3>Domain: {{ domain }}</h3> {% for domain, info in customer.items() %}
<p>Customer Industry: <input type="text" name="{{ domain }}_industry" value="{{ info.get('customer industry', '') }}"></p> <h3>Domain: {{ domain }}</h3>
<p>Customer Industry: <input type="text" name="{{ domain }}_industry" value="{{ info.get('customer industry', '') }}"></p>
<h4>Email Addresses</h4> <h4>Email Addresses</h4>
<div> <div>
{% if info.get('email addresses') %} {% if info.get('email addresses') %}
{% for email in info['email addresses'] %} {% for email in info['email addresses'] %}
<div> <div>
<p>Owner Name: <input type="text" name="{{ domain }}_owner_name_{{ email['idx'] }}" value="{{ email.get("owner's name", '') }}"></p> <p>Owner Name: <input type="text" name="{{ domain }}_owner_name_{{ email['idx'] }}" value="{{ email.get("owner's name", '') }}"></p>
<p>Email Address: <input type="text" name="{{ domain }}_email_address_{{ email['idx'] }}" value="{{ email.get('email address', '') }}"></p> <p>Email Address: <input type="text" name="{{ domain }}_email_address_{{ email['idx'] }}" value="{{ email.get('email address', '') }}"></p>
<p>Category: <input type="text" name="{{ domain }}_category_{{ email['idx'] }}" value="{{ email.get('category', '') }}"></p> <p>Category: <input type="text" name="{{ domain }}_category_{{ email['idx'] }}" value="{{ email.get('category', '') }}"></p>
<p>Promotion History: <input type="text" name="{{ domain }}_promotion_history_{{ email['idx'] }}" value="{{ email.get('promotion history', []) | join(', ') }}"></p> <p>Promotion History: <input type="text" name="{{ domain }}_promotion_history_{{ email['idx'] }}" value="{{ email.get('promotion history', []) | join(', ') }}"></p>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<p>No email addresses available.</p> <p>No email addresses available.</p>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}
<button type="submit">Save Changes</button> <button type="submit">Save Changes</button>
</form> </form>
<hr> <hr>
<!-- Navigation buttons and search input -->
<div>
<button onclick="goToTop()">Go to Top</button>
<button onclick="goToBottom()">Go to Bottom</button>
<input type="number" id="pageIndex" placeholder="Enter page number">
<button onclick="goToPage()">Go to Page</button>
</div>
<!-- 新增导航按钮 --> <hr>
<div>
<!-- 跳转到数据库的第一条记录按钮 -->
<button onclick="goToTop()">Go to Top</button>
<!-- 跳转到数据库的最后一条记录按钮 --> <!-- Search by email functionality -->
<button onclick="goToBottom()">Go to Bottom</button> <div>
<input type="text" id="emailSearch" placeholder="Enter email address">
<button onclick="searchByEmail()">Search by Email</button>
</div>
<!-- 跳转到指定页面的输入框和按钮 --> <hr>
<input type="number" id="pageIndex" placeholder="Enter page number">
<button onclick="goToPage()">Go to Page</button> <!-- Pagination buttons -->
<div>
<button {% if is_first %}disabled{% endif %}>
<a href="{% if not is_first %}{{ url_for('view_customer', index=index-1) }}{% endif %}">Previous</a>
</button>
<button {% if is_last %}disabled{% endif %}>
<a href="{% if not is_last %}{{ url_for('view_customer', index=index+1) }}{% endif %}">Next</a>
</button>
</div>
</div> </div>
<hr> <!-- Fixed status bar -->
<!-- 搜索邮件地址的输入框和按钮 -->
<div>
<input type="text" id="emailSearch" placeholder="Enter email address">
<button onclick="searchByEmail()">Search by Email</button>
</div>
<hr>
<!-- 原有的上一页和下一页按钮 -->
<div>
<button {% if is_first %}disabled{% endif %}>
<a href="{% if not is_first %}{{ url_for('view_customer', index=index-1) }}{% endif %}">Previous</a>
</button>
<button {% if is_last %}disabled{% endif %}>
<a href="{% if not is_last %}{{ url_for('view_customer', index=index+1) }}{% endif %}">Next</a>
</button>
</div>
<!-- 固定状态栏 -->
<div class="status-bar"> <div class="status-bar">
<p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }}</p> <p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }}</p>
</div> </div>
<!-- JavaScript 脚本 --> <!-- JavaScript for navigation functions -->
<script> <script>
// 跳转到数据库的第一条记录
function goToTop() { function goToTop() {
window.location.href = "/customer/top"; // 跳转到后端“Top”路由 window.location.href = "/customer/top";
} }
// 跳转到数据库的最后一条记录
function goToBottom() { function goToBottom() {
window.location.href = "/customer/bottom"; // 跳转到后端“Bottom”路由 window.location.href = "/customer/bottom";
} }
// 跳转到指定记录
function goToPage() { function goToPage() {
const pageIndex = document.getElementById('pageIndex').value; const pageIndex = document.getElementById('pageIndex').value;
if (pageIndex !== '') { if (pageIndex !== '') {
@ -105,7 +104,6 @@
} }
} }
// 搜索邮件地址并跳转
function searchByEmail() { function searchByEmail() {
const email = document.getElementById('emailSearch').value; const email = document.getElementById('emailSearch').value;
if (email) { if (email) {