Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0 into development

# Conflicts:
#	app/Http/Resources/TransactionResource.php
#	resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue
#	routes/web.php
This commit is contained in:
omair saleh
2021-12-21 19:42:28 +08:00
15 changed files with 308 additions and 51 deletions
@@ -4,7 +4,7 @@ namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class IssuerNot implements Filter
class IssuerNotIn implements Filter
{
/**
@@ -14,7 +14,7 @@ class IssuerNot implements Filter
*/
public static function apply(Builder $builder, $value)
{
return $builder->where('issuer', '!=', $value);
return $builder->whereNotIn('issuer', $value);
}
}
@@ -47,6 +47,8 @@ class ExportsCustomers implements FromQuery, WithHeadingRow, WithMapping
return [
$company->reference,
$company->name,
$company->employees()->first() ? $company->employees()->first()->name : '',
$company->contacts()->first() ? $company->contacts()->first()->phone : '',
$company->type === CompanyType::COMPANY_BUSINESS ? 'Company' : 'individual',
count($company->bookings),
$company->bookings()->sum('fix_amount'),
@@ -0,0 +1,91 @@
<?php
namespace App\Console\Commands;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use ZipArchive;
class EmailDoToVTCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'mail:EmailDoToVTCommand';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send do to vt nation';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Auth::login(User::findOrFail(1));
$zip_file = 'do_'.Carbon::yesterday()->format('Y_m_d').'.zip';
$attachment = storage_path().'/'.$zip_file;
$zip = new ZipArchive();
if ($zip->open($attachment, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE)) {
$bookings = \App\Models\Booking::where('status', ApprovalStatus::COMPLETED)->whereDate('updated_at', Carbon::yesterday())
->whereHas('transactions', function ($query){
return $query->where('type', TransactionType::BILL)->where('issuer', 2);
})->get();
if(!count($bookings)){ return; }
foreach ($bookings as $booking) {
$file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();
$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y').'_'.$booking->marking.'.pdf');
}
$zip->close();
Mail::raw( "Attention to VT Admin team:\r\n\r\nKindly refer to the attachment for our DAILY DO COMPILATION ".Carbon::yesterday()->format('d-m-Y').".\r\n\r\n**This is an automatically generated email please do not reply to it. If you have any queries kindly contact our admin team through Wechat.\r\n\r\n\r\nCIEF WORLDWIDE SDN BHD", function($message) use ($attachment){
$message->from('exchange@cief-malaysia.com');
$message->to(['vtnation16@gmail.com', 'vtnation@gmail.com', 'atvantic04@gmail.com', 'vtnation2@gmail.com']);
$message->cc(['shafiqa_sukeri@cief-malaysia.com', 'frontendcief@gmail.com', 'pm@cief-malaysia.com', 'hasan@cief-malaysia.com', 'shipping_admin@cief-malaysia.com', 'hasanakbar27@gmail.com', 'pmwong2019@gmail.com', 'uldvstar@gmail.com']);
$message->subject('CIEF DO COMPILATION '.Carbon::yesterday()->format('d-m-Y'));
$message->attach($attachment);
});
File::delete($attachment);
echo 'success';
}
}
}
+10
View File
@@ -2,8 +2,15 @@
namespace App\Console;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use ZipArchive;
class Kernel extends ConsoleKernel
{
@@ -23,7 +30,10 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('mail:EmailDoToVTCommand')->dailyAt('10:00')->withoutOverlapping();
}
/**
+1 -1
View File
@@ -3,7 +3,6 @@
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Transaction;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -25,6 +24,7 @@ class TransactionResource extends JsonResource
'payment_reference' => $this->payment_reference,
'payment_method' => (float) $this->payment_method,
'recipient_bank_account' => new BankResource($this->when((int) $this->type === TransactionType::BILL, $this->booking->bank)),
'issuer_name' => $this->issuerCompany->name,
'amount' => (double) $this->amount,
'original_amount' => (double) $this->original_amount,
'currency' => new CurrencyResource($this->currency),
+8
View File
@@ -48,6 +48,14 @@ class Transaction extends AbstractModel implements Documentable
return $this->BelongsTo(Wallet::class, 'owner_id', 'id');
}
/**
* @return BelongsTo
*/
public function issuerCompany(): BelongsTo
{
return $this->BelongsTo( Company::class, 'issuer', 'id');
}
/**
* @return BelongsTo
*/
@@ -28,12 +28,23 @@
{{item.booking.company.reference}}
</div>
</div>
<div class="col" v-if="item.status === 3">
<div v-for="file in item.documents.files" v-bind:key="file.id" class="col-auto no-padding m-l-5">
<document-file-viewer-component :file="file">
<template slot="button">
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-0">
<i class="fa fa-file-image-o fs-10"></i>
</div>
</template>
</document-file-viewer-component>
</div>
</div>
</div>
<bank-in-component :data="item"></bank-in-component>
</div>
</div>
</div>
<div class="col-2 b-a b-dashed b-success requestModal pointer" @click="selectedID(item.id)" data-type="paymentProofModal">
<div class="col-2 b-a b-dashed b-success requestModal pointer" v-if="item.status !== 3" @click="selectedID(item.id)" data-type="paymentProofModal">
<div class="row align-item-center justify-content-center h-100">
<div class="col-auto" >
<div class="row align-items-center h-100">
@@ -318,7 +318,7 @@
<div class="col-auto p-l-0">
<div class="font-heading fs-8 text-white all-caps">Payable</div>
<div class="font-heading fs-10 text-white bold">
{{item.original_currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
{{item.currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
</div>
</div>
</div>
File diff suppressed because one or more lines are too long
@@ -2,7 +2,14 @@
<div class="col">
<div class="row">
<div class="col col-md-5 bg-white padding-25">
<list-component ref="paymentProofList" section="paymentProofSection" :endpoint="route('api.transaction.list')" :options="{status: 2, type: 3, issuer_not: 2}">
<list-component ref="paymentProofList" section="paymentProofSection" :endpoint="route('api.transaction.list')" :options="{status: 2, type: 3, issuer_not_in: [2, 1937]}">
<template slot="list" slot-scope="{data}">
<payment-proof-component :data="data" class="m-b-15 m-r-0"></payment-proof-component>
</template>
</list-component>
</div>
<div class="col col-md-5 bg-white padding-25">
<list-component ref="paymentProofList" section="paymentProofHistorySection" :endpoint="route('api.transaction.list')" :options="{status: 3, type: 3, issuer_not_in: [2, 1937]}">
<template slot="list" slot-scope="{data}">
<payment-proof-component :data="data" class="m-b-15 m-r-0"></payment-proof-component>
</template>
@@ -31,6 +31,11 @@
<div class="text-white all-caps fs-12">Payments & Billing</div>
</a>
</div>
<div class="col-auto p-r-20" v-if="$store.getters.isAdmin">
<a href="{{route('currency_orders')}}">
<div class="text-white all-caps fs-12">Currency Orders</div>
</a>
</div>
<div class="col-auto p-r-20" v-if="$store.getters.isAdmin">
<a href="{{route('bookings')}}">
<div class="text-white all-caps fs-12">Transfers</div>
+7 -45
View File
@@ -1,10 +1,6 @@
<?php
use App\Models\User;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
/*
|--------------------------------------------------------------------------
@@ -55,8 +51,12 @@ Route::get('/payments', function () {
return view('pages.payments');
})->name('payments');
Route::get('/currency_orders', function () {
return view('pages.currency_orders');
})->name('currency_orders');
Route::get('/bookings', function () {
return view('pages.bookings');
return view('pages.bookings.index');
})->name('bookings');
Route::get('/bookings/urgent', function () {
@@ -64,50 +64,12 @@ Route::get('/bookings/urgent', function () {
})->name('bookings.urgent');
Route::get('/transfer/{marking}', function ($marking) {
return view('pages.booking_details', ['marking' => $marking]);
return view('pages.bookings.profile', ['marking' => $marking]);
})->name('booking.details');
Route::get('/transfer/merge/{marking}', function ($marking) {
return view('pages.booking_merge', ['marking' => $marking]);
return view('pages.bookings.merge', ['marking' => $marking]);
})->name('booking.merge');
Route::get('/test', function(){
// Auth::login(User::findOrFail(1));
// try {
// $zip_file = 'cief_jun_to_september_delivery_orders.zip'; // Name of our archive to download
// $zip = new ZipArchive();
// if ($zip->open(storage_path().'/'.$zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE) === TRUE) {
//
// //whereMonth('created_at', 5)->whereYear('created_at', 2021)->
// $bookings = \App\Models\Booking::where('status', \App\Classes\ValueObjects\Constants\ApprovalStatus::COMPLETED)->get();
//
// foreach ($bookings as $booking) {
// $file = $booking->documents()->where('document_type', \App\Classes\ValueObjects\Constants\DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();
// if (! $zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), Carbon::now()->format('d_m_Y').'_'.$booking->marking.'.pdf')) {
// echo 'Could not add file to ZIP: ' . $file;
// }
// }
//
// // Close ZipArchive
// $zip->close();
// } else {
// echo 'Could not open ZIP file.';
// }
// } catch (Exception $exception) {
// dd($exception);
// }
});
Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callback')->name('online_payment.redirect');
//Route::get('/online_payment/redirect', function () {
// return view('pages.billplz_redirect');
//})->name('online_payment.redirect');
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions');