From 3acde619cc155e5f3f662dcf297e25202d16160f Mon Sep 17 00:00:00 2001 From: omair saleh Date: Sun, 3 Oct 2021 15:06:08 +0800 Subject: [PATCH] add destination account admin user --- .../General/Eloquent/Filters/IssuerNot.php | 20 ++++++ .../ValueObjects/Constants/RoleTypes.php | 8 +++ app/Http/Resources/TransactionResource.php | 1 + app/Models/Transaction.php | 10 +++ .../banks/elements/BankInComponent.vue | 36 ++++++++++ .../bookings/elements/BookingComponent.vue | 4 +- .../elements/PaymentProofComponent.vue | 67 +++++++++---------- .../forms/PaymentProofFormComponent.vue | 1 + .../assets/vue/vuex/modules/authentication.js | 2 + .../views/pages/banks/customers.blade.php | 2 +- .../pages/dashboards/account_admin.blade.php | 13 ++++ .../views/pages/dashboards/admin.blade.php | 2 +- .../views/pages/dashboards/customer.blade.php | 2 +- .../views/pages/dashboards/index.blade.php | 1 + resources/views/pages/settings.blade.php | 45 +------------ resources/views/partials/header.blade.php | 2 +- routes/transaction.php | 1 + 17 files changed, 134 insertions(+), 83 deletions(-) create mode 100644 app/Classes/General/Eloquent/Filters/IssuerNot.php create mode 100644 resources/assets/vue/components/banks/elements/BankInComponent.vue create mode 100644 resources/views/pages/dashboards/account_admin.blade.php diff --git a/app/Classes/General/Eloquent/Filters/IssuerNot.php b/app/Classes/General/Eloquent/Filters/IssuerNot.php new file mode 100644 index 00000000..77423b5d --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/IssuerNot.php @@ -0,0 +1,20 @@ +where('issuer', '!=', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/ValueObjects/Constants/RoleTypes.php b/app/Classes/ValueObjects/Constants/RoleTypes.php index 3027bcb1..ec5fe961 100644 --- a/app/Classes/ValueObjects/Constants/RoleTypes.php +++ b/app/Classes/ValueObjects/Constants/RoleTypes.php @@ -16,4 +16,12 @@ final class RoleTypes public const USER = 3; + public const CURRENCY_SUPPLIER = 4; + + public const MONEY_MULE = 5; + + public const ORIGIN_ACCOUNT_ADMIN = 6; + + public const DESTINATION_ACCOUNT_ADMIN = 7; + } \ No newline at end of file diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index fc0dff73..1793d191 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -21,6 +21,7 @@ class TransactionResource extends JsonResource 'booking' => new BookingResource($this->booking), 'type' => (int) $this->type, 'bill_no' => $this->bill_no, + 'recipient_bank_account' => new BankResource($this->when((int) $this->type === TransactionType::BILL,$this->booking->bank)), 'amount' => (double) $this->amount, 'original_amount' => (double) $this->original_amount, 'currency' => new CurrencyResource($this->currency), diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 9d1ed5b9..2624117b 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -9,6 +9,8 @@ use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\HasOneThrough; use Illuminate\Database\Eloquent\Relations\MorphMany; @@ -24,6 +26,14 @@ class Transaction extends AbstractModel implements Documentable return $this->BelongsTo( Booking::class, 'booking_id', 'id'); } + /** + * @return BelongsTo + */ + public function recipientBankAccount(): BelongsTo + { + return $this->BelongsTo(Bank::class); + } + /** * @return MorphMany */ diff --git a/resources/assets/vue/components/banks/elements/BankInComponent.vue b/resources/assets/vue/components/banks/elements/BankInComponent.vue new file mode 100644 index 00000000..ff42850a --- /dev/null +++ b/resources/assets/vue/components/banks/elements/BankInComponent.vue @@ -0,0 +1,36 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/bookings/elements/BookingComponent.vue b/resources/assets/vue/components/bookings/elements/BookingComponent.vue index 509e9840..99c3228c 100644 --- a/resources/assets/vue/components/bookings/elements/BookingComponent.vue +++ b/resources/assets/vue/components/bookings/elements/BookingComponent.vue @@ -40,13 +40,13 @@
Payable Amount
{{this.item.amount}} {{this.item.fixed_currency.short_code}}
-
+
status
{{item.status === 3 ? 'Complete' : 'In Progress'}}
-
+
Billing
Pending... diff --git a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue index 5356070b..c403af9d 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue @@ -3,48 +3,45 @@
-
-
-
+
+
+
-
Reference
- -
- {{item.booking.marking}} + -
-
Date
-
- {{item.updated_at}}
+
-
-
Marking
-
- {{item.booking.company.reference}} -
-
-
-
Currency
-
- {{item.original_currency.short_code}} -
-
-
-
Amount
-
- {{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} -
-
-
-
+
+
+
+
+
+
+ style=" fill:#000000;">
diff --git a/resources/assets/vue/components/bookings/forms/PaymentProofFormComponent.vue b/resources/assets/vue/components/bookings/forms/PaymentProofFormComponent.vue index 612b8735..0c85a3f7 100644 --- a/resources/assets/vue/components/bookings/forms/PaymentProofFormComponent.vue +++ b/resources/assets/vue/components/bookings/forms/PaymentProofFormComponent.vue @@ -10,6 +10,7 @@
+
diff --git a/resources/assets/vue/vuex/modules/authentication.js b/resources/assets/vue/vuex/modules/authentication.js index b28ddb10..19ab2317 100644 --- a/resources/assets/vue/vuex/modules/authentication.js +++ b/resources/assets/vue/vuex/modules/authentication.js @@ -13,6 +13,8 @@ export default { isSuperAdmin: (state, getters) => getters.getDecodedAccessToken.user.type === 0 || getters.getDecodedAccessToken.user.type === 1, isAdmin: (state, getters) => getters.getDecodedAccessToken.user.type === 0 || getters.getDecodedAccessToken.user.type === 1 || getters.getDecodedAccessToken.user.type === 2, + isCustomer: (state, getters) => getters.getDecodedAccessToken.user.type === 3, + isDestinationAccountAdmin: (state, getters) => getters.getDecodedAccessToken.user.type === 7, getUserName: (state, getters) => getters.getUpdatedFullname || getters.getDecodedAccessToken.user.name, getUserId: (state, getters) => getters.getDecodedAccessToken.user.id, getUserEmail: (state, getters) => getters.getDecodedAccessToken.user.email, diff --git a/resources/views/pages/banks/customers.blade.php b/resources/views/pages/banks/customers.blade.php index d755c801..92901def 100644 --- a/resources/views/pages/banks/customers.blade.php +++ b/resources/views/pages/banks/customers.blade.php @@ -1,4 +1,4 @@ -
+
diff --git a/resources/views/pages/dashboards/account_admin.blade.php b/resources/views/pages/dashboards/account_admin.blade.php new file mode 100644 index 00000000..d3a1c657 --- /dev/null +++ b/resources/views/pages/dashboards/account_admin.blade.php @@ -0,0 +1,13 @@ +
+
+
+
+ + + +
+
+
+
\ No newline at end of file diff --git a/resources/views/pages/dashboards/admin.blade.php b/resources/views/pages/dashboards/admin.blade.php index 71944a13..31ad8d1c 100644 --- a/resources/views/pages/dashboards/admin.blade.php +++ b/resources/views/pages/dashboards/admin.blade.php @@ -328,7 +328,7 @@
- + diff --git a/resources/views/pages/dashboards/customer.blade.php b/resources/views/pages/dashboards/customer.blade.php index c5e842c2..3e877546 100644 --- a/resources/views/pages/dashboards/customer.blade.php +++ b/resources/views/pages/dashboards/customer.blade.php @@ -1,4 +1,4 @@ -
+
diff --git a/resources/views/pages/dashboards/index.blade.php b/resources/views/pages/dashboards/index.blade.php index 496640e4..a1d93610 100644 --- a/resources/views/pages/dashboards/index.blade.php +++ b/resources/views/pages/dashboards/index.blade.php @@ -2,4 +2,5 @@ @section('inner_content') @include('pages.dashboards.admin') @include('pages.dashboards.customer') + @include('pages.dashboards.account_admin') @endsection \ No newline at end of file diff --git a/resources/views/pages/settings.blade.php b/resources/views/pages/settings.blade.php index 9157dbc5..edb38329 100644 --- a/resources/views/pages/settings.blade.php +++ b/resources/views/pages/settings.blade.php @@ -512,17 +512,17 @@
-
+
-
+
-
+
-
-
-
-
-
-
-
- -
-
-
-
-
Announcements
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
diff --git a/resources/views/partials/header.blade.php b/resources/views/partials/header.blade.php index 9a0e09ad..ecbd150d 100644 --- a/resources/views/partials/header.blade.php +++ b/resources/views/partials/header.blade.php @@ -41,7 +41,7 @@
Urgent List
- diff --git a/routes/transaction.php b/routes/transaction.php index cab4d241..9f10c6cc 100644 --- a/routes/transaction.php +++ b/routes/transaction.php @@ -9,6 +9,7 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' => route::post('/supplier/{id}/bill/create', 'CreateSupplierTransactionController@create')->name('supplier.create'); route::post('{id}/bill/verification', 'CreatePaymentProofDocumentController@verify')->name('bill.verification'); + route::post('{id}/bill/pay', 'CreatePaymentProofDocumentController@pay')->name('bill.pay'); Route::post('booking/{id}/details/update', 'CreatePurchaseOrderTransactionController@create')->name('po.create');