Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0 into dillon/crm-integration

This commit is contained in:
edmondlang
2023-02-12 20:04:25 +08:00
50 changed files with 1157 additions and 468 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Classes\General\Traits;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
trait LogData
{
public static function boot()
{
parent::boot();
static::updating(function($model)
{
$tableName = Str::singular($model->table).'_logs';
$relationshipColumn = Str::singular($model->table).'_id';
$originalData = $model->getRawOriginal();
$originalData[$relationshipColumn] = $originalData['id'];
unset($originalData['id']);
// remove pivot columns
foreach($originalData as $key => $row){
if(str::startsWith($key, 'pivot_')){
unset($originalData[$key]);
}
}
if (!Schema::hasTable($tableName)) {
DB::statement('CREATE TABLE '.$tableName.' LIKE '.$model->table);
$indexs = DB::select('SHOW INDEX FROM '.$tableName.';');
$removedIndexes = [];
foreach ($indexs as $index){
if($index->Column_name === 'id' || in_array($index->Key_name, $removedIndexes)) continue;
DB::statement('ALTER TABLE '.$tableName.' drop index '.$index->Key_name);
$removedIndexes[] = $index->Key_name;
}
DB::statement('ALTER TABLE '.$tableName.' ADD COLUMN `'.$relationshipColumn.'` BIGINT NOT NULL AFTER `id`');
}
DB::table($tableName)->insert($originalData);
});
}
}
@@ -0,0 +1,61 @@
<?php
namespace App\Classes\Modules\Accounts\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Accounts\Services\FetchesUser;
use App\Classes\Modules\Accounts\Standards\Rules\CanFetchUser;
use App\Http\Resources\UserCompanyResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchUserByEmailLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved User',
'message' => 'You have successfully retrieved a User by email'
];
}
/** @var CanFetchUser */
private $canFetchUser;
/** @var FetchesUser */
private $fetchesUser;
/**
* FetchUserByEmailLogic constructor.
* @param CanFetchUser $canFetchUser
* @param FetchesUser $fetchesUser
*/
public function __construct(CanFetchUser $canFetchUser, FetchesUser $fetchesCompany)
{
$this->canFetchUser = $canFetchUser;
$this->fetchesUser = $fetchesCompany;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function logic(Request $request) : JsonResponse
{
$this->canFetchUser->passes();
$query = $this->fetchesUser->execute(['email' => $request->route('email')]);
return $this->resourceResponse(new UserCompanyResource($query));
}
}
@@ -0,0 +1,87 @@
<?php
namespace App\Classes\Modules\Bookings\ControllersLogic;
use App\Http\Resources\BookingResource;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Bookings\Services\FetchesBooking;
use App\Classes\Modules\Bookings\Standards\Rules\CanUpdateBooking;
use App\Classes\Modules\Bookings\Services\UpdatesBookingOwner;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Bookings\Standards\Rules\CanFetchBooking;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Models\Company;
class UpdateBookingOwnerLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification(): array
{
return [
'title' => 'Update Booking Owner',
'message' => "You have successfully updated booking's owner"
];
}
/** @var CanUpdateBooking */
private $canUpdateBooking;
/** @var UpdatesBookingOwner */
private $updatesBookingOwner;
/** @var FetchesBooking */
private $fetchesBooking;
/** @var CanFetchBooking */
private $canFetchBooking;
/** @var FetchesCompany */
private $fetchesCompany;
/**
* UpdateBookingLogic constructor.
* @param CanUpdateBooking $canUpdateBooking
* @param UpdatesBookingOwner $updatesBookingOwner
* @param CanFetchBooking $canFetchBooking
* @param FetchesBooking $fetchesBooking
* @param FetchesCompany $fetchesCompany
*/
public function __construct(
CanUpdateBooking $canUpdateBooking,
UpdatesBookingOwner $updatesBookingOwner,
CanFetchBooking $canFetchBooking,
FetchesBooking $fetchesBooking,
FetchesCompany $fetchesCompany
) {
$this->canUpdateBooking = $canUpdateBooking;
$this->updatesBookingOwner = $updatesBookingOwner;
$this->canFetchBooking = $canFetchBooking;
$this->fetchesBooking = $fetchesBooking;
$this->fetchesCompany = $fetchesCompany;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request): JsonResponse
{
$this->canFetchBooking->passes();
$booking = $this->fetchesBooking->execute([
'id' => $request->route('id'),
]);
$newCompanyId = Company::where('reference', $request->input('newMarking'))->first()->id;
$this->updatesBookingOwner->execute($booking, $newCompanyId);
return $this->resourceResponse(new BookingResource($booking));
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Classes\Modules\Bookings\Services;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Models\Booking;
class UpdatesBookingOwner extends AbstractUpdateRecord
{
/**
* @param Booking $model
* @param int $id
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Booking $model, int $id)
{
$model->company_id = $id;
return $this->handler($model);
}
}
@@ -29,7 +29,7 @@ class FetchesCompanyServiceSettings
$constants= $service->constants()->whereIn('segment_id', $company->segments->pluck('id'))->get();
$standardConfigurations = $constants->firstWhere('reference', SegmentConstants::SERVICE_TYPE);
$standardConfigurations = $constants->where('reference', '=', SegmentConstants::SERVICE_TYPE)->first();
$rate = Currency::find($object->getCurrencyId())->rates->where('payment_method_type', $object->getPaymentMethod())
->where('service_id', $object->getServiceId())->first();
@@ -105,4 +105,4 @@ class FetchesCompanyServiceSettings
}
}
@@ -10,13 +10,12 @@ use App\Models\Group;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\Modules\Documents\Services\CreatesFiles;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use Meneses\LaravelLaravelMpdf\Facades\LaravelLaravelMpdf;
use App\Classes\Modules\Documents\Services\CreatesDocument;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
@@ -6,9 +6,8 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
use App\Classes\Modules\Transactions\Processors\CreateSupplierTransactionProcessor;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use Meneses\LaravelLaravelMpdf\Facades\LaravelLaravelMpdf;
class DownloadMockUpWhiteFormPdfLogic
{
@@ -24,7 +24,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use ErrorException;
use Illuminate\Support\Facades\DB;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
class UpdateGroupLogic extends AbstractControllerLogic
{
@@ -106,20 +106,20 @@ class UpdateGroupLogic extends AbstractControllerLogic
$serviceCharge = $this->calculatesTransactionServiceCharge->execute($transaction->original_amount, $rate, $constant);
$object = new TransactionObject(
$transaction->bill_no,
TransactionType::BILL,
$supplier->id,
$transaction->bill_no,
TransactionType::BILL,
$supplier->id,
1,
$supplier->banks()->where('default', true)->first()->id,
$supplier->banks()->where('default', true)->first()->id,
PaymentMethodType::CASH,
$transaction->original_amount * (1 / $rate),
$transaction->original_amount,
1,
$transaction->original_amount * (1 / $rate),
$transaction->original_amount,
1,
$transaction->original_currency_id,
$rate,
0,
$serviceCharge,
null,
$rate,
0,
$serviceCharge,
null,
ApprovalStatus::PENDING_VERIFICATION
);
@@ -130,20 +130,20 @@ class UpdateGroupLogic extends AbstractControllerLogic
$transferFee = $this->calculatesTransactionTransferFee->execute($billTransaction->original_amount, $constant);
$object = new TransactionObject(
$transferTransaction->bill_no,
$transferTransaction->bill_no,
TransactionType::TRANSFER_FEE,
$supplier->id,
1,
$supplier->banks()->where('default', true)->first()->id,
$supplier->banks()->where('default', true)->first()->id,
PaymentMethodType::CASH,
$transaction->original_amount,
$transaction->original_amount,
$transaction->original_currency_id,
$transaction->original_amount,
$transaction->original_amount,
$transaction->original_currency_id,
1,
0,
$transferFee,
null,
$transaction->original_currency_id,
1,
0,
$transferFee,
null,
ApprovalStatus::PENDING_VERIFICATION
);
@@ -182,4 +182,4 @@ class UpdateGroupLogic extends AbstractControllerLogic
return $this->resourceResponse(new GroupResource($group));
}
}
}
@@ -8,7 +8,7 @@ use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Models\Document;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger;
class CreateInvoiceDocumentProcessor
@@ -2,6 +2,7 @@
namespace App\Classes\Modules\Transactions\Processors;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\Bookings\Services\CalculatesBookingPayableAmount;
use App\Classes\Modules\Bookings\Services\CalculatesBookingTransferredAmount;
use App\Classes\Modules\ServiceTypes\Services\FetchesServiceConfigurations;
@@ -23,8 +24,6 @@ use App\Models\SegmentConstant;
class CreateInvoiceTransactionProcessor
{
/** @var ListsTransactions */
private $listsTransactions;
/** @var CreatesTransaction */
private $createsTransaction;
@@ -41,9 +40,6 @@ class CreateInvoiceTransactionProcessor
/** @var CalculatesBookingTransferredAmount */
private $calculatesBookingTransferredAmount;
/** @var FetchesServiceConfigurations */
private $fetchesServiceConfigurations;
/** @var CalculatesBookingCurrencyAverageRate */
private $calculatesBookingCurrencyAverageRate;
@@ -76,13 +72,11 @@ class CreateInvoiceTransactionProcessor
*/
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingTransferredAmount $calculatesBookingTransferredAmount, FetchesServiceConfigurations $fetchesServiceConfigurations, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, UpdatesBookingStatus $updatesBookingStatus, CreateInvoiceDocumentProcessor $invoiceDocumentProcessor, CreatePerfexCRMInvoiceProcessor $createPerfexCRMInvoiceProcessor)
{
$this->listsTransactions = $listsTransactions;
$this->createsTransaction = $createsTransaction;
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
$this->calculatesBookingPaidAmount = $calculatesBookingPaidAmount;
$this->calculatesBookingPayableAmount = $calculatesBookingPayableAmount;
$this->calculatesBookingTransferredAmount = $calculatesBookingTransferredAmount;
$this->fetchesServiceConfigurations = $fetchesServiceConfigurations;
$this->calculatesBookingCurrencyAverageRate = $calculatesBookingCurrencyAverageRate;
$this->fetchesCompany = $fetchesCompany;
$this->updatesBookingStatus = $updatesBookingStatus;
@@ -95,7 +89,7 @@ class CreateInvoiceTransactionProcessor
/**
* @param Booking $booking
* @return void
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws MalformedRequestException
*/
public function execute(Booking $booking)
{
@@ -24,7 +24,7 @@ use App\Classes\ValueObjects\Constants\DocumentType;
use App\Models\Booking;
use App\Models\Document;
use Carbon\Carbon;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
class CreateProformaInvoiceTransactionProcessor
{
@@ -13,7 +13,7 @@ use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Document;
use App\Models\Group;
use App\Models\Transaction;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
class GeneratesGroupTransactionsPurchaseOrder
{
@@ -13,7 +13,7 @@ use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Document;
use App\Models\Group;
use App\Models\Transaction;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
class GeneratesGroupTransactionsWhiteForm
{
@@ -2,19 +2,21 @@
namespace App\Classes\Modules\Transactions\Services;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
use App\Models\Booking;
use App\Models\Transaction;
use Illuminate\Database\Eloquent\Model;
class UpdatesTransaction extends AbstractUpdateRecord
{
/**
* @param Transaction $transaction
* @param TransactionObject $object
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
* @return Model
* @throws MalformedRequestException
*/
public function execute(Transaction $transaction, TransactionObject $object) {
$transaction->recipient_bank_account_id = $object->getRecipientBankAccountId();
@@ -30,4 +32,4 @@ class UpdatesTransaction extends AbstractUpdateRecord
return $this->handler($transaction);
}
}
}
@@ -0,0 +1,19 @@
<?php
namespace App\Http\Controllers\Accounts;
use App\Classes\Modules\Accounts\ControllersLogic\FetchUserByEmailLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class FetchUserByEmailController
{
/**
* @param Request $request
* @param FetchUserLogic $logic
* @return JsonResponse
*/
public function fetch(Request $request, FetchUserByEmailLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Bookings;
use App\Classes\Modules\Bookings\ControllersLogic\UpdateBookingOwnerLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateBookingOwnerController
{
/**
* @param Request $request
* @param RegenerateInvoiceBookingLogic $logic
* @return JsonResponse
*/
public function update(Request $request, UpdateBookingOwnerLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
+3
View File
@@ -22,6 +22,9 @@ class GroupResource extends JsonResource
public function toArray($request)
{
if(!$this->issuerCompany){
dd($this->id);
}
return [
'id' => $this->id,
'original_amount' => (float) $this->original_amount,
@@ -0,0 +1,25 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class UserCompanyResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
'reference' => $this->company()->first()->reference,
'type' => (int) $this->type,
'status' => (int) $this->status
];
}
}
+2
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Classes\General\Interfaces\Documentable;
use App\Classes\General\Interfaces\Transactionable;
use App\Classes\General\Traits\LogData;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Scopes\CustomerBookingsScope;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -28,6 +29,7 @@ class Booking extends AbstractModel implements Documentable, Transactionable
{
use HasRelationships;
use SoftDeletes;
use LogData;
protected $table = 'bookings';
+1
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Classes\General\Traits\LogData;
use Illuminate\Database\Eloquent\Model;
use App\Classes\General\Interfaces\Documentable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
+10
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Classes\General\Interfaces\Documentable;
use App\Classes\General\Interfaces\Transactionable;
use App\Classes\General\Traits\LogData;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use Carbon\Carbon;
@@ -22,6 +23,7 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
{
use HasTableAlias;
use SoftDeletes;
use LogData;
protected $table = 'transactions';
@@ -102,6 +104,14 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
return $this->HasMany(TransactionDetail::class, 'transaction_id', 'id');
}
/**
* @return HasOne
*/
public function groupTransaction(): HasOne
{
return $this->HasOne(GroupTransaction::class, 'transaction_id');
}
public function convert_original_amount()
{
if($this->booking()->first()->fix_currency_id !== 1) {
+2
View File
@@ -3,6 +3,7 @@
namespace App\Models;
use App\Classes\General\Interfaces\Transactionable;
use App\Classes\General\Traits\LogData;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
@@ -12,6 +13,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
class Wallet extends AbstractModel implements Transactionable
{
use SoftDeletes;
use LogData;
protected $table = 'wallets';
/**
+1
View File
@@ -22,6 +22,7 @@
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0",
"maatwebsite/excel": "^3.1",
"mpdf/mpdf": "^8.1",
"rinvex/countries": "^6.1",
"smalot/pdfparser": "^2.2",
"spatie/laravel-activitylog": "^3.14",
+2 -2
View File
@@ -178,7 +178,7 @@ return [
// Third Parties
Spatie\Permission\PermissionServiceProvider::class,
Barryvdh\DomPDF\ServiceProvider::class,
Meneses\LaravelMpdf\LaravelMpdfServiceProvider::class,
Mccarlosen\LaravelMpdf\LaravelMpdfServiceProvider::class,
TimeHunter\LaravelGoogleReCaptchaV3\Providers\GoogleReCaptchaV3ServiceProvider::class,
Webklex\PDFMerger\Providers\PDFMergerServiceProvider::class
@@ -234,7 +234,7 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'PDF' => Barryvdh\DomPDF\Facade::class,
'MPDF' => Meneses\LaravelMpdf\Facades\LaravelMpdf::class,
'MPDF' => Mccarlosen\LaravelMpdf\Facades\LaravelMpdf::class,
'GoogleReCaptchaV3'=> TimeHunter\LaravelGoogleReCaptchaV3\Facades\GoogleReCaptchaV3::class,
'PDFMerger' => Webklex\PDFMerger\Facades\PDFMergerFacade::class
@@ -15,15 +15,13 @@ class CreateCompaniesWalletTable extends Migration
{
Schema::create('wallets', function (Blueprint $table) {
$table->id();
$table->foreignId('company_id')->unsigned();
$table->morphs('owner');
$table->string('code');
$table->foreignId('currency_id')->unsigned();
$table->decimal('amount', 20, 5)->default(0.00);
$table->softDeletes();
$table->timestamps();
$table->foreign('company_id')->references('id')->on('companies');
$table->foreign('currency_id')->references('id')->on('currencies');
});
}
@@ -17,7 +17,7 @@ class CreateTransactionsTable extends Migration
{
Schema::create('transactions', function (Blueprint $table) {
$table->id();
$table->foreignId('booking_id')->unsigned();
$table->morphs('owner');
$table->string('type')->default(TransactionType::PAYMENT);
$table->foreignId('issuer')->unsigned();
$table->foreignId('receiver')->unsigned();
@@ -37,13 +37,12 @@ class CreateTransactionsTable extends Migration
$table->softDeletes();
$table->timestamps();
$table->foreign('booking_id')->references('id')->on('bookings');
$table->foreign('currency_id')->references('id')->on('currencies');
$table->foreign('issuer')->references('id')->on('companies');
$table->foreign('receiver')->references('id')->on('companies');
$table->foreign('recipient_bank_account_id')->references('id')->on('banks');
$table->foreign('original_currency_id')->references('id')->on('currencies');
});
}
@@ -1,51 +0,0 @@
<?php
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateWalletTransactionTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wallet_transaction', function (Blueprint $table) {
$table->id();
$table->foreignId('wallet_id')->unsigned();
$table->foreignId('transaction_id')->unsigned()->nullable();
$table->foreignId('bill_no')->unsigned();
$table->integer('type')->default(TransactionType::PAYMENT);
$table->decimal('amount', 14, 5)->default(0.00);
$table->foreignId('currency_id')->unsigned();
$table->decimal('original_amount', 14, 5)->default(0.00);
$table->foreignId('original_currency_id')->unsigned();
$table->decimal('currency_rate', 14, 5)->default(0.00);
$table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION);
$table->softDeletes();
$table->timestamps();
$table->foreign('transaction_id')->references('id')->on('transactions');
$table->foreign('wallet_id')->references('id')->on('wallets');
$table->foreign('currency_id')->references('id')->on('currencies');
$table->foreign('original_currency_id')->references('id')->on('currencies');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wallet_transaction');
}
}
@@ -1,50 +0,0 @@
<?php
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateReceiptsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('receipts', function (Blueprint $table) {
$table->id();
$table->foreignId('transaction_id')->unsigned();
$table->string('bill_no')->unique();
$table->decimal('amount', 14, 5)->default(0.00);
$table->decimal('original_amount', 14, 5)->default(0.00);
$table->foreignId('currency_id')->unsigned();
$table->foreignId('original_currency_id')->unsigned();
$table->decimal('currency_rate', 14, 5)->default(0.00);
$table->decimal('tax', 14, 5)->default(0.00);
$table->decimal('service_charge', 14, 5)->default(0.00);
$table->timestamp('transaction_date')->useCurrent();
$table->integer('status')->default(ApprovalStatus::COMPLETED);
$table->softDeletes();
$table->timestamps();
$table->foreign('transaction_id')->references('id')->on('transactions');
$table->foreign('currency_id')->references('id')->on('currencies');
$table->foreign('original_currency_id')->references('id')->on('currencies');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('receipt');
}
}
@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateReceiptDetailsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('receipt_details', function (Blueprint $table) {
$table->id();
$table->foreignId('receipt_id')->unsigned();
$table->decimal('price', 14, 5)->default(0.00);
$table->decimal('amount', 14, 5)->default(0.00);
$table->timestamps();
$table->foreign('receipt_id')->references('id')->on('receipts');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('receipt_detail');
}
}
@@ -1,28 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropWalletTransactionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('wallet_transaction');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -1,44 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterWalletCompanyId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasColumn('wallets', 'company_id')) {
Schema::table('wallets', function (Blueprint $table) {
$table->dropForeign('wallets_company_id_foreign');
$table->dropColumn('company_id');
});
}
if (!Schema::hasColumn('wallets', 'owner_id')) {
Schema::table('wallets', function (Blueprint $table) {
$table->morphs('owner');
});
//In-case the model name lengthy
Schema::table('wallets', function (Blueprint $table) {
$table->string('owner_type', 250)->change();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -1,45 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class AlterTransactionBookingId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasColumn('transactions', 'owner_id')) {
Schema::table('transactions', function (Blueprint $table) {
$table->morphs('owner');
});
//In-case the model name lengthy
Schema::table('transactions', function (Blueprint $table) {
$table->string('owner_type', 250)->change();
});
DB::statement("UPDATE transactions SET owner_type='App\\\\Models\\\\Booking', owner_id = booking_id");
Schema::table('transactions', function (Blueprint $table) {
$table->dropForeign('transactions_booking_id_foreign');
$table->dropColumn('booking_id');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
+10
View File
@@ -25,5 +25,15 @@ class CompaniesTableSeeder extends Seeder
$company->save();
$bank = new \App\Models\Bank();
$bank->company_id = $company->id;
$bank->bank_name = 'Maybank';
$bank->holder_name = 'CIEF Worldwide Snd Bhd';
$bank->account_no = '63465345345';
$bank->country_id = 1;
$bank->status = ApprovalStatus::APPROVED;
$bank->type = \App\Classes\ValueObjects\Constants\BankAccountType::PERSONAL;
$bank->save();
}
}
+5 -3
View File
@@ -4,6 +4,7 @@ use Database\Seeders\BanksTableDevelopmentSeeder;
use Database\Seeders\CompaniesTableDevelopmentSeeder;
use Database\Seeders\CurrenciesTableDevelopmentSeeder;
use Database\Seeders\CurrencyRatesTableDevelopmentSeeder;
use Database\Seeders\DummyDataSeeder;
use Database\Seeders\SegmentConstantsTableDevelopmentSeeder;
use Database\Seeders\SegmentsTableDevelopmentSeeder;
use Database\Seeders\ServiceTypesTableDevelopmentSeeder;
@@ -34,16 +35,17 @@ class DatabaseSeeder extends Seeder
$this->call(CompaniesTableSeeder::class);
// Admin
$this->call(AdminUserTableSeeder::class);
// $this->call(AdminUserTableSeeder::class);
$this->call(AdminUserPermissionsTableSeeder::class);
if(App()->environment('local')){
$this->call(CompaniesTableDevelopmentSeeder::class);
$this->call(BanksTableDevelopmentSeeder::class);
// $this->call(CompaniesTableDevelopmentSeeder::class);
// $this->call(BanksTableDevelopmentSeeder::class);
$this->call(ServiceTypesTableDevelopmentSeeder::class);
$this->call(SegmentsTableDevelopmentSeeder::class);
$this->call(SegmentConstantsTableDevelopmentSeeder::class);
$this->call(CurrencyRatesTableDevelopmentSeeder::class);
$this->call(DummyDataSeeder::class);
}
DB::commit();
+267 -86
View File
@@ -12,72 +12,56 @@ use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Banks\DataTransferObjects\BankObject;
use App\Classes\Modules\Banks\Services\CreatesBank;
use App\Classes\Modules\Banks\Services\SetsBankToDefault;
use App\Classes\Modules\Bookings\DataTransferObjects\BookingObject;
use App\Classes\Modules\Bookings\Services\CreatesBooking;
use App\Classes\Modules\Bookings\Services\FetchesBookingQuotation;
use App\Classes\Modules\Bookings\Services\GeneratesBookingMarking;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyModuleObject;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
use App\Classes\Modules\Companies\Processors\AssignSegmentProcessor;
use App\Classes\Modules\Companies\Services\CreatesCompany;
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompanyModule;
use App\Classes\Modules\Companies\Services\GeneratesUniqueAccountNumber;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Services\CreatesContact;
use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyConversionObject;
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
use App\Classes\Modules\Documents\Services\ApprovesDocument;
use App\Classes\Modules\Documents\Services\CreatesDocument;
use App\Classes\Modules\Documents\Services\CreatesFiles;
use App\Classes\Modules\Orders\Processors\CreateOrderProcessor;
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
use App\Classes\Modules\PackingLists\DataTransferObjects\ContainerObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Processors\CreateContainerProcessor;
use App\Classes\Modules\PackingLists\Processors\CreatePackageProcessor;
use App\Classes\Modules\PackingLists\Processors\CreatePackingListProcessor;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Documents\Services\RejectsDocument;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
use App\Classes\Modules\Transactions\Processors\CreatePurchaseOrderTransactionProcessor;
use App\Classes\Modules\Transactions\Processors\CreateSupplierTransactionProcessor;
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
use App\Classes\Modules\Wallets\Services\CreatesWallet;
use App\Classes\Modules\Wallets\Services\GeneratesWalletCode;
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\BankAccountType;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use App\Classes\ValueObjects\Constants\DocumentType;
use App\Classes\ValueObjects\Constants\PackageType;
use App\Classes\ValueObjects\Constants\PackingListType;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\RoleTypes;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Models\Address;
use App\Models\Company;
use App\Models\CompanyModule;
use App\Models\Container;
use App\Models\Document;
use App\Models\PackingList;
use App\Models\Group;
use App\Models\ServiceType;
use App\Models\Transaction;
use App\Models\Transport;
use App\Models\User;
use App\Models\Wallet;
use Carbon\Carbon;
use Illuminate\Database\Seeder;
use Faker\Generator as Faker;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
use Mpdf\MpdfException;
class DummyDataSeeder extends Seeder
{
@@ -133,9 +117,29 @@ class DummyDataSeeder extends Seeder
/** @var CreatesBooking */
public $createsBooking;
/** @var FetchesBookingQuotation */
public $fetchBookingQuotation;
/** @var ApprovesDocument */
public $approvesDocument;
/** @var RejectsDocument */
public $rejectsDocument;
/** @var CreatePurchaseOrderTransactionProcessor */
public $createPurchaseOrderTransactionProcessor;
/** @var CreateInvoiceTransactionProcessor */
public $createInvoiceTransactionProcessor;
/** @var CreateSupplierTransactionProcessor */
public $createSupplierTransactionProcessor;
/** @var AssignSegmentProcessor */
private $assignSegmentProcessor;
/** @var SetsBankToDefault*/
private $setsBankToDefault ;
/**
* @param Faker $faker
@@ -146,8 +150,25 @@ class DummyDataSeeder extends Seeder
* @param AssignEmployeeProcessor $assignEmployeeProcessor
* @param CreatesDocument $createsDocument
* @param CreatesFiles $createsFiles
* @param GeneratesWalletCode $generatesWalletCode
* @param CreatesWallet $createsWallet
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
* @param CreatesTransaction $createsTransaction
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdatesWalletBalance $updatesWalletBalance
* @param CreatesBank $createsBank
* @param GeneratesBookingMarking $generatesBookingMarking
* @param CreatesBooking $createsBooking
* @param FetchesBookingQuotation $fetchBookingQuotation
* @param ApprovesDocument $approvesDocument
* @param RejectsDocument $rejectsDocument
* @param CreatePurchaseOrderTransactionProcessor $createPurchaseOrderTransactionProcessor
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
* @param CreateSupplierTransactionProcessor $createSupplierTransactionProcessor
* @param AssignSegmentProcessor $assignSegmentProcessor
* @param SetsBankToDefault $setsBankToDefault
*/
public function __construct(Faker $faker, CreatesUser $createsUser, CreatesCompany $createsCompany, CreatesContact $createsContact, CreatesAddress $createsAddress, AssignEmployeeProcessor $assignEmployeeProcessor, CreatesDocument $createsDocument, CreatesFiles $createsFiles)
public function __construct(Faker $faker, CreatesUser $createsUser, CreatesCompany $createsCompany, CreatesContact $createsContact, CreatesAddress $createsAddress, AssignEmployeeProcessor $assignEmployeeProcessor, CreatesDocument $createsDocument, CreatesFiles $createsFiles, GeneratesWalletCode $generatesWalletCode, CreatesWallet $createsWallet, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatesTransaction $createsTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesWalletBalance $updatesWalletBalance, CreatesBank $createsBank, GeneratesBookingMarking $generatesBookingMarking, CreatesBooking $createsBooking, FetchesBookingQuotation $fetchBookingQuotation, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, CreatePurchaseOrderTransactionProcessor $createPurchaseOrderTransactionProcessor, CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor, CreateSupplierTransactionProcessor $createSupplierTransactionProcessor, AssignSegmentProcessor $assignSegmentProcessor, SetsBankToDefault $setsBankToDefault)
{
$this->faker = $faker;
$this->createsUser = $createsUser;
@@ -157,6 +178,23 @@ class DummyDataSeeder extends Seeder
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
$this->createsDocument = $createsDocument;
$this->createsFiles = $createsFiles;
$this->generatesWalletCode = $generatesWalletCode;
$this->createsWallet = $createsWallet;
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
$this->createsTransaction = $createsTransaction;
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->updatesWalletBalance = $updatesWalletBalance;
$this->createsBank = $createsBank;
$this->generatesBookingMarking = $generatesBookingMarking;
$this->createsBooking = $createsBooking;
$this->fetchBookingQuotation = $fetchBookingQuotation;
$this->approvesDocument = $approvesDocument;
$this->rejectsDocument = $rejectsDocument;
$this->createPurchaseOrderTransactionProcessor = $createPurchaseOrderTransactionProcessor;
$this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor;
$this->createSupplierTransactionProcessor = $createSupplierTransactionProcessor;
$this->assignSegmentProcessor = $assignSegmentProcessor;
$this->setsBankToDefault = $setsBankToDefault;
}
@@ -164,9 +202,10 @@ class DummyDataSeeder extends Seeder
* Run the database seeds.
*
* @return void
* @throws MalformedRequestException
* @throws AccessForbiddenException
* @throws MalformedRequestException
* @throws RequestValidationException
* @throws MpdfException
*/
public function run()
{
@@ -189,11 +228,13 @@ class DummyDataSeeder extends Seeder
// =============================================== //
// create super admin
$userObject = new RegistrationObject($this->faker->name, 'super_admin@izyim.com', $password, $password,RoleTypes::SUPER_ADMIN, ApprovalStatus::APPROVED);
$userObject = new RegistrationObject($this->faker->name, 'super_admin@exchange.com', $password, $password,RoleTypes::SUPER_ADMIN, ApprovalStatus::APPROVED);
$this->createsUser->execute($userObject);
Auth()->login(User::find(1), true);
// create admin
$userObject = new RegistrationObject($this->faker->name, 'admin@izyim.com', $password, $password,RoleTypes::ADMIN, ApprovalStatus::APPROVED);
$userObject = new RegistrationObject($this->faker->name, 'admin@exchange.com', $password, $password,RoleTypes::ADMIN, ApprovalStatus::APPROVED);
$this->createsUser->execute($userObject);
// create CIEF
@@ -211,37 +252,17 @@ class DummyDataSeeder extends Seeder
$supplierName = $this->faker->company;
$supplierReference = $this->faker->bothify('??-????');
$company_object = new CompanyObject($supplierName, $supplierReference,CompanyType::COMPANY_BUSINESS,ApprovalStatus::APPROVED);
$company_object = new CompanyObject($supplierName, $supplierReference,BusinessType::CURRENCY_VENDOR, CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED);
/** @var Company $company */
$company = $this->createsCompany->execute($company_object);
$bank_object = new BankObject($company->id, $this->faker->numberBetween(2, 3),
$this->faker->company, $this->faker->name, $this->faker->bankAccountNumber,
$this->faker->city, null, null,
2, $this->faker->company);
$companyModuleObject = new CompanyModuleObject($supplierName, $supplierReference, '', '', BusinessType::FREIGHT_FORWARDER, ApprovalStatus::APPROVED);
$this->createsCompanyModule->execute($company, $companyModuleObject);
$bank = $this->createsBank->execute($bank_object);
$this->setsBankToDefault->execute($bank);
// create supplier warehouses
foreach(['Guangzhou', 'Yiwu', 'Klang', 'Sabah', 'Sarawak'] as $name){
$warehouseReference = '';
$isChina = false;
switch($name) {
case 'Guangzhou': $warehouseReference = 'GZ-V0'.$i; $isChina = true; break;
case 'Yiwu': $warehouseReference = 'YY-V0'.$i; $isChina = true; break;
case 'Klang': $warehouseReference = 'KL-V0'.$i; break;
case 'Sabah': $warehouseReference = 'SB-V0'.$i; break;
case 'Sarawak':$warehouseReference = 'SRW-V0'.$i; break;
}
$companyModuleObject = new CompanyModuleObject($name, $warehouseReference, '', '', BusinessType::WAREHOUSE, ApprovalStatus::APPROVED);
/** @var CompanyModule $companyModule */
$companyModule = $this->createsCompanyModule->execute($company, $companyModuleObject);
$address = new AddressObject( $this->faker->streetAddress, $this->faker->streetAddress, $isChina ? 2 : 1, $isChina ? 35 : 15, $isChina ? 633 : 412, $isChina ? 510450 : 41400, AddressType::DELIVERY, ApprovalStatus::APPROVED);
$this->createsAddress->execute($companyModule, $address);
$contact = new ContactObject($this->faker->name, $this->faker->phoneNumber, '', '');
$this->createsContact->execute($companyModule, $contact);
}
}
@@ -253,6 +274,7 @@ class DummyDataSeeder extends Seeder
// 3. Attach Employee
// 4. create contact
//
// 5. create Address
// 6. identification verification
@@ -278,7 +300,7 @@ class DummyDataSeeder extends Seeder
// 16. generate invoice
// generate random number of users
for($userLoop=1; $userLoop <= rand(20, 50); $userLoop++) {
for($userLoop=1; $userLoop <= 20; $userLoop++) {
// === //
// 1 // ========== //
@@ -315,6 +337,8 @@ class DummyDataSeeder extends Seeder
/** @var Company $company */
$company = $this->createsCompany->execute($company_object);
$this->assignSegmentProcessor->execute($company);
// === //
// 3 // ===========//
@@ -329,7 +353,7 @@ class DummyDataSeeder extends Seeder
// Create Contact //
// ================= //
// Contacts uses eloquent polymorphic relationship to declare its owner. and for this use case it will be attached to the company not the company module.
$contactObject = new ContactObject($company->id, $customerName, $this->faker->phoneNumber, $customerEmail, null, $this->faker->bothify('??#####'));
$contactObject = new ContactObject($company->id, $customerName, (int) $this->faker->randomNumber(7), $customerEmail, null, 1);
$this->createsContact->execute($contactObject);
// === //
@@ -342,7 +366,7 @@ class DummyDataSeeder extends Seeder
// AddressType::BILLING : for the invoice billing address
// create delivery address
$addressObject = new AddressObject($this->faker->streetAddress, '', 1, $this->faker->numberBetween(1, 15), $this->faker->numberBetween(1, 442), $this->faker->postcode);
$addressObject = new AddressObject($this->faker->streetAddress, '', 1, $this->faker->numberBetween(1, 15), $this->faker->numberBetween(1, 100), $this->faker->postcode);
/** @var Address $address */
$address = $this->createsAddress->execute($company, $addressObject);
@@ -373,7 +397,7 @@ class DummyDataSeeder extends Seeder
// TransactionType::TOP_UP : represent a top-up amount to a wallet;
// TransactionType::PAYMENT : represent payment out of the wallet;
// TransactionType::CREDIT_NOTE : represent a manual top-up to a wallet, and can only be performed by super admin;
// TransactionType::CREDIT_NOTE : represent a deduction from a wallet, and can only be performed by super admin;
// TransactionType::DEBDIT_NOTE : represent a deduction from a wallet, and can only be performed by super admin;
// TransactionType::WITHDRAW : represent a customer withdrawing credit out of a wallet to a bank account (refund);
@@ -419,7 +443,7 @@ class DummyDataSeeder extends Seeder
// 2. AliPay Transfer (EXTERNAL) (the account the customer is requesting to transfer funds to when bank type is ALIPAY)
// 3. Refund bank (PERSONAL) (the account the customer is requesting his order refunds to be transferred to)
$bank_object = new BankObject($company->id, $this->faker->numberBetween(2, 3),
$this->faker->bank, $this->faker->name, $this->faker->bankAccountNumber,
$this->faker->company, $this->faker->name, $this->faker->bankAccountNumber,
$this->faker->city, null, null,
2, $this->faker->company);
@@ -427,8 +451,8 @@ class DummyDataSeeder extends Seeder
$bank = $this->createsBank->execute($bank_object);
// generate random number of bookings
for($orderLoop=1; $orderLoop <= rand(1, 30); $orderLoop++) {
for($orderLoop=1; $orderLoop <= rand(1, 5); $orderLoop++) {
echo 'booking created';
// === //
// 9 // ========= //
// Create Booking //
@@ -452,15 +476,15 @@ class DummyDataSeeder extends Seeder
// and can be used to place different type of transfer orders (e.g. 1 day transfer, 3 days transfer, 1688 Payment)
// randomly selects a service type
$service = ServiceType::where('reference', $this->faker->numberBetween(1, 3))->first();
$service = ServiceType::inRandomOrder()->first();
// Booking human readable id
$reference = $this->generatesBookingMarking->execute();
// random currency booking (CNY, USD)
$bookedCurrency = $this->faker->numberBetween(2, 3);
$bookedCurrency = 2;
$bank = $company->banks()->inRandomOrder()->first();
$object = new BookingObject($service->id, $bank->id, $reference, $this->faker->numberBetween(10, 300000), $bookedCurrency, $bookedCurrency, 1);
$booking = $this->createsBooking->execute($company, $object);
@@ -474,33 +498,190 @@ class DummyDataSeeder extends Seeder
// TransactionType::TRANSFER_FEE : is to represent the transfer fee charged by CIEF currency supplier is attached to a transaction type TransactionType::BILL;
// TransactionType::REFUND : is to represent a request for refund on a payment, and is attached to a transaction type TransactionType::PAYMENT;
// todo make payment
// todo approve payment
$numberOfPayments = $this->faker->numberBetween(0, 3);
// todo create supplier order
// when processing a customer order, we will place an order with one of our currency supplier which will generate a transaction type TransactionType::BILL
// and attach it to the customer payment TransactionType::PAYMENT, and it will update the TransactionType::PAYMENT status to ApprovalStatus::COMPLETED
for ($paymentLoop=0; $paymentLoop <= $numberOfPayments; $paymentLoop++) {
echo 'payment created';
$shouldSubmit = $this->faker->numberBetween(0, 1);
$shouldApprove = $this->faker->numberBetween(0, 1);
if ($numberOfPayments > 1){
// todo upload china payment proof
// when our currency supplier completes the transfer they will send us the bank slip as proof of payment, then the admin user
// will upload the bank slip document and attaching it to transaction type TransactionType::BILL
$amount = $booking->fix_amount / $numberOfPayments;
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $amount)), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS['cash']);
$configurations = $this->fetchBookingQuotation->execute($booking->company, $conversionObject);
$billNumber = $this->generatesTransactionBillNumber->execute('PYMT-');
$object = new TransactionObject($billNumber, TransactionType::PAYMENT, 1, $booking->company->id,
$configurations->getConfigurations()->getBankId(), $configurations->getConversionObject()->getPaymentMethod(),
$configurations->getTotal(), $configurations->getForeignTotal(), 1,
$configurations->getConversionObject()->getCurrencyId(), $configurations->getConfigurations()->getRate(),
$configurations->getTax(), $configurations->getServiceCharge(), Carbon::now()->addMinutes(10), ApprovalStatus::PENDING_SUBMISSION, [], null);
/** @var Transaction $transaction */
$transaction = $this->createsTransaction->execute($booking, $object);
if($shouldSubmit || $shouldApprove) {
$object = new DocumentObject( DocumentType::CUSTOMER_PAYMENT_PROOF, ['data:image/png;base64,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'],
'', ApprovalStatus::PENDING_VERIFICATION, 'payments');
/** @var Document $document */
$document = $this->createsDocument->execute($transaction, $object);
$this->createsFiles->execute($document, $object);
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::PENDING_SUBMISSION);
}
if($shouldApprove) {
$this->approvesDocument->execute($document);
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED);
$shouldReject = $this->faker->numberBetween(0, 1);
if($shouldReject){
$this->rejectsDocument->execute($document);
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::REJECTED);
}
}
}
}
// todo create purchase order
// creating the purchase order can happen before or after the payment is made, the customer needs to fill up the list of product
// they are buying and attaching it to the booking, a purchase order is a transaction of type TransactionType::PURCHASE_ORDER
// todo approve purchase order
$billNumber = $this->generatesTransactionBillNumber->execute('PO-');
$shouldSubmit = $this->faker->numberBetween(0, 1);
$shouldApprove = $this->faker->numberBetween(0, 1);
if($shouldSubmit){
$completeSubmission = $this->faker->numberBetween(0, 1);
$quantity = $this->faker->numberBetween(5, 200);
$unitPrice = $booking->fix_amount / $quantity;
$products = collect([[
'stockCode' => $this->faker->numerify('#####'),
'description' => $this->faker->text,
'quantity' => $completeSubmission ? $quantity : $quantity - $this->faker->numberBetween(1, 4),
'unit_price' => (string) round($unitPrice, 5)
]]);
$total = $products->first()['quantity'] * (float) $products->first()['unit_price'];
$object = new TransactionObject($billNumber, TransactionType::PURCHASE_ORDER, $booking->company->id, 1,
1, PaymentMethodType::CASH,
$total, $total, $booking->fix_currency_id, $booking->fix_currency_id,
1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, $products->toArray());
$transaction = $this->createPurchaseOrderTransactionProcessor->execute($booking, $object);
}
if($transaction->status === ApprovalStatus::PENDING_VERIFICATION) {
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED);
}
// todo generate invoice
// the invoicing documents will be generated once they 2 conditions are met:
// 1. Full payment completed (completed is flagged when the china payment proof is uploaded)
// 2. The purchase order is filled and approved (when the purchase order is not filled for more than 2 months the system will automatically generate a random products for Purchase order to close the order)
// once the invoice is generated the transaction table will include 2 new transaction type TransactionType::INVOICE, TransactionType::SUPPLIER_DELIVERY
// and for documents will be generated and attached to the booking.
// once this process is complete the booking status will update to ApprovalStatus::COMPLETED
}
// when processing a customer order, we will place an order with one of our currency supplier which will generate a transaction type TransactionType::BILL
// and attach it to the customer payment TransactionType::PAYMENT, and it will update the TransactionType::PAYMENT status to ApprovalStatus::COMPLETED
$totalApprovedPayments = Transaction::where('type', TransactionType::PAYMENT)->where('status', 2)->count();
$totalWhiteForms = round($totalApprovedPayments / $this->faker->numberBetween(2, 5));
$perWhiteForm = $totalApprovedPayments / (round($totalWhiteForms / 2) ?: 1);
for($orderLoop=1; $orderLoop <= ($totalWhiteForms / 2); $orderLoop++) {
$supplier = Company::where('business_type', BusinessType::CURRENCY_VENDOR)->inRandomOrder()->first();
$rate = $this->faker->randomFloat(5, 1.3, 1.6);
$payments = Transaction::where('type', TransactionType::PAYMENT)->where('status', ApprovalStatus::APPROVED)->inRandomOrder()->limit($perWhiteForm)->get();
$this->createSupplierTransactionProcessor->execute($supplier, $rate, $payments->toArray());
$group = new Group();
$group->save();
$issuer = '';
$receiver = '';
$amount = 0;
$original_amount = 0;
$currency_id = 0;
$original_currency_id = '';
$currency_rate = '';
$tax = 0;
$service_charge = 0;
foreach ($this->createSupplierTransactionProcessor->getBills() as $key => $row) {
$group->transactions()->sync($row->id, false);
$issuer = $row->issuer;
$receiver = $row->receiver;
$amount += $row->amount;
$original_amount += $row->original_amount;
$currency_id = $row->currency_id;
$original_currency_id = $row->original_currency_id;
$currency_rate = $row->currency_rate;
$tax += $row->tax;
$service_charge += $row->service_charge;
}
$group->issuer = $issuer;
$group->receiver = $receiver;
$group->reference = $this->generatesTransactionBillNumber->execute('SPO-');
$group->amount = $amount;
$group->original_amount = $original_amount;
$group->currency_id = $currency_id;
$group->original_currency_id = $original_currency_id;
$group->currency_rate = $currency_rate;
$group->tax = $tax;
$group->service_charge = $service_charge;
$group->update();
$pdf = LaravelMpdf::loadView('pages.pdfs.currency_vendor_order', ['transactions' => $this->createSupplierTransactionProcessor->getBills(), 'transferFeeTransactions' => $this->createSupplierTransactionProcessor->getTransferTransactions(), 'supplier' => $supplier]);
$object = new DocumentObject(
DocumentType::CURRENCY_VENDOR_ORDER,
[chunk_split('data:application/pdf;base64,'.base64_encode($pdf->output()))],
'',
ApprovalStatus::COMPLETED,
'currency_vendor_order'
);
/** @var Document $document */
$document = $this->createsDocument->execute($group, $object);
$this->createsFiles->execute($document, $object);
foreach ($payments as $payment) {
$chinaBankSlipUploaded = $this->faker->numberBetween(0, 1);
if($chinaBankSlipUploaded){
$bill = $payment->transactions()->where('type', TransactionType::BILL)->first();
// when our currency supplier completes the transfer they will send us the bank slip as proof of payment, then the admin user
// will upload the bank slip document and attaching it to transaction type TransactionType::BILL
$object = new DocumentObject( DocumentType::CUSTOMER_PAYMENT_PROOF, ['data:image/png;base64,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'],
'', ApprovalStatus::APPROVED, 'china_bank_slip');
/** @var Document $document */
$document = $this->createsDocument->execute($bill, $object);
$this->createsFiles->execute($document, $object);
$this->updatesTransactionStatus->execute($bill, ApprovalStatus::APPROVED);
// the invoicing documents will be generated once they 2 conditions are met:
// 1. Full payment completed (completed is flagged when the china payment proof is uploaded)
// 2. The purchase order is filled and approved (when the purchase order is not filled for more than 2 months the system will automatically generate a random products for Purchase order to close the order)
// once the invoice is generated the transaction table will include 2 new transaction type TransactionType::INVOICE, TransactionType::SUPPLIER_DELIVERY
// and for documents will be generated and attached to the booking.
// once this process is complete the booking status will update to ApprovalStatus::COMPLETED
$this->createInvoiceTransactionProcessor->execute($booking);
}
}
}
}
}
@@ -219,6 +219,29 @@
</div>
</div>
</div>
<div class="row" v-if="$store.getters.isAdmin">
<div class="col-6 m-auto">
<div class="row p-t-20 p-b-20 b-a b-dashed b-success requestModal pointer" v-if="item.transaction_bill.status === 1" data-type="paymentProofModal">
<div class="col">
<div class="row align-item-center justify-content-center h-100">
<div class="col-auto" >
<div class="row align-items-center h-100">
<div class="col">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="40" height="40"
viewBox="0 0 172 172"
style=" fill:#000000;"><defs><linearGradient x1="86" y1="45.01563" x2="86" y2="152.92681" gradientUnits="userSpaceOnUse" id="color-1_48314_gr1"><stop offset="0" stop-color="#1ac86f"></stop><stop offset="1" stop-color="#1ac86f"></stop></linearGradient><linearGradient x1="86" y1="45.01563" x2="86" y2="152.92681" gradientUnits="userSpaceOnUse" id="color-2_48314_gr2"><stop offset="0" stop-color="#1ac86f"></stop><stop offset="1" stop-color="#1ac86f"></stop></linearGradient><linearGradient x1="86" y1="16.79688" x2="86" y2="92.05225" gradientUnits="userSpaceOnUse" id="color-3_48314_gr3"><stop offset="0" stop-color="#67eba8"></stop><stop offset="1" stop-color="#67eba8"></stop></linearGradient><linearGradient x1="86" y1="45.01563" x2="86" y2="152.92681" gradientUnits="userSpaceOnUse" id="color-4_48314_gr4"><stop offset="0" stop-color="#1ac86f"></stop><stop offset="1" stop-color="#1ac86f"></stop></linearGradient></defs><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g><path d="M147.8125,48.375h-32.25v5.375h32.25c1.50769,0 2.6875,1.12875 2.6875,2.56925v75.25c0,1.51844 -1.23087,2.80575 -2.6875,2.80575h-123.625c-1.45662,0 -2.6875,-1.28731 -2.6875,-2.80575v-75.25c0,-1.4405 1.17981,-2.56925 2.6875,-2.56925h32.25v-5.375h-32.25c-4.52038,0 -8.0625,3.49106 -8.0625,7.94425v75.25c0,3.55019 2.25481,6.54944 5.375,7.67819v3.07181c0,4.51231 3.61737,8.18075 8.0625,8.18075h112.875c4.44512,0 8.0625,-3.66844 8.0625,-8.18075v-3.07181c3.12019,-1.12875 5.375,-4.128 5.375,-7.67819v-75.25c0,-4.45319 -3.54212,-7.94425 -8.0625,-7.94425zM142.4375,145.125h-112.875c-1.45662,0 -2.6875,-1.28731 -2.6875,-2.80575v-2.56925h118.25v2.56925c0,1.51844 -1.23087,2.80575 -2.6875,2.80575z" fill="url(#color-1_48314_gr1)"></path><path d="M126.3125,129h-83.3125v-2.6875c0,-7.51425 -6.02806,-13.4375 -13.4375,-13.4375h-2.6875v-37.625h2.6875c6.3425,0 13.4375,-5.79156 13.4375,-13.46706v-2.70363l13.4375,0.04569v5.375l-8.2775,-0.01613c-1.26044,7.95231 -7.94425,14.61731 -15.91,15.86969v27.219c8.25869,1.18788 14.80006,7.76956 15.94762,16.05244h75.6155c1.17444,-8.30438 7.70238,-14.85112 15.93688,-16.03631v-27.262c-7.96844,-1.247 -14.65494,-7.89587 -15.91269,-15.82669h-8.27481v-5.375h13.4375v2.6875c0,6.30219 5.74587,13.4375 13.4375,13.4375h2.6875v37.50675l-2.6875,0.01613c-7.40944,0 -13.4375,6.03344 -13.4375,13.45094v2.6875z" fill="url(#color-2_48314_gr2)"></path><path d="M104.8125,53.75h-8.0625c-1.4835,0 -2.6875,1.14487 -2.6875,2.63106v29.61356c0,1.48619 -1.204,2.69288 -2.6875,2.69288h-10.75c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.69288v-29.61356c0,-1.48619 -1.204,-2.63106 -2.6875,-2.63106h-8.0625c-2.2145,0 -3.47763,-2.881 -2.15,-4.87781l16.65175,-25.04481c2.05056,-3.08256 6.57094,-3.08794 8.6215,-0.00806l16.65175,25.05556c1.32762,1.99681 0.0645,4.87512 -2.15,4.87512z" fill="url(#color-3_48314_gr3)"></path><path d="M86,112.875c-10.37375,0 -18.8125,-8.0625 -18.8125,-18.8125h5.375c0,8.0625 6.02806,13.4375 13.4375,13.4375c7.40944,0 13.4375,-5.375 13.4375,-13.4375h5.375c0,10.75 -8.43875,18.8125 -18.8125,18.8125z" fill="url(#color-4_48314_gr4)"></path></g></g></svg>
</div>
</div>
</div>
<modal-component type="paymentProofModal">
<payment-proof-form-component section="paymentProofSection" :id="item.transaction_bill.id" :data="item.transaction_bill"></payment-proof-form-component>
</modal-component>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-10" v-show="[2, 3].includes(item.status) && totalRequestedConvertRefund < data.booking.amount">
<div class="col">
<button class="btn btn-xs all-caps b-rad-none bg-master-lighter btn-block no-border requestModal hide" data-type="transferSummary">Request Refund</button>
@@ -0,0 +1,62 @@
<template>
<div class="row">
<div class="col">
<div class="row">
<div class="col">
<div class="row m-b-10">
<div class="col">
<h5 class="all-caps m-b-5 bold no-margin">Change Booking Owner</h5>
</div>
</div>
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
<div class="col">
<small class="bold fs-10 text-danger">{{error}}</small>
</div>
</div>
<div class="row m-b-10">
<div class="col">
<validation-wrapper-component :validator="$v.parameters.newMarking">
<label class="text-left">Customer Marking</label>
<input type="text" class="form-control" v-model="parameters.newMarking">
</validation-wrapper-component>
</div>
</div>
<div class="row">
<div class="col p-r-5">
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Submit</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { required } from "vuelidate/lib/validators";
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
export default {
data(){
return {
error: '',
parameters: {
newMarking: '',
},
}
},
validations: {
parameters: {
newMarking: { },
},
},
methods: {
submitForm() {
this.submit(route('api.booking.owner.update', this.data.id), 'put', this.section, true, true);
}
},
mixins: [ModalFormHandler]
}
</script>
@@ -270,7 +270,7 @@
</div>
</div>
</div>
<purchase-order-form-component v-if="booking.service.id !== 4 || $store.getters.isAdmin || [199, 510].includes($store.getters.getCompanyId)" :data="booking" :section="section"></purchase-order-form-component>
<purchase-order-form-component v-if="booking.service.id !== 4 || $store.getters.isAdmin || [199, 510].includes($store.getters.getCompanyId) || companySegmentIds.includes(24)" :data="booking" :section="section"></purchase-order-form-component>
</div>
</div>
<div class="row m-t-15" v-if="booking.status === 3 && $store.getters.isSuperAdmin">
@@ -426,6 +426,14 @@
</div>
</div>
</div>
<div class="row m-t-5" v-if="$store.getters.isAdmin">
<div class="col">
<div class="btn btn-xs all-caps b-rad-none btn-warning pointer requestModal" data-type="changeBookingOwner">Change Booking Owner</div>
<modal-component type="changeBookingOwner">
<change-booking-owner-form-component :data="booking" :section="section" class="text-center"></change-booking-owner-form-component>
</modal-component>
</div>
</div>
</div>
<div class="col col-sm-12 col-md-3">
<wallet-component class="m-b-20" :data="booking.company"></wallet-component>
@@ -467,6 +475,9 @@
});
return complete;
},
companySegmentIds() {
return this.booking.company.segments.map(obj => parseInt(obj.id));
}
},
watch: {
@@ -47,8 +47,8 @@
style=" fill:#000000;"><defs><linearGradient x1="86" y1="97.08594" x2="86" y2="105.31775" gradientUnits="userSpaceOnUse" id="color-1_43991_gr1"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="94.0625" y1="85.83338" x2="94.0625" y2="93.89588" gradientUnits="userSpaceOnUse" id="color-2_43991_gr2"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="77.9375" y1="85.83338" x2="77.9375" y2="93.89588" gradientUnits="userSpaceOnUse" id="color-3_43991_gr3"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="86" y1="28.55469" x2="86" y2="143.10938" gradientUnits="userSpaceOnUse" id="color-4_43991_gr4"><stop offset="0" stop-color="#009add"></stop><stop offset="1" stop-color="#00baa4"></stop></linearGradient></defs><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g><path d="M77.9375,96.75c0,4.45319 3.60931,8.0625 8.0625,8.0625c4.45319,0 8.0625,-3.60931 8.0625,-8.0625z" fill="url(#color-1_43991_gr1)"></path><path d="M94.0625,86c-2.2264,0 -4.03125,1.80485 -4.03125,4.03125c0,2.2264 1.80485,4.03125 4.03125,4.03125c2.2264,0 4.03125,-1.80485 4.03125,-4.03125c0,-2.2264 -1.80485,-4.03125 -4.03125,-4.03125z" fill="url(#color-2_43991_gr2)"></path><path d="M77.9375,86c-2.2264,0 -4.03125,1.80485 -4.03125,4.03125c0,2.2264 1.80485,4.03125 4.03125,4.03125c2.2264,0 4.03125,-1.80485 4.03125,-4.03125c0,-2.2264 -1.80485,-4.03125 -4.03125,-4.03125z" fill="url(#color-3_43991_gr3)"></path><path d="M147.8125,51.0625h-18.8125v-8.0625c0,-4.44512 -3.61738,-8.0625 -8.0625,-8.0625h-11.2445c-1.11263,-3.12019 -4.06888,-5.375 -7.568,-5.375h-32.25c-3.49912,0 -6.45538,2.25481 -7.568,5.375h-11.2445c-4.44512,0 -8.0625,3.61738 -8.0625,8.0625v8.0625h-18.8125c-4.44513,0 -8.0625,3.61738 -8.0625,8.0625v59.125c0,4.44512 3.61737,8.0625 8.0625,8.0625h18.8125v8.0625c0,4.44512 3.61738,8.0625 8.0625,8.0625h69.875c4.44512,0 8.0625,-3.61738 8.0625,-8.0625v-8.0625h18.8125c4.44512,0 8.0625,-3.61738 8.0625,-8.0625v-59.125c0,-4.44512 -3.61737,-8.0625 -8.0625,-8.0625zM147.8125,56.4375c1.4835,0 2.6875,1.20669 2.6875,2.6875v51.0625h-2.88637c-0.80625,-6.09525 -4.28119,-11.78469 -9.47612,-15.25425c0.99437,-1.87319 1.6125,-3.98019 1.6125,-6.24575v-5.375c0,-6.48763 -4.62519,-11.91638 -10.75,-13.16606v-13.70894zM134.375,88.6875c0,3.49912 -2.25213,6.45538 -5.375,7.568v-20.50831c3.12287,1.11262 5.375,4.06887 5.375,7.568zM134.6545,99.1365c3.913,2.48056 6.62469,6.84506 7.47125,11.051h-13.12575v-8.33394c2.12044,-0.43269 4.02319,-1.41094 5.6545,-2.71706zM67.1875,37.625c0,-1.48081 1.204,-2.6875 2.6875,-2.6875h32.25c1.4835,0 2.6875,1.20669 2.6875,2.6875v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875h-32.25c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875zM51.0625,40.3125h10.75c0,4.44512 3.61737,8.0625 8.0625,8.0625h32.25c4.44512,0 8.0625,-3.61738 8.0625,-8.0625h10.75c1.4835,0 2.6875,1.20669 2.6875,2.6875v83.3125h-3.34056c-1.73881,-9.23963 -7.19444,-17.45531 -15.06344,-22.66906c1.44319,-2.88906 2.279,-6.13556 2.279,-9.58094v-10.75c0,-11.85456 -9.64544,-21.5 -21.5,-21.5c-11.85456,0 -21.5,9.64544 -21.5,21.5v10.75c0,3.44537 0.83581,6.69188 2.28169,9.58094c-7.869,5.21375 -13.32463,13.42675 -15.06344,22.66906h-3.34325v-83.3125c0,-1.48081 1.204,-2.6875 2.6875,-2.6875zM102.125,94.0625c0,8.89294 -7.23206,16.125 -16.125,16.125c-8.89294,0 -16.125,-7.23206 -16.125,-16.125v-10.75c0,-8.89294 7.23206,-16.125 16.125,-16.125c8.89294,0 16.125,7.23206 16.125,16.125zM86,115.5625c6.48494,0 12.29531,-2.89981 16.24056,-7.45513c6.39088,4.22744 10.93006,10.77956 12.59363,18.20513h-57.66837c1.66356,-7.42556 6.20275,-13.97769 12.59631,-18.20244c3.94256,4.55531 9.75294,7.45244 16.23787,7.45244zM43,96.2555c-3.12288,-1.11263 -5.375,-4.06888 -5.375,-7.568v-5.375c0,-3.49912 2.25212,-6.45538 5.375,-7.568zM37.32669,99.12306c1.634,1.31419 3.54481,2.29512 5.67331,2.7305v8.33394h-13.18487c0.78475,-4.57412 3.526,-8.63225 7.51156,-11.06444zM24.1875,56.4375h18.8125v13.70894c-6.12481,1.24969 -10.75,6.67575 -10.75,13.16606v5.375c0,2.26287 0.61544,4.36719 1.60981,6.24038c-5.21106,3.44806 -8.686,9.05688 -9.47613,15.25963h-2.88369v-51.0625c0,-1.48081 1.204,-2.6875 2.6875,-2.6875zM24.1875,120.9375c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875v-2.6875h21.5v5.375zM120.9375,137.0625h-69.875c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875v-2.6875h75.25v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875zM147.8125,120.9375h-18.8125v-5.375h21.5v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875z" fill="url(#color-4_43991_gr4)"></path></g></g></svg>
</div>
<div class="col">
<div class="row no-margin">
<div class="col-auto no-padding m-r-10 m-b-5 m-t-5 parentContainer" v-for="segment in item.segments" v-bind:key="segment.id" v-if="segment.id !== 1">
<div class="row no-margin" v-for="segment in item.segments" v-bind:key="segment.id" v-if="segment.id !== 1">
<div class="col-auto no-padding m-r-10 m-b-5 m-t-5 parentContainer">
<div class="font-heading fs-10 lh-20 p-l-10 p-r-10 bg-master-lightest btn-rounded">
{{segment.name}}
<i class="fa fa-times muted m-l-10 pointer requestModal" data-type="detachSegment" ></i>
@@ -0,0 +1,49 @@
<template>
<div class="row m-b-15 align-items-end">
<div class="col-auto">
<div class="row">
<div class="col">
<div class="font-heading fs-10 muted all-caps">Name</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading all-caps fs-11">{{this.item.name}}</div>
</div>
</div>
</div>
<div class="col-2 text-right">
<div class="row">
<div class="col">
<div class="font-heading fs-10 muted all-caps">Reference</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading all-caps fs-11">{{this.item.reference}}</div>
</div>
</div>
</div>
<div class="col-auto">
<a :href="route('customer.profile', this.item.reference)" target="_blank">
<button type="button" class="btn btn-xs btn-primary fs-11">Open in new tab</button>
</a>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
data(){
return {
minWidth:{
minWidth:'100px',
},
minWidth150:{
minWidth:'150px',
},
}
},
mixins: [componentHandler]
}
</script>
@@ -0,0 +1,81 @@
<template>
<div class="row m-b-20" @keyup.enter="submitSearch">
<div class="col">
<div class="row">
<div class="col">
<loading-component style="height: 50px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
<div class="row m-l-0 m-r-0 bg-master-light padding-10" v-show="!isLoading">
<div class="col-md col-12">
<div class="row">
<div class="col">
<validation-wrapper-component :validator="$v.email">
<label class="all-caps">Email</label>
<input type="text" class="form-control" v-model.lazy="email">
</validation-wrapper-component>
</div>
</div>
</div>
<div class="col-12 col-md-auto d-flex align-items-center justify-content-center mt-2 mt-md-0">
<button type="button" class="btn btn-lg btn-primary fs-11 w-100 d-block mr-2 mr-md-0" @click="submitSearch()">Search</button>
<button type="button" class="btn btn-lg btn-secondary fs-11 w-100 d-block ml-2 ml-md-0" @click="resetSearch()">Reset</button>
</div>
</div>
</div>
</div>
<div class="row no-margin" v-show="search" :key="serachSectionKey">
<div class="col bg-white padding-25">
<p v-if="!userCompany">{{ message }}</p>
<user-company-component v-if="userCompany" :data="userCompany"></user-company-component>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from "../../../general/mixins/componentHandler";
export default {
data(){
return {
section: 'customerSectionTwoComponent',
isLoading: false,
search: false,
serachSectionKey: 2,
email: '',
userCompany: null,
message: 'Searching...'
}
},
methods: {
submitSearch(){
this.serachSectionKey ++;
this.search = true;
this.userCompany = null;
this.message = 'Searching...';
this.submit(route('api.account.user.company', this.email), 'get', this.section, false, false);
},
successHandler(response){
if(response.payload.data != undefined)
this.userCompany = response.payload.data;
else
this.message = 'Customer not found';
},
errorHandler(response){
if(response.payload.data == undefined)
this.message = 'Customer not found';
},
resetSearch() {
this.userCompany = null;
this.search = false;
this.email = '';
this.message = 'Searching...';
}
},
validations: {
email: {}
},
mixins: [componentHandler]
};
</script>
@@ -0,0 +1,179 @@
@extends('layouts.base_portal')
@section('inner_content')
<div class="row">
<div class="col bg-white p-t-15 p-b-15">
<div class="row no-margin">
<div class="col-12">
<form method="post" >
@csrf
<div class="row">
<div class="col">
<input class="form-control" type="text" name="marking" placeholder="Marking" value="{{$marking}}">
</div>
<div class="col">
<input class="form-control" type="text" name="customer_email" placeholder="Email" value="{{$email}}">
</div>
<div class="col">
<input class="form-control" type="text" name="booking_reference" placeholder="Booking Reference" value="{{$bookingReference}}">
</div>
<div class="col-auto">
<button class="btn btn-complete" type="submit">Search</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<main>
@if($company)
@php
$employees = $company->employees;
$primaryEmployee = $employees->first();
$identification = $company->documents->whereIn('document_type', \App\Classes\ValueObjects\Constants\DocumentType::IDENTIFICATION_DOCUMENTS)->first()
@endphp
<section id="customer-account" class="m-b-50">
<h3>Customer Account</h3>
<p>Marking: <span><a href="{{route('customer.profile', $company->reference)}}" target="_blank">{{$company->reference}}</a></span></p>
<p>Account Type: <span>{{$company->type === 1 ? 'Business' : 'Personal'}}</span></p>
@if($company->type === 1)<p>Company's Name: <span>{{$company->name}}</span></p>@endif
<p>Customer's Name: <span>{{$employees->pluck('name')->implode(', ')}}</span></p>
<p>Email: <span>{{$employees->pluck('email')->implode(', ')}}</span></p>
<p>Phone: <span>{{$company->contacts->pluck('phone')->implode(', ')}}</span></p>
<p>Registration Date: <span>{{$company->created_at->format('d-m-Y')}}</span></p>
</section>
<section id="customer-verification" class="m-b-50">
<h3>Customer Verification</h3>
<p>Email Verification Status: <span>{{ $primaryEmployee->status === 2 ? 'Verified' : 'Pending Verification'}}</span></p>
<p>Identification Verification Status: <span>{{$identification ? ($identification->status === 2 ? 'Verified' : 'Pending Verification') : 'Not Submitted'}}</span></p>
</section>
@if(!$booking)
<section>
<h3>Customer Bookings</h3>
@php
$bookings = $company->bookings()->whereIn('status', [2, 3])->get();
@endphp
<section>
@foreach($bookings as $booking)
@php
$payments = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->get();
$purchaseOrder = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->first();
@endphp
<section class="m-b-50">
<h5 class="bold">Booking Reference: {{$booking->marking}}</h5>
<p>Amount: <span>{{$booking->fix_amount.' '.$booking->fixedCurrency->short_code}}</span></p>
<p>Status: <span>{{$booking->status === 3 ? 'Complete' : 'In Progress'}}</span></p>
<p>Purchase Order Status: <span>{{$purchaseOrder ? ($purchaseOrder->status === 3 ? 'Approved' : ($purchaseOrder->status === 1 ? 'Pending Approval' : 'Incomplete Submission')) : 'Pending Submission'}}</span></p>
@if($payments)<p class="m-t-35 bold">Payment History:</p>@endif
@php $i = 1; @endphp
@foreach($payments as $payment)
@php
$bill = $payment->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::BILL)->first();
$transferProof = null;
$status = 'Pending Submission';
if($payment->status === 1) {
$status = 'Pending Approval';
}
if($payment->status === 2) {
$status = 'Pending Confirmation';
}
if(in_array($payment->status, [4, 5])) {
$status = 'Rejected/Failed Payment';
}
if($bill) {
if($bill->status === 1) {
$status = 'Pending Transfer Proof';
}
if(in_array($bill->status, [2, 3])) {
$status = 'Transfer Complete';
$transferProof = $bill->documents()->first();
}
}
@endphp
<section class="m-b-35">
<p>{{$i++}}.</p>
<p>Amount: <span>{{$payment->original_amount.' '.$payment->original_currency->short_code}}</span></p>
<p>Status: <span>{{$status}}</span></p>
<p>Payment Date: <span>{{$payment->created_at->format('d-m-Y')}}</span></p>
@if($bill)
<p>Supplier: <span>{{$bill->issuerCompany->name}}</span></p>
<p>Supplier Order Date: <span>{{$bill->created_at->format('d-m-Y')}}</span></p>
@if($transferProof)<p>Transfer Proof Upload Date: <span>{{$transferProof->created_at->format('d-m-Y')}}</span></p>@endif
@endif
</section>
@endforeach
</section>
@endforeach
</section>
</section>
@endif
@endif
@if($booking)
@php
$payments = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->get();
$purchaseOrder = $booking->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::PURCHASE_ORDER)->first();
@endphp
<section>
<h5 class="bold">Booking Reference: {{$booking->marking}}</h5>
<p>Amount: <span>{{$booking->fix_amount.' '.$booking->fixedCurrency->short_code}}</span></p>
<p>Status: <span>{{$booking->status === 3 ? 'Complete' : 'In Progress'}}</span></p>
<p>Purchase Order Status: <span>{{$purchaseOrder ? ($purchaseOrder->status === 3 ? 'Approved' : ($purchaseOrder->status === 1 ? 'Pending Approval' : 'Incomplete Submission')) : 'Pending Submission'}}</span></p>
@if($payments)<p class="m-t-35 bold">Payment History:</p>@endif
@php $i = 1; @endphp
@foreach($payments as $payment)
@php
$bill = $payment->transactions()->where('type', \App\Classes\ValueObjects\Constants\TransactionType::BILL)->first();
$transferProof = null;
$status = 'Pending Submission';
if($payment->status === 1) {
$status = 'Pending Approval';
}
if($payment->status === 2) {
$status = 'Pending Confirmation';
}
if(in_array($payment->status, [4, 5])) {
$status = 'Rejected/Failed Payment';
}
if($bill) {
if($bill->status === 1) {
$status = 'Pending Transfer Proof';
}
if(in_array($bill->status, [2, 3])) {
$status = 'Transfer Complete';
$transferProof = $bill->documents()->first();
}
}
@endphp
<section class="m-b-35">
<p>{{$i++}}.</p>
<p>Amount: <span>{{$payment->original_amount.' '.$payment->original_currency->short_code}}</span></p>
<p>Status: <span>{{$status}}</span></p>
<p>Payment Date: <span>{{$payment->created_at->format('d-m-Y')}}</span></p>
@if($bill)
<p>Supplier: <span>{{$bill->issuerCompany->name}}</span></p>
<p>Supplier Order Date: <span>{{$bill->created_at->format('d-m-Y')}}</span></p>
@if($transferProof)<p>Transfer Proof Upload Date: <span>{{$transferProof->created_at->format('d-m-Y')}}</span></p>@endif
@endif
</section>
@endforeach
</section>
@endif
</main>
</div>
</div>
@endsection
@@ -5,6 +5,7 @@
<div class="row m-b-25">
<div class="col">
<customer-section-component></customer-section-component>
<customer-section-two-component></customer-section-two-component>
<div class="row tabsContainer">
<div class="col">
<div class="row m-l-0 m-r-0 d-flex">
@@ -77,10 +78,10 @@
<div class="row no-margin">
<div class="col bg-white padding-25">
<div class="row tabsContainer tabContent m-l-0 m-r-0" tab-name="top-spenders">
<list-component key="2" section="topSpenders" :endpoint="route('api.company.list')" :options="{'with_total_payments': true,
'recency':'2022-02-15',
'frequency': 15,
<list-component key="2" section="topSpenders" :endpoint="route('api.company.list')" :options="{'with_total_payments': true,
'recency':'2022-02-15',
'frequency': 15,
'business_type': 2, with_bookings:true, order_by:{ column:'total_payments', DESC:true}}">
<template slot="list" slot-scope="{data}">
<company-component :data="data"></company-component>
@@ -287,4 +288,4 @@
</div>
</div>
</div>
@endsection
@endsection
@@ -34,7 +34,7 @@
<div class="ref">REF: {{ $transaction->booking->marking }}</div>
<div class="date">Date: {{ $po_order_transaction->created_at }}</div>
<div class="date">Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->created_at }}</div>
<div>&nbsp;</div>
</div>
</td>
+1 -1
View File
@@ -33,7 +33,7 @@
<div class="ref">Ref# {{ $po_order_transaction->booking->marking }}</div>
<div class="date">Date: {{ $po_order_transaction->booking->created_at }}</div>
<div class="date">Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->booking->created_at }}</div>
<div>&nbsp;</div>
</div>
</td>
@@ -14,7 +14,7 @@
<td class="document-detail">
PO#: {{ $po_order_transaction->bill_no }} <br>
Ref#: {{ $po_order_transaction->booking->marking }} <br>
Date: {{ $po_order_transaction->booking->created_at }}
Date: {{ $supplier->segments->whereIn('id', [23])->first() ? \Carbon\Carbon::now() : $po_order_transaction->booking->created_at }}
</td>
</tr>
</table>
+59 -59
View File
@@ -31,6 +31,29 @@
</div>
</div>
</div>
<div class="row m-b-5" v-if="$store.getters.isAdmin">
<div class="col">
<div class="row">
<div class="col">
<div class="row">
<div class="col bg-master-light tabButton" tab-name="labelSegment">
<div class="row align-items-center">
<div class="col-auto p-t-10 p-b-10 b-r b-grey">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="35" height="35"
viewBox="0 0 172 172"
style=" fill:#000000;"><defs><linearGradient x1="86" y1="97.08594" x2="86" y2="105.31775" gradientUnits="userSpaceOnUse" id="color-1_43991_gr1"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="94.0625" y1="85.83338" x2="94.0625" y2="93.89588" gradientUnits="userSpaceOnUse" id="color-2_43991_gr2"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="77.9375" y1="85.83338" x2="77.9375" y2="93.89588" gradientUnits="userSpaceOnUse" id="color-3_43991_gr3"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="86" y1="28.55469" x2="86" y2="143.10938" gradientUnits="userSpaceOnUse" id="color-4_43991_gr4"><stop offset="0" stop-color="#009add"></stop><stop offset="1" stop-color="#00baa4"></stop></linearGradient></defs><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g><path d="M77.9375,96.75c0,4.45319 3.60931,8.0625 8.0625,8.0625c4.45319,0 8.0625,-3.60931 8.0625,-8.0625z" fill="url(#color-1_43991_gr1)"></path><path d="M94.0625,86c-2.2264,0 -4.03125,1.80485 -4.03125,4.03125c0,2.2264 1.80485,4.03125 4.03125,4.03125c2.2264,0 4.03125,-1.80485 4.03125,-4.03125c0,-2.2264 -1.80485,-4.03125 -4.03125,-4.03125z" fill="url(#color-2_43991_gr2)"></path><path d="M77.9375,86c-2.2264,0 -4.03125,1.80485 -4.03125,4.03125c0,2.2264 1.80485,4.03125 4.03125,4.03125c2.2264,0 4.03125,-1.80485 4.03125,-4.03125c0,-2.2264 -1.80485,-4.03125 -4.03125,-4.03125z" fill="url(#color-3_43991_gr3)"></path><path d="M147.8125,51.0625h-18.8125v-8.0625c0,-4.44512 -3.61738,-8.0625 -8.0625,-8.0625h-11.2445c-1.11263,-3.12019 -4.06888,-5.375 -7.568,-5.375h-32.25c-3.49912,0 -6.45538,2.25481 -7.568,5.375h-11.2445c-4.44512,0 -8.0625,3.61738 -8.0625,8.0625v8.0625h-18.8125c-4.44513,0 -8.0625,3.61738 -8.0625,8.0625v59.125c0,4.44512 3.61737,8.0625 8.0625,8.0625h18.8125v8.0625c0,4.44512 3.61738,8.0625 8.0625,8.0625h69.875c4.44512,0 8.0625,-3.61738 8.0625,-8.0625v-8.0625h18.8125c4.44512,0 8.0625,-3.61738 8.0625,-8.0625v-59.125c0,-4.44512 -3.61737,-8.0625 -8.0625,-8.0625zM147.8125,56.4375c1.4835,0 2.6875,1.20669 2.6875,2.6875v51.0625h-2.88637c-0.80625,-6.09525 -4.28119,-11.78469 -9.47612,-15.25425c0.99437,-1.87319 1.6125,-3.98019 1.6125,-6.24575v-5.375c0,-6.48763 -4.62519,-11.91638 -10.75,-13.16606v-13.70894zM134.375,88.6875c0,3.49912 -2.25213,6.45538 -5.375,7.568v-20.50831c3.12287,1.11262 5.375,4.06887 5.375,7.568zM134.6545,99.1365c3.913,2.48056 6.62469,6.84506 7.47125,11.051h-13.12575v-8.33394c2.12044,-0.43269 4.02319,-1.41094 5.6545,-2.71706zM67.1875,37.625c0,-1.48081 1.204,-2.6875 2.6875,-2.6875h32.25c1.4835,0 2.6875,1.20669 2.6875,2.6875v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875h-32.25c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875zM51.0625,40.3125h10.75c0,4.44512 3.61737,8.0625 8.0625,8.0625h32.25c4.44512,0 8.0625,-3.61738 8.0625,-8.0625h10.75c1.4835,0 2.6875,1.20669 2.6875,2.6875v83.3125h-3.34056c-1.73881,-9.23963 -7.19444,-17.45531 -15.06344,-22.66906c1.44319,-2.88906 2.279,-6.13556 2.279,-9.58094v-10.75c0,-11.85456 -9.64544,-21.5 -21.5,-21.5c-11.85456,0 -21.5,9.64544 -21.5,21.5v10.75c0,3.44537 0.83581,6.69188 2.28169,9.58094c-7.869,5.21375 -13.32463,13.42675 -15.06344,22.66906h-3.34325v-83.3125c0,-1.48081 1.204,-2.6875 2.6875,-2.6875zM102.125,94.0625c0,8.89294 -7.23206,16.125 -16.125,16.125c-8.89294,0 -16.125,-7.23206 -16.125,-16.125v-10.75c0,-8.89294 7.23206,-16.125 16.125,-16.125c8.89294,0 16.125,7.23206 16.125,16.125zM86,115.5625c6.48494,0 12.29531,-2.89981 16.24056,-7.45513c6.39088,4.22744 10.93006,10.77956 12.59363,18.20513h-57.66837c1.66356,-7.42556 6.20275,-13.97769 12.59631,-18.20244c3.94256,4.55531 9.75294,7.45244 16.23787,7.45244zM43,96.2555c-3.12288,-1.11263 -5.375,-4.06888 -5.375,-7.568v-5.375c0,-3.49912 2.25212,-6.45538 5.375,-7.568zM37.32669,99.12306c1.634,1.31419 3.54481,2.29512 5.67331,2.7305v8.33394h-13.18487c0.78475,-4.57412 3.526,-8.63225 7.51156,-11.06444zM24.1875,56.4375h18.8125v13.70894c-6.12481,1.24969 -10.75,6.67575 -10.75,13.16606v5.375c0,2.26287 0.61544,4.36719 1.60981,6.24038c-5.21106,3.44806 -8.686,9.05688 -9.47613,15.25963h-2.88369v-51.0625c0,-1.48081 1.204,-2.6875 2.6875,-2.6875zM24.1875,120.9375c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875v-2.6875h21.5v5.375zM120.9375,137.0625h-69.875c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875v-2.6875h75.25v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875zM147.8125,120.9375h-18.8125v-5.375h21.5v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875z" fill="url(#color-4_43991_gr4)"></path></g></g></svg>
</div>
<div class="col">
<div class="fs-12 m-t-5 all-caps m-b-5">Labels</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<template v-if="$store.getters.isSuperAdmin">
<div class="row m-b-5">
<div class="col">
@@ -170,29 +193,6 @@
</div>
</div>
</div>
<div class="row m-b-5">
<div class="col">
<div class="row">
<div class="col">
<div class="row">
<div class="col bg-master-light tabButton" tab-name="labelSegment">
<div class="row align-items-center">
<div class="col-auto p-t-10 p-b-10 b-r b-grey">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="35" height="35"
viewBox="0 0 172 172"
style=" fill:#000000;"><defs><linearGradient x1="86" y1="97.08594" x2="86" y2="105.31775" gradientUnits="userSpaceOnUse" id="color-1_43991_gr1"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="94.0625" y1="85.83338" x2="94.0625" y2="93.89588" gradientUnits="userSpaceOnUse" id="color-2_43991_gr2"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="77.9375" y1="85.83338" x2="77.9375" y2="93.89588" gradientUnits="userSpaceOnUse" id="color-3_43991_gr3"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></stop></linearGradient><linearGradient x1="86" y1="28.55469" x2="86" y2="143.10938" gradientUnits="userSpaceOnUse" id="color-4_43991_gr4"><stop offset="0" stop-color="#009add"></stop><stop offset="1" stop-color="#00baa4"></stop></linearGradient></defs><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g><path d="M77.9375,96.75c0,4.45319 3.60931,8.0625 8.0625,8.0625c4.45319,0 8.0625,-3.60931 8.0625,-8.0625z" fill="url(#color-1_43991_gr1)"></path><path d="M94.0625,86c-2.2264,0 -4.03125,1.80485 -4.03125,4.03125c0,2.2264 1.80485,4.03125 4.03125,4.03125c2.2264,0 4.03125,-1.80485 4.03125,-4.03125c0,-2.2264 -1.80485,-4.03125 -4.03125,-4.03125z" fill="url(#color-2_43991_gr2)"></path><path d="M77.9375,86c-2.2264,0 -4.03125,1.80485 -4.03125,4.03125c0,2.2264 1.80485,4.03125 4.03125,4.03125c2.2264,0 4.03125,-1.80485 4.03125,-4.03125c0,-2.2264 -1.80485,-4.03125 -4.03125,-4.03125z" fill="url(#color-3_43991_gr3)"></path><path d="M147.8125,51.0625h-18.8125v-8.0625c0,-4.44512 -3.61738,-8.0625 -8.0625,-8.0625h-11.2445c-1.11263,-3.12019 -4.06888,-5.375 -7.568,-5.375h-32.25c-3.49912,0 -6.45538,2.25481 -7.568,5.375h-11.2445c-4.44512,0 -8.0625,3.61738 -8.0625,8.0625v8.0625h-18.8125c-4.44513,0 -8.0625,3.61738 -8.0625,8.0625v59.125c0,4.44512 3.61737,8.0625 8.0625,8.0625h18.8125v8.0625c0,4.44512 3.61738,8.0625 8.0625,8.0625h69.875c4.44512,0 8.0625,-3.61738 8.0625,-8.0625v-8.0625h18.8125c4.44512,0 8.0625,-3.61738 8.0625,-8.0625v-59.125c0,-4.44512 -3.61737,-8.0625 -8.0625,-8.0625zM147.8125,56.4375c1.4835,0 2.6875,1.20669 2.6875,2.6875v51.0625h-2.88637c-0.80625,-6.09525 -4.28119,-11.78469 -9.47612,-15.25425c0.99437,-1.87319 1.6125,-3.98019 1.6125,-6.24575v-5.375c0,-6.48763 -4.62519,-11.91638 -10.75,-13.16606v-13.70894zM134.375,88.6875c0,3.49912 -2.25213,6.45538 -5.375,7.568v-20.50831c3.12287,1.11262 5.375,4.06887 5.375,7.568zM134.6545,99.1365c3.913,2.48056 6.62469,6.84506 7.47125,11.051h-13.12575v-8.33394c2.12044,-0.43269 4.02319,-1.41094 5.6545,-2.71706zM67.1875,37.625c0,-1.48081 1.204,-2.6875 2.6875,-2.6875h32.25c1.4835,0 2.6875,1.20669 2.6875,2.6875v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875h-32.25c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875zM51.0625,40.3125h10.75c0,4.44512 3.61737,8.0625 8.0625,8.0625h32.25c4.44512,0 8.0625,-3.61738 8.0625,-8.0625h10.75c1.4835,0 2.6875,1.20669 2.6875,2.6875v83.3125h-3.34056c-1.73881,-9.23963 -7.19444,-17.45531 -15.06344,-22.66906c1.44319,-2.88906 2.279,-6.13556 2.279,-9.58094v-10.75c0,-11.85456 -9.64544,-21.5 -21.5,-21.5c-11.85456,0 -21.5,9.64544 -21.5,21.5v10.75c0,3.44537 0.83581,6.69188 2.28169,9.58094c-7.869,5.21375 -13.32463,13.42675 -15.06344,22.66906h-3.34325v-83.3125c0,-1.48081 1.204,-2.6875 2.6875,-2.6875zM102.125,94.0625c0,8.89294 -7.23206,16.125 -16.125,16.125c-8.89294,0 -16.125,-7.23206 -16.125,-16.125v-10.75c0,-8.89294 7.23206,-16.125 16.125,-16.125c8.89294,0 16.125,7.23206 16.125,16.125zM86,115.5625c6.48494,0 12.29531,-2.89981 16.24056,-7.45513c6.39088,4.22744 10.93006,10.77956 12.59363,18.20513h-57.66837c1.66356,-7.42556 6.20275,-13.97769 12.59631,-18.20244c3.94256,4.55531 9.75294,7.45244 16.23787,7.45244zM43,96.2555c-3.12288,-1.11263 -5.375,-4.06888 -5.375,-7.568v-5.375c0,-3.49912 2.25212,-6.45538 5.375,-7.568zM37.32669,99.12306c1.634,1.31419 3.54481,2.29512 5.67331,2.7305v8.33394h-13.18487c0.78475,-4.57412 3.526,-8.63225 7.51156,-11.06444zM24.1875,56.4375h18.8125v13.70894c-6.12481,1.24969 -10.75,6.67575 -10.75,13.16606v5.375c0,2.26287 0.61544,4.36719 1.60981,6.24038c-5.21106,3.44806 -8.686,9.05688 -9.47613,15.25963h-2.88369v-51.0625c0,-1.48081 1.204,-2.6875 2.6875,-2.6875zM24.1875,120.9375c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875v-2.6875h21.5v5.375zM120.9375,137.0625h-69.875c-1.4835,0 -2.6875,-1.20669 -2.6875,-2.6875v-2.6875h75.25v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875zM147.8125,120.9375h-18.8125v-5.375h21.5v2.6875c0,1.48081 -1.204,2.6875 -2.6875,2.6875z" fill="url(#color-4_43991_gr4)"></path></g></g></svg>
</div>
<div class="col">
<div class="fs-12 m-t-5 all-caps m-b-5">Labels</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
@@ -245,6 +245,42 @@
</div>
</div>
</div>
<div class="row tabsContainer hide tabContent" tab-name="labelSegment" v-if="$store.getters.isAdmin">
<div class="col">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading('labelSection')"></loading-component>
<div class="row" v-show="!$store.getters.isLoading('labelSection')">
<div class="col">
<div class="row p-b-5 m-b-20 b-b b-grey align-items-center parentContainer">
<div class="col">
<div class="font-heading all-caps fs-10 hint-text">
Labels
</div>
</div>
<div class="col-auto">
<button class="btn btn-xs btn-primary b-rad-none requestModal" data-type="createModal">
<i class="fa fa-plus m-r-5"></i>
Create Label
</button>
<modal-form-component section="labelSection">
<template slot="form" slot-scope="{section}">
<segment-form-component :section="section" :type="3"></segment-form-component>
</template>
</modal-form-component>
</div>
</div>
<div class="row m-b-20">
<div class="col">
<list-component section="labelSection" :endpoint="route('api.segment.list')" :options="{'type': 3}">
<template slot="list" slot-scope="{data}">
<segment-component section="labelSection" :data="data" :type="3"></segment-component>
</template>
</list-component>
</div>
</div>
</div>
</div>
</div>
</div>
<template v-if="$store.getters.isSuperAdmin">
<div class="row tabsContainer hide tabContent" tab-name="team">
<div class="col">
@@ -495,42 +531,6 @@
</div>
</div>
</div>
<div class="row tabsContainer hide tabContent" tab-name="labelSegment">
<div class="col">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading('labelSection')"></loading-component>
<div class="row" v-show="!$store.getters.isLoading('labelSection')">
<div class="col">
<div class="row p-b-5 m-b-20 b-b b-grey align-items-center parentContainer">
<div class="col">
<div class="font-heading all-caps fs-10 hint-text">
Labels
</div>
</div>
<div class="col-auto">
<button class="btn btn-xs btn-primary b-rad-none requestModal" data-type="createModal">
<i class="fa fa-plus m-r-5"></i>
Create Label
</button>
<modal-form-component section="labelSection">
<template slot="form" slot-scope="{section}">
<segment-form-component :section="section" :type="3"></segment-form-component>
</template>
</modal-form-component>
</div>
</div>
<div class="row m-b-20">
<div class="col">
<list-component section="labelSection" :endpoint="route('api.segment.list')" :options="{'type': 3}">
<template slot="list" slot-scope="{data}">
<segment-component section="labelSection" :data="data" :type="3"></segment-component>
</template>
</list-component>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row tabsContainer hide tabContent" tab-name="announcement">
<div class="col">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading('announcementsSection')"></loading-component>
+2 -1
View File
@@ -34,6 +34,7 @@ Route::group(['prefix' => 'account', 'namespace' => 'Accounts', 'as' => 'account
});
Route::group(['prefix' => 'user', 'as' => 'user.', 'middleware' => 'valid.token'], function () {
Route::get('/{email}', 'FetchUserByEmailController@fetch')->name('company');
Route::post('/show', 'FetchUserController@fetch')->name('show');
Route::get('/list', 'ListUsersController@list')->name('list');
Route::put('/update/{id}', 'UpdateUserController@update')->name('update');
@@ -44,4 +45,4 @@ Route::group(['prefix' => 'account', 'namespace' => 'Accounts', 'as' => 'account
});
});
+2
View File
@@ -12,6 +12,8 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking
Route::delete('/delete/{id}', 'DeleteBookingController@delete')->name('delete');
Route::post('/regenerate/invoice/{id}', 'RegenerateInvoiceBookingController@regenerate')->name('regenerate.invoice');
Route::put('/owner/update/{id}', 'UpdateBookingOwnerController@update')->name('owner.update');
Route::group(['prefix' => '{id}/payment', 'as' => 'payment.'], function () {
Route::post('quotation', 'FetchBookingPaymentQuotationController@fetch')->name('quotation');
Route::post('create', 'CreateBookingPaymentController@create')->name('create');
+45 -1
View File
@@ -19,7 +19,7 @@ use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Maatwebsite\Excel\Excel;
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
use Webklex\PDFMerger\Facades\PDFMergerFacade as PDFMerger;
/*
@@ -103,6 +103,50 @@ Route::get('/purchase_orders', function () {
return view('pages.purchase_orders');
})->name('purchase_orders');
Route::get('/support', function () {
return view('pages.customer_support', [
'marking' => null,
'email' => null,
'bookingReference' => null,
'company' => null,
'booking' => null
]);
})->name('support');
Route::post('/support', function (Request $request) {
$marking = $request->input('marking');
$email = $request->input('customer_email');
$bookingReference = $request->input('booking_reference');
$company = null;
$booking = null;
if($email) {
$company = Company::whereHas('Employees', function($user) use($email) {
return $user->where('email', $email);
})->first();
}
if($marking) {
$company = Company::where('reference', $marking)->first();
}
if($bookingReference) {
$booking = Booking::where('marking', $bookingReference)->first();
$company = $booking->company;
}
return view('pages.customer_support', [
'marking' => $marking,
'email' => $email,
'bookingReference' => $bookingReference,
'company' => $company,
'booking' => $booking,
]);
})->name('support');
Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callback')->name('online_payment.redirect');
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');