mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-26 16:04:05 +00:00
Merge branch 'dillon/34-jenkins-vapor' into vapor/development
This commit is contained in:
@@ -27,3 +27,7 @@ public/*
|
||||
/storage/app/public
|
||||
public
|
||||
/storage/framework/laravel-excel
|
||||
.vapor/
|
||||
.env.production
|
||||
.env.staging
|
||||
.env.development
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
image: dillonngo/docker-based-image:poc
|
||||
|
||||
stages:
|
||||
- build
|
||||
|
||||
Build:
|
||||
stage: build
|
||||
services:
|
||||
- docker:dind
|
||||
script:
|
||||
- docker info
|
||||
# - npm install
|
||||
# - gulp build
|
||||
- composer install --no-dev
|
||||
- vendor/bin/vapor deploy production --message="$CI_COMMIT_MESSAGE"
|
||||
only:
|
||||
- test
|
||||
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
// Webhook + Gitlab git pull + Vapor
|
||||
|
||||
// def payload = readJSON text: "${payload}"
|
||||
// String userName = payload.user_name
|
||||
// String userEmail = payload.user_email
|
||||
// String httpUrl = payload.project.http_url
|
||||
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image 'dillonngo/docker-based-image:poc'
|
||||
args "--group-add 992 -v /var/run/docker.sock:/var/run/docker.sock"
|
||||
}
|
||||
}
|
||||
environment {
|
||||
HOME = '.'
|
||||
}
|
||||
stages {
|
||||
stage('Download source code from Git') {
|
||||
steps {
|
||||
script{
|
||||
switch(GIT_BRANCH) {
|
||||
case "vapor/production":
|
||||
case "vapor/staging":
|
||||
case "vapor/development":
|
||||
git(
|
||||
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git',
|
||||
credentialsId: 'gitlab-jenkins-localhost',
|
||||
branch: GIT_BRANCH
|
||||
)
|
||||
case "origin/dillon/34-jenkins-vapor":
|
||||
git(
|
||||
url: 'https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git',
|
||||
credentialsId: 'gitlab-jenkins-localhost',
|
||||
branch: 'dillon/34-jenkins-vapor'
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install') {
|
||||
steps {
|
||||
sh 'composer update'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Tests') {
|
||||
steps {
|
||||
sh 'vendor/bin/phpunit tests/Unit'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
script{
|
||||
String gitCommitMessage = getCommitMessage()
|
||||
println("GIT CommitMessage: " + gitCommitMessage)
|
||||
println("GIT GIT_BRANCH: " + GIT_BRANCH)
|
||||
switch(GIT_BRANCH) {
|
||||
case "vapor/production":
|
||||
sh "vendor/bin/vapor deploy production --message='${gitCommitMessage}'"
|
||||
break
|
||||
case "vapor/staging":
|
||||
sh "vendor/bin/vapor deploy staging --message='${gitCommitMessage}'"
|
||||
break
|
||||
case "vapor/development":
|
||||
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
|
||||
break
|
||||
case "origin/dillon/34-jenkins-vapor":
|
||||
sh "vendor/bin/vapor deploy development --message='${gitCommitMessage}'"
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
String getCommitMessage(){
|
||||
commitMessage = " "
|
||||
for ( changeLogSet in currentBuild.changeSets){
|
||||
for (entry in changeLogSet.getItems()){
|
||||
commitMessage = entry.msg
|
||||
}
|
||||
}
|
||||
return commitMessage
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Exceptions;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
|
||||
final class JobResourceNotFoundException extends ServiceApiException {
|
||||
public function __construct(?string $message = null) {
|
||||
parent::__construct($message ?? 'Unable to find the requested resource', HttpStatus::RESOURCE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\Exceptions\JobResourceNotFoundException;
|
||||
|
||||
abstract class AbstractControllerLogic
|
||||
{
|
||||
@@ -67,7 +68,19 @@ abstract class AbstractControllerLogic
|
||||
return $response;
|
||||
|
||||
} catch (ErrorException|GeneralExceptions $exception){
|
||||
log::error($exception);
|
||||
if ($exception instanceof JobResourceNotFoundException) {
|
||||
Log::error(sprintf(
|
||||
"Uncaught exception '%s' with message '%s' in %s:%d",
|
||||
get_class($exception),
|
||||
$exception->getMessage(),
|
||||
$exception->getTrace()[0]['file'],
|
||||
$exception->getTrace()[0]['line']
|
||||
));
|
||||
}
|
||||
else{
|
||||
log::error($exception);
|
||||
}
|
||||
|
||||
return (new ApiResponseObject($this->getNotificationTitle().' failed', $exception->getMessage(),
|
||||
$exception->getCode() ? $exception->getCode() : HttpStatus::SERVER_ERROR))->handler();
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@ namespace App\Classes\General\Eloquent;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Exceptions\JobResourceNotFoundException;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Psy\Exception\ErrorException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
abstract class AbstractFetchRecord extends AbstractGetRecord
|
||||
{
|
||||
@@ -27,12 +29,18 @@ abstract class AbstractFetchRecord extends AbstractGetRecord
|
||||
* @return Model
|
||||
* @throws ResourceNotFoundException
|
||||
*/
|
||||
public function getResults(Builder $query): Model {
|
||||
public function getResults(Builder $query, array $param = []): Model {
|
||||
if(!$query->exists()){
|
||||
throw new ResourceNotFoundException('Unable to find any record based on the criteria provided');
|
||||
$table = $query->getModel()->getTable();
|
||||
if($table ==='job_results'){
|
||||
throw new JobResourceNotFoundException('Unable to find any job based on the criteria provided');
|
||||
}
|
||||
else{
|
||||
throw new ResourceNotFoundException('Unable to find any record based on the criteria provided');
|
||||
}
|
||||
}
|
||||
|
||||
return $query->first();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,25 @@ abstract class AbstractGetRecord
|
||||
return $this->filters->only(self::DECORATION_FILTERS);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @param null|string $json
|
||||
// * @return array
|
||||
// */
|
||||
// public function deserializeFilters(?string $json): array {
|
||||
// return $json !== null ? collect(json_decode($json))->toArray() : [];
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param null|string $json
|
||||
* @param null|string $param
|
||||
* @return array
|
||||
*/
|
||||
public function deserializeFilters(?string $json): array {
|
||||
public function deserializeFilters($param): array {
|
||||
if(gettype($param) == "array"){
|
||||
$json = implode(',', $param);
|
||||
}
|
||||
else{
|
||||
$json = $param;
|
||||
}
|
||||
return $json !== null ? collect(json_decode($json))->toArray() : [];
|
||||
}
|
||||
|
||||
@@ -50,9 +64,9 @@ abstract class AbstractGetRecord
|
||||
* @param array $filters
|
||||
* @return mixed
|
||||
*/
|
||||
public function handler(array $filters){
|
||||
public function handler(array $filters, array $params = []){
|
||||
$this->filters = collect($filters);
|
||||
return $this->getResults($this->applyFiltersToQuery());
|
||||
return $this->getResults($this->applyFiltersToQuery(), $params);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +79,6 @@ abstract class AbstractGetRecord
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
*/
|
||||
abstract function getResults(Builder $query);
|
||||
abstract function getResults(Builder $query, array $params = []);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ abstract class AbstractListRecord extends AbstractGetRecord
|
||||
* @return mixed
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(array $filters = []){
|
||||
public function execute(array $filters = [], array $param = []){
|
||||
|
||||
try{
|
||||
|
||||
return $this->handler($filters);
|
||||
return $this->handler($filters, $param);
|
||||
|
||||
} catch (QueryException $exception){
|
||||
log::error($exception);
|
||||
@@ -30,18 +30,24 @@ abstract class AbstractListRecord extends AbstractGetRecord
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Builder $query
|
||||
* @return mixed
|
||||
*/
|
||||
public function getResults(Builder $query) {
|
||||
public function getResults(Builder $query, array $param = []) {
|
||||
$filters = $this->getDecorationFilters();
|
||||
|
||||
if($filters->has('order_by')){
|
||||
$query = $query->orderBy($filters->get('order_by')->column, $filters->get('order_by')->DESC ? 'DESC': 'ASC');
|
||||
}
|
||||
|
||||
return $filters->has('per_page') ? $query->paginate($filters->get('per_page')) : $query->get();
|
||||
if(!empty($param)){
|
||||
return $filters->has('per_page') ? $query->paginate($filters->get('per_page'), ['*'], 'page', $param['page']) : $query->get();
|
||||
}
|
||||
else{
|
||||
return $filters->has('per_page') ? $query->paginate($filters->get('per_page')) : $query->get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class JobId implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('job_id', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,4 +42,19 @@ class Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $param
|
||||
* @return array
|
||||
*/
|
||||
static function deserializeFilters($param): array {
|
||||
if(gettype($param) == "array"){
|
||||
$json = implode(',', $param);
|
||||
}
|
||||
else{
|
||||
$json = $param;
|
||||
}
|
||||
return $json !== null ? collect(json_decode($json))->toArray() : [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Modules\Bookings\Processors\ListBookingJobProcessor;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\JobResult;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ListBookings implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var ListGenericJobObject */
|
||||
private $listGenericJobObject;
|
||||
|
||||
private $jobId;
|
||||
|
||||
/**
|
||||
* ListBookings constructor.
|
||||
* @param ListGenericJobObject $listGenericJobObject
|
||||
*/
|
||||
public function __construct(ListGenericJobObject $listGenericJobObject)
|
||||
{
|
||||
$this->listGenericJobObject = $listGenericJobObject;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$rawPayload = $this->job->payload();
|
||||
if(isset($rawPayload['data']['commandName'])){
|
||||
$this->listGenericJobObject->setJobCommandName($rawPayload['data']['commandName']);
|
||||
}
|
||||
|
||||
if(isset($rawPayload['data']['command'])){
|
||||
$this->listGenericJobObject->setJobCommand($rawPayload['data']['command']);
|
||||
}
|
||||
|
||||
$result = (App()->make(ListBookingJobProcessor::class))->execute($this->listGenericJobObject);
|
||||
}
|
||||
|
||||
public function getJobId(){
|
||||
return $this->job->getJobId();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Modules\Documents\Processors\ListDocumentJobProcessor;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\JobResult;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ListDocuments implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var ListGenericJobObject */
|
||||
private $listGenericJobObject;
|
||||
|
||||
private $jobId;
|
||||
|
||||
/**
|
||||
* ListDocuments constructor.
|
||||
* @param ListGenericJobObject $listGenericJobObject
|
||||
*/
|
||||
public function __construct(ListGenericJobObject $listGenericJobObject)
|
||||
{
|
||||
$this->listGenericJobObject = $listGenericJobObject;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$rawPayload = $this->job->payload();
|
||||
if(isset($rawPayload['data']['commandName'])){
|
||||
$this->listGenericJobObject->setJobCommandName($rawPayload['data']['commandName']);
|
||||
}
|
||||
|
||||
if(isset($rawPayload['data']['command'])){
|
||||
$this->listGenericJobObject->setJobCommand($rawPayload['data']['command']);
|
||||
}
|
||||
|
||||
$result = (App()->make(ListDocumentJobProcessor::class))->execute($this->listGenericJobObject);
|
||||
|
||||
//cief todo: Insert into DB: job id, query result, timestamp
|
||||
// Store the result in the job_results table
|
||||
|
||||
//cief todo: why cannot save data in table like this
|
||||
// $model = new JobResult();
|
||||
// $model->job_id = $this->job->getJobId();
|
||||
// $model->result = json_encode($result);
|
||||
// $model->save();
|
||||
|
||||
// Log::error(json_encode($model->id));
|
||||
}
|
||||
|
||||
public function getJobId(){
|
||||
return $this->job->getJobId();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\ListTransactionJobProcessor;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\JobResult;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ListTransactions implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var ListGenericJobObject */
|
||||
private $listGenericJobObject;
|
||||
|
||||
private $jobId;
|
||||
|
||||
/**
|
||||
* ListTransactions constructor.
|
||||
* @param ListGenericJobObject $listGenericJobObject
|
||||
*/
|
||||
public function __construct(ListGenericJobObject $listGenericJobObject)
|
||||
{
|
||||
$this->listGenericJobObject = $listGenericJobObject;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$rawPayload = $this->job->payload();
|
||||
if(isset($rawPayload['data']['commandName'])){
|
||||
$this->listGenericJobObject->setJobCommandName($rawPayload['data']['commandName']);
|
||||
}
|
||||
|
||||
if(isset($rawPayload['data']['command'])){
|
||||
$this->listGenericJobObject->setJobCommand($rawPayload['data']['command']);
|
||||
}
|
||||
|
||||
$result = (App()->make(ListTransactionJobProcessor::class))->execute($this->listGenericJobObject);
|
||||
}
|
||||
|
||||
public function getJobId(){
|
||||
return $this->job->getJobId();
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
|
||||
}
|
||||
|
||||
// $this->generateEmailVerificationAttemptProcessor->execute($user);
|
||||
// $this->generateEmailVerificationAttemptProcessor->execute($user); //cief todo
|
||||
|
||||
$this->newCustomerToVoucherifyProcessor->execute($company->id, $user, true);
|
||||
|
||||
@@ -191,12 +191,12 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
// register account on shipping portal
|
||||
$shippingCompanyModuleId = $this->registerOnShippingProcessor->execute($request, $company->id);
|
||||
}
|
||||
|
||||
|
||||
if ($shippingCompanyModuleId) {
|
||||
// create shipping company connection on exchange
|
||||
$this->connectCompanyToShippingCompanyModule->execute($company->id, $shippingCompanyModuleId);
|
||||
}
|
||||
|
||||
|
||||
return $this->response($this->authenticationProcessor->execute($request, false));
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Jobs\ListBookings;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanListBookings;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ListBookingJobLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'List Booking Job',
|
||||
'message' => 'You have successfully submit a job to list bookings'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$jobId = uniqid();
|
||||
|
||||
$user = Auth::user();
|
||||
$userInfo = (object) [
|
||||
'email' => $user->email,
|
||||
'type' => $user->type,
|
||||
];
|
||||
|
||||
$listGenericJobObject = new ListGenericJobObject(
|
||||
$request->fullUrl(),
|
||||
$request->all(),
|
||||
$jobId,
|
||||
$userInfo
|
||||
);
|
||||
|
||||
ListBookings::dispatch($listGenericJobObject);
|
||||
|
||||
$result = [];
|
||||
$result['job_id'] = $jobId;
|
||||
|
||||
return $this->response(['data' => $result]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\Processors;
|
||||
|
||||
use App\Classes\Modules\Bookings\Services\ListsBookings;
|
||||
use App\Classes\Modules\Jobs\Services\CreatesJobResult;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use App\Http\Resources\BookingResource;
|
||||
|
||||
class ListBookingJobProcessor
|
||||
{
|
||||
|
||||
/** @var ListsBookings */
|
||||
private $listsBookings;
|
||||
|
||||
/** @var CreatesJobResult */
|
||||
private $createsJobResult;
|
||||
|
||||
/**
|
||||
* ListBookingJobProcessor constructor.
|
||||
* @param ListsBookings $listsBookings
|
||||
* @param CreatesJobResult $createsJobResult
|
||||
*/
|
||||
public function __construct(ListsBookings $listsBookings, CreatesJobResult $createsJobResult)
|
||||
{
|
||||
$this->listsBookings = $listsBookings;
|
||||
$this->createsJobResult = $createsJobResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ListGenericJobObject $listGenericJobObject
|
||||
* @return null|object
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ListGenericJobObject $listGenericJobObject) {
|
||||
|
||||
$query = $this->listsBookings->execute($this->listsBookings->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page']]);
|
||||
|
||||
//cief todo: remove comments
|
||||
// $result = $this->collectionResponse(BookingResource::collection($query)->userInfo($listGenericJobObject->getuserInfo()));
|
||||
$result = $this->collectionResponse(BookingResource::customResourceCollection($query, $listGenericJobObject->getuserInfo()));
|
||||
|
||||
// $result = new JobBookingCollectionResponse($query, $listGenericJobObject->getuserInfo());
|
||||
// $result = $this->collectionResponse(new BookingResourceCollection(BookingResource::collection($query), $listGenericJobObject->getuserInfo()));
|
||||
|
||||
$create = $this->createsJobResult->execute($listGenericJobObject, json_encode($result));
|
||||
|
||||
return $create;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ResourceCollection $collection
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function collectionResponse(ResourceCollection $collection){
|
||||
return json_decode($collection->response()->getContent(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class GetBookings extends AbstractGetRecord
|
||||
* @return Collection
|
||||
* @throws ResourceNotFoundException
|
||||
*/
|
||||
public function getResults(Builder $query):Collection
|
||||
public function getResults(Builder $query, array $param = []):Collection
|
||||
{
|
||||
if (!$query->exists()) {
|
||||
throw new ResourceNotFoundException('Unable to find any record based on the criteria provided');
|
||||
@@ -48,4 +48,4 @@ class GetBookings extends AbstractGetRecord
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Documents\Services\ListsDocuments;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use App\Classes\Jobs\ListDocuments;
|
||||
use App\Http\Resources\DocumentResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\General\Helper;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ListDocumentJobLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'List Document Job',
|
||||
'message' => 'You have successfully submit a job to list documents'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$jobId = uniqid();
|
||||
|
||||
$user = Auth::user();
|
||||
$userInfo = (object) [
|
||||
'email' => $user->email,
|
||||
'type' => $user->type,
|
||||
];
|
||||
|
||||
|
||||
$listGenericJobObject = new ListGenericJobObject(
|
||||
$request->fullUrl(),
|
||||
$request->all(),
|
||||
$jobId,
|
||||
$userInfo
|
||||
);
|
||||
|
||||
ListDocuments::dispatch($listGenericJobObject);
|
||||
|
||||
//cief todo: remove comments
|
||||
// // Create your job instance with delay, so we can back here within delay and take control in our hands.
|
||||
// $job = new ListDocuments($listGenericJobObject);
|
||||
// $job->delay(now()->addSeconds(5));
|
||||
|
||||
// // Dispath your job with our custom_dispatch helper. This will return job id from jobs table
|
||||
// // $jobId = $this->custom_dispatch($job);
|
||||
|
||||
|
||||
$result = [];
|
||||
$result['job_id'] = $jobId;
|
||||
|
||||
return $this->response(['data' => $result]);
|
||||
}
|
||||
|
||||
//cief todo: no longer need jobId
|
||||
// function custom_dispatch($job): int {
|
||||
// return app(\Illuminate\Contracts\Bus\Dispatcher::class)->dispatch($job);
|
||||
// }
|
||||
}
|
||||
@@ -54,10 +54,18 @@ class ListDocumentLogic extends AbstractControllerLogic
|
||||
|
||||
$this->canListDocuments->passes();
|
||||
|
||||
// dd(json_encode($request->input('filters')));
|
||||
// /"{\"per_page\":30,\"with_owner\":true,\"document_type_in\":[\"PURCHASE_ORDER\"],\"order_by\":{\"column\":\"id\",\"DESC\":true}}"
|
||||
|
||||
// dd(json_encode($this->listsDocuments->deserializeFilters($request->input('filters'))));
|
||||
//{"per_page":30,"with_owner":true,"document_type_in":["INVOICE"],"order_by":{"column":"id","DESC":true}}
|
||||
|
||||
//{"page":"1","filters":"{\"per_page\":30,\"with_owner\":true,\"document_type_in\":[\"PURCHASE_ORDER\"],\"order_by\":{\"column\":\"id\",\"DESC\":true}}"}
|
||||
|
||||
$query = $this->listsDocuments->execute($this->listsDocuments->deserializeFilters($request->input('filters')));
|
||||
|
||||
return $this->collectionResponse(DocumentResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,11 +54,17 @@ class RenderDocumentLogic extends AbstractControllerLogic
|
||||
|
||||
$this->canRenderDocument->passes();
|
||||
|
||||
if(!Storage::disk('documents')->exists($file))
|
||||
// if(!Storage::disk('documents')->exists($file))
|
||||
// {
|
||||
// throw new ResourceNotFoundException();
|
||||
// }
|
||||
|
||||
// return $this->response(['src' => explode('.', $file)[1] == 'pdf' ? chunk_split(base64_encode(Storage::disk('documents')->get($file))) : Storage::disk('documents')->get($file) ]);
|
||||
if(!Storage::disk('s3')->exists($file))
|
||||
{
|
||||
throw new ResourceNotFoundException();
|
||||
}
|
||||
|
||||
return $this->response(['src' => explode('.', $file)[1] == 'pdf' ? chunk_split(base64_encode(Storage::disk('documents')->get($file))) : Storage::disk('documents')->get($file) ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Documents\Processors;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\ListsDocuments;
|
||||
use App\Classes\Modules\Jobs\Services\CreatesJobResult;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use App\Http\Controllers\Documents\ListDocumentsController;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use App\Http\Resources\DocumentResource;
|
||||
|
||||
class ListDocumentJobProcessor
|
||||
{
|
||||
|
||||
/** @var ListsDocuments */
|
||||
private $listsDocuments;
|
||||
|
||||
/** @var CreatesJobResult */
|
||||
private $createsJobResult;
|
||||
|
||||
/**
|
||||
* ListDocumentJobProcessor constructor.
|
||||
* @param ListsDocuments $listsDocuments
|
||||
* @param CreatesJobResult $createsJobResult
|
||||
*/
|
||||
public function __construct(ListsDocuments $listsDocuments, CreatesJobResult $createsJobResult)
|
||||
{
|
||||
$this->listsDocuments = $listsDocuments;
|
||||
$this->createsJobResult = $createsJobResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ListGenericJobObject $listGenericJobObject
|
||||
* @return null|object
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ListGenericJobObject $listGenericJobObject) {
|
||||
|
||||
$query = $this->listsDocuments->execute($this->listsDocuments->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page']]);
|
||||
|
||||
//cief todo: remove comments
|
||||
//attempt 1
|
||||
// $result = $this->collectionResponse(DocumentResource::collection($query, $listGenericJobObject->getuserInfo()));
|
||||
|
||||
//attempt 2
|
||||
// $result = new JobDocumentCollectionResponse($query, $listGenericJobObject->getuserInfo());
|
||||
$result = $this->collectionResponse(DocumentResource::customResourceCollection($query, $listGenericJobObject->getuserInfo()));
|
||||
// $result = $this->collectionResponse(new DocumentResourceCollection(DocumentResource::collection($query), $listGenericJobObject->getuserInfo()));
|
||||
|
||||
$create = $this->createsJobResult->execute($listGenericJobObject, json_encode($result));
|
||||
|
||||
return $create;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ResourceCollection $collection
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function collectionResponse(ResourceCollection $collection){
|
||||
return json_decode($collection->response()->getContent(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,12 +99,15 @@ class ConvertsBase64ToFile
|
||||
*/
|
||||
private function generateFile(FileObject $file, string $suffix = '') {
|
||||
|
||||
$filePath = $this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
|
||||
// $filePath = $this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
|
||||
|
||||
Storage::disk('documents')->put($filePath, $file->getDecodedData());
|
||||
// Storage::disk('documents')->put($filePath, $file->getDecodedData());
|
||||
|
||||
// return $filePath;
|
||||
|
||||
$filePath = 'localhost/'.$file->getFileName().$suffix.'.'.$file->getExtension();
|
||||
Storage::put($filePath, $file->getDecodedData(), 's3');
|
||||
return $filePath;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Generic\DataTransferObjects;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class ListGenericJobObject implements DataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var array */
|
||||
private $payload;
|
||||
|
||||
/** @var string */
|
||||
private $jobId;
|
||||
|
||||
/** @var object */
|
||||
private $userInfo;
|
||||
|
||||
/** @var string */
|
||||
private $jobCommandName;
|
||||
|
||||
/** @var string */
|
||||
private $jobCommand;
|
||||
|
||||
public function __construct(string $name, array $payload, string $jobId, object $userInfo = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->payload = $payload;
|
||||
$this->jobId = $jobId;
|
||||
$this->userInfo = $userInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPayload(): array
|
||||
{
|
||||
return $this->payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getJobId(): string
|
||||
{
|
||||
return $this->jobId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*/
|
||||
public function getUserInfo(): object
|
||||
{
|
||||
return $this->userInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getJobCommandName(): string
|
||||
{
|
||||
return $this->jobCommandName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getJobCommand(): string
|
||||
{
|
||||
return $this->jobCommand;
|
||||
}
|
||||
|
||||
// public function setJobId(int $jobId)
|
||||
// {
|
||||
// $this->jobId = $jobId;
|
||||
// }
|
||||
|
||||
public function setJobCommandName(string $jobCommandName)
|
||||
{
|
||||
$this->jobCommandName = $jobCommandName;
|
||||
}
|
||||
|
||||
public function setJobCommand(string $jobCommand)
|
||||
{
|
||||
$this->jobCommand = $jobCommand;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Jobs\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Jobs\Services\FetchesJobResult;
|
||||
use App\Http\Resources\JobResultResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchJobResultLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Data',
|
||||
'message' => 'You have successfully retrieved data'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesJobResult */
|
||||
private $fetchesJobResult;
|
||||
|
||||
/**
|
||||
* FetchJobResultLogic constructor.
|
||||
* @param FetchesJobResult $fetchesJobResult
|
||||
*/
|
||||
public function __construct(FetchesJobResult $fetchesJobResult)
|
||||
{
|
||||
$this->fetchesJobResult = $fetchesJobResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$query = $this->fetchesJobResult->execute(['job_id' => $request->route('job_id')]);
|
||||
|
||||
return $this->resourceResponse(new JobResultResource($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Jobs\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\JobResult;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
|
||||
class CreatesJobResult extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param string $job_id
|
||||
* @param string $result
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ListGenericJobObject $listGenericJobObject, string $result)
|
||||
{
|
||||
$model = new JobResult();
|
||||
$model->job_id = $listGenericJobObject->getJobId();
|
||||
$model->result = $result;
|
||||
$model->url = $listGenericJobObject->getName();
|
||||
$model->job_command_name = $listGenericJobObject->getJobCommandName();
|
||||
$model->job_command = $listGenericJobObject->getJobCommand();
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Jobs\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\JobResult;
|
||||
|
||||
class FetchesJobResult extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var JobResult */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* FetchesJobResult constructor.
|
||||
* @param JobResult $repository
|
||||
*/
|
||||
public function __construct(JobResult $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Jobs\ListTransactions;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListTransactionsJobLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'List Transaction Job',
|
||||
'message' => 'You have successfully submit a job to list transactions'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$jobId = uniqid();
|
||||
|
||||
$listGenericJobObject = new ListGenericJobObject(
|
||||
$request->fullUrl(),
|
||||
$request->all(),
|
||||
$jobId
|
||||
);
|
||||
|
||||
ListTransactions::dispatch($listGenericJobObject);
|
||||
|
||||
$result = [];
|
||||
$result['job_id'] = $jobId;
|
||||
|
||||
return $this->response(['data' => $result]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Modules\Transactions\Services\ListsTransactions;
|
||||
use App\Classes\Modules\Jobs\Services\CreatesJobResult;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\Modules\Generic\DataTransferObjects\ListGenericJobObject;
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
use App\Http\Resources\TransactionResource;
|
||||
|
||||
class ListTransactionJobProcessor
|
||||
{
|
||||
|
||||
/** @var ListsTransactions */
|
||||
private $listsTransactions;
|
||||
|
||||
/** @var CreatesJobResult */
|
||||
private $createsJobResult;
|
||||
|
||||
/**
|
||||
* ListTransactionJobProcessor constructor.
|
||||
* @param ListsTransactions $listsTransactions
|
||||
* @param CreatesJobResult $createsJobResult
|
||||
*/
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesJobResult $createsJobResult)
|
||||
{
|
||||
$this->listsTransactions = $listsTransactions;
|
||||
$this->createsJobResult = $createsJobResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ListGenericJobObject $listGenericJobObject
|
||||
* @return null|object
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ListGenericJobObject $listGenericJobObject) {
|
||||
|
||||
$query = $this->listsTransactions->execute($this->listsTransactions->deserializeFilters($listGenericJobObject->getPayload()['filters']), ['page' => $listGenericJobObject->getPayload()['page']]);
|
||||
|
||||
$result = $this->collectionResponse(TransactionResource::collection($query));
|
||||
|
||||
$create = $this->createsJobResult->execute($listGenericJobObject, json_encode($result));
|
||||
|
||||
return $create;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ResourceCollection $collection
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function collectionResponse(ResourceCollection $collection){
|
||||
return json_decode($collection->response()->getContent(), true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AWS;
|
||||
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
|
||||
|
||||
class AWSImageUploadController extends Controller
|
||||
|
||||
{
|
||||
|
||||
public function imageUpload()
|
||||
{
|
||||
return view('pages.aws_image_upload');
|
||||
}
|
||||
|
||||
|
||||
public function imageUploadPost(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
]);
|
||||
|
||||
$imageName = time().'.'.$request->image->extension();
|
||||
|
||||
$request->image->storeAs('images', $imageName);
|
||||
|
||||
//cief todo: checking if storage disk exist
|
||||
if (Storage::disk('documents')) {
|
||||
$check1 = "The disk documents exists.";
|
||||
} else {
|
||||
$check1 = "The disk documents does not exist.";
|
||||
}
|
||||
|
||||
// $diskNames = Storage::diskNames();
|
||||
|
||||
// if (count($diskNames) > 0) {
|
||||
// $check2 = "The following disks are configured: " . implode(', ', $diskNames);
|
||||
// } else {
|
||||
// $check2 = "No storage disks are configured.";
|
||||
// }
|
||||
|
||||
|
||||
if (Storage::disk('public')) {
|
||||
$check2 = "The disk public exists.";
|
||||
} else {
|
||||
$check2 = "The disk public does not exist.";
|
||||
}
|
||||
|
||||
if (Storage::disk('local')) {
|
||||
$check3 = "The disk local exists.";
|
||||
} else {
|
||||
$check3 = "The disk local does not exist.";
|
||||
}
|
||||
|
||||
|
||||
return redirect()->back()
|
||||
->with('success','You have successfully upload image.')
|
||||
->with('image',$imageName)
|
||||
->with('check1', $check1)
|
||||
->with('check2', $check2)
|
||||
->with('check3', $check3);
|
||||
}
|
||||
|
||||
|
||||
public function displayImage($fileName)
|
||||
{
|
||||
// dd($fileName);
|
||||
|
||||
//1.
|
||||
// $path = 'images/'.$fileName;
|
||||
// $url = Storage::url($path);
|
||||
// $url = Storage::temporaryUrl('file.jpg', now()->addMinutes(5));
|
||||
// return $url;
|
||||
|
||||
|
||||
//2
|
||||
// $path = 'images/'.$fileName;
|
||||
// // if(Storage::disk('s3')->exists($path)){
|
||||
// return Storage::disk('s3')->get($path);
|
||||
// // }
|
||||
// return null;
|
||||
|
||||
|
||||
//original
|
||||
$path = 'images/'.$fileName;
|
||||
$file = Storage::get($path);
|
||||
$type = Storage::mimeType($path);
|
||||
|
||||
$response = Response::make($file, 200);
|
||||
$response->header("Content-Type", $type);
|
||||
return $response;
|
||||
|
||||
// $path = 'images/'.$fileName;
|
||||
// return Storage::temporaryUrl($path, now()->addMinutes(5));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Bookings;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\ListBookingJobLogic;
|
||||
|
||||
|
||||
class ListBookingsJobController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListBookingJobLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
||||
public function list(Request $request, ListBookingJobLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Documents;
|
||||
|
||||
use App\Classes\Modules\Documents\ControllersLogic\ListDocumentJobLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Jobs\ListDocuments;
|
||||
|
||||
class ListDocumentsJobController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListDocumentJobLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListDocumentJobLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Services;
|
||||
|
||||
use App\Classes\Modules\Jobs\ControllersLogic\FetchJobResultLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchJobResultController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchJobResultLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchJobResultLogic $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\ListTransactionsJobLogic;
|
||||
|
||||
|
||||
class ListTransactionsJobController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListTransactionsJobLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListTransactionsJobLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,19 @@ use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BookingResource extends JsonResource
|
||||
{
|
||||
// protected $userInfo;
|
||||
private static $userInfo;
|
||||
|
||||
public function userInfo($resource, $userInfo = null)
|
||||
{
|
||||
parent::__construct($resource);
|
||||
self::$userInfo = $userInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
@@ -27,7 +36,7 @@ class BookingResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'company' => new CompanyResource($this->company),
|
||||
'company' => new CompanyResource($this->company, self::$userInfo),
|
||||
'bank' => new BankResource($this->bank),
|
||||
'service' => new ServiceTypeResource($this->service),
|
||||
'marking' => $this->marking,
|
||||
@@ -72,4 +81,10 @@ class BookingResource extends JsonResource
|
||||
])
|
||||
];
|
||||
}
|
||||
|
||||
public static function customResourceCollection($resource, $userInfo): AnonymousResourceCollection
|
||||
{
|
||||
self::$userInfo = $userInfo;
|
||||
return parent::collection($resource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,14 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CompanyResource extends JsonResource
|
||||
{
|
||||
protected $userInfo;
|
||||
|
||||
public function __construct($resource, $userInfo = null)
|
||||
{
|
||||
parent::__construct($resource);
|
||||
$this->userInfo = $userInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
@@ -33,6 +41,28 @@ class CompanyResource extends JsonResource
|
||||
$segment = SegmentConstant::where('reference', SegmentConstants::SUPPLIER_CURRENCIES)->where('detail->id', $this->id)->first();
|
||||
$serviceCharge = SegmentConstant::where('reference', SegmentConstants::SERVICE_CHARGE)->where('detail->id', $this->id)->first();
|
||||
|
||||
$userResource = null;
|
||||
|
||||
$userInfoEmail = $this->userInfo && isset($this->userInfo->email) ? $this->userInfo->email : null;
|
||||
$userInfoType = $this->userInfo && isset($this->userInfo->type) ? $this->userInfo->type : null;
|
||||
|
||||
if(!$userInfoEmail && Auth::user()){
|
||||
$userInfoEmail = Auth::user()->email;
|
||||
}
|
||||
if(!$userInfoType && Auth::user()){
|
||||
$userInfoType = Auth::user()->type;
|
||||
}
|
||||
|
||||
//cief todo: remove
|
||||
// Log::error('CompanyResource 1: '. json_encode($userInfoEmail));
|
||||
// Log::error('CompanyResource 2: '. json_encode($userInfoType));
|
||||
|
||||
if(!is_null($userInfoEmail) && !is_null($userInfoType)){
|
||||
//cief todo: to review following merge conflict
|
||||
//new UserResource(Auth::user() && Auth::user()->type === RoleTypes::USER ? $this->employees()->where('email', '=', Auth::user()->email)->first() : $this->employees()->orderBy('id', 'DESC')->first()),
|
||||
$userResource = new UserResource($userInfoType === RoleTypes::USER ? $this->employees()->where('email', '=', $userInfoEmail)->first() : $this->employees()->orderBy('id', 'DESC')->first());
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'shipping_company_module_id' => $this->shippingCompanyConnection ? $this->shippingCompanyConnection->shipping_company_module_id : null,
|
||||
@@ -44,7 +74,8 @@ class CompanyResource extends JsonResource
|
||||
'status' => (int) $this->status,
|
||||
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
|
||||
'address' => new AddressResource($this->when($this->has('addresses'), $this->addresses->where('billing', true)->first())),
|
||||
'employee' => new UserResource(Auth::user() && Auth::user()->type === RoleTypes::USER ? $this->employees()->where('email', '=', Auth::user()->email)->first() : $this->employees()->orderBy('id', 'DESC')->first()),
|
||||
//cief todo: this one need to decide what to do to replace Auth:user() when it is run by job queue
|
||||
'employee' => $userResource,
|
||||
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->first()),
|
||||
'bookings' => $this->whenLoaded('bookings', $this->bookings()->orderBy('id', 'DESC')->get(), []),
|
||||
'confirmed_bookings' => $this->bookings()->whereHas('transactions', function ($query){
|
||||
|
||||
@@ -8,9 +8,21 @@ use App\Models\Document;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
||||
|
||||
class DocumentResource extends JsonResource
|
||||
{
|
||||
// protected $userInfo;
|
||||
|
||||
// public function userInfo($resource, $userInfo = null)
|
||||
// {
|
||||
// $this->userInfo = $userInfo;
|
||||
// }
|
||||
|
||||
private static $userInfo;
|
||||
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
@@ -19,14 +31,23 @@ class DocumentResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
//cief todo: remove
|
||||
// Log::error('DocumentResource 1: '. json_encode(self::$userInfo));
|
||||
// Log::error('DocumentResource 2: '. json_encode($this->relationLoaded('owner')));
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
'status' => (int) $this->status,
|
||||
'document_type' => $this->document_type,
|
||||
'owner' => $this->relationLoaded('owner') ? ($this->owner instanceof Booking ? new BookingResource($this->owner) : new CompanyResource($this->owner)) : null,
|
||||
'owner' => $this->relationLoaded('owner') ? ($this->owner instanceof Booking ? new BookingResource($this->owner, self::$userInfo) : new CompanyResource($this->owner, self::$userInfo)) : null,
|
||||
'files' => FileResource::collection($this->files),
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A')
|
||||
];
|
||||
}
|
||||
|
||||
public static function customResourceCollection($resource, $userInfo): AnonymousResourceCollection
|
||||
{
|
||||
self::$userInfo = $userInfo;
|
||||
return parent::collection($resource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class JobResultResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'job_id' => $this->job_id,
|
||||
'result' => $this->result,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class JobResult extends AbstractModel
|
||||
{
|
||||
protected $table = 'job_results';
|
||||
|
||||
public $fillable = [
|
||||
'job_id',
|
||||
'result'
|
||||
];
|
||||
}
|
||||
@@ -24,6 +24,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
if (!file_exists(storage_path('framework/sessions'))) {
|
||||
mkdir(storage_path('framework/sessions'), 0777, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -9,6 +9,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.2.5",
|
||||
"ext-bcmath": "*",
|
||||
"ext-fileinfo": "*",
|
||||
"ext-json": "*",
|
||||
"ext-zip": "*",
|
||||
@@ -21,6 +22,8 @@
|
||||
"intervention/image": "^2.5",
|
||||
"laravel/framework": "^8.0",
|
||||
"laravel/tinker": "^2.0",
|
||||
"laravel/vapor-cli": "^1.55",
|
||||
"laravel/vapor-core": "^2.33",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"mpdf/mpdf": "^8.1",
|
||||
"rinvex/countries": "^6.1",
|
||||
@@ -31,8 +34,7 @@
|
||||
"staudenmeir/eloquent-has-many-deep": "^1.7",
|
||||
"timehunter/laravel-google-recaptcha-v3": "~2.5",
|
||||
"tymon/jwt-auth": "^1.0",
|
||||
"webklex/laravel-pdfmerger": "^1.3",
|
||||
"ext-bcmath": "*"
|
||||
"webklex/laravel-pdfmerger": "^1.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.3.6",
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateJobResultsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('job_results', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('job_id', 50);
|
||||
$table->longText('result');
|
||||
$table->timestamps();
|
||||
|
||||
// $table->foreign('job_id')->references('id')->on('jobs')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('job_results');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddNewColumnToJobResultsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('job_results', function (Blueprint $table) {
|
||||
$table->string('url')->after('result')->nullable();
|
||||
$table->string('job_command_name')->after('url')->nullable();
|
||||
$table->longText('job_command')->after('job_command_name')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('job_results', function (Blueprint $table) {
|
||||
$table->dropColumn('url');
|
||||
$table->dropColumn('job_command_name');
|
||||
$table->dropColumn('job_command');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM laravelphp/vapor:php74
|
||||
|
||||
COPY . /var/task
|
||||
@@ -45,6 +45,8 @@ services:
|
||||
volumes:
|
||||
- ../:/var/www/html
|
||||
- ./php/default.conf:/usr/local/etc/php-fpm.d/zz-docker.conf
|
||||
ports:
|
||||
- "9002:9000"
|
||||
networks:
|
||||
- exchange-staging
|
||||
#################################################################
|
||||
|
||||
@@ -3,6 +3,7 @@ daemonize = no
|
||||
|
||||
[www]
|
||||
listen = 9000
|
||||
php_admin_value[max_execution_time] = 60
|
||||
|
||||
pm.max_children = 15
|
||||
pm.max_requests = 500
|
||||
|
||||
+8
-7
@@ -12,33 +12,34 @@
|
||||
"dependencies": {
|
||||
"animate.css": "^4.1.1",
|
||||
"bootstrap": "^4.0.0",
|
||||
"bootstrap-datepicker": "^1.7.1",
|
||||
"bootstrap-datepicker": "^1.10.0",
|
||||
"chart.js": "^2.9.4",
|
||||
"dropzone": "^5.7.2",
|
||||
"epic-spinners": "^1.1.0",
|
||||
"flag-icon-css": "^3.5.0",
|
||||
"font-awesome": "^4.7.0",
|
||||
"intro.js": "^3.1.0",
|
||||
"jquery": "^3.2",
|
||||
"jquery": "^3.7.0",
|
||||
"jquery.scrollbar": "^0.2.11",
|
||||
"jwt-decode": "^3.1.2",
|
||||
"laravel-vapor": "^0.6.0",
|
||||
"noty": "^3.2.0-beta",
|
||||
"perfect-scrollbar": "^1.5.0",
|
||||
"popper.js": "^1.12",
|
||||
"sass-loader": "10.1.0",
|
||||
"select2": "^4.0.6-rc.1",
|
||||
"v-money": "^0.8.1",
|
||||
"vue": "^2.6.10",
|
||||
"vue": "^2.7.14",
|
||||
"vue-avatar": "^2.1.8",
|
||||
"vue-debounce": "^2.6.0",
|
||||
"vue-template-compiler": "^2.6.10",
|
||||
"vue-template-compiler": "^2.7.14",
|
||||
"vue-the-mask": "^0.11.1",
|
||||
"vuelidate": "^0.7.4",
|
||||
"vuex": "^3.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.0",
|
||||
"chromatic": "^6.5.4",
|
||||
"chromatic": "^6.21.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"del": "^6.0.0",
|
||||
"fancy-log": "^1.3.0",
|
||||
@@ -54,14 +55,14 @@
|
||||
"gulp-plumber": "^1.1.0",
|
||||
"gulp-print": "^5.0.2",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-replace": "^1.0.0",
|
||||
"gulp-replace": "^1.1.4",
|
||||
"gulp-sass": "^4.1.0",
|
||||
"gulp-streamify": "^1.0.2",
|
||||
"gulp-uglify": "^3.0.0",
|
||||
"gulp-uglify-es": "^2.0.0",
|
||||
"laravel-mix": "^5.0.9",
|
||||
"lodash": "^4.17.13",
|
||||
"resolve-url-loader": "^3.1.2"
|
||||
"resolve-url-loader": "^3.1.5"
|
||||
},
|
||||
"paths": {
|
||||
"build": {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM laravelphp/vapor:php74
|
||||
|
||||
COPY . /var/task
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 MiB |
Vendored
+6
-1
@@ -28,6 +28,10 @@ import { debounce } from 'vue-debounce'
|
||||
|
||||
import Avatar from 'vue-avatar';
|
||||
|
||||
import Vapor from 'laravel-vapor';
|
||||
// Vapor.withBaseAssetUrl(import.meta.env.VITE_VAPOR_ASSET_URL);
|
||||
window.Vapor = Vapor;
|
||||
|
||||
/** Application Injections */
|
||||
Vue.use(vuelidate);
|
||||
Vue.use(VueTheMask);
|
||||
@@ -36,7 +40,8 @@ Vue.use(filters);
|
||||
Vue.directive('closable', closable);
|
||||
Vue.mixin({
|
||||
methods: {
|
||||
route: route
|
||||
route: route,
|
||||
asset: window.Vapor.asset
|
||||
},
|
||||
mixins: [request, crudHandler]
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="col-12 col-lg-5 padding-25 d-none d-md-inline">
|
||||
<div class="row h-100 align-items-end">
|
||||
<div class="col no-padding">
|
||||
<img src="/images/2829248.png" class="w-100">
|
||||
<img :src="asset('images/2829248.png')" class="w-100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -98,4 +98,4 @@
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
+4
-4
@@ -117,11 +117,11 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list')" :options="{per_page: 5, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id}">
|
||||
<list-polling-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list.job')" :options="{per_page: 5, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<supplier-pending-order-component :data="data" v-on:input="updateOrder($event)"></supplier-pending-order-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -165,7 +165,7 @@
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.submit(route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]}), 'get', 'pendingOrdersSection', false, false)
|
||||
this.submit(route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [1, 2, 0]}), 'get', 'pendingOrdersSection', false, false); //cief todo: Uncaught (in promise) null
|
||||
},
|
||||
methods: {
|
||||
successHandler(response){
|
||||
@@ -210,4 +210,4 @@
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<div class="col bg-white padding-15">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<img class="m-b-10 w-100" src="/images/1688_approved.png" />
|
||||
<img class="m-b-10 w-100" :src="asset('images/1688_approved.png')" />
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
<div class="col-4">
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
<template>
|
||||
<transition-component group enter-class="animate__animated animate__fadeInUp animate__delay-1 animate__faster p-r-30" leave-class="animate__animated animate__fadeOutDown 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="!$store.getters.isLoading(section)">
|
||||
<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 && !isLoading && 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">
|
||||
<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" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="list disable-text-selection" data-check-all="checkAll">
|
||||
<div class="row" ref="list" v-for="item in $store.getters.getListData(section)" v-bind:key="item.id" :data="item">
|
||||
<div class="col">
|
||||
<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,
|
||||
required: true
|
||||
},
|
||||
options: {
|
||||
default () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
emptyListSection: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
filters: this.options,
|
||||
pollingInterval: null,
|
||||
isPolling: false,
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.setDecoratorDefault();
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section, 'page': 1, 'filters': this.filters}); //cief todo: Uncaught (in promise) null
|
||||
},
|
||||
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);
|
||||
let url = this.endpoint + '?page=' + listDecorators.page + '&filters=' + JSON.stringify(listDecorators.filters);
|
||||
this.isLoading = true;
|
||||
this.submitJob(url);
|
||||
},
|
||||
//cief todo: remove?
|
||||
// updateFilters(filters){
|
||||
// this.filters = filters;
|
||||
// this.setDecoratorDefault();
|
||||
// console.log('updateFilters');
|
||||
// this.submit(this.endpoint + '?page=1&filters=' + JSON.stringify(this.filters), 'get', this.section, false, false); //cief todo: Uncaught (in promise) null
|
||||
// },
|
||||
successHandler(response){
|
||||
let result = JSON.parse(response.payload.data.result);
|
||||
result.meta = {
|
||||
current_page: result.meta.current_page,
|
||||
first_page_url: result.meta.first_page_url,
|
||||
from: result.meta.from,
|
||||
last_page: result.meta.last_page,
|
||||
last_page_url: result.meta.last_page_url,
|
||||
next_page_url: result.meta.next_page_url,
|
||||
path: result.meta.path,
|
||||
per_page: result.meta.per_page,
|
||||
prev_page_url: result.meta.prev_page_url,
|
||||
to: result.meta.to,
|
||||
total: result.meta.total
|
||||
};
|
||||
|
||||
console.log('ListPolling:', JSON.stringify(result.meta));
|
||||
this.stopPolling();
|
||||
this.$store.dispatch('completeList', {'name': this.section, 'data': result.data});
|
||||
this.$refs.pagination.makePagination(result.meta, result.links);
|
||||
this.isLoading = false;
|
||||
},
|
||||
errorHandler(error){
|
||||
// console.log('ListPolling error:', JSON.stringify(error));
|
||||
this.isPolling = false;
|
||||
// this.isLoading = false;
|
||||
},
|
||||
startPolling(jobId) {
|
||||
// this.fetchJobResult(jobId); // Start immediately
|
||||
this.pollingInterval = setInterval(() => {
|
||||
if (this.isPolling) {
|
||||
return;
|
||||
}
|
||||
this.isPolling = true;
|
||||
this.fetchJobResult(jobId); // Replace with the actual job ID
|
||||
}, 10000); // Poll every 5 seconds
|
||||
},
|
||||
stopPolling() {
|
||||
clearInterval(this.pollingInterval);
|
||||
this.pollingInterval = null;
|
||||
this.isPolling = false;
|
||||
},
|
||||
submitJob(url){
|
||||
try {
|
||||
this.$store.dispatch('crudRequest', {endpoint: url, method: 'get'}).then(response => {
|
||||
let success = response.ok;
|
||||
response.json().then(response => {
|
||||
if(!success){return;}
|
||||
let jobId = response.payload.data.job_id;
|
||||
if(jobId){
|
||||
this.startPolling(jobId);
|
||||
}
|
||||
});
|
||||
})
|
||||
// this.job.progress = response.data.progress;
|
||||
// this.job.completed = response.data.completed;
|
||||
|
||||
// if (this.job.completed) {
|
||||
// this.stopPolling();
|
||||
// }
|
||||
} catch (error) {
|
||||
console.error('Error submitJob', error);
|
||||
}
|
||||
},
|
||||
fetchJobResult(jobId) {
|
||||
try {
|
||||
let anotherEndpoint = route('api.job.fetch', jobId);
|
||||
this.submit(anotherEndpoint, 'get', this.section, false, false); //cief todo: Uncaught (in promise) null
|
||||
} catch (error) {
|
||||
console.error('Error fetchJobResult', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
+28
-2
@@ -2,7 +2,21 @@ export default {
|
||||
actions: {
|
||||
crudRequest({getters, dispatch}, {endpoint, method, parameters}){
|
||||
return dispatch('ensureReCaptchaIsSet').then(function () {
|
||||
return fetch(endpoint, {
|
||||
const queryDomain = endpoint.split('?')[0];
|
||||
let encodedParams = endpoint.split('?')[1];
|
||||
let decodedParams = fullyDecodeURI(encodedParams);
|
||||
const queryParams = encodeURIComponent(decodedParams);
|
||||
encodedParams = queryParams.toString();
|
||||
let filteredEncodedParams = encodedParams.replace(/%3D/g,'=');
|
||||
filteredEncodedParams = filteredEncodedParams.replace(/%26/g,'&');
|
||||
console.log('filteredEncodedParams: ', filteredEncodedParams);
|
||||
console.log('queryDomain: ', queryDomain);
|
||||
let combinedAbsoluteUrl = queryDomain;
|
||||
if(filteredEncodedParams !== undefined && filteredEncodedParams !== 'undefined'){
|
||||
combinedAbsoluteUrl = queryDomain + '?' + filteredEncodedParams;
|
||||
console.log('combinedAbsoluteUrl: ', combinedAbsoluteUrl);
|
||||
}
|
||||
return fetch(queryDomain + '?' + filteredEncodedParams, {
|
||||
method: method,
|
||||
responseType: 'json',
|
||||
body: parameters ? JSON.stringify(parameters):null,
|
||||
@@ -23,4 +37,16 @@ export default {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isEncoded(uri) {
|
||||
uri = uri || '';
|
||||
return uri !== decodeURIComponent(uri);
|
||||
}
|
||||
|
||||
function fullyDecodeURI(uri){
|
||||
while (isEncoded(uri)){
|
||||
uri = decodeURIComponent(uri);
|
||||
}
|
||||
return uri;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('vendor/head')
|
||||
</head>
|
||||
<style>
|
||||
.grecaptcha-badge {
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<body class="horizontal-menu horizontal-app-menu bg-master-lightest overflow-hidden">
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TQKCPCD"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<div id="app" style="min-height: 100%;">
|
||||
<div id="grecaptcha_container"></div>
|
||||
@yield('content')
|
||||
</div>
|
||||
@include('vendor/js')
|
||||
@stack('scripts')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,26 @@
|
||||
@extends('layouts.base_debug')
|
||||
|
||||
@section('content')
|
||||
<div class="row d-md-none" style="display: none;" v-show="$store.getters.isShowing('sideMenu')" >
|
||||
<div class="col absolute bg-master w-100 h-100" style="opacity: 0.3; z-index: 9998; left: 0px;"></div>
|
||||
<div class="col-8 bg-master-lightest position-fixed h-100" style="z-index: 9999" >
|
||||
@include('partials.menu')
|
||||
</div>
|
||||
</div>
|
||||
@include('partials.header')
|
||||
<div class="page-container">
|
||||
<div class="page-content-wrapper p-b-50" style="padding-top: 70px;">
|
||||
<div class="content pt-md-auto pt-4">
|
||||
<div class="container-fluid p-0 px-sm-5 container-fixed-lg">
|
||||
<div class="row no-margin">
|
||||
<div class="col">
|
||||
@yield('inner_content')
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@@ -0,0 +1,45 @@
|
||||
@extends('layouts.base_portal')
|
||||
@section('inner_content')
|
||||
<div class="container">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-body">
|
||||
<p>Session: {{ session('image') }}</p>
|
||||
<p>check1: {{ session('check1') }}</p>
|
||||
<p>check2: {{ session('check2') }}</p>
|
||||
<p>check3: {{ session('check3') }}</p>
|
||||
@if ($message = session('success'))
|
||||
<div class="alert alert-success alert-block">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ $message }}</strong>
|
||||
</div>
|
||||
<img src="{{ route('aws.image.displayImage', session('image')) }}" style="width: 400px">
|
||||
@endif
|
||||
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> There were some problems with your input.
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<form action="{{ route('aws.image.upload.post') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="file" name="image" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<button type="submit" class="btn btn-success">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -95,37 +95,37 @@
|
||||
<div class="row no-margin">
|
||||
<div class="col bg-white padding-25">
|
||||
<div class="row tabsContainer tabContent m-l-0 m-r-0" tab-name="invoice">
|
||||
<list-component key="2" section="invoiceSection" :endpoint="route('api.document.list')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['INVOICE']}">
|
||||
<list-polling-component key="2" section="invoiceSection" :endpoint="route('api.document.list.job')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['INVOICE']}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<billing-document-component :data="data"></billing-document-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent m-l-0 m-r-0 hide" tab-name="purchase-order">
|
||||
<list-component key="2" section="purchaseOrderSection" :endpoint="route('api.document.list')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['PURCHASE_ORDER']}">
|
||||
</list-polling-component>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent m-l-0 m-r-0 hide" tab-name="purchase-order">
|
||||
<list-polling-component key="2" section="purchaseOrderSection" :endpoint="route('api.document.list.job')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['PURCHASE_ORDER']}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<billing-document-component :data="data"></billing-document-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent m-l-0 m-r-0 hide" tab-name="delivery-order">
|
||||
<list-component key="2" section="deliveryOrderSection" :endpoint="route('api.document.list')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['DELIVER_ORDER']}">
|
||||
</list-polling-component>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent m-l-0 m-r-0 hide" tab-name="delivery-order">
|
||||
<list-polling-component key="2" section="deliveryOrderSection" :endpoint="route('api.document.list.job')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['DELIVER_ORDER']}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<billing-document-component :data="data"></billing-document-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent m-l-0 m-r-0 hide" tab-name="supplier-delivery-order">
|
||||
<list-component key="2" section="SupplierDeliveryOrderSection" :endpoint="route('api.document.list')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['SUPPLIER_DELIVER_ORDER']}">
|
||||
<list-polling-component key="2" section="SupplierDeliveryOrderSection" :endpoint="route('api.document.list.job')" :options="{'per_page': 30, 'with_owner': true, 'document_type_in': ['SUPPLIER_DELIVER_ORDER']}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<billing-document-component :data="data"></billing-document-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@@ -70,11 +70,11 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="paymentVerificationSection" :endpoint="route('api.transaction.list')" :options="{'payment_approvals': true}">
|
||||
<list-polling-component key="2" section="paymentVerificationSection" :endpoint="route('api.transaction.list.job')" :options="{'payment_approvals': true}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<payment-verification-component section="paymentVerificationSection" :data="data"></payment-verification-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,11 +83,11 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="listRefundTransactionSection" :endpoint="route('api.transaction.list')" :options="{'type': 6, status: 1}">
|
||||
<list-polling-component key="2" section="listRefundTransactionSection" :endpoint="route('api.transaction.list.job')" :options="{'type': 6, status: 1}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<refund-verification-component section="listRefundTransactionSection" :data="data"></refund-verification-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -180,11 +180,11 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component ref="paymentProofList" section="paymentProofSection" :endpoint="route('api.transaction.list')" :options="{status: 1, type: 3, issuer_not_in: [2185, 1970, 1921]}">
|
||||
<list-polling-component ref="paymentProofList" section="paymentProofSection" :endpoint="route('api.transaction.list.job')" :options="{status: 1, type: 3, issuer_not_in: [2185, 1970, 1921]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<payment-proof-component :data="data"></payment-proof-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -202,11 +202,11 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="poPendingApprovalSection" :endpoint="route('api.booking.list')" :options="{per_page: 10, purchase_order_approval: true, status_in: [2]}">
|
||||
<list-polling-component key="2" section="poPendingApprovalSection" :endpoint="route('api.booking.list.job')" :options="{per_page: 10, purchase_order_approval: true, status_in: [2]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<booking-component :data="data"></booking-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -220,11 +220,11 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="poPendingSubmissionSection" :endpoint="route('api.booking.list')" :options="{per_page: 10, pending_purchase_order: true, has_payment_status_in: [2, 3]}">
|
||||
<list-polling-component key="2" section="poPendingSubmissionSection" :endpoint="route('api.booking.list.job')" :options="{per_page: 10, pending_purchase_order: true, has_payment_status_in: [2, 3]}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<booking-component :data="data"></booking-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -296,11 +296,11 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="identificationVerificationSection" :options="{'per_page': 5, 'document_type_in': ['SSM_REGISTRATION', 'IDENTITY_CARD'], 'status': 1, 'with_company': true}" :endpoint="route('api.document.list')">
|
||||
<list-polling-component key="2" section="identificationVerificationSection" :options="{'per_page': 5, 'document_type_in': ['SSM_REGISTRATION', 'IDENTITY_CARD'], 'status': 1, 'with_company': true}" :endpoint="route('api.document.list.job')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<identification-verification-component section="identificationVerificationSection" :data="data"></identification-verification-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</list-polling-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row no-margin">
|
||||
<div class="col p-l-0 p-t-20 p-b-20 sm-text-center">
|
||||
<small class="small no-margin pull-left sm-pull-reset all-caps fs-10 muted" style=" letter-spacing: 1px; ">Copyright © {{ date('Y') }} CIEF Exchange. All rights reserved.</small>
|
||||
<small class="small no-margin pull-left sm-pull-reset all-caps fs-10 muted" style=" letter-spacing: 1px; ">Copyright © {{ date('Y') }} CIEF Exchange. All rights reserved. Powered by Laravel Vapor.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END COPYRIGHT -->
|
||||
<!-- END COPYRIGHT -->
|
||||
|
||||
@@ -78,6 +78,10 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
|
||||
require __DIR__ . '/milestone.php';
|
||||
|
||||
// require __DIR__ . '/accounting.php'; //cief todo: To check if this is needed
|
||||
|
||||
require __DIR__ . '/job.php';
|
||||
|
||||
// require __DIR__ . '/rate.php';
|
||||
// require __DIR__ . '/receipt.php';
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Bookings'], function () {
|
||||
Route::get('/show/{marking}', 'FetchBookingController@fetch')->name('show');
|
||||
Route::get('/list', 'ListBookingsController@list')->name('list');
|
||||
Route::get('/list/job', 'ListBookingsJobController@list')->name('list.job');
|
||||
Route::post('/create', 'CreateBookingController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdateBookingController@update')->name('update');
|
||||
Route::put('/recipient/update/{id}', 'UpdateBookingRecipientController@update')->name('update.recipient');
|
||||
|
||||
+2
-1
@@ -10,7 +10,8 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani
|
||||
Route::put('/update/{id}', 'UpdateCompanyController@update')->name('update');
|
||||
Route::put('/update/{id}/profile', 'UpdateCompanyProfileController@update')->name('profile.update');
|
||||
Route::put('update/{id}/status', 'UpdateCompanyStatusController@update')->name('status.update');
|
||||
Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');
|
||||
// Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');
|
||||
Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('destroy');
|
||||
Route::put('/name-and-debtor/update/{id}', 'UpdateCompanyNameAndDebtorController@update')->name('update.nameAndDebtor');
|
||||
|
||||
Route::get('/business-type/list', 'ListBusinessTypesController@list')->name('business_type.list');
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
|
||||
+2
-1
@@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'document', 'as' => 'document.', 'namespace' => 'Documents'], function () {
|
||||
Route::get('/list', 'ListDocumentsController@list')->name('list');
|
||||
Route::get('/list/job', 'ListDocumentsJobController@list')->name('list.job');
|
||||
Route::delete('/{id}/delete', 'DeleteDocumentController@delete')->name('delete');
|
||||
Route::put('/{id}/approve', 'ApproveDocumentController@approve')->name('status.approve');
|
||||
Route::put('/{id}/reject', 'RejectDocumentController@reject')->name('status.reject');
|
||||
|
||||
Route::put('/{id}/reference/update', 'UpdateDocumentReferenceController@update')->name('reference.update');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'job', 'as' => 'job.', 'namespace' => 'Services'], function () {
|
||||
Route::get('/fetch/{job_id}', 'FetchJobResultController@fetch')->name('fetch');
|
||||
});
|
||||
@@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' => 'transaction.'], function () {
|
||||
|
||||
Route::get('/list', 'ListTransactionsController@list')->name('list');
|
||||
Route::get('/list/job', 'ListTransactionsJobController@list')->name('list.job');
|
||||
Route::delete('/suspend/{id}', 'SuspendTransactionController@suspend')->name('suspend');
|
||||
|
||||
route::post('/supplier/{id}/bill/create', 'CreateSupplierTransactionController@create')->name('supplier.create');
|
||||
@@ -19,7 +20,7 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
|
||||
Route::post('booking/{id}/details/import', 'ImportPurchaseOrderTransactionController@import')->name('po.import');
|
||||
|
||||
Route::get('bulk/po/{issuer_id}/{start_date}/{end_date}', 'CreateBulkPurchaseOrderTransactionController@create')->name('po.bulk.create');
|
||||
|
||||
|
||||
Route::get('wallet/list', 'ListWalletTransactionsController@list')->name('wallet.list');
|
||||
|
||||
Route::get('/company/{id}/account/balance', 'FetchCompanyAccountBalanceController@fetch')->name('company.account.balance');
|
||||
@@ -34,4 +35,4 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
|
||||
Route::post('/{id}/approve', 'CreateBulkPurchaseOrderDocumentController@aprove')->name('approve');
|
||||
Route::post('/bulk/po', 'CreateBulkPurchaseOrderDocumentController@create')->name('bulk.po');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+36
-23
@@ -157,7 +157,7 @@ Route::get('/support', function () {
|
||||
'company' => null,
|
||||
'booking' => null
|
||||
]);
|
||||
})->name('support');
|
||||
})->name('support.fetch'); //duplicate name
|
||||
|
||||
Route::post('/support', function (Request $request) {
|
||||
|
||||
@@ -191,7 +191,7 @@ Route::post('/support', function (Request $request) {
|
||||
'booking' => $booking,
|
||||
]);
|
||||
|
||||
})->name('support');
|
||||
})->name('support'); //duplicate name
|
||||
|
||||
Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callback')->name('online_payment.redirect');
|
||||
|
||||
@@ -203,7 +203,7 @@ Route::get('/export/customers/leads', 'Exports\ExportCustomersToExcelController@
|
||||
|
||||
Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) {
|
||||
return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
})->name('products.random');
|
||||
})->name('products.random.1'); //duplicate name
|
||||
|
||||
Route::get('/fix_bills', function () {
|
||||
ini_set('max_execution_time', '1000000');
|
||||
@@ -232,7 +232,7 @@ Route::get('/fix_bills', function () {
|
||||
}
|
||||
|
||||
|
||||
})->name('products.random');
|
||||
})->name('products.random.2'); //duplicate name
|
||||
|
||||
Route::get('/wallet/{marking}/details', function ($marking) {
|
||||
$company = \App\Models\Company::where('reference', '=', $marking)->first();
|
||||
@@ -278,7 +278,7 @@ Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsP
|
||||
})->get();
|
||||
dd($bookings->count());
|
||||
return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
})->name('products.random');
|
||||
})->name('products.random.3');
|
||||
|
||||
Route::get('/auto-purchase-order-fill', 'Bookings\AutoPurchaseOrderFillController@auto')->name('assign');
|
||||
|
||||
@@ -582,24 +582,24 @@ Route::get('/1688/fix/{reference}', function($reference){
|
||||
//
|
||||
// (App()->make(createPurchaseOrderFor1688OrderProcessor::class))->execute($document->owner);
|
||||
// }
|
||||
})->name('ecommerce.fix');
|
||||
})->name('ecommerce.fix'); //duplicate name
|
||||
|
||||
Route::get('/po/manual/fix', function(){
|
||||
// Route::get('/po/manual/fix', function(){
|
||||
|
||||
// $bookings = Booking::whereIn('company_id', [199, 510])->whereHas('documents', function($query){
|
||||
// return $query->where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER);
|
||||
// })->get();
|
||||
//
|
||||
// foreach ($bookings as $booking){
|
||||
// $booking->status = ApprovalStatus::APPROVED;
|
||||
// $booking->save();
|
||||
//
|
||||
// $booking->documents()->whereIn('document_type', [DocumentType::PURCHASE_ORDER, DocumentType::DELIVER_ORDER, DocumentType::INVOICE, DocumentType::SUPPLIER_DELIVER_ORDER])->delete();
|
||||
// $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->update(['status' => ApprovalStatus::PENDING_SUBMISSION]);
|
||||
//
|
||||
// }
|
||||
// // $bookings = Booking::whereIn('company_id', [199, 510])->whereHas('documents', function($query){
|
||||
// // return $query->where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER);
|
||||
// // })->get();
|
||||
// //
|
||||
// // foreach ($bookings as $booking){
|
||||
// // $booking->status = ApprovalStatus::APPROVED;
|
||||
// // $booking->save();
|
||||
// //
|
||||
// // $booking->documents()->whereIn('document_type', [DocumentType::PURCHASE_ORDER, DocumentType::DELIVER_ORDER, DocumentType::INVOICE, DocumentType::SUPPLIER_DELIVER_ORDER])->delete();
|
||||
// // $booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->update(['status' => ApprovalStatus::PENDING_SUBMISSION]);
|
||||
// //
|
||||
// // }
|
||||
|
||||
})->name('ecommerce.fix');
|
||||
// })->name('ecommerce.fix'); //duplicate name
|
||||
|
||||
Route::get('/payment/check', function(){
|
||||
|
||||
@@ -818,13 +818,13 @@ Route::get('/invoice/{marking}/{started_at}/{ended_at}/fix', function($marking,
|
||||
->withTrashed()
|
||||
->orderBy('created_at', 'asc')
|
||||
->first();
|
||||
|
||||
|
||||
// get the first bill_no
|
||||
$firstBillNo = $firstInvoice->bill_no;
|
||||
if (strpos($firstBillNo, '-deleted') !== false) {
|
||||
$firstBillNo = substr($firstBillNo, 0, strpos($firstBillNo, '-deleted'));
|
||||
}
|
||||
|
||||
|
||||
// update currentInvoice bill_no to '-deleted-'
|
||||
$currentInvoice = $booking->transactions()->where('type', TransactionType::INVOICE)->first();
|
||||
$currentInvoice->bill_no = $currentInvoice->bill_no ."-deleted-" . Str::random(10);
|
||||
@@ -849,4 +849,17 @@ Route::get('/invoice/{marking}/{started_at}/{ended_at}/fix', function($marking,
|
||||
);
|
||||
})->name('invoice.fix.byCustomerMarking');
|
||||
|
||||
Route::get('/booking/{marking}/track-shipping-order', 'Bookings\TrackBookingShipmentController@track')->name('booking.track_shipping_order');
|
||||
Route::get('/booking/{marking}/track-shipping-order', 'Bookings\TrackBookingShipmentController@track')->name('booking.track_shipping_order');
|
||||
|
||||
//cief todo: To mark new api for laravel-vapor
|
||||
Route::get('/aws-image-upload', 'AWS\AWSImageUploadController@imageUpload')->name('aws.image.upload');
|
||||
Route::post('/aws-image-upload', 'AWS\AWSImageUploadController@imageUploadPost')->name('aws.image.upload.post');
|
||||
Route::get('/aws-image/{filename}', 'AWS\AWSImageUploadController@displayImage')->name('aws.image.displayImage');
|
||||
|
||||
Route::get('/token', function (Request $request) {
|
||||
$token = $request->session()->token();
|
||||
echo $token;
|
||||
$token = csrf_token();
|
||||
echo $token;
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
FROM laravelphp/vapor:php74
|
||||
|
||||
COPY . /var/task
|
||||
@@ -0,0 +1,57 @@
|
||||
id: 53427
|
||||
name: exchange
|
||||
separate-vendor: true
|
||||
environments:
|
||||
development:
|
||||
memory: 1024
|
||||
cli-memory: 512
|
||||
runtime: 'php-8.2:al2'
|
||||
build:
|
||||
- 'COMPOSER_MIRROR_PATH_REPOS=1 composer install --no-dev'
|
||||
- 'php artisan event:cache'
|
||||
- 'npm ci && npm run prod && rm -rf node_modules'
|
||||
production:
|
||||
domain: production.exchange.izyim.com
|
||||
memory: 1024
|
||||
cli-memory: 512
|
||||
database: cief-rds-mysql
|
||||
storage: exchange-2.0-production
|
||||
runtime: docker
|
||||
timeout: 180
|
||||
build:
|
||||
- 'composer update'
|
||||
- 'npm install'
|
||||
- 'npm run dev'
|
||||
- 'gulp build'
|
||||
deploy:
|
||||
- 'php artisan migrate --force'
|
||||
staging:
|
||||
domain: staging.exchange.izyim.com
|
||||
memory: 1024
|
||||
cli-memory: 512
|
||||
database: cief-rds-mysql
|
||||
storage: exchange-2.0-staging
|
||||
runtime: docker
|
||||
timeout: 180
|
||||
build:
|
||||
- 'composer update'
|
||||
- 'npm install'
|
||||
- 'npm run dev'
|
||||
- 'gulp build'
|
||||
deploy:
|
||||
- 'php artisan migrate --force'
|
||||
development:
|
||||
domain: dev.exchange.izyim.com
|
||||
memory: 1024
|
||||
cli-memory: 512
|
||||
database: cief-rds-mysql
|
||||
storage: exchange-2.0-development
|
||||
runtime: docker
|
||||
timeout: 180
|
||||
build:
|
||||
- 'composer update'
|
||||
- 'npm install'
|
||||
- 'npm run dev'
|
||||
- 'gulp build'
|
||||
deploy:
|
||||
- 'php artisan migrate --force'
|
||||
Reference in New Issue
Block a user