|
|
@@ -16,7 +16,8 @@ |
|
|
|
|
|
|
|
<div class="details"> |
|
|
|
<ul> |
|
|
|
<li><b>Status:</b> <span>{{selected.status}}</span></li> |
|
|
|
<li><b>Status:</b> <span>{{selected.status.charAt(0).toUpperCase() + |
|
|
|
selected.status.slice(1)}}</span></li> |
|
|
|
<li><b>Quantity:</b> <span>{{selected.quantity}}</span></li> |
|
|
|
<li><b>Remaining:</b> <span>{{selected.remaining}}</span></li> |
|
|
|
<li><b>URL:</b> <span>{{selected.url}}</span></li> |
|
|
@@ -26,8 +27,8 @@ |
|
|
|
<div v-if="selected.status == 'processing' || selected.status == |
|
|
|
'error'" class="change-url"> |
|
|
|
<h4>URL</h4> |
|
|
|
<div><input :value="selected.url" type="url" id="url"></div> |
|
|
|
<button @click="saveUrl" :disabled="loading">Save |
|
|
|
<div><input v-model="url" type="url" id="url"></div> |
|
|
|
<button @click="saveURL" :disabled="loading">Save |
|
|
|
<loading-icon v-if="loading"></loading-icon></button> |
|
|
|
<p id="overlay-error">{{errorMessage}}</p> |
|
|
|
</div> |
|
|
@@ -41,15 +42,30 @@ |
|
|
|
import LoadingIcon from '../icons/loading.vue' |
|
|
|
|
|
|
|
function saveURL() { |
|
|
|
fetch('/panel/save-url', { |
|
|
|
method: 'POST', |
|
|
|
headers: {'Content-Type': 'application/json', |
|
|
|
'Accept': 'application/json', |
|
|
|
'X-XSRF-TOKEN': this.token}, |
|
|
|
body: JSON.stringify({'url': this.url, 'order': this.selected.id}) |
|
|
|
}).then(response => { |
|
|
|
if (response.ok) { |
|
|
|
this.errorMessage = 'Saved' |
|
|
|
this.$emit('changeUrl', this.url) |
|
|
|
} else { |
|
|
|
this.errorMessage = 'An error occured' |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return {loading: false, errorMessage: ''} |
|
|
|
return {loading: false, errorMessage: '', url: this.selected.url} |
|
|
|
}, |
|
|
|
components: {LoadingIcon}, |
|
|
|
methods: {saveURL}, |
|
|
|
props: ['selected', 'token'], |
|
|
|
emits: ['changeUrl', 'close'] |
|
|
|
} |
|
|
|
</script> |