3rd
This commit is contained in:
@@ -30,6 +30,11 @@
|
||||
<!-- 郵件通知對象選擇 -->
|
||||
<div class="mb-3">
|
||||
<label for="recipients" class="form-label"><strong>郵件通知對象</strong></label>
|
||||
{% if saved_emails %}
|
||||
<div class="alert alert-info mb-2">
|
||||
<small>以下為生效時設定的通知對象,您可以直接使用或進行編輯。如果修改,展延後將更新為新的通知對象。</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
<select id="recipients" name="recipients" multiple placeholder="請輸入姓名或 Email 來搜尋...">
|
||||
</select>
|
||||
<div class="form-text">可搜尋姓名或 Email 地址,支援多人選擇</div>
|
||||
@@ -45,6 +50,13 @@
|
||||
{% block scripts %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 預先載入已儲存的郵件清單
|
||||
{% if saved_emails %}
|
||||
const savedEmails = "{{ saved_emails }}".split(';').filter(email => email.trim());
|
||||
{% else %}
|
||||
const savedEmails = [];
|
||||
{% endif %}
|
||||
|
||||
const recipientSelect = new TomSelect('#recipients', {
|
||||
valueField: 'value',
|
||||
labelField: 'text',
|
||||
@@ -89,6 +101,17 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 預填已儲存的郵件
|
||||
if (savedEmails.length > 0) {
|
||||
savedEmails.forEach(email => {
|
||||
const trimmedEmail = email.trim();
|
||||
if (trimmedEmail) {
|
||||
recipientSelect.addOption({value: trimmedEmail, text: trimmedEmail});
|
||||
recipientSelect.addItem(trimmedEmail);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
@@ -23,6 +23,11 @@
|
||||
<!-- 郵件通知對象選擇 -->
|
||||
<div class="mb-3">
|
||||
<label for="recipients" class="form-label"><strong>郵件通知對象</strong></label>
|
||||
{% if saved_emails %}
|
||||
<div class="alert alert-info mb-2">
|
||||
<small>以下為生效時設定的通知對象,您可以直接使用或進行編輯。</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
<select id="recipients" name="recipients" multiple placeholder="請輸入姓名或 Email 來搜尋...">
|
||||
</select>
|
||||
<div class="form-text">可搜尋姓名或 Email 地址,支援多人選擇</div>
|
||||
@@ -38,6 +43,13 @@
|
||||
{% block scripts %}
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 預先載入已儲存的郵件清單
|
||||
{% if saved_emails %}
|
||||
const savedEmails = "{{ saved_emails }}".split(';').filter(email => email.trim());
|
||||
{% else %}
|
||||
const savedEmails = [];
|
||||
{% endif %}
|
||||
|
||||
const recipientSelect = new TomSelect('#recipients', {
|
||||
valueField: 'value',
|
||||
labelField: 'text',
|
||||
@@ -82,6 +94,17 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 預填已儲存的郵件
|
||||
if (savedEmails.length > 0) {
|
||||
savedEmails.forEach(email => {
|
||||
const trimmedEmail = email.trim();
|
||||
if (trimmedEmail) {
|
||||
recipientSelect.addOption({value: trimmedEmail, text: trimmedEmail});
|
||||
recipientSelect.addItem(trimmedEmail);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user