diff --git a/app/Http/Controllers/OrderController.php b/app/Http/Controllers/OrderController.php
index 2f986cc..600272b 100644
--- a/app/Http/Controllers/OrderController.php
+++ b/app/Http/Controllers/OrderController.php
@@ -46,4 +46,21 @@ class OrderController extends Controller
}
return true;
}
+
+ public function changeURL(Request $request) {
+ $validated = $request->validate([
+ 'order' => 'required',
+ 'url' => 'required'
+ ]);
+
+ $order = Order::find($request->order);
+ $user = Auth::user();
+
+ if (!in_array($order->status, ['processing', 'error'])) {
+ abort(422);
+ }
+
+ $order->url = $request->url;
+ $order->save();
+ }
}
diff --git a/resources/js/panel/order-item.vue b/resources/js/panel/order-item.vue
index 474342f..171dad3 100644
--- a/resources/js/panel/order-item.vue
+++ b/resources/js/panel/order-item.vue
@@ -16,7 +16,8 @@
- - Status: {{selected.status}}
+ - Status: {{selected.status.charAt(0).toUpperCase() +
+ selected.status.slice(1)}}
- Quantity: {{selected.quantity}}
- Remaining: {{selected.remaining}}
- URL: {{selected.url}}
@@ -26,8 +27,8 @@
@@ -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']
}
diff --git a/resources/js/panel/orders.vue b/resources/js/panel/orders.vue
index fca16b2..8ec24da 100644
--- a/resources/js/panel/orders.vue
+++ b/resources/js/panel/orders.vue
@@ -47,7 +47,8 @@
src="../../images/arrow-right-circle-fill.svg" alt=""/>
-
+ selected.url = url">
diff --git a/resources/js/panel/panel.vue b/resources/js/panel/panel.vue
index 857c25d..3dcde3c 100644
--- a/resources/js/panel/panel.vue
+++ b/resources/js/panel/panel.vue
@@ -14,7 +14,7 @@
Recent Activity
- Date | Name | Status | Quantity |
+ Date | Name | Status |
@@ -23,7 +23,6 @@
{{order.status.charAt(0).toUpperCase() +
order.status.slice(1)}} |
- {{order.quantity}} |
diff --git a/resources/scss/main.scss b/resources/scss/main.scss
index f636486..54ddd71 100644
--- a/resources/scss/main.scss
+++ b/resources/scss/main.scss
@@ -804,7 +804,6 @@ section.recent-pane, section.history-pane{
border-spacing: 4px;
margin: auto;
text-align: center;
- min-width: 30em;
width: 100%;
}
@@ -913,6 +912,10 @@ section.recent-pane, section.history-pane{
left: 50%;
}
+ table {
+ min-width: 30em;
+ }
+
}
.actions {
diff --git a/routes/web.php b/routes/web.php
index cb31f09..f315376 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -131,6 +131,9 @@ Route::post('/panel/pm-fail', [BillingController::class,
Route::get('/panel/cards', [BillingController::class,
'getCards'])->middleware([ 'auth', 'verified' ]);
+Route::post('/panel/save-url', [OrderController::class,
+ 'changeURL'])->middleware([ 'auth', 'verified' ]);
+
//Stripe webhooks
Route::post('/hooks/charge',
[BillingController::class, 'chargeEvent']);