|
|
@@ -26,7 +26,6 @@ |
|
|
|
</section> |
|
|
|
</div> |
|
|
|
<div v-else-if="active === '#orders'" id="main"> |
|
|
|
<div class="actions"><a class="new-order" href="#orders/new">New</a></div> |
|
|
|
<section class="pending-pane"> |
|
|
|
<h4>Pending Orders</h4> |
|
|
|
<ul> |
|
|
@@ -87,7 +86,7 @@ |
|
|
|
<section class="change-password-pane"> |
|
|
|
<h4>Change Password</h4> |
|
|
|
<h5>Current Password</h5><input name="current_passowrd" id="current_password" type="password"> |
|
|
|
<h5>New Password</h5><input id="changed_password" name="passowrd" type="password"> |
|
|
|
<h5>New Password</h5><input id="new_password" name="passowrd" type="password"> |
|
|
|
<h5>Confirm Password</h5><input id="confirm_password" name="confirm_passowrd" type="password"> |
|
|
|
<button @click="changePassword">Save<img class="loading-icon" src="../../images/loading-white.svg" alt=""></button> |
|
|
|
<span></span> |
|
|
@@ -129,6 +128,7 @@ function changeName() { |
|
|
|
let pane = document.querySelector('.change-name-pane') |
|
|
|
|
|
|
|
pane.classList.add('loading') |
|
|
|
pane.classList.remove('error') |
|
|
|
fetch("/panel/change-name", { |
|
|
|
method: 'POST', |
|
|
|
headers: {'Content-Type': 'application/json', |
|
|
@@ -142,7 +142,7 @@ function changeName() { |
|
|
|
info.textContent = 'Completed' |
|
|
|
} else { |
|
|
|
pane.classList.add('error') |
|
|
|
info.textContent = 'Error:' + response.status |
|
|
|
info.textContent = 'Error: ' + response.status |
|
|
|
} |
|
|
|
|
|
|
|
pane.classList.remove('loading') |
|
|
@@ -155,6 +155,7 @@ function changeEmail() { |
|
|
|
let pane = document.querySelector('.change-email-pane') |
|
|
|
|
|
|
|
pane.classList.add('loading') |
|
|
|
pane.classList.remove('error') |
|
|
|
fetch("/panel/change-name", { |
|
|
|
method: 'POST', |
|
|
|
headers: {'Content-Type': 'application/json', |
|
|
@@ -163,12 +164,37 @@ function changeEmail() { |
|
|
|
body: JSON.stringify({'email': email}), |
|
|
|
}).then(response => { |
|
|
|
if (response.ok) { |
|
|
|
response.json().then(data => {this.user = data}) |
|
|
|
pane.classList.add('completed') |
|
|
|
info.textContent = 'Completed' |
|
|
|
} else { |
|
|
|
pane.classList.add('error') |
|
|
|
info.textContent = 'Error:' + response.status |
|
|
|
info.textContent = 'Error: ' + response.status |
|
|
|
} |
|
|
|
|
|
|
|
pane.classList.remove('loading') |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function changePassword() { |
|
|
|
let info = document.querySelector('.change-password-pane span') |
|
|
|
let pane = document.querySelector('.change-password-pane') |
|
|
|
|
|
|
|
pane.classList.add('loading') |
|
|
|
pane.classList.remove('error') |
|
|
|
fetch("/panel/change-password", { |
|
|
|
method: 'POST', |
|
|
|
headers: {'Content-Type': 'application/json', |
|
|
|
'Accept': 'application/json', |
|
|
|
'X-XSRF-TOKEN': this.token}, |
|
|
|
body: JSON.stringify({'current_password': document.getElementById('current_password').value, 'password': document.getElementById('new_password').value, 'password_confirmation': document.getElementById('confirm_password').value}), |
|
|
|
}).then(response => { |
|
|
|
response.json().then(data => {console.log(data)}) |
|
|
|
if (response.ok) { |
|
|
|
pane.classList.add('completed') |
|
|
|
info.textContent = 'Completed' |
|
|
|
} else { |
|
|
|
pane.classList.add('error') |
|
|
|
info.textContent = 'Error: ' + response.status |
|
|
|
} |
|
|
|
|
|
|
|
pane.classList.remove('loading') |
|
|
@@ -183,6 +209,6 @@ export default { |
|
|
|
return {active: window.location.hash, user: '', |
|
|
|
token: '', orders: '', historyPage: 1} |
|
|
|
}, |
|
|
|
methods: {togglePending, toggleOrderItem, moveHistory, changeName, changeEmail} |
|
|
|
methods: {togglePending, toggleOrderItem, moveHistory, changeName, changeEmail, changePassword} |
|
|
|
} |
|
|
|
</script> |