mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-24 06:54:02 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -63,6 +63,7 @@ class AuthenticateUserLogic extends AbstractControllerLogic
|
||||
return $this->response(['access_token' => $token, 'redirect_url' => $this->authenticationRedirect->url()]);
|
||||
|
||||
} catch (\Exception $exception){
|
||||
dd($exception);
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\AuthenticationCredentialsObject;
|
||||
use App\Classes\Modules\Accounts\Services\AuthenticatesUser;
|
||||
use App\Classes\Modules\Accounts\Services\AuthenticationRedirect;
|
||||
use App\Classes\Modules\Accounts\Services\FetchesUser;
|
||||
use App\Classes\Modules\Accounts\Standards\Rules\CanAuthenticateUser;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\ValueObjects\Constants\Notifications;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckEmailLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'User found',
|
||||
'message' => 'Account Already Exists'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesUser */
|
||||
private $fetchesUser;
|
||||
|
||||
|
||||
/**
|
||||
* CheckEmailLogic constructor.
|
||||
* @param FetchesUser $fetchesUser
|
||||
*/
|
||||
public function __construct(FetchesUser $fetchesUser)
|
||||
{
|
||||
$this->fetchesUser = $fetchesUser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
protected function logic(Request $request): JsonResponse {
|
||||
|
||||
try {
|
||||
|
||||
$this->fetchesUser->execute(['email' => $request->input('email')]);
|
||||
|
||||
return $this->response();
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Accounts\Services\ListsUsers;
|
||||
use App\Classes\Modules\Accounts\Standards\Rules\CanListUsers;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Http\Resources\UserResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListUsersLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'List Users',
|
||||
'message' => 'You have successfully retrieved a list of users'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanListUsers */
|
||||
private $canListUser;
|
||||
|
||||
/** @var ListsUsers */
|
||||
private $listsUsers;
|
||||
|
||||
/**
|
||||
* ListUsersControllerLogic constructor.
|
||||
* @param CanListUsers $canListUser
|
||||
* @param ListsUsers $listsUsers
|
||||
*/
|
||||
public function __construct(CanListUsers $canListUser, ListsUsers $listsUsers)
|
||||
{
|
||||
$this->canListUser = $canListUser;
|
||||
$this->listsUsers = $listsUsers;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canListUser->passes();
|
||||
|
||||
$query = $this->listsUsers->execute($this->listsUsers->deserializeFilters($request->input('filters')));
|
||||
|
||||
return $this->collectionResponse(UserResource::collection($query));
|
||||
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,11 +2,18 @@
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\Roles;
|
||||
|
||||
class AuthenticationRedirect
|
||||
{
|
||||
|
||||
public function url(){
|
||||
return route('dashboard');
|
||||
|
||||
if(\Auth::user()->hasRole('Shadow Admin') || \Auth::user()->hasRole('Ultimate Admin')){
|
||||
return route('dashboard.forwarder');
|
||||
}
|
||||
|
||||
// return route('dashboard.importer', ['id' => Auth()->user()->employers->first()->company->id]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListsUsers extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var User */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsUsers constructor.
|
||||
* @param User $repository
|
||||
*/
|
||||
public function __construct(User $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\PasswordResetObject;
|
||||
use App\Classes\Modules\Accounts\Standards\Criteria\PasswordResetTokenExists;
|
||||
use App\Classes\Modules\Accounts\Standards\Validators\ResetPasswordValidation;
|
||||
|
||||
class CanListUsers extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PasswordResetObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param PasswordResetObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateCompanyLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Company',
|
||||
'message' => 'You have successfully created a new Company'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/**
|
||||
* CreateCompanyLogic constructor.
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
*/
|
||||
public function __construct(CreateCompanyProcessor $createCompanyProcessor)
|
||||
{
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($this->createCompanyProcessor->execute($request)));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\DeletesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanDeleteCompany;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteCompanyLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Deleted Company',
|
||||
'message' => 'You have successfully deleted a Company'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var CanDeleteCompany */
|
||||
private $canDeleteCompany;
|
||||
|
||||
/** @var DeletesCompany */
|
||||
private $deletesCompany;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/**
|
||||
* DeleteCompanyLogic constructor.
|
||||
* @param CanDeleteCompany $canDeleteCompany
|
||||
* @param DeletesCompany $deletesCompany
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
*/
|
||||
public function __construct(CanDeleteCompany $canDeleteCompany, DeletesCompany $deletesCompany, FetchesCompany $fetchesCompany)
|
||||
{
|
||||
$this->canDeleteCompany = $canDeleteCompany;
|
||||
$this->deletesCompany = $deletesCompany;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canDeleteCompany->passes();
|
||||
|
||||
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->deletesCompany->execute($query);
|
||||
|
||||
return $this->response([]);
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanFetchCompany;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchCompanyLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Company',
|
||||
'message' => 'You have successfully retrieved a Company'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanFetchCompany */
|
||||
private $canFetchCompany;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/**
|
||||
* FetchCompanyControllerLogic constructor.
|
||||
* @param CanFetchCompany $canFetchCompany
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
*/
|
||||
public function __construct(CanFetchCompany $canFetchCompany, FetchesCompany $fetchesCompany)
|
||||
{
|
||||
$this->canFetchCompany = $canFetchCompany;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$this->canFetchCompany->passes();
|
||||
|
||||
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($query));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllerLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\ListsCompanies;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanListCompanies;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListCompaniesLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Companies',
|
||||
'message' => 'You have successfully retrieved a list of Companies'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanListCompanies */
|
||||
private $canListCompanies;
|
||||
|
||||
/** @var ListsCompanies */
|
||||
private $listsCompanies;
|
||||
|
||||
/**
|
||||
* ListCompaniesControllerLogic constructor.
|
||||
* @param CanListCompanies $canListCompanies
|
||||
* @param ListsCompanies $listsCompanies
|
||||
*/
|
||||
public function __construct(CanListCompanies $canListCompanies, ListsCompanies $listsCompanies)
|
||||
{
|
||||
$this->canListCompanies = $canListCompanies;
|
||||
$this->listsCompanies = $listsCompanies;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
$this->canListCompanies->passes();
|
||||
|
||||
$query = $this->listsCompanies->execute($this->listsCompanies->deserializeFilters($request->input('filters')));
|
||||
return $this->collectionResponse(CompanyResource::collection($query));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Company',
|
||||
'message' => 'You have successfully updated the Company'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateCompany */
|
||||
private $canUpdateCompany;
|
||||
|
||||
/** @var UpdatesCompany */
|
||||
private $updatesCompany;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/**
|
||||
* UpdateCompanyControllerLogic constructor.
|
||||
* @param CanUpdateCompany $canUpdateCompany
|
||||
* @param UpdatesCompany $updatesCompany
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
*/
|
||||
public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompany $updatesCompany, FetchesCompany $fetchesCompany)
|
||||
{
|
||||
$this->canUpdateCompany = $canUpdateCompany;
|
||||
$this->updatesCompany = $updatesCompany;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$object = new CompanyObject($request->input('reference_no'), $request->input('name'), $request->input('type'));
|
||||
|
||||
$this->canUpdateCompany->passes($object);
|
||||
|
||||
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
$query = $this->updatesCompany->execute($query, $object);
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($query));
|
||||
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\DataTransferObjects;
|
||||
|
||||
|
||||
use App\Models\CompanyModule;
|
||||
|
||||
class ConnectionObject
|
||||
{
|
||||
|
||||
/** @var CompanyModule */
|
||||
private $inviter;
|
||||
|
||||
/** @var CompanyModule */
|
||||
private $invitee;
|
||||
|
||||
/**
|
||||
* ConnectionObject constructor.
|
||||
* @param CompanyModule $inviter
|
||||
* @param CompanyModule $invitee
|
||||
*/
|
||||
public function __construct(CompanyModule $inviter, CompanyModule $invitee)
|
||||
{
|
||||
$this->inviter = $inviter;
|
||||
$this->invitee = $invitee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompanyModule
|
||||
*/
|
||||
public function getInviter(): CompanyModule
|
||||
{
|
||||
return $this->inviter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompanyModule
|
||||
*/
|
||||
public function getInvitee(): CompanyModule
|
||||
{
|
||||
return $this->invitee;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\DataTransferObjects;
|
||||
|
||||
use App\Classes\Interfaces\DataTransferObject;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\User;
|
||||
|
||||
class EmployeeObject implements DataTransferObject
|
||||
{
|
||||
/** @var CompanyModule */
|
||||
private $companyModule;
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/** @var int */
|
||||
private $role;
|
||||
|
||||
/**
|
||||
* EmployeeObject constructor.
|
||||
* @param CompanyModule $companyModule
|
||||
* @param User $user
|
||||
* @param int $role
|
||||
*/
|
||||
public function __construct(CompanyModule $companyModule, User $user, int $role)
|
||||
{
|
||||
$this->companyModule = $companyModule;
|
||||
$this->user = $user;
|
||||
$this->role = $role;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompanyModule
|
||||
*/
|
||||
public function getCompanyModule(): CompanyModule
|
||||
{
|
||||
return $this->companyModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
public function getUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRole(): int
|
||||
{
|
||||
return $this->role;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\DataTransferObjects;
|
||||
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
class ModuleObject
|
||||
{
|
||||
|
||||
/** @var Company */
|
||||
private $company;
|
||||
|
||||
/** @var int */
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* ModuleObject constructor.
|
||||
* @param Company $company
|
||||
* @param int $type
|
||||
*/
|
||||
public function __construct(Company $company, int $type)
|
||||
{
|
||||
$this->company = $company;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Company
|
||||
*/
|
||||
public function getCompany(): Company
|
||||
{
|
||||
return $this->company;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getType(): int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\Company;
|
||||
|
||||
class ListsCompanies extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var Company */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsCompanies constructor.
|
||||
* @param Company $repository
|
||||
*/
|
||||
public function __construct(Company $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
|
||||
class CanDeleteCompany extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
|
||||
class CanFetchCompany extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
|
||||
class CanListCompanies extends AbstractRule
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param CompanyObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Receipts\Standards\Rules\CanCreateReceipt;
|
||||
use App\Classes\Modules\Receipts\Standards\Rules\CanCreateReceiptDetail;
|
||||
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptObject;
|
||||
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptDetailObject;
|
||||
use App\Classes\Modules\Receipts\Services\CreatesReceipt;
|
||||
use App\Classes\Modules\Receipts\Services\CreatesReceiptDetail;
|
||||
use App\Classes\Modules\Receipts\Services\GeneratesReceiptBillNo;
|
||||
use App\Http\Resources\ReceiptResource;
|
||||
use App\Http\Resources\ReceiptDetailResource;
|
||||
|
||||
use App\Classes\Modules\Currencies\Services\FetchesCurrency;
|
||||
use App\Classes\Modules\Currencies\Services\RateCalculatesCurrency;
|
||||
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateReceiptLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Receipt',
|
||||
'message' => 'You have successfully created a receipt'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var GeneratesReceiptBillNo */
|
||||
private $generatesReceiptBillNo;
|
||||
|
||||
/** @var CanCreateReceipt */
|
||||
private $canCreateReceipt;
|
||||
|
||||
private $fetchesCurrency;
|
||||
|
||||
private $rateCalculatesCurrency;
|
||||
|
||||
private $fetchesCompany;
|
||||
|
||||
private $createsReceipt;
|
||||
|
||||
private $canCreateReceiptDetail;
|
||||
|
||||
private $createsReceiptDetail;
|
||||
|
||||
private $fetchesTransaction;
|
||||
/**
|
||||
* CreateWalletLogic constructor.
|
||||
* @param CreatesWallet $createsWallet
|
||||
* @param GeneratesWalletCode $generatesWalletCode
|
||||
* @param CanCreateCompanyWallet $canCreateCompanyWallet
|
||||
*/
|
||||
public function __construct(
|
||||
GeneratesReceiptBillNo $generatesReceiptBillNo, CanCreateReceipt $canCreateReceipt,
|
||||
FetchesCurrency $fetchesCurrency,RateCalculatesCurrency $rateCalculatesCurrency, FetchesCompany $fetchesCompany,
|
||||
CreatesReceipt $createsReceipt,
|
||||
CanCreateReceiptDetail $canCreateReceiptDetail, CreatesReceiptDetail $createsReceiptDetail,
|
||||
FetchesTransaction $fetchesTransaction
|
||||
){
|
||||
$this->generatesReceiptBillNo = $generatesReceiptBillNo;
|
||||
$this->canCreateReceipt = $canCreateReceipt;
|
||||
$this->fetchesCurrency = $fetchesCurrency;
|
||||
$this->rateCalculatesCurrency = $rateCalculatesCurrency;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createsReceipt =$createsReceipt;
|
||||
$this->canCreateReceiptDetail =$canCreateReceiptDetail;
|
||||
$this->createsReceiptDetail = $createsReceiptDetail;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
DB::beginTransaction();
|
||||
$json_array = json_decode($request->getContent(), true);
|
||||
$company = $this->fetchesCompany->execute(['id' => $json_array['company_id']]);
|
||||
|
||||
$conversion_currency = $this->fetchesCurrency->execute(['id' => $json_array['currency_id']]);
|
||||
$convertable_currency = $this->fetchesCurrency->execute(['id' => 1]);//MYR
|
||||
$convert_amount = $this->rateCalculatesCurrency->execute($conversion_currency, $convertable_currency, $json_array['amount']);
|
||||
$convert_rate = $this->rateCalculatesCurrency->execute_rate($conversion_currency, $convertable_currency);
|
||||
|
||||
$object = new ReceiptObject(
|
||||
$this->generatesReceiptBillNo->execute(),$json_array['trans_type1'],$json_array['trans_type2'],
|
||||
number_format( (float) $convert_amount, 5, '.', ''), 1 , number_format( (float) $json_array['amount'], 5, '.', ''),
|
||||
$json_array['currency_id'],number_format( (float) $convert_rate, 5, '.', ''),
|
||||
$json_array['dt_transaction'],1,$request->route('id'),
|
||||
$company->id
|
||||
);
|
||||
|
||||
|
||||
$this->canCreateReceipt->passes($object);
|
||||
|
||||
$receipt = $this->createsReceipt->execute($object);
|
||||
|
||||
$receipt_array = new ReceiptResource($receipt);
|
||||
$receipt_detail_array = array();
|
||||
|
||||
foreach ($json_array['receipt_detail'] as $key => $value) {
|
||||
|
||||
$transaction_inv = $this->fetchesTransaction->execute(['id' => $value['transaction_id']]);
|
||||
|
||||
$object_detail = new ReceiptDetailObject(
|
||||
$json_array['trans_type1'],$json_array['trans_type2'],
|
||||
$transaction_inv->id,$receipt->id,
|
||||
number_format( (float) $convert_amount, 5, '.', ''), number_format( (float) $json_array['amount'], 5, '.', '')
|
||||
);
|
||||
$this->canCreateReceiptDetail->passes($object_detail);
|
||||
$transaction_detail = $this->createsReceiptDetail->execute($object_detail);
|
||||
//array_push($stack, "apple", "raspberry");
|
||||
$receipt_detail_resource= new ReceiptDetailResource($transaction_detail);
|
||||
$receipt_detail_array[]= $receipt_detail_resource->toArray($request);
|
||||
|
||||
}
|
||||
|
||||
//$transaction_array['transaction_detail']= $transaction_detail_array;
|
||||
//print_r($transaction_detail_array);
|
||||
//dd($transaction_detail_array);
|
||||
DB::commit();
|
||||
|
||||
return $this->resourceResponse($receipt_array);
|
||||
//return $this->resourceResponse($json_array);
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\DataTransferObjects;
|
||||
|
||||
use App\Classes\Interfaces\DataTransferObject;
|
||||
|
||||
class ReceiptDetailObject implements DataTransferObject
|
||||
{
|
||||
|
||||
|
||||
private $trans_type1;
|
||||
|
||||
private $trans_type2;
|
||||
|
||||
private $transaction_id;
|
||||
|
||||
private $receipt_id;
|
||||
|
||||
private $price;
|
||||
|
||||
private $amount;
|
||||
|
||||
|
||||
public function __construct(
|
||||
string $trans_type1,string $trans_type2,
|
||||
int $transaction_id, int $receipt_id,
|
||||
float $price,float $amount
|
||||
){
|
||||
$this->trans_type1= $trans_type1;
|
||||
$this->trans_type2 = $trans_type2;
|
||||
$this->transaction_id = $transaction_id;
|
||||
$this->receipt_id = $receipt_id;
|
||||
$this->price = $price;
|
||||
$this->amount = $amount;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTransType1(): string
|
||||
{
|
||||
return $this->trans_type1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTransType2(): string
|
||||
{
|
||||
return $this->trans_type2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTransactionId(): int
|
||||
{
|
||||
return $this->transaction_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getReceiptId(): int
|
||||
{
|
||||
return $this->receipt_id;
|
||||
}
|
||||
|
||||
public function getPrice(): float
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
public function getAmount(): float
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\DataTransferObjects;
|
||||
|
||||
use App\Classes\Interfaces\DataTransferObject;
|
||||
|
||||
class ReceiptObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/*
|
||||
*
|
||||
* return [
|
||||
'id' => $this->id,
|
||||
'trans_type1' => $this->trans_type1,
|
||||
'trans_type2' => $this->trans_type2,
|
||||
'bill_no' => (int) $this->bill_no,
|
||||
'amount' => (double) $this->amount,
|
||||
'currency_id' => (int) $this->currency_id,
|
||||
'original_amount' => (double) $this->original_amount,
|
||||
'original_currency_id' => (int) $this->original_currency_id,
|
||||
'currency_rate' => (double) $this->currency_rate,
|
||||
'dt_transaction' => $this->dt_transaction,
|
||||
'status' => (int) $this->status,
|
||||
'booking_id' => (int) $this->booking_id,
|
||||
'company_id' => (int) $this->company_id
|
||||
];
|
||||
*/
|
||||
private $trans_type1;
|
||||
|
||||
private $trans_type2;
|
||||
|
||||
private $bill_no;
|
||||
|
||||
private $amount;
|
||||
|
||||
private $currency_id;
|
||||
|
||||
private $original_amount;
|
||||
|
||||
private $original_currency_id;
|
||||
|
||||
private $currency_rate;
|
||||
|
||||
private $dt_transaction;
|
||||
|
||||
private $status;
|
||||
|
||||
private $booking_id;
|
||||
|
||||
private $company_id;
|
||||
|
||||
public function __construct(
|
||||
int $bill_no,string $trans_type1,string $trans_type2,
|
||||
float $amount, int $currency_id, int $original_amount,
|
||||
int $original_currency_id, float $currency_rate,
|
||||
string $dt_transaction,int $status,int $booking_id,
|
||||
int $company_id
|
||||
){
|
||||
$this->bill_no = $bill_no;
|
||||
$this->trans_type1= $trans_type1;
|
||||
$this->trans_type2 = $trans_type2;
|
||||
$this->amount= $amount;
|
||||
$this->currency_id = $currency_id;
|
||||
$this->original_amount = $original_amount;
|
||||
$this->original_currency_id = $original_currency_id;
|
||||
$this->currency_rate = $currency_rate;
|
||||
$this->dt_transaction = $dt_transaction;
|
||||
$this->status = $status;
|
||||
$this->booking_id = $booking_id;
|
||||
$this->company_id = $company_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getBillNo(): int
|
||||
{
|
||||
return $this->bill_no;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTransType1(): string
|
||||
{
|
||||
return $this->trans_type1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTransType2(): string
|
||||
{
|
||||
return $this->trans_type2;
|
||||
}
|
||||
|
||||
|
||||
public function getAmount(): float
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCurrency(): int
|
||||
{
|
||||
return $this->currency_id;
|
||||
}
|
||||
|
||||
|
||||
public function getOriginalAmount(): float
|
||||
{
|
||||
return $this->original_amount;
|
||||
}
|
||||
|
||||
public function getOriginalCurrency(): int
|
||||
{
|
||||
return $this->original_currency_id;
|
||||
}
|
||||
|
||||
public function getCurrencyRate(): float
|
||||
{
|
||||
return $this->currency_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDtTransaction(): string
|
||||
{
|
||||
return $this->dt_transaction;
|
||||
}
|
||||
|
||||
public function getStatus(): int
|
||||
{
|
||||
return $this->original_currency_id;
|
||||
}
|
||||
|
||||
public function getBookingId(): int
|
||||
{
|
||||
return $this->booking_id;
|
||||
}
|
||||
|
||||
public function getCompanyId(): int
|
||||
{
|
||||
return $this->company_id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Services;
|
||||
|
||||
|
||||
use App\Models\Receipt;
|
||||
|
||||
class ChecksIfReceiptBillNoExists
|
||||
{
|
||||
|
||||
private $repository;
|
||||
|
||||
public function __construct(Receipt $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(int $bill_no): bool {
|
||||
return $this->repository->where('bill_no', $bill_no)->exists();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptObject;
|
||||
use App\Models\Receipt;
|
||||
|
||||
class CreatesReceipt extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param WalletObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ReceiptObject $object) {
|
||||
$model = new Receipt();
|
||||
$model->bill_no = $object->getBillNo();
|
||||
$model->trans_type1 = $object->getTransType1();
|
||||
$model->trans_type2 = $object->getTransType2();
|
||||
$model->amount = $object->getAmount();
|
||||
$model->currency_id = $object->getCurrency();
|
||||
$model->original_amount = $object->getOriginalAmount();
|
||||
$model->original_currency_id = $object->getOriginalCurrency();
|
||||
$model->currency_rate = $object->getCurrencyRate();
|
||||
$model->dt_transaction = $object->getDtTransaction();
|
||||
$model->status = $object->getStatus();
|
||||
$model->booking_id = $object->getBookingId();
|
||||
$model->company_id = $object->getCompanyId();
|
||||
|
||||
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptDetailObject;
|
||||
use App\Models\ReceiptDetail;
|
||||
|
||||
class CreatesReceiptDetail extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param WalletObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(ReceiptDetailObject $object) {
|
||||
$model = new ReceiptDetail();
|
||||
$model->trans_type1 = $object->getTransType1();
|
||||
$model->trans_type2 = $object->getTransType2();
|
||||
$model->transaction_id = $object->getTransactionId();
|
||||
$model->receipt_id = $object->getReceiptId();
|
||||
$model->price = $object->getPrice();
|
||||
$model->amount = $object->getAmount();
|
||||
|
||||
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Services;
|
||||
|
||||
|
||||
class GeneratesReceiptBillNo
|
||||
{
|
||||
|
||||
|
||||
private $receiptBillNoExists;
|
||||
|
||||
|
||||
public function __construct(ChecksIfReceiptBillNoExists $receiptBillNoExists)
|
||||
{
|
||||
$this->receiptBillNoExists = $receiptBillNoExists;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function execute(): int {
|
||||
|
||||
$code = mt_rand(100000001, 999999999);
|
||||
return !$this->receiptBillNoExists->execute($code) ? $code : self::execute();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Receipts\Standards\Validators\ReceiptValidation;
|
||||
|
||||
class CanCreateReceipt extends AbstractRule
|
||||
{
|
||||
|
||||
/** @var WalletTransactionValidation */
|
||||
private $receiptValidation;
|
||||
|
||||
|
||||
public function __construct(ReceiptValidation $receiptValidation)
|
||||
{
|
||||
$this->receiptValidation = $receiptValidation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompanyWalletValidation $object
|
||||
* @return bool
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return $this->receiptValidation->validate($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SegmentCompanyValidation $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Receipts\Standards\Validators\ReceiptDetailValidation;
|
||||
|
||||
class CanCreateReceiptDetail extends AbstractRule
|
||||
{
|
||||
|
||||
/** @var WalletTransactionValidation */
|
||||
private $receiptDetailValidation;
|
||||
|
||||
|
||||
public function __construct(ReceiptDetailValidation $receiptDetailValidation)
|
||||
{
|
||||
$this->receiptDetailValidation = $receiptDetailValidation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CompanyWalletValidation $object
|
||||
* @return bool
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return $this->receiptDetailValidation->validate($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SegmentCompanyValidation $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Standards\Validators;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractValidation;
|
||||
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptDetailObject;
|
||||
|
||||
class ReceiptDetailValidation extends AbstractValidation
|
||||
{
|
||||
/*
|
||||
*
|
||||
* $this->bill_no = $bill_no;
|
||||
$this->trans_type1= $trans_type1;
|
||||
$this->trans_type2 = $trans_type2;
|
||||
$this->amount= $amount;
|
||||
$this->currency_id = $currency_id;
|
||||
$this->original_amount = $original_amount;
|
||||
$this->original_currency_id = $original_currency_id;
|
||||
$this->currency_rate = $currency_rate;
|
||||
$this->dt_transaction = $dt_transaction;
|
||||
$this->status = $status;
|
||||
$this->booking_id = $booking_id;
|
||||
$this->company_id = $company_id;
|
||||
*/
|
||||
protected function data($object): array
|
||||
{
|
||||
return [
|
||||
'trans_type1' => $object->getTransType1(),
|
||||
'trans_type2' => $object->getTransType2(),
|
||||
'transaction_id' => $object->getTransactionId(),
|
||||
'receipt_id' => $object->getReceiptId(),
|
||||
'price'=>$object->getPrice(),
|
||||
'amount' => $object->getAmount()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(): array
|
||||
{
|
||||
return [
|
||||
'trans_type1' => 'required',
|
||||
'trans_type2' => 'required',
|
||||
'transaction_id' => 'required',
|
||||
'receipt_id' => 'required',
|
||||
'price'=>'required',
|
||||
'amount' => 'required'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function messages(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Receipts\Standards\Validators;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractValidation;
|
||||
use App\Classes\Modules\Receipts\DataTransferObjects\ReceiptObject;
|
||||
|
||||
class ReceiptValidation extends AbstractValidation
|
||||
{
|
||||
|
||||
protected function data($object): array
|
||||
{
|
||||
return [
|
||||
'bill_no' => $object->getBillNo(),
|
||||
'trans_type1' => $object->getBillNo(),
|
||||
'trans_type2' => $object->getTransType2(),
|
||||
'amount' => $object->getAmount(),
|
||||
'currency_id' => $object->getCurrency(),
|
||||
'original_amount' => $object->getOriginalAmount(),
|
||||
'original_currency_id'=>$object->getOriginalCurrency(),
|
||||
'dt_transaction'=>$object->getDtTransaction(),
|
||||
'status'=>$object->getStatus(),
|
||||
'booking_id'=>$object->getBookingId(),
|
||||
'company_id'=>$object->getCompanyId()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(): array
|
||||
{
|
||||
return [
|
||||
'bill_no' => 'required',
|
||||
'trans_type1' => 'required',
|
||||
'trans_type2' => 'required',
|
||||
'amount' => 'required',
|
||||
'currency_id' => 'required',
|
||||
'original_amount' => 'required',
|
||||
'original_currency_id'=>'required',
|
||||
'dt_transaction'=>'required',
|
||||
'status'=>'required',
|
||||
'booking_id'=>'required',
|
||||
'company_id'=>'required'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function messages(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\Transaction;
|
||||
|
||||
class FetchesTransaction extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var Transaction */
|
||||
private $repository;
|
||||
|
||||
|
||||
/**
|
||||
* FetchesTransaction constructor.
|
||||
* @param Transaction $repository
|
||||
*/
|
||||
public function __construct(Transaction $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Accounts;
|
||||
|
||||
use App\Classes\Modules\Accounts\ControllersLogic\CheckEmailLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckEmailController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CheckEmailLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function check(Request $request, CheckEmailLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Accounts;
|
||||
|
||||
|
||||
use App\Classes\Modules\Accounts\ControllersLogic\ListUsersLogic;
|
||||
use App\Classes\Modules\Accounts\Services\ListsUsers;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListUsersController
|
||||
{
|
||||
/** @var ListsUsers */
|
||||
private $listsUsers;
|
||||
|
||||
/**
|
||||
* ListUsersController constructor.
|
||||
* @param ListsUsers $listsUsers
|
||||
*/
|
||||
public function __construct(ListsUsers $listsUsers)
|
||||
{
|
||||
$this->listsUsers = $listsUsers;
|
||||
}
|
||||
|
||||
|
||||
public function list(Request $request, ListUsersLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\CreateCompanyLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateCompanyController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateCompanyLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateCompanyLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\DeleteCompanyLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteCompanyController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteCompanyLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(Request $request, DeleteCompanyLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\FetchCompanyLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchCompanyController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchCompanyLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchCompanyLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllerLogic\ListCompaniesLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListCompaniesController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListCompaniesLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListCompaniesLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\UpdateCompanyLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateCompanyLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateCompanyLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Receipts;
|
||||
|
||||
use App\Classes\Modules\Receipts\ControllersLogic\CreateReceiptLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateReceiptController
|
||||
{
|
||||
|
||||
public function create(Request $request, CreateReceiptLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReceiptDetailResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'trans_type1' => $this->trans_type1,
|
||||
'trans_type2' => $this->trans_type2,
|
||||
'transaction_id' => (int) $this->transaction_id,
|
||||
'receipt_id' => (int)$this->receipt_id,
|
||||
'price' => (double) $this->price,
|
||||
'amount' => (double) $this->amount
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReceiptResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'trans_type1' => $this->trans_type1,
|
||||
'trans_type2' => $this->trans_type2,
|
||||
'bill_no' => (int) $this->bill_no,
|
||||
'amount' => (double) $this->amount,
|
||||
'currency_id' => (int) $this->currency_id,
|
||||
'original_amount' => (double) $this->original_amount,
|
||||
'original_currency_id' => (int) $this->original_currency_id,
|
||||
'currency_rate' => (double) $this->currency_rate,
|
||||
'dt_transaction' => $this->dt_transaction,
|
||||
'status' => (int) $this->status,
|
||||
'booking_id' => (int) $this->booking_id,
|
||||
'company_id' => (int) $this->company_id
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
|
||||
class Receipt extends AbstractModel
|
||||
{
|
||||
protected $table = 'receipt';
|
||||
|
||||
public function company(): HasOne
|
||||
{
|
||||
return $this->hasOne(Companies::class, 'company_id', 'id');
|
||||
}
|
||||
|
||||
public function currency(): HasOne
|
||||
{
|
||||
return $this->hasOne(Currency::class, 'currency_id', 'id');
|
||||
}
|
||||
|
||||
public function original_currency(): HasOne
|
||||
{
|
||||
return $this->hasOne(Currency::class, 'original_currency_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
|
||||
class ReceiptDetail extends AbstractModel
|
||||
{
|
||||
protected $table = 'receipt_detail';
|
||||
|
||||
public function transaction(): HasOne
|
||||
{
|
||||
return $this->hasOne(Transaction::class, 'transaction_id', 'id');
|
||||
}
|
||||
|
||||
public function receipt(): HasOne
|
||||
{
|
||||
return $this->hasOne(Receipt::class, 'receipt_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateReceiptTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('receipt', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('trans_type1');
|
||||
$table->string('trans_type2');
|
||||
$table->bigInteger('bill_no')->unsigned();
|
||||
$table->decimal('amount', 14, 5)->default(0.00);
|
||||
$table->decimal('original_amount', 14, 5)->default(0.00);
|
||||
$table->bigInteger('currency_id')->unsigned();
|
||||
$table->bigInteger('original_currency_id')->unsigned();
|
||||
$table->decimal('currency_rate', 14, 5)->default(0.00);
|
||||
$table->date('dt_transaction');
|
||||
$table->integer('status');
|
||||
$table->bigInteger('booking_id')->unsigned();
|
||||
$table->bigInteger('company_id')->unsigned();
|
||||
$table->timestamps();
|
||||
$table->foreign('company_id')->references('id')->on('companies')->onDelete('cascade');
|
||||
$table->foreign('currency_id')->references('id')->on('currencies')->onDelete('cascade');
|
||||
$table->foreign('original_currency_id')->references('id')->on('currencies')->onDelete('cascade');
|
||||
|
||||
});
|
||||
|
||||
Schema::create('receipt_detail', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('trans_type1');
|
||||
$table->string('trans_type2');
|
||||
$table->bigInteger('receipt_id')->unsigned();
|
||||
$table->bigInteger('transaction_id')->unsigned();
|
||||
$table->decimal('price', 14, 5)->default(0.00);
|
||||
$table->decimal('amount', 14, 5)->default(0.00);
|
||||
$table->timestamps();
|
||||
$table->foreign('receipt_id')->references('id')->on('receipt')->onDelete('cascade');
|
||||
$table->foreign('transaction_id')->references('id')->on('transaction')->onDelete('cascade');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('receipt');
|
||||
Schema::dropIfExists('receipt_detail');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-r-0 m-l-0 m-b-20 animated fadeInUpBig fast" v-if="error">
|
||||
<div class="col p-l-50">
|
||||
<small class="bold fs-10 text-danger">{{error}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-l-0 animated fadeInUpBig">
|
||||
<div class="col b-t b-b b-grey animated" :class="[{'shake': $v.parameters.email.$error}]" :style="[$v.parameters.email.$error ? {'border-bottom': 'solid 2px red !important'} : {}]">
|
||||
<div class="row align-items-center">
|
||||
<div class="col no-padding bg-white ">
|
||||
<div class="input-group transparent">
|
||||
<span class="input-group-addon no-border">
|
||||
<i class="fa fa-envelope-o fa-fw p-l-15 p-t-20" style="padding-right: 18px;"></i>
|
||||
</span>
|
||||
<input v-model="parameters.email" placeholder="Email Address" class="form-control no-border bg-white p-t-35 p-b-35 p-l-0 p-r-0">
|
||||
<validation-error-component :validator="$v.parameters.email" class="absolute fs-12" style=" top: 10px; right: 15px; z-index: 99;"></validation-error-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-30 align-items-center">
|
||||
<div class="col-auto animated fadeInLeftBig slower">
|
||||
<div class="b-t b-b b-r b-grey all-caps muted p-t-15 p-b-15 p-l-30 p-r-20 font-lato pointer fs-12" @click="$store.dispatch('toggleSection', {name: 'forgetPassword', status: false})" style="letter-spacing: 2px;"><i class="fa fa-angle-left" style="padding-right: 18px;"></i>Back to login</div>
|
||||
</div>
|
||||
<div class="col-auto ml-auto p-r-0 animated fadeInRightBig slow">
|
||||
<div class="bg-success all-caps text-white p-t-15 p-b-15 p-l-50 p-r-20 bold font-lato pointer fs-12" style="letter-spacing: 4px;" @click="submit(route('api.account.authentication.password.forget'), 'post', section, false , false)">Request Reset Link</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import { required, email } from "vuelidate/lib/validators";
|
||||
import request from '../../../mixins/requestMixin'
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
error: '',
|
||||
parameters: {
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
email: { required, email }
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
successHandler(){
|
||||
this.$store.dispatch('toggleSection', {name: 'forgetPasswordSuccess', status: true})
|
||||
this.$store.dispatch('passwordResetEmail', {email: this.parameters.email})
|
||||
},
|
||||
errorHandler(error){
|
||||
this.error = error.message;
|
||||
}
|
||||
},
|
||||
mixins: [request]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -16,7 +16,7 @@
|
||||
<span class="input-group-addon no-border">
|
||||
<i class="fa fa-user-o fa-fw p-l-15 p-t-20" style="padding-right: 18px;"></i>
|
||||
</span>
|
||||
<input v-model="parameters.email" placeholder="email" class="form-control no-border bg-white p-t-25 p-b-35 p-l-0 p-r-0">
|
||||
<div class="form-control no-border bg-white p-t-25 p-b-35 p-l-0 p-r-0 text-muted fs-13 text-lowercase" style="cursor: default;">{{parameters.email}}</div>
|
||||
<validation-error-component :validator="$v.parameters.email" class="absolute fs-12" style=" top: 10px; right: 15px; z-index: 99;"></validation-error-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,19 +53,24 @@
|
||||
</template>
|
||||
<script>
|
||||
import { required, email } from "vuelidate/lib/validators";
|
||||
import request from '../../../mixins/requestMixin'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
email: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
error: '',
|
||||
parameters: {
|
||||
email: '',
|
||||
email: this.email,
|
||||
password: ''
|
||||
}
|
||||
};
|
||||
@@ -76,18 +81,21 @@
|
||||
password: { required }
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'email': function() {
|
||||
this.parameters.email = this.email;
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
successHandler(response){
|
||||
localStorage.setItem('user-token', response.payload.access_token);
|
||||
|
||||
console.log(response.payload.access_token);
|
||||
|
||||
this.$store.dispatch('userAuthentication', {access_token: response.payload.access_token});
|
||||
|
||||
this.error = '';
|
||||
// this.$store.dispatch('toggleSection', {name: 'loginSuccess', status: true})
|
||||
// setTimeout(function(){
|
||||
// window.location.href = response.payload.redirect_url;
|
||||
// }, 2000);
|
||||
this.$store.dispatch('toggleSection', {name: 'loginSuccess', status: true})
|
||||
setTimeout(function(){
|
||||
window.location.href = response.payload.redirect_url;
|
||||
}, 2000);
|
||||
},
|
||||
errorHandler(error){
|
||||
this.$store.dispatch('userAuthentication', {access_token: ''});
|
||||
@@ -95,7 +103,8 @@
|
||||
|
||||
this.error = error.message;
|
||||
}
|
||||
}
|
||||
},
|
||||
mixins: [request]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col p-r-0">
|
||||
<transition-component key="2" group enter-class="animated fadeInRightBig faster" leave-class="animated fadeOutUpBig" v-show="!$store.getters.isLoading('loginSection')">
|
||||
<div class="row" key="1" v-show="!$store.getters.isShowing('loginForm') && !$store.getters.isShowing('registrationForm')">
|
||||
<div class="col p-r-0">
|
||||
<div class="row m-l-0">
|
||||
<div class="col p-l-50">
|
||||
<h5 class="font-lato light animated fadeInRightBig slow" style=" line-height: 50px; letter-spacing: 5px; ">Hi There!</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-l-0 m-b-20 animated fadeInRightBig slow">
|
||||
<div class="col p-l-50">
|
||||
<p class="muted font-lato light lh-25" style="letter-spacing: 2px; ">Enter your email address to <b>register</b>/<b>login</b>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin">
|
||||
<div class="col">
|
||||
<div class="row m-b-20 animated fadeInUpBig fast" v-if="error">
|
||||
<div class="col p-l-50">
|
||||
<small class="bold fs-10 text-danger">{{error}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row animated fadeInDownBig">
|
||||
<div class="col b-t b-b b-grey animated" :class="[{'shake': $v.parameters.email.$error}]" :style="[$v.parameters.email.$error ? {'border-bottom': 'solid 2px red !important'} : {}]">
|
||||
<div class="row align-items-center">
|
||||
<div class="col pl-md-0 pr-md-0 bg-white">
|
||||
<div class="input-group transparent b-grey b-t b-b">
|
||||
<span class="input-group-addon no-border">
|
||||
<i class="fa fa-user-o fa-fw p-l-15 p-t-20" style="padding-right: 18px;"></i>
|
||||
</span>
|
||||
<input placeholder="My Email Address" v-model.trim="parameters.email" class="form-control no-border bg-white p-t-35 p-b-35 p-l-0 p-r-0">
|
||||
<validation-error-component :validator="$v.parameters.email" class="absolute fs-12" style=" top: 10px; right: 15px; z-index: 99;"></validation-error-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-30 align-items-center">
|
||||
<div class="col-auto animated fadeInLeftBig slow">
|
||||
<div class="b-t b-b b-r b-primary bg-transparent all-caps text-primary p-t-15 p-b-15 p-l-50 p-r-50 bold font-lato pointer" style="letter-spacing: 8px;" @click="submit(route('api.account.authentication.authenticate.email.check'), 'post', section, false, false)">Next <i class="fa fa-chevron-right fs-13"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" key="2" v-show="$store.getters.isShowing('loginForm')" >
|
||||
<div class="col all-caps">
|
||||
<div class="row m-l-0">
|
||||
<div class="col p-l-50">
|
||||
<h5 class="font-lato light lh-40 animated fadeInLeftBig slow" style="letter-spacing: 5px; ">Welcome Back!</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-l-0 m-b-20 animated fadeInRightBig slow">
|
||||
<div class="col p-l-50">
|
||||
<p class="muted font-lato light lh-25" style="letter-spacing: 2px; ">Looks like you already have an account with us.</p>
|
||||
</div>
|
||||
</div>
|
||||
<login-form-component section="loginSection" :email="parameters.email"></login-form-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-30" key="3" v-show="$store.getters.isShowing('registrationForm')" >
|
||||
<div class="col all-caps">
|
||||
<div class="row m-b-20">
|
||||
<div class="col p-l-50">
|
||||
<div class="row m-l-0 align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<h5 class="font-lato light lh-40 animated fadeInLeftBig slow" style="letter-spacing: 5px; ">Create Account</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-l-0 animated fadeInRightBig slow">
|
||||
<div class="col">
|
||||
<p class="muted font-lato light lh-25" style="letter-spacing: 2px; ">Looks like you are a new user.<br>Let's create a fresh new izyim profile for you.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<registration-form-component ref="registration" :email="parameters.email" section="loginSection"></registration-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</transition-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { required, email } from "vuelidate/lib/validators";
|
||||
import request from '../../../mixins/requestMixin'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
error: '',
|
||||
parameters: {
|
||||
email: ''
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
email: { required, email }
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
successHandler(){
|
||||
this.$store.dispatch('toggleSection', {name: 'loginForm', status: true})
|
||||
},
|
||||
errorHandler(){
|
||||
this.$store.dispatch('toggleSection', {name: 'registrationForm', status: true})
|
||||
}
|
||||
},
|
||||
mixins: [request]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -1,5 +1,93 @@
|
||||
@extends('layouts.base_login')
|
||||
|
||||
@section('inner_content')
|
||||
<login-form-component ref="registration" :section="'RegistrationSection'"></login-form-component>
|
||||
<transition-component group enter-class="animated fadeInRightBig faster" leave-class="animated fadeOutRightBig" class="h-100">
|
||||
<div class="row h-100 m-auto" key="1" v-show="!$store.getters.isShowing('loginSuccess') && !$store.getters.isShowing('forgetPasswordSuccess')">
|
||||
<div class="col d-flex align-items-start flex-column">
|
||||
<div class="row invisible" v-if="!$store.getters.isShowing('registrationForm')">
|
||||
<div class="col-auto p-l-0 p-r-0 ml-auto" style="background-color: rgba(255,255,255,0.2);">
|
||||
<div class="text-white font-lato lightest" style=" font-size: 150px; font-weight: 100; margin-right: -17px; margin-left: -183px; ">...</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row w-100">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col no-padding relative">
|
||||
<transition-component group enter-class="animated fadeInUpBig faster" leave-class="animated fadeOutRightBig">
|
||||
<loading-component style="height: 350px;" key="1" color="primary" v-show="$store.getters.isLoading('loginSection')"></loading-component>
|
||||
<transition-component key="2" group enter-class="animated fadeInRightBig faster" leave-class="animated fadeOutUpBig" v-show="!$store.getters.isLoading('loginSection')">
|
||||
<div class="row" key="1" v-show="!$store.getters.isShowing('forgetPassword')" >
|
||||
<div class="col all-caps">
|
||||
<login-section-component section="loginSection"></login-section-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" key="2" v-show="$store.getters.isShowing('forgetPassword')" >
|
||||
<div class="col all-caps">
|
||||
<div class="row m-l-0">
|
||||
<div class="col p-l-50">
|
||||
<h5 class="font-lato light lh-40 animated fadeInLeftBig slow" style="letter-spacing: 5px; ">Did you forget your password?</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-l-0 m-b-20 animated fadeInRightBig slow">
|
||||
<div class="col p-l-50">
|
||||
<p class="muted font-lato light lh-25" style="letter-spacing: 2px; ">Enter your email address you're using for your account below<br>and we will send you a password reset link</p>
|
||||
</div>
|
||||
</div>
|
||||
<forget-password-form-component section="loginSection"></forget-password-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</transition-component>
|
||||
</transition-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center justify-content-center h-100 bg-white text-center" key="2" v-show="$store.getters.isShowing('loginSuccess')">
|
||||
<div class="col">
|
||||
<div class="row m-b-20 animated fadeInRightBig">
|
||||
<div class="col">
|
||||
<i class="fa fa-user-circle-o animated pulse slower infinite fs-60 text-success"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row animated fadeInLeftBig" style="height: 50px;">
|
||||
<div class="col">
|
||||
<loading-component style="height: 40px;" key="1" color="success"></loading-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row animated fadeInUpBig fast">
|
||||
<div class="col">
|
||||
<h5 class="all-caps fs-35 m-b-15 text-success">Login Successful</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row animated fadeInUpBig">
|
||||
<div class="col">
|
||||
<small class="muted font-lato all-caps">Please wait for redirect</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center justify-content-center h-100 bg-white text-center" key="3" v-show="$store.getters.isShowing('forgetPasswordSuccess')">
|
||||
<div class="col-10">
|
||||
<div class="row m-b-20 animated fadeInDownBig">
|
||||
<div class="col"><i class="fa fa-lock animated swing slower infinite fs-80 text-primary"></i></div>
|
||||
</div>
|
||||
<div class="row animated fadeInLeftBig">
|
||||
<div class="col">
|
||||
<h5 class="all-caps fs-35 m-b-15 text-primary" style="letter-spacing: 2px;">reset your password</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row animated fadeInRightBig">
|
||||
<div class="col"><small class="font-lato all-caps light" style="letter-spacing: 2px;">we have sent a reset password email to <span class="text-success" v-text="$store.getters.getResetPasswordEmail"></span><br>Please click the reset password link to set your new password.</small></div>
|
||||
</div>
|
||||
<div class="row m-t-30 animated fadeInUpBig slow">
|
||||
<div class="col"><small class="hint-text font-lato all-caps fs-10" style="letter-spacing: 1px;"><span class="text-danger bold m-r-5">didn't receive the email yet ?</span> Please check your spam folder, or <span class="text-success text-underline bold pointer" @click="$store.dispatch('toggleSection', {name: 'forgetPasswordSuccess', status: false})">resend the email</span></small></div>
|
||||
</div>
|
||||
<div class="row m-t-50 animated fadeInUpBig slower">
|
||||
<div class="col"><small class="hint-text font-lato all-caps fs-10" style="letter-spacing: 1px;">Did you remember your password? Go back to <span class="text-underline text-primary bold pointer" @click="$store.dispatch('toggleSection', {name: 'forgetPasswordSuccess', status: false});$store.dispatch('toggleSection', {name: 'forgetPassword', status: false})">login</span></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition-component>
|
||||
@endsection
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
||||
@extends('layouts.base_portal')
|
||||
@section('inner_content')
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading('companyProfile')"></loading-component>
|
||||
<importer-dashboard-component :id={{$id}} section="companyProfile" v-show="!$store.getters.isLoading('companyProfile')"></importer-dashboard-component>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
+4
-4
@@ -8,6 +8,7 @@ Route::group(['prefix' => 'account', 'namespace' => 'Accounts', 'as' => 'account
|
||||
|
||||
Route::group(['prefix' => 'login', 'as' => 'authenticate.'], function () {
|
||||
Route::post('/attempt', 'UserAuthenticationController@authenticate')->name('attempt');
|
||||
Route::post('/check_email', 'CheckEmailController@check')->name('email.check');
|
||||
});
|
||||
|
||||
// Route::group(['prefix' => 'password', 'as' => 'password.'], function () {
|
||||
@@ -23,8 +24,7 @@ Route::group(['prefix' => 'account', 'namespace' => 'Accounts', 'as' => 'account
|
||||
|
||||
Route::post('/registration', 'CreateUserController@create')->name('registration');
|
||||
|
||||
// Route::group(['prefix' => 'user', 'as' => 'user.'], function () {
|
||||
// Route::get('list', 'ListUsersController@list')->name('list');
|
||||
// });
|
||||
|
||||
Route::group(['prefix' => 'user', 'as' => 'user.'], function () {
|
||||
Route::get('list', 'ListUsersController@list')->name('list');
|
||||
});
|
||||
});
|
||||
+5
-1
@@ -19,13 +19,17 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
require __DIR__ . '/account.php';
|
||||
|
||||
require __DIR__ . '/transaction.php';
|
||||
|
||||
require __DIR__ . '/receipt.php';
|
||||
|
||||
Route::group(['middleware' => 'valid.token'], function () {
|
||||
require __DIR__ . '/crud.php';
|
||||
|
||||
require __DIR__ . '/wallet.php';
|
||||
|
||||
require __DIR__ . '/document.php';
|
||||
require __DIR__ . '/company.php';
|
||||
|
||||
require __DIR__ . '/company_bank.php';
|
||||
|
||||
require __DIR__ . '/segment.php';
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Companies'], function () {
|
||||
Route::get('/{id}/show', 'FetchCompanyController@fetch')->name('show');
|
||||
Route::get('/list', 'ListCompaniesController@list')->name('list');
|
||||
Route::post('/create', 'CreateCompanyController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdateCompanyController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'receipt', 'namespace' => 'Receipts', 'as' => 'receipt.'], function () {
|
||||
|
||||
Route::post('/create/{id}', 'CreateReceiptController@create')->name('create');
|
||||
//Route::post('/create-transaction/{id}', 'CreateWalletTransactionController@create')->name('create_transaction');
|
||||
|
||||
});
|
||||
+9
-7
@@ -17,7 +17,6 @@ Route::get('', function () {
|
||||
return view('pages.accounts.authentication.login');
|
||||
})->name('login');
|
||||
|
||||
|
||||
Route::get('account/registration', function () {
|
||||
return view('pages.accounts.registration');
|
||||
})->name('registration');
|
||||
@@ -26,11 +25,14 @@ Route::get('account/registration-step-2', function () {
|
||||
return view('pages.accounts.registration_step_2');
|
||||
})->name('registration-step-2');
|
||||
|
||||
Route::get('/accounts', function () {
|
||||
return view('pages.accounts.dashboard');
|
||||
})->name('account.dashboard');
|
||||
|
||||
Route::get('account/password/reset/{token}', function ($token){
|
||||
return view('pages.accounts.authentication.reset_password',['token' => $token]);
|
||||
})->name('account.password.reset');
|
||||
// Route::get('/company/{id}/importer/dashboard', function ($id) {
|
||||
// return view('pages.dashboards.importer_profile', ['id' => (int) $id]);
|
||||
// })->name('dashboard.importer');
|
||||
|
||||
route::get('dashboard/', function (){
|
||||
return redirect()->route('registration-step-2');
|
||||
})->name('dashboard');
|
||||
Route::get('/company/forwarder/dashboard', function () {
|
||||
return view('pages.dashboards.forwarder_profile');
|
||||
})->name('dashboard.forwarder');
|
||||
Reference in New Issue
Block a user