<script>
document.addEventListener('DOMContentLoaded', function() {
    document.querySelectorAll('.edit-btn').forEach(function(btn) {
        btn.addEventListener('click', function() {
            var tr = btn.closest('tr');
            if (btn.textContent === 'Sửa') {
                btn.textContent = 'Hoàn thành';
                tr.querySelectorAll('.td-username, .td-password, .td-tennguoidung').forEach(function(td) {
                    var val = td.textContent;
                    td.innerHTML = '<input type="text" value="' + val.replace(/"/g, '&quot;') + '" style="width:120px;">';
                });
            } else {
                // Gửi AJAX cập nhật
                var id = tr.getAttribute('data-id');
                var username = tr.querySelector('.td-username input').value;
                var password = tr.querySelector('.td-password input').value;
                var ten_nguoi_dung = tr.querySelector('.td-tennguoidung input').value;
                var formData = new FormData();
                formData.append('edit_account', 1);
                formData.append('id', id);
                formData.append('username', username);
                formData.append('password', password);
                formData.append('ten_nguoi_dung', ten_nguoi_dung);
                fetch('', { method: 'POST', body: formData })
                    .then(res => res.text())
                    .then(html => { location.reload(); });
            }
        });
    });
});
</script> <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://test.motlavi11.com/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://test.motlavi11.com/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://test.motlavi11.com/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://test.motlavi11.com/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://test.motlavi11.com/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
