diff --git a/app/Classes/General/Eloquent/Filters/WithOwner.php b/app/Classes/General/Eloquent/Filters/WithOwner.php
new file mode 100644
index 00000000..7d31691e
--- /dev/null
+++ b/app/Classes/General/Eloquent/Filters/WithOwner.php
@@ -0,0 +1,20 @@
+with('owner');
+ }
+}
\ No newline at end of file
diff --git a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php
index 9e656e0b..5b331fca 100644
--- a/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php
+++ b/app/Classes/Modules/Billplzs/Services/CreatesBillplzBill.php
@@ -4,7 +4,6 @@ namespace App\Classes\Modules\Billplzs\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
-use phpDocumentor\Reflection\Types\Boolean;
class CreatesBillplzBill
{
@@ -20,7 +19,7 @@ class CreatesBillplzBill
* @return null|object
* @throws MalformedRequestException
*/
- public function execute(string $name, string $email, string $description, float $amount, string $billNumber, ?string $bankCode = null, ?Boolean $wallet = null) {
+ public function execute(string $name, string $email, string $description, float $amount, string $billNumber, ?string $bankCode = null, ?bool $wallet = null) {
try{
// config('billplz.maybank')
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->post(config('billplz.base_url').'/api/v3/bills', [
diff --git a/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php b/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php
index 3c3459e2..514c32cd 100644
--- a/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php
+++ b/app/Classes/Modules/Bookings/ControllersLogic/DownloadBookingDocumentLogic.php
@@ -3,64 +3,39 @@
namespace App\Classes\Modules\Bookings\ControllersLogic;
+use Illuminate\Support\Facades\File;
use ZipArchive;
use Carbon\Carbon;
use App\Models\User;
use App\Models\Booking;
use Illuminate\Http\Request;
-use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
-use App\Classes\ValueObjects\Constants\TransactionType;
-use App\Classes\General\Abstracts\AbstractControllerLogic;
-class DownloadBookingDocumentLogic extends AbstractControllerLogic
+class DownloadBookingDocumentLogic
{
- /**
- * @return array
- */
- protected function notification(): array
- {
- return [
- 'title' => 'Download Booking Document',
- 'message' => 'You have successfully retrieved a Booking Document'
- ];
- }
-
- /**
- * DownloadBookingDocumentLogic constructor.
- */
- public function __construct()
- {
- }
-
/**
* @param Request $request
- * @return JsonResponse
- * @throws \App\Classes\Exceptions\AccessForbiddenException
- * @throws \App\Classes\Exceptions\RequestValidationException
+ * @return void
+ * @throws MalformedRequestException
*/
- public function logic(Request $request): JsonResponse
+ public function execute(Request $request)
{
Auth::login(User::findOrFail(1));
- $zip_file = 'do_' . Carbon::yesterday()->format('Y_m_d') . '.zip';
- $attachment = storage_path() . '/' . $zip_file;
+ $zip_file = $request->input('type').'.zip';
+ $attachment = storage_path().'/app/documents/collections/' . $zip_file;
$zip = new ZipArchive();
if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) {
- $bookings = Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', '>=', $request->input('startDate'))->whereDate('updated_at', '<=', $request->input('endDate'))
- ->whereHas('transactions', function ($query) {
- return $query->where('type', TransactionType::PAYMENT)->whereHas('transactions', function ($query) {
- return $query->where('issuer', 2);
- });
- })->get();
+ $bookings = Booking::where('status', ApprovalStatus::COMPLETED)
+ ->whereDate('created_at', '>=', Carbon::parse($request->input('startDate')))
+ ->whereDate('created_at', '<=', Carbon::parse($request->input('endDate')))->get();
if (!count($bookings)) throw new MalformedRequestException('No available file to download');
@@ -70,7 +45,6 @@ class DownloadBookingDocumentLogic extends AbstractControllerLogic
}
$zip->close();
-
while (ob_get_level()) {
ob_end_clean();
}
@@ -86,9 +60,14 @@ class DownloadBookingDocumentLogic extends AbstractControllerLogic
readfile($attachment);
File::delete($attachment);
-
+
exit;
+// header('Content-Type: application/zip');
+// header('Content-Length: ' . filesize($attachment));
+// readfile($attachment);
+// unlink($attachment);
+
}
}
}
diff --git a/app/Classes/Modules/Wallets/ControllersLogic/CreditWalletLogic.php b/app/Classes/Modules/Wallets/ControllersLogic/CreditWalletLogic.php
index 1e7b3ceb..60dd95cb 100644
--- a/app/Classes/Modules/Wallets/ControllersLogic/CreditWalletLogic.php
+++ b/app/Classes/Modules/Wallets/ControllersLogic/CreditWalletLogic.php
@@ -102,13 +102,13 @@ class CreditWalletLogic extends AbstractControllerLogic
$wallet = $company->wallets()->first();
$billNumber = $this->generatesTransactionBillNumber->execute($type === 2 ? 'DEBIT-NOTE-' : 'CREDIT-NOTE-');
-
- $transaction_object = new TransactionObject($billNumber, $type === 2 ? TransactionType::DEBIT_NOTE : TransactionType::CREDIT_NOTE, 1, $wallet->company->id, 1, PaymentMethodType::CASH, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::APPROVED, [], $reference);
+
+ $transaction_object = new TransactionObject($billNumber, $type === 2 ? TransactionType::DEBIT_NOTE : TransactionType::CREDIT_NOTE, 1, $wallet->owner->id, 1, PaymentMethodType::CASH, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::APPROVED, [], $reference);
$transaction = $this->createsTransaction->execute($wallet, $transaction_object);
$updateWalletAmount = $type === 2 ? ($wallet->amount - $transaction->amount) : ($wallet->amount + $transaction->amount);
- $walletObject = new WalletObject($wallet->company->id, $wallet->currency_id, $wallet->code, $updateWalletAmount);
+ $walletObject = new WalletObject($wallet->owner->id, $wallet->currency_id, $wallet->code, $updateWalletAmount);
$wallet = $this->updatesWallet->execute($wallet, $walletObject);
diff --git a/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php b/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php
index 461e48fc..95427363 100644
--- a/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php
+++ b/app/Http/Controllers/Bookings/DownloadBookingDocumentController.php
@@ -11,9 +11,10 @@ class DownloadBookingDocumentController
/**
* @param Request $request
* @param DownloadBookingDocumentLogic $logic
- * @return JsonResponse
+ * @return void
+ * @throws \App\Classes\Exceptions\MalformedRequestException
*/
- public function download(Request $request, DownloadBookingDocumentLogic $logic): JsonResponse {
+ public function download(Request $request, DownloadBookingDocumentLogic $logic) {
return $logic->execute($request);
}
diff --git a/app/Http/Controllers/Transactions/ListWalletTransactionsController.php b/app/Http/Controllers/Transactions/ListWalletTransactionsController.php
index d084b252..e83d7b58 100644
--- a/app/Http/Controllers/Transactions/ListWalletTransactionsController.php
+++ b/app/Http/Controllers/Transactions/ListWalletTransactionsController.php
@@ -3,19 +3,19 @@
namespace App\Http\Controllers\Transactions;
+use App\Classes\Modules\Transactions\ControllersLogic\ListWalletTransactionsLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
-use App\Classes\Modules\Transactions\ControllersLogic\ListTransactionsLogic;
class ListWalletTransactionsController
{
/**
* @param Request $request
- * @param ListTransactionsLogic $logic
+ * @param ListWalletTransactionsLogic $logic
* @return JsonResponse
*/
- public function list(Request $request, ListTransactionsLogic $logic) : JsonResponse {
+ public function list(Request $request, ListWalletTransactionsLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
diff --git a/app/Http/Resources/DocumentResource.php b/app/Http/Resources/DocumentResource.php
index 2595ed55..59933a67 100644
--- a/app/Http/Resources/DocumentResource.php
+++ b/app/Http/Resources/DocumentResource.php
@@ -2,6 +2,7 @@
namespace App\Http\Resources;
+use App\Models\Booking;
use App\Models\Company;
use App\Models\Document;
use Carbon\Carbon;
@@ -23,7 +24,7 @@ class DocumentResource extends JsonResource
'reference' => $this->reference,
'status' => (int) $this->status,
'document_type' => $this->document_type,
- 'owner' => new CompanyResource($this->whenLoaded('owner')),
+ 'owner' => $this->relationLoaded('owner') ? ($this->owner instanceof Booking ? new BookingResource($this->owner) : new CompanyResource($this->owner)) : null,
'files' => FileResource::collection($this->files),
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A')
];
diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php
index 69e0a264..efcdb99c 100644
--- a/app/Http/Resources/TransactionResource.php
+++ b/app/Http/Resources/TransactionResource.php
@@ -17,6 +17,7 @@ class TransactionResource extends JsonResource
public function toArray($request)
{
$booking = (int)$this->type === TransactionType::BILL ? $this->owner->owner : $this->booking;
+ $days = Carbon::parse($this->created_at)->addDays($booking->service_id === 1 ? 1 : 2);
return [
'id' => $this->id,
@@ -41,8 +42,8 @@ class TransactionResource extends JsonResource
'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'),
'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'),
+ 'value' => $days->gt(Carbon::now()) ? '+' : '-',
+ 'duration' => $days->diff(Carbon::now())->format('%d'),
]
];
}
diff --git a/resources/assets/images/10107.jpg b/resources/assets/images/10107.jpg
new file mode 100644
index 00000000..cffb1f8f
Binary files /dev/null and b/resources/assets/images/10107.jpg differ
diff --git a/resources/assets/images/first_topup_badge.png b/resources/assets/images/first_topup_badge.png
new file mode 100644
index 00000000..dce1b545
Binary files /dev/null and b/resources/assets/images/first_topup_badge.png differ
diff --git a/resources/assets/images/hot.png b/resources/assets/images/hot.png
new file mode 100644
index 00000000..46520b44
Binary files /dev/null and b/resources/assets/images/hot.png differ
diff --git a/resources/assets/images/new-icon.png b/resources/assets/images/new-icon.png
new file mode 100644
index 00000000..4131f31e
Binary files /dev/null and b/resources/assets/images/new-icon.png differ
diff --git a/resources/assets/images/wallet_announcement.png b/resources/assets/images/wallet_announcement.png
new file mode 100644
index 00000000..bb03ce79
Binary files /dev/null and b/resources/assets/images/wallet_announcement.png differ
diff --git a/resources/assets/images/wallet_announcement_2.png b/resources/assets/images/wallet_announcement_2.png
new file mode 100644
index 00000000..79c6a32f
Binary files /dev/null and b/resources/assets/images/wallet_announcement_2.png differ
diff --git a/resources/assets/sass/_responsive.scss b/resources/assets/sass/_responsive.scss
index 622c734a..fa7bb2f7 100644
--- a/resources/assets/sass/_responsive.scss
+++ b/resources/assets/sass/_responsive.scss
@@ -1184,4 +1184,8 @@
border: 1px solid #d9d9d9;
border-top: none;
pointer-events: none;
+}
+
+.top-0 {
+ top: 0;
}
\ No newline at end of file
diff --git a/resources/assets/sass/modules/_typography.scss b/resources/assets/sass/modules/_typography.scss
index 6e9934dc..605b8e7c 100644
--- a/resources/assets/sass/modules/_typography.scss
+++ b/resources/assets/sass/modules/_typography.scss
@@ -439,6 +439,10 @@ hr{
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 75%);
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.8) 75%);
}
+.gradient-white {
+ background: -webkit-linear-gradient(top, rgba(255,255,255, 0.5) 0%, rgba(255,255,255, 0.9) 75%);
+ background: linear-gradient(to bottom, rgba(255,255,255, 0.5) 0%, rgba(255,255,255, 0.9) 75%);
+}
/* Other Colors
------------------------------------
diff --git a/resources/assets/vue/components/bookings/elements/BillingComponent.vue b/resources/assets/vue/components/bookings/elements/BillingComponent.vue
new file mode 100644
index 00000000..bfa8b2d9
--- /dev/null
+++ b/resources/assets/vue/components/bookings/elements/BillingComponent.vue
@@ -0,0 +1,109 @@
+
+