mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into multi-payment-final
# Conflicts: # app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php # app/Classes/ValueObjects/Constants/TransactionType.php # routes/api.php # routes/web.php
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class AmountExceed implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('amount', '>', $value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class AmountShort implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('amount', '<', $value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class CreatedBefore implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('created_at', '<', Carbon::parse($value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class EmailLike implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('email', 'LIKE', '%'.$value.'%');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class PaymentMethod implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('payment_method', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Classes\General;
|
||||
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Helper
|
||||
{
|
||||
@@ -24,4 +24,21 @@ class Helper
|
||||
return array_slice(get_class_methods($className), 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $log
|
||||
* @return none
|
||||
*/
|
||||
static function debugLoggerForPerfexCRM($log){
|
||||
if($log){
|
||||
$message = $log['message'];
|
||||
$substring = 'No data were found';
|
||||
if (isset($message)) {
|
||||
if (strpos($message, $substring) !== false) {
|
||||
// Log::info('Message exist');
|
||||
} else {
|
||||
Log::info($log['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Modules\PerfexCRM\Processors\InitializePerfexCRMProcessor;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InitialPerfexCRMObject;
|
||||
|
||||
class InitializePerfexCRM implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var InitialPerfexCRMObject */
|
||||
private $initialPerfexCRMObject;
|
||||
|
||||
/**
|
||||
* InitializePerfexCRM constructor.
|
||||
* @param InitialPerfexCRMObject $initialPerfexCRMObject
|
||||
*/
|
||||
public function __construct(InitialPerfexCRMObject $initialPerfexCRMObject)
|
||||
{
|
||||
$this->initialPerfexCRMObject = $initialPerfexCRMObject;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
(App()->make(InitializePerfexCRMProcessor::class))->execute($this->initialPerfexCRMObject);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
|
||||
|
||||
class UpdatePerfexCRM implements ShouldQueue
|
||||
{
|
||||
@@ -17,17 +18,37 @@ class UpdatePerfexCRM implements ShouldQueue
|
||||
/** @var UpdatePerfexCRMObject */
|
||||
private $updatePerfexCRMObject;
|
||||
|
||||
/** @var UpdatePerfexCRMInvoice */
|
||||
private $nextJob;
|
||||
|
||||
/** @var */
|
||||
private $transaction;
|
||||
|
||||
/**
|
||||
* UpdatePerfexCRM constructor.
|
||||
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
|
||||
* @param UpdatePerfexCRMInvoice $nextJob
|
||||
* @param $transaction
|
||||
*/
|
||||
public function __construct(UpdatePerfexCRMObject $updatePerfexCRMObject)
|
||||
public function __construct(UpdatePerfexCRMObject $updatePerfexCRMObject, $transaction, $nextJob)
|
||||
{
|
||||
$this->updatePerfexCRMObject = $updatePerfexCRMObject;
|
||||
$this->nextJob = $nextJob;
|
||||
$this->transaction = $transaction;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
(App()->make(UpdatePerfexCRMProcessor::class))->execute($this->updatePerfexCRMObject);
|
||||
$result = (App()->make(UpdatePerfexCRMProcessor::class))->execute($this->updatePerfexCRMObject);
|
||||
if($this->nextJob != null && $this->transaction != null){
|
||||
$updatePerfexCRMInvoiceOject = new UpdatePerfexCRMInvoiceObject(
|
||||
$this->updatePerfexCRMObject->getContactEmail(),
|
||||
$result->projectId,
|
||||
$this->transaction,
|
||||
true
|
||||
);
|
||||
/** @var UpdatePerfexCRMInvoice $nextJob */
|
||||
$this->nextJob::dispatch($updatePerfexCRMInvoiceOject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\General\Helper;
|
||||
|
||||
class UpdatePerfexCRMInvoice implements ShouldQueue
|
||||
{
|
||||
@@ -47,10 +47,16 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
|
||||
$invoiceId = 0;
|
||||
$invoiceStatus = 0;
|
||||
$invoice = (App()->make(FetchesPerfexCRMInvoice::class))->execute($customer->userid,"INV-", $transaction->owner->bill_no);
|
||||
Log::error(json_encode('UpdatePerfexCRMInvoice debug $transaction->owner->bill_no: '.$transaction->owner->bill_no));
|
||||
|
||||
if(is_null($invoice)){
|
||||
$result = (App()->make(CreatePerfexCRMInvoiceProcessor::class))->execute($transaction->owner, $this->updatePerfexCRMInvoiceObject->getIsPaid());
|
||||
if ($result) {
|
||||
$invoiceId = $result->payload['id'];
|
||||
} else {
|
||||
// Log::error(json_encode('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed'));
|
||||
Helper::debugLoggerForPerfexCRM('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed');
|
||||
}
|
||||
}
|
||||
else{
|
||||
$invoiceId = $invoice->id;
|
||||
@@ -58,26 +64,9 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
|
||||
|
||||
//This only run when invoice already exist and the invoice does not have a PAID status
|
||||
if($invoiceStatus != PerfexCRMInvoiceStatus::PAID){
|
||||
//get project
|
||||
$projectId = "";
|
||||
$projectName = "";
|
||||
if($transaction->owner instanceof Transaction){
|
||||
$orderReference = $transaction->owner->owner->owner()->first()->reference;
|
||||
$packingListReference = $transaction->owner->owner->reference;
|
||||
$projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference;
|
||||
$project = (App()->make(FetchesPerfexCRMProject::class))->execute($projectName, $customer->userid);
|
||||
if(!is_null($project)){
|
||||
$projectId = $project->id;
|
||||
}
|
||||
}
|
||||
|
||||
if($projectId == ""){
|
||||
Log::error(json_encode('UpdatePerfexCRMInvoice debug: '.$projectName));
|
||||
Log::error(json_encode($transaction->owner));
|
||||
}
|
||||
|
||||
Log::error(json_encode('UpdatePerfexCRMInvoice debug $this->updatePerfexCRMInvoiceObject->getProjectId(): '.$this->updatePerfexCRMInvoiceObject->getProjectId()));
|
||||
//update invoice
|
||||
(App()->make(UpdatesPerfexCRMInvoice::class))->execute($invoice, $projectId);
|
||||
(App()->make(UpdatesPerfexCRMInvoice::class))->execute($invoice, $this->updatePerfexCRMInvoiceObject->getProjectId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
|
||||
use App\Models\PackingList;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
class UpdatePerfexCRMPrelude implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var */
|
||||
private $packingList;
|
||||
|
||||
/** @var */
|
||||
private $transaction;
|
||||
|
||||
/** @var UpdatePerfexCRMObject */
|
||||
private $updatePerfexCRMObject;
|
||||
|
||||
/** @var UpdatePerfexCRM */
|
||||
private $nextJob1;
|
||||
|
||||
/** @var UpdatePerfexCRMInvoice */
|
||||
private $nextJob2;
|
||||
|
||||
/**
|
||||
* UpdatePerfexCRMPrelude constructor.
|
||||
* @param $packingList
|
||||
* @param $transaction
|
||||
* @param UpdatePerfexCRMObject $updatePerfexCRMObject
|
||||
* @param UpdatePerfexCRM $nextJob1
|
||||
* @param UpdatePerfexCRMInvoice $nextJob2
|
||||
*/
|
||||
public function __construct($packingList, $transaction, UpdatePerfexCRMObject $updatePerfexCRMObject, $nextJob1, $nextJob2)
|
||||
{
|
||||
$this->packingList = $packingList;
|
||||
$this->transaction = $transaction;
|
||||
$this->updatePerfexCRMObject = $updatePerfexCRMObject;
|
||||
$this->nextJob1 = $nextJob1;
|
||||
$this->nextJob2 = $nextJob2;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
if(is_null($this->packingList)){
|
||||
$this->packingList = $this->transaction->owner->owner;
|
||||
}
|
||||
$amount = 0.00;
|
||||
if(!is_null($this->transaction)){
|
||||
$amount = $this->transaction->amount;
|
||||
}
|
||||
$data = [
|
||||
'amount' => number_format($amount, 2, '.', ''),
|
||||
'link_order' => config('app.url').'/order/show/'.$this->packingList->owner->reference,
|
||||
'link_autocount_or' => 'https://docs.google.com/spreadsheets/d/1Q3rJBGQ9Bo04HZp5WR9zbLp7pIW2kfDYsabxG7JON-4/edit#gid=2013983170',
|
||||
'link_perfex' => 'https://perfex.cief-malaysia.com/admin/projects/view/89',
|
||||
];
|
||||
|
||||
|
||||
$result = $this->replacePlaceholders($this->updatePerfexCRMObject->getTasks(), $data);
|
||||
$this->updatePerfexCRMObject->setTasks($result);
|
||||
/** @var UpdatePerfexCRM $nextJob1 */
|
||||
/** @var UpdatePerfexCRMInvoice $nextJob2 */
|
||||
$this->nextJob1::dispatch($this->updatePerfexCRMObject, $this->transaction, $this->nextJob2);
|
||||
}
|
||||
|
||||
function replacePlaceholders($template, $data, $prefix = '')
|
||||
{
|
||||
foreach ($template as $key => $value) {
|
||||
foreach ($data as $dataKey => $dataValue) {
|
||||
if (is_array($dataValue)) {
|
||||
$template[$key] = $this->replacePlaceholders($template[$key], $dataValue, $dataKey);
|
||||
} else {
|
||||
if ($prefix != '') {
|
||||
$template[$key] = str_replace('{' .$prefix. "." .$dataKey . '}', $dataValue, $template[$key]);
|
||||
} else {
|
||||
$template[$key] = str_replace('{' . $dataKey . '}', $dataValue, $template[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace App\Classes\Modules\Accounts\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesUser;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesUserFullName;
|
||||
use App\Classes\Modules\Accounts\Services\FetchesUser;
|
||||
use App\Classes\Modules\Accounts\Standards\Rules\CanUpdateUser;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
|
||||
@@ -29,8 +29,8 @@ class UpdateUserLogic extends AbstractControllerLogic
|
||||
/** @var CanUpdateUser */
|
||||
private $canUpdateUser;
|
||||
|
||||
/** @var UpdatesUser */
|
||||
private $updatesUser;
|
||||
/** @var UpdatesUserFullName */
|
||||
private $updatesUserFullName;
|
||||
|
||||
/** @var FetchesUser */
|
||||
private $fetchesUser;
|
||||
@@ -38,13 +38,13 @@ class UpdateUserLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* UpdateAddressLogic constructor.
|
||||
* @param CanUpdateUser $canUpdateUser
|
||||
* @param UpdatesUser $updatesUser
|
||||
* @param UpdatesUserFullName $updatesUserFullName
|
||||
* @param FetchesUser $fetchesUSer
|
||||
*/
|
||||
public function __construct(CanUpdateUser $canUpdateUser, UpdatesUser $updatesUser, FetchesUser $fetchesUser)
|
||||
public function __construct(CanUpdateUser $canUpdateUser, UpdatesUserFullName $updatesUserFullName, FetchesUser $fetchesUser)
|
||||
{
|
||||
$this->canUpdateUser = $canUpdateUser;
|
||||
$this->updatesUser = $updatesUser;
|
||||
$this->updatesUserFullName = $updatesUserFullName;
|
||||
$this->fetchesUser = $fetchesUser;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class UpdateUserLogic extends AbstractControllerLogic
|
||||
|
||||
$query = $this->fetchesUser->execute(['id' => $request->route('id')]);
|
||||
|
||||
$query = $this->updatesUser->execute($query, $object);
|
||||
$query = $this->updatesUserFullName->execute($query, $object);
|
||||
|
||||
return $this->resourceResponse(new UserResource($query));
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesUser;
|
||||
use App\Classes\Modules\Accounts\Services\FetchesUser;
|
||||
use App\Classes\Modules\Accounts\Standards\Rules\CanUpdateUser;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserObject;
|
||||
use App\Http\Resources\UserResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateUserRoleLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Admin Role',
|
||||
'message' => 'You have successfully updated the Admin Role'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateUser */
|
||||
private $canUpdateUser;
|
||||
|
||||
/** @var UpdatesUser */
|
||||
private $updatesUser;
|
||||
|
||||
/** @var FetchesUser */
|
||||
private $fetchesUser;
|
||||
|
||||
/**
|
||||
* UpdateAddressLogic constructor.
|
||||
* @param CanUpdateUser $canUpdateUser
|
||||
* @param UpdatesUser $updatesUser
|
||||
* @param FetchesUser $fetchesUSer
|
||||
*/
|
||||
public function __construct(CanUpdateUser $canUpdateUser, UpdatesUser $updatesUser, FetchesUser $fetchesUser)
|
||||
{
|
||||
$this->canUpdateUser = $canUpdateUser;
|
||||
$this->updatesUser = $updatesUser;
|
||||
$this->fetchesUser = $fetchesUser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$query = $this->fetchesUser->execute(['id' => $request->route('id')]);
|
||||
|
||||
$object = new UserObject($query->name, $request->input('type'));
|
||||
|
||||
$this->canUpdateUser->passes($object);
|
||||
|
||||
$query = $this->updatesUser->execute($query, $object);
|
||||
|
||||
return $this->resourceResponse(new UserResource($query));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class UserObject implements DataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var int */
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* FullNameObject constructor.
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct(string $name, int $type)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getType(): int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserObject;
|
||||
use App\Models\User;
|
||||
|
||||
class UpdatesUser extends AbstractUpdateRecord
|
||||
@@ -11,13 +11,14 @@ class UpdatesUser extends AbstractUpdateRecord
|
||||
|
||||
/**
|
||||
* @param User $model
|
||||
* @param FullNameObject $object
|
||||
* @param UserObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(User $model, FullNameObject $object) {
|
||||
public function execute(User $model, UserObject $object) {
|
||||
|
||||
$model->name = $object->getName();
|
||||
$model->type = $object->getType();
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\FullNameObject;
|
||||
use App\Models\User;
|
||||
|
||||
class UpdatesUserFullName extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param User $model
|
||||
* @param FullNameObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(User $model, FullNameObject $object) {
|
||||
|
||||
$model->name = $object->getName();
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ use App\Classes\Modules\Announcements\Services\FetchesAnnouncement;
|
||||
use App\Classes\Modules\Announcements\Services\UpdatesAnnouncement;
|
||||
|
||||
use App\Http\Resources\AnnouncementResource;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -66,8 +66,8 @@ class UpdateAnnouncementLogic extends AbstractControllerLogic
|
||||
$annoucement_object = new AnnouncementObject(
|
||||
$request->input('title'),
|
||||
$request->input('description'),
|
||||
$request->input('starting_on'),
|
||||
$request->input('ending_on')
|
||||
Carbon::createFromFormat('d-m-Y', $request->input('starting_on'))->format('Y-m-d H:i:s'),
|
||||
Carbon::createFromFormat('d-m-Y', $request->input('ending_on'))->format('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
$this->canUpdateAnnouncement->passes($annoucement_object);
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyTypeLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Company Type',
|
||||
'message' => 'You have successfully updated the Company Tyoe'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateCompany */
|
||||
private $canUpdateCompany;
|
||||
|
||||
/** @var UpdatesCompany */
|
||||
private $updatesCompany;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/**
|
||||
* UpdateCompanyControllersLogic constructor.
|
||||
* @param CanUpdateCompany $canUpdateCompany
|
||||
* @param UpdatesCompany $updatesCompany
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
*/
|
||||
public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompany $updatesCompany, FetchesCompany $fetchesCompany)
|
||||
{
|
||||
$this->canUpdateCompany = $canUpdateCompany;
|
||||
$this->updatesCompany = $updatesCompany;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
$object = new CompanyObject($query->name, $query->reference, $request->input('type'));
|
||||
|
||||
$this->canUpdateCompany->passes($object);
|
||||
|
||||
$query = $this->updatesCompany->execute($query, $object);
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($query));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Contacts\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Contacts\Services\UpdatesContact;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Services\FetchesContact;
|
||||
use App\Http\Resources\ContactResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateContactLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Contact',
|
||||
'message' => 'You have successfully updated the Contact'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var UpdatesContact */
|
||||
private $updatesContact;
|
||||
|
||||
/** @var FetchesContact */
|
||||
private $fetchesContact;
|
||||
|
||||
/**
|
||||
* UpdateContactLogic constructor.
|
||||
* @param UpdatesContact $updatesContact
|
||||
* @param FetchesContact $fetchesContact
|
||||
*/
|
||||
public function __construct(UpdatesContact $updatesContact, FetchesContact $fetchesContact)
|
||||
{
|
||||
$this->updatesContact = $updatesContact;
|
||||
$this->fetchesContact = $fetchesContact;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$object = new ContactObject(
|
||||
$request->input('reference'),
|
||||
$request->input('phone'),
|
||||
$request->input('email'),
|
||||
$request->input('wechat_id')
|
||||
);
|
||||
|
||||
// $this->canUpdateContact->passes($object);
|
||||
|
||||
$query = $this->fetchesContact->execute(['id' => $request->route('id')]);
|
||||
|
||||
$query = $this->updatesContact->execute($query, $object);
|
||||
|
||||
return $this->resourceResponse(new ContactResource($query));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Contacts\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\Contact;
|
||||
|
||||
class FetchesContact extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var Contact */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* FetchesContact constructor.
|
||||
* @param Contact $repository
|
||||
*/
|
||||
public function __construct(Contact $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Contacts\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Models\Contact;
|
||||
|
||||
class UpdatesContact extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Contact $model
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Contact $model, ContactObject $object)
|
||||
{
|
||||
$model->reference = $object->getReference();
|
||||
$model->phone = $object->getPhone();
|
||||
$model->email = $object->getEmail();
|
||||
$model->wechat_id = $object->getWechatId();
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,12 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
'ProjNo',
|
||||
'DeptNo',
|
||||
'Qty',
|
||||
'UnitPrice'
|
||||
'UnitPrice',
|
||||
// 'marking',
|
||||
// 'contact person',
|
||||
// 'contact number',
|
||||
// 'link',
|
||||
// 'amount'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -97,6 +102,10 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
$order = $transaction->owner->owner;
|
||||
$company = $order->companyModule->company;
|
||||
$shippingTransactionDetails = $transaction->transactionDetails()->where('reference', 'SHIPPING_FEE')->first();
|
||||
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
|
||||
$contact = $order->companyModule->company->contacts->first();
|
||||
$userName = $order->companyModule->employees()->first();
|
||||
$link = route('customer.payment-and-billing', $marking);
|
||||
|
||||
$furtherDescription = '';
|
||||
|
||||
@@ -123,7 +132,12 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
||||
$container->reference,
|
||||
'CIEF',
|
||||
$shippingTransactionDetails->quantity,
|
||||
$shippingTransactionDetails->price
|
||||
$shippingTransactionDetails->price,
|
||||
// $marking,
|
||||
// $contact ? $contact->phone : '',
|
||||
// $userName->name,
|
||||
// $link,
|
||||
// $transaction->amount
|
||||
];
|
||||
return [
|
||||
'<<New>>',
|
||||
|
||||
@@ -18,7 +18,8 @@ use Illuminate\Http\JsonResponse;
|
||||
class CreateOrderLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
protected function notification():array {
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Order',
|
||||
'message' => 'You have successfully created a new Order'
|
||||
@@ -62,18 +63,30 @@ class CreateOrderLogic extends AbstractControllerLogic
|
||||
}
|
||||
|
||||
|
||||
public function logic(Request $request) : JsonResponse {
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
|
||||
|
||||
$address = $this->fetchesAddress->execute(['id' => $request->input('address_id')]);
|
||||
|
||||
// todo-new: fix this
|
||||
// if select warehouse foshan
|
||||
if ($request->input('warehouse_id') === 'foshan') {
|
||||
// 13 - sabah, 14 - sarawak
|
||||
if (in_array($address->state->id, [13, 14])) {
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
|
||||
} else {
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
|
||||
}
|
||||
} else {
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
|
||||
|
||||
if (!in_array($company->companyModules()->importers()->first()->id, WarehouseReferences::YD_EXEMPT_LIST)) {
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU ? WarehouseReferences::YD_GUANG_ZHOU : WarehouseReferences::YD_YIWU]);
|
||||
}
|
||||
}
|
||||
|
||||
if($originWarehouse->reference === WarehouseReferences::YD_YIWU && in_array($address->state_id, [5, 13, 14])) {
|
||||
throw new RequestValidationException('Our Yiwu warehouse is unable to ship goods to Sabah & Sarawak at the moment. you can select our Guangzhou warehouse as an alternative.');
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanFetchOrder;
|
||||
use App\Http\Resources\OrderV2Resource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchOrderV2Logic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Order',
|
||||
'message' => 'You have successfully retrieved an order'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchOrder */
|
||||
private $canFetchOrder;
|
||||
|
||||
/** @var FetchesOrder */
|
||||
private $fetchesOrder;
|
||||
|
||||
/**
|
||||
* FetchOrderLogic constructor.
|
||||
* @param CanFetchOrder $canFetchOrder
|
||||
* @param FetchesOrder $fetchesOrder
|
||||
*/
|
||||
public function __construct(CanFetchOrder $canFetchOrder, FetchesOrder $fetchesOrder)
|
||||
{
|
||||
$this->canFetchOrder = $canFetchOrder;
|
||||
$this->fetchesOrder = $fetchesOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$this->canFetchOrder->passes();
|
||||
|
||||
$query = $this->fetchesOrder->execute(['reference' => $request->route('id'), 'with_packing_lists' => true]);
|
||||
|
||||
return $this->resourceResponse(new OrderV2Resource($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\ListsOrders;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Http\Resources\OrderV2Resource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListOrdersV2Logic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Orders',
|
||||
'message' => 'You have successfully retrieved a list of Orders'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanListOrders */
|
||||
private $canListOrders;
|
||||
|
||||
/** @var ListsOrders */
|
||||
private $listsOrders;
|
||||
|
||||
/**
|
||||
* ListOrdersLogic constructor.
|
||||
* @param CanListOrders $canListOrders
|
||||
* @param ListsOrders $listsOrders
|
||||
*/
|
||||
public function __construct(CanListOrders $canListOrders, ListsOrders $listsOrders)
|
||||
{
|
||||
$this->canListOrders = $canListOrders;
|
||||
$this->listsOrders = $listsOrders;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$this->canListOrders->passes();
|
||||
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]));
|
||||
|
||||
return $this->collectionResponse(OrderV2Resource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\DeletesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Services\Packages\FetchesPackage;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\CanDeletePackingList;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Models\PackingList;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeletePackingListByPackageIdLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Deleted PackingList',
|
||||
'message' => 'You have successfully deleted a PackingList'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var CanDeletePackingList */
|
||||
private $canDeletePackingList;
|
||||
|
||||
/** @var DeletesPackingList */
|
||||
private $deletesPackingList;
|
||||
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/** @var FetchesPackage */
|
||||
private $fetchesPackage;
|
||||
|
||||
/**
|
||||
* DeletePackingListByPackageIdLogic constructor.
|
||||
* @param CanDeletePackingList $canDeletePackingList
|
||||
* @param DeletesPackingList $deletesPackingList
|
||||
* @param FetchesPackingList $fetchesPackingList
|
||||
* @param FetchesPackage $fetchesPackage
|
||||
*/
|
||||
public function __construct(CanDeletePackingList $canDeletePackingList, DeletesPackingList $deletesPackingList, FetchesPackingList $fetchesPackingList, FetchesPackage $fetchesPackage)
|
||||
{
|
||||
$this->canDeletePackingList = $canDeletePackingList;
|
||||
$this->deletesPackingList = $deletesPackingList;
|
||||
$this->fetchesPackingList = $fetchesPackingList;
|
||||
$this->fetchesPackage = $fetchesPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$this->canDeletePackingList->passes();
|
||||
|
||||
$package = $this->fetchesPackage->execute(['id' => $request->route('id')]);
|
||||
|
||||
$packingList = $package->packingList;
|
||||
|
||||
$packingList = PackingList::where('reference', $packingList->reference)->get();
|
||||
|
||||
$childPackingList = PackingList::where('owner_type', PackingList::class)->whereIn('owner_id', $packingList->pluck('id'))->get();
|
||||
|
||||
$packingList->each->delete();
|
||||
|
||||
$childPackingList->each->delete();
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,7 +36,13 @@ class CreateTaskPerfexCRMObject implements DataTransferObject
|
||||
/** @var string */
|
||||
private $department;
|
||||
|
||||
public function __construct(string $email, string $name, string $description, string $leadId, string $projectId, string $milestoneId, string $reference, string $onTaskCompletion, string $status, string $department)
|
||||
/** @var string */
|
||||
private $priority;
|
||||
|
||||
/** @var string */
|
||||
private $duedate;
|
||||
|
||||
public function __construct(string $email, string $name, string $description, string $leadId, string $projectId, string $milestoneId, string $reference, string $onTaskCompletion, string $status, string $department, string $priority, string $duedate)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->name = $name;
|
||||
@@ -48,6 +54,8 @@ class CreateTaskPerfexCRMObject implements DataTransferObject
|
||||
$this->onTaskCompletion = $onTaskCompletion;
|
||||
$this->status = $status;
|
||||
$this->department = $department;
|
||||
$this->priority = $priority;
|
||||
$this->duedate = $duedate;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,4 +142,20 @@ class CreateTaskPerfexCRMObject implements DataTransferObject
|
||||
{
|
||||
return $this->department;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPriority(): string
|
||||
{
|
||||
return $this->priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDuedate(): string
|
||||
{
|
||||
return $this->duedate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,15 @@ class UpdatePerfexCRMInvoiceObject implements DataTransferObject
|
||||
/** @var bool */
|
||||
private $isPaid;
|
||||
|
||||
public function __construct(string $email, Transaction $transaction, bool $isPaid)
|
||||
/** @var string */
|
||||
private $projectId;
|
||||
|
||||
public function __construct(string $email, string $projectId, Transaction $transaction, bool $isPaid)
|
||||
{
|
||||
$this->email = $email;
|
||||
$this->transaction = $transaction;
|
||||
$this->isPaid = $isPaid;
|
||||
$this->projectId = $projectId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,6 +36,14 @@ class UpdatePerfexCRMInvoiceObject implements DataTransferObject
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectId(): string
|
||||
{
|
||||
return $this->projectId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Transaction
|
||||
*/
|
||||
|
||||
@@ -32,10 +32,10 @@ class UpdatePerfexCRMObject implements DataTransferObject
|
||||
private $milestoneNames;
|
||||
|
||||
/** @var array */
|
||||
private $taskNames;
|
||||
private $tasks;
|
||||
|
||||
|
||||
public function __construct(string $companyName, string $companyReference, string $contactName, string $contactEmail, string $bookingMarking, string $projectName, int $projectStatus, array $milestoneNames, array $taskNames)
|
||||
public function __construct(string $companyName, string $companyReference, string $contactName, string $contactEmail, string $bookingMarking, string $projectName, int $projectStatus, array $milestoneNames, array $tasks)
|
||||
{
|
||||
|
||||
$this->companyName = $companyName;
|
||||
@@ -46,7 +46,7 @@ class UpdatePerfexCRMObject implements DataTransferObject
|
||||
$this->projectName = $projectName;
|
||||
$this->projectStatus = $projectStatus;
|
||||
$this->milestoneNames = $milestoneNames;
|
||||
$this->taskNames = $taskNames;
|
||||
$this->tasks = $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,8 +116,13 @@ class UpdatePerfexCRMObject implements DataTransferObject
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTaskNames(): array
|
||||
public function getTasks(): array
|
||||
{
|
||||
return $this->taskNames;
|
||||
return $this->tasks;
|
||||
}
|
||||
|
||||
public function setTasks($tasks)
|
||||
{
|
||||
$this->tasks = $tasks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class CreatePerfexCRMInvoiceProcessor
|
||||
|
||||
$date = Carbon::parse($transaction->created_at)->format('Y-m-d');
|
||||
$dueDate = Carbon::parse($transaction->created_at)->addDays(6)->startOfDay()->format('Y-m-d');
|
||||
$currency = 1; //cief TODO: To look into Malaysia and Chinese currency
|
||||
$currency = 1;
|
||||
$subTotal = 0.00;
|
||||
$total = 0.00;
|
||||
|
||||
@@ -80,12 +80,17 @@ class CreatePerfexCRMInvoiceProcessor
|
||||
->where('status', '=', \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED)
|
||||
->where('type', '=', \App\Classes\ValueObjects\Constants\AddressType::BILLING)->first();
|
||||
|
||||
if ($addresses !== null) {
|
||||
$billingStreet = $billingStreet.$addresses->street_one;
|
||||
$billingStreet = $billingStreet.$addresses->street_two.',';
|
||||
$billingStreet = $billingStreet.$addresses->district()->first()->name.',';
|
||||
$billingStreet = $billingStreet.$addresses->postcode;
|
||||
$billingStreet = $billingStreet.$addresses->state()->first()->name.',';
|
||||
$billingStreet = $billingStreet.$addresses->country()->first()->name;
|
||||
}
|
||||
else{
|
||||
$billingStreet = "[Pending Billing Details by user]";
|
||||
}
|
||||
|
||||
$allowedPaymentModes = [];
|
||||
$invoiceItems = [];
|
||||
@@ -106,9 +111,10 @@ class CreatePerfexCRMInvoiceProcessor
|
||||
$orderReference = $transaction->owner->owner->reference;
|
||||
$packingListReference = $transaction->owner->reference;
|
||||
$projectName = 'IZYIM | X1 Shipping | '.$orderReference.' | '.$packingListReference;
|
||||
$project = $this->fetchesPerfexCRMProject->execute($projectName, $clientId);
|
||||
if(!is_null($project)){
|
||||
$projectId = $project->id;
|
||||
$result = $this->fetchesPerfexCRMProject->execute($projectName, $clientId);
|
||||
if(isset($result->payload)){
|
||||
$project = $result->payload[0];
|
||||
$projectId = $project['id'];
|
||||
}
|
||||
else{
|
||||
$result = $this->createsPerfexCRMCustomerProject->execute($projectName, PerfexCRMProjectStatus::NOT_STARTED, $clientId);
|
||||
|
||||
@@ -35,6 +35,8 @@ class CreatePerfexCRMTaskProcessor
|
||||
$createTaskPerfexCRMObject->getOnTaskCompletion(),
|
||||
$createTaskPerfexCRMObject->getDepartment(),
|
||||
$createTaskPerfexCRMObject->getStatus(),
|
||||
$createTaskPerfexCRMObject->getPriority(),
|
||||
$createTaskPerfexCRMObject->getDuedate()
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PerfexCRM\Processors;
|
||||
|
||||
use App\Classes\Modules\PerfexCRM\Services\ConvertsPerfexCRMLeadToCustomer;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerProject;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMMilestone;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMTask;
|
||||
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMProject;
|
||||
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMMilestone;
|
||||
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMTask;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomer;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerContact;
|
||||
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMCustomer;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\InitialPerfexCRMObject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMMilestones;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMTaskStatus;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class InitializePerfexCRMProcessor
|
||||
{
|
||||
/** @var ConvertsPerfexCRMLeadToCustomer */
|
||||
private $convertsPerfexCRMLeadToCustomer;
|
||||
|
||||
/** @var CreatesPerfexCRMCustomerProject */
|
||||
private $createsPerfexCRMCustomerProject;
|
||||
|
||||
/** @var CreatesPerfexCRMMilestone */
|
||||
private $createsPerfexCRMMilestone;
|
||||
|
||||
/** @var CreatesPerfexCRMTask */
|
||||
private $createsPerfexCRMTask;
|
||||
|
||||
/** @var FetchesPerfexCRMProject */
|
||||
private $fetchesPerfexCRMProject;
|
||||
|
||||
/** @var FetchesPerfexCRMMilestone */
|
||||
private $fetchesPerfexCRMMilestone;
|
||||
|
||||
/** @var FetchesPerfexCRMTask */
|
||||
private $fetchesPerfexCRMTask;
|
||||
|
||||
/** @var CreatesPerfexCRMCustomer */
|
||||
private $createsPerfexCRMCustomer;
|
||||
|
||||
/** @var CreatesPerfexCRMCustomerContact */
|
||||
private $createsPerfexCRMCustomerContact;
|
||||
|
||||
/** @var UpdatesPerfexCRM */
|
||||
private $updatePerfexCRM;
|
||||
|
||||
/** @var UpdatesPerfexCRMCustomer */
|
||||
private $updatesPerfexCRMCustomer;
|
||||
|
||||
/**
|
||||
* @param ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer
|
||||
* @param CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject
|
||||
* @param CreatesPerfexCRMMilestone $createsPerfexCRMMilestone
|
||||
* @param CreatesPerfexCRMTask $createsPerfexCRMTask
|
||||
* @param FetchesPerfexCRMProject $fetchesPerfexCRMProject
|
||||
* @param FetchesPerfexCRMMilestone $fetchesPerfexCRMMilestone
|
||||
* @param FetchesPerfexCRMTask $fetchesPerfexCRMTask
|
||||
* @param CreatesPerfexCRMCustomer $createsPerfexCRMCustomer
|
||||
* @param CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact
|
||||
* @param UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer
|
||||
*/
|
||||
public function __construct(ConvertsPerfexCRMLeadToCustomer $convertsPerfexCRMLeadToCustomer,
|
||||
CreatesPerfexCRMCustomerProject $createsPerfexCRMCustomerProject,
|
||||
CreatesPerfexCRMMilestone $createsPerfexCRMMilestone,
|
||||
CreatesPerfexCRMTask $createsPerfexCRMTask,
|
||||
FetchesPerfexCRMProject $fetchesPerfexCRMProject,
|
||||
FetchesPerfexCRMMilestone $fetchesPerfexCRMMilestone,
|
||||
FetchesPerfexCRMTask $fetchesPerfexCRMTask,
|
||||
CreatesPerfexCRMCustomer $createsPerfexCRMCustomer,
|
||||
CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact,
|
||||
UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer)
|
||||
{
|
||||
$this->convertsPerfexCRMLeadToCustomer = $convertsPerfexCRMLeadToCustomer;
|
||||
$this->createsPerfexCRMCustomerProject = $createsPerfexCRMCustomerProject;
|
||||
$this->createsPerfexCRMMilestone = $createsPerfexCRMMilestone;
|
||||
$this->createsPerfexCRMTask = $createsPerfexCRMTask;
|
||||
$this->fetchesPerfexCRMProject = $fetchesPerfexCRMProject;
|
||||
$this->fetchesPerfexCRMMilestone = $fetchesPerfexCRMMilestone;
|
||||
$this->fetchesPerfexCRMTask = $fetchesPerfexCRMTask;
|
||||
$this->createsPerfexCRMCustomer = $createsPerfexCRMCustomer;
|
||||
$this->createsPerfexCRMCustomerContact = $createsPerfexCRMCustomerContact;
|
||||
$this->updatesPerfexCRMCustomer = $updatesPerfexCRMCustomer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param InitialPerfexCRMObject $initialPerfexCRMObject
|
||||
* @return null|object
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(InitialPerfexCRMObject $initialPerfexCRMObject) {
|
||||
|
||||
// Customer has to exist first before Project can appear under it
|
||||
// Check with Perfex CRM, if this user (email) was previously a lead, should automatically now become a customer
|
||||
$crmCompany = $initialPerfexCRMObject->getCompanyName();
|
||||
$result = $this->convertsPerfexCRMLeadToCustomer->execute($initialPerfexCRMObject->getContactEmail());
|
||||
if(isset($result->payload)){
|
||||
$crmClientId = $result->payload['client_id'];
|
||||
if (isset($result->payload['company'])) {
|
||||
$crmCompany = $result->payload['company'];
|
||||
}
|
||||
}
|
||||
else{
|
||||
//if reach this point, this means this user is not a official customer nor is a lead in crm
|
||||
//Create Customer has 2 parts: Create Company (client), Create Contact
|
||||
$result = $this->createsPerfexCRMCustomer->execute($crmCompany);
|
||||
if(is_null($result)){
|
||||
$crmCompany = $crmCompany." 2";
|
||||
$result = $this->createsPerfexCRMCustomer->execute($crmCompany);
|
||||
}
|
||||
|
||||
$crmClientId = $result->payload['clientId'];
|
||||
|
||||
$customerContactObject = new CustomerContactObject(
|
||||
$crmClientId,
|
||||
$initialPerfexCRMObject->getContactName(),
|
||||
$initialPerfexCRMObject->getContactName(),
|
||||
$initialPerfexCRMObject->getContactEmail(),
|
||||
"pU^T@sC#9Q",
|
||||
"on",
|
||||
"on"
|
||||
);
|
||||
$result = $this->createsPerfexCRMCustomerContact->execute($customerContactObject);
|
||||
}
|
||||
|
||||
//Update custom fields to identify company reference from exchange or shipping portal
|
||||
$value_exists = false;
|
||||
if (isset($result->payload['customfields'])) {
|
||||
foreach ($result->payload['customfields'] as $element) {
|
||||
if ($element['value'] === $initialPerfexCRMObject->getCompanyReference()) {
|
||||
$value_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$value_exists);
|
||||
{
|
||||
$result = $this->updatesPerfexCRMCustomer->execute($crmClientId, $crmCompany, $initialPerfexCRMObject->getCompanyReference());
|
||||
}
|
||||
|
||||
// Get existing or create project, project has to exist first before milestone can appear under it
|
||||
$result = $this->createsPerfexCRMCustomerProject->execute($initialPerfexCRMObject->getProjectName(), $initialPerfexCRMObject->getProjectStatus(), $crmClientId);
|
||||
if(isset($result->payload)){ //Here means project creation successful
|
||||
$projectId = $result->payload['project_id'];
|
||||
}
|
||||
else{
|
||||
$projectId = $this->fetchesPerfexCRMProject->execute($initialPerfexCRMObject->getProjectName(), $crmClientId)->id;
|
||||
}
|
||||
|
||||
$tasks = $initialPerfexCRMObject->getTaskNames();
|
||||
if(count($tasks) > 0){
|
||||
|
||||
//Create tasks with milestone
|
||||
for($count=0; $count < count($tasks); $count++) {
|
||||
$milestoneId = 0; //By default milestoneId is 0, having this set at individual task is optional
|
||||
if($tasks[$count]['milestone'] != "") //Create milestone only if it is defined
|
||||
{
|
||||
// Get existing or create milestone, milestone has to exist first before task can appear under it
|
||||
$result = $this->createsPerfexCRMMilestone->execute($tasks[$count]['milestone'], $projectId, $count);
|
||||
if(isset($result->payload)){
|
||||
$milestoneId = $result->payload['milestone_id'];
|
||||
}
|
||||
else{
|
||||
$milestone = $this->fetchesPerfexCRMMilestone->execute($tasks[$count]['milestone'], $projectId);
|
||||
$array = json_decode(json_encode($milestone), true);
|
||||
$milestoneId = $array[0]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
$taskStatus = PerfexCRMTaskStatus::NOT_STARTED;
|
||||
if($tasks[$count]['status'] != ''){
|
||||
$taskStatus = $tasks[$count]['status'];
|
||||
}
|
||||
|
||||
// Get existing or create task
|
||||
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'],$tasks[$count]['department'], $taskStatus);
|
||||
if(is_null($result)){
|
||||
break; //Breaking the rest of the tasks in array assuming that they are all created as a batch previously
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\PerfexCRM\Processors;
|
||||
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CreateTaskPerfexCRMObject;
|
||||
use App\Classes\Jobs\CreatePerfexCRMSingleTask;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMTaskPriority;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
|
||||
use App\Models\Company;
|
||||
|
||||
@@ -30,7 +31,9 @@ class NewLeadTaskToPerfexCRMProcessor
|
||||
"",
|
||||
"",
|
||||
PerfexCRMTasks::TASK_IDENTIFICATION_1['status'],
|
||||
PerfexCRMTasks::TASK_IDENTIFICATION_1['department']
|
||||
PerfexCRMTasks::TASK_IDENTIFICATION_1['department'],
|
||||
PerfexCRMTaskPriority::DEFAULT,
|
||||
"0"
|
||||
);
|
||||
|
||||
CreatePerfexCRMSingleTask::dispatch($createTaskPerfexCRMObject);
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Processors;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
|
||||
use App\Classes\Jobs\UpdatePerfexCRM;
|
||||
use App\Classes\Jobs\UpdatePerfexCRMPrelude;
|
||||
use App\Models\PackingList;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -20,7 +21,6 @@ class PackingListToPerfexCRMProcessor
|
||||
{
|
||||
try {
|
||||
if($packingList->owner instanceof \App\Models\Order) {
|
||||
Log::error(json_encode($packingList));
|
||||
$order = $packingList->owner;
|
||||
$companyModule = $order->companyModule()->first();
|
||||
$connection = $companyModule->inviters()->withPivot('invitee_reference')->first();
|
||||
@@ -48,7 +48,7 @@ class PackingListToPerfexCRMProcessor
|
||||
PerfexCRMTasks::TASK_LOADED_CONTAINER_2,
|
||||
]
|
||||
);
|
||||
UpdatePerfexCRM::dispatch($updatePerfexCRMObject);
|
||||
UpdatePerfexCRMPrelude::dispatch($packingList, null, $updatePerfexCRMObject, UpdatePerfexCRM::class, null);
|
||||
}
|
||||
} catch (\Exception $exception){
|
||||
Log::error(json_encode('PackingListToPerfexCRMProcessor debug:'));
|
||||
|
||||
@@ -2,47 +2,19 @@
|
||||
|
||||
namespace App\Classes\Modules\PerfexCRM\Processors;
|
||||
|
||||
use App\Classes\Modules\PerfexCRM\Processors\UpdatePerfexCRMProcessor;
|
||||
use App\Classes\Modules\PerfexCRM\Processors\InitializePerfexCRMProcessor;
|
||||
use App\Classes\Modules\PerfexCRM\Services\Init;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMObject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\UpdatePerfexCRMInvoiceObject;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMMilestones;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMTasks;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMProjectStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Jobs\UpdatePerfexCRMInvoice;
|
||||
use App\Classes\Jobs\UpdatePerfexCRM;
|
||||
use App\Classes\Jobs\UpdatePerfexCRMPrelude;
|
||||
use App\Classes\Jobs\CreatePerfexCRMInvoice;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class TransactionToPerfexCRMProcessor
|
||||
{
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var UpdatePerfexCRMProcessor */
|
||||
private $updatePerfexCRMProcessor;
|
||||
|
||||
/** @var InitializePerfexCRMProcessor */
|
||||
private $initializePerfexCRMProcessor;
|
||||
|
||||
/**
|
||||
* TransactionToPerfexCRMProcessor constructor.
|
||||
* @param UpdatePerfexCRMProcessor $updatePerfexCRMProcessor
|
||||
* @param InitializePerfexCRMProcessor $initializePerfexCRMProcessor
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
*/
|
||||
public function __construct(UpdatePerfexCRMProcessor $updatePerfexCRMProcessor, InitializePerfexCRMProcessor $initializePerfexCRMProcessor, FetchesCompany $fetchesCompany)
|
||||
{
|
||||
$this->updatePerfexCRMProcessor = $updatePerfexCRMProcessor;
|
||||
$this->initializePerfexCRMProcessor = $initializePerfexCRMProcessor;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Transaction $model
|
||||
* @param int $status
|
||||
@@ -50,6 +22,8 @@ class TransactionToPerfexCRMProcessor
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Transaction $model, int $status)
|
||||
{
|
||||
try
|
||||
{
|
||||
if($model->owner instanceof \App\Models\Transaction && $status == ApprovalStatus::APPROVED)
|
||||
{
|
||||
@@ -85,16 +59,17 @@ class TransactionToPerfexCRMProcessor
|
||||
]
|
||||
);
|
||||
|
||||
UpdatePerfexCRM::dispatch($updatePerfexCRMObject);
|
||||
|
||||
$updatePerfexCRMInvoiceOject = new UpdatePerfexCRMInvoiceObject(
|
||||
$contactEmail,
|
||||
$model,
|
||||
true
|
||||
);
|
||||
UpdatePerfexCRMInvoice::dispatch($updatePerfexCRMInvoiceOject)->delay(6);
|
||||
UpdatePerfexCRMPrelude::dispatch(null, $model, $updatePerfexCRMObject, UpdatePerfexCRM::class, UpdatePerfexCRMInvoice::class);
|
||||
}
|
||||
else if($model->owner instanceof \App\Models\PackingList && $model->status == ApprovalStatus::PENDING_SUBMISSION && $status == ApprovalStatus::APPROVED)
|
||||
{
|
||||
CreatePerfexCRMInvoice::dispatch($model);
|
||||
}
|
||||
}
|
||||
catch (\Exception $exception) {
|
||||
Log::error('TransactionToPerfexCRMProcessor debug:');
|
||||
Log::error($exception);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMMilestone;
|
||||
use App\Classes\Modules\PerfexCRM\Services\FetchesPerfexCRMTask;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomer;
|
||||
use App\Classes\Modules\PerfexCRM\Services\CreatesPerfexCRMCustomerContact;
|
||||
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMTask;
|
||||
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMCustomer;
|
||||
use App\Classes\Modules\PerfexCRM\Services\UpdatesPerfexCRMProject;
|
||||
use App\Classes\Modules\PerfexCRM\DataTransferObjects\CustomerContactObject;
|
||||
@@ -51,8 +52,8 @@ class UpdatePerfexCRMProcessor
|
||||
/** @var CreatesPerfexCRMCustomerContact */
|
||||
private $createsPerfexCRMCustomerContact;
|
||||
|
||||
/** @var UpdatesPerfexCRM */
|
||||
private $updatePerfexCRM;
|
||||
/** @var UpdatesPerfexCRMTask */
|
||||
private $updatesPerfexCRMTask;
|
||||
|
||||
/** @var UpdatesPerfexCRMCustomer */
|
||||
private $updatesPerfexCRMCustomer;
|
||||
@@ -70,6 +71,7 @@ class UpdatePerfexCRMProcessor
|
||||
* @param FetchesPerfexCRMTask $fetchesPerfexCRMTask
|
||||
* @param CreatesPerfexCRMCustomer $createsPerfexCRMCustomer
|
||||
* @param CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact
|
||||
* @param UpdatesPerfexCRMTask $updatesPerfexCRMTask
|
||||
* @param UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer
|
||||
* @param UpdatesPerfexCRMProject $updatesPerfexCRMProject
|
||||
*/
|
||||
@@ -82,6 +84,7 @@ class UpdatePerfexCRMProcessor
|
||||
FetchesPerfexCRMTask $fetchesPerfexCRMTask,
|
||||
CreatesPerfexCRMCustomer $createsPerfexCRMCustomer,
|
||||
CreatesPerfexCRMCustomerContact $createsPerfexCRMCustomerContact,
|
||||
UpdatesPerfexCRMTask $updatesPerfexCRMTask,
|
||||
UpdatesPerfexCRMCustomer $updatesPerfexCRMCustomer,
|
||||
UpdatesPerfexCRMProject $updatesPerfexCRMProject)
|
||||
{
|
||||
@@ -94,6 +97,7 @@ class UpdatePerfexCRMProcessor
|
||||
$this->fetchesPerfexCRMTask = $fetchesPerfexCRMTask;
|
||||
$this->createsPerfexCRMCustomer = $createsPerfexCRMCustomer;
|
||||
$this->createsPerfexCRMCustomerContact = $createsPerfexCRMCustomerContact;
|
||||
$this->updatesPerfexCRMTask = $updatesPerfexCRMTask;
|
||||
$this->updatesPerfexCRMCustomer = $updatesPerfexCRMCustomer;
|
||||
$this->updatesPerfexCRMProject = $updatesPerfexCRMProject;
|
||||
}
|
||||
@@ -104,6 +108,7 @@ class UpdatePerfexCRMProcessor
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(UpdatePerfexCRMObject $updatePerfexCRMObject) {
|
||||
$projectId = "";
|
||||
|
||||
// Customer has to exist first before Project can appear under it
|
||||
// Check with Perfex CRM, if this user (email) was previously a lead, should automatically now become a customer
|
||||
@@ -154,21 +159,27 @@ class UpdatePerfexCRMProcessor
|
||||
}
|
||||
|
||||
// Get existing or create project, project has to exist first before milestone can appear under it
|
||||
$result = $this->createsPerfexCRMCustomerProject->execute($updatePerfexCRMObject->getProjectName(), $updatePerfexCRMObject->getProjectStatus(), $crmClientId);
|
||||
if(isset($result->payload)){ //Here means project creation successful
|
||||
$projectId = $result->payload['project_id'];
|
||||
}
|
||||
else{
|
||||
$project = $this->fetchesPerfexCRMProject->execute($updatePerfexCRMObject->getProjectName(), $crmClientId);
|
||||
$projectId = $project->id;
|
||||
$result = $this->fetchesPerfexCRMProject->execute($updatePerfexCRMObject->getProjectName(), $crmClientId);
|
||||
|
||||
if(isset($result->payload)){
|
||||
$project = $result->payload[0];
|
||||
$projectId = $project['id'];
|
||||
|
||||
//if the project status is anything but PerfexCRMProjectStatus::NOT_STARTED, update the project
|
||||
if($updatePerfexCRMObject->getProjectStatus() != PerfexCRMProjectStatus::NOT_STARTED)
|
||||
if($updatePerfexCRMObject->getProjectStatus() != PerfexCRMProjectStatus::NOT_STARTED && $project['status'] == PerfexCRMProjectStatus::NOT_STARTED)
|
||||
{
|
||||
$this->updatesPerfexCRMProject->execute($project, $updatePerfexCRMObject->getProjectStatus());
|
||||
}
|
||||
}
|
||||
else{
|
||||
$result = $this->createsPerfexCRMCustomerProject->execute($updatePerfexCRMObject->getProjectName(), $updatePerfexCRMObject->getProjectStatus(), $crmClientId);
|
||||
if(isset($result->payload)){ //Here means project creation successful
|
||||
$projectId = $result->payload['project_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$tasks = $updatePerfexCRMObject->getTaskNames();
|
||||
|
||||
$tasks = $updatePerfexCRMObject->getTasks();
|
||||
if(count($tasks) > 0){
|
||||
|
||||
//Create tasks with milestone
|
||||
@@ -177,14 +188,16 @@ class UpdatePerfexCRMProcessor
|
||||
if($tasks[$count]['milestone'] != "") //Create milestone only if it is defined
|
||||
{
|
||||
// Get existing or create milestone, milestone has to exist first before task can appear under it
|
||||
$result = $this->fetchesPerfexCRMMilestone->execute($tasks[$count]['milestone'], $projectId);
|
||||
if(isset($result->payload)){
|
||||
$array = json_decode(json_encode($result->payload[0]), true);
|
||||
$milestoneId = $array['id'];
|
||||
}
|
||||
else{
|
||||
$result = $this->createsPerfexCRMMilestone->execute($tasks[$count]['milestone'], $projectId, $count);
|
||||
if(isset($result->payload)){
|
||||
$milestoneId = $result->payload['milestone_id'];
|
||||
}
|
||||
else{
|
||||
$milestone = $this->fetchesPerfexCRMMilestone->execute($tasks[$count]['milestone'], $projectId);
|
||||
$array = json_decode(json_encode($milestone), true);
|
||||
$milestoneId = $array[0]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,13 +207,25 @@ class UpdatePerfexCRMProcessor
|
||||
}
|
||||
|
||||
// Get existing or create task
|
||||
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'], $tasks[$count]['department'], $taskStatus);
|
||||
if(is_null($result)){
|
||||
$result = $this->fetchesPerfexCRMTask->execute($tasks[$count]['name'], $milestoneId, 'project', $projectId);
|
||||
if(isset($result->payload)){
|
||||
break; //Breaking the rest of the tasks in array assuming that they are all created as a batch previously
|
||||
//The following are code not needed at Shipping Portal, Exchange need certain task's status to be updated dynamically
|
||||
// if($taskStatus != PerfexCRMTaskStatus::NOT_STARTED && $result->payload[0]['status'] == PerfexCRMTaskStatus::NOT_STARTED)
|
||||
// {
|
||||
// $task = $result->payload[0];
|
||||
// $result = $this->updatesPerfexCRMTask->execute($task['id'], $task['name'], $task['milestone'], $task['rel_id'], $taskStatus, $task['startdate'], is_null($task['duedate']) ? '': $task['duedate']);
|
||||
// }
|
||||
}
|
||||
else{
|
||||
$result = $this->createsPerfexCRMTask->execute($tasks[$count]['name'], $tasks[$count]['description'], '', $milestoneId, $projectId, $tasks[$count]['reference'], $tasks[$count]['on_task_completion'], $tasks[$count]['department'], $taskStatus, $tasks[$count]['priority'], $tasks[$count]['duedate']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
$payload = [];
|
||||
$payload['projectId'] = $projectId;
|
||||
return (object) $payload;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,13 +15,16 @@ class CreatesPerfexCRMTask
|
||||
* @param string $leadId
|
||||
* @param string $milestoneId
|
||||
* @param string $projectId
|
||||
* @param string $reference, default: ''
|
||||
* @param string $on_task_completion, default: ''
|
||||
* @param string $status, default: 1
|
||||
* @param string $reference
|
||||
* @param string $on_task_completion
|
||||
* @param string $department
|
||||
* @param string $status
|
||||
* @param string $priority
|
||||
* @param string $duedate
|
||||
* @return null|object
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(string $taskName, string $taskDescription, string $leadId, string $milestoneId, string $projectId, string $reference = '', string $on_task_completion = '', string $department = '', string $status = "1") {
|
||||
public function execute(string $taskName, string $taskDescription, string $leadId, string $milestoneId, string $projectId, string $reference, string $on_task_completion, string $department, string $status, string $priority, string $duedate) {
|
||||
try{
|
||||
$custom_fields = [];
|
||||
if($department != ""){
|
||||
@@ -43,7 +46,9 @@ class CreatesPerfexCRMTask
|
||||
'is_system_created' => 1,
|
||||
'reference' => $reference,
|
||||
'on_task_completion' => $on_task_completion,
|
||||
'custom_fields' => $custom_fields
|
||||
'custom_fields' => $custom_fields,
|
||||
'priority' => $priority,
|
||||
'duedate' => date('Y-m-d', strtotime('+' . $duedate . ' days')),
|
||||
];
|
||||
|
||||
if($leadId != '') {
|
||||
@@ -58,7 +63,9 @@ class CreatesPerfexCRMTask
|
||||
'is_system_created' => 1,
|
||||
'reference' => $reference,
|
||||
'on_task_completion' => $on_task_completion,
|
||||
'custom_fields' => $custom_fields
|
||||
'custom_fields' => $custom_fields,
|
||||
'priority' => $priority,
|
||||
'duedate' => date('Y-m-d', strtotime('+' . $duedate . ' days')),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,14 @@ class FetchesPerfexCRMMilestone
|
||||
*/
|
||||
public function execute(string $milestoneName, string $projectId) {
|
||||
try{
|
||||
$response = Http::withHeaders([
|
||||
'authtoken' => config('perfexcrm.api_key'),])
|
||||
->get(config('perfexcrm.base_url').'/api/milestones/bynameandprojectid/'.rawurlencode($milestoneName).'/'.$projectId);
|
||||
$data = [
|
||||
'name' => $milestoneName,
|
||||
'project_id' => $projectId,
|
||||
];
|
||||
|
||||
$response = Http::asForm()->withHeaders([
|
||||
'authtoken' => config('perfexcrm.api_key')])
|
||||
->post(config('perfexcrm.base_url').'/api/milestones/bynameandprojectid', $data);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
|
||||
@@ -5,27 +5,41 @@ namespace App\Classes\Modules\PerfexCRM\Services;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\General\Helper;
|
||||
|
||||
class FetchesPerfexCRMTask
|
||||
{
|
||||
/**
|
||||
* @param string $taskName
|
||||
* @param string $milestoneId
|
||||
* @param string $relType
|
||||
* @param string $relId
|
||||
* @return null|object
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(string $taskName, string $milestoneId) {
|
||||
public function execute(string $taskName, string $milestoneId, string $relType, string $relId) {
|
||||
try{
|
||||
$response = Http::withHeaders([
|
||||
'authtoken' => config('perfexcrm.api_key'),])
|
||||
->get(config('perfexcrm.base_url').'/api/tasks/bynameandmilestoneid/'.rawurlencode($taskName).'/'.$milestoneId);
|
||||
$data = [
|
||||
'name' => $taskName,
|
||||
'rel_type' => $relType,
|
||||
'rel_id' => $relId,
|
||||
];
|
||||
|
||||
if($milestoneId != '') {
|
||||
$newItem = ['milestone' => $milestoneId ];
|
||||
$data = array_merge($data, $newItem);
|
||||
}
|
||||
|
||||
$response = Http::asForm()->withHeaders([
|
||||
'authtoken' => config('perfexcrm.api_key')])
|
||||
->post(config('perfexcrm.base_url').'/api/tasks/customsearch', $data);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
|
||||
return (object) $data;
|
||||
}else{
|
||||
Log::error($response);
|
||||
Helper::debugLoggerForPerfexCRM($response);
|
||||
return null;
|
||||
}
|
||||
}catch(\Exception $exception){
|
||||
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields;
|
||||
use App\Classes\General\Helper;
|
||||
|
||||
class UpdatesPerfexCRMCustomer
|
||||
{
|
||||
@@ -37,7 +38,7 @@ class UpdatesPerfexCRMCustomer
|
||||
$data = $response->json();
|
||||
return (object) $data;
|
||||
}else{
|
||||
Log::error($response);
|
||||
Helper::debugLoggerForPerfexCRM($response);
|
||||
return null;
|
||||
}
|
||||
}catch(\Exception $exception){
|
||||
|
||||
@@ -17,17 +17,17 @@ class UpdatesPerfexCRMProject
|
||||
public function execute($project, int $status) {
|
||||
try{
|
||||
$data = [
|
||||
'name' => $project->name,
|
||||
'clientid' => $project->clientid,
|
||||
'name' => $project['name'],
|
||||
'clientid' => $project['clientid'],
|
||||
// 'rel_type' => 'customer',
|
||||
'billing_type' => 1,
|
||||
'start_date' => $project->start_date,
|
||||
'start_date' => $project['start_date'],
|
||||
'status' => $status
|
||||
];
|
||||
|
||||
$response = Http::asJson()->withHeaders([
|
||||
'authtoken' => config('perfexcrm.api_key')])
|
||||
->put(config('perfexcrm.base_url').'/api/projects/'.$project->id, $data);
|
||||
->put(config('perfexcrm.base_url').'/api/projects/'.$project['id'], $data);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Delete Transaction',
|
||||
'message' => 'You have successfully deleted the transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
|
||||
/**
|
||||
* SuspendTransactionLogic constructor.
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
}
|
||||
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
|
||||
|
||||
$transaction->delete();
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
-5
@@ -75,11 +75,6 @@ class ApproveShippingInvoiceTransactionProcessor
|
||||
$user->notify(new InvoiceIssuedEmail($user, $packingList));
|
||||
}
|
||||
|
||||
// update perfex crm
|
||||
if(config('perfexcrm.is_enabled') == 'true'){
|
||||
CreatePerfexCRMInvoice::dispatch($invoice_transaction);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,25 +5,19 @@ namespace App\Classes\Modules\Transactions\Services;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\Transaction;
|
||||
use App\Classes\Modules\PerfexCRM\Processors\TransactionToPerfexCRMProcessor;
|
||||
use App\Classes\Modules\PerfexCRM\Processors\NewLeadTaskToPerfexCRMProcessor;
|
||||
|
||||
class UpdatesTransactionStatus extends AbstractUpdateRecord
|
||||
{
|
||||
/** @var TransactionToPerfexCRMProcessor */
|
||||
private $transactionToPerfexCRMProcessor;
|
||||
|
||||
/** @var NewLeadTaskToPerfexCRMProcessor */
|
||||
private $newLeadTaskToPerfexCRMProcessor;
|
||||
|
||||
/**
|
||||
* UpdatesTransactionStatus constructor.
|
||||
* @param TransactionToPerfexCRMProcessor $transactionToPerfexCRMProcessor
|
||||
* @param NewLeadTaskToPerfexCRMProcessor $newLeadTaskToPerfexCRMProcessor
|
||||
*/
|
||||
public function __construct(TransactionToPerfexCRMProcessor $transactionToPerfexCRMProcessor, NewLeadTaskToPerfexCRMProcessor $newLeadTaskToPerfexCRMProcessor)
|
||||
public function __construct(TransactionToPerfexCRMProcessor $transactionToPerfexCRMProcessor)
|
||||
{
|
||||
$this->transactionToPerfexCRMProcessor = $transactionToPerfexCRMProcessor;
|
||||
$this->newLeadTaskToPerfexCRMProcessor = $newLeadTaskToPerfexCRMProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -34,11 +28,13 @@ class UpdatesTransactionStatus extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(Transaction $model, int $status)
|
||||
{
|
||||
if(config('perfexcrm.is_enabled') == 'true'){
|
||||
$this->transactionToPerfexCRMProcessor->execute($model, $status);
|
||||
// $this->newLeadTaskToPerfexCRMProcessor->execute();
|
||||
}
|
||||
$transaction = clone($model);
|
||||
$model->status = $status;
|
||||
return $this->handler($model);
|
||||
$result = $this->handler($model);
|
||||
|
||||
if(config('perfexcrm.is_enabled') == 'true'){
|
||||
$this->transactionToPerfexCRMProcessor->execute($transaction, $status);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,9 @@ final class CompanyType {
|
||||
|
||||
public const COMPANY_BUSINESS = 1;
|
||||
|
||||
public const COMPANY_TYPE_ID = [
|
||||
self::PERSONAL_BUSINESS => "Personal Business",
|
||||
self::COMPANY_BUSINESS => "Company Business",
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class PerfexCRMTaskPriority {
|
||||
|
||||
public const DEFAULT = 0;
|
||||
|
||||
public const LOW = 1;
|
||||
|
||||
public const MEDIUM = 2;
|
||||
|
||||
public const HIGH = 3;
|
||||
|
||||
public const URGENT = 4;
|
||||
|
||||
}
|
||||
@@ -14,7 +14,9 @@ class PerfexCRMTasks
|
||||
'reference' => '',
|
||||
'on_task_completion' => '',
|
||||
'department' => '',
|
||||
'status' => PerfexCRMTaskStatus::COMPLETED
|
||||
'status' => PerfexCRMTaskStatus::COMPLETED,
|
||||
'priority' => PerfexCRMTaskPriority::DEFAULT,
|
||||
'duedate' => 0
|
||||
];
|
||||
|
||||
public const TASK_POST_PAYMENT_1 = [
|
||||
@@ -31,23 +33,21 @@ class PerfexCRMTasks
|
||||
'reference' => 'TASK_POST_PAYMENT_1',
|
||||
'on_task_completion' => 'TASK_POST_PAYMENT_2',
|
||||
'department' => 'Accounts',
|
||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS,
|
||||
'priority' => PerfexCRMTaskPriority::HIGH,
|
||||
'duedate' => 0
|
||||
];
|
||||
public const TASK_POST_PAYMENT_2 = [
|
||||
'name' => 'Approve Payment',
|
||||
'description' => '○ Purpose: To verify and approve the customer\'s payment on IZYIM<br>
|
||||
○ Initial Status: Not Started<br>
|
||||
○ Deadline:Same day<br>
|
||||
○ Responsible department: Accounts<br>
|
||||
○ Next step: Change the status of the Issue Shipping Autocount Invoice operation to "In Progress"<br>
|
||||
○ Additional details: When the payment method is FPX or Wallet this task is performed automatically by the system.<br>
|
||||
○ Dependencies: Map Transaction operation must be completed before this operation can begin.<br>
|
||||
○ Outcomes: The payment will be approved in IZYIM, which will release the customer’s goods for delivery.<br>',
|
||||
○ Amount To be Approve: RM {amount}<br>',
|
||||
'milestone' => '',
|
||||
'reference' => 'TASK_POST_PAYMENT_2',
|
||||
'on_task_completion' => 'TASK_POST_PAYMENT_3',
|
||||
'department' => 'Accounts',
|
||||
'status' => ''
|
||||
'status' => '',
|
||||
'priority' => PerfexCRMTaskPriority::HIGH,
|
||||
'duedate' => 0
|
||||
];
|
||||
public const TASK_POST_PAYMENT_3 = [
|
||||
'name' => 'Issue Shipping Autocount Invoince',
|
||||
@@ -63,7 +63,22 @@ class PerfexCRMTasks
|
||||
'reference' => 'TASK_POST_PAYMENT_3',
|
||||
'on_task_completion' => 'TASK_POST_PAYMENT_4',
|
||||
'department' => 'Accounts',
|
||||
'status' => ''
|
||||
'status' => '',
|
||||
'priority' => PerfexCRMTaskPriority::MEDIUM,
|
||||
'duedate' => 1
|
||||
];
|
||||
public const TASK_POST_PAYMENT_3_1 = [
|
||||
'name' => 'Issue Shipping Autocount OR',
|
||||
'description' => '○ Purpose: To issue an invoice for the customer\'s payment in accounting software.<br>
|
||||
○ Note: Customer Actually Upload Bank Slip or Not, If not, Invoice Will Not be Exported<br>
|
||||
○ {link_autocount_or}<br>',
|
||||
'milestone' => '',
|
||||
'reference' => 'TASK_POST_PAYMENT_3_1',
|
||||
'on_task_completion' => 'TASK_POST_PAYMENT_4',
|
||||
'department' => 'Accounts',
|
||||
'status' => '',
|
||||
'priority' => PerfexCRMTaskPriority::DEFAULT,
|
||||
'duedate' => 0
|
||||
];
|
||||
public const TASK_POST_PAYMENT_4 = [
|
||||
'name' => 'Knockoff Invoice',
|
||||
@@ -79,36 +94,35 @@ class PerfexCRMTasks
|
||||
'reference' => 'TASK_POST_PAYMENT_4',
|
||||
'on_task_completion' => '',
|
||||
'department' => 'Accounts',
|
||||
'status' => ''
|
||||
'status' => '',
|
||||
'priority' => PerfexCRMTaskPriority::MEDIUM,
|
||||
'duedate' => 1
|
||||
];
|
||||
|
||||
public const TASK_LOADED_CONTAINER_1 = [
|
||||
'name' => 'Generate Shipping Invoices',
|
||||
'description' => '○ Purpose: -<br>
|
||||
○ Initial Status: In Progress<br>
|
||||
○ Deadline: Next day<br>
|
||||
○ Responsible department: Operation<br>
|
||||
○ Assignee: -<br>
|
||||
○ Next step: Approve Shipping Invoice change to in progress.<br>',
|
||||
○ Link to order page: {link_order}<br>',
|
||||
'milestone' => '',
|
||||
'reference' => 'TASK_LOADED_CONTAINER_1',
|
||||
'on_task_completion' => 'TASK_LOADED_CONTAINER_2',
|
||||
'department' => 'Operations',
|
||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS,
|
||||
'priority' => PerfexCRMTaskPriority::HIGH,
|
||||
'duedate' => 1
|
||||
];
|
||||
|
||||
public const TASK_LOADED_CONTAINER_2 = [
|
||||
'name' => 'Approve Shipping Invoices',
|
||||
'description' => '○ Purpose: -<br>
|
||||
○ Initial Status: Not Starteds<br>
|
||||
○ Deadline: Next day<br>
|
||||
○ Responsible department: Customer Services<br>
|
||||
○ Next step: -<br>',
|
||||
○ Link to refer Pay On Behalf or Any extra charge: : {link_perfex}<br>',
|
||||
'milestone' => '',
|
||||
'reference' => 'TASK_LOADED_CONTAINER_2',
|
||||
'on_task_completion' => '',
|
||||
'department' => 'Customer Services',
|
||||
'status' => ''
|
||||
'status' => '',
|
||||
'priority' => PerfexCRMTaskPriority::HIGH,
|
||||
'duedate' => 1
|
||||
];
|
||||
|
||||
|
||||
@@ -126,6 +140,8 @@ class PerfexCRMTasks
|
||||
'reference' => 'TASK_IDENTIFICATION_1',
|
||||
'on_task_completion' => '',
|
||||
'department' => 'Operations',
|
||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS
|
||||
'status' => PerfexCRMTaskStatus::IN_PROGRESS,
|
||||
'priority' => PerfexCRMTaskPriority::DEFAULT,
|
||||
'duedate' => 0
|
||||
];
|
||||
}
|
||||
|
||||
@@ -16,4 +16,10 @@ final class RoleTypes
|
||||
|
||||
public const USER = 3;
|
||||
|
||||
public const USER_TYPE_ID = [
|
||||
self::SHADOW_ADMIN => "Shadow Admin",
|
||||
self::SUPER_ADMIN => "Super Admin",
|
||||
self::ADMIN => "Admin",
|
||||
self::USER => "User",
|
||||
];
|
||||
}
|
||||
@@ -35,4 +35,10 @@ final class TransactionType {
|
||||
// public const SHIPPING_COST = 14;
|
||||
|
||||
public const GROUP_PAYMENT = 15;
|
||||
|
||||
public const TRANSACTION_TYPE_ID = [
|
||||
self::SHIPPING_INVOICE => "Shipping Invoice",
|
||||
self::PAYMENT => "Payment",
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ final class WarehouseReferences {
|
||||
|
||||
public const VT_SARAWAK = 'SRW-V01';
|
||||
|
||||
public const YD_FS_WEST_MALAYSIA = 'FS-V01';
|
||||
|
||||
public const YD_FS_EAST_MALAYSIA = 'FS-V02';
|
||||
|
||||
public const VT_DESTINATION_WAREHOUSE = [
|
||||
1 => self::VT_KLANG,
|
||||
2 => self::VT_KLANG,
|
||||
|
||||
@@ -24,7 +24,7 @@ class AuditBillplzInvoice extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Check all unpaid invoice but marked at paid at out system';
|
||||
protected $description = 'Check all unpaid invoice but marked paid at our system';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class BillplzFailedCallbackPayment extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'billplz-failed-callback';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Check all failled callback from billplz';
|
||||
|
||||
protected $output = null;
|
||||
|
||||
protected $outputArray = [];
|
||||
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->appendToOutput(Carbon::now() . ' : Billplz Failled Callback cron started.');
|
||||
$this->outputArray = [];
|
||||
$start = new Carbon();
|
||||
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereIn('status', [ApprovalStatus::REJECTED, ApprovalStatus::PENDING_VERIFICATION])->get();
|
||||
$totalTransactions = count($transactions);
|
||||
$counter = 1;
|
||||
$totalAmount = 0;
|
||||
foreach ($transactions as $transaction){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
if($data['paid']){
|
||||
$totalAmount += $transaction->amount;
|
||||
$this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status]);
|
||||
} else {
|
||||
// $totalAmount += $transaction->amount;
|
||||
// $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
|
||||
}
|
||||
}else{
|
||||
$this->appendToOutput("billplz error</br>");
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
$this->appendToOutput(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
|
||||
|
||||
$this->output = json_encode($this->outputArray);
|
||||
}
|
||||
|
||||
public function appendToOutput($string) {
|
||||
$this->outputArray[] = $string;
|
||||
$this->info($string);
|
||||
}
|
||||
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class CheckDeletedInvoiceButPaid extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'check-deleted-paid-invoice';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Check all deleted invoice but has completed payment';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->info(Carbon::now() . ' : Start Check all deleted invoice but has completed payment.');
|
||||
$start = new Carbon();
|
||||
|
||||
$totalAmount = 0;
|
||||
|
||||
$softDeletedTransactions = Transaction::onlyTrashed()->where('type', TransactionType::SHIPPING_INVOICE)->whereHas('transactions', function (Builder $query) {
|
||||
$query->where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY);
|
||||
})->get();
|
||||
|
||||
foreach ($softDeletedTransactions as $invoice) {
|
||||
$invoice_payments = $invoice->transactions()->payments()->get();
|
||||
|
||||
foreach($invoice_payments as $invoice_payment) {
|
||||
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$invoice_payment->payment_reference);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
|
||||
$orderReference = $invoice->owner->owner->reference ?? null;
|
||||
|
||||
if($data['paid']){
|
||||
$this->info('Invoice id: ' . $invoice->id. '. Payment id: ' . $invoice_payment->id . '. Order: ' . $orderReference);
|
||||
} else {
|
||||
|
||||
}
|
||||
}else{
|
||||
$this->info("billplz error</br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
$this->info(Carbon::now() . ' : Done Check all deleted invoice but has completed payment. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
|
||||
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class FixBillplzFailedCallbackPayment extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'billplz-failed-callback:fix';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Fix all failled callback from billplz';
|
||||
|
||||
protected $output = null;
|
||||
|
||||
protected $outputArray = [];
|
||||
|
||||
/** @var GetBillplzBill */
|
||||
private $getBillplzBill;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var UpdateDoFromVTPortalProcessor */
|
||||
private $updateDoFromVTPortalProcessor;
|
||||
|
||||
/** @var UpdateDoFromYDPortalProcessor */
|
||||
private $updateDoFromYDPortalProcessor ;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->info(Carbon::now() . ' : Fix failled callback from billplz cron started.');
|
||||
$this->outputArray = [];
|
||||
$start = new Carbon();
|
||||
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
$totalTransactions = count($transactions);
|
||||
$counter = 1;
|
||||
$totalAmount = 0;
|
||||
foreach ($transactions as $transaction){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
if($data['paid']){
|
||||
$totalAmount += $transaction->amount;
|
||||
$invoiceStatus = null;
|
||||
|
||||
switch($transaction->owner->status) {
|
||||
case 3:
|
||||
$invoiceStatus = 'Payment Completed';
|
||||
break;
|
||||
case 5:
|
||||
$invoiceStatus = 'Dispute in progress';
|
||||
break;
|
||||
case 6:
|
||||
$invoiceStatus = 'Cancelled Invoice';
|
||||
break;
|
||||
default:
|
||||
$invoiceStatus = 'Pending Payment';
|
||||
}
|
||||
|
||||
$order = $transaction->owner->owner->owner;
|
||||
|
||||
if (in_array($invoiceStatus , ['Pending Payment', 'Payment Completed'])) {
|
||||
// code here
|
||||
|
||||
// $billPlz = $this->getBillplzBill->execute($billplzXSignatureObject->getBillPlzId());
|
||||
|
||||
// if(!$billPlz) throw new ResourceNotFoundException('Billplz bill not found.');
|
||||
|
||||
// $transaction = $this->fetchesTransaction->execute(['payment_reference' => $billplzXSignatureObject->getBillPlzId()]);
|
||||
|
||||
$invoice = $transaction->owner;
|
||||
$packingList = $invoice->owner;
|
||||
$order = $packingList->owner;
|
||||
|
||||
$status = ApprovalStatus::PENDING_VERIFICATION;
|
||||
|
||||
if($data['state'] === 'paid') {
|
||||
$status = ApprovalStatus::APPROVED;
|
||||
}
|
||||
|
||||
// if($data->state === 'due') {
|
||||
// $status = $billplzXSignatureObject->getStatus() === 'failed' ? ApprovalStatus::REJECTED : ApprovalStatus::PENDING_VERIFICATION;
|
||||
// }
|
||||
|
||||
// $token = Auth::fromUser(User::find(1));
|
||||
// $request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status);
|
||||
|
||||
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
if(($invoice->amount - $totalPaidAmount) < 0.01) {
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
if(app()->environment('production')){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
}
|
||||
|
||||
$this->info('Updated invoice ' . $counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
|
||||
} else {
|
||||
$this->info('Failed to update invoice due to unsufficeint payment ' . $counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if(!$order instanceof Order) {
|
||||
$this->info("Error transaction id:" . $transaction->id . 'Type: ' . get_class($order));
|
||||
} else {
|
||||
$this->info($counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// $totalAmount += $transaction->amount;
|
||||
// $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
|
||||
}
|
||||
}else{
|
||||
$this->info("billplz error</br>");
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
$this->info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ShowBillplzPaymentStatus extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'billplz-payment-status {billplz_id}` ';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Show Billplz payment status';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->info(Carbon::now() . ' : Show Billplz payment status started.');
|
||||
$start = new Carbon();
|
||||
|
||||
$billplz_id = $this->argument('billplz_id');
|
||||
$billplz_id = explode(",", $billplz_id);
|
||||
|
||||
foreach ($billplz_id as $payment) {
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$payment);
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
dump($data);
|
||||
}else{
|
||||
$this->info("billplz error</br>");
|
||||
}
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
$this->info(Carbon::now() . ' : Done Showing Billplz payment status. ElapsedTime: ' . $elapsedTime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
|
||||
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ShowFixBillplzFailedCallbackPayment extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'billplz-failed-callback:show';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Check all failled callback from billplz';
|
||||
|
||||
protected $output = null;
|
||||
|
||||
protected $outputArray = [];
|
||||
|
||||
/** @var GetBillplzBill */
|
||||
private $getBillplzBill;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var UpdateDoFromVTPortalProcessor */
|
||||
private $updateDoFromVTPortalProcessor;
|
||||
|
||||
/** @var UpdateDoFromYDPortalProcessor */
|
||||
private $updateDoFromYDPortalProcessor ;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->info(Carbon::now() . ' : Billplz Failled Callback cron started.');
|
||||
$this->outputArray = [];
|
||||
$start = new Carbon();
|
||||
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
$totalTransactions = count($transactions);
|
||||
$counter = 1;
|
||||
$totalAmount = 0;
|
||||
foreach ($transactions as $transaction){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
if($data['paid']){
|
||||
$totalAmount += $transaction->amount;
|
||||
$invoiceStatus = null;
|
||||
|
||||
switch($transaction->owner->status) {
|
||||
case 3:
|
||||
$invoiceStatus = 'Payment Completed';
|
||||
break;
|
||||
case 5:
|
||||
$invoiceStatus = 'Dispute in progress';
|
||||
break;
|
||||
case 6:
|
||||
$invoiceStatus = 'Cancelled Invoice';
|
||||
break;
|
||||
default:
|
||||
$invoiceStatus = 'Pending Payment';
|
||||
}
|
||||
|
||||
$order = $transaction->owner->owner->owner;
|
||||
|
||||
if(!$order instanceof Order) {
|
||||
$this->info("Error transaction id:" . $transaction->id . 'Type: ' . get_class($order));
|
||||
} else {
|
||||
$this->info($counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
|
||||
}
|
||||
|
||||
} else {
|
||||
// $totalAmount += $transaction->amount;
|
||||
// $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
|
||||
}
|
||||
}else{
|
||||
$this->info("billplz error</br>");
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
$this->info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
|
||||
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class SuccessUpdatePaymentStatusButFailedCallback extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'fix-invoice-status';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Success Updated Payment Status But Inoie stat';
|
||||
|
||||
protected $output = null;
|
||||
|
||||
protected $outputArray = [];
|
||||
|
||||
/** @var GetBillplzBill */
|
||||
private $getBillplzBill;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var UpdateDoFromVTPortalProcessor */
|
||||
private $updateDoFromVTPortalProcessor;
|
||||
|
||||
/** @var UpdateDoFromYDPortalProcessor */
|
||||
private $updateDoFromYDPortalProcessor ;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$this->info(Carbon::now() . ' : Billplz Failled Callback cron started.');
|
||||
$this->outputArray = [];
|
||||
$start = new Carbon();
|
||||
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
$transactions = Transaction::where('type', TransactionType::PAYMENT)
|
||||
->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->get();
|
||||
|
||||
foreach ($transactions as $payment) {
|
||||
$invoice = $payment->owner ?? null;
|
||||
if (!$invoice) {
|
||||
$this->info('Payment has no owner. Payment ID: ' . $payment->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
$packingList = $invoice->owner ?? null;
|
||||
if (!$packingList) {
|
||||
$this->info('Invoice has no owner. Invoice ID: ' . $invoice->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
$order = $packingList->owner;
|
||||
if (!$invoice) {
|
||||
$this->info('PackingList has no owner. PackingList ID: ' . $packingList->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($invoice->status == ApprovalStatus::APPROVED) {
|
||||
|
||||
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
if(($invoice->amount - $totalPaidAmount) < 0.01) {
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
if(app()->environment('production')){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
}
|
||||
|
||||
dump('Updated invoice ' . $invoice->id . '. Order: '. $order->reference);
|
||||
} else {
|
||||
$this->info('Failed Update invoice ' . $invoice->id . ' because payment not enough. Invoice Amount: ' . $invoice->amount . ' . Paid Amount: ' . $totalPaidAmount . ' . Order: '. $order->reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
$this->info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime );
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class debugBillplzFailedPayment extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'billplz-failed-payment:debug';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::COMPLETED, ApprovalStatus::APPROVED])->get();
|
||||
|
||||
$i = 0;
|
||||
$totalAmount = 0;
|
||||
foreach ($transactions as $transaction){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
|
||||
|
||||
// dd($response);
|
||||
|
||||
// dd($transaction->owner->owner->owner->reference);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
if($data['paid']){
|
||||
if (!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
$this->returnLog('Paid transaction', $transaction);
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// $totalAmount += $transaction->amount;
|
||||
// $this->returnLog('Unpaid Transaction', $transaction);
|
||||
// }
|
||||
}else{
|
||||
$this->returnLog('billplz error', $transaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function returnLog($text, $transaction) {
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
$this->info($text . ' - id: '. $transaction->id . '. Order Marking: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Current Status: ' . $approvalStatusArray[$transaction->status]);
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,11 @@ class Kernel extends ConsoleKernel
|
||||
->hourly()
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log');
|
||||
|
||||
$schedule->command('billplz-failed-callback:fix')
|
||||
->dailyAt('00:00')
|
||||
->withoutOverlapping()
|
||||
->appendOutputTo (storage_path().'/logs/dix_failed_callback_from_billplz.log');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Accounts;
|
||||
|
||||
use App\Classes\Modules\Accounts\ControllersLogic\UpdateUserRoleLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateUserRoleController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateUserLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateUserRoleLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\UpdateCompanyTypeLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyTypeController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param AddNewMemberLogic $execute
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, UpdateCompanyTypeLogic $execute) : JsonResponse
|
||||
{
|
||||
return $execute->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Contacts;
|
||||
|
||||
use App\Classes\Modules\Contacts\ControllersLogic\UpdateContactLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateContactController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateCompanyLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateContactLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class DownloadOrderQrPdfController
|
||||
$warehousePrefix = 'YW/';
|
||||
}
|
||||
|
||||
if(in_array($warehouse->reference,[WarehouseReferences::YD_GUANG_ZHOU, WarehouseReferences::YD_GUANG_ZHOU_2])){
|
||||
if(in_array($warehouse->reference,[WarehouseReferences::YD_GUANG_ZHOU, WarehouseReferences::YD_GUANG_ZHOU_2, WarehouseReferences::YD_FS_EAST_MALAYSIA, WarehouseReferences::YD_FS_WEST_MALAYSIA])){
|
||||
$warehousePrefix = 'YD/';
|
||||
|
||||
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan' || in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
use App\Classes\Modules\Orders\ControllersLogic\FetchOrderV2Logic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchOrderV2Controller
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchOrderLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchOrderV2Logic $logic): JsonResponse
|
||||
{
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Orders\ControllersLogic\ListOrdersV2Logic;
|
||||
|
||||
|
||||
class ListOrdersV2Controller
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListOrdersV2Logic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
||||
public function list(Request $request, ListOrdersV2Logic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists;
|
||||
|
||||
use App\Classes\Modules\PackingLists\ControllersLogic\DeletePackingListByPackageIdLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeletePackingListByPackageIdController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeletePackingListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request, DeletePackingListByPackageIdLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\DeleteTransactionLogic;
|
||||
|
||||
|
||||
class DeleteTransactionController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteTransactionLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request, DeleteTransactionLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -44,6 +44,11 @@ class Kernel extends HttpKernel
|
||||
'throttle:300,1',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'apipub' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -63,6 +68,7 @@ class Kernel extends HttpKernel
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'valid.token' => ValidateToken::class
|
||||
'valid.token' => ValidateToken::class,
|
||||
'token.check' => \App\Http\Middleware\TokenCheckerMiddleware::class,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\PersonalAccessTokens;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TokenCheckerMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
//Method 1: Token pass via query parameter
|
||||
// Check if the api_key query parameter is present
|
||||
if (!$request->query('api-key')) {
|
||||
return response()->json(['message' => 'Invalid API key.'], 401);
|
||||
}
|
||||
|
||||
// Check if the api_key is valid
|
||||
$apiKey = $request->query('api-key');
|
||||
$personalAccessToken = PersonalAccessTokens::where('token', $apiKey)->first();
|
||||
|
||||
if (!$personalAccessToken) {
|
||||
return response()->json(['error' => 'Unauthorized'], 401);
|
||||
}
|
||||
return $next($request);
|
||||
|
||||
//Method 2: Token pass via request header
|
||||
/*
|
||||
$authHeader = $request->header('Authorization');
|
||||
if (preg_match('/Bearer\s+(.*)$/i', $authHeader, $matches)) {
|
||||
$token = $matches[1];
|
||||
// validate the token here
|
||||
|
||||
$personalAccessToken = PersonalAccessToken::where('token', $token)->first();
|
||||
|
||||
if (!$personalAccessToken) {
|
||||
return response()->json(['error' => 'Unauthorized'], 401);
|
||||
}
|
||||
|
||||
|
||||
// if the token is valid, you can attach it to the request
|
||||
$request->attributes->add(['bearerToken' => $token]);
|
||||
return $next($request);
|
||||
}
|
||||
return response()->json(['error' => 'Unauthorized'], 401);
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,8 @@ class AnnouncementResource extends JsonResource
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'segments' => $this->segments,
|
||||
'starting_on' => Carbon::parse($this->starting_on)->format('Y-m-d'),
|
||||
'ending_on' => Carbon::parse($this->ending_on)->format('Y-m-d'),
|
||||
'starting_on' => Carbon::parse($this->starting_on)->format('d-m-Y'),
|
||||
'ending_on' => Carbon::parse($this->ending_on)->format('d-m-Y'),
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ class CompanyModuleResource extends JsonResource
|
||||
'marking' => $marking,
|
||||
'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null,
|
||||
'connections' => $this->connections,
|
||||
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
@@ -19,6 +20,8 @@ class CompanyResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
$companyModule = $this->companyModules()->first();
|
||||
$companyTypeArray = CompanyType::COMPANY_TYPE_ID;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'hash_id' => Crypt::encryptString($this->id),
|
||||
@@ -26,6 +29,7 @@ class CompanyResource extends JsonResource
|
||||
'debtor' => $this->debtor,
|
||||
'reference' => $this->reference,
|
||||
'type' => (int) $this->type,
|
||||
'type_name' => ($companyTypeArray[(int) $this->type]),
|
||||
'business_type' => (int) $this->business_type,
|
||||
'status' => (int) $this->status,
|
||||
'segments' => SegmentResource::collection($companyModule->connections()->first()->segments),
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\TransportType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class OrderV2Resource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
'reference_contract' => (int) $this->type,
|
||||
'type' => (int) $this->type,
|
||||
'status' => (int) $this->status,
|
||||
'company_module' => new CompanyModuleResource($this->companyModule),
|
||||
'warehouse' => new CompanyModuleResource($this->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee),
|
||||
'address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->first()),
|
||||
'address_change_request' => new AddressResource($this->addressesPendingVerification()->first()),
|
||||
'invoices' => $this->whenLoaded('packingLists', function() {
|
||||
return TransactionResource::collection($this->transactions()->whereNotIn('transactions.status', [0, 1])->get());
|
||||
}),
|
||||
'remarks' => RemarkResource::collection($this->remarks),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class UserResource extends JsonResource
|
||||
@@ -14,11 +15,13 @@ class UserResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$userTypeArray = RoleTypes::USER_TYPE_ID;
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'type' => (int) $this->type,
|
||||
'type_name' => ($userTypeArray[(int) $this->type]),
|
||||
'status' => (int) $this->status
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class PersonalAccessTokens extends AbstractModel
|
||||
{
|
||||
protected $table = 'personal_access_tokens';
|
||||
|
||||
}
|
||||
@@ -43,6 +43,11 @@ class RouteServiceProvider extends ServiceProvider
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::prefix('public/api')
|
||||
->middleware('apipub')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/apipub.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePersonalAccessTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
// $table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Addresses\Processors\CreateAddressFromOldAddressProcessor;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompany;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\WarehouseReferences;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\OldCompany;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
class FoshanWarehouseTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/** @var UpdatesCompanyStatus*/
|
||||
private $updatesCompanyStatus;
|
||||
|
||||
/** @var CreateCompanyModuleProcessor */
|
||||
private $createCompanyModuleProcessor;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreatesCompanyConnection */
|
||||
private $createsCompanyConnection;
|
||||
|
||||
/** @var ApprovesCompanyConnection */
|
||||
private $approvesCompanyConnection;
|
||||
|
||||
/** @var CreateAddressFromOldAddressProcessor */
|
||||
private $createAddressFromOldAddressProcessor;
|
||||
|
||||
/** @var CreatesAddress */
|
||||
private $createsAddress;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreatesContact */
|
||||
private $createsContact;
|
||||
|
||||
/**
|
||||
* ModernWarehouseTableSeeder constructor.
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreatesCompanyConnection $createsCompanyConnection
|
||||
* @param ApprovesCompanyConnection $approvesCompanyConnection
|
||||
* @param CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor
|
||||
* @param CreatesAddress $createsAddress
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param CreatesContact $createsContact
|
||||
*/
|
||||
public function __construct(CreateCompanyProcessor $createCompanyProcessor, UpdatesCompanyStatus $updatesCompanyStatus, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, CreatesAddress $createsAddress, FetchesCompany $fetchesCompany, CreatesContact $createsContact)
|
||||
{
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->approvesCompanyConnection = $approvesCompanyConnection;
|
||||
$this->createAddressFromOldAddressProcessor = $createAddressFromOldAddressProcessor;
|
||||
$this->createsAddress = $createsAddress;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createsContact = $createsContact;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
/** @var Company $company */
|
||||
$company = $this->fetchesCompany->execute(['reference' => 'MODERN']);
|
||||
|
||||
// YD_FS_WEST_MALAYSIA - FS-V01
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
$companyModule->update(['name' => 'Foshan', 'reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
|
||||
|
||||
$address = new AddressObject('广东省 佛山市 南海区 狮山镇北园东路6号D幢1楼', '', 2, 35, 638, 528225, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$contact = new ContactObject('郑佳鹏', '18520607573', '', '');
|
||||
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
$this->createsContact->execute($companyModule, $contact);
|
||||
|
||||
// FS_EAST_MALAYSIA - FS-V02
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
$companyModule->update(['name' => 'Foshan', 'reference' => WarehouseReferences::YD_FS_EAST_MALAYSIA]);
|
||||
|
||||
$address = new AddressObject('广东省 佛山市 南海区 狮山镇北园东路6号C幢1楼', '', 2, 35, 638, 528225, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$contact = new ContactObject('游万彬', '18520607573', '', '');
|
||||
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
$this->createsContact->execute($companyModule, $contact);
|
||||
}
|
||||
}
|
||||
@@ -23,5 +23,9 @@ server {
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_keep_conn on;
|
||||
fastcgi_param PHP_VALUE "auto_prepend_file= \n allow_url_include=Off \n output_buffering=Off \n output_buffering=4096";
|
||||
proxy_send_timeout 3600;
|
||||
proxy_read_timeout 3600;
|
||||
fastcgi_send_timeout 3600;
|
||||
fastcgi_read_timeout 3600;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
+76
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<div class="row m-b-10 parentContainer">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="no-margin fs-12 text-black">{{item.street_one}} {{item.street_two}}, {{item.district.name}}, {{item.post_code}} {{item.state.name}}, {{item.country.name}}</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row">
|
||||
<!-- <div class="col-auto p-r-5">
|
||||
<i class="fa m-r-10" data-type="defaultAddress" :class="{'fa-star': item.default, 'requestModal': !item.default, 'fa-star-o': !item.default, 'pointer': !item.default, 'text-warning': item.default}" ></i>
|
||||
</div> -->
|
||||
<div class="col-auto no-padding p-r-5 p-l-5 pointer">
|
||||
<i class="fa fa-pencil-square-o text-complete m-r-10" @click="expanded = !expanded"></i>
|
||||
</div>
|
||||
<!-- <div class="col-auto p-l-5">
|
||||
<i class="fa fa-trash-o text-danger requestModal" data-type="deleteAddress"></i>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="expanded">
|
||||
<div class="col">
|
||||
<warehouse-address-form-component :company_module_id="company_module_id" :data="item" :section="section" @input="updateAddress($event)"></warehouse-address-form-component>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteAddress">
|
||||
<delete-address-form-component :data="item" :section="section" class="text-center"></delete-address-form-component>
|
||||
</modal-component>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="defaultAddress">
|
||||
<set-default-address-form-component :data="item" :section="section" class="text-center"></set-default-address-form-component>
|
||||
</modal-component> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
props: {
|
||||
company_module_id: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
section: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
expanded: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: function(value){
|
||||
this.value = value;
|
||||
if(value !== this.item.id){
|
||||
this.expanded = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateAddress(id){
|
||||
this.expanded = false;
|
||||
this.$emit('input', id);
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<div class="row p-t-25 text-left">
|
||||
<div class="col">
|
||||
<div class="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
|
||||
<div class="col">
|
||||
<!-- <div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||
<label>Address Reference/Label</label>
|
||||
<input class="form-control" name="reference" v-model="parameters.reference">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_one">
|
||||
<label>Address Line 1</label>
|
||||
<input class="form-control" name="street_one" v-model="parameters.street_one">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_two">
|
||||
<label>Address Line 2</label>
|
||||
<input class="form-control" name="street_two" v-model="parameters.street_two">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.district_id">
|
||||
<label>District</label>
|
||||
<selectable-component :endpoint="route('api.address.district.list')" section="districtListSection" valueColumn="id" :labelColumn="['city']" v-model="parameters.district_id"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md pl-md-1">
|
||||
<validation-wrapper-component :validator="$v.parameters.post_code">
|
||||
<label>Post Code</label>
|
||||
<input class="form-control" name="post_code" v-model="parameters.post_code">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.person_in_charge">
|
||||
<label>Person In Charge</label>
|
||||
<input class="form-control" name="person_in_charge" v-model="parameters.person_in_charge">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md pl-md-1">
|
||||
<validation-wrapper-component :validator="$v.parameters.phone">
|
||||
<label>Phone</label>
|
||||
<input class="form-control" name="phone" v-model="parameters.phone">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||
<label>Delivery Remark</label>
|
||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="[7,8].includes($store.getters.getCompanyModuleType)">
|
||||
<div class="col">
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||
<label>Company Name</label>
|
||||
<input class="form-control" name="reference" v-model="parameters.reference">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.person_in_charge">
|
||||
<label>Name</label>
|
||||
<input class="form-control" name="person_in_charge" v-model="parameters.person_in_charge">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md pl-md-1">
|
||||
<validation-wrapper-component :validator="$v.parameters.phone">
|
||||
<label>Phone</label>
|
||||
<input class="form-control" name="phone" v-model="parameters.phone">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md-3 pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_one">
|
||||
<label>Unit No.</label>
|
||||
<input class="form-control" name="street_one" v-model="parameters.street_one">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md pl-md-1">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_two">
|
||||
<label>Street Address</label>
|
||||
<input class="form-control" name="street_two" v-model="parameters.street_two">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.district_id">
|
||||
<label>City/Town</label>
|
||||
<selectable-component :endpoint="route('api.address.district.list')" section="districtListSection" valueColumn="id" :labelColumn="['city']" v-model="parameters.district_id"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md pl-md-1">
|
||||
<validation-wrapper-component :validator="$v.parameters.post_code">
|
||||
<label>Post Code</label>
|
||||
<input class="form-control" name="post_code" v-model="parameters.post_code">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||
<label>Remark</label>
|
||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col"></div>
|
||||
<div class="col-auto">
|
||||
<button type="button" class="btn btn-sm btn-complete b-rad-none" @click="submitForm()">{{ this.data ? "Update" : "Save" }} Address</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { required, requiredIf, numeric } from "vuelidate/lib/validators";
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
company_module_id: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 2
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters : {
|
||||
company_module_id: this.company_module_id,
|
||||
street_one: '',
|
||||
street_two: '',
|
||||
district_id: '',
|
||||
post_code: '',
|
||||
type: this.type,
|
||||
// reference: null,
|
||||
// remark: null,
|
||||
// phone: null,
|
||||
// person_in_charge: null,
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
created(){
|
||||
if(this.data){
|
||||
this.parameters.reference = this.data.reference;
|
||||
this.parameters.street_one = this.data.street_one;
|
||||
this.parameters.street_two = this.data.street_two;
|
||||
this.parameters.district_id = this.data.district.id;
|
||||
this.parameters.post_code = this.data.post_code;
|
||||
this.parameters.type = this.data.type;
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
|
||||
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
||||
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
// reference: {
|
||||
// required: requiredIf(function(){
|
||||
// return ![7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||
// })
|
||||
// },
|
||||
street_one: { required },
|
||||
street_two: {
|
||||
required: requiredIf(function(){
|
||||
return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||
})
|
||||
},
|
||||
district_id: { required },
|
||||
post_code: { required },
|
||||
// remark: {},
|
||||
// phone: {required, numeric},
|
||||
// person_in_charge: { required },
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
submitForm(){
|
||||
this.submit(this.data ? (this.route('api.address.update', this.data.id)) : (this.route('api.address.create')), this.data ? 'put' : 'post', this.section, true, true);
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -16,8 +16,9 @@
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="changeCustomerName">
|
||||
<change-customer-name-form-component :section="'customerProfileSection'" :data="item"></change-customer-name-form-component>
|
||||
</modal-component>
|
||||
<div class="font-heading fs-20 light">{{item.name}}
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary" data-type="changeCustomerName" >
|
||||
<div class="font-heading fs-20 light">
|
||||
{{item.name}}
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary bg-transparent" data-type="changeCustomerName" >
|
||||
<i class="fa fa-edit pointer fa-fw fs-15 m-l-5"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,11 +93,25 @@
|
||||
<h6 class="no-margin">{{item.contact.phone}}</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<!-- <div class="row align-items-center">
|
||||
<div class="col">
|
||||
<h6 class="no-margin fs-12">WeChat ID</h6>
|
||||
<h6 class="no-margin">{{item.contact.wechat_id}}</h6>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<h6 class="no-margin fs-12">Company Type </h6>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="changeBusinessType">
|
||||
<change-business-type-form-component :section="'customerProfileSection'" :data="item"></change-business-type-form-component>
|
||||
</modal-component>
|
||||
<h6 class="no-margin">
|
||||
{{item.type_name}}
|
||||
<div class="btn btn-xs b-rad-none pointer requestModal d-inline rounded no-border hover-primary bg-transparent" data-type="changeBusinessType" v-if="$store.getters.isAdmin">
|
||||
<i class="fa fa-edit pointer fa-fw fs-15 m-l-5"></i>
|
||||
</div>
|
||||
</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
|
||||
+4
-2
@@ -16,7 +16,8 @@
|
||||
<i class="fa fa-address-card fs-12 m-b-5 muted"></i>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="muted bold fs-10">+{{item.owner.contact.country_code}} {{parseInt(item.owner.contact.phone, 10)}}</div>
|
||||
<div class="muted bold fs-10" v-if="item.owner.contact">+{{item.owner.contact.country_code}} {{parseInt(item.owner.contact.phone, 10)}}</div>
|
||||
<div class="muted bold fs-10" v-else></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +52,8 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="fs-11 bold">{{item.owner.contact.wechat_id}}</div>
|
||||
<div class="fs-11 bold" v-if="item.owner.contact">{{item.owner.contact.wechat_id}}</div>
|
||||
<div class="fs-11 bold" v-else></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<div class="row m-b-10">
|
||||
<div class="col text-center">
|
||||
<h3>Edit Contact</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||
<label>Reference</label>
|
||||
<input class="form-control" name="street_one" v-model="parameters.reference">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.phone">
|
||||
<label>Phone</label>
|
||||
<input class="form-control" name="street_one" v-model="parameters.phone">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.email">
|
||||
<label>Email</label>
|
||||
<input class="form-control" name="street_one" v-model="parameters.email">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.wechat_id">
|
||||
<label>Wechat ID</label>
|
||||
<input class="form-control" name="street_one" v-model="parameters.wechat_id">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
<div class="col-auto p-r-5">
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submitForm">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
company_module_id: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
reference: this.data.reference,
|
||||
phone: this.data.phone,
|
||||
email: this.data.email,
|
||||
wechat_id: this.data.wechat_id,
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.submit(this.route('api.contact.update', this.data.id), 'put', this.section, true, true)
|
||||
},
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
reference: { },
|
||||
phone: { },
|
||||
email: { },
|
||||
wechat_id: { },
|
||||
}
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div class="row" style="margin-top: 100px; margin-bottom: 100px;">
|
||||
<div class="col">
|
||||
<div class="row align-items-center justify-content-center w-100" style="height: 200px; top: 0;">
|
||||
<div class="col">
|
||||
<div class='tetrominos'>
|
||||
<div class='tetromino box1'></div>
|
||||
<div class='tetromino box2'></div>
|
||||
<div class='tetromino box3'></div>
|
||||
<div class='tetromino box4'></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<p class="text-center fs-15 muted all-caps font-lato" style="letter-spacing: 2px">
|
||||
Loading Packages Data
|
||||
<span class="loading-text"></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
.loading-text::after {
|
||||
content: ".";
|
||||
animation: loading 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
0% {
|
||||
content: ". ";
|
||||
}
|
||||
|
||||
25% {
|
||||
content: ". . ";
|
||||
}
|
||||
|
||||
50% {
|
||||
content: ". . . ";
|
||||
}
|
||||
|
||||
75% {
|
||||
content: ". . . . ";
|
||||
}
|
||||
|
||||
100% {
|
||||
content: ". . . . . ";
|
||||
}
|
||||
}
|
||||
|
||||
.tetrominos {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-112px, -96px);
|
||||
}
|
||||
|
||||
.tetromino {
|
||||
width: 96px;
|
||||
height: 112px;
|
||||
position: absolute;
|
||||
transition: all ease 0.3s;
|
||||
background: url('data:image/svg+xml;utf-8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 612 684"%3E%3Cpath fill="%23010101" d="M305.7 0L0 170.9v342.3L305.7 684 612 513.2V170.9L305.7 0z"/%3E%3Cpath fill="%23fff" d="M305.7 80.1l-233.6 131 233.6 131 234.2-131-234.2-131"/%3E%3C/svg%3E') no-repeat top center;
|
||||
}
|
||||
|
||||
.box1 {
|
||||
animation: tetromino1 1.5s ease-out infinite;
|
||||
}
|
||||
|
||||
.box2 {
|
||||
animation: tetromino2 1.5s ease-out infinite;
|
||||
}
|
||||
|
||||
.box3 {
|
||||
animation: tetromino3 1.5s ease-out infinite;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.box4 {
|
||||
animation: tetromino4 1.5s ease-out infinite;
|
||||
}
|
||||
|
||||
@keyframes tetromino1 {
|
||||
|
||||
0%,
|
||||
40% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translate(48px, -27px);
|
||||
}
|
||||
|
||||
60%,
|
||||
100% {
|
||||
transform: translate(96px, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes tetromino2 {
|
||||
|
||||
0%,
|
||||
20% {
|
||||
transform: translate(96px, 0px);
|
||||
}
|
||||
|
||||
40%,
|
||||
100% {
|
||||
transform: translate(144px, 27px);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes tetromino3 {
|
||||
|
||||
0% {
|
||||
transform: translate(144px, 27px);
|
||||
}
|
||||
|
||||
20%,
|
||||
60% {
|
||||
transform: translate(96px, 54px);
|
||||
}
|
||||
|
||||
90%,
|
||||
100% {
|
||||
transform: translate(48px, 27px);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes tetromino4 {
|
||||
|
||||
0%,
|
||||
60% {
|
||||
transform: translate(48px, 27px);
|
||||
}
|
||||
|
||||
90%,
|
||||
100% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div class="row parentContainer" @keyup.enter="search">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col p-r-0">
|
||||
<div class="row">
|
||||
<!-- <div class="col">
|
||||
<div class="form-group no-margin form-group-default b-rad-none">
|
||||
<label class="text-primary">Customer Marking</label>
|
||||
<input type="text" class="form-control" v-model="parameters.customerMarking"
|
||||
@click="clearAll('customerMarking')" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group no-margin form-group-default b-rad-none">
|
||||
<label class="text-primary">Email</label>
|
||||
<input type="text" class="form-control" v-model="parameters.email"
|
||||
@click="clearAll('email')" />
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="col">
|
||||
<div class="form-group no-margin form-group-default b-rad-none">
|
||||
<label class="text-primary">Order No</label>
|
||||
<input type="text" class="form-control" v-model="parameters.orderNo"
|
||||
@click="clearAll('orderNo')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="btn btn-primary b-rad-none" @click="search">
|
||||
<i class="fa fa-search lh-40"></i>
|
||||
</div>
|
||||
<div class="btn btn-default b-rad-none lh-40" @click="reset">
|
||||
Reset
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
section: {
|
||||
default: 'addressList'
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
parameters: {
|
||||
customerMarking: null,
|
||||
email: null,
|
||||
orderNo: null,
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clearAll(input) {
|
||||
var parameters = this.parameters;
|
||||
$.each(this.parameters, function (key, value) {
|
||||
if (key != input) {
|
||||
parameters[key] = null;
|
||||
}
|
||||
});
|
||||
this.parameters = parameters;
|
||||
},
|
||||
reset() {
|
||||
this.parameters.customerMarking = null;
|
||||
this.parameters.email = null;
|
||||
this.parameters.orderNo = null;
|
||||
},
|
||||
search() {
|
||||
if (this.parameters.orderNo) {
|
||||
window.location.href = this.route('order.show', this.parameters.orderNo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<transition-component group enter-class="animate__animated animate__fadeInRight animate__delay-1 animate__faster p-r-30" leave-class="animate__animated animate__fadeOutLeft animate__faster p-r-30" style="min-height: 300px;width:100%">
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
|
||||
<div class="row" key="2" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row align-items-center justify-content-center p-t-50 p-b-50" v-show="!$store.getters.getListData(section).length && !$store.getters.isLoading(section) && emptyListSection">
|
||||
<div class="col-10">
|
||||
<div class="row align-items-center justify-content-center hint-text">
|
||||
<div class="col-4 hint-text"><img src="/images/not-found-illustration.png" class="w-100 hint-text"/></div>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="col">
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<p class="all-caps no-margin fs-11" style="letter-spacing: 2px;">Nothing To Show Here</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-5 align-items-center justify-content-center hide">
|
||||
<div class="col">
|
||||
<small class="fs-9 muted all-caps font-lato" style="letter-spacing: 2px">There is no results found, Try adjusting your filters to find what you are looking for.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="list disable-text-selection" data-check-all="checkAll">
|
||||
<div class="row" v-for="group in Math.ceil($store.getters.getListData(section).length / columns)">
|
||||
<div class="col-12" :class="'col-md-'+(12/columns)" v-for="item in $store.getters.getListData(section).slice((group - 1) * columns, group * columns)" v-bind:key="item.id" :data="item">
|
||||
<slot name="list" :data="item"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<pagination-component :section="section" class="mb-5" ref="pagination"></pagination-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition-component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
endpoint: {
|
||||
type: String,
|
||||
default: route('api.order.v2.list'),
|
||||
},
|
||||
options: {
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
emptyListSection: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
columns: {
|
||||
type: Number,
|
||||
validator: (prop) => [1, 2, 3, 4, 6, 12].includes(prop),
|
||||
default: 1
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
filters: this.options,
|
||||
api_count: 0,
|
||||
isLoading: true,
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.setDecoratorDefault();
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section, 'page': 1, 'filters': this.filters});
|
||||
},
|
||||
computed: {
|
||||
pendingList () {
|
||||
return this.$store.getters.isInCompleteQueue(this.section);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pendingList(inComplete){
|
||||
if(inComplete){
|
||||
this.fetchList();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchList(){
|
||||
let listDecorators = this.$store.getters.getListDetails(this.section);
|
||||
this.submit(this.endpoint + '?page=' + listDecorators.page + '&filters=' + JSON.stringify(listDecorators.filters), 'get', this.section, false, false)
|
||||
},
|
||||
updateFilters(filters){
|
||||
this.filters = filters;
|
||||
this.setDecoratorDefault();
|
||||
this.submit(this.endpoint + '?page=1&filters=' + JSON.stringify(this.filters), 'get', this.section, false, false)
|
||||
},
|
||||
successHandler(response){
|
||||
this.$store.dispatch('completeList', {'name': this.section, 'data': response.payload.data});
|
||||
this.$refs.pagination.makePagination(response.payload.meta, response.payload.links);
|
||||
this.api_count += 1;
|
||||
this.isLoading = false;
|
||||
|
||||
if (this.endpoint === route('api.order.v2.list') && this.api_count === 1) {
|
||||
let listDecorators = this.$store.getters.getListDetails(this.section);
|
||||
this.submit(this.route('api.order.list') + '?page=' + listDecorators.page + '&filters=' + JSON.stringify(listDecorators.filters), 'get', this.section, false, false)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -62,15 +62,18 @@
|
||||
<div class="row text-center">
|
||||
<div class="col b-r b-grey text-info p-t-5 p-b-10">
|
||||
<small class="fs-10 all-caps bold">Received</small>
|
||||
<h6 class="bold no-margin text-info">{{item.parcels.received_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
|
||||
<h6 class="bold no-margin text-info" v-if="item.parcels" >{{item.parcels.received_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
|
||||
<h6 class="bold no-margin text-info" v-else > - </h6>
|
||||
</div>
|
||||
<div class="col b-r b-grey text-primary p-t-5 p-b-10">
|
||||
<small class="fs-10 all-caps bold">In Transit</small>
|
||||
<h6 class="bold no-margin text-primary">{{item.parcels.in_transit_packages.flatMap(packing_list => packing_list.packages).concat(item.parcels.destination_warehouse_packages.flatMap(packing_list => packing_list.packages)).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
|
||||
<h6 class="bold no-margin text-primary" v-if="item.parcels" >{{item.parcels.in_transit_packages.flatMap(packing_list => packing_list.packages).concat(item.parcels.destination_warehouse_packages.flatMap(packing_list => packing_list.packages)).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
|
||||
<h6 class="bold no-margin text-info" v-else > - </h6>
|
||||
</div>
|
||||
<div class="col text-success p-t-5 p-b-10">
|
||||
<small class="fs-10 all-caps bold">Delivered</small>
|
||||
<h6 class="bold no-margin text-success">{{item.parcels.delivered_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
|
||||
<h6 class="bold no-margin text-success" v-if="item.parcels" >{{item.parcels.delivered_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.quantity + total, 0)}}</h6>
|
||||
<h6 class="bold no-margin text-info" v-else > - </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,7 +93,8 @@
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<small class="fs-10 all-caps muted">Total CBM</small>
|
||||
<h6 class="no-margin semi-bold">{{(Math.ceil((item.parcels.origin_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.in_transit_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.destination_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.delivered_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0)) * 10000) / 10000).toFixed(3)}}</h6>
|
||||
<h6 class="no-margin semi-bold" v-if="item.parcels">{{(Math.ceil((item.parcels.origin_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.in_transit_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.destination_warehouse_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0) + item.parcels.delivered_packages.flatMap(packing_list => packing_list.packages).reduce((total, obj) => obj.cbm + total, 0)) * 10000) / 10000).toFixed(3)}}</h6>
|
||||
<h6 class="bold no-margin text-info" v-else > - </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="row parentContainer">
|
||||
<div class="col">
|
||||
<div class="row align-items-center p-t-5 p-b-5">
|
||||
<div class="col-auto p-r-0" v-if="!$store.getters.isAdmin">
|
||||
@@ -38,6 +38,14 @@
|
||||
<div class="col-auto text-right">
|
||||
<div class="btn btn-xs btn-default" @click="expanded = !expanded"><i class="fa" :class="{'fa-angle-up': expanded, 'fa-angle-down': !expanded}"></i></div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0 p-r-0 d-flex justify-content-center align-items-center" v-if="$store.getters.isSuperAdmin">
|
||||
<span class="d-inline-block m-r-15 pointer requestModal bg-white btn-xs" data-type="deleteParcel">
|
||||
<i class="fa fa-close"></i>
|
||||
</span>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteParcel">
|
||||
<delete-parcel-form-component :data="item" :section="section"></delete-parcel-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -104,6 +112,12 @@
|
||||
expanded: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
default: null,
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<div class="row m-b-10">
|
||||
<div class="col text-center">
|
||||
<h3>Edit Role Type</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-t-15 m-b-15">
|
||||
<div class="col p-r-5">
|
||||
<div class="b-grey b-a w-100 text-center p-l-15 p-r-15 p-t-10 p-b-10 pointer fs-15" :class="[{'b-primary': parameters.type === 2}]" @click="updateRoleType(2)">Admin</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="b-grey b-a w-100 text-center p-l-15 p-r-15 p-t-10 p-b-10 pointer fs-15" :class="[{'b-primary': parameters.type === 1}]" @click="updateRoleType(1)">Super Admin</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
<div class="col-auto p-r-5">
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submitForm">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required, minLength } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
data:{
|
||||
type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
type: this.data.type,
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.submit(this.route('api.account.user.update.role', this.data.id), 'put', this.section, true, true)
|
||||
},
|
||||
updateRoleType(type){
|
||||
this.parameters.type=type;
|
||||
}
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<div class="row m-b-10">
|
||||
<div class="col text-center">
|
||||
<h3>Edit Company Type</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15 m-b-15">
|
||||
<div class="col p-r-5">
|
||||
<div class="b-grey b-a w-100 text-center p-l-15 p-r-15 p-t-10 p-b-10 pointer fs-15" :class="[{'b-primary': parameters.type === 0}]" @click="updateType(0)">Personal<br>Business</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="b-grey b-a w-100 text-center p-l-15 p-r-15 p-t-10 p-b-10 pointer fs-15" :class="[{'b-primary': parameters.type === 1}]" @click="updateType(1)">Company<br>Business</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
<div class="col-auto p-r-5">
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submitForm">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
type: this.data.type,
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.submit(this.route('api.company.update.type', this.data.id), 'put', this.section, true, true)
|
||||
},
|
||||
updateType(type) {
|
||||
this.parameters.type = type;
|
||||
},
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -60,9 +60,6 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
successHandler(response) {
|
||||
window.location.replace(this.route('customers', response.payload.data.reference));
|
||||
},
|
||||
submitForm() {
|
||||
this.submit(this.route('api.company.update.nameAndDebtor', this.data.id), 'put', this.section, true, true)
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center justify-content-center">
|
||||
<div class="col col-md-3 p-r-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.warehouse_id === 3, 'b-grey': parameters.warehouse_id !== 3 }" @click="parameters.warehouse_id = 3">
|
||||
<div class="col-12 col-md-3 p-l-5 p-r-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer h-100" :class="{ 'b-primary': parameters.warehouse_id === 3, 'b-grey': parameters.warehouse_id !== 3 }" @click="parameters.warehouse_id = 3">
|
||||
<div class="row m-b-15 justify-content-center">
|
||||
<div class="col-8">
|
||||
<img src="/images/guangzhou-map.png" class="w-100">
|
||||
@@ -26,8 +26,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-md-3 p-l-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" @click="parameters.warehouse_id = 4" :class="{ 'b-primary': parameters.warehouse_id === 4, 'b-grey': parameters.warehouse_id !== 4 }">
|
||||
<div class="col-12 col-md-3 p-l-5 p-r-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer h-100" @click="parameters.warehouse_id = 4" :class="{ 'b-primary': parameters.warehouse_id === 4, 'b-grey': parameters.warehouse_id !== 4 }">
|
||||
<div class="row m-b-15 justify-content-center">
|
||||
<div class="col-8">
|
||||
<img src="/images/yiwu-map.png" class="w-100">
|
||||
@@ -40,6 +40,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 p-l-5 p-r-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer h-100" @click="parameters.warehouse_id = 'foshan'" :class="{ 'b-primary': parameters.warehouse_id === 'foshan', 'b-grey': parameters.warehouse_id !== 'foshan'}">
|
||||
<div class="row m-b-15 justify-content-center">
|
||||
<div class="col-8">
|
||||
<img src="/images/foshan-map.png" class="w-100">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5 class="no-margin" :class="{ 'text-primary': parameters.warehouse_id === 'foshan', 'semi-bold': parameters.warehouse_id === 'foshan'}">Foshan</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center m-t-15 align-items-center" v-if="parameters.warehouse_id">
|
||||
<div class="col-6">
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -301,7 +301,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<parcel-component v-for="parcel in order.parcels.received_packages.flatMap(packing_list => packing_list.packages)" :data="parcel" :key="parcel.id"></parcel-component>
|
||||
<parcel-component :section="section" v-for="parcel in order.parcels.received_packages.flatMap(packing_list => packing_list.packages)" :data="parcel" :key="parcel.id"></parcel-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 200px; top: 0;" v-if="isLoading"></loading-component>
|
||||
<div class="row flex-wrap" v-if="!isLoading && order">
|
||||
<div class="col">
|
||||
<div class="row m-b-30">
|
||||
<div class="col bg-master-lightest padding-25">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-12 col-lg-3">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-10">
|
||||
<a :href="route('order.qr.download', order.id)" target="_blank">
|
||||
<div class="peelable-corner overflow-hidden relative">
|
||||
<img :src="'https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl={id:'+order.id+'}'" class="w-100">
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col-auto">
|
||||
<h3 class="no-margin"><b>Order No.</b> {{order.reference}}</h3>
|
||||
</div>
|
||||
<div class="col d-flex">
|
||||
<div class="btn btn-xs btn-outline-danger b-rad-none pointer requestModal align-items-center d-flex" data-type="changeOrderNo" v-if="$store.getters.isSuperAdmin">Change Order Number</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="changeOrderNo">
|
||||
<change-order-number-form-component :section="section" :data="order"></change-order-number-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-auto d-flex align-items-center">
|
||||
<h6 class="no-margin"><b>Remark:</b></h6>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" type="orderRemark">
|
||||
<remark-form-component module_type="Order" :data="order" :section="section"></remark-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="col-auto p-l-0" v-if="order.remarks.length == 0">
|
||||
<div class="btn btn-xs btn-outline-info b-rad-none pointer requestModal" data-type="orderRemark">Add a Remark</div>
|
||||
</div>
|
||||
<div class="col d-flex align-items-center pl-3 pl-md-0" v-if="order.remarks.length >= 1">
|
||||
<h6 class="no-margin">{{ order.remarks[0].content }}</h6>
|
||||
<span class="btn btn-md btn-default m-l-10 requestModal" data-type="orderRemark">
|
||||
<i class="fa fa-edit"></i>
|
||||
</span>
|
||||
<span class="btn btn-md btn-default m-l-5 requestModal" data-type="deleteOrderRemark">
|
||||
<i class="fa fa-trash"></i>
|
||||
</span>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" type="deleteOrderRemark">
|
||||
<delete-remark-form-component :section="section" :data="order.remarks[0]"></delete-remark-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="col-12 col-sm-auto">
|
||||
<h6 class="no-margin"><b>Order Date:</b> {{order.created_at}}</h6>
|
||||
</div>
|
||||
<div class="col-12 col-sm-auto">
|
||||
<h6 class="no-margin"><b>Warehouse:</b> {{order.warehouse.name}} {{$store.getters.isAdmin ? order.warehouse.reference : ''}}</h6>
|
||||
</div>
|
||||
<div class="col col-sm" v-if="$store.getters.isAdmin">
|
||||
<a :href="route('customer.profile', order.company_module.marking)">
|
||||
<h6 class="no-margin"><b>Customer Marking:</b> {{order.company_module.marking}}</h6>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10 align-items-center parentContainer" >
|
||||
<div class="col-auto">
|
||||
<h6 class="no-margin">
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-auto pr-sm-0"><b>Delivery Address:</b> </div>
|
||||
<div class="col-12 col-sm-auto pl-sm-0">{{order.address.reference}} <i class="fa fa-info-circle m-l-10" v-tooltip:right="order.address.street_one+' '+(order.address.street_two ? order.address.street_two : '')+', '+ order.address.district.name+', '+order.address.post_code+' '+order.address.state.name+', '+order.address.country.name" ></i></div>
|
||||
</div>
|
||||
</h6>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row" v-if="!order.address_change_request">
|
||||
<div class="col">
|
||||
<div class="btn btn-xs btn-outline-danger b-rad-none pointer requestModal m-t-10 mt-sm-0" data-type="updateDeliveryAddress">Change Delivery Address</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="stick-up" type="updateDeliveryAddress" size="large">
|
||||
<change-order-address-form-component :data="order" :section="section" class="text-center"></change-order-address-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row parentContainer" v-if="order.address_change_request">
|
||||
<div class="col-auto p-r-0">
|
||||
<div class="p-t-10 p-b-10 p-l-15 p-r-15 b-a b-danger fs-10 text-danger requestModal" data-type="updateDeliveryAddress"><i class="fa fa-exclamation-circle m-r-10"></i>Your Delivery address change request is being reviewed</div>
|
||||
</div>
|
||||
<div class="col-auto bg-danger-light pointer requestModal" data-type="cancelAddressChangeRequest">
|
||||
<i class="fa fa-times text-white lh-38"></i>
|
||||
</div>
|
||||
<modal-component small type="cancelAddressChangeRequest">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Cancel Address Change Request</h5>
|
||||
<div class="fs-11">Are you sure you want to cancel your order delivery address change request?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-danger btn-block b-rad-none" @click="submit(route('api.order.address.status.update', order.address_change_request.id, 6), 'put', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-10">
|
||||
<h6 class="text-info"><span class="text-danger bold">Gentle reminder:</span> You need to send the QR code to your supplier to print and stick on your packages, this QR code is required for us to identify your packages when they arrives at our warehouse!</h6>
|
||||
<a :href="route('order.qr.download', order.id)" target="_blank">
|
||||
<button class="btn btn-sm btn-success bg-master b-rad-none all-caps">Download QR Code Pdf</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-30" v-if="order.invoices.length">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h4 class="bold">Invoices</h4>
|
||||
<p>You can view your invoices here and make payment.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bg-master-lightest p-t-15" v-for="invoice in order.invoices">
|
||||
<div class="col">
|
||||
<customer-payments-billing-component :data="invoice" invoice_status="Pending Payment" :section="section"></customer-payments-billing-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<order-package-v2-section-component v-if="!isLoading" :order_number="order_number"></order-package-v2-section-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
order_number: {
|
||||
type: Number,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
section: 'orderProfileV2Section',
|
||||
isLoading: true,
|
||||
order: null,
|
||||
addComment: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pendingQueue () {
|
||||
return this.$store.getters.isInCompleteQueue(this.section);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pendingQueue(inComplete){
|
||||
if(inComplete){
|
||||
this.fetchCompany();
|
||||
}
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section});
|
||||
},
|
||||
methods: {
|
||||
fetchCompany(){
|
||||
this.isLoading = true;
|
||||
this.submit(route('api.order.v2.show', this.order_number), 'get', this.section, false, false)
|
||||
},
|
||||
successHandler(response){
|
||||
this.$store.dispatch('completeList', {'name': this.section, 'data': []});
|
||||
this.isLoading = false;
|
||||
this.order = response.payload.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -162,11 +162,11 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component v-show="!$store.getters.isShowing('createOrderForm')" section="pendingOrderListSection" :endpoint="route('api.order.list')" :options="item ? {per_page: 12, status_in: [1], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 30, status_in: [1], with_packing_lists: true}" :columns=3>
|
||||
<list-order-component v-show="!$store.getters.isShowing('createOrderForm')" section="pendingOrderListSection" :options="item ? {per_page: 12, status_in: [1], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 30, status_in: [1], with_packing_lists: true}" :columns=3>
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<order-component :data="data"></order-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-order-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -179,11 +179,11 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component v-show="!$store.getters.isShowing('createOrderForm')" section="activeOrderListSection" :endpoint="route('api.order.list')" :options="item ? {per_page: 12, order_by: {column: 'created_at', DESC: true}, status_in: [2], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 30, order_by: {column: 'created_at', DESC: true}, status_in: [2], with_packing_lists: true}" :columns=3>
|
||||
<list-order-component v-show="!$store.getters.isShowing('createOrderForm')" section="activeOrderListSection" :options="item ? {per_page: 12, order_by: {column: 'created_at', DESC: true}, status_in: [2], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 12, order_by: {column: 'created_at', DESC: true}, status_in: [2], with_packing_lists: true}" :columns=3>
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<order-component :data="data"></order-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-order-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -196,11 +196,11 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component v-show="!$store.getters.isShowing('createOrderForm')" section="completeOrderListSection" :endpoint="route('api.order.list')" :options="item ? {per_page: 12, status_in: [3], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 30, status_in: [3], with_packing_lists: true}" :columns=3>
|
||||
<list-order-component v-show="!$store.getters.isShowing('createOrderForm')" section="completeOrderListSection" :options="item ? {per_page: 12, status_in: [3], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 12, status_in: [3], with_packing_lists: true}" :columns=3>
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<order-component :data="data"></order-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-order-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -213,11 +213,11 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component v-show="!$store.getters.isShowing('createOrderForm')" section="cancelledOrderListSection" :endpoint="route('api.order.list')" :options="item ? {per_page: 12, status_in: [4, 5, 6], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 30, status_in: [4, 5, 6], with_packing_lists: true}" :columns=3>
|
||||
<list-order-component v-show="!$store.getters.isShowing('createOrderForm')" section="cancelledOrderListSection" :options="item ? {per_page: 12, status_in: [4, 5, 6], company_module_id: item.company_module.id, with_packing_lists: true} : {per_page: 12, status_in: [4, 5, 6], with_packing_lists: true}" :columns=3>
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<order-component :data="data"></order-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-order-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+8
@@ -63,6 +63,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0 p-r-0 d-flex justify-content-center align-items-center" v-if="$store.getters.isSuperAdmin">
|
||||
<span class="d-inline-block m-r-15 text-primary bold text-underline pointer requestModal" data-type="deleteInvoice">
|
||||
<i class="fa fa-close"></i>
|
||||
</span>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteInvoice">
|
||||
<delete-invoice-form-component :data="item" :section="section"></delete-invoice-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="col-auto hide">
|
||||
<div class="btn btn-sm all-caps b-rad-none btn-block" :class="{'btn-success': !expanded, 'btn-default': expanded}" @click="expanded = !expanded">
|
||||
{{ expanded ? 'Cancel' : 'Make Payment' }}</div>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Delete Invoice</h5>
|
||||
<div class="fs-11">Are you sure you want to delete this invoice?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-danger w-100 btn-sm" @click="submit(route('api.transaction.delete', data.id), 'delete', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Delete Parcel</h5>
|
||||
<div class="fs-11">Are you sure you want to delete this Parcel?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-danger w-100 btn-sm" @click="submit(route('api.packing_list.delete.by_package_id', data.id), 'delete', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user