100 lines
3.8 KiB
HTML
100 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Edit Customer Data</title>
|
|
</head>
|
|
<body>
|
|
<h2>Edit Customer Data</h2>
|
|
|
|
<form method="POST" action="/update/{{ index }}">
|
|
{% for domain, info in customer.items() %}
|
|
<h3>Domain: {{ domain }}</h3>
|
|
<p>Customer Industry: <input type="text" name="{{ domain }}_industry" value="{{ info.get('customer industry', '') }}"></p>
|
|
|
|
<h4>Email Addresses</h4>
|
|
<div>
|
|
{% if info.get('email addresses') %}
|
|
{% for email in info['email addresses'] %}
|
|
<div>
|
|
<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>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>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<p>No email addresses available.</p>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
<button type="submit">Save Changes</button>
|
|
</form>
|
|
|
|
<hr>
|
|
|
|
<!-- 新增导航按钮 -->
|
|
<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>
|
|
<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>
|
|
|
|
<!-- JavaScript 脚本 -->
|
|
<script>
|
|
// 跳转到数据库的第一条记录
|
|
function goToTop() {
|
|
window.location.href = "/customer/top"; // 跳转到后端“Top”路由
|
|
}
|
|
|
|
// 跳转到数据库的最后一条记录
|
|
function goToBottom() {
|
|
window.location.href = "/customer/bottom"; // 跳转到后端“Bottom”路由
|
|
}
|
|
|
|
// 跳转到指定记录
|
|
function goToPage() {
|
|
const pageIndex = document.getElementById('pageIndex').value;
|
|
if (pageIndex !== '') {
|
|
window.location.href = `/customer/${pageIndex}`;
|
|
}
|
|
}
|
|
|
|
// 搜索邮件地址并跳转
|
|
function searchByEmail() {
|
|
const email = document.getElementById('emailSearch').value;
|
|
if (email) {
|
|
window.location.href = `/search?email=${encodeURIComponent(email)}`;
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|