{% extends "layout.html" %}
{% block main %}
<!-- <script type="text/javascript" src="/static/config.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/image@latest"></script><!-- Image -->
<script type="text/javascript" src="/static/js/yo.js"></script>
<table>
    <tbody id='contactData'>
        <h1 class="h3"><i class="fas fa-pen mr-3 mb-3"></i>{{ title }}</h1>
        <tr>
         
            <!-- <td class="table__data">修改聯絡EMAIL</td> -->
            修改聯絡 Email <span class="text-danger">（若輸入多數 Email，請以逗號 (,) 或分號 (;) 分隔，逗號或分號後請勿加空格）</span>
            <td class="table__data"><input class="form-control" id="newEmail" type="text" style="width: 600px;" placeholder="修改聯絡EMAIL" /></td>
            <td class="table__data"></td>
            <!-- <td class="table__data">1</td> -->
            <td class="table__data"></td>
            <td>
                <div class="d-flex justify-content-center">
                    <button class="btn btn_light mr-1" onclick="modEmail($('#newEmail').val());"><b>儲存</b> <i
                            class="fas fa-pencil-alt"></i></button>
                </div>

            </td>
        </tr>

    </tbody>
</table>
<script>
    $(function(){
        axios.get('/backstage/edit_contact_us_getemail').then(({ data }) => {
            $('#newEmail').val(data);
        });
        
    });

    function modEmail() {
        axios.get('/backstage/edit_contact_us_editemail?newemail='+$('#newEmail').val()).then(({ data }) => {
            alert('已儲存');
        }).finally((data) => { location.reload(); });
    };

</script>
{% endblock main %}
