Browse Source

Render services in their components

tags/v0.1.0
Immanuel Onyeka 3 years ago
parent
commit
b24b3b74d4
7 changed files with 103 additions and 21 deletions
  1. +14
    -0
      app/Http/Controllers/ServiceController.php
  2. +10
    -0
      app/Http/Controllers/Transaction.php
  3. +27
    -2
      resources/js/panel/panel.vue
  4. +27
    -0
      resources/js/panel/service-pane.vue
  5. +19
    -18
      resources/js/panel/services.vue
  6. +2
    -1
      resources/scss/main.scss
  7. +4
    -0
      routes/web.php

+ 14
- 0
app/Http/Controllers/ServiceController.php View File

@@ -0,0 +1,14 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use App\Models\Service;

class ServiceController extends Controller
{
public function getServices(Request $request) {
return Service::all();
}
}

+ 10
- 0
app/Http/Controllers/Transaction.php View File

@@ -0,0 +1,10 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class Transaction extends Controller
{
//
}

+ 27
- 2
resources/js/panel/panel.vue View File

@@ -1,4 +1,5 @@
<template> <template>
<template v-if="!loading">
<sidebar :active="active"></sidebar> <sidebar :active="active"></sidebar>
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<div v-if="active === ''" id="main"> <div v-if="active === ''" id="main">
@@ -27,7 +28,7 @@
</div> </div>
<PastOrders :orders="orders" v-else-if="active === '#orders'" id="main"> <PastOrders :orders="orders" v-else-if="active === '#orders'" id="main">
</PastOrders> </PastOrders>
<NewOrder :orders="orders" v-else-if="active === '#new-order'" id="main">
<NewOrder :token="token" v-else-if="active === '#new-order'" id="main">
</NewOrder> </NewOrder>
<div id="main" v-else-if="active === '#exit'"> <div id="main" v-else-if="active === '#exit'">
<section class="logout-pane"> <section class="logout-pane">
@@ -38,6 +39,7 @@
<settings :token="token" :user="user" class="settings-page" id="main" v-else-if="active === '#settings'"></settings> <settings :token="token" :user="user" class="settings-page" id="main" v-else-if="active === '#settings'"></settings>
</transition> </transition>
</template> </template>
</template>


<script> <script>
import Sidebar from './sidebar.vue' import Sidebar from './sidebar.vue'
@@ -45,6 +47,19 @@ import Settings from './settings.vue'
import PastOrders from './orders.vue' import PastOrders from './orders.vue'
import NewOrder from './services.vue' import NewOrder from './services.vue'


/* function getServices() { */
/* } */
/* function getServices() { */
/* fetch("/panel/services", { */
/* method: 'GET', */
/* headers: {'Content-Type': 'application/json', */
/* 'Accept': 'application/json', */
/* 'X-XSRF-TOKEN': this.token} */
/* }).then(response => { */
/* response.json().then(data => {this.services = data}) */
/* }) */
/* } */


export default { export default {
components: { components: {
@@ -52,8 +67,18 @@ export default {
}, },
data() { data() {
return {active: window.location.hash, user: '', return {active: window.location.hash, user: '',
token: '', orders: '',}
token: '', orders: '', loading: true}
}, },
methods: {}, methods: {},
beforeCreate() {
fetch("/panel/services", {
method: 'GET',
headers: {'Content-Type': 'application/json',
'Accept': 'application/json',
'X-XSRF-TOKEN': this.token}
}).then(response => {
response.json().then(data => {this.services = data; this.loading = false})
})
}
} }
</script> </script>

+ 27
- 0
resources/js/panel/service-pane.vue View File

@@ -0,0 +1,27 @@
<template>
<section class="services-pane youtube" >
<h4>{{site.charAt(0).toUpperCase() + site.slice(1)}}</h4>
<ul :key="service.id" v-for="service in filter(site)">
<li><span>{{service.name}}</span><span>{{service.price}}</span><span>{{service.minimum}}</span><span>{{service.maximum}}</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-square-fill" viewBox="0 0 16 16">
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z"/>
</svg>
</li>
</ul>
</section>
</template>

<script>
function filter(site) {
if (!this.services) {return}

return this.services.filter(function(s) {
return s.site == site
})
}

export default {
props: ['services', 'site'],
methods: {filter}
}
</script>

+ 19
- 18
resources/js/panel/services.vue View File

@@ -8,31 +8,32 @@
</div> </div>
<div class="services-legend"><h5>Name</h5> <div class="services-legend"><h5>Name</h5>
<h5>Credits per 1000</h5><h5>Min Qt.</h5><h5>Max Qt.</h5></div> <h5>Credits per 1000</h5><h5>Min Qt.</h5><h5>Max Qt.</h5></div>
<section class="services-pane youtube">
<h4>Youtube</h4>
<ul>
<li><span>Unique Views and Engagements</span><span>11</span><span>1000</span><span>500,000</span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-square-fill" viewBox="0 0 16 16">
<path d="M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z"/>
</svg>
</li>
</ul>
</section>
<section class="services-pane instagram">
<h4>Instagram</h4>
</section>
<section class="services-pane twitter">
<h4>Twitter</h4>
</section>
<ServicePane :site="'youtube'" :services="services"></ServicePane>
<ServicePane :site="'instagram'" :services="services"></ServicePane>
<ServicePane :site="'twitter'" :services="services"></ServicePane>
<ServicePane :site="'tiktok'" :services="services"></ServicePane>
</div> </div>
</template> </template>


<script> <script>
import ServicePane from './service-pane.vue'



export default { export default {
data() { data() {
return {servicePane: true}
return {servicePane: true, services: ''}
},
components: {ServicePane},
props: ['token'],
created() {
fetch("/panel/services", {
method: 'GET',
headers: {'Content-Type': 'application/json',
'Accept': 'application/json',
'X-XSRF-TOKEN': this.token}
}).then(response => {
response.json().then(data => {this.services = data})
})
}, },
props: ['orders']
} }
</script> </script>

+ 2
- 1
resources/scss/main.scss View File

@@ -1031,7 +1031,7 @@ main.panel {
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-top: 1px solid grey; border-top: 1px solid grey;
border-bottom: 1px solid grey;
// border-bottom: 1px solid grey;
padding: 6px 0; padding: 6px 0;
} }


@@ -1053,6 +1053,7 @@ main.panel {
width: 25px; width: 25px;
height: 25px; height: 25px;
color: vars.getColor('brand-orange'); color: vars.getColor('brand-orange');
right: 10px;
} }


svg:hover { svg:hover {


+ 4
- 0
routes/web.php View File

@@ -2,6 +2,7 @@


use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController; use App\Http\Controllers\UserController;
use App\Http\Controllers\ServiceController;
use Illuminate\Foundation\Auth\EmailVerificationRequest; use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@@ -63,6 +64,9 @@ Route::get('/panel/user', function (Request $request) {
Route::get('/panel/orders', [UserController::class, Route::get('/panel/orders', [UserController::class,
'getOrders'])->middleware([ 'auth', 'verified' ]); 'getOrders'])->middleware([ 'auth', 'verified' ]);


Route::get('/panel/services', [ServiceController::class,
'getServices'])->middleware([ 'auth', 'verified' ]);

Route::get('/logout', [UserController::class, Route::get('/logout', [UserController::class,
'logout'])->middleware('auth'); 'logout'])->middleware('auth');




Loading…
Cancel
Save