mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Period Lock - Partial Implementation 1 (merge branch dillon/110-period-lock-b through dillon/90-e-invoice-g-0)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class KeyValuePairIn implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder
|
||||
->whereNull('owner_type')
|
||||
->whereNull('owner_id')
|
||||
->whereIn('key', [$value]);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Bookings\Processors\RegenerateInvoiceBookingProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Classes\Jobs\Commands\V2;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Classes\Jobs;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Notifications\WelcomeVoucherEmail;
|
||||
use App\Models\User;
|
||||
use App\Models\Voucher;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Accounts\Standards\Rules\CanCreateUser;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUser;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreateSystemUserLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Account',
|
||||
'message' => 'You have successfully created a new Account'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanCreateUser */
|
||||
private $canCreateUser;
|
||||
|
||||
/** @var CreatesUser */
|
||||
private $createsUser;
|
||||
|
||||
|
||||
/**
|
||||
* CreateSystemUserLogic constructor.
|
||||
* @param CanCreateUser $canCreateUser
|
||||
* @param CreatesUser $createsUser
|
||||
*/
|
||||
public function __construct(
|
||||
CanCreateUser $canCreateUser,
|
||||
CreatesUser $createsUser
|
||||
)
|
||||
{
|
||||
$this->canCreateUser = $canCreateUser;
|
||||
$this->createsUser = $createsUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
if($request->input('password') === 'ciefsystemuser@123' && $request->input('password_confirmation') === 'ciefsystemuser@123'){
|
||||
$user_object = new RegistrationObject($request->input('name'), $request->input('email'),
|
||||
$request->input('password'), $request->input('password_confirmation'),
|
||||
$request->input('is_internal') ? RoleTypes::SYSTEM_INTERNAL : RoleTypes::SYSTEM_EXTERNAL, ApprovalStatus::APPROVED);
|
||||
|
||||
$this->canCreateUser->passes($user_object);
|
||||
$user = $this->createsUser->execute($user_object);
|
||||
// $token = $user->createToken('my-app-token', ['*'])->plainTextToken;
|
||||
// return $this->response(['token' => $token]);
|
||||
}
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ use App\Classes\Modules\Banks\Services\UpdatesBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesOrUpdateBank;
|
||||
use App\Classes\Modules\Banks\DataTransferObjects\BankObject;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Bank;
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanCreateBooking;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateBookingLockLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Booking Locked',
|
||||
'message' => 'You have successfully lock Booking from editing'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanCreateBooking */
|
||||
private $canCreateBooking;
|
||||
|
||||
/** @var FetchesBooking */
|
||||
private $fetchesBooking;
|
||||
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreatesKeyValuePair */
|
||||
private $createsKeyValuePair;
|
||||
|
||||
/**
|
||||
* CreateBookingLockLogic constructor.
|
||||
* @param CanCreateBooking $canCreateBooking
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param CreatesKeyValuePair $createsKeyValuePair
|
||||
* @param FetchesBooking $fetchesBooking
|
||||
*/
|
||||
public function __construct(CanCreateBooking $canCreateBooking, FetchesCompany $fetchesCompany, CreatesKeyValuePair $createsKeyValuePair, FetchesBooking $fetchesBooking)
|
||||
{
|
||||
$this->canCreateBooking = $canCreateBooking;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createsKeyValuePair = $createsKeyValuePair;
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
// cief todo: 110 - CanCreateBookingLock
|
||||
|
||||
// $password = $request->input('password');
|
||||
// if($password !== 'prototype'){
|
||||
// throw new AccessForbiddenException('Incorrect Password');
|
||||
// }
|
||||
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->input('booking_id')]);
|
||||
$this->updateOrCreateKeyValuePair($booking, KVPKey::BOOKING_IS_LOCKED, 1);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
private function updateOrCreateKeyValuePair($booking, $key, $value)
|
||||
{
|
||||
$booking->attributesKVP()->updateOrCreate(
|
||||
['key' => $key],
|
||||
['value' => $value]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
use App\Classes\Exceptions\AccessForbiddenException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanDeleteBooking;
|
||||
use App\Classes\Modules\Bookings\Services\DeletesBooking;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class DeleteBookingLockLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Booking Unlock',
|
||||
'message' => 'You have successfully unlock the Booking for editing'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanDeleteBooking */
|
||||
private $canDeleteBooking;
|
||||
|
||||
/** @var DeletesBooking */
|
||||
private $deletesBooking;
|
||||
|
||||
/** @var FetchesBooking */
|
||||
private $fetchesBooking;
|
||||
|
||||
|
||||
public function __construct(
|
||||
CanDeleteBooking $canDeleteBooking,
|
||||
DeletesBooking $deletesBooking,
|
||||
FetchesBooking $fetchesBooking
|
||||
)
|
||||
{
|
||||
$this->canDeleteBooking = $canDeleteBooking;
|
||||
$this->deletesBooking = $deletesBooking;
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws AccessForbiddenException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
// cief todo: 110 - CanDeleteBookingLock
|
||||
|
||||
$password = $request->input('password');
|
||||
if($password !== 'prototype'){
|
||||
throw new AccessForbiddenException('Incorrect Password');
|
||||
}
|
||||
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
||||
$booking->attributesKVP()->where('key', KVPKey::BOOKING_IS_LOCKED)->delete();
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,9 @@ use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Bookings\Services\UpdatesBookingInvoiceStatus;
|
||||
use App\Classes\Modules\Bookings\Services\UpdatesBookingFixedAmount;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanUpdateBooking;
|
||||
use App\Classes\Modules\Rules\Services\RuleEvaluator;
|
||||
use App\Classes\Modules\Rules\Standards\Rules\CanPassTransferPeriodLockRule;
|
||||
use App\Classes\Modules\Rules\DataTransferObjects\CheckTransferPeriodLockRuleVariant2DTO;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionV2Processor;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
@@ -20,6 +23,7 @@ use App\Http\Resources\BookingResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Classes\Exceptions\CriteriaNotFulfilledException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateBookingAmountLogic extends AbstractControllerLogic
|
||||
@@ -57,6 +61,12 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic
|
||||
/** @var CreateInvoiceTransactionV2Processor */
|
||||
private $createInvoiceTransactionProcessor;
|
||||
|
||||
/** @var RuleEvaluator */
|
||||
private $ruleEvaluator;
|
||||
|
||||
/** @var CanPassTransferPeriodLockRule */
|
||||
private $canPassTransferPeriodLockRule;
|
||||
|
||||
/**
|
||||
* UpdateBookingAmountLogic constructor.
|
||||
* @param CanUpdateBooking $canUpdateBooking
|
||||
@@ -66,8 +76,10 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdatesBookingInvoiceStatus $updatesBookingInvoiceStatus
|
||||
* @param CreateInvoiceTransactionV2Processor $createInvoiceTransactionProcessor
|
||||
* @param RuleEvaluator $ruleEvaluator
|
||||
* @param CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule
|
||||
*/
|
||||
public function __construct(CanUpdateBooking $canUpdateBooking, UpdatesBookingFixedAmount $updatesBookingFixedAmount, FetchesBooking $fetchesBooking, CalculatesBookingOutstanding $calculatesBookingOutstanding, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesBookingInvoiceStatus $updatesBookingInvoiceStatus, CreateInvoiceTransactionV2Processor $createInvoiceTransactionProcessor)
|
||||
public function __construct(CanUpdateBooking $canUpdateBooking, UpdatesBookingFixedAmount $updatesBookingFixedAmount, FetchesBooking $fetchesBooking, CalculatesBookingOutstanding $calculatesBookingOutstanding, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesBookingInvoiceStatus $updatesBookingInvoiceStatus, CreateInvoiceTransactionV2Processor $createInvoiceTransactionProcessor, RuleEvaluator $ruleEvaluator, CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule)
|
||||
{
|
||||
$this->canUpdateBooking = $canUpdateBooking;
|
||||
$this->updatesBookingFixedAmount = $updatesBookingFixedAmount;
|
||||
@@ -76,15 +88,31 @@ class UpdateBookingAmountLogic extends AbstractControllerLogic
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updatesBookingInvoiceStatus = $updatesBookingInvoiceStatus;
|
||||
$this->createInvoiceTransactionProcessor = $createInvoiceTransactionProcessor;
|
||||
$this->ruleEvaluator = $ruleEvaluator;
|
||||
$this->canPassTransferPeriodLockRule = $canPassTransferPeriodLockRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws MalformedRequestException
|
||||
* @throws CriteriaNotFulfilledException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
//cief todo: 110 - Prototype Period Lock - Starts
|
||||
// $reqData['id'] = $request->route('id');
|
||||
// $dto = new CheckTransferPeriodLockRuleVariant2DTO($reqData);
|
||||
|
||||
// $result = $this->ruleEvaluator->evaluate([
|
||||
// $this->canPassTransferPeriodLockRule,
|
||||
// ], $dto);
|
||||
|
||||
// if ($result->failed()) {
|
||||
// throw new CriteriaNotFulfilledException("- " . implode("<br>- ", $result->messages()));
|
||||
// }
|
||||
//cief todo: 110 - Prototype Period Lock - Ends
|
||||
|
||||
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
|
||||
|
||||
$input_amount = number_format( floatval(str_replace(',', '', $request->input('fix_amount', $booking->fix_amount))), 5, '.', '');
|
||||
|
||||
@@ -6,8 +6,8 @@ use App\Classes\Modules\Bookings\Services\UpdatesBookingFixedAmount;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanUpdateBooking;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingOutstanding;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
|
||||
@@ -7,8 +7,8 @@ use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Jobs\Commands\V2\ProcessPaymentReportV2CommandJob;
|
||||
use App\Classes\Jobs\Commands\V2\ProcessSalesInvoiceReportV2CommandJob;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\Imports\Services\AutoCountDataImport;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Rules\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\CriteriaNotFulfilledException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Rules\DataTransferObjects\CheckTransferPeriodLockRuleDTO;
|
||||
use App\Classes\Modules\Rules\Services\RuleEvaluator;
|
||||
use App\Classes\Modules\Rules\Standards\Rules\CanPassTransferPeriodLockRule;
|
||||
use App\Http\Resources\RuleResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CheckTransferPeriodLockRuleLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Rule Check Transfer Period Lock',
|
||||
'message' => 'You have successfully passed all rules evaluated'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var RuleEvaluator */
|
||||
private $ruleEvaluator;
|
||||
|
||||
/** @var CanPassTransferPeriodLockRule */
|
||||
private $canPassTransferPeriodLockRule;
|
||||
|
||||
/**
|
||||
* CheckTransferPeriodLockRuleLogic constructor.
|
||||
* @param RuleEvaluator $ruleEvaluator
|
||||
* @param CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule
|
||||
*/
|
||||
public function __construct(RuleEvaluator $ruleEvaluator, CanPassTransferPeriodLockRule $canPassTransferPeriodLockRule)
|
||||
{
|
||||
$this->ruleEvaluator = $ruleEvaluator;
|
||||
$this->canPassTransferPeriodLockRule = $canPassTransferPeriodLockRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
* @throws \App\Classes\Exceptions\CriteriaNotFulfilledException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$dto = new CheckTransferPeriodLockRuleDTO($request->all());
|
||||
|
||||
$result = $this->ruleEvaluator->evaluate([
|
||||
$this->canPassTransferPeriodLockRule,
|
||||
], $dto);
|
||||
|
||||
if ($result->failed()) {
|
||||
throw new CriteriaNotFulfilledException("- " . implode("<br>- ", $result->messages()));
|
||||
}
|
||||
|
||||
return $this->resourceResponse(new RuleResource((object)$result));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Rules\DataTransferObjects;
|
||||
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class CheckTransferPeriodLockRuleDTO implements DataTransferObject
|
||||
{
|
||||
public int $bookingId;
|
||||
public int $companyId;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->bookingId = $data['booking_id'];
|
||||
$this->companyId = $data['company_id'];
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'booking_id' => $this->bookingId,
|
||||
'company_id' => $this->companyId,
|
||||
];
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Rules\DataTransferObjects;
|
||||
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class CheckTransferPeriodLockRuleVariant2DTO implements DataTransferObject
|
||||
{
|
||||
public int $bookingId;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->bookingId = $data['id'];
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->bookingId,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Rules\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\Exceptions\CriteriaNotFulfilledException;
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CanPassTransferPeriodLockRule extends AbstractRule
|
||||
{
|
||||
|
||||
/** @var FetchesBooking */
|
||||
private $fetchesBooking;
|
||||
|
||||
|
||||
/**
|
||||
* CanPassTransferPeriodLockRule constructor.
|
||||
* @param FetchesBooking $fetchesBooking
|
||||
*/
|
||||
public function __construct(FetchesBooking $fetchesBooking)
|
||||
{
|
||||
$this->fetchesBooking = $fetchesBooking;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
$booking = $this->fetchesBooking->execute(['id' => $object->bookingId]);
|
||||
$bookingAttribute = $booking->attributesKVP()->where('key', KVPKey::BOOKING_IS_LOCKED)->first();
|
||||
|
||||
if($bookingAttribute && in_array(Auth::user()->type, RoleTypes::ADMIN_ROLES)){
|
||||
throw new CriteriaNotFulfilledException("Booking is locked for edit.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanCreateBooking;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateLockLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Lock Created',
|
||||
'message' => 'You have successfully created a lock'
|
||||
];
|
||||
}
|
||||
|
||||
// /** @var CanCreateBooking */
|
||||
// private $canCreateBooking;
|
||||
|
||||
/** @var CreatesKeyValuePair */
|
||||
private $createsKeyValuePair;
|
||||
|
||||
/**
|
||||
* CreateLockLogic constructor.
|
||||
* @param CanCreateBooking $canCreateBooking
|
||||
* @param CreatesKeyValuePair $createsKeyValuePair
|
||||
*/
|
||||
public function __construct(CanCreateBooking $canCreateBooking, CreatesKeyValuePair $createsKeyValuePair)
|
||||
{
|
||||
// $this->canCreateBooking = $canCreateBooking;
|
||||
$this->createsKeyValuePair = $createsKeyValuePair;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
// cief todo: 110 - CanCreateLock
|
||||
|
||||
// $password = $request->input('password');
|
||||
// if($password !== 'prototype'){
|
||||
// throw new AccessForbiddenException('Incorrect Password');
|
||||
// }
|
||||
|
||||
$keyValuePairObject = new KeyValuePairObject(
|
||||
KVPKey::UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED,
|
||||
0
|
||||
);
|
||||
$this->createsKeyValuePair->execute(null, $keyValuePairObject);
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Bookings\Services\FetchesBooking;
|
||||
use App\Classes\Modules\Bookings\Standards\Rules\CanFetchBooking;
|
||||
use App\Http\Resources\LockResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchLockLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Lock',
|
||||
'message' => 'You have successfully retrieved a Lock'
|
||||
];
|
||||
}
|
||||
|
||||
// /** @var CanFetchBooking */
|
||||
// private $canFetchBooking;
|
||||
|
||||
/** @var FetchesKeyValuePair */
|
||||
private $fetchesKeyValuePair;
|
||||
|
||||
/**
|
||||
* FetchLockLogic constructor.
|
||||
* @param CanFetchBooking $canFetchBooking
|
||||
* @param FetchesKeyValuePair $fetchesKeyValuePair
|
||||
*/
|
||||
public function __construct(CanFetchBooking $canFetchBooking, FetchesBooking $fetchesKeyValuePair)
|
||||
{
|
||||
// $this->canFetchBooking = $canFetchBooking;
|
||||
$this->fetchesKeyValuePair = $fetchesKeyValuePair;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
// cief todo: 110 - CanFetchLock
|
||||
|
||||
// $this->canFetchBooking->passes();
|
||||
|
||||
// $query = $this->fetchesKeyValuePair->execute(['marking' => $request->route('marking'), 'with_transactions' => true]);
|
||||
|
||||
// return $this->resourceResponse(new LockResource($query));
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Settings\Services\ListsKeyValuePairs;
|
||||
use App\Classes\Modules\ServiceTypes\Standards\Rules\CanListServiceTypes;
|
||||
use App\Http\Resources\LockResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListLocksLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Locks',
|
||||
'message' => 'You have successfully retrieved a list of Locks'
|
||||
];
|
||||
}
|
||||
|
||||
// /** @var CanListServiceTypes */
|
||||
// private $canListServiceTypes;
|
||||
|
||||
/** @var ListsKeyValuePairs */
|
||||
private $listsKeyValuePairs;
|
||||
|
||||
/**
|
||||
* ListLocksLogic constructor.
|
||||
* @param CanListServiceTypes $canListServiceTypes
|
||||
* @param ListsKeyValuePairs $listsKeyValuePairs
|
||||
*/
|
||||
public function __construct(CanListServiceTypes $canListServiceTypes, ListsKeyValuePairs $listsKeyValuePairs)
|
||||
{
|
||||
// $this->canListServiceTypes = $canListServiceTypes;
|
||||
$this->listsKeyValuePairs = $listsKeyValuePairs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
// cief todo: 110 - CanListLocks
|
||||
|
||||
// $this->canListServiceTypes->passes();
|
||||
|
||||
$query = $this->listsKeyValuePairs->execute($this->listsKeyValuePairs->deserializeFilters($request->input('filters')));
|
||||
|
||||
return $this->collectionResponse(LockResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Classes\Modules\ServiceTypes\Standards\Rules\CanUpdateServiceType;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Http\Resources\LockResource;
|
||||
use App\Models\KeyValuePair;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateLockLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Lock Status',
|
||||
'message' => 'You have successfully updated the Lock status'
|
||||
];
|
||||
}
|
||||
|
||||
// /** @var CanUpdateServiceType */
|
||||
// private $canUpdateServiceType;
|
||||
|
||||
/** @var CreatesKeyValuePair */
|
||||
private $createsKeyValuePair;
|
||||
|
||||
/** @var UpdatesKeyValuePair */
|
||||
private $updatesKeyValuePair;
|
||||
|
||||
/**
|
||||
* UpdateLockLogic constructor.
|
||||
* @param CanUpdateServiceType $canUpdateServiceType
|
||||
* @param CreatesKeyValuePair $createsKeyValuePair
|
||||
* @param UpdatesKeyValuePair $updatesKeyValuePair
|
||||
*/
|
||||
public function __construct(CanUpdateServiceType $canUpdateServiceType, CreatesKeyValuePair $createsKeyValuePair, UpdatesKeyValuePair $updatesKeyValuePair)
|
||||
{
|
||||
// $this->canUpdateServiceType = $canUpdateServiceType;
|
||||
$this->createsKeyValuePair = $createsKeyValuePair;
|
||||
$this->updatesKeyValuePair = $updatesKeyValuePair;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
// cief todo: 110 - CanUpdateLock
|
||||
|
||||
$key = $request->input('key');
|
||||
$kvp = KeyValuePair::whereNull('owner_type')
|
||||
->whereNull('owner_id')
|
||||
->where('key', $key)
|
||||
->first();
|
||||
$value = ($kvp->value === "1") ? "0" : "1";
|
||||
$this->updateOrCreateKeyValuePair($key, $value);
|
||||
return $this->resourceResponse(new LockResource($kvp));
|
||||
|
||||
}
|
||||
|
||||
private function updateOrCreateKeyValuePair($key, $value)
|
||||
{
|
||||
$keyValuePairObject = new KeyValuePairObject($key, $value);
|
||||
$kvp = KeyValuePair::whereNull('owner_type')
|
||||
->whereNull('owner_id')
|
||||
->where('key', $key)
|
||||
->first();
|
||||
|
||||
if ($kvp) {
|
||||
$this->updatesKeyValuePair->execute($kvp, $keyValuePairObject);
|
||||
} else {
|
||||
$this->createsKeyValuePair->execute(null, $keyValuePairObject);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
||||
use App\Classes\General\Interfaces\KeyValueInterface;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Models\KeyValuePair;
|
||||
|
||||
class CreatesKeyValuePair extends AbstractUpdateRelationshipRecord
|
||||
{
|
||||
/**
|
||||
* @param KeyValueInterface $kv
|
||||
* @param KeyValuePairObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
|
||||
public function execute(?KeyValueInterface $kv, KeyValuePairObject $object) {
|
||||
$model = new KeyValuePair();
|
||||
$model->key = $object->getKey();
|
||||
$model->value = $object->getValue();
|
||||
|
||||
// Owner-less
|
||||
if (is_null($kv)) {
|
||||
$model->owner_type = null;
|
||||
$model->owner_id = null;
|
||||
$model->save();
|
||||
return $model;
|
||||
}
|
||||
|
||||
return $this->handler($kv->attributesKVP(), $model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\KeyValuePair;
|
||||
|
||||
class FetchesKeyValuePair extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var KeyValuePair */
|
||||
private $repository;
|
||||
|
||||
|
||||
/**
|
||||
* FetchesKeyValuePair constructor.
|
||||
* @param KeyValuePair $repository
|
||||
*/
|
||||
public function __construct(KeyValuePair $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use App\Models\KeyValuePair;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListsKeyValuePairs extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var KeyValuePair */
|
||||
private $repository;
|
||||
|
||||
|
||||
/**
|
||||
* ListsKeyValuePairs constructor.
|
||||
* @param KeyValuePair $repository
|
||||
*/
|
||||
public function __construct(KeyValuePair $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Settings\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\KeyValuePairObject;
|
||||
use App\Models\KeyValuePair;
|
||||
|
||||
class UpdatesKeyValuePair extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param KeyValuePair $model
|
||||
* @param KeyValuePairObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(KeyValuePair $model, KeyValuePairObject $object) {
|
||||
$model->key = $object->getKey();
|
||||
$model->value = $object->getValue();
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\Jobs\SendUserPaymentProofUploadedEmail;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use App\Models\Company;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -98,6 +99,10 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
|
||||
]
|
||||
);
|
||||
|
||||
//cief todo: 110 - Prototype Period Lock - Starts
|
||||
// $this->updateOrCreateKeyValuePair($transaction->owner->booking, KVPKey::BOOKING_IS_LOCKED, 1);
|
||||
//cief todo: 110 - Prototype Period Lock - Ends
|
||||
|
||||
// send email to customer
|
||||
// todo: a function to send a proof to the receipiant, they have to give us a email of the receipiant and also need to submiited purchase order
|
||||
$companyEmployee = $transaction->owner->booking->company->employees;
|
||||
@@ -110,4 +115,11 @@ class CreatePaymentProofDocumentLogic extends AbstractControllerLogic
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
private function updateOrCreateKeyValuePair($booking, $key, $value)
|
||||
{
|
||||
$booking->attributesKVP()->updateOrCreate(
|
||||
['key' => $key],
|
||||
['value' => $value]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ use App\Classes\Modules\Vouchers\Services\CreatesVoucher;
|
||||
use App\Classes\Modules\Vouchers\Services\FetchesVoucher;
|
||||
use App\Classes\Modules\Vouchers\Services\UpdatesVoucherCampaign;
|
||||
use App\Classes\Modules\Rewards\Services\CreatesUserReward;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Vouchers\Standards\Rules\CanCreateVoucher;
|
||||
use App\Classes\Modules\Vouchers\DataTransferObjects\ValidateVoucherifyVoucherObject;
|
||||
use App\Classes\Modules\Vouchers\DataTransferObjects\CreateVoucherObject;
|
||||
|
||||
@@ -15,8 +15,8 @@ use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Accounts\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\CreatesKeyValuePair;
|
||||
use App\Classes\Modules\Settings\Services\UpdatesKeyValuePair;
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use App\Models\Transaction;
|
||||
|
||||
|
||||
@@ -30,7 +30,16 @@ class KVPKey
|
||||
|
||||
public const CHATGPT_PROMPT_PREFIX = 'CHATGPT_PROMPT_';
|
||||
public const CLAUDE_PROMPT_PREFIX = 'CLAUDE_PROMPT_';
|
||||
|
||||
|
||||
public const BOOKING_AMOUNT_UPDATE = 'BOOKING_AMOUNT_UPDATE';
|
||||
|
||||
|
||||
public const BOOKING_IS_LOCKED = 'BOOKING_IS_LOCKED';
|
||||
|
||||
public const UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED = 'UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED';
|
||||
|
||||
public const UI_PAYMENTS_COMPLETE_CURRENCY_ORDERS_IS_LOCKED = 'UI_PAYMENTS_COMPLETE_CURRENCY_ORDERS_IS_LOCKED';
|
||||
|
||||
public const UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED = 'UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED';
|
||||
|
||||
}
|
||||
|
||||
@@ -31,4 +31,7 @@ final class RoleTypes
|
||||
self::USER => "User",
|
||||
];
|
||||
|
||||
}
|
||||
public const SYSTEM_INTERNAL = 8;
|
||||
|
||||
public const SYSTEM_EXTERNAL = 9;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Accounts;
|
||||
|
||||
|
||||
use App\Classes\Modules\Accounts\ControllersLogic\CreateSystemUserLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateSystemUserController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateSystemUserLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateSystemUserLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bookings;
|
||||
|
||||
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\CreateBookingLockLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateBookingLockController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateBookingLockLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateBookingLockLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Bookings;
|
||||
|
||||
|
||||
use App\Classes\Modules\Bookings\ControllersLogic\DeleteBookingLockLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteBookingLockController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteBookingLockLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request, DeleteBookingLockLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Classes\Modules\Rules\ControllersLogic\CheckEInvoiceRuleLogic;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckPurchaseOrderRuleLogic;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckTransferRuleLogic;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckEInvoiceAmountLimitLogic;
|
||||
use App\Classes\Modules\Rules\ControllersLogic\CheckTransferPeriodLockRuleLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -46,4 +47,13 @@ class CheckRuleController
|
||||
public function checkEInvoiceAmountLimitRule(Request $request, CheckEInvoiceAmountLimitLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CheckTransferPeriodLockRuleLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function checkTransferPeriodLockRule(Request $request, CheckTransferPeriodLockRuleLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Classes\Modules\Settings\ControllersLogic\CreateLockLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateLockController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateLockLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateLockLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Classes\Modules\Settings\ControllersLogic\FetchLockLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchLockController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchLockLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchLockLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Classes\Modules\Settings\ControllersLogic\ListLocksLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListLocksController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListLocksLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListLocksLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Classes\Modules\Settings\ControllersLogic\UpdateLockLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateLockController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateLockLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateLockLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class LockResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'key' => $this->key,
|
||||
'value' => $this->value,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\KVPKey;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\KeyValuePair;
|
||||
|
||||
|
||||
class KeyValuePairSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$data = [
|
||||
[
|
||||
'key' => KVPKey::UI_PAYMENTS_COMPLETE_CURRENCY_ORDERS_IS_LOCKED,
|
||||
'value' => 0,
|
||||
],
|
||||
[
|
||||
'key' => KVPKey::UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED,
|
||||
'value' => 0,
|
||||
],
|
||||
[
|
||||
'key' => KVPKey::UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED,
|
||||
'value' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($data as $item) {
|
||||
KeyValuePair::updateOrCreate(
|
||||
[
|
||||
'owner_type' => null,
|
||||
'owner_id' => null,
|
||||
'key' => $item['key'],
|
||||
],
|
||||
[
|
||||
'value' => $item['value'],
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+49
-7
@@ -1,6 +1,21 @@
|
||||
<template>
|
||||
<div class="row parentContainer">
|
||||
<div class="col">
|
||||
<!-- cief todo: 110 - Prototype Period Lock - Starts -->
|
||||
<!-- <button v-if="booking && !locked && lockInitialized && $store.getters.isAdmin" @click="lock">
|
||||
🔒 Lock Page
|
||||
</button>
|
||||
|
||||
<page-lock v-if="booking"
|
||||
:active="locked"
|
||||
:section="section + 'PeriodLock'"
|
||||
:company-id="booking.company.id"
|
||||
:booking-id="booking.id"
|
||||
:password="''"
|
||||
v-on:lock="lock"
|
||||
v-on:initializeLock="initializeLock">
|
||||
</page-lock> -->
|
||||
<!-- cief todo: 110 - Prototype Period Lock - Ends -->
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
|
||||
<div class="row" v-show="!isLoading" v-if="booking">
|
||||
<div class="col-md col-sm-12 m-b-20">
|
||||
@@ -424,7 +439,7 @@
|
||||
<div class="col-12 col-sm-12 col-md-5 mt-3 mt-sm-0">
|
||||
<!-- <booking-payment-quotation-component :data="booking" :section="section"></booking-payment-quotation-component> -->
|
||||
<booking-payment-quotation-v2-component :data="booking" :section="section"></booking-payment-quotation-v2-component>
|
||||
<div class="row m-t-20" v-if="booking.payment_attempts.length">
|
||||
<div class="row m-t-20" v-if="booking.payment_attempts && booking.payment_attempts.length">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
@@ -498,7 +513,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20" v-if="booking.expired_payment_attempts.length">
|
||||
<div class="row m-t-20" v-if="booking.expired_payment_attempts && booking.expired_payment_attempts.length">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
@@ -547,7 +562,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20" v-if="booking.payment_history.length">
|
||||
<div class="row m-t-20" v-if="booking.payment_history && booking.payment_history.length">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
@@ -564,7 +579,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col" v-if="booking.payment_history.length">
|
||||
<div class="col" v-if="booking.payment_history && booking.payment_history.length">
|
||||
<div class="alert alert-danger padding-15" role="alert">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -610,7 +625,9 @@
|
||||
attention: false,
|
||||
bearShowing: false,
|
||||
oneSixEightEightServiceIds: [4, 10],
|
||||
parameters: {}
|
||||
parameters: {},
|
||||
locked: true,
|
||||
lockInitialized: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -679,7 +696,10 @@
|
||||
if(section === this.section + 'CheckTransferRule'){
|
||||
window.location.href = route('billplz.bill', payload.payment_reference);
|
||||
}
|
||||
else
|
||||
else if(section === this.section + 'Lock'){
|
||||
this.locked = true;
|
||||
}
|
||||
else if(section === this.section)
|
||||
{
|
||||
this.$store.dispatch('completeList', {'name': this.section, 'data': []});
|
||||
this.isLoading = false;
|
||||
@@ -690,7 +710,7 @@
|
||||
if(section === this.section + 'CheckTransferRule' && statusCode === 422){
|
||||
console.log('Transfer expired, please create new transfer');
|
||||
}
|
||||
else{
|
||||
else if(section === this.section){
|
||||
window.location.href = this.route('dashboard');
|
||||
}
|
||||
},
|
||||
@@ -709,6 +729,28 @@
|
||||
};
|
||||
this.submit(route('api.rule.check.transfer'), 'post', this.section + 'CheckTransferRule', false, true);
|
||||
},
|
||||
initializeLock(state) {
|
||||
this.lockInitialized = true;
|
||||
this.locked = state;
|
||||
},
|
||||
lock(state){
|
||||
this.lockInitialized = true;
|
||||
this.parameters = {
|
||||
booking_id: this.booking.id,
|
||||
};
|
||||
if(state){
|
||||
this.submit(
|
||||
route("api.booking.create.lock"),
|
||||
"post",
|
||||
this.section + 'Lock',
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
else{
|
||||
this.locked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<transition name="fade">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button v-if="item.value === '0' && $store.getters.isAdmin" @click="lock(item.key)">
|
||||
🔒 Click to Lock {{ postfix ? ` ${postfix}` : '' }}
|
||||
</button>
|
||||
<button v-if="item.value === '1' && $store.getters.isAdmin" @click="lock(item.key)">
|
||||
🔓 Click to Unlock {{ postfix ? ` ${postfix}` : '' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
name: "ComponentLock",
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
postfix: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
lock(key){
|
||||
this.parameters = {
|
||||
key: key
|
||||
};
|
||||
this.submit(
|
||||
route("api.setting.update.lock"),
|
||||
"post",
|
||||
this.section,
|
||||
true,
|
||||
false
|
||||
);
|
||||
},
|
||||
successHandler(response, section, payload){
|
||||
this.$store.dispatch('reloadList', {'name': this.section});
|
||||
if(section === 'lockPaidBillGroup'){
|
||||
this.$store.dispatch('reloadList', {'name': 'paidBillGroupListSection'});
|
||||
}
|
||||
else if(section === 'lockCompleteCurrencyOrderSection'){
|
||||
this.$store.dispatch('reloadList', {'name': 'completeTransactionGroupsListSection'});
|
||||
}
|
||||
else if(section === 'lockOpenCurrencyOrderSection'){
|
||||
this.$store.dispatch('reloadList', {'name': 'openTransactionGroupsListSection'});
|
||||
}
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,216 @@
|
||||
<template>
|
||||
<transition name="fade">
|
||||
<div v-if="localActive" class="overlay-lock">
|
||||
<div class="backdrop">
|
||||
|
||||
</div>
|
||||
<div class="content" v-if="!isLoading">
|
||||
<div class="lock-box">
|
||||
<p>To edit, please enter the password to unlock page:</p>
|
||||
|
||||
<input
|
||||
v-model="passwordInput"
|
||||
type="password"
|
||||
placeholder="Enter password"
|
||||
class="password-input"
|
||||
@keyup.enter="verifyPassword"
|
||||
/>
|
||||
|
||||
<button @click="verifyPassword" class="unlock-btn">
|
||||
Unlock
|
||||
</button>
|
||||
|
||||
<p v-if="errorMessage" class="error">{{ errorMessage }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "PageLock",
|
||||
props: {
|
||||
active: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
section: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
companyId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
bookingId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
password: {
|
||||
type: String,
|
||||
default: "1234", // 🔐 Default password (you can override in parent)
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
pendingQueue() {
|
||||
return this.$store.getters.isInCompleteQueue(this.section);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localActive: this.active,
|
||||
passwordInput: "",
|
||||
errorMessage: "",
|
||||
isLoading: true,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
active(newVal) {
|
||||
this.localActive = newVal;
|
||||
},
|
||||
pendingQueue(inComplete) {
|
||||
if (inComplete) {
|
||||
this.fetchStatus();
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch("updateListQueue", { name: this.section });
|
||||
},
|
||||
methods: {
|
||||
fetchStatus() {
|
||||
this.isLoading = true;
|
||||
this.parameters = {
|
||||
booking_id: this.bookingId,
|
||||
company_id: this.companyId,
|
||||
};
|
||||
this.submit(
|
||||
route("api.rule.check.transfer.period.lock"),
|
||||
"post",
|
||||
this.section,
|
||||
false,
|
||||
false
|
||||
);
|
||||
},
|
||||
successHandler(response, section, payload) {
|
||||
console.log('response: ' , JSON.stringify(response));
|
||||
console.log('section: ' , JSON.stringify(section));
|
||||
console.log('payload: ' , JSON.stringify(payload));
|
||||
if(section === this.section){
|
||||
this.$emit("initializeLock", false); // emit unlock
|
||||
this.localActive = false;
|
||||
}
|
||||
if(section === this.section + 'UnLock'){
|
||||
this.$emit("lock", false); // emit unlock
|
||||
this.localActive = false;
|
||||
this.passwordInput = '';
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.isLoading = false;
|
||||
}, 2000);
|
||||
},
|
||||
errorHandler(response, statusCode, section) {
|
||||
this.isLoading = false;
|
||||
if (statusCode === 422) {
|
||||
// this.$emit("lock", true);
|
||||
}
|
||||
else if(statusCode === 403) {
|
||||
this.errorMessage = response.message;
|
||||
}
|
||||
},
|
||||
verifyPassword() {
|
||||
// if (this.passwordInput === this.password) {
|
||||
this.errorMessage = "";
|
||||
this.parameters = {
|
||||
booking_id: this.bookingId,
|
||||
password: this.passwordInput,
|
||||
};
|
||||
this.submit(
|
||||
route("api.booking.delete.lock", this.bookingId),
|
||||
"delete",
|
||||
this.section + 'UnLock',
|
||||
false,
|
||||
true
|
||||
);
|
||||
// } else {
|
||||
// this.errorMessage = "Incorrect password. Please try again.";
|
||||
// }
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.overlay-lock {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: 9999;
|
||||
pointer-events: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.content {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: auto;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.lock-box {
|
||||
background: white;
|
||||
border-radius: 1rem;
|
||||
padding: 2rem 3rem;
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
|
||||
text-align: center;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.password-input {
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.unlock-btn {
|
||||
margin-top: 1rem;
|
||||
padding: 0.5rem 1rem;
|
||||
border: none;
|
||||
background: #4caf50;
|
||||
color: white;
|
||||
border-radius: 0.5rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.unlock-btn:hover {
|
||||
background: #43a047;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
margin-top: 0.5rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-15 parentContainer">
|
||||
<div class="col">
|
||||
<list-component key="lock-1" section="lockSectionCompleteCurrencyOrderSection" :endpoint="route('api.setting.list.lock')" :options="{'key_value_pair_in': ['UI_PAYMENTS_COMPLETE_CURRENCY_ORDERS_IS_LOCKED']}" style="min-height: 25px;width:100%">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<component-lock section="lockSectionCompleteCurrencyOrderSection" :data="data" :postfix="'Payments > Complete Current Orders'"></component-lock>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15 parentContainer">
|
||||
<div class="col">
|
||||
<list-component key="lock-2" section="lockSectionOpenCurrencyOrderSection" :endpoint="route('api.setting.list.lock')" :options="{'key_value_pair_in': ['UI_PAYMENTS_OPEN_CURRENCY_ORDERS_IS_LOCKED']}" style="min-height: 25px;width:100%">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<component-lock section="lockSectionOpenCurrencyOrderSection" :data="data" :postfix="'Payments > Open Current Orders'"></component-lock>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15 parentContainer">
|
||||
<div class="col">
|
||||
<list-component key="lock-3" section="lockSectionPaidBillGroup" :endpoint="route('api.setting.list.lock')" :options="{'key_value_pair_in': ['UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED']}" style="min-height: 25px;width:100%">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<component-lock section="lockSectionPaidBillGroup" :data="data" :postfix="'Supplier Current Orders > Paid Current Order Tab'"></component-lock>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "LockSectionComponent",
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 50px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
|
||||
<div class="row" v-show="!$store.getters.isLoading(section)">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h6 class="all-caps m-b-5 bold no-margin">Add System User Account</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
|
||||
<div class="col">
|
||||
<small class="bold fs-10 text-danger">{{error}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.name">
|
||||
<label>Name</label>
|
||||
<input type="text" class="form-control" v-model="parameters.name">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.email">
|
||||
<label>Email</label>
|
||||
<input type="text" class="form-control" v-model="parameters.email">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.password">
|
||||
<label>Password</label>
|
||||
<input type="password" class="form-control" v-model="parameters.password">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.password_confirmation">
|
||||
<label>Password Confirmation</label>
|
||||
<input type="password" class="form-control" v-model="parameters.password_confirmation">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.is_internal">
|
||||
<label>Is Internal (Yes/No)</label>
|
||||
<input type="text" class="form-control" v-model="parameters.is_internal">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" :data-dismiss="closable ? 'modal' : ''" @click="$emit('close')">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Add System User</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import FormHandler from '../../../general/mixins/formHandler';
|
||||
import { required, sameAs, minLength , email} from "vuelidate/lib/validators";
|
||||
export default {
|
||||
props : {
|
||||
closable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
name: '',
|
||||
email: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
is_internal: '',
|
||||
}
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
name: {
|
||||
required
|
||||
},
|
||||
email: {
|
||||
required,
|
||||
email
|
||||
},
|
||||
password: {
|
||||
required,
|
||||
minLength: minLength(6)
|
||||
},
|
||||
password_confirmation: {
|
||||
required,
|
||||
sameAsPassword: sameAs('password')
|
||||
},
|
||||
is_internal: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(route('api.account.user.system.create'), 'post', this.section, true, false);
|
||||
},
|
||||
successHandler(response){
|
||||
this.closeModal();
|
||||
// this.$emit('createdAdmin', response.payload.data);
|
||||
this.formHandler();
|
||||
this.resetForm();
|
||||
console.log('api key: ' + JSON.stringify(response));
|
||||
},
|
||||
errorHandler(error){
|
||||
this.formHandler(error.message);
|
||||
}
|
||||
},
|
||||
mixins: [FormHandler]
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,8 @@
|
||||
@extends('layouts.base_portal')
|
||||
@section('inner_content')
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<lock-section-component></lock-section-component>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -426,6 +426,24 @@
|
||||
<list-admin-component section="accountsSection"></list-admin-component>
|
||||
</div>
|
||||
</div>
|
||||
@if(request('s') == 1)
|
||||
<div class="row p-b-5 m-b-20 b-b b-grey align-items-center parentContainer">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10 hint-text">
|
||||
System Accounts
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-xs btn-primary b-rad-none requestModal" data-type="createSystemUserModal">
|
||||
<i class="fa fa-plus m-r-5"></i>
|
||||
Add System Account
|
||||
</button>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="createSystemUserModal">
|
||||
<system-form-component :section="'accountsSection'"></system-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -122,6 +122,13 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<!-- cief todo: 110 - Prototype Period Lock - Starts -->
|
||||
<!-- <list-component key="lock-1" section="lockPaidBillGroup" :endpoint="route('api.setting.list.lock')" :options="{'key_value_pair_in': ['UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED']}" style="min-height: 50px;width:100%">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<component-lock section="lockPaidBillGroup" :data="data"></component-lock>
|
||||
</template>
|
||||
</list-component> -->
|
||||
<!-- cief todo: 110 - Prototype Period Lock - Ends -->
|
||||
<bill-group-list-section-component section="paidBillGroupList"></bill-group-list-section-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,4 +142,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Accounts\CreateSystemUserController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'account', 'namespace' => 'Accounts', 'as' => 'account.'], function () {
|
||||
@@ -42,6 +43,7 @@ Route::group(['prefix' => 'account', 'namespace' => 'Accounts', 'as' => 'account
|
||||
Route::post('/admin/create', 'CreateAdminUserController@create')->name('admin.create');
|
||||
Route::delete('/delete/{id}', 'DeleteUserController@delete')->name('delete');
|
||||
Route::put('/update/{id}/role', 'UpdateUserRoleController@update')->name('update.role');
|
||||
Route::post('/system/create', [CreateSystemUserController::class, 'create'])->name('system.create');
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
|
||||
require __DIR__ . '/key_value_pair.php';
|
||||
|
||||
require __DIR__ . '/setting.php';
|
||||
|
||||
// require __DIR__ . '/rate.php';
|
||||
// require __DIR__ . '/receipt.php';
|
||||
});
|
||||
|
||||
@@ -4,6 +4,8 @@ use App\Http\Controllers\Bookings\RegenerateBookingPaymentRVController;
|
||||
use App\Http\Controllers\Bookings\RegenerateBookingEInvoiceController;
|
||||
use App\Http\Controllers\Bookings\UpdateBookingAmountController;
|
||||
use App\Http\Controllers\Bookings\CreateBankingInvoiceTransactionController;
|
||||
use App\Http\Controllers\Bookings\CreateBookingLockController;
|
||||
use App\Http\Controllers\Bookings\DeleteBookingLockController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Bookings'], function () {
|
||||
@@ -11,6 +13,8 @@ Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Booking
|
||||
Route::get('/list', 'ListBookingsController@list')->name('list');
|
||||
Route::get('/list/job', 'ListBookingsJobController@list')->name('list.job');
|
||||
Route::post('/create', 'CreateBookingController@create')->name('create');
|
||||
Route::post('/create/lock', [CreateBookingLockController::class, 'create'])->name('create.lock');
|
||||
Route::delete('/delete/lock/{id}', [DeleteBookingLockController::class, 'delete'])->name('delete.lock');
|
||||
Route::put('/update/{id}', 'UpdateBookingController@update')->name('update');
|
||||
Route::put('/recipient/update/{id}', 'UpdateBookingRecipientController@update')->name('update.recipient');
|
||||
Route::put('/cancel/{id}', 'CancelBookingController@cancel')->name('cancel');
|
||||
|
||||
@@ -10,4 +10,6 @@ Route::prefix('rule')
|
||||
Route::post('/check/purchase-order', [CheckRuleController::class, 'checkPurchaseOrderRule'])->name('check.purchase.order');
|
||||
Route::post('/check/tranfer', [CheckRuleController::class, 'checkTransferRule'])->name('check.transfer');
|
||||
Route::post('/check/e-invoice/amount-limit', [CheckRuleController::class, 'checkEInvoiceAmountLimitRule'])->name('check.einvoice.amount-limit');
|
||||
|
||||
Route::post('/check/tranfer/period-lock', [CheckRuleController::class, 'checkTransferPeriodLockRule'])->name('check.transfer.period.lock');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Settings\CreateLockController;
|
||||
use App\Http\Controllers\Settings\ListLocksController;
|
||||
use App\Http\Controllers\Settings\UpdateLockController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::prefix('setting')
|
||||
->as('setting.')
|
||||
->group(function () {
|
||||
Route::post('/create/lock', [CreateLockController::class, 'create'])->name('create.lock');
|
||||
Route::post('/update/lock', [UpdateLockController::class, 'update'])->name('update.lock');
|
||||
Route::get('/list/lock', [ListLocksController::class, 'list'])->name('list.lock');
|
||||
});
|
||||
@@ -1398,3 +1398,8 @@ Route::get('/preview-unfinished-payment-orders', function (Request $request) {
|
||||
Route::get('/run-batch-unfinished-payment-orders', function (Request $request) {
|
||||
return (new UnfinishedPaymentOrders())->execute($request);
|
||||
});
|
||||
|
||||
|
||||
Route::get('/locks', function () {
|
||||
return view('pages.dashboards.admin_lock');
|
||||
})->name('admin.admin_lock');
|
||||
|
||||
Reference in New Issue
Block a user