mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-30 09:53:56 +00:00
large changes
This commit is contained in:
@@ -54,5 +54,13 @@ class UserInvitationObject
|
||||
return $this->hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null|string $hash
|
||||
*/
|
||||
public function setHash(?string $hash): void
|
||||
{
|
||||
$this->hash = $hash;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Accounts\Services;
|
||||
use App\Classes\common;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserInvitationObject;
|
||||
use App\Classes\Modules\Accounts\Exceptions\InvitationAlreadyExistsException;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\ResourceConflictException;
|
||||
use App\Models\UserInvitation;
|
||||
|
||||
final class CreatesUserInvitation
|
||||
@@ -27,17 +28,21 @@ final class CreatesUserInvitation
|
||||
/**
|
||||
* @param UserInvitationObject $object
|
||||
* @return UserInvitation|null
|
||||
* @throws ResourceConflictException
|
||||
*/
|
||||
public function execute(UserInvitationObject $object): ?UserInvitation {
|
||||
$model = $this->repository->create([
|
||||
'email' => $object->getInviteeEmail(),
|
||||
'hash' => $object->getHash(),
|
||||
'role_id' => $object->getRole(),
|
||||
'sender_id' => auth()->user()->getAuthIdentifier(),
|
||||
'is_complete' => false,
|
||||
]);
|
||||
|
||||
return $model;
|
||||
|
||||
|
||||
$this->repository->email = $object->getInviteeEmail();
|
||||
$this->repository->hash = $object->getHash();
|
||||
$this->repository->role_id = $object->getRole();
|
||||
$this->repository->sender_id = auth()->user()->getAuthIdentifier();
|
||||
$this->repository->is_complete = false;
|
||||
|
||||
$this->repository->save();
|
||||
|
||||
return $this->repository;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -12,7 +12,7 @@ namespace App\Classes\Modules\Accounts\Services;
|
||||
use App\Models\User;
|
||||
use App\Http\Resources\User as UserResource;
|
||||
|
||||
class ListUserAccount
|
||||
class ListsUserAccount
|
||||
{
|
||||
/** @var User */
|
||||
private $repository;
|
||||
@@ -29,7 +29,8 @@ class ListUserAccount
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$user = $this->repository->get();
|
||||
/** @var User $user */
|
||||
$user = $this->repository->paginate(10);
|
||||
|
||||
return UserResource::collection($user);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Omair Saleh
|
||||
* Date: 6/3/2019
|
||||
* Time: 3:12 PM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Validation;
|
||||
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserInvitationObject;
|
||||
use App\Models\UserInvitation;
|
||||
|
||||
class CanSendAccountInvitation
|
||||
{
|
||||
|
||||
/** @var UserInvitation */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* CreatesUserInvitation constructor.
|
||||
* @param UserInvitation $repository
|
||||
*/
|
||||
public function __construct(UserInvitation $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UserInvitationObject $object
|
||||
* @return bool
|
||||
*/
|
||||
public function execute(UserInvitationObject $object){
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Validation;
|
||||
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserInvitationObject;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\ResourceConflictException;
|
||||
use App\Models\UserInvitation;
|
||||
|
||||
class InvitationAlreadyExists
|
||||
{
|
||||
|
||||
/** @var UserInvitation */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* CreatesUserInvitation constructor.
|
||||
* @param UserInvitation $repository
|
||||
*/
|
||||
public function __construct(UserInvitation $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param UserInvitationObject $object
|
||||
* @return bool
|
||||
* @throws ResourceConflictException
|
||||
*/
|
||||
public function execute(UserInvitationObject $object){
|
||||
|
||||
// ensure that there is not already an invitation for the email
|
||||
$existingInvitations = $this->repository->where('email', $object->getInviteeEmail())->first();
|
||||
|
||||
if ($existingInvitations) {
|
||||
throw new ResourceConflictException("An existing invitation already exists for the email {$object->getInviteeEmail()}");
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Exceptions;
|
||||
|
||||
use App\Classes\Exceptions\Common\ErrorException;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
|
||||
final class CannotListCompanyOrderCategoryException extends ErrorException {
|
||||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function __construct(string $message) {
|
||||
parent::__construct($message, HttpStatus::BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
|
||||
class FetchCompanyOrderCategorySteps
|
||||
{
|
||||
|
||||
public function execute(string $category): array {
|
||||
switch ($category){
|
||||
case OrderSteps::COMPANY_PROCESSING_CATEGORY:
|
||||
return OrderSteps::COMPANY_ORDER_PROCESSING;
|
||||
case OrderSteps::COMPANY_SHIPPING_CATEGORY:
|
||||
return OrderSteps::COMPANY_ORDER_SHIPPING;
|
||||
case OrderSteps::COMPANY_RECEIVING_CATEGORY:
|
||||
return OrderSteps::COMPANY_ORDER_RECEIVING;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
||||
use App\Models\Order;
|
||||
use App\Http\Resources\Order as OrderResource;
|
||||
|
||||
class ListsCompanyCancelledOrders
|
||||
{
|
||||
/** @var Order */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsCompleteOrders constructor.
|
||||
* @param Order $repository
|
||||
*/
|
||||
public function __construct(Order $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
* @throws CannotListCompanyOrderCategoryException
|
||||
*/
|
||||
public function execute(int $id){
|
||||
|
||||
try {
|
||||
/** @var Order $orders */
|
||||
$orders = $this->repository->where('company_id', $id)
|
||||
->onlyTrashed()->get();
|
||||
|
||||
return OrderResource::collection($orders);
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new CannotListCompanyOrderCategoryException($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
||||
use App\Models\Order;
|
||||
use App\Http\Resources\Order as OrderResource;
|
||||
|
||||
class ListsCompanyCompleteOrders
|
||||
{
|
||||
/** @var Order */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsCompleteOrders constructor.
|
||||
* @param Order $repository
|
||||
*/
|
||||
public function __construct(Order $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
* @throws CannotListCompanyOrderCategoryException
|
||||
*/
|
||||
public function execute(int $id){
|
||||
|
||||
try {
|
||||
/** @var Order $orders */
|
||||
$orders = $this->repository->where('company_id', $id)
|
||||
->where('complete', true)->get();
|
||||
|
||||
return OrderResource::collection($orders);
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new CannotListCompanyOrderCategoryException($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
||||
use App\Models\Order;
|
||||
use App\Http\Resources\Order as OrderResource;
|
||||
|
||||
class ListsCompanyOrdersCategory
|
||||
{
|
||||
|
||||
/** @var Order */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsCompleteOrders constructor.
|
||||
* @param Order $repository
|
||||
*/
|
||||
public function __construct(Order $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(int $id, array $category){
|
||||
|
||||
try {
|
||||
/** @var Order $orders */
|
||||
$orders = $this->repository->where('company_id', $id)
|
||||
->whereIn('current_step', $category)->get();
|
||||
|
||||
return OrderResource::collection($orders);
|
||||
} catch (\Exception $exception){
|
||||
throw new CannotListCompanyOrderCategoryException($exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+18
-24
@@ -5,36 +5,35 @@ namespace App\Classes\Modules\ControllersLogic\Accounts;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserInvitationObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUserInvitation;
|
||||
use App\Classes\Modules\Accounts\Validation\CanSendAccountInvitation;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\ResourceConflictException;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Events\Accounts\UserInvited;
|
||||
use App\Models\UserInvitation;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RegistrationInvitationLogic
|
||||
class CreateAccountInvitationLogic
|
||||
{
|
||||
|
||||
/** @var UserInvitation */
|
||||
private $repository;
|
||||
|
||||
/** @var CreatesUserInvitation */
|
||||
private $createUserInvitation;
|
||||
|
||||
/** @var CanSendAccountInvitation */
|
||||
private $canSendAccountInvitation;
|
||||
|
||||
/**
|
||||
* RegistrationInvitationLogic constructor.
|
||||
* @param UserInvitation $repository
|
||||
* CreateAccountInvitationLogic constructor.
|
||||
* @param CreatesUserInvitation $createUserInvitation
|
||||
* @param CanSendAccountInvitation $canSendAccountInvitation
|
||||
*/
|
||||
public function __construct(
|
||||
UserInvitation $repository,
|
||||
CreatesUserInvitation $createUserInvitation
|
||||
) {
|
||||
$this->repository = $repository;
|
||||
public function __construct(CreatesUserInvitation $createUserInvitation, CanSendAccountInvitation $canSendAccountInvitation)
|
||||
{
|
||||
$this->createUserInvitation = $createUserInvitation;
|
||||
$this->canSendAccountInvitation = $canSendAccountInvitation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
@@ -44,23 +43,18 @@ class RegistrationInvitationLogic
|
||||
|
||||
try {
|
||||
|
||||
// the email doesn't exist in the database, so create the user
|
||||
$object = new UserInvitationObject($request->get('role_id'), $request->get('email'));
|
||||
|
||||
// ensure that there is not already an invitation for the email
|
||||
$existingInvitations = $this->repository->where('email', $object->getInviteeEmail())->get();
|
||||
if($this->canSendAccountInvitation->execute($object)){
|
||||
|
||||
if ($existingInvitations->count() !== 0) {
|
||||
throw new ResourceConflictException("An existing invitation already exists for the email {$object->getInviteeEmail()}");
|
||||
|
||||
$invitation = $this->createUserInvitation->execute($object);
|
||||
|
||||
event(new UserInvited($invitation));
|
||||
|
||||
return new JsonResponse("Invitation have been sent!", HttpStatus::RESOURCE_CREATED);
|
||||
}
|
||||
|
||||
$invitation = $this->createUserInvitation->execute($object);
|
||||
|
||||
// dispatch event for user invited
|
||||
event(new UserInvited($invitation));
|
||||
|
||||
return new JsonResponse("Invitation have been sent!", HttpStatus::RESOURCE_CREATED);
|
||||
|
||||
} catch (ResourceConflictException $exception) {
|
||||
throw new InternalServerErrorException("Failed to send user invitation because {$exception->getMessage()}");
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Accounts;
|
||||
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUserAccount;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateUserLogic
|
||||
{
|
||||
|
||||
/** @var CreatesUserAccount */
|
||||
private $createsUserAccount;
|
||||
|
||||
/**
|
||||
* RegisterAccountLogic constructor.
|
||||
*
|
||||
* @param CreatesUserAccount $createsUserAccount
|
||||
*/
|
||||
public function __construct(
|
||||
CreatesUserAccount $createsUserAccount
|
||||
) {
|
||||
$this->createsUserAccount = $createsUserAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \App\Models\User|null
|
||||
* @throws \App\Classes\Modules\Accounts\Exceptions\CannotCreateOrderException
|
||||
*/
|
||||
public function execute(Request $request){
|
||||
// the email doesn't exist in the database, so create the user
|
||||
$object = new UserObject($request->get('first_name'), $request->get('last_name'),
|
||||
$request->get('email'), $request->get('password'), 0, true);
|
||||
|
||||
|
||||
return $this->createsUserAccount->execute($object);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: user
|
||||
* Date: 08/03/2019
|
||||
* Time: 4:05 PM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Accounts;
|
||||
|
||||
|
||||
use App\Classes\Modules\Accounts\Services\ListUserAccount;
|
||||
use App\Classes\Modules\Accounts\Services\ListsUserAccount;
|
||||
|
||||
class ListUserAccountLogic
|
||||
{
|
||||
/** @var ListUserAccount */
|
||||
/** @var ListsUserAccount */
|
||||
private $listUserAccount;
|
||||
|
||||
/**
|
||||
* ListUserAccountLogic constructor.
|
||||
* @param ListUserAccount $listUserAccount
|
||||
* @param ListsUserAccount $listUserAccount
|
||||
*/
|
||||
public function __construct(ListUserAccount $listUserAccount)
|
||||
public function __construct(ListsUserAccount $listUserAccount)
|
||||
{
|
||||
$this->listUserAccount = $listUserAccount;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Companies;
|
||||
|
||||
|
||||
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
||||
use App\Classes\Modules\Companies\Services\ListsCompanyCancelledOrders;
|
||||
use App\Classes\Modules\Companies\Services\ListsCompanyCompleteOrders;
|
||||
use App\Classes\Modules\Companies\Services\FetchCompanyOrderCategorySteps;
|
||||
use App\Classes\Modules\Companies\Services\ListsCompanyOrdersCategory;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
|
||||
class ListCompanyOrderLogic
|
||||
{
|
||||
|
||||
/** @var FetchCompanyOrderCategorySteps */
|
||||
private $fetchCompanyOrderCategorySteps;
|
||||
|
||||
/** @var ListsCompanyCompleteOrders */
|
||||
private $listsCompanyCompleteOrders;
|
||||
|
||||
/** @var ListsCompanyCancelledOrders */
|
||||
private $listCompanyCancelledOrders;
|
||||
|
||||
/** @var ListsCompanyOrdersCategory */
|
||||
private $listCompanyOrdersCategory;
|
||||
|
||||
/**
|
||||
* ListCompanyOrderLogic constructor.
|
||||
* @param FetchCompanyOrderCategorySteps $fetchCompanyOrderCategorySteps
|
||||
* @param ListsCompanyCompleteOrders $listsCompanyCompleteOrders
|
||||
* @param ListsCompanyCancelledOrders $listCompanyCancelledOrders
|
||||
* @param ListsCompanyOrdersCategory $listCompanyOrdersCategory
|
||||
*/
|
||||
public function __construct(FetchCompanyOrderCategorySteps $fetchCompanyOrderCategorySteps, ListsCompanyCompleteOrders $listsCompanyCompleteOrders, ListsCompanyCancelledOrders $listCompanyCancelledOrders, ListsCompanyOrdersCategory $listCompanyOrdersCategory)
|
||||
{
|
||||
$this->fetchCompanyOrderCategorySteps = $fetchCompanyOrderCategorySteps;
|
||||
$this->listsCompanyCompleteOrders = $listsCompanyCompleteOrders;
|
||||
$this->listCompanyCancelledOrders = $listCompanyCancelledOrders;
|
||||
$this->listCompanyOrdersCategory = $listCompanyOrdersCategory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $category
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute(int $id, string $category){
|
||||
try {
|
||||
switch ($category){
|
||||
case OrderSteps::COMPANY_COMPLETE_CATEGORY:
|
||||
return $this->listsCompanyCompleteOrders->execute($id);
|
||||
case OrderSteps::COMPANY_CANCEL_CATEGORY:
|
||||
return $this->listCompanyCancelledOrders->execute($id);
|
||||
default:
|
||||
return $this->listCompanyOrdersCategory->execute($id, $this->fetchCompanyOrderCategorySteps->execute($category));
|
||||
|
||||
}
|
||||
} catch (CannotListCompanyOrderCategoryException $exception){
|
||||
throw new InternalServerErrorException('Cannot list company\'s order in category because'.$exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Orders;
|
||||
|
||||
use App\Classes\Modules\Accounts\Exceptions\CannotConfirmOrderException;
|
||||
use App\Classes\Modules\Accounts\Exceptions\CannotListCompanyOrdersException;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||
use App\Classes\Modules\Orders\Services\ConfirmsOrder;
|
||||
@@ -66,7 +66,7 @@ class ConfirmOrderLogic
|
||||
|
||||
return new JsonResponse("Order has been confirmed", HttpStatus::OK);
|
||||
|
||||
} catch (CannotConfirmOrderException $exception){
|
||||
} catch (CannotListCompanyOrdersException $exception){
|
||||
throw new InternalServerErrorException("Failed to confirm order because {$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Warehouses;
|
||||
|
||||
|
||||
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
||||
use App\Classes\Modules\Warehouses\Services\FetchWarehouseOrderCategorySteps;
|
||||
use App\Classes\Modules\Warehouses\Services\ListsWarehouseCompleteOrders;
|
||||
use App\Classes\Modules\Warehouses\Services\ListsWarehouseOrdersCategory;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
|
||||
class ListWarehouseOrderLogic
|
||||
{
|
||||
|
||||
/** @var FetchWarehouseOrderCategorySteps */
|
||||
private $fetchOrderCategorySteps;
|
||||
|
||||
/** @var ListsWarehouseOrdersCategory */
|
||||
private $listOrdersCategory;
|
||||
|
||||
/** @var ListsWarehouseCompleteOrders */
|
||||
private $listCompleteOrders;
|
||||
|
||||
/**
|
||||
* ListWarehouseOrderLogic constructor.
|
||||
* @param FetchWarehouseOrderCategorySteps $fetchOrderCategorySteps
|
||||
* @param ListsWarehouseOrdersCategory $listOrdersCategory
|
||||
* @param ListsWarehouseCompleteOrders $listCompleteOrders
|
||||
*/
|
||||
public function __construct(FetchWarehouseOrderCategorySteps $fetchOrderCategorySteps, ListsWarehouseOrdersCategory $listOrdersCategory, ListsWarehouseCompleteOrders $listCompleteOrders)
|
||||
{
|
||||
$this->fetchOrderCategorySteps = $fetchOrderCategorySteps;
|
||||
$this->listOrdersCategory = $listOrdersCategory;
|
||||
$this->listCompleteOrders = $listCompleteOrders;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $category
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute(int $id, string $category){
|
||||
try {
|
||||
switch ($category){
|
||||
case OrderSteps::WAREHOUSE_COMPLETE_CATEGORY:
|
||||
return $this->listCompleteOrders->execute($id, $this->fetchOrderCategorySteps->execute($category));
|
||||
default:
|
||||
return $this->listOrdersCategory->execute($id, $this->fetchOrderCategorySteps->execute($category));
|
||||
|
||||
}
|
||||
|
||||
} catch (CannotListCompanyOrderCategoryException $exception){
|
||||
throw new InternalServerErrorException('Cannot list warehouse\'s orders in '.$category.' category because'.$exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace App\Classes\Modules\Orders\Services\Processors;
|
||||
|
||||
|
||||
use App\Classes\Constants;
|
||||
use App\Classes\Modules\Accounts\Exceptions\CannotConfirmOrderException;
|
||||
use App\Classes\Modules\Accounts\Exceptions\CannotListCompanyOrdersException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\Modules\Orders\Services\CreatesOrderSteps;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Warehouses\Services;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
|
||||
class FetchWarehouseOrderCategorySteps
|
||||
{
|
||||
|
||||
public function execute(string $category): array {
|
||||
switch ($category){
|
||||
case OrderSteps::WAREHOUSE_RECEIVING_CATEGORY:
|
||||
return OrderSteps::WAREHOUSE_ORDER_RECEIVING;
|
||||
case OrderSteps::WAREHOUSE_SHIPPING_CATEGORY:
|
||||
return OrderSteps::WAREHOUSE_ORDER_SHIPPING;
|
||||
case OrderSteps::WAREHOUSE_COMPLETE_CATEGORY:
|
||||
return OrderSteps::WAREHOUSE_ORDER_COMPLETE;
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Warehouses\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
||||
use App\Models\Order;
|
||||
use App\Http\Resources\Order as OrderResource;
|
||||
|
||||
class ListsWarehouseCompleteOrders
|
||||
{
|
||||
|
||||
/** @var Order */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsCompleteOrders constructor.
|
||||
* @param Order $repository
|
||||
*/
|
||||
public function __construct(Order $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(int $id, array $category){
|
||||
|
||||
try {
|
||||
/** @var Order $orders */
|
||||
$orders = $this->repository->where('warehouse_id', $id)
|
||||
->whereIn('current_step', $category)
|
||||
->orWhere('complete', true)->get();
|
||||
|
||||
return OrderResource::collection($orders);
|
||||
} catch (\Exception $exception){
|
||||
throw new CannotListCompanyOrderCategoryException($exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Warehouses\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
||||
use App\Models\Order;
|
||||
use App\Http\Resources\Order as OrderResource;
|
||||
|
||||
class ListsWarehouseOrdersCategory
|
||||
{
|
||||
|
||||
/** @var Order */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsCompleteOrders constructor.
|
||||
* @param Order $repository
|
||||
*/
|
||||
public function __construct(Order $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(int $id, array $category){
|
||||
|
||||
try {
|
||||
/** @var Order $orders */
|
||||
$orders = $this->repository->where('warehouse_id', $id)
|
||||
->whereIn('current_step', $category)->get();
|
||||
|
||||
return OrderResource::collection($orders);
|
||||
} catch (\Exception $exception){
|
||||
throw new CannotListCompanyOrderCategoryException($exception->getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
|
||||
use App\Classes\Constants;
|
||||
|
||||
class OrderSteps
|
||||
{
|
||||
|
||||
public const COMPANY_PROCESSING_CATEGORY = 'processing';
|
||||
public const COMPANY_SHIPPING_CATEGORY = 'shipping';
|
||||
public const COMPANY_RECEIVING_CATEGORY = 'receiving';
|
||||
public const COMPANY_COMPLETE_CATEGORY = 'complete';
|
||||
public const COMPANY_CANCEL_CATEGORY = 'cancel';
|
||||
|
||||
public const COMPANY_ORDER_PROCESSING = [
|
||||
Constants::ORDER_PROCESSING_STEP,
|
||||
Constants::ORDER_NO_WAREHOUSE_PENDING_SUPPLIER,
|
||||
Constants::ORDER_WAREHOUSE_RECEIVING_STEP
|
||||
];
|
||||
|
||||
public const COMPANY_ORDER_SHIPPING = [
|
||||
Constants::ORDER_WAREHOUSE_PACKING_STEP,
|
||||
Constants::ORDER_SHIPPING_STEP
|
||||
];
|
||||
|
||||
public const COMPANY_ORDER_RECEIVING = [
|
||||
Constants::ORDER_WAREHOUSE_ARRIVAL_STEP,
|
||||
Constants::ORDER_WAREHOUSE_UNPACKING_STEP,
|
||||
Constants::ORDER_DELIVERY_STEP
|
||||
|
||||
];
|
||||
|
||||
public const WAREHOUSE_RECEIVING_CATEGORY = 'receiving';
|
||||
public const WAREHOUSE_SHIPPING_CATEGORY = 'shipping';
|
||||
public const WAREHOUSE_COMPLETE_CATEGORY = 'complete';
|
||||
public const WAREHOUSE_CANCEL_CATEGORY = 'cancel';
|
||||
|
||||
public const WAREHOUSE_ORDER_RECEIVING = [
|
||||
Constants::ORDER_WAREHOUSE_RECEIVING_STEP
|
||||
];
|
||||
|
||||
public const WAREHOUSE_ORDER_SHIPPING = [
|
||||
Constants::ORDER_WAREHOUSE_PACKING_STEP,
|
||||
Constants::ORDER_SHIPPING_STEP,
|
||||
];
|
||||
|
||||
public const WAREHOUSE_ORDER_COMPLETE = [
|
||||
Constants::ORDER_WAREHOUSE_ARRIVAL_STEP,
|
||||
Constants::ORDER_WAREHOUSE_UNPACKING_STEP,
|
||||
Constants::ORDER_DELIVERY_STEP
|
||||
];
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ final class UserRoles {
|
||||
public const SUPPLIER = 4;
|
||||
|
||||
|
||||
public const ROLES_ID = [
|
||||
public const ROLES_NAMES = [
|
||||
0 => 'Administrator',
|
||||
1 => 'Administrator',
|
||||
2 => 'Importer',
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
namespace App\Events\Accounts;
|
||||
|
||||
interface UserEvent {
|
||||
public function getData();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class UserInvited implements UserEvent {
|
||||
/**
|
||||
* @return UserInvitation
|
||||
*/
|
||||
public function getInvitation(): UserInvitation
|
||||
public function getData(): UserInvitation
|
||||
{
|
||||
return $this->invitation;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Account;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Accounts\CreateUserLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateUserController
|
||||
{
|
||||
public function execute(Request $request, CreateUserLogic $logic){
|
||||
return $logic->execute($request);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Account;
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Accounts\RegistrationInvitationLogic;
|
||||
use App\Classes\Modules\ControllersLogic\Accounts\CreateAccountInvitationLogic;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -11,11 +11,11 @@ class InviteUserController extends Controller
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param RegistrationInvitationLogic $logic
|
||||
* @param CreateAccountInvitationLogic $logic
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException
|
||||
*/
|
||||
public function invite(Request $request, RegistrationInvitationLogic $logic): JsonResponse {
|
||||
public function invite(Request $request, CreateAccountInvitationLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: user
|
||||
* Date: 08/03/2019
|
||||
* Time: 4:07 PM
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Account;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Accounts\ListUserAccountLogic;
|
||||
|
||||
class ListUserController
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Companies\ListCompanyOrderLogic;
|
||||
|
||||
class CompanyOrderController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $category
|
||||
* @param ListCompanyOrderLogic $logic
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
* @throws \App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException
|
||||
*/
|
||||
public function list(int $id, string $category, ListCompanyOrderLogic $logic){
|
||||
return $logic->execute($id, $category);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,12 @@ class OrderController extends Controller
|
||||
return OrderResource::collection($orders);
|
||||
}
|
||||
|
||||
public function listWarehouseOrders(String $id){
|
||||
$orders = Order::where('warehouse', $id)->orderBy('created_at', 'DESC')
|
||||
->paginate(100);
|
||||
return OrderResource::collection($orders);
|
||||
}
|
||||
|
||||
public function updateStep(String $orderId, Request $request, UpdateOrderStepLogic $logic){
|
||||
return $logic->execute($orderId, $request);
|
||||
// return (new UpdateOrderStepLogic())->execute($orderId, $request) ? 200 : 408;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Warehouses;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Warehouses\ListWarehouseOrderLogic;
|
||||
|
||||
class WarehouseOrderController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $category
|
||||
* @param ListWarehouseOrderLogic $logic
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
* @throws \App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException
|
||||
*/
|
||||
public function list(int $id, string $category, ListWarehouseOrderLogic $logic){
|
||||
return $logic->execute($id, $category);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\Constants;
|
||||
use App\Classes\ValueObjects\Constants\UserRoles;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class User extends JsonResource
|
||||
@@ -18,8 +18,8 @@ class User extends JsonResource
|
||||
{
|
||||
return [
|
||||
'full_name' => $this->first_name.' '.$this->last_name,
|
||||
'role' => UserRoles::ROLES_ID[$this->role_id],
|
||||
'created_at' => $this->created_at
|
||||
'role' => UserRoles::ROLES_NAMES[$this->role_id],
|
||||
'created_at' =>Carbon::parse($this->created_at)->format('d/m/Y')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ return [
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'noreply@izyim.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'No Reply'),
|
||||
'name' => env('MAIL_FROM_NAME', 'IZYIM'),
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
+8
-3
@@ -33,6 +33,7 @@
|
||||
"magnific-popup": "^1.1.0",
|
||||
"metrojs": "^0.9.77",
|
||||
"modernizr": "^3.5.0",
|
||||
"noty": "^3.2.0-beta",
|
||||
"owl.carousel": "^2.3.3",
|
||||
"pretty-checkbox": "^3.0.3",
|
||||
"select2": "^4.0.6-rc.1",
|
||||
@@ -42,9 +43,7 @@
|
||||
"twitter-bootstrap-wizard": "^1.2.0",
|
||||
"typeahead.js": "^0.11.1",
|
||||
"vue-avatar": "^2.1.7",
|
||||
"vue-select": "^2.5.1",
|
||||
"vue-slide-up-down": "^1.4.1",
|
||||
"vuejs-datepicker": "^1.5.4"
|
||||
"vue-slide-up-down": "^1.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.18",
|
||||
@@ -104,6 +103,7 @@
|
||||
"./node_modules/magnific-popup/dist/jquery.magnific-popup.js",
|
||||
"./node_modules/jquery-validation/dist/jquery.validate.js",
|
||||
"./node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.js",
|
||||
"./node_modules/noty/lib/noty.js",
|
||||
"./node_modules/vue/dist/vue.min.js",
|
||||
"./node_modules/switchery-npm/index.js"
|
||||
],
|
||||
@@ -123,7 +123,12 @@
|
||||
"./node_modules/magnific-popup/dist/magnific-popup.css",
|
||||
"./node_modules/pretty-checkbox/dist/pretty-checkbox.css",
|
||||
"./node_modules/bootstrap-tagsinput/dist/bootstrap-tagsinput.css",
|
||||
"./node_modules/noty/lib/noty.css",
|
||||
"./node_modules/noty/lib/themes/relax.css",
|
||||
"./node_modules/noty/lib/themes/bootstrap-v4.css",
|
||||
"./node_modules/noty/lib/themes/metroui.css",
|
||||
"./node_modules/bootstrap/dist/css/bootstrap.min.css"
|
||||
|
||||
],
|
||||
"vendorFonts": [
|
||||
"./node_modules/font-awesome/fonts/**/*"
|
||||
|
||||
Vendored
-2
@@ -28,6 +28,4 @@ $(function() {
|
||||
$('.singleLightBox').magnificPopup({
|
||||
type: 'image'
|
||||
});
|
||||
|
||||
$('.datepicker').datepicker();
|
||||
});
|
||||
Vendored
+10
@@ -38,5 +38,15 @@ $(function() {
|
||||
onfocusout: false
|
||||
});
|
||||
|
||||
$("#form-company").validate({
|
||||
rules: {
|
||||
marking: true
|
||||
},
|
||||
messages: {
|
||||
marking: "this field is required"
|
||||
},
|
||||
onfocusout: false
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
+11
@@ -2064,6 +2064,17 @@ padding-right: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.noty_bar {
|
||||
.noty_body {
|
||||
padding: 15px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.noty_buttons {
|
||||
padding: 15px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@keyframes slideDown {
|
||||
|
||||
Vendored
+14
-8
@@ -7,16 +7,12 @@
|
||||
|
||||
window.Vue = require('vue');
|
||||
|
||||
import Avatar from 'vue-avatar'
|
||||
import Avatar from 'vue-avatar';
|
||||
Vue.component('user-avatar', Avatar);
|
||||
|
||||
import SlideUpDown from 'vue-slide-up-down';
|
||||
Vue.component('slide-up-down', SlideUpDown);
|
||||
|
||||
import Datepicker from 'vuejs-datepicker';
|
||||
Vue.component('datepicker', Datepicker);
|
||||
|
||||
|
||||
/**
|
||||
* Next, we will create a fresh Vue application instance and attach it to
|
||||
* the page. Then, you may begin adding components to this application
|
||||
@@ -30,6 +26,7 @@ Vue.component('modal-component', require('./components/common/ModalComponent.vue
|
||||
Vue.component('confirm-modal-component', require('./components/common/ConfirmModalComponent.vue'));
|
||||
Vue.component('warning-message-component', require('./components/common/WarningMessageComponent.vue'));
|
||||
Vue.component('accounts-search-component', require('./components/common/AccountsSearchComponent.vue'));
|
||||
Vue.component('date-picker-component', require('./components/common/DatePickerComponent.vue'))
|
||||
|
||||
//form elements
|
||||
Vue.component('file-selector', require('./components/form_elements/FileSelectorComponent.vue'));
|
||||
@@ -37,7 +34,8 @@ Vue.component('select-component', require('./components/form_elements/SelectComp
|
||||
Vue.component('address-component', require('./components/form_elements/AddressComponent.vue'));
|
||||
|
||||
//lists
|
||||
Vue.component('accounts-list-component', require('./components/account/lists/AccountsListComponenet.vue'));
|
||||
Vue.component('accounts-list-component', require('./components/account/lists/AccountsListComponent.vue'));
|
||||
|
||||
|
||||
Vue.component('companies-list-component', require('./components/company/lists/CompaniesListComponenet.vue'));
|
||||
Vue.component('address-book-list-component', require('./components/company/lists/AddressListComponenet.vue'));
|
||||
@@ -49,7 +47,8 @@ Vue.component('warehouses-list-component', require('./components/warehouse/lists
|
||||
Vue.component('orders-list-component', require('./components/order/lists/OrdersListComponenet.vue'));
|
||||
|
||||
//elements
|
||||
Vue.component('account-component', require('./components/account/elements/AccountComponenet.vue'));
|
||||
|
||||
Vue.component('account-component', require('./components/account/elements/AccountComponent.vue'));
|
||||
|
||||
Vue.component('company-profile-component', require('./components/company/elements/CompanyProfileComponenet.vue'));
|
||||
Vue.component('company-summary-component', require('./components/company/elements/CompanySummaryComponenet.vue'));
|
||||
@@ -82,7 +81,14 @@ Vue.component('contact-form-component', require('./components/contact/forms/Cont
|
||||
|
||||
Vue.component('warehouse-form-component', require('./components/warehouse/forms/WarehouseFormComponent.vue'));
|
||||
|
||||
Vue.component('order-form-component', require('./components/order/forms/OrderFormComponent'));
|
||||
Vue.component('order-form-component', require('./components/order/forms/OrderFormComponent.vue'));
|
||||
|
||||
Vue.component('create-account-form-component', require('./components/account/forms/CreateAccountFormComponent.vue'));
|
||||
|
||||
|
||||
|
||||
Vue.component('notification-component', require('./components/common/NotificationComponent.vue'));
|
||||
Vue.component('company-error-notification-component', require('./components/company/notifications/CompanyErrorComponent.vue'));
|
||||
|
||||
|
||||
window.Event = new Vue();
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
<template>
|
||||
<div class="row m-b-10 parentContainer">
|
||||
<div class="col m-b-5">
|
||||
<div class="row bg-white no-margin">
|
||||
<div class="col p-t-5 p-b-5 b-b b-grey">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="fs-12 semi-bold no-margin">{{this.company.name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<small class="muted fs-9">{{this.company.street_one}} {{this.company.street_two}}, {{this.company.city}}, {{this.company.state}}, {{this.company.post_code}}, {{this.company.country}}</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row h-100">
|
||||
<div class="col-auto text-right bg-danger">
|
||||
<a href="#" class="requestDelete">
|
||||
<div class="row link align-items-center justify-content-center h-100" data-toggle="tooltip" title="Delete" data-placement="bottom">
|
||||
<div class="col">
|
||||
<i class="fa fa-trash text-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-auto text-right bg-info">
|
||||
<a class="pointer" @click='toggleEdit()' v-show="!isEditing">
|
||||
<div class="row link align-items-center justify-content-center h-100" data-toggle="tooltip" title="Edit" data-placement="bottom">
|
||||
<div class="col">
|
||||
<i class="fa fa-pencil text-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a class="pointer" @click='closeEdit()' v-show="isEditing">
|
||||
<div class="row link align-items-center justify-content-center h-100" data-toggle="tooltip" title="Edit" data-placement="bottom">
|
||||
<div class="col">
|
||||
<i class="fa fa-times text-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-auto text-right bg-master">
|
||||
<a :href="route('companies.profile', {companyId: this.company.id})">
|
||||
<div class="row link align-items-center justify-content-center h-100" data-toggle="tooltip" title="Manage" data-placement="bottom">
|
||||
<div class="col">
|
||||
<i class="fa fa-chevron-right text-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bg-white no-margin">
|
||||
<div class="col no-padding">
|
||||
<slide-up-down :active="isEditing" :duration="700">
|
||||
<company-form-component v-on:collapseEdit="closeEdit()" :data="this.company"></company-form-component>
|
||||
</slide-up-down>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade stick-up deleteModal">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content-wrapper">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header clearfix text-left">
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<i class="fa fa-times fs-14"></i>
|
||||
</button>
|
||||
<h6>Remove Company</h6>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="no-margin">Are you sure you want to remove <strong>{{this.company.name}}</strong>?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">
|
||||
Cancel
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-danger" data-dismiss="modal" @click="deleteCompany()">Delete Company</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: ['data'],
|
||||
data() {
|
||||
return {
|
||||
company: this.data,
|
||||
isEditing: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
Event.$on('collapseEdit', () => {
|
||||
this.closeEdit();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
route: route,
|
||||
deleteCompany(){
|
||||
fetch(route('api.company.delete', {'id': this.company.id}), {
|
||||
method: 'delete'
|
||||
}).then(response => response.json())
|
||||
.then(data => {
|
||||
Event.$emit('updateCompanyList');
|
||||
})
|
||||
.catch(error => console.log(error))
|
||||
},
|
||||
closeEdit(){
|
||||
this.isEditing = false;
|
||||
},
|
||||
toggleEdit(){
|
||||
Event.$emit('collapseEdit');
|
||||
this.isEditing = !this.isEditing;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<div class="row no-margin">
|
||||
<div class="col bg-white">
|
||||
<div class="row align-items-center justify-content-center fs-11 p-t-10 p-b-10">
|
||||
<div class="col bold">{{this.account.full_name}}</div>
|
||||
<div class="col text-complete">{{this.account.role}}</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-secondary btn-xs b-rad-none p-r-0 muted" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="muted">Action</span><i class="fa fa-angle-down m-l-5 p-l-5 p-r-5 muted"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['data'],
|
||||
data() {
|
||||
return {
|
||||
account: this.data
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div class="row align-items-center justify-content-center h-100">
|
||||
<div class="col">
|
||||
<loading-component v-show="isLoading"></loading-component>
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<div class="b-l b-success p-l-15 m-b-15" style="border-left-width: 3px;">
|
||||
<h6 class="bold all-caps no-margin text-success">Create User</h6>
|
||||
<div class="muted all-caps fs-12">Send an invitation to a new user</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" @submit.prevent="createAccount">
|
||||
<div class="row">
|
||||
<div class="col no-padding">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">first name</label>
|
||||
<input class="form-control" v-model="account.first_name">
|
||||
</div>
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">last name</label>
|
||||
<input class="form-control" v-model="account.last_name">
|
||||
</div>
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">email</label>
|
||||
<input class="form-control" v-model="account.email">
|
||||
</div>
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">password</label>
|
||||
<input class="form-control" type="password" v-model="account.password">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-right no-padding">
|
||||
<button class="btn b-rad-none btn-success" @click="createAccount" data-dismiss="modal">Send Invite</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
account: {
|
||||
first_name: null,
|
||||
last_name: null,
|
||||
email: null,
|
||||
password: null
|
||||
},
|
||||
isLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createAccount(){
|
||||
//turn on loading animation
|
||||
this.isLoading = true;
|
||||
|
||||
fetch(route('api.account.test'), {
|
||||
method: 'post',
|
||||
body: JSON.stringify(this.account),
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
}).then((response) => {
|
||||
Event.$emit('updateAccountList');
|
||||
this.clearForm();
|
||||
|
||||
//turn off loading animation
|
||||
this.isLoading = false;
|
||||
|
||||
})
|
||||
},
|
||||
clearForm() {
|
||||
this.account = {
|
||||
first_name: null,
|
||||
last_name: null,
|
||||
email: null,
|
||||
password: null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+12
-10
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="h-100">
|
||||
<accounts-search-component placeholder="Search warehouse by name..."></accounts-search-component>
|
||||
<div class="relative h-100">
|
||||
<loading-component v-show="isLoading"></loading-component>
|
||||
<account-component v-for="account in accounts" v-bind:key="account.id" :data="account"></account-component>
|
||||
<pagination-component class="m-b-20" ref="pagination" v-on:changePage="fetchAccounts($event)"></pagination-component>
|
||||
<pagination-component class="m-b-20" ref="pagination" v-on:changePage="fetchCompanies($event)"></pagination-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
@@ -16,16 +16,14 @@
|
||||
isLoading: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchAccounts();
|
||||
},
|
||||
|
||||
mounted() {
|
||||
Event.$on('updateAccountsList', () => {
|
||||
Event.$on('updateAccountList', () => {
|
||||
this.fetchAccounts();
|
||||
});
|
||||
},
|
||||
|
||||
created() {
|
||||
this.fetchAccounts();
|
||||
},
|
||||
methods: {
|
||||
fetchAccounts(page = 1){
|
||||
//turn on loading animation
|
||||
@@ -40,10 +38,14 @@
|
||||
|
||||
//turn off loading animation
|
||||
this.isLoading = false;
|
||||
|
||||
|
||||
})
|
||||
.catch(error => console.log(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<input type="text" class="form-control" v-datepicker :value="value" v-on:changeDate="updateDate($event)">
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
directives: {
|
||||
datepicker: {
|
||||
inserted (el,) {
|
||||
let vm = this;
|
||||
$(el).datepicker({
|
||||
autoclose: true,
|
||||
format: 'dd/mm/yyyy',
|
||||
todayBtn: true,
|
||||
todayHighlight: true
|
||||
}).on('changeDate',function(e){
|
||||
this.updateDate(event.target.value)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
props: ['value'],
|
||||
methods: {
|
||||
updateDate(value){
|
||||
alert(value);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div class="row" ref="content">
|
||||
<div class="col no-padding">
|
||||
<div class="row">
|
||||
<div class="col all-caps fs-13 bold" ref="title"></div>
|
||||
</div>
|
||||
<div class="row fs-12 m-t-5">
|
||||
<div class="col" ref="message"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
message: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
execute(){
|
||||
this.$refs.title.innerHTML = this.title;
|
||||
this.$refs.message.innerHTML = this.message;
|
||||
|
||||
let content = this.$refs.content;
|
||||
|
||||
new Noty({
|
||||
type: 'error',
|
||||
text: content.innerHTML.toString(),
|
||||
timeout: 5000,
|
||||
closeWith: ['button'],
|
||||
layout: "bottomRight",
|
||||
theme: "metroui"
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -36,7 +36,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="full-width side-tab">
|
||||
<a href="#profile" data-toggle="tab" role="tab">
|
||||
<a href="#address-book" data-toggle="tab" role="tab">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="row p-b-5 p-t-5 bg-white tab-container">
|
||||
@@ -114,22 +114,33 @@
|
||||
Complete
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-toggle="tab" href="#cancelled">
|
||||
Cancelled
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content bg-transparent p-l-0 p-r-0">
|
||||
<div class="tab-pane active" id="processing">
|
||||
<orders-list-component :data="companyId"></orders-list-component>
|
||||
<orders-list-component :id="companyId" type="company" category="processing"></orders-list-component>
|
||||
</div>
|
||||
<div class="tab-pane active" id="ship">
|
||||
|
||||
<div class="tab-pane" id="ship">
|
||||
<orders-list-component :id="companyId" type="company" category="shipping"></orders-list-component>
|
||||
</div>
|
||||
<div class="tab-pane active" id="receive">
|
||||
|
||||
<div class="tab-pane" id="receive">
|
||||
<orders-list-component :id="companyId" type="company" category="receiving"></orders-list-component>
|
||||
</div>
|
||||
<div class="tab-pane" id="complete">
|
||||
|
||||
<orders-list-component :id="companyId" type="company" category="complete"></orders-list-component>
|
||||
</div>
|
||||
<div class="tab-pane" id="cancelled">
|
||||
<!--<orders-list-component :data="companyId" category="cancel"></orders-list-component>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="address-book">
|
||||
<address-list-componenet :data="companyId"></address-list-componenet>
|
||||
</div>
|
||||
<div class="tab-pane" id="profile">
|
||||
<ul class="nav nav-tabs nav-tabs-simple" role="tablist" data-init-reponsive-tabs="dropdownfx">
|
||||
<li>
|
||||
@@ -180,7 +191,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddressListComponenet from "../lists/AddressListComponenet";
|
||||
export default {
|
||||
components: {AddressListComponenet},
|
||||
props: ['data'],
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<notification-component ref="notification"></notification-component>
|
||||
<loading-component v-show="isLoading"></loading-component>
|
||||
<div class="row m-t-20" v-show="!isEdit">
|
||||
<div class="col">
|
||||
@@ -9,32 +10,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" @submit.prevent="updateCompany">
|
||||
<form @submit.prevent="updateCompany">
|
||||
<div class="row">
|
||||
<div class="col no-padding">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">Marking</label>
|
||||
<input class="form-control" v-model="company.marking">
|
||||
<input class="form-control" name="marking" v-model="company.marking">
|
||||
</div>
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">Company Name</label>
|
||||
<input class="form-control" v-model="company.name">
|
||||
<input class="form-control" name="name" v-model="company.name">
|
||||
</div>
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">Email Address</label>
|
||||
<input class="form-control" v-model="company.email">
|
||||
<input class="form-control" name="email" v-model="company.email">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-l-0">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">Registration Number</label>
|
||||
<input class="form-control" v-model="company.registration_no">
|
||||
<input class="form-control" name="registration_no" v-model="company.registration_no">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-r-0">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">Tax Number</label>
|
||||
<input class="form-control" v-model="company.tax_no">
|
||||
<input class="form-control" name="tax_no" v-model="company.tax_no">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,33 +94,84 @@
|
||||
this.isEdit = true;
|
||||
this.company = this.data;
|
||||
}
|
||||
|
||||
},
|
||||
mounted: function() {
|
||||
$(this.$el).find('form').validate({
|
||||
rules: {
|
||||
marking: "required",
|
||||
name: "required",
|
||||
email: {
|
||||
required: true,
|
||||
isEmail: this
|
||||
},
|
||||
registration_no: "required",
|
||||
tax_no: "required",
|
||||
street_one: "required",
|
||||
city: "required",
|
||||
state: "required",
|
||||
post_code: "required",
|
||||
},
|
||||
messages: {
|
||||
marking: 'The marking field is required',
|
||||
email: {
|
||||
required: "The email address field is required",
|
||||
isEmail: "Enter a valid email address"
|
||||
},
|
||||
password: "The password field is required"
|
||||
},
|
||||
errorPlacement: function ( error, element ) {
|
||||
|
||||
if(element.parent().hasClass('form-group')){
|
||||
error.insertAfter( element.parent() );
|
||||
} else {
|
||||
error.insertAfter( element );
|
||||
}
|
||||
|
||||
},
|
||||
highlight: function(element) {
|
||||
$(element).parents(".form-group").addClass('has-error');
|
||||
},
|
||||
unhighlight: function(element) {
|
||||
$(element).parents(".form-group").removeClass('has-error')
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
updateCompany() {
|
||||
if($(this.$el).find('form').valid()){
|
||||
//turn on loading animation
|
||||
this.isLoading = true;
|
||||
|
||||
//turn on loading animation
|
||||
this.isLoading = true;
|
||||
var url = this.isEdit ? route('api.company.update', {id: this.company.id}) : route('api.company.create'),
|
||||
method = this.isEdit ? 'put' : 'post';
|
||||
|
||||
var url = this.isEdit ? route('api.company.update', {id: this.company.id}) : route('api.company.create'),
|
||||
method = this.isEdit ? 'put' : 'post';
|
||||
fetch(url, {
|
||||
method: method,
|
||||
body: JSON.stringify(this.company),
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
}).then((response) => {
|
||||
if(!this.isEdit){
|
||||
Event.$emit('updateCompanyList');
|
||||
this.clearForm();
|
||||
}
|
||||
|
||||
fetch(url, {
|
||||
method: method,
|
||||
body: JSON.stringify(this.company),
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
}
|
||||
}).then((response) => {
|
||||
if(!this.isEdit){
|
||||
Event.$emit('updateCompanyList');
|
||||
this.clearForm();
|
||||
}
|
||||
let notification = this.$refs.notification;
|
||||
|
||||
//turn off loading animation
|
||||
this.isLoading = false;
|
||||
notification.title = 'Created Successfully';
|
||||
notification.message = 'Importer details have been updated successfully';
|
||||
|
||||
notification.execute();
|
||||
|
||||
//turn off loading animation
|
||||
this.isLoading = false;
|
||||
|
||||
this.collapseEdit();
|
||||
})
|
||||
}
|
||||
|
||||
this.collapseEdit();
|
||||
})
|
||||
},
|
||||
updateRegistrationCertificate(files){
|
||||
this.company.registration_certificate = files;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="h-100">
|
||||
<accounts-search-component placeholder="Search importer by name, marking..."></accounts-search-component>
|
||||
<div class="relative h-100">
|
||||
<div class="relative h-100" style="min-height: 300px;">
|
||||
<loading-component v-show="isLoading"></loading-component>
|
||||
<company-component v-for="company in companies" v-bind:key="company.id" :data="company"></company-component>
|
||||
<pagination-component class="m-b-20" ref="pagination" v-on:changePage="fetchCompanies($event)"></pagination-component>
|
||||
@@ -18,7 +18,6 @@
|
||||
},
|
||||
created() {
|
||||
this.fetchCompanies();
|
||||
console.log(this.companies);
|
||||
},
|
||||
|
||||
mounted() {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "CompanyCreated"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col all-caps fs-13 bold">Failed To {{this.type}}</div>
|
||||
</div>
|
||||
<div class="row fs-12 m-t-5">
|
||||
<div class="col">{{this.message}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type: '',
|
||||
message: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'type': function() {
|
||||
this.type = this.type;
|
||||
},
|
||||
'message': function() {
|
||||
this.message = this.message;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,24 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col all-caps fs-13 bold">Created Successfully</div>
|
||||
</div>
|
||||
<div class="row fs-12 m-t-5">
|
||||
<div class="col">New importer has been created successfully</div>
|
||||
</div>
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<a class="pointer">
|
||||
<div class="btn btn-sm bg-master-darker no-border text-white m-r-5">
|
||||
<i class="fa fa-undo"></i>
|
||||
</div>
|
||||
</a>
|
||||
<a class="pointer">
|
||||
<div class="btn btn-sm bg-master-darker no-border text-white m-r-5">View</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -3,31 +3,31 @@
|
||||
<div class="col no-padding">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">Address Line 1</label>
|
||||
<input class="form-control" v-model="address.street_one" @change="changeAddress()">
|
||||
<input class="form-control" name="street_one" v-model="address.street_one" @change="changeAddress()">
|
||||
</div>
|
||||
<div class="form-group form-group-default">
|
||||
<label class="muted">Address Line 2</label>
|
||||
<input class="form-control" v-model="address.street_two" @change="changeAddress()">
|
||||
<input class="form-control" name="street_two" v-model="address.street_two" @change="changeAddress()">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-l-0">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">City</label>
|
||||
<input class="form-control" v-model="address.city" @change="changeAddress()">
|
||||
<input class="form-control" name="city" v-model="address.city" @change="changeAddress()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-r-0">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">State</label>
|
||||
<input class="form-control" v-model="address.state" @change="changeAddress()">
|
||||
<input class="form-control" name="state" v-model="address.state" @change="changeAddress()">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4 p-l-0">
|
||||
<div class="col-5 p-l-0">
|
||||
<div class="form-group form-group-default required">
|
||||
<label class="muted">Post Code</label>
|
||||
<input class="form-control" v-model="address.post_code" @change="changeAddress()">
|
||||
<input class="form-control" name="post_code" v-model="address.post_code" @change="changeAddress()">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-r-0">
|
||||
|
||||
@@ -96,9 +96,6 @@
|
||||
required: true
|
||||
}
|
||||
},
|
||||
created(){
|
||||
console.log(this.data);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
order: this.data,
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
<div class="form-group form-group-default input-group" style=" overflow: visible; ">
|
||||
<div class="form-input-group">
|
||||
<label>Date Received</label>
|
||||
<datepicker class="form-control block" v-model="receiveNote.receive_date"></datepicker>
|
||||
<!--<date-picker-component v-on:updateDate="updateReceiveDate($event)"></date-picker-component>-->
|
||||
<input class="form-control block datepicker" v-model="receiveNote.receive_date">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -88,6 +89,10 @@
|
||||
|
||||
})
|
||||
},
|
||||
updateReceiveDate(value){
|
||||
alert(value);
|
||||
this.receiveNote.receive_date = value;
|
||||
},
|
||||
clearForm(){
|
||||
this.receiveNote.tracking_no = '';
|
||||
this.receiveNote.receive_date = '';
|
||||
|
||||
@@ -57,7 +57,8 @@
|
||||
data() {
|
||||
return {
|
||||
order: {
|
||||
marking: ''
|
||||
marking: '',
|
||||
name: ''
|
||||
},
|
||||
isLoading: false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,27 @@
|
||||
<template>
|
||||
<div class="relative" style="min-height: 100%;">
|
||||
<div class="relative" style="min-height: 300px">
|
||||
<loading-component v-show="isLoading"></loading-component>
|
||||
<div class="row" v-if="!orders.length && isLoading === false">
|
||||
<div class="col text-center p-t-30 p-b-30 bg-white">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<img src="https://static.thenounproject.com/png/10066-200.png" width="60" class="hint-text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="bold all-caps p-t-15 fs-12 text-primary">Order list is empty</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<small class="all-caps fs-10 muted">No orders matching your criteria</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<order-component v-for="order in orders" v-bind:key="order.id" :data="order"></order-component>
|
||||
<pagination-component class="m-b-20" ref="pagination" v-on:changePage="fetchOrders($event)"></pagination-component>
|
||||
</div>
|
||||
@@ -9,7 +30,15 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
'data': {
|
||||
'type': {
|
||||
type: String,
|
||||
default: 'company'
|
||||
},
|
||||
'id': {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
'category': {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
@@ -33,14 +62,22 @@
|
||||
//turn on loading animation
|
||||
this.isLoading = true;
|
||||
|
||||
fetch(route('api.order.company.list', {companyId: this.data}) + '?page='+ page).then(response => response.json())
|
||||
let url = route('api.company.order.list', {id: this.id, category: this.category});
|
||||
|
||||
if(this.type === 'warehouse'){
|
||||
url = route('api.warehouse.order.list', {id: this.id, category: this.category});
|
||||
}
|
||||
|
||||
fetch(url + '?page='+ page)
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
|
||||
this.orders = response.data;
|
||||
this.$refs.pagination.makePagination(response.meta, response.links);
|
||||
|
||||
//turn off loading animation
|
||||
this.isLoading = false;
|
||||
this.$refs.pagination.makePagination(response.meta, response.links);
|
||||
|
||||
|
||||
|
||||
})
|
||||
.catch(error => console.log(error))
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="col-7">
|
||||
<div class="card no-border bg-transparent">
|
||||
<div class="tab-content bg-transparent p-l-0 p-r-0">
|
||||
<div class="tab-pane active" id="orders">
|
||||
@@ -88,13 +88,13 @@
|
||||
</ul>
|
||||
<div class="tab-content bg-transparent p-l-0 p-r-0">
|
||||
<div class="tab-pane active" id="receive">
|
||||
|
||||
<orders-list-component :id="warehouseId" type="warehouse" category="receiving"></orders-list-component>
|
||||
</div>
|
||||
<div class="tab-pane" id="ship">
|
||||
|
||||
<orders-list-component :id="warehouseId" type="warehouse" category="shipping"></orders-list-component>
|
||||
</div>
|
||||
<div class="tab-pane" id="complete">
|
||||
|
||||
<orders-list-component :id="warehouseId" type="warehouse" category="complete"></orders-list-component>
|
||||
</div>
|
||||
<div class="tab-pane" id="rejected">
|
||||
|
||||
|
||||
@@ -48,50 +48,37 @@
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<accounts-search-component placeholder="Search users by name, email, group..."></accounts-search-component>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row no-margin hint-text">
|
||||
<div class="col bg-master-lighter hint-text">
|
||||
<div class="row fs-10 muted p-t-10 p-b-10">
|
||||
<div class="col">Full Name</div>
|
||||
<div class="col">Group</div>
|
||||
<div class="col">Last Active</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card bg-transparent card-borderless">
|
||||
<ul class="nav nav-tabs nav-tabs-simple bg-white m-b-10">
|
||||
<li class="nav-item">
|
||||
<a class="active" href="#" data-toggle="tab" role="tab" data-target="#usersList">Active Users</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" data-toggle="tab" role="tab" data-target="#invitesList">Users Invites</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" data-toggle="tab" role="tab" data-target="#blockedList">Blocked Users</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content no-padding">
|
||||
<div class="tab-pane active" id="usersList">
|
||||
<accounts-list-component></accounts-list-component>
|
||||
</div>
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<div class="row no-margin">
|
||||
<div class="col bg-white">
|
||||
<div class="row align-items-center justify-content-center fs-11 p-t-10 p-b-10">
|
||||
<div class="col bold">Omair Saleh</div>
|
||||
<div class="col text-complete">Administrator</div>
|
||||
<div class="col muted">13-02-2019 2:30 PM</div>
|
||||
<div class="col text-right">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-secondary btn-xs b-rad-none p-r-0 muted" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="muted">Action</span><i class="fa fa-angle-down m-l-5 p-l-5 p-r-5 muted"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="tab-pane" id="invitesList">
|
||||
|
||||
</div>
|
||||
<div class="tab-pane" id="blockedList">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-right parentContainer">
|
||||
<button class="btn b-rad-none btn-sm btn-success m-b-20 requestModal" data-type="new">Invite User</button>
|
||||
<button class="btn b-rad-none btn-sm btn-success m-b-20 requestModal" data-type="create">create User</button>
|
||||
<modal-component type="create" effect="slide-right">
|
||||
<create-account-form-component class="text-left"></create-account-form-component>
|
||||
</modal-component>
|
||||
<modal-component type="new" effect="slide-right">
|
||||
<invite-account-form-component class="text-left"></invite-account-form-component>
|
||||
</modal-component>
|
||||
|
||||
+10
-12
@@ -19,7 +19,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
Route::group(['prefix' => 'account', 'as' => 'account.', 'namespace' => 'Account'], function () {
|
||||
Route::post('/create', 'RegisterAccountController@register')->name('create');
|
||||
Route::post('/invite', 'InviteUserController@invite')->name('invite');
|
||||
Route::get('/list/active','ListUserController@list')->name('list');
|
||||
Route::post('/test', 'CreateUserController@execute')->name('test');
|
||||
Route::get('/list/active', 'ListUserController@list')->name('list');
|
||||
});
|
||||
|
||||
// Companies Routes
|
||||
@@ -43,6 +44,9 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
// Delete company
|
||||
Route::delete('{id}', 'CompanyController@destroy')->name('delete');
|
||||
|
||||
Route::get('{id}/order/{category}/list', 'CompanyOrderController@list')
|
||||
->where('category', 'processing|shipping|receiving|complete|cancel')->name('order.list');
|
||||
|
||||
// Companies Address Book Routes
|
||||
Route::group(['prefix' => 'address-book', 'as' => 'addressBook.'], function () {
|
||||
|
||||
@@ -68,10 +72,10 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
Route::group(['prefix' => 'contact', 'as' => 'contact.', 'namespace' => 'Contacts'], function () {
|
||||
|
||||
// List contacts
|
||||
//Route::get('list/{type}/{reference}', 'ContactController@index')->name('list');
|
||||
Route::get('list/{type}/{reference}', 'ContactController@index')->name('list');
|
||||
|
||||
// Create new contact
|
||||
//Route::post('{type}/{reference}', 'ContactController@store')->name('create');
|
||||
Route::post('{type}/{reference}', 'ContactController@store')->name('create');
|
||||
|
||||
// Update contact
|
||||
Route::put('{type}/{reference}/{id}', 'ContactController@store')->name('update');
|
||||
@@ -79,15 +83,6 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
// Delete contact
|
||||
Route::delete('{id}', 'ContactController@destroy')->name('delete');
|
||||
|
||||
// Test Create Contact
|
||||
Route::post('/create/{type}/{reference}','CreateContactController@create')->name('create.contact');
|
||||
|
||||
// Test Update Contact
|
||||
Route::post('/update/{id}','UpdateContactController@update')->name('update.contact');
|
||||
|
||||
// Test List Contact
|
||||
Route::get('/list/{type}/{reference}','ListContactController@list')->name('list.contact');
|
||||
|
||||
});
|
||||
|
||||
// Warehouses Routes
|
||||
@@ -108,6 +103,9 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
// Delete warehouse
|
||||
Route::get('{id}', 'WarehouseController@destroy')->name('delete');
|
||||
|
||||
Route::get('{id}/order/{category}/list', 'WarehouseOrderController@list')
|
||||
->where('category', 'receiving|shipping|complete')->name('order.list');
|
||||
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'order', 'as' => 'order.', 'namespace' => 'Orders'], function () {
|
||||
|
||||
Reference in New Issue
Block a user