frontend & backend update

This commit is contained in:
carodej
2020-06-22 16:46:02 +02:00
parent a2cab6198e
commit a2dfc627a7
35 changed files with 595 additions and 1080 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="plans-wrapper">
<div class="plans-wrapper" v-if="plans">
<article class="plan" v-for="(plan, i) in plans" :key="i">
<div class="plan-wrapper">
<header class="plan-header">

View File

@@ -9,18 +9,18 @@
<template scope="{ row }">
<tr>
<td>
<a :href="'/invoice/' + row.data.attributes.token" target="_blank" class="cell-item">
<a :href="'/invoice/' + row.data.id" target="_blank" class="cell-item">
{{ row.data.attributes.order }}
</a>
</td>
<td>
<span class="cell-item">
${{ row.data.attributes.total }}
{{ row.data.attributes.total }}
</span>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.bag[0].description }}
{{ row.data.attributes.bag.description }}
</span>
</td>
<td>
@@ -29,17 +29,20 @@
</span>
</td>
<td>
<router-link :to="{name: 'UserInvoices', params: {id: row.relationships.user.data.id}}">
<router-link v-if="row.relationships" :to="{name: 'UserInvoices', params: {id: row.relationships.user.data.id}}">
<DatatableCellImage
image-size="small"
:image="row.relationships.user.data.attributes.avatar"
:title="row.relationships.user.data.attributes.name"
/>
</router-link>
<span v-else class="cell-item">
-
</span>
</td>
<td>
<div class="action-icons">
<a :href="'/invoice/' + row.data.attributes.token" target="_blank">
<a :href="'/invoice/' + row.data.id" target="_blank">
<external-link-icon size="15" class="icon"></external-link-icon>
</a>
</div>

View File

@@ -72,7 +72,7 @@
this.isSendingRequest = true
axios
.delete(this.$store.getters.api + '/plans/' + this.$route.params.id + '/delete',
.delete(this.$store.getters.api + '/plans/' + this.$route.params.id,
{
data: {
name: this.planName
@@ -82,11 +82,11 @@
.then(() => {
this.isSendingRequest = false
// Show error message
// Show message
events.$emit('success:open', {
emoji: '👍',
title: this.$t('popup_deleted_user.title'),
message: this.$t('popup_deleted_user.message'),
title: 'Plan was deleted',
message: 'Your plan was successfully deleted.',
})
this.$router.push({name: 'Plans'})

View File

@@ -1,22 +1,22 @@
<template>
<PageTab v-if="invoices">
<PageTabGroup v-if="invoices.length > 0">
<PageTab :is-loading="isLoading">
<PageTabGroup v-if="invoices && invoices.length > 0">
<DatatableWrapper :paginator="true" :columns="columns" :data="invoices" class="table">
<template scope="{ row }">
<tr>
<td>
<a :href="'/invoice/' + row.data.attributes.token" target="_blank" class="cell-item">
<a :href="'/invoice/' + row.data.id" target="_blank" class="cell-item">
{{ row.data.attributes.order }}
</a>
</td>
<td>
<span class="cell-item">
${{ row.data.attributes.total }}
{{ row.data.attributes.total }}
</span>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.bag[0].description }}
{{ row.data.attributes.bag.description }}
</span>
</td>
<td>
@@ -26,7 +26,7 @@
</td>
<td>
<div class="action-icons">
<a :href="'/invoice/' + row.data.attributes.token" target="_blank">
<a :href="'/invoice/' + row.data.id" target="_blank">
<external-link-icon size="15" class="icon"></external-link-icon>
</a>
</div>

View File

@@ -2,7 +2,7 @@
<PageTab v-if="storage">
<PageTabGroup>
<SetupBox
v-if="! config.isSaaS || ! user.relationships.subscription"
v-if="! config.isSaaS || ! user.data.attributes.subscription"
theme="base"
:title="$t('user_box_storage.title')"
:description="$t('user_box_storage.description')"

View File

@@ -1,5 +1,5 @@
<template>
<PageTab>
<PageTab :is-loading="isLoading">
<PageTabGroup v-if="subscription">
<!--Info about active subscription-->
@@ -65,6 +65,7 @@
data() {
return {
subscription: undefined,
isLoading: true,
}
},
created() {

View File

@@ -54,7 +54,7 @@
</div>
</router-link>
<router-link v-if="config.isSaaS" replace :to="{name: 'Subscription'}" class="menu-list-item link">
<router-link v-if="canShowSubscriptionSettings" replace :to="{name: 'Subscription'}" class="menu-list-item link">
<div class="icon">
<cloud-icon size="17"></cloud-icon>
</div>
@@ -63,7 +63,7 @@
</div>
</router-link>
<router-link v-if="config.isSaaS" replace :to="{name: 'PaymentCards'}" class="menu-list-item link">
<router-link v-if="canShowSubscriptionSettings" replace :to="{name: 'PaymentCards'}" class="menu-list-item link">
<div class="icon">
<credit-card-icon size="17"></credit-card-icon>
</div>
@@ -72,7 +72,7 @@
</div>
</router-link>
<router-link v-if="config.isSaaS" replace :to="{name: 'Invoice'}" class="menu-list-item link">
<router-link v-if="canShowSubscriptionSettings" replace :to="{name: 'Invoice'}" class="menu-list-item link">
<div class="icon">
<file-text-icon size="17"></file-text-icon>
</div>
@@ -143,6 +143,9 @@
subscriptionColor() {
return this.user.data.attributes.subscription ? 'green' : 'purple'
},
canShowSubscriptionSettings() {
return this.config.isSaaS && this.user.data.attributes.stripe_customer
}
},
data() {
return {

View File

@@ -383,8 +383,12 @@
},
},
mounted: function () {
card = elements.create('card');
card.mount(this.$refs.stripeCard);
if (!this.requestedPlan) {
this.$router.push({name: 'UpgradePlan'})
} else {
card = elements.create('card');
card.mount(this.$refs.stripeCard);
}
},
created() {
@@ -395,10 +399,6 @@
axios.get('/api/user/payments')
.then(response => {
if (!this.requestedPlan) {
this.$router.push({name: 'UpgradePlan'})
}
this.defaultPaymentCard = response.data.default
this.paymentCards = response.data.others

View File

@@ -1,22 +1,22 @@
<template>
<PageTab v-if="invoices">
<PageTabGroup v-if="invoices.length > 0">
<PageTab :is-loading="isLoading">
<PageTabGroup v-if="invoices && invoices.length > 0">
<DatatableWrapper :paginator="true" :columns="columns" :data="invoices" class="table">
<template scope="{ row }">
<tr>
<td>
<a :href="'/invoice/' + row.data.attributes.token" target="_blank" class="cell-item">
<a :href="'/invoice/' + row.data.attributes.customer + '/' + row.data.id" target="_blank" class="cell-item">
{{ row.data.attributes.order }}
</a>
</td>
<td>
<span class="cell-item">
${{ row.data.attributes.total }}
{{ row.data.attributes.total }}
</span>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.bag[0].description }}
{{ row.data.attributes.bag.description }}
</span>
</td>
<td>
@@ -26,7 +26,7 @@
</td>
<td>
<div class="action-icons">
<a :href="'/invoice/' + row.data.attributes.token" target="_blank">
<a :href="'/invoice/' + row.data.attributes.customer + '/' + row.data.id" target="_blank">
<external-link-icon size="15" class="icon"></external-link-icon>
</a>
</div>

View File

@@ -34,7 +34,7 @@
<ul class="list">
<li class="list-item">
<b>Date:</b>
<span>{{ $invoice->created_at }}</span>
<span>{{ format_date($invoice->date()) }}</span>
</li>
<li class="list-item">
<b>Product:</b>
@@ -42,7 +42,7 @@
</li>
<li class="list-item">
<b>Invoice Number:</b>
<span>{{ $invoice->order }}</span>
<span>{{ $invoice->number }}</span>
</li>
</ul>
</section>
@@ -113,53 +113,53 @@
<h2 class="partner-title">Client:</h2>
<ul class="list">
@isset($invoice->client['billing_name'])
@isset($invoice->customer_name)
<li class="list-item">
<b>Name:</b>
<span>{{ $invoice->client['billing_name'] }}</span>
<span>{{ $invoice->customer_name }}</span>
</li>
@endisset
@isset($invoice->client['billing_phone_number'])
@isset($invoice->customer_phone)
<li class="list-item">
<b>Phone:</b>
<span>{{ $invoice->client['billing_phone_number'] }}</span>
<span>{{ $invoice->customer_phone }}</span>
</li>
@endisset
</ul>
<ul class="list">
@isset($invoice->client['billing_address'])
@isset($invoice->customer_address['line1'])
<li class="list-item">
<b>Address:</b>
<span>{{ $invoice->client['billing_address'] }}</span>
<span>{{ $invoice->customer_address['line1'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_city'])
@isset($invoice->customer_address['city'])
<li class="list-item">
<b>City:</b>
<span>{{ $invoice->client['billing_city'] }}</span>
<span>{{ $invoice->customer_address['city'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_state'])
@isset($invoice->customer_address['state'])
<li class="list-item">
<b>State:</b>
<span>{{ $invoice->client['billing_state'] }}</span>
<span>{{ $invoice->customer_address['state'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_postal_code'])
@isset($invoice->customer_address['postal_code'])
<li class="list-item">
<b>Postal code:</b>
<span>{{ $invoice->client['billing_postal_code'] }}</span>
<span>{{ $invoice->customer_address['postal_code'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_country'])
@isset($invoice->customer_address['country'])
<li class="list-item">
<b>Country:</b>
<span>{{ $invoice->client['billing_country'] }}</span>
<span>{{ $invoice->customer_address['country'] }}</span>
</li>
@endisset
</ul>
@@ -175,18 +175,16 @@
</tr>
</thead>
<tbody class="table-body">
@foreach($invoice->bag as $item)
<tr>
<td>{{ $item['description'] }} (1)</td>
<td>{{ $item['date'] }}</td>
<td>{{ $item['amount'] }} {{ $invoice->currency }}</td>
<td>{{ $invoice->subscriptions()[0]->description }}</td>
<td>{{ $invoice->subscriptions()[0]->type }}</td>
<td>{{ \Laravel\Cashier\Cashier::formatAmount($invoice->subscriptions()[0]->amount) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="invoice-summary">
<b>Total {{ $invoice->total }} {{ $invoice->currency }}</b>
<b>Total {{ $invoice->total() }}</b>
</div>
</div>
</body>