mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
big commit
This commit is contained in:
@@ -3,14 +3,17 @@
|
||||
namespace App\Classes\General\Abstracts;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\ErrorException;
|
||||
use App\Classes\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\ValueObjects\Constants\Notifications;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Classes\ValueObjects\Response\ApiResponseObject;
|
||||
use ErrorException;
|
||||
use ErrorException as GeneralExceptions;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
abstract class AbstractControllerLogic
|
||||
{
|
||||
@@ -49,10 +52,17 @@ abstract class AbstractControllerLogic
|
||||
|
||||
try {
|
||||
|
||||
return $this->logic($request);
|
||||
DB::beginTransaction();
|
||||
|
||||
} catch (ErrorException $exception){
|
||||
return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(), $exception->getCode() === 0 ? 500 : $exception->getCode()))->handler();
|
||||
$response = $this->logic($request);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return $response;
|
||||
|
||||
} catch (ErrorException|GeneralExceptions $exception){
|
||||
return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(),
|
||||
$exception->getCode() ? $exception->getCode() : HttpStatus::SERVER_ERROR))->handler();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Interfaces;
|
||||
|
||||
|
||||
Interface DataTransferObject
|
||||
{
|
||||
|
||||
}
|
||||
@@ -119,7 +119,7 @@ class CreateUserLogic extends AbstractControllerLogic
|
||||
|
||||
// $this->sendUserVerificationEmail::dispatch($user, $attempt);
|
||||
|
||||
$request->request->set('name', $request->input('type') === 2 ? $request->input('company_name') : $request->input('name'));
|
||||
$request->request->set('name', $request->input('type') === 1 ? $request->input('company_name') : $request->input('name'));
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $this->createCompanyProcessor->execute($request);
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Documents\Services\RejectsDocument;
|
||||
use App\Classes\Modules\Documents\Standards\Rules\CanApproveDocument;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\DocumentResource;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\FetchesDocument;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\ApprovesDocument;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Approve Document',
|
||||
'message' => 'You have successfully approved the Document'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanApproveDocument*/
|
||||
private $canApproveDocument;
|
||||
|
||||
/** @var ApprovesDocument */
|
||||
private $approvesDocument;
|
||||
|
||||
/** @var RejectsDocument */
|
||||
private $rejectsDocument;
|
||||
|
||||
/** @var FetchesDocument */
|
||||
private $fetchesDocument;
|
||||
|
||||
/** @var UpdatesCompanyStatus */
|
||||
private $updatesCompanyStatus;
|
||||
|
||||
/**
|
||||
* ApproveIdentificationDocumentLogic constructor.
|
||||
* @param CanApproveDocument $canApproveDocument
|
||||
* @param ApprovesDocument $approvesDocument
|
||||
* @param RejectsDocument $rejectsDocument
|
||||
* @param FetchesDocument $fetchesDocument
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
*/
|
||||
public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus)
|
||||
{
|
||||
$this->canApproveDocument = $canApproveDocument;
|
||||
$this->approvesDocument = $approvesDocument;
|
||||
$this->rejectsDocument = $rejectsDocument;
|
||||
$this->fetchesDocument = $fetchesDocument;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$status = $request->route('status');
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->fetchesDocument->execute(['id' => $request->route('document_id')]);
|
||||
|
||||
$this->canApproveDocument->passes();
|
||||
|
||||
$document = $status === 'approve' ? $this->approvesDocument->execute($document) : $this->rejectsDocument->execute($document);
|
||||
|
||||
$this->updatesCompanyStatus->execute($document->owner, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_SUBMISSION);
|
||||
|
||||
return $this->resourceResponse(new DocumentResource($document));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+11
-19
@@ -17,6 +17,7 @@ use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\OwnerType;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use App\Http\Resources\DocumentResource;
|
||||
use App\Models\Company;
|
||||
use App\Models\Document;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -70,31 +71,22 @@ class UpdateCompanyIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
/** @var Company $company */
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
$object = new DocumentObject($company->type === CompanyTypes::COMPANY_BUSINESS ? DocumentType::SSM_REGISTRATION: DocumentType::IDENTITY_CARD, $request->input('files'),
|
||||
$request->input('reference'), ApprovalStatus::PENDING_VERIFICATION, 'identifications');
|
||||
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($company, $object);
|
||||
$this->createsFile->execute($document, $object);
|
||||
|
||||
$object = new DocumentObject(
|
||||
$company->type === CompanyTypes::COMPANY_BUSINESS ? DocumentType::SSM_REGISTRATION: DocumentType::IDENTITY_CARD,
|
||||
$request->input('files'), $request->input('reference'));
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($company, $object);
|
||||
|
||||
$this->createsFile->execute($document, $object);
|
||||
|
||||
$this->updatesCompanyStatus->execute($company, ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
return $this->resourceResponse(new DocumentResource($document));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
$this->updatesCompanyStatus->execute($company, ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\RejectsDocument;
|
||||
use App\Classes\Modules\Documents\Standards\Rules\CanApproveDocument;
|
||||
use App\Http\Resources\DocumentResource;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\FetchesDocument;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RejectDocumentLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Reject Document',
|
||||
'message' => 'You have successfully rejected the Document'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanApproveDocument*/
|
||||
private $canApproveDocument;
|
||||
|
||||
/** @var RejectsDocument */
|
||||
private $rejectsDocument;
|
||||
|
||||
/** @var FetchesDocument */
|
||||
private $fetchesDocument;
|
||||
|
||||
/**
|
||||
* RejectDocumentLogic constructor.
|
||||
* @param CanApproveDocument $canApproveDocument
|
||||
* @param RejectsDocument $rejectsDocument
|
||||
* @param FetchesDocument $fetchesDocument
|
||||
*/
|
||||
public function __construct(CanApproveDocument $canApproveDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument)
|
||||
{
|
||||
$this->canApproveDocument = $canApproveDocument;
|
||||
$this->rejectsDocument = $rejectsDocument;
|
||||
$this->fetchesDocument = $fetchesDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$document = $this->fetchesDocument->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->canApproveDocument->passes();
|
||||
|
||||
$document_query = $this->rejectsDocument->execute($document);
|
||||
|
||||
return $this->resourceResponse(new DocumentResource($document_query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\ControllersLogic;
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Documents\Standards\Rules\CanRenderDocument;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Tymon\JWTAuth\JWT;
|
||||
|
||||
class RenderDocumentLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* RenderDocumentLogic constructor.
|
||||
* @param CanRenderDocument $canRenderDocument
|
||||
*/
|
||||
public function __construct(CanRenderDocument $canRenderDocument)
|
||||
{
|
||||
$this->canRenderDocument = $canRenderDocument;
|
||||
}
|
||||
|
||||
protected function notification(): array {
|
||||
return [
|
||||
'title' => '',
|
||||
'message' => ''
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanRenderDocument */
|
||||
private $canRenderDocument;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws AccessForbiddenException
|
||||
* @throws RequestValidationException
|
||||
* @throws ResourceNotFoundException
|
||||
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$file = $request->route('fileName');
|
||||
|
||||
$this->canRenderDocument->passes();
|
||||
|
||||
if(!Storage::disk('documents')->exists($file))
|
||||
{
|
||||
throw new ResourceNotFoundException('Requested File not found');
|
||||
}
|
||||
|
||||
return $this->response(['src' => explode('.', $file)[1] == 'pdf' ? chunk_split(base64_encode(Storage::disk('documents')->get($file))) : Storage::disk('documents')->get($file) ]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Classes\Modules\Documents\DataTransferObjects;
|
||||
|
||||
use App\Classes\Interfaces\DataTransferObject;
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
use App\Classes\Modules\Documents\Services\ConvertsBase64ToFile;
|
||||
|
||||
class DocumentObject implements DataTransferObject
|
||||
@@ -14,20 +14,30 @@ class DocumentObject implements DataTransferObject
|
||||
/** @var array */
|
||||
private $files;
|
||||
|
||||
/** @var string|null */
|
||||
/** @var string */
|
||||
private $reference;
|
||||
|
||||
/** @var int */
|
||||
private $status;
|
||||
|
||||
/** @var string|null */
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* DocumentObject constructor.
|
||||
* @param string $document_type
|
||||
* @param array $files
|
||||
* @param null|string $reference
|
||||
* @param string $reference
|
||||
* @param int $status
|
||||
* @param null|string $path
|
||||
*/
|
||||
public function __construct(string $document_type, array $files, ?string $reference = null)
|
||||
public function __construct(string $document_type, array $files, string $reference, int $status, ?string $path = '')
|
||||
{
|
||||
$this->document_type = $document_type;
|
||||
$this->files = $files;
|
||||
$this->reference = $reference;
|
||||
$this->status = $status;
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,20 +50,29 @@ class DocumentObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
* @return string
|
||||
*/
|
||||
public function getReference(): string
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStatus(): int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function getFiles(): array
|
||||
{
|
||||
return (new ConvertsBase64ToFile())->convert($this->files);
|
||||
return (new ConvertsBase64ToFile($this->path))->convert($this->files);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Classes\Modules\Documents\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Document;
|
||||
use Carbon\Carbon;
|
||||
@@ -18,7 +17,7 @@ class ApprovesDocument extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(Document $model)
|
||||
{
|
||||
$model->status = ApprovalStatus::ACTIVE;
|
||||
$model->status = ApprovalStatus::APPROVED;
|
||||
$model->approved_by = Auth()->user()->id;
|
||||
$model->approved_date = Carbon::now();
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ class ConvertsBase64ToFile
|
||||
{
|
||||
$this->path = $path;
|
||||
$this->filesInfo = [];
|
||||
|
||||
File::isDirectory(storage_path($this->path)) or
|
||||
File::makeDirectory(storage_path($this->path), 0777, true, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,10 +98,9 @@ class ConvertsBase64ToFile
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
private function generateFile(FileObject $file, string $suffix = '') {
|
||||
$filePath = $this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
|
||||
|
||||
$filePath = storage_path($this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension());
|
||||
|
||||
Storage::put($filePath, $file->getDecodedData());
|
||||
Storage::disk('documents')->put($filePath, $file->getDecodedData());
|
||||
|
||||
return $filePath;
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Document;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class RejectsDocument extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Document $model
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Document $model)
|
||||
{
|
||||
$model->status = ApprovalStatus::REJECTED;
|
||||
$model->approved_by = Auth()->user()->id;
|
||||
$model->approved_date = Carbon::now();
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
|
||||
class CanApproveDocument extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
|
||||
class CanRenderDocument extends AbstractRule
|
||||
{
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,4 +5,5 @@ namespace App\Classes\ValueObjects\Constants;
|
||||
final class DocumentType {
|
||||
public const SSM_REGISTRATION = 'SSM_REGISTRATION';
|
||||
public const IDENTITY_CARD = 'IDENTITY_CARD';
|
||||
public const IDENTIFICATION_DOCUMENTS = [self::IDENTITY_CARD, self::SSM_REGISTRATION];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\ApproveIdentificationDocumentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApproveIdentificationDocumentController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ApproveIdentificationDocumentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function approve(Request $request, ApproveIdentificationDocumentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Documents;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\ApproveIdentificationDocumentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApproveDocumentController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ApproveIdentificationDocumentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function approve(Request $request, ApproveIdentificationDocumentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Documents;
|
||||
|
||||
use App\Classes\Modules\Documents\ControllersLogic\ListDocumentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListDocumentsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListDocumentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListDocumentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Documents;
|
||||
|
||||
use App\Classes\Modules\Documents\ControllersLogic\RejectDocumentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RejectDocumentController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param RejectDocumentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function reject(Request $request, RejectDocumentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Documents;
|
||||
|
||||
|
||||
use App\Classes\Modules\Documents\ControllersLogic\RenderDocumentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RenderDocumentController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param RenderDocumentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fileStorageServe(Request $request, RenderDocumentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -77,9 +77,9 @@ class OrderController
|
||||
'marking' => CompanyConnections::where('module_one', $order->importer->modules->first()->id)->first()->marking
|
||||
];
|
||||
|
||||
return view('pages.pdf.qr', $data);
|
||||
// return view('pages.pdf.qr', $data);
|
||||
|
||||
return $pdf->loadView('pages.pdf.qr', $data)->download();
|
||||
return $pdf->loadView('pages.pdf.qr', $data)->stream();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\AccountStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Models\CompanyConnections;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -26,7 +27,8 @@ class CompanyResource extends JsonResource
|
||||
'status' => (int) $this->status,
|
||||
'delivery_address' => new AddressResource($this->deliveryAddress),
|
||||
'contact' => new ContactResource($this->contacts->first()),
|
||||
'total_orders' => count($this->orders)
|
||||
'total_orders' => count($this->orders),
|
||||
'identification' => new DocumentResource($this->whenLoaded('documents', $this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first())),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,8 @@ return [
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
Barryvdh\DomPDF\ServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -226,6 +228,7 @@ return [
|
||||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||
|
||||
],
|
||||
|
||||
|
||||
@@ -55,6 +55,13 @@ return [
|
||||
'visibility' => 'public',
|
||||
],
|
||||
|
||||
'documents' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/documents'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'private',
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
|
||||
+302
@@ -0,0 +1,302 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of jwt-auth.
|
||||
*
|
||||
* (c) Sean Tymon <tymon148@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT Authentication Secret
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Don't forget to set this in your .env file, as it will be used to sign
|
||||
| your tokens. A helper command is provided for this:
|
||||
| `php artisan jwt:secret`
|
||||
|
|
||||
| Note: This will be used for Symmetric algorithms only (HMAC),
|
||||
| since RSA and ECDSA use a private/public key combo (See below).
|
||||
|
|
||||
*/
|
||||
|
||||
'secret' => env('JWT_SECRET'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT Authentication Keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The algorithm you are using, will determine whether your tokens are
|
||||
| signed with a random string (defined in `JWT_SECRET`) or using the
|
||||
| following public & private keys.
|
||||
|
|
||||
| Symmetric Algorithms:
|
||||
| HS256, HS384 & HS512 will use `JWT_SECRET`.
|
||||
|
|
||||
| Asymmetric Algorithms:
|
||||
| RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
|
||||
|
|
||||
*/
|
||||
|
||||
'keys' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Public Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| A path or resource to your public key.
|
||||
|
|
||||
| E.g. 'file://path/to/public/key'
|
||||
|
|
||||
*/
|
||||
|
||||
'public' => env('JWT_PUBLIC_KEY'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Private Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| A path or resource to your private key.
|
||||
|
|
||||
| E.g. 'file://path/to/private/key'
|
||||
|
|
||||
*/
|
||||
|
||||
'private' => env('JWT_PRIVATE_KEY'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Passphrase
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The passphrase for your private key. Can be null if none set.
|
||||
|
|
||||
*/
|
||||
|
||||
'passphrase' => env('JWT_PASSPHRASE'),
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT time to live
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the length of time (in minutes) that the token will be valid for.
|
||||
| Defaults to 1 hour.
|
||||
|
|
||||
| You can also set this to null, to yield a never expiring token.
|
||||
| Some people may want this behaviour for e.g. a mobile app.
|
||||
| This is not particularly recommended, so make sure you have appropriate
|
||||
| systems in place to revoke the token if necessary.
|
||||
| Notice: If you set this to null you should remove 'exp' element from 'required_claims' list.
|
||||
|
|
||||
*/
|
||||
|
||||
'ttl' => env('JWT_TTL', 60),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Refresh time to live
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the length of time (in minutes) that the token can be refreshed
|
||||
| within. I.E. The user can refresh their token within a 2 week window of
|
||||
| the original token being created until they must re-authenticate.
|
||||
| Defaults to 2 weeks.
|
||||
|
|
||||
| You can also set this to null, to yield an infinite refresh time.
|
||||
| Some may want this instead of never expiring tokens for e.g. a mobile app.
|
||||
| This is not particularly recommended, so make sure you have appropriate
|
||||
| systems in place to revoke the token if necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT hashing algorithm
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the hashing algorithm that will be used to sign the token.
|
||||
|
|
||||
| See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL
|
||||
| for possible values.
|
||||
|
|
||||
*/
|
||||
|
||||
'algo' => env('JWT_ALGO', 'HS256'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Required Claims
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the required claims that must exist in any token.
|
||||
| A TokenInvalidException will be thrown if any of these claims are not
|
||||
| present in the payload.
|
||||
|
|
||||
*/
|
||||
|
||||
'required_claims' => [
|
||||
'iss',
|
||||
'iat',
|
||||
'exp',
|
||||
'nbf',
|
||||
'sub',
|
||||
'jti',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Persistent Claims
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the claim keys to be persisted when refreshing a token.
|
||||
| `sub` and `iat` will automatically be persisted, in
|
||||
| addition to the these claims.
|
||||
|
|
||||
| Note: If a claim does not exist then it will be ignored.
|
||||
|
|
||||
*/
|
||||
|
||||
'persistent_claims' => [
|
||||
'name', 'email', 'type', 'company_id', 'status', 'verification'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Lock Subject
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This will determine whether a `prv` claim is automatically added to
|
||||
| the token. The purpose of this is to ensure that if you have multiple
|
||||
| authentication models e.g. `App\User` & `App\OtherPerson`, then we
|
||||
| should prevent one authentication request from impersonating another,
|
||||
| if 2 tokens happen to have the same id across the 2 different models.
|
||||
|
|
||||
| Under specific circumstances, you may want to disable this behaviour
|
||||
| e.g. if you only have one authentication model, then you would save
|
||||
| a little on token size.
|
||||
|
|
||||
*/
|
||||
|
||||
'lock_subject' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Leeway
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This property gives the jwt timestamp claims some "leeway".
|
||||
| Meaning that if you have any unavoidable slight clock skew on
|
||||
| any of your servers then this will afford you some level of cushioning.
|
||||
|
|
||||
| This applies to the claims `iat`, `nbf` and `exp`.
|
||||
|
|
||||
| Specify in seconds - only if you know you need it.
|
||||
|
|
||||
*/
|
||||
|
||||
'leeway' => env('JWT_LEEWAY', 0),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Blacklist Enabled
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| In order to invalidate tokens, you must have the blacklist enabled.
|
||||
| If you do not want or need this functionality, then set this to false.
|
||||
|
|
||||
*/
|
||||
|
||||
'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Blacklist Grace Period
|
||||
| -------------------------------------------------------------------------
|
||||
|
|
||||
| When multiple concurrent requests are made with the same JWT,
|
||||
| it is possible that some of them fail, due to token regeneration
|
||||
| on every request.
|
||||
|
|
||||
| Set grace period in seconds to prevent parallel request failure.
|
||||
|
|
||||
*/
|
||||
|
||||
'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookies encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default Laravel encrypt cookies for security reason.
|
||||
| If you decide to not decrypt cookies, you will have to configure Laravel
|
||||
| to not encrypt your cookie token by adding its name into the $except
|
||||
| array available in the middleware "EncryptCookies" provided by Laravel.
|
||||
| see https://laravel.com/docs/master/responses#cookies-and-encryption
|
||||
| for details.
|
||||
|
|
||||
| Set it to true if you want to decrypt cookies.
|
||||
|
|
||||
*/
|
||||
|
||||
'decrypt_cookies' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the various providers used throughout the package.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JWT Provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the provider that is used to create and decode the tokens.
|
||||
|
|
||||
*/
|
||||
|
||||
'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the provider that is used to authenticate users.
|
||||
|
|
||||
*/
|
||||
|
||||
'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Storage Provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Specify the provider that is used to store tokens in the blacklist.
|
||||
|
|
||||
*/
|
||||
|
||||
'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
+1
-1
@@ -7,7 +7,7 @@ require_once "vendor/autoload.php";
|
||||
// If you have modified your font directory set this
|
||||
// variable appropriately.
|
||||
//$fontDir = "lib/fonts";
|
||||
|
||||
$fontDir = 'storage/fonts';
|
||||
|
||||
// *** DO NOT MODIFY BELOW THIS POINT ***
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 49 KiB |
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row p-t-25 text-left">
|
||||
<div class="row text-left">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<div class="col p-l-50">
|
||||
<div class="row">
|
||||
<div class="col-auto p-r-0">
|
||||
<div class="b-a b-grey bg-white p-t-20 p-b-20 p-l-45 p-r-45 pointer" :class="{ 'b-primary': parameters.type === 2, 'text-primary': parameters.type === 2, 'b-grey': parameters.type !== 2 }" @click="parameters.type = 2">
|
||||
<div class="b-a b-grey bg-white p-t-20 p-b-20 p-l-45 p-r-45 pointer" :class="{ 'b-primary': parameters.type === 1, 'text-primary': parameters.type === 1, 'b-grey': parameters.type !== 1 }" @click="parameters.type = 1">
|
||||
<div class="m-b-15">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
width="45" height="45"
|
||||
@@ -58,7 +58,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="b-a b-grey bg-white p-t-20 p-b-20 p-l-45 p-r-45 pointer" :class="{ 'b-primary': parameters.type === 1, 'text-primary': parameters.type === 1, 'b-grey': parameters.type !== 1 }" @click="parameters.type = 1">
|
||||
<div class="b-a b-grey bg-white p-t-20 p-b-20 p-l-45 p-r-45 pointer" :class="{ 'b-primary': parameters.type === 0, 'text-primary': parameters.type === 0, 'b-grey': parameters.type !== 0 }" @click="parameters.type = 0">
|
||||
<div class="m-b-15">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
||||
width="45" height="45"
|
||||
@@ -73,7 +73,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-30" v-show="parameters.type === 2">
|
||||
<div class="row m-b-30" v-show="parameters.type === 1">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col p-l-50">
|
||||
@@ -233,7 +233,7 @@
|
||||
name: {required},
|
||||
type: {required},
|
||||
company_name: { required: requiredIf(() => {
|
||||
return this.parameters.type === 2;
|
||||
return this.parameters.type === 1;
|
||||
})
|
||||
},
|
||||
phone: {},
|
||||
@@ -246,7 +246,7 @@
|
||||
name: {required},
|
||||
type: {required},
|
||||
company_name: {
|
||||
required: this.type === 2
|
||||
required: this.type === 1
|
||||
},
|
||||
phone: { required, numeric },
|
||||
wechat_id: {},
|
||||
@@ -261,7 +261,7 @@
|
||||
parameters: {
|
||||
email: this.email,
|
||||
name: '',
|
||||
type: 2,
|
||||
type: 1,
|
||||
company_name: '',
|
||||
phone: '',
|
||||
wechat_id: '',
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
<div class="modal modalContainer" :data-type="this.type">
|
||||
<div class="modal-dialog" v-bind:class="[{'modal-lg': this.large}, {'modal-sm': this.small}]">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header p-t-10 p-r-10 p-l-10">
|
||||
<i class="fa fa-times pointer ml-auto muted" data-dismiss="modal"></i>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="row parentContainer">
|
||||
<div class="col">
|
||||
<div class="requestModal pointer" @click="loadFile" data-type="filePreview">
|
||||
<slot name="button" ></slot>
|
||||
</div>
|
||||
<modal-component styleType="fill-in" type="filePreview">
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<img :src="src" class="w-100" v-if="type !== 'pdf'">
|
||||
<iframe v-if="type === 'pdf'" class="pdf-display w-100 scrollable" style="height: 80vh" :src="'data:application/pdf;base64,'+src"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
file: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
isLoading: false,
|
||||
loaded: false,
|
||||
src: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
type() {
|
||||
return this.file.file.mime_type === 'application/pdf' ? 'pdf' : 'image'
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
loadFile(){
|
||||
if(!this.loaded) {
|
||||
this.isLoading = true;
|
||||
let filePath = this.type === 'pdf' ? this.file.file.file_info.original.file : this.file.file.file_info[0].original.file;
|
||||
this.submit(this.route('api.storage.document.file', filePath)+'/', 'get', 'imagePreviewSection', false, false)
|
||||
}
|
||||
},
|
||||
renderPdf() {
|
||||
this.isLoading = false;
|
||||
},
|
||||
successHandler(response){
|
||||
this.loaded = true;
|
||||
this.src = response.payload.src;
|
||||
this.isLoading = false;
|
||||
|
||||
if(this.type === 'pdf'){
|
||||
this.renderPdf()
|
||||
}
|
||||
},
|
||||
errorHandler(error, statusCode){
|
||||
this.src = statusCode === 404 ? '/images/3231370.jpg' : '/images/2942005.jpg'
|
||||
this.isLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row p-t-25 text-left">
|
||||
<div class="row text-left">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-l-0">
|
||||
<small class="all-caps hint-text text-warning">{{company.status === 2 ? 'Active' : 'Pending Verification'}}</small>
|
||||
<small class="all-caps hint-text text-warning" :class="[{'text-warning': company.status !== 2}, {'text-success': company.status === 2}]">{{company.status === 2 ? 'Active' : 'Pending Verification'}}</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -254,13 +254,37 @@
|
||||
</div>
|
||||
<div class="col pl-0 pl-md-auto p-r-5">
|
||||
<modal-component type="notification">
|
||||
<div class="row p-t-20">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h3 class="bold">Important Notice</h3>
|
||||
</div>
|
||||
</div>
|
||||
<qr-notice-component :id="newOrderId"></qr-notice-component>
|
||||
</modal-component>
|
||||
<modal-component type="wechat">
|
||||
<div class="row">
|
||||
<div class="col p-t-0 p-b-20">
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<div class="font-heading text-success fs-14 bold">Great! You have done all the processes.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-11">**Gentle reminder, our warehouse will reject any parcel that does not contain QR code.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<img src="/images/wechat_insturction.png" class="w-100">
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="font-heading fs-16 bold m-t-5">In order to assist you, and to help you keep track of your parcel, we will create a group on WeChat. <br><br>Please notice the friend request that has been sent by us on WeChat.</r></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
<list-component key="2" section="orderSection" :endpoint="route('api.order.list', id)">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<order-component :data="data" class="b-b b-grey"></order-component>
|
||||
@@ -627,6 +651,11 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
$(this.$el).find('.modalContainer[data-type="notification"]').on('hidden.bs.modal', function () {
|
||||
$('.modalContainer[data-type="wechat"]').modal('show');
|
||||
});
|
||||
|
||||
EventBus.$on('updateAddress', () => {
|
||||
this.fetchProfile();
|
||||
});
|
||||
@@ -636,7 +665,8 @@
|
||||
EventBus.$on('placeOrder', () => {
|
||||
this.$refs.placeOrder.click()
|
||||
});
|
||||
EventBus.$on('newOrder', (orderId) => {
|
||||
EventBus.$on('' +
|
||||
'newOrder', (orderId) => {
|
||||
if(this.company.total_orders === 0){
|
||||
this.fetchProfile();
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
</div>
|
||||
<modal-component type="welcome">
|
||||
<div class="row">
|
||||
<div class="col p-t-20 p-b-20">
|
||||
<div class="col p-t-0 p-b-20">
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<div class="font-heading text-success fs-16 bold">Hello There! Welcome To CIEF Shipping</div>
|
||||
@@ -152,7 +152,7 @@
|
||||
</modal-component>
|
||||
<modal-component type="identification">
|
||||
<div class="row">
|
||||
<div class="col p-t-20 p-b-20">
|
||||
<div class="col p-t-0 p-b-20">
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<div class="font-heading text-success fs-16 bold">Great! You have done the first step.</div>
|
||||
@@ -173,7 +173,7 @@
|
||||
</modal-component>
|
||||
<modal-component type="firstOrder">
|
||||
<div class="row">
|
||||
<div class="col p-t-20 p-b-20">
|
||||
<div class="col p-t-0 p-b-20">
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<div class="font-heading text-success fs-16 bold">Great! You have uploaded your document.</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row p-t-25 text-left">
|
||||
<div class="row text-left">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
|
||||
+3
-2
@@ -8,14 +8,15 @@ export default {
|
||||
method: method,
|
||||
parameters: this.parameters
|
||||
}).then(response => {
|
||||
let success = response.ok;
|
||||
let statusCode = response.status,
|
||||
success = response.ok;
|
||||
|
||||
response.json().then(response => {
|
||||
|
||||
if(!success){
|
||||
|
||||
errorNotification ? this.$store.dispatch('createNotification', {title: response.title, message: response.message, type: 'error'}): null;
|
||||
this.errorHandler(response); return;
|
||||
this.errorHandler(response, statusCode); return;
|
||||
}
|
||||
|
||||
successNotification ? this.$store.dispatch('createNotification', {title: response.title, message: response.message, type: 'success'}): null;
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
@include('vendor/head')
|
||||
</head>
|
||||
<body class="fixed-header horizontal-menu horizontal-app-menu bg-master-lightest">
|
||||
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WDCRHTZ"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
|
||||
<div id="app" style="min-height: 100%;">
|
||||
@yield('content')
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: SimHei;
|
||||
src: url('{{base_path().'/public/'}}simhei.ttf') format('truetype');
|
||||
}
|
||||
* {
|
||||
font-family: SimHei, serif ;
|
||||
}
|
||||
@page { margin: 0px; }
|
||||
body { margin: 0px; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('inner_content')
|
||||
</body>
|
||||
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
@@ -1,68 +1,52 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: SimHei;
|
||||
src: url('{{base_path().'/public/'}}simhei.ttf') format('truetype');
|
||||
}
|
||||
* {
|
||||
font-family: SimHei, serif ;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<style>
|
||||
@page { margin: 0px; }
|
||||
body { margin: 0px; }
|
||||
</style>
|
||||
<body>
|
||||
<table style="width: 100%; border: 2px solid #000000;">
|
||||
<tbody>
|
||||
@for ($i = 0; $i < 4; $i++)
|
||||
<tr>
|
||||
<td align="center" width="30%" style="border: 2px solid #000000;">
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<img src="{{ url('https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl={"hash":"{1*23456}","id":'.$order->id.'}') }}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<h5 style="margin: 0 !important;"><strong>#{{$order->order_number}}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td width="70%" style="border: 2px solid #000000; padding: 15px !important;">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border-bottom: solid 2px #000000;">
|
||||
<h3 style="margin-top: 0px !important; margin-bottom: 10px !important;">@if(strtolower($delivery_address->state) === 'sabah') SB/ @elseif(strtolower($delivery_address->state) === 'sarawak') SRW/ @endif CIEF/{{$marking}}/{{$order->order_number}}</h3>
|
||||
</td>
|
||||
</tr>
|
||||
{{--<tr>--}}
|
||||
{{--<td style="border-bottom: solid 1px #000000;">--}}
|
||||
{{--<h5 style="margin-top: 10px !important; margin-bottom: 10px !important; word-wrap: break-word">{{$delivery_address->street_one.' '.$delivery_address->street_two.' '.$delivery_address->city.' '.$delivery_address->post_code.' '.$delivery_address->state}}</h5>--}}
|
||||
{{--</td>--}}
|
||||
{{--</tr>--}}
|
||||
<tr>
|
||||
<td>
|
||||
<p style="font-size: 12px; margin-bottom: 0 !important; margin-top: 10px !important;">仓库地址:</p>
|
||||
<p style="margin-top: 5px !important; margin-bottom: 5px !important; word-wrap: break-word; font-size: 16px;">{{$warehouse_address->street_one.' '.$warehouse_address->street_two.' '.$warehouse_address->city.' '.$warehouse_address->state.' 邮编:'.$warehouse_address->post_code}}</p>
|
||||
<p style="margin-top: 5px !important; margin-bottom: 0px !important; font-size: 12px;">联系:{{$warehouse_contact[0]->phone.' '.$warehouse_contact[0]->name}} @if(array_key_exists(1, $warehouse_contact)) / {{$warehouse_contact[1]->phone.' '.$warehouse_contact[1]->name}} @endif</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@endfor
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
<table style="width: 100%; border: 2px solid #000000;">
|
||||
<tbody>
|
||||
@for ($i = 0; $i < 4; $i++)
|
||||
<tr>
|
||||
<td align="center" width="30%" style="border: 2px solid #000000;">
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<img src="{{ url('https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl={"hash":"{1*23456}","id":'.$order->id.'}') }}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="center">
|
||||
<td>
|
||||
<h5 style="margin: 0 !important;"><strong>#{{$order->order_number}}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td width="70%" style="border: 2px solid #000000; padding: 15px !important;">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border-bottom: solid 2px #000000;">
|
||||
<h3 style="margin-top: 0px !important; margin-bottom: 10px !important;">@if(strtolower($delivery_address->state) === 'sabah') SB/ @elseif(strtolower($delivery_address->state) === 'sarawak') SRW/ @endif CIEF/{{$marking}}/{{$order->order_number}}</h3>
|
||||
</td>
|
||||
</tr>
|
||||
{{--<tr>--}}
|
||||
{{--<td style="border-bottom: solid 1px #000000;">--}}
|
||||
{{--<h5 style="margin-top: 10px !important; margin-bottom: 10px !important; word-wrap: break-word">{{$delivery_address->street_one.' '.$delivery_address->street_two.' '.$delivery_address->city.' '.$delivery_address->post_code.' '.$delivery_address->state}}</h5>--}}
|
||||
{{--</td>--}}
|
||||
{{--</tr>--}}
|
||||
<tr>
|
||||
<td>
|
||||
<p style="font-size: 12px; margin-bottom: 0 !important; margin-top: 10px !important;">仓库地址:</p>
|
||||
<p style="margin-top: 5px !important; margin-bottom: 5px !important; word-wrap: break-word; font-size: 16px;">{{$warehouse_address->street_one.' '.$warehouse_address->street_two.' '.$warehouse_address->city.' '.$warehouse_address->state.' 邮编:'.$warehouse_address->post_code}}</p>
|
||||
<p style="margin-top: 5px !important; margin-bottom: 0px !important; font-size: 12px;">联系:{{$warehouse_contact[0]->phone.' '.$warehouse_contact[0]->name}} @if(array_key_exists(1, $warehouse_contact)) / {{$warehouse_contact[1]->phone.' '.$warehouse_contact[1]->name}} @endif</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
@endfor
|
||||
</tbody>
|
||||
</table>
|
||||
@endsection
|
||||
|
||||
|
||||
|
||||
Vendored
+10
@@ -1,4 +1,13 @@
|
||||
{{--BEGIN VENDOR JS--}}
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id=%27+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-WDCRHTZ');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
|
||||
<script>
|
||||
window.Laravel = {!! json_encode([
|
||||
'csrfToken' => csrf_token(),
|
||||
@@ -6,6 +15,7 @@
|
||||
'routes' => collect(\Route::getRoutes())->mapWithKeys(function ($route) { return [$route->getName() => $route->uri()]; })
|
||||
]) !!};
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('js/vendor.js') }}" type="text/javascript"></script>
|
||||
<script src="{{asset('vue/app.js')}}"></script>
|
||||
<script src="{{ asset('js/site.js') }}" type="text/javascript"></script>
|
||||
|
||||
@@ -18,6 +18,7 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
require __DIR__ . '/account.php';
|
||||
|
||||
Route::group(['middleware' => 'valid.token'], function () {
|
||||
Route::get('/storage/{fileName}/fetch', 'Documents\RenderDocumentController@fileStorageServe')->where(['fileName' => '.*'])->name('storage.document.file');
|
||||
require __DIR__ . '/crud.php';
|
||||
Route::post('order/create', 'Orders\OrderController@create')->name('order.create');
|
||||
Route::get('orders/{company_id}/list', 'Orders\OrderController@list')->name('order.list');
|
||||
|
||||
@@ -15,6 +15,10 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani
|
||||
|
||||
Route::post('/{id}/document/identification/update', 'UpdateCompanyIdentificationDocumentController@update')->name('document.identification.update');
|
||||
|
||||
Route::group(['prefix' => '{id}/identification', 'as' => 'identification.'], function () {
|
||||
Route::put('/{document_id}/approval/{status}', 'ApproveIdentificationDocumentController@approve')->where('status', 'approve|reject')->name('approval');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'address', 'as' => 'address.', 'namespace' => 'Addresses'], function () {
|
||||
|
||||
+2
-1
@@ -4,5 +4,6 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'document', 'as' => 'document.', 'namespace' => 'Documents'], function () {
|
||||
Route::get('/list', 'ListDocumentsController@list')->name('list');
|
||||
Route::put('/approve/{id}', 'ApproveDocumentController@approve')->name('approve');
|
||||
Route::put('/{id}/approve', 'ApproveDocumentController@approve')->name('status.approve');
|
||||
Route::put('/{id}/reject', 'RejectDocumentController@reject')->name('status.reject');
|
||||
});
|
||||
Reference in New Issue
Block a user