From 79e4555218bb6adac1c23bc5fc7276799cc6ac08 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Sun, 22 Aug 2021 16:16:21 +0800 Subject: [PATCH 1/6] change email address ui --- .../elements/UserProfileComponent.vue | 6 ++- .../settings/forms/EditEmailFormComponent.vue | 44 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue diff --git a/resources/assets/vue/components/settings/elements/UserProfileComponent.vue b/resources/assets/vue/components/settings/elements/UserProfileComponent.vue index d2610144..05dff8bd 100644 --- a/resources/assets/vue/components/settings/elements/UserProfileComponent.vue +++ b/resources/assets/vue/components/settings/elements/UserProfileComponent.vue @@ -37,7 +37,7 @@
-
+
Request Email Change
@@ -50,6 +50,10 @@ + + + +
diff --git a/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue new file mode 100644 index 00000000..13143db0 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue @@ -0,0 +1,44 @@ + + \ No newline at end of file From 508e71aeb4a0374ed14423238c0ca62cea31840c Mon Sep 17 00:00:00 2001 From: omair saleh Date: Tue, 24 Aug 2021 13:03:05 +0800 Subject: [PATCH 2/6] hide announcement from user profile --- resources/views/pages/settings.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/pages/settings.blade.php b/resources/views/pages/settings.blade.php index 8fb76ae2..9157dbc5 100644 --- a/resources/views/pages/settings.blade.php +++ b/resources/views/pages/settings.blade.php @@ -570,7 +570,7 @@
-
+
From ca1936d4ebcd5ed684cdffaf96b50acc3053245f Mon Sep 17 00:00:00 2001 From: edmondlang Date: Tue, 24 Aug 2021 13:05:55 +0800 Subject: [PATCH 3/6] change email address ui, add input column for email --- .../settings/forms/EditEmailFormComponent.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue index 13143db0..68ef720a 100644 --- a/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue @@ -5,8 +5,15 @@
-

Edit Email

-

An edit email link will send to your email account

+

Edit Email Address

+
+
+
+
+
Email Address
+ + +
@@ -19,7 +26,7 @@
Cancel
-
Confirm
+
Update
@@ -28,17 +35,17 @@
\ No newline at end of file From 165d80537e6546058265d3cf150eec51bedd2ecb Mon Sep 17 00:00:00 2001 From: fuadzaidan7 Date: Mon, 6 Sep 2021 13:34:14 +0800 Subject: [PATCH 4/6] Signed-off-by: fuadzaidan7 --- .../CalculatesBookingCurrencyAverageRate.php | 16 +++++-- .../views/pages/pdfs/deliver_order.blade.php | 40 +++++++++++++----- resources/views/pages/pdfs/invoice.blade.php | 40 +++++++++++++----- .../views/pages/pdfs/purchase_order.blade.php | 42 ++++++++++++++----- .../pdfs/supplier_deliver_order.blade.php | 38 +++++++++++++---- 5 files changed, 132 insertions(+), 44 deletions(-) diff --git a/app/Classes/Modules/Bookings/Services/CalculatesBookingCurrencyAverageRate.php b/app/Classes/Modules/Bookings/Services/CalculatesBookingCurrencyAverageRate.php index e00ab114..235d897a 100644 --- a/app/Classes/Modules/Bookings/Services/CalculatesBookingCurrencyAverageRate.php +++ b/app/Classes/Modules/Bookings/Services/CalculatesBookingCurrencyAverageRate.php @@ -12,16 +12,24 @@ class CalculatesBookingCurrencyAverageRate public function execute(Booking $booking, $type){ if ($type == TransactionType::PAYMENT) { - return $booking->transactions() + + $amount_without_service = $booking->transactions() ->where('type', TransactionType::PAYMENT) ->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]) - ->avg('currency_rate'); + ->selectRaw('ROUND(amount,2)-ROUND(service_charge,2) AS amount_without_service') + ->get()->sum('amount_without_service'); + + return number_format($booking->fix_amount/$amount_without_service,2); } else if ($type == TransactionType::BILL) { - return $booking->transactions() + + $amount_without_service = $booking->transactions() ->where('type', TransactionType::BILL) ->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]) - ->avg('currency_rate'); + ->selectRaw('ROUND(amount,2)-ROUND(service_charge,2) AS amount_without_service') + ->get()->sum('amount_without_service'); + + return number_format($booking->fix_amount/$amount_without_service,2); } } diff --git a/resources/views/pages/pdfs/deliver_order.blade.php b/resources/views/pages/pdfs/deliver_order.blade.php index c45d27f7..e7256b1f 100644 --- a/resources/views/pages/pdfs/deliver_order.blade.php +++ b/resources/views/pages/pdfs/deliver_order.blade.php @@ -77,18 +77,22 @@ Stock Code Description Quantity - Unit Price (RM) + Unit Price (RM) Total Amount
(RM) + @php + $subtotal = 0; + @endphp + @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) {{ $key + 1 }} {{ $transaction_detail->product_code }} {{ $transaction_detail->product_name }} {{ $transaction_detail->quantity }} - + @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) {{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }} @else @@ -97,9 +101,18 @@ @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }} - @else - {{ number_format($transaction_detail->amount, 2) }} + + {{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp + @else + {{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp @endif @@ -110,11 +123,7 @@ Subtotal - @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }} - @else - {{ number_format($invoice_transaction->amount, 2) }} - @endif + {{ number_format($subtotal, 2) }} @@ -124,6 +133,17 @@ {{ number_format($invoice_transaction->service_charge, 2) }} + + + Adjustment + + @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) + {{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} + @else + {{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} + @endif + + @if($invoice_transaction->tax > 0) diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php index 3bad3ac0..7d6e88ca 100644 --- a/resources/views/pages/pdfs/invoice.blade.php +++ b/resources/views/pages/pdfs/invoice.blade.php @@ -76,18 +76,22 @@ Stock Code Description Quantity - Unit Price (RM) + Unit Price (RM) Total Amount
(RM) + @php + $subtotal = 0; + @endphp + @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) {{ $key + 1 }} {{ $transaction_detail->product_code }} {{ $transaction_detail->product_name }} {{ $transaction_detail->quantity }} - + @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) {{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }} @else @@ -96,9 +100,18 @@ @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }} - @else - {{ number_format($transaction_detail->amount, 2) }} + + {{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp + @else + {{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp @endif @@ -109,11 +122,7 @@ Subtotal - @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }} - @else - {{ number_format($invoice_transaction->amount, 2) }} - @endif + {{ number_format($subtotal, 2) }} @@ -123,6 +132,17 @@ {{ number_format($invoice_transaction->service_charge, 2) }} + + + Adjustment + + @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) + {{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} + @else + {{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} + @endif + + @if($invoice_transaction->tax > 0) diff --git a/resources/views/pages/pdfs/purchase_order.blade.php b/resources/views/pages/pdfs/purchase_order.blade.php index 2d1327cd..c2c17481 100644 --- a/resources/views/pages/pdfs/purchase_order.blade.php +++ b/resources/views/pages/pdfs/purchase_order.blade.php @@ -81,18 +81,22 @@ Stock Code Description Quantity - Unit Price (RM) + Unit Price (RM) Total Amount
(RM) + @php + $subtotal = 0; + @endphp + @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) {{ $key + 1 }} {{ $transaction_detail->product_code }} {{ $transaction_detail->product_name }} {{ $transaction_detail->quantity }} - + @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) {{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }} @else @@ -101,9 +105,18 @@ @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->amount, 2) }} - @else - {{ number_format($transaction_detail->amount, 2) }} + + {{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp + @else + {{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp @endif @@ -112,13 +125,9 @@ - Subtotal + Subtotal - @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2) }} - @else - {{ number_format($invoice_transaction->amount, 2) }} - @endif + {{ number_format($subtotal, 2) }} @@ -128,6 +137,17 @@ {{ number_format($invoice_transaction->service_charge, 2) }} + + + Adjustment + + @if($invoice_transaction->booking()->first()->fix_currency_id !== 1) + {{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} + @else + {{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} + @endif + + @if($invoice_transaction->tax > 0) diff --git a/resources/views/pages/pdfs/supplier_deliver_order.blade.php b/resources/views/pages/pdfs/supplier_deliver_order.blade.php index 5b736e39..57b4ed0a 100644 --- a/resources/views/pages/pdfs/supplier_deliver_order.blade.php +++ b/resources/views/pages/pdfs/supplier_deliver_order.blade.php @@ -66,18 +66,22 @@ Stock Code Description Quantity - Unit Price (RM) + Unit Price (RM) Total Amount
(RM) + @php + $subtotal = 0; + @endphp + @foreach ($po_order_transaction->transactionDetails as $key => $transaction_detail) {{ $key + 1 }} {{ $transaction_detail->product_code }} {{ $transaction_detail->product_name }} {{ $transaction_detail->quantity }} - + @if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1) {{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->price, 2) }} @else @@ -86,9 +90,18 @@ @if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->amount, 2) }} - @else - {{ number_format($transaction_detail->amount, 2) }} + + {{ number_format((float)number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp + @else + {{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }} + + @php + $subtotal += number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.',''); + @endphp @endif @@ -99,10 +112,17 @@ Subtotal - @if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1) - {{ number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $supplier_deliver_order_transaction->amount, 2) }} - @else - {{ number_format($supplier_deliver_order_transaction->amount, 2) }} + {{ number_format($subtotal, 2) }} + + + + + Adjustment + + @if($supplier_deliver_order_transaction->booking()->first()->fix_currency_id !== 1) + {{ number_format((float)number_format( (1/$supplier_deliver_order_transaction->currency_rate) * $supplier_deliver_order_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} + @else + {{ number_format((float)number_format($supplier_deliver_order_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }} @endif From f68fd19b7f1058ab1aadeb38de046d933fae1d40 Mon Sep 17 00:00:00 2001 From: glovetleong Date: Wed, 8 Sep 2021 17:38:24 +0800 Subject: [PATCH 5/6] -created data on OP -fix payment proof file select bug --- .../bookings/elements/PaymentProofComponent.vue | 14 ++++++++++++-- resources/views/pages/pdfs/deliver_order.blade.php | 2 +- resources/views/pages/pdfs/invoice.blade.php | 2 +- .../pages/pdfs/supplier_deliver_order.blade.php | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue index b684d64e..5356070b 100644 --- a/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue +++ b/resources/assets/vue/components/bookings/elements/PaymentProofComponent.vue @@ -39,7 +39,7 @@
-
+
- +
@@ -63,6 +63,16 @@ diff --git a/resources/views/pages/pdfs/deliver_order.blade.php b/resources/views/pages/pdfs/deliver_order.blade.php index e7256b1f..a2c77a66 100644 --- a/resources/views/pages/pdfs/deliver_order.blade.php +++ b/resources/views/pages/pdfs/deliver_order.blade.php @@ -34,7 +34,7 @@
REF: {{ $invoice_transaction->payment_reference ?? '-' }}
-
Date: {{ $invoice_transaction->created_at }}
+
Date: {{ $po_order_transaction->created_at }}
 
diff --git a/resources/views/pages/pdfs/invoice.blade.php b/resources/views/pages/pdfs/invoice.blade.php index 7d6e88ca..611d4362 100644 --- a/resources/views/pages/pdfs/invoice.blade.php +++ b/resources/views/pages/pdfs/invoice.blade.php @@ -33,7 +33,7 @@
Ref# {{ $invoice_transaction->payment_reference ?? '-' }}
-
Date: {{ $invoice_transaction->created_at }}
+
Date: {{ $po_order_transaction->created_at }}
 
diff --git a/resources/views/pages/pdfs/supplier_deliver_order.blade.php b/resources/views/pages/pdfs/supplier_deliver_order.blade.php index 57b4ed0a..22de6719 100644 --- a/resources/views/pages/pdfs/supplier_deliver_order.blade.php +++ b/resources/views/pages/pdfs/supplier_deliver_order.blade.php @@ -20,7 +20,7 @@ PO#: {{ $supplier_deliver_order_transaction->bill_no }}
Ref#: {{ $supplier_deliver_order_transaction->payment_reference ?? '-' }}
- Date: {{ $supplier_deliver_order_transaction->created_at }} + Date: {{ $po_order_transaction->created_at }} From 6c39bc780ba7de0519a0542d7054307e028c8919 Mon Sep 17 00:00:00 2001 From: Haziq Danial Date: Sat, 11 Sep 2021 13:15:25 +0800 Subject: [PATCH 6/6] added update email controller and logic --- .../ControllersLogic/AddNewMemberLogic.php | 75 +++++++++++++++++++ .../Companies/AddNewMemberController.php | 17 +++++ .../settings/forms/EditEmailFormComponent.vue | 4 +- routes/company.php | 4 +- 4 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 app/Classes/Modules/Accounts/ControllersLogic/AddNewMemberLogic.php create mode 100644 app/Http/Controllers/Companies/AddNewMemberController.php diff --git a/app/Classes/Modules/Accounts/ControllersLogic/AddNewMemberLogic.php b/app/Classes/Modules/Accounts/ControllersLogic/AddNewMemberLogic.php new file mode 100644 index 00000000..280cf188 --- /dev/null +++ b/app/Classes/Modules/Accounts/ControllersLogic/AddNewMemberLogic.php @@ -0,0 +1,75 @@ + 'Updated Email', + 'message' => 'Successfully updated email' + ]; + } + + + public function __construct(CreateUserProcessor $createUserProcessor, AssignEmployeeProcessor $assignEmployeeProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor) + { + $this->createUserProcessor = $createUserProcessor; + $this->assignEmployeeProcessor = $assignEmployeeProcessor; + $this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor; + } + + public function logic(Request $request): JsonResponse + { + $new_email = $request->input('name'); + $user = Auth::user(); + $company = $user->company()->first(); + $user->email = $new_email; + + request()->request->add([ + 'name' => $user->name, + 'email' => $new_email, + 'password' => $user->getAuthPassword(), + 'password_confirmation' => $user->getAuthPassword() + ]); + + /** @var User $user */ + $user = $this->createUserProcessor->execute($request, RoleTypes::USER, ApprovalStatus::PENDING_VERIFICATION); + + $Object = new EmploymentObject($company, $user); + $this->assignEmployeeProcessor->execute($Object); + + $this->generateEmailVerificationAttemptProcessor->execute($user); + return $this->response([ + 'message' => 'test' + ]); + } +} diff --git a/app/Http/Controllers/Companies/AddNewMemberController.php b/app/Http/Controllers/Companies/AddNewMemberController.php new file mode 100644 index 00000000..e55f46b9 --- /dev/null +++ b/app/Http/Controllers/Companies/AddNewMemberController.php @@ -0,0 +1,17 @@ +logic($request); + } +} diff --git a/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue index 68ef720a..9fb3ae21 100644 --- a/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue @@ -26,7 +26,7 @@
Cancel
-
Update
+
Update
@@ -48,4 +48,4 @@ mixins: [updateProfileFormValidation] } - \ No newline at end of file + diff --git a/routes/company.php b/routes/company.php index e964d741..f5c4dfbc 100644 --- a/routes/company.php +++ b/routes/company.php @@ -9,6 +9,8 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani Route::put('/update/{id}', 'UpdateCompanyController@update')->name('update'); Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete'); + Route::post('/team/create', 'AddNewMemberController@create')->name('team.create'); + Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () { Route::post('/assign', 'AssignCompanyToSegmentController@assign')->name('assign'); Route::delete('/detach/{segment_id}', 'RemoveCompanyFromSegmentController@detach')->name('detach'); @@ -25,4 +27,4 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani Route::put('/{document_id}/approval/{status}', 'ApproveIdentificationDocumentController@approve')->where('status', 'approve|reject')->name('approval'); }); -}); \ No newline at end of file +});