mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 05:53:58 +00:00
Merge branch 'update-service-content' into 'development'
Update service content See merge request CIEFWorldwideSdnBhd/exchange-2.0!77
This commit is contained in:
@@ -53,24 +53,18 @@ class DeleteUserLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
$user = $this->fetchesUser->execute(['id' => $request->route('id')]);
|
||||
$this->canDeleteUser->passes();
|
||||
$this->deletesUser->execute($user);
|
||||
|
||||
$user = $this->fetchesUser->execute(['id' => $request->route('id')]);
|
||||
$this->canDeleteUser->passes();
|
||||
$this->deletesUser->execute($user);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return $this->resourceResponse(new UserResource($user));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
return $this->resourceResponse(new UserResource($user));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ class AddressObject implements DataTransferObject
|
||||
/** @var int */
|
||||
private $districtId;
|
||||
|
||||
/** @var int */
|
||||
/** @var string */
|
||||
private $postCode;
|
||||
|
||||
/**
|
||||
@@ -32,9 +32,9 @@ class AddressObject implements DataTransferObject
|
||||
* @param int $countryId
|
||||
* @param int $stateId
|
||||
* @param int $districtId
|
||||
* @param int $postCode
|
||||
* @param string $postCode
|
||||
*/
|
||||
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode)
|
||||
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, string $postCode)
|
||||
{
|
||||
$this->streetOne = $streetOne;
|
||||
$this->streetTwo = $streetTwo;
|
||||
@@ -85,9 +85,9 @@ class AddressObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @return string
|
||||
*/
|
||||
public function getPostCode(): int
|
||||
public function getPostCode(): string
|
||||
{
|
||||
return $this->postCode;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Bookings\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Bookings\DataTransferObjects\BookingObject;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanDeleteBooking extends AbstractRule
|
||||
{
|
||||
@@ -14,7 +15,7 @@ class CanDeleteBooking extends AbstractRule
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
|
||||
if (!\Auth::user()->can('delete booking')) {
|
||||
if (!Auth::user()->can('delete booking')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\Bookings\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Bookings\Standards\Validators\BookingValidation;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanUpdateBooking extends AbstractRule
|
||||
{
|
||||
@@ -29,7 +30,7 @@ class CanUpdateBooking extends AbstractRule
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
|
||||
if (!\Auth::user()->can('edit booking')) {
|
||||
if (!Auth::user()->can('edit booking')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\Currencies\Standards\Rules\Rates;
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Currencies\Standards\Validators\Rates\RateValidation;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\RateObject;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanCreateRate extends AbstractRule
|
||||
{
|
||||
@@ -27,7 +28,7 @@ class CanCreateRate extends AbstractRule
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
if (!\Auth::user()->can('add currency_rate')) {
|
||||
if (!Auth::user()->can('add currency_rate')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Currencies\Standards\Rules\Rates;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\RateObject;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanDeleteRate extends AbstractRule
|
||||
{
|
||||
@@ -14,7 +15,7 @@ class CanDeleteRate extends AbstractRule
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
|
||||
if (!\Auth::user()->can('delete currency_rate')) {
|
||||
if (!Auth::user()->can('delete currency_rate')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Currencies\Standards\Rules\Rates;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyObject;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanListRates extends AbstractRule
|
||||
{
|
||||
@@ -14,7 +15,7 @@ class CanListRates extends AbstractRule
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
|
||||
if (!\Auth::user()->can('view currency_rate')) {
|
||||
if (!Auth::user()->can('view currency_rate')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Currencies\Standards\Rules\Rates;
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Currencies\Standards\Validators\Rates\RateValidation;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\RateObject;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanUpdateRate extends AbstractRule
|
||||
{
|
||||
@@ -29,7 +30,7 @@ class CanUpdateRate extends AbstractRule
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
|
||||
if (!\Auth::user()->can('view currency_rate')) {
|
||||
if (!Auth::user()->can('view currency_rate')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\Segments\Standards\Rules;
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Classes\Modules\Segments\Standards\Validators\SegmentValidation;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanCreateSegment extends AbstractRule
|
||||
{
|
||||
@@ -27,7 +28,7 @@ class CanCreateSegment extends AbstractRule
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
if (!\Auth::user()->can('add segment')) {
|
||||
if (!Auth::user()->can('add segment')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Segments\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanDeleteSegment extends AbstractRule
|
||||
{
|
||||
@@ -14,7 +15,7 @@ class CanDeleteSegment extends AbstractRule
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
|
||||
if (!\Auth::user()->can('delete segment')) {
|
||||
if (!Auth::user()->can('delete segment')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Segments\Standards\Rules;
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Classes\Modules\Segments\Standards\Validators\SegmentValidation;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanUpdateSegment extends AbstractRule
|
||||
{
|
||||
@@ -30,7 +31,7 @@ class CanUpdateSegment extends AbstractRule
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
|
||||
if (!\Auth::user()->can('edit segment')) {
|
||||
if (!Auth::user()->can('edit segment')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,11 @@ class TransactionResource extends JsonResource
|
||||
'documents' => new DocumentResource($this->documents()->first()),
|
||||
'customer_booking' => new TransactionResource($this->when((int) $this->type === TransactionType::BILL, $this->booking->transactions()->payments()->complete()->where('original_amount', '=', $this->original_amount)->where('id', '<', $this->id)->orderByDesc('id')->first())),
|
||||
'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:i:s A'),
|
||||
'updated_at' => Carbon::parse($this->updated_at)->format('d-m-Y h:i:s A')
|
||||
'updated_at' => Carbon::parse($this->updated_at)->format('d-m-Y h:i:s A'),
|
||||
'interval' => [
|
||||
'value' => (Carbon::parse($this->created_at)->addDays(3)->gt(Carbon::now()) ) ? '+' : '-' ,
|
||||
'duration' => Carbon::parse($this->created_at)->addDays(3)->diff(Carbon::now())->format('%d'),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
@@ -23,7 +24,7 @@ class User extends AbstractModel implements
|
||||
AuthorizableContract,
|
||||
CanResetPasswordContract
|
||||
{
|
||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail;
|
||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail, SoftDeletes;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,6 +68,14 @@
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-lg-right">
|
||||
<div class="font-heading fs-10 muted all-caps">Service</div>
|
||||
<div class="font-heading fs-10">
|
||||
{{item.booking.service.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10">
|
||||
<div v-if="!no_action" class="col-6 col-md-auto text-right">
|
||||
<button class="btn btn-xs btn-outline-danger b-rad-none m-r-5 requestModal" data-type="rejectPayment">
|
||||
<i class="fa fa-times fa-fw"></i>
|
||||
|
||||
+15
-1
@@ -46,6 +46,12 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Service</div>
|
||||
<div class="font-heading fs-10">
|
||||
{{item.booking.service.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
@@ -60,12 +66,20 @@
|
||||
<span class="flag-icon" :class="'flag-icon-'+item.original_currency.country.short_code.toLowerCase()"></span> {{item.original_currency.short_code}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Amount</div>
|
||||
<div class="font-heading fs-12 text-success bold">
|
||||
{{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted all-caps">timer</div>
|
||||
<div class="font-heading fs-10" :class="[{'text-success': item.interval.value === '+'}, {'text-danger': item.interval.value === '-'}]">
|
||||
{{item.interval.value}}
|
||||
{{item.interval.duration}}
|
||||
days
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+60
-12
@@ -8,30 +8,30 @@
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-8 p-r-0">
|
||||
<div class="btn btn-xs btn-outline-primary btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="selectedSupplier.status = !selectedSupplier.status">
|
||||
<div class="col p-r-0">
|
||||
<div class="btn btn-xs btn-outline-primary btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="serviceDropdownLaunch.status = ! serviceDropdownLaunch.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-5 p-b-5 fs-9">
|
||||
{{selectedSupplier.name}}
|
||||
<div class="col p-t-5 p-b-5">
|
||||
{{selectedService.name}}
|
||||
</div>
|
||||
<div class="col-auto b-l b-success">
|
||||
<div class="col-auto b-l b-primary">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa" :class="[{'fa-angle-down': !selectedSupplier.status}, {'fa-angle-up': selectedSupplier.status}]"></i>
|
||||
<i class="fa" :class="[{'fa-angle-down': !serviceDropdownLaunch.status}, {'fa-angle-up': serviceDropdownLaunch.status}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-primary" :class="[{'hide': !selectedSupplier.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="absolute w-100 b-l b-b b-r b-success" v-show="serviceDropdownLaunch.status" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="supplier in suppliers" v-bind:key="supplier.id" :data="supplier">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10" :class="[{'bg-primary-light': selectedSupplier.id === supplier.id}, {'text-white': selectedSupplier.id === supplier.id}, {'hover-primary': selectedSupplier.id !== supplier.id}, {'pointer': selectedSupplier.id !== supplier.id}]" @click="updateSupplier(supplier)">
|
||||
<div class="row no-margin" v-for="service in selectedSupplier.services" v-bind:key="service.id" :data="service">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10" :class="[{'bg-primary-light': selectedService.id === service.id}, {'text-white': selectedService.id === service.id}, {'hover-primary': selectedService.id !== service.id}, {'pointer': selectedService.id !== service.id}]" @click="updateService(service)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">{{supplier.name}}</div>
|
||||
<div class="font-heading fs-10">{{service.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 p-r-0">
|
||||
<div class="col p-r-0">
|
||||
<div class="btn btn-xs btn-outline-primary btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="currencyDropdownLaunch.status = ! currencyDropdownLaunch.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-5 p-b-5">
|
||||
@@ -75,11 +75,46 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-5">
|
||||
<div class="col p-r-0">
|
||||
<div class="btn btn-xs btn-outline-primary btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="selectedSupplier.status = !selectedSupplier.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-5 p-b-5 fs-9">
|
||||
{{selectedSupplier.name}}
|
||||
</div>
|
||||
<div class="col-auto b-l b-success">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa" :class="[{'fa-angle-down': !selectedSupplier.status}, {'fa-angle-up': selectedSupplier.status}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-primary" :class="[{'hide': !selectedSupplier.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="supplier in suppliers" v-bind:key="supplier.id" :data="supplier">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10" :class="[{'bg-primary-light': selectedSupplier.id === supplier.id}, {'text-white': selectedSupplier.id === supplier.id}, {'hover-primary': selectedSupplier.id !== supplier.id}, {'pointer': selectedSupplier.id !== supplier.id}]" @click="updateSupplier(supplier)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">{{supplier.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list')" :options="{per_page: 10000, status: 2, type: 1, original_currency_id_in: [selectedCurrency.id]}">
|
||||
<list-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list')" :options="{per_page: 10000, status: 2, type: 1, original_currency_id_in: [selectedCurrency.id], service_type_id_in: [selectedService.id]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<supplier-pending-order-component :data="data" v-on:input="updateOrder($event)"></supplier-pending-order-component>
|
||||
</template>
|
||||
@@ -124,6 +159,14 @@
|
||||
currencyDropdownLaunch: {
|
||||
status: false
|
||||
},
|
||||
serviceDropdownLaunch: {
|
||||
status: false
|
||||
},
|
||||
selectedService: {
|
||||
id: 1,
|
||||
name: '',
|
||||
status: false
|
||||
},
|
||||
payments: []
|
||||
}
|
||||
},
|
||||
@@ -135,6 +178,7 @@
|
||||
this.suppliers = response.payload.data;
|
||||
this.updateSupplier(this.suppliers[0]);
|
||||
this.updateCurrency(this.suppliers[0].currencies[0]);
|
||||
this.updateService(this.suppliers[0].services[0]);
|
||||
},
|
||||
updateSupplier(supplier){
|
||||
this.selectedSupplier = supplier;
|
||||
@@ -151,6 +195,10 @@
|
||||
this.payments = [];
|
||||
|
||||
},
|
||||
updateService(service){
|
||||
this.selectedService = service;
|
||||
this.serviceDropdownLaunch.status = false;
|
||||
},
|
||||
updateOrder(payment){
|
||||
this.payments.includes(payment) ? this.payments.splice(this.payments.indexOf(payment), 1) : this.payments.push(payment);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user