mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 22:13:59 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Addresses\ControllersLogic;
|
||||
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Addresses\Standards\Rules\CanUpdateAddress;
|
||||
use App\Classes\Modules\Addresses\Services\ResetsAddressesDefault;
|
||||
use App\Classes\Modules\Addresses\Services\SetsAddressToDefault;
|
||||
|
||||
use App\Models\Address;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class SetAddressToDefaultLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Updated Address',
|
||||
'message' => 'You have successfully set the default Address'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var ResetsAddressesDefault */
|
||||
private $resetsAddressesDefault;
|
||||
|
||||
/** @var FetchesAddress */
|
||||
private $fetchesAddress;
|
||||
|
||||
/** @var SetsAddressToDefault*/
|
||||
private $setsAddressToDefault;
|
||||
|
||||
/**
|
||||
* SetAddressToDefaultLogic constructor.
|
||||
* @param ResetsAddressesDefault $resetsAddressesDefault
|
||||
* @param FetchesAddress $fetchesAddress
|
||||
* @param SetsAddressToDefault $setsAddressToDefault
|
||||
*/
|
||||
public function __construct(ResetsAddressesDefault $resetsAddressesDefault, FetchesAddress $fetchesAddress, SetsAddressToDefault $setsAddressToDefault)
|
||||
{
|
||||
$this->resetsAddressesDefault = $resetsAddressesDefault;
|
||||
$this->fetchesAddress = $fetchesAddress;
|
||||
$this->setsAddressToDefault = $setsAddressToDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
/** @var Address $address */
|
||||
|
||||
$address = $this->fetchesAddress->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->resetsAddressesDefault->execute($address);
|
||||
|
||||
return $this->resourceResponse(new AddressResource($this->setsAddressToDefault->execute($address)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Addresses\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\Address;
|
||||
|
||||
class ResetsAddressesDefault extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Address $address
|
||||
* @return void
|
||||
*/
|
||||
public function execute(Address $address)
|
||||
{
|
||||
$address->company->addresses()->update(['billing' => false]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Addresses\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\Address;
|
||||
|
||||
class SetsAddressToDefault extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Address $model
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Address $model)
|
||||
{
|
||||
$model->billing = true;
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,17 @@ namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\ApprovesDocument;
|
||||
use App\Classes\Modules\Documents\Services\FetchesDocument;
|
||||
use App\Classes\Modules\Documents\Services\RejectsDocument;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -22,14 +27,15 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
|
||||
* @param ApprovesDocument $approvesDocument
|
||||
* @param RejectsDocument $rejectsDocument
|
||||
* @param FetchesDocument $fetchesDocument
|
||||
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument)
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->approvesDocument = $approvesDocument;
|
||||
$this->rejectsDocument = $rejectsDocument;
|
||||
$this->fetchesDocument = $fetchesDocument;
|
||||
$this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,10 +60,8 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
|
||||
/** @var RejectsDocument */
|
||||
private $rejectsDocument;
|
||||
|
||||
/** @var FetchesDocument */
|
||||
private $fetchesDocument;
|
||||
|
||||
|
||||
/** @var CreateInvoiceTransactionProcessor */
|
||||
private $createInvoiceTransactionProcessor;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
@@ -75,6 +79,8 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
|
||||
|
||||
$this->createInvoiceTransactionProcessor->execute($transaction->booking);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Booking;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CalculatesBookingCurrencyAverageRate
|
||||
{
|
||||
public function execute(Booking $booking){
|
||||
return $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->avg('currency_rate');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\Booking;
|
||||
|
||||
class UpdatesBookingStatus extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Booking $model
|
||||
* @param int $status
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Booking $model, int $status)
|
||||
{
|
||||
$model->status = $status;
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ServiceTypes\Services;
|
||||
|
||||
use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
use App\Models\SegmentConstant;
|
||||
|
||||
class FetchesServiceBankConfigurations
|
||||
{
|
||||
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
/**
|
||||
* FetchesServiceBankConfigurations constructor.
|
||||
* @param FetchesBank $fetchesBank
|
||||
*/
|
||||
public function __construct(FetchesBank $fetchesBank)
|
||||
{
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
}
|
||||
|
||||
public function execute(SegmentConstant $constants)
|
||||
{
|
||||
return $this->fetchesBank->execute(['id' => $constants->detail->bank_id]);
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,19 @@ class FetchesServiceConfigurations
|
||||
/** @var FetchesServiceCurrenciesConfigurations */
|
||||
private $fetchesServiceCurrenciesConfigurations;
|
||||
|
||||
/** @var FetchesServiceBankConfigurations */
|
||||
private $fetchesServiceBankConfigurations;
|
||||
|
||||
/**
|
||||
* FetchesServiceConfigurations constructor.
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param FetchesServiceCurrenciesConfigurations $fetchesServiceCurrenciesConfigurations
|
||||
*/
|
||||
public function __construct(FetchesConstant $fetchesConstant, FetchesServiceCurrenciesConfigurations $fetchesServiceCurrenciesConfigurations)
|
||||
public function __construct(FetchesConstant $fetchesConstant, FetchesServiceCurrenciesConfigurations $fetchesServiceCurrenciesConfigurations, FetchesServiceBankConfigurations $fetchesServiceBankConfigurations)
|
||||
{
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->fetchesServiceCurrenciesConfigurations = $fetchesServiceCurrenciesConfigurations;
|
||||
$this->fetchesServiceBankConfigurations = $fetchesServiceBankConfigurations;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +36,7 @@ class FetchesServiceConfigurations
|
||||
'active' => (int) $constant->detail->is_active ?? false,
|
||||
'billable' => (int) $constant->detail->is_billable ?? false,
|
||||
'bank_id' => $constant->detail->bank_id ?? '',
|
||||
'bank_info' => $constant->detail->bank_id ? $this->fetchesServiceBankConfigurations->execute($constant) : '',
|
||||
'currencies' => $this->fetchesServiceCurrenciesConfigurations->execute($constant)
|
||||
], $this->addConfigurations($constant)->toArray());
|
||||
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
|
||||
$path = Str::studly($supplier->name).'_'.Carbon::now()->format('Y_m_d_h_s_i').'.pdf';
|
||||
|
||||
$object = new DocumentObject(
|
||||
DocumentType::CUSTOMER_PAYMENT_PROOF,
|
||||
DocumentType::CURRENCY_VENDOR_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Modules\Transactions\Services\ListsTransactions;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingPaidAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingCurrencyAverageRate;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Bookings\Services\UpdatesBookingStatus;
|
||||
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Barryvdh\DomPDF\PDF;
|
||||
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CreateInvoiceTransactionProcessor
|
||||
{
|
||||
/** @var ListsTransactions */
|
||||
private $listsTransactions;
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
/** @var CalculatesBookingPaidAmount */
|
||||
private $calculatesBookingPaidAmount;
|
||||
|
||||
/** @var CalculatesBookingCurrencyAverageRate */
|
||||
private $calculatesBookingCurrencyAverageRate;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
|
||||
/** @var CreatesFiles */
|
||||
private $createsFile;
|
||||
|
||||
/** @var UpdatesBookingStatus */
|
||||
private $updatesBookingStatus;
|
||||
|
||||
/** @var PDF */
|
||||
private $purchase_pdf;
|
||||
|
||||
/** @var PDF */
|
||||
private $deliver_pdf;
|
||||
|
||||
/** @var PDF */
|
||||
private $payment_pdf;
|
||||
|
||||
/** @var PDF */
|
||||
private $supplier_pdf;
|
||||
|
||||
/**
|
||||
* CreateInvoiceTransactionLogic constructor.
|
||||
* @param ListsTransactions $listsTransactions
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param CalculatesBookingPaidAmount $calculatesBookingPaidAmount
|
||||
*/
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, CreatesDocument $createsDocument, CreatesFiles $createsFile, UpdatesBookingStatus $updatesBookingStatus, PDF $purchase_pdf, PDF $deliver_pdf, PDF $payment_pdf, PDF $supplier_pdf)
|
||||
{
|
||||
$this->listsTransactions = $listsTransactions;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->calculatesBookingPaidAmount = $calculatesBookingPaidAmount;
|
||||
$this->calculatesBookingCurrencyAverageRate = $calculatesBookingCurrencyAverageRate;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFile = $createsFile;
|
||||
$this->updatesBookingStatus = $updatesBookingStatus;
|
||||
$this->purchase_pdf = $purchase_pdf;
|
||||
$this->deliver_pdf = $deliver_pdf;
|
||||
$this->payment_pdf = $payment_pdf;
|
||||
$this->supplier_pdf = $supplier_pdf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Booking $booking
|
||||
* @return Model
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function execute(Booking $booking)
|
||||
{
|
||||
$po_order_transaction = $booking->transactions()
|
||||
->where('type', TransactionType::PURCHASE_ORDER)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->first();
|
||||
if ($po_order_transaction) {
|
||||
$paymant_amount = $this->calculatesBookingPaidAmount->execute($booking, $booking->fix_currency_id);
|
||||
$booking_amount = $booking->fix_amount;
|
||||
|
||||
if ((float) $booking_amount === (float) $paymant_amount) {
|
||||
|
||||
$transaction = $booking->transactions()
|
||||
->where('type', TransactionType::PAYMENT)
|
||||
->first();
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('INV-');
|
||||
|
||||
$booking_currency_average_rate = $this->calculatesBookingCurrencyAverageRate->execute($booking);
|
||||
|
||||
$transaction_object = new TransactionObject(
|
||||
$billNumber,
|
||||
TransactionType::INVOICE,
|
||||
$transaction->issuer,
|
||||
$transaction->receiver,
|
||||
$transaction->recipient_bank_account_id,
|
||||
$transaction->payment_method,
|
||||
$paymant_amount,
|
||||
$booking_amount,
|
||||
$transaction->currency_id,
|
||||
$transaction->original_currency_id,
|
||||
$booking_currency_average_rate,
|
||||
$transaction->tax,
|
||||
$transaction->service_charge,
|
||||
null,
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
|
||||
$supplier = $this->fetchesCompany->execute(['id' => $transaction->receiver]);
|
||||
|
||||
$purchase_order_pdf = $this->purchase_pdf->loadView('pages.pdfs.purchase_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::PURCHASE_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($purchase_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'purchase_orders'
|
||||
);
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
$deliver_order_pdf = $this->deliver_pdf->loadView('pages.pdfs.deliver_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::DELIVER_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($deliver_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'deliver_orders'
|
||||
);
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
$payment_order_pdf = $this->payment_pdf->loadView('pages.pdfs.payment_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::PAYMENT_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($payment_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'payment_orders'
|
||||
);
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
$supplier_order_pdf = $this->supplier_pdf->loadView('pages.pdfs.supplier_order', ['transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SUPPLIER_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($supplier_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'supplier_orders'
|
||||
);
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
$transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
|
||||
$this->updatesBookingStatus->execute($booking, ApprovalStatus::COMPLETED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,13 @@ final class DocumentType {
|
||||
|
||||
public const CUSTOMER_PAYMENT_PROOF = 'CUSTOMER_PAYMENT_PROOF';
|
||||
public const CURRENCY_VENDOR_PAYMENT_PROOF = 'CURRENCY_VENDOR_PAYMENT_PROOF';
|
||||
public const CURRENCY_VENDOR_ORDER = 'CURRENCY_VENDOR_ORDER';
|
||||
|
||||
public const WALLET_TOP_UP_PAYMENT_PROOF = 'WALLET_TOP_UP_PAYMENT_PROOF';
|
||||
public const WALLET_REFUND_PAYMENT_PROOF = 'WALLET_REFUND_PAYMENT_PROOF';
|
||||
|
||||
public const PURCHASE_ORDER = 'PURCHASE_ORDER';
|
||||
public const DELIVER_ORDER = 'DELIVER_ORDER';
|
||||
public const PAYMENT_ORDER = 'PAYMENT_ORDER';
|
||||
public const SUPPLIER_ORDER = 'SUPPLIER_ORDER';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Addresses;
|
||||
|
||||
use App\Classes\Modules\Addresses\ControllersLogic\SetAddressToDefaultLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SetAddressToDefaultController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param SetAddressToDefaultLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, SetAddressToDefaultLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingPaidAmount;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -35,6 +36,10 @@ class BookingResource extends JsonResource
|
||||
'fixed_currency' => new CurrencyResource($this->fixedCurrency),
|
||||
'convertible_currency' => new CurrencyResource($this->convertibleCurrency),
|
||||
'conversion_currency' => new CurrencyResource($this->conversionCurrency),
|
||||
'purchase_order_document' => new DocumentResource($this->documents()->where('document_type', DocumentType::PURCHASE_ORDER)->first()),
|
||||
'deliver_order_document' => new DocumentResource($this->documents()->where('document_type', DocumentType::DELIVER_ORDER)->first()),
|
||||
'payment_order_document' => new DocumentResource($this->documents()->where('document_type', DocumentType::PAYMENT_ORDER)->first()),
|
||||
'supplier_order_document' => new DocumentResource($this->documents()->where('document_type', DocumentType::SUPPLIER_ORDER)->first()),
|
||||
'status' => $this->status,
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y'),
|
||||
$this->mergeWhen($this->relationLoaded('transactions'), [
|
||||
|
||||
@@ -29,7 +29,7 @@ class CompanyResource extends JsonResource
|
||||
'business_type' => (int) $this->business_type,
|
||||
'status' => (int) $this->status,
|
||||
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
|
||||
'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->first())),
|
||||
'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->where('billing', true)->first())),
|
||||
'employee' => new UserResource($this->employees->first()),
|
||||
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first()),
|
||||
'bookings' => BookingResource::collection($this->whenLoaded('bookings', $this->bookings()->orderBy('id', 'DESC')->get(), [])),
|
||||
|
||||
+11
-1
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Documentable;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Scopes\CustomerBookingsScope;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -22,7 +24,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property \App\Models\Currency convertible_currency_id
|
||||
* @property \App\Models\Currency conversion_currency_id
|
||||
*/
|
||||
class Booking extends AbstractModel
|
||||
class Booking extends AbstractModel implements Documentable
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
@@ -78,6 +80,14 @@ class Booking extends AbstractModel
|
||||
return $this->BelongsTo(Currency::class, 'conversion_currency_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function documents(): MorphMany
|
||||
{
|
||||
return $this->MorphMany(Document::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
|
||||
@@ -52,4 +52,12 @@ class Transaction extends AbstractModel implements Documentable
|
||||
return $this->HasMany(TransactionDetail::class, 'transaction_id', 'id');
|
||||
}
|
||||
|
||||
public function convert_original_amount()
|
||||
{
|
||||
if($this->booking()->first()->fix_currency_id !== 1) {
|
||||
$currency_rate = $this->currency()->first()->rates()->where('payment_method_type', $this->payment_method)->first();
|
||||
return number_format($this->original_amount / $currency_rate->selling, 2);
|
||||
}
|
||||
return $this->original_amount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,36 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
|
||||
class TransactionDetail extends AbstractModel
|
||||
{
|
||||
protected $table = 'transaction_detail';
|
||||
|
||||
public function transaction(): HasOne
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function transaction(): BelongsTo
|
||||
{
|
||||
return $this->hasOne(Transaction::class, 'transaction_id', 'id');
|
||||
return $this->BelongsTo( Transaction::class, 'transaction_id', 'id');
|
||||
}
|
||||
|
||||
public function convert_original_price()
|
||||
{
|
||||
if($this->transaction()->first()->booking()->first()->fix_currency_id !== 1) {
|
||||
$currency_rate = $this->transaction()->first()->currency()->first()->rates()->where('payment_method_type', $this->transaction()->first()->payment_method)->first();
|
||||
return number_format($this->price / $currency_rate->selling, 2);
|
||||
}
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
public function convert_original_amount()
|
||||
{
|
||||
if($this->transaction()->first()->booking()->first()->fix_currency_id !== 1) {
|
||||
$currency_rate = $this->transaction()->first()->currency()->first()->rates()->where('payment_method_type', $this->transaction()->first()->payment_method)->first();
|
||||
return number_format($this->amount / $currency_rate->selling, 2);
|
||||
}
|
||||
return $this->amount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<div class="row zig-zag-top">
|
||||
<div class="col bg-white padding-25">
|
||||
<div class="row p-b-20 b-b b-dashed m-b-20 b-grey" v-if="defaultAddress[0]">
|
||||
<div class="col">
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps bold fs-10">Default Billing Address</div>
|
||||
<div class="font-heading fs-10">
|
||||
{{defaultAddress[0].street_one}} {{defaultAddress[0].street_two}}, {{defaultAddress[0].district.name}}, {{defaultAddress[0].post_code}} {{defaultAddress[0].state.name}}, {{defaultAddress[0].country.name}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row p-b-20 b-b b-dashed b-grey m-b-20">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-10" v-if="billingAddress.length > 0">
|
||||
<div class="col">
|
||||
<div class="row m-l-0 m-r-0 m-b-5">
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col-auto">
|
||||
<div class="fs-10 all-caps">List of Address </div>
|
||||
</div>
|
||||
<div class="col-auto text-right lh-10 p-r-0 p-l-0 hide">
|
||||
<i class="fa fa-info-circle fs-10 lh-15 hint-text"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<div class="row">
|
||||
<div class="col p-r-0">
|
||||
<div class="btn btn-xs btn-default bg-transparent text-master btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="addressDropdownLaunch.status = !addressDropdownLaunch.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-10 p-b-5 ">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading bold lh-15">{{selectedAddress.street_one}}, {{selectedAddress.street_two}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10 muted"><b class="m-r-5 text-primary">{{selectedAddress.post_code}}</b> {{selectedAddress.district.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto b-l b-grey ">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa text-primary" :class="[{'fa-angle-down': !addressDropdownLaunch.status}, {'fa-angle-up': addressDropdownLaunch.status}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-grey" :class="[{'hide': !addressDropdownLaunch.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="address in billingAddress" v-bind:key="address.id" >
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer p-t-10 p-b-10" :class="[{'bg-master-lightest': address.id === address.id}, {'text-master': address.id === address.id}, {'hover-primary': address.id !== address.id}, {'pointer': address.id !== address.id}]" @click="updateAddress(address)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<!-- <div class="font-heading bold lh-15 fs-10">{{address.post_code ? address.post_code + ' - ':''}}{{address.post_code}}</div> -->
|
||||
<div class="font-heading bold lh-15 fs-10">{{address.street_one}},{{address.street_two}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10 muted"><b class="m-r-5 text-primary">{{address.post_code}}</b> {{address.district.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row parentContainer">
|
||||
<div class="col">
|
||||
<div class="row" v-show="!createAddress">
|
||||
<div class="col">
|
||||
<button class="btn btn-xs btn-outline-primary b-rad-none" @click="createAddress = !createAddress">
|
||||
<i class="fa fa-plus m-r-5"></i>
|
||||
Add New Address
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-show="createAddress">
|
||||
<div class="col">
|
||||
<div>Address form</div>
|
||||
<address-form-component :id="company_id" :type="2" v-on:createdAddress="updateAddress($event)" v-on:close="createAddress = !createAddress"></address-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<set-default-billing-address-component :section="section" :data="item" v-if="item.id != null && defaultAddress[0].id != item.id" v-on:updateBillingAddress="updateBillingAddress($event)"></set-default-billing-address-component>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FormHandler from '../../../general/mixins/formHandler';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
company_id: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
isLoading: true,
|
||||
billingAddress: [],
|
||||
createAddress: false,
|
||||
addressDropdownLaunch: {
|
||||
status: false
|
||||
},
|
||||
selectedAddress: null,
|
||||
item:{
|
||||
id:null
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pendingQueue () {
|
||||
return this.$store.getters.isInCompleteQueue(this.section);
|
||||
},
|
||||
defaultAddress: function() {
|
||||
let defaultAddress = this.billingAddress.filter(function(item) {
|
||||
return item.billing == 1;
|
||||
});
|
||||
if(!this.selectedAddress){
|
||||
this.selectedAddress = defaultAddress[0];
|
||||
}
|
||||
return defaultAddress;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pendingQueue(inComplete){
|
||||
if(inComplete){
|
||||
this.fetchBillingAddress();
|
||||
}
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section});
|
||||
},
|
||||
methods: {
|
||||
fetchBillingAddress(){
|
||||
this.submit(route('api.address.list')+'?filters={%22company_id%22:'+this.company_id+'}', 'get', this.section, false, false)
|
||||
},
|
||||
successHandler(response){
|
||||
this.billingAddress = response.payload.data;
|
||||
},
|
||||
errorHandler(){
|
||||
// window.location.href = this.route('dashboard')
|
||||
},
|
||||
updateAddress(address){
|
||||
this.addressDropdownLaunch.status = false;
|
||||
this.selectedAddress = address;
|
||||
this.createAddress = false;
|
||||
this.fetchBillingAddress();
|
||||
this.item.id = address.id;
|
||||
},
|
||||
updateBillingAddress(address){
|
||||
this.id = address;
|
||||
this.$emit('updateDefaultAddress', address);
|
||||
}
|
||||
},
|
||||
mixins: [FormHandler]
|
||||
}
|
||||
</script>
|
||||
@@ -54,7 +54,11 @@
|
||||
id: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'id': function() {
|
||||
@@ -85,8 +89,9 @@
|
||||
submitForm(){
|
||||
this.submit((this.route('api.address.create')), 'post', 'bookingDetailSection', true, true)
|
||||
},
|
||||
successHandler(){
|
||||
this.updateList()
|
||||
successHandler(response){
|
||||
this.type !== 2 ? this.$emit('updateDefaultAddress', response.payload.data) : this.$emit('createdAddress', response.payload.data);
|
||||
this.resetForm();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-lg btn-default bg-master-lightest b-rad-none all-caps fs-12" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-lg btn-success b-rad-none all-caps fs-12" @click="submitForm()">Set as default</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(route('api.address.default', this.item.id), 'put', this.section, true, true);
|
||||
this.$emit('updateBillingAddress', this.item.id);
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -159,6 +159,7 @@
|
||||
successHandler(response){
|
||||
this.type !== 2 ? this.closeModal() : this.$emit('createdBank', response.payload.data);
|
||||
this.formHandler();
|
||||
this.resetForm();
|
||||
},
|
||||
errorHandler(error){
|
||||
this.formHandler(error.message);
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="bank in data.recipientBanks" v-bind:key="bank.id" >
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer p-t-10 p-b-10" :class="[{'bg-master-lightest': parameters.bankAccount.id === bank.id}, {'text-master': parameters.bankAccount.id === bank.id}, {'hover-primary': parameters.bankAccount.id !== bank.id}, {'pointer': parameters.bankAccount.id !== bank.id}]" @click="updateBank(bank)">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer p-t-10 p-b-10" :class="[{'bg-master-lightest': parameters.bankAccount.id === bank.id}, {'text-master': parameters.bankAccount.id === bank.id}, {'hover-primary': parameters.bankAccount.id !== bank.id}, {'pointer': parameters.bankAccount.id !== bank.id}]" @click="selectBank(bank)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
@@ -257,11 +257,14 @@
|
||||
},
|
||||
methods: {
|
||||
updateBank(bank){
|
||||
this.parameters.bankAccount = bank;
|
||||
this.parameters.bankAccount.status = false;
|
||||
this.selectBank(bank);
|
||||
this.recipientBanks.push(bank);
|
||||
this.createBank = false;
|
||||
},
|
||||
selectBank(bank){
|
||||
this.parameters.bankAccount = bank;
|
||||
this.parameters.bankAccount.status = false;
|
||||
},
|
||||
},
|
||||
mixins: [FormHandler]
|
||||
}
|
||||
|
||||
@@ -29,14 +29,16 @@
|
||||
<div class="row align-items-end">
|
||||
<div class="col">
|
||||
<div class="row no-margin">
|
||||
<div v-for="file in item.documents.files" v-bind:key="file.id" class="col-auto no-padding m-r-5">
|
||||
<document-file-viewr-component :file="file">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
|
||||
<i class="fa fa-file-image-o fs-10"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewr-component>
|
||||
<div v-if="item.documents != null">
|
||||
<div v-for="file in item.documents.files" v-bind:key="file.id" class="col-auto no-padding m-r-5">
|
||||
<document-file-viewr-component :file="file">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
|
||||
<i class="fa fa-file-image-o fs-10"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewr-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -275,7 +275,9 @@
|
||||
this.isloading = false;
|
||||
},
|
||||
errorHandler(error){
|
||||
this.$emit('newCalculation', {});
|
||||
this.$emit('newCalculation', {
|
||||
calculation: -1
|
||||
});
|
||||
this.error = error.message;
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+98
-4
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="row parentContainer">
|
||||
<div class="col">
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
|
||||
<div class="row" v-show="!isLoading" v-if="booking">
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
<div class="row" v-if="!booking.company.address">
|
||||
<div class="col-8">
|
||||
<address-form-component :id="booking.company.id"></address-form-component>
|
||||
<address-form-component :id="booking.company.id" v-on:updateDefaultAddress="updateDefaultAddress"></address-form-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row b-b b-dashed b-grey p-b-25" v-if="booking.company.address">
|
||||
@@ -91,6 +91,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-b-15">
|
||||
<div class="col">
|
||||
<div class="btn btn-sm btn-block btn-success b-rad-none shadow-sm pointer requestModal" data-type="addressesList" >Edit</div>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="addressesList" size="large">
|
||||
<address-list-component :section="section" :company_id="booking.company.id" v-on:updateDefaultAddress="updateDefaultAddress"></address-list-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -145,7 +153,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-5 p-r-5 bg-success requestModal pointer" data-type="identificationVerificationModal">
|
||||
<div class="row align-items-center h-100">
|
||||
<div @click="selectedID(item.id)" class="row align-items-center h-100">
|
||||
<div class="col">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
width="30" height="30"
|
||||
@@ -158,7 +166,7 @@
|
||||
<delete-payment-attempt-form-component :data="item" :section="section" class="text-center"></delete-payment-attempt-form-component>
|
||||
</modal-component>
|
||||
<modal-component type="identificationVerificationModal">
|
||||
<payment-verification-form-component :section="section" :id="booking.id" :data="item"></payment-verification-form-component>
|
||||
<payment-verification-form-component v-if="selected_id == item.id" :section="section" :id="booking.id" :data="item"></payment-verification-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -214,6 +222,85 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20" v-if="booking.status == 3">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="font-head fs-10 all-caps">Invoice</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="col p-t-10 p-b-10 p-r-0 bg-white">
|
||||
<div v-if="booking.purchase_order_document" class="row align-items-end m-b-10 ">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Purchase Order:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="col-auto no-padding m-r-5">
|
||||
<document-file-viewr-component :file="booking.purchase_order_document.files[0]">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
|
||||
<i class="fa fa-file-image-o fs-10"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewr-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="booking.deliver_order_document" class="row align-items-end m-b-10 ">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Purchase Order:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="col-auto no-padding m-r-5">
|
||||
<document-file-viewr-component :file="booking.deliver_order_document.files[0]">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
|
||||
<i class="fa fa-file-image-o fs-10"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewr-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="booking.payment_order_document" class="row align-items-end m-b-10 ">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Purchase Order:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="col-auto no-padding m-r-5">
|
||||
<document-file-viewr-component :file="booking.payment_order_document.files[0]">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
|
||||
<i class="fa fa-file-image-o fs-10"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewr-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="booking.supplier_order_document" class="row align-items-end m-b-10 ">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Purchase Order:</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="col-auto no-padding m-r-5">
|
||||
<document-file-viewr-component :file="booking.supplier_order_document.files[0]">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
|
||||
<i class="fa fa-file-image-o fs-10"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewr-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20" v-if="booking.payment_history.length">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
@@ -276,6 +363,7 @@
|
||||
data(){
|
||||
return {
|
||||
section: 'bookingDetailSection',
|
||||
selected_id: '',
|
||||
isLoading: true,
|
||||
booking: null,
|
||||
attention: false,
|
||||
@@ -309,6 +397,12 @@
|
||||
},
|
||||
errorHandler(){
|
||||
window.location.href = this.route('dashboard')
|
||||
},
|
||||
updateDefaultAddress(){
|
||||
this.fetchBooking();
|
||||
},
|
||||
selectedID(id){
|
||||
this.selected_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: SimHei;
|
||||
src: url('{{base_path().'/public/'}}simhei.ttf') format('truetype');
|
||||
}
|
||||
* {
|
||||
font-family: SimHei, serif ;
|
||||
}
|
||||
</style>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: SimHei;
|
||||
src: url('{{base_path().'/public/'}}simhei.ttf') format('truetype');
|
||||
}
|
||||
* {
|
||||
font-family: SimHei, serif ;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="paymentVerificationSection" :endpoint="route('api.transaction.list')" :options="{'status': 1}">
|
||||
<list-component key="2" section="paymentVerificationSection" :endpoint="route('api.transaction.list')" :options="{'status': 1, 'type': 1}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<payment-verification-component section="paymentVerificationSection" :data="data"></payment-verification-component>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
<style>
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
<h1>Deliver Order</h1>
|
||||
<table style="margin-bottom: 25px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{$supplier->name}}</td>
|
||||
<td>{{\Carbon\Carbon::now('Asia/Singapore')->format('d-m-Y h:s')}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Reference</td>
|
||||
<td>Amount</td>
|
||||
<td>Bank in Details</td>
|
||||
</tr>
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{$transaction->booking->marking}}</td>
|
||||
<td>MYR {{ $transaction->convert_original_amount() }}</td>
|
||||
<td>Account Holder Name: {{$transaction->booking->bank->holder_name}}<br>{{$transaction->booking->bank->bank_name}}: {{$transaction->booking->bank->account_no}}
|
||||
<br>Branch: 首都<br>Bank in Amount: {{$transaction->original_amount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Product Code</td>
|
||||
<td>Product Name</td>
|
||||
<td>Quantity</td>
|
||||
<td>Price</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
@foreach($transaction->transactionDetails as $transaction_detail)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{ $transaction_detail->product_code }}</td>
|
||||
<td>{{ $transaction_detail->product_name }}</td>
|
||||
<td>{{ $transaction_detail->quantity }}</td>
|
||||
<td>MYR {{ $transaction_detail->convert_original_price() }}</td>
|
||||
<td>MYR {{ $transaction_detail->convert_original_amount() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endsection
|
||||
@@ -0,0 +1,57 @@
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
<style>
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
<h1>Payment Order</h1>
|
||||
<table style="margin-bottom: 25px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{$supplier->name}}</td>
|
||||
<td>{{\Carbon\Carbon::now('Asia/Singapore')->format('d-m-Y h:s')}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Reference</td>
|
||||
<td>Amount</td>
|
||||
<td>Bank in Details</td>
|
||||
</tr>
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{$transaction->booking->marking}}</td>
|
||||
<td>MYR {{ $transaction->convert_original_amount() }}</td>
|
||||
<td>Account Holder Name: {{$transaction->booking->bank->holder_name}}<br>{{$transaction->booking->bank->bank_name}}: {{$transaction->booking->bank->account_no}}
|
||||
<br>Branch: 首都<br>Bank in Amount: {{$transaction->original_amount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Product Code</td>
|
||||
<td>Product Name</td>
|
||||
<td>Quantity</td>
|
||||
<td>Price</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
@foreach($transaction->transactionDetails as $transaction_detail)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{ $transaction_detail->product_code }}</td>
|
||||
<td>{{ $transaction_detail->product_name }}</td>
|
||||
<td>{{ $transaction_detail->quantity }}</td>
|
||||
<td>MYR {{ $transaction_detail->convert_original_price() }}</td>
|
||||
<td>MYR {{ $transaction_detail->convert_original_amount() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endsection
|
||||
@@ -0,0 +1,57 @@
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
<style>
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
<h1>Purchase Order</h1>
|
||||
<table style="margin-bottom: 25px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{$supplier->name}}</td>
|
||||
<td>{{\Carbon\Carbon::now('Asia/Singapore')->format('d-m-Y h:s')}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Reference</td>
|
||||
<td>Amount</td>
|
||||
<td>Bank in Details</td>
|
||||
</tr>
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{$transaction->booking->marking}}</td>
|
||||
<td>MYR {{ $transaction->convert_original_amount() }}</td>
|
||||
<td>Account Holder Name: {{$transaction->booking->bank->holder_name}}<br>{{$transaction->booking->bank->bank_name}}: {{$transaction->booking->bank->account_no}}
|
||||
<br>Branch: 首都<br>Bank in Amount: {{$transaction->original_amount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Product Code</td>
|
||||
<td>Product Name</td>
|
||||
<td>Quantity</td>
|
||||
<td>Price</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
@foreach($transaction->transactionDetails as $transaction_detail)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{ $transaction_detail->product_code }}</td>
|
||||
<td>{{ $transaction_detail->product_name }}</td>
|
||||
<td>{{ $transaction_detail->quantity }}</td>
|
||||
<td>MYR {{ $transaction_detail->convert_original_price() }}</td>
|
||||
<td>MYR {{ $transaction_detail->convert_original_amount() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endsection
|
||||
@@ -9,6 +9,7 @@
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
<h1>Purchase Order</h1>
|
||||
<table style="margin-bottom: 25px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -21,17 +22,34 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Reference</td>
|
||||
<td>Rate</td>
|
||||
<td>Amount</td>
|
||||
<td>Bank in Details</td>
|
||||
</tr>
|
||||
@foreach($transactions as $transaction)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{$transaction->booking->marking}}</td>
|
||||
<td>{{$transaction->original_currency->short_code}} {{$transaction->original_amount}}</td>
|
||||
<td>Account Holder Name: {{$transaction->booking->bank->holder_name}}<br>{{$transaction->booking->bank->bank_name}}: {{$transaction->booking->bank->account_no}}
|
||||
<br>Branch: 首都<br>Bank in Amount: {{$transaction->original_amount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Product Code</td>
|
||||
<td>Product Name</td>
|
||||
<td>Quantity</td>
|
||||
<td>Price</td>
|
||||
<td>Amount</td>
|
||||
</tr>
|
||||
@foreach($transaction->transactionDetails as $transaction_detail)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{$transaction->booking->marking}}</td>
|
||||
<td>{{$transaction->currency_rate}}</td>
|
||||
<td>{{$transaction->original_currency->short_code}} {{$transaction->original_amount}}</td>
|
||||
<td>Account Holder Name: {{$transaction->booking->bank->holder_name}}<br>{{$transaction->booking->bank->bank_name}}: {{$transaction->booking->bank->account_no}}
|
||||
<br>Branch: 首都<br>Bank in Amount: {{$transaction->original_amount}}</td>
|
||||
<td>{{ $transaction_detail->product_code }}</td>
|
||||
<td>{{ $transaction_detail->product_name }}</td>
|
||||
<td>{{ $transaction_detail->quantity }}</td>
|
||||
<td>{{$transaction->original_currency->short_code}} {{ $transaction_detail->price }}</td>
|
||||
<td>{{$transaction->original_currency->short_code}} {{ $transaction_detail->amount }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
@@ -12,6 +12,8 @@ Route::group(['prefix' => 'address', 'as' => 'address.', 'namespace' => 'Address
|
||||
|
||||
Route::put('/update/{id}', 'UpdateAddressController@update')->name('update');
|
||||
|
||||
Route::put('/{id}/default', 'SetAddressToDefaultController@update')->name('default');
|
||||
|
||||
Route::delete('/delete/{id}', 'DeleteAddressController@destroy')->name('delete');
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php return array (
|
||||
'sans-serif' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Helvetica',
|
||||
'bold' => $rootDir . '/lib/fonts/Helvetica-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Helvetica-Oblique',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Helvetica-BoldOblique',
|
||||
),
|
||||
'times' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Times-Roman',
|
||||
'bold' => $rootDir . '/lib/fonts/Times-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Times-Italic',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Times-BoldItalic',
|
||||
),
|
||||
'times-roman' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Times-Roman',
|
||||
'bold' => $rootDir . '/lib/fonts/Times-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Times-Italic',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Times-BoldItalic',
|
||||
),
|
||||
'courier' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Courier',
|
||||
'bold' => $rootDir . '/lib/fonts/Courier-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Courier-Oblique',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Courier-BoldOblique',
|
||||
),
|
||||
'helvetica' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Helvetica',
|
||||
'bold' => $rootDir . '/lib/fonts/Helvetica-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Helvetica-Oblique',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Helvetica-BoldOblique',
|
||||
),
|
||||
'zapfdingbats' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/ZapfDingbats',
|
||||
'bold' => $rootDir . '/lib/fonts/ZapfDingbats',
|
||||
'italic' => $rootDir . '/lib/fonts/ZapfDingbats',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/ZapfDingbats',
|
||||
),
|
||||
'symbol' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Symbol',
|
||||
'bold' => $rootDir . '/lib/fonts/Symbol',
|
||||
'italic' => $rootDir . '/lib/fonts/Symbol',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Symbol',
|
||||
),
|
||||
'serif' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Times-Roman',
|
||||
'bold' => $rootDir . '/lib/fonts/Times-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Times-Italic',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Times-BoldItalic',
|
||||
),
|
||||
'monospace' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Courier',
|
||||
'bold' => $rootDir . '/lib/fonts/Courier-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Courier-Oblique',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Courier-BoldOblique',
|
||||
),
|
||||
'fixed' => array(
|
||||
'normal' => $rootDir . '/lib/fonts/Courier',
|
||||
'bold' => $rootDir . '/lib/fonts/Courier-Bold',
|
||||
'italic' => $rootDir . '/lib/fonts/Courier-Oblique',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/Courier-BoldOblique',
|
||||
),
|
||||
'dejavu sans' => array(
|
||||
'bold' => $rootDir . '/lib/fonts/DejaVuSans-Bold',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/DejaVuSans-BoldOblique',
|
||||
'italic' => $rootDir . '/lib/fonts/DejaVuSans-Oblique',
|
||||
'normal' => $rootDir . '/lib/fonts/DejaVuSans',
|
||||
),
|
||||
'dejavu sans mono' => array(
|
||||
'bold' => $rootDir . '/lib/fonts/DejaVuSansMono-Bold',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/DejaVuSansMono-BoldOblique',
|
||||
'italic' => $rootDir . '/lib/fonts/DejaVuSansMono-Oblique',
|
||||
'normal' => $rootDir . '/lib/fonts/DejaVuSansMono',
|
||||
),
|
||||
'dejavu serif' => array(
|
||||
'bold' => $rootDir . '/lib/fonts/DejaVuSerif-Bold',
|
||||
'bold_italic' => $rootDir . '/lib/fonts/DejaVuSerif-BoldItalic',
|
||||
'italic' => $rootDir . '/lib/fonts/DejaVuSerif-Italic',
|
||||
'normal' => $rootDir . '/lib/fonts/DejaVuSerif',
|
||||
),
|
||||
'simhei' => array(
|
||||
'normal' => $fontDir . '/simhei',
|
||||
'bold' => $fontDir . '/simhei',
|
||||
'italic' => $fontDir . '/simhei',
|
||||
'bold_italic' => $fontDir . '/simhei',
|
||||
),
|
||||
) ?>
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user