Merge branch '272-dashboard-first-order' into 'master'

272 dashboard first order

See merge request CIEFWorldwideSdnBhd/shipping-portal!35
This commit is contained in:
Fairuz
2021-08-05 03:25:50 +00:00
26 changed files with 997 additions and 107 deletions
@@ -0,0 +1,23 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class HasMorphCompanyModule implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
logger("calling");
return $builder->whereHasMorph('owner', ['App\Models\CompanyModule'], function ($query) use($value) {
$query->where('id',$value);
});
}
}
@@ -8,7 +8,7 @@ use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Addresses\Services\FetchesDistrict;
use App\Classes\Modules\Addresses\Standards\Rules\CanCreateAddress;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Http\Resources\AddressResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
@@ -33,8 +33,8 @@ class CreateAddressLogic extends AbstractControllerLogic
/** @var FetchesDistrict */
private $fetchesDistrict;
/** @var FetchesCompany */
private $fetchesCompany;
/** @var FetchesCompanyModule */
private $fetchesCompanyModule;
/** @var CreatesAddress */
private $createsAddress;
@@ -43,14 +43,14 @@ class CreateAddressLogic extends AbstractControllerLogic
* CreateAddressLogic constructor.
* @param CanCreateAddress $canCreateAddress
* @param FetchesDistrict $fetchesDistrict
* @param FetchesCompany $fetchesCompany
* @param FetchesCompanyModule $fetchesCompanyModule
* @param CreatesAddress $createsAddress
*/
public function __construct(CanCreateAddress $canCreateAddress, FetchesDistrict $fetchesDistrict, FetchesCompany $fetchesCompany, CreatesAddress $createsAddress)
public function __construct(CanCreateAddress $canCreateAddress, FetchesDistrict $fetchesDistrict, FetchesCompanyModule $fetchesCompanyModule, CreatesAddress $createsAddress)
{
$this->canCreateAddress = $canCreateAddress;
$this->fetchesDistrict = $fetchesDistrict;
$this->fetchesCompany = $fetchesCompany;
$this->fetchesCompanyModule = $fetchesCompanyModule;
$this->createsAddress = $createsAddress;
}
@@ -70,10 +70,10 @@ class CreateAddressLogic extends AbstractControllerLogic
$this->canCreateAddress->passes($object);
$query = $this->createsAddress->execute($this->fetchesCompany->execute(['id' => $request->input('company_id')]), $object);
$query = $this->createsAddress->execute($this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]), $object);
return $this->resourceResponse(new AddressResource($query));
}
}
}
@@ -6,7 +6,7 @@ use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Models\Address;
use App\Models\Company;
use App\Models\CompanyModule;
class CreatesAddress extends AbstractUpdateRelationshipRecord
{
@@ -17,7 +17,7 @@ class CreatesAddress extends AbstractUpdateRelationshipRecord
* @return \Illuminate\Database\Eloquent\Model
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute(Company $company, AddressObject $object) {
public function execute(CompanyModule $companyModule, AddressObject $object) {
$model = new Address();
$model->street_one = $object->getStreetOne();
$model->street_two = $object->getStreetTwo();
@@ -26,7 +26,7 @@ class CreatesAddress extends AbstractUpdateRelationshipRecord
$model->district_id = $object->getDistrictId();
$model->postcode = $object->getPostCode();
return $this->handler($company->addresses(), $model);
return $this->handler($companyModule->addresses(), $model);
}
}
@@ -0,0 +1,34 @@
<?php
namespace App\Classes\Modules\Companies\Services;
use App\Classes\General\Eloquent\AbstractFetchRecord;
use Illuminate\Database\Eloquent\Builder;
use App\Models\CompanyModule;
class FetchesCompanyModule extends AbstractFetchRecord
{
/** @var Company */
private $repository;
/**
* FetchesCompany constructor.
* @param Company $repository
*/
public function __construct(CompanyModule $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -0,0 +1,55 @@
<?php
namespace App\Classes\Modules\Orders\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Orders\Services\ListsOrders;
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
use App\Http\Resources\OrderResource;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class ListOrdersLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Retrieved Orders',
'message' => 'You have successfully retrieved a list of Orders'
];
}
/** @var CanListOrders */
private $canListOrders;
/** @var ListsOrders */
private $listsOrders;
/**
* ListOrdersLogic constructor.
* @param CanListOrders $canListOrders
* @param ListsOrders $listsOrders
*/
public function __construct(CanListOrders $canListOrders, ListsOrders $listsOrders)
{
$this->canListOrders = $canListOrders;
$this->listsOrders = $listsOrders;
}
public function logic(Request $request) : JsonResponse
{
$this->canListOrders->passes();
$query = $this->listsOrders->execute($this->listsOrders->deserializeFilters($request->input('filters')));
return $this->collectionResponse(OrderResource::collection($query));
}
}
@@ -0,0 +1,31 @@
<?php
namespace App\Classes\Modules\Orders\Services;
use Illuminate\Database\Eloquent\Builder;
use App\Classes\General\Eloquent\AbstractListRecord;
use App\Models\Order;
class ListsOrders extends AbstractListRecord
{
/** @var Order */
private $repository;
/**
* ListsOrders constructor.
* @param Order $repository
*/
public function __construct(Order $repository)
{
$this->repository = $repository;
}
/**
* @return Builder
*/
public function getRepository(): Builder
{
return $this->repository->newQuery();
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Classes\Modules\Orders\Standards\Rules;
use App\Classes\General\Abstracts\AbstractRule;
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
class CanListOrders extends AbstractRule
{
/**
* @return bool
*/
protected function authorized(): bool
{
// TODO Set Authorization rules
return true;
}
/**
* @param BookingObject $object
* @return bool
*/
protected function validators($object): bool
{
return true;
}
/**
* @param BookingObject $object
* @return bool
*/
protected function criteria($object): bool
{
return true;
}
}
@@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Orders;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use App\Classes\Modules\Orders\ControllersLogic\ListOrdersLogic;
class ListOrdersController
{
/**
* @param Request $request
* @param ListOrdersLogic $logic
* @return JsonResponse
*/
public function list(Request $request, ListOrdersLogic $logic) : JsonResponse {
return $logic->execute($request);
}
}
@@ -53,6 +53,7 @@
},
successHandler(){
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: this.route('login')});
this.$store.dispatch('updateIfCreateNewOrder','');
},
errorHandler(){
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: this.route('login')});
@@ -0,0 +1,128 @@
<template>
<div class="row p-t-25 text-left">
<div class="col">
<div class="shadow p-3 bg-white rounded">
<div class="d-flex flex-row align-items-center">
<input type="radio" name="answer" id="answer-2"
v-model="computeAddressId"
:value='-1'
:checked="new_address == true"
>
<label for="answer-2" data-question-number="2" class="mb-0 pl-2 pl-md-2 bold">Add New Address</label>
</div>
<div class="col-0" v-if="computeAddressId==-1">
<div class="d-flex flex-column flex-sm-row">
<div class="col px-0 pr-sm-2">
<validation-wrapper-component selecatable :validator="$v.parameters.district_id">
<label class="text-primary fs-12">District</label>
<div class="controls">
<selectable-component :endpoint="route('api.address.district.list')" section="districtListSection" valueColumn="id" :labelColumn="['city']" v-model="parameters.district_id"></selectable-component>
</div>
</validation-wrapper-component>
</div>
<div class="col px-0 pl-sm-2">
<validation-wrapper-component :validator="$v.parameters.post_code">
<label class="text-primary fs-12">Post Code</label>
<div class="controls">
<input type="text" class="form-control fs-12" v-model="parameters.post_code">
</div>
</validation-wrapper-component>
</div>
</div>
<div class="d-flex flex-column flex-sm-row">
<div class="col px-0 pr-sm-2">
<validation-wrapper-component :validator="$v.parameters.street_one">
<label class="text-primary fs-12">Street one</label>
<div class="controls">
<input type="text" class="form-control fs-12"
v-model="parameters.street_one"
>
</div>
</validation-wrapper-component>
</div>
<div class="col px-0 pl-sm-2">
<validation-wrapper-component :validator="$v.parameters.street_two">
<label class="text-primary fs-12">Street two</label>
<div class="controls">
<input type="text" class="form-control fs-12"
v-model="parameters.street_two"
>
</div>
</validation-wrapper-component>
</div>
</div>
<div class="row m-t-25">
<div class="col">
<div class="row">
<div class="col text-right">
<button type="button" class="btn btn-sm btn-primary b-rad-none" @click="submitForm()">New Address</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { required ,requiredIf } from "vuelidate/lib/validators";
export default {
props: {
address_id: null
},
watch: {
},
data() {
return {
parameters : {
company_module_id:this.$store.getters.getCompanyModuleId,
street_one: '',
street_two: '',
district_id: '',
post_code: '',
},
new_address:false
}
},
computed: {
computeAddressId:{
get() {
return this.address_id;
},
set(val) {
this.$emit('input', val);
}
},
},
validations: {
parameters: {
street_one: { required:requiredIf(function () { return this.computeAddressId === -1 }) },
street_two: {},
district_id: { required },
post_code: { required },
}
},
methods:{
submitForm(){
if(!this.validate()){
return;
}
this.isLoading = true;
this.submit((this.route('api.address.create')), 'post', 'addressList', true, true);
},
successHandler(response){
this.$emit('input', response.payload.data.id);
this.resetForm();
}
}
}
</script>
@@ -2,7 +2,7 @@
<div class="animate__animated" :class="[{'animate__shake': validator.$error}]">
<div class="row">
<div class="col">
<div class="form-group no-margin form-group-default" :class="[{' has-error': validator.$error}, {'form-group-default-select2': selecatable}, {'p-b-5': selecatable}]">
<div class="form-group no-margin" :class="[{' has-error': validator.$error}, {'form-group-default-select2': selecatable}, {'p-b-5': selecatable}]">
<slot></slot>
</div>
</div>
@@ -0,0 +1,63 @@
<template>
<div>
<div class="row">
<div class="col">
<div class="row m-b-20">
<div class="col">
<div class="font-heading fs-18 text-primary all-caps m-b-50">
Order instruction
</div>
<div class="row align-items-center">
<div class="col">
<div class="card" style="width: 18rem">
<div class="card-body">
<h5 class="card-title">Step 1</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and
make up the bulk of the card's content.
</p>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem">
<div class="card-body">
<h5 class="card-title">Step 2</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and
make up the bulk of the card's content.
</p>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 18rem">
<div class="card-body">
<h5 class="card-title">Step 3</h5>
<h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
<p class="card-text">
Some quick example text to build on the card title and
make up the bulk of the card's content.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
};
},
methods: {},
};
</script>
@@ -0,0 +1,101 @@
<template>
<div>
<div class="row">
<div class="col">
<div class="row m-b-20">
<div class="col">
<div class="font-heading fs-18 text-primary all-caps">Completed QR Code</div>
</div>
</div>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<slot name="createOrderButton"></slot>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" v-show="section!='orderList'" id="nav-order-completed-tab" data-toggle="tab" href="#nav-order-completed" role="tab" aria-controls="nav-order-completed" aria-selected="true">Completed</a>
<a class="nav-item nav-link" id="nav-order-history-tab" data-toggle="tab" href="#nav-order-history" role="tab" aria-controls="nav-order-history" aria-selected="tab">Order History</a>
<!-- <li class="nav-item">
<a class="nav-item nav-link" v-bind:class="{ active: isCreateOrderSection }" v-show="section!='orderList'" id="nav-order-completed-tab" data-toggle="tab" href="#nav-order-completed" role="tab" aria-controls="nav-order-completed" aria-selected="tab">Completed</a>
</li>
<li class="nav-item">
<a class="nav-item nav-link" v-bind:class="{ active: isOrderList }" id="nav-order-history-tab" data-toggle="tab" href="#nav-order-history" role="tab" aria-controls="nav-order-history" aria-selected="true">Order History</a>
</li> -->
</div>
</nav>
<div class="tab-content" id="nav-tabContent">
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="!completedOrder && section!='orderList'" ></loading-component>
<!-- <div class="tab-pane fade" v-bind:class="{ active: isCreateOrderSection ,show:isCreateOrderSection }" id="nav-order-completed" role="tabpanel" aria-labelledby="nav-order-completed-tab"> -->
<div class="tab-pane fade show active" id="nav-order-completed" role="tabpanel" aria-labelledby="nav-order-completed-tab">
<!-- each order component-->
<div class="card m-t-15" v-if="completedOrder">
<div class="card-body">
<h5 class="card-title">Parcel Information</h5>
<h6 class="card-subtitle mb-2 text-muted">Order Number {{completedOrder.id}}</h6>
<h5 class="card-title">Delivery Information</h5>
<h6 class="card-subtitle mb-2 text-muted">subtitle</h6>
<p class="card-text">{{completedOrder}}</p>
</div>
</div>
</div>
<div class="tab-pane fade" id="nav-order-history" role="tabpanel" aria-labelledby="nav-order-history-tab">
<!-- <div class="tab-pane fade" v-bind:class="{ active: isOrderList ,show:isOrderList }" id="nav-order-history" role="tabpanel" aria-labelledby="nav-order-history-tab"> -->
<list-component key="2" section="purchaseOrderSection1" :endpoint="route('api.order.list')" :options="{per_page: 10, CompanyModuleId :company_module_id}">
<template slot="list" slot-scope="{data}">
<div class="card m-t-15">
<div class="card-body">
<h5 class="card-title">title</h5>
<h6 class="card-subtitle mb-2 text-muted">subtitle</h6>
<p class="card-text">{{data}}</p>
</div>
</div>
</template>
</list-component>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
company_module_id:{
type: Number,
default: 1
},
completedOrder:{
default: null
},
section:null,
},
data(){
return {
}
},
computed: {
isOrderList(){
return this.section == 'orderList';
},
isCreateOrderSection(){
return this.section == 'createOrderSection';
}
},
watch: {
},
created(){
},
methods: {
},
}
</script>
@@ -0,0 +1,86 @@
<template>
<div>
<div class="row">
<div class="col">
<div class="row m-b-20">
<div class="col">
<div class="font-heading fs-18 text-primary all-caps m-b-50">Select Address</div>
</div>
</div>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
<list-component v-show="!isLoading" key="2" section="addressList" :endpoint="route('api.address.list')" :options="{per_page: 10, HasMorphCompanyModule :company_module_id}">
<template slot="list" slot-scope="{data}">
<div class="shadow p-3 mb-3 bg-white rounded">
<div class="d-flex flex-column flex-md-row align-items-center">
<div class="flex-row align-self-start pb-2 pb-sm-0">
<input type="radio" name="answer" id="answer-1"
v-model="computeAddress"
:value="data.id"
>
<label for="answer-1" data-question-number="1" class="mb-0 pl-2 pl-md-2 bold">[name]</label>
</div>
<div>
<span class="fs-12 pl-sm-3 pl-lg-5" style="color: #a6a6a6;">{{data.country.name}} {{data.street_one}} {{data.street_two}} {{data.post_code}} {{data.district.name}} {{data.state.name}}</span>
</div>
</div>
</div>
</template>
</list-component>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<slot name="addressForm" :data="item"></slot>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
company_module_id: {
type: Number,
default: 1
},
address_id:null
},
data(){
return {
isLoading: false,
createAddress: false,
selectedAddress: null,
item:{
id:null
},
status:{
error:false,
message:null,
direction:null,
},
}
},
computed: {
computeAddress:{
get() {
return this.address_id;
},
set(val) {
this.$emit('input', val);
}
},
},
watch: {
},
created(){
},
methods: {
},
}
</script>
@@ -0,0 +1,79 @@
<template>
<div>
<div class="row">
<div class="col">
<div class="row m-b-20">
<div class="col">
<div class="font-heading fs-18 text-primary all-caps m-b-50">Select Warehouse</div>
</div>
</div>
</div>
</div>
<div class="row m-b-15">
<div class="col">
<list-component key="2" section="purchaseOrderSection" :endpoint="route('api.company.list')" :options="{per_page: 10, status: 2 ,WithCompanyModuleType :4}">
<template slot="list" slot-scope="{data}">
<div class="shadow p-3 mb-3 bg-white rounded">
<div class="d-flex flex-column flex-md-row align-items-center">
<div class="flex-row align-self-start pb-2 pb-sm-0">
<input type="radio" name="warehouse"
v-model="computeWarehouse"
:value="data.id"
>
<label for="answer-1" data-question-number="1" class="mb-0 pl-2 pl-md-2 bold">{{data.name}}</label>
</div>
<div>
<span class="fs-12 pl-sm-3 pl-lg-5" style="color: #a6a6a6;">GuangZhou, China </span>
</div>
</div>
</div>
</template>
</list-component>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
warehouse: null,
},
data() {
return {
isLoading: true,
billingAddress: [],
createAddress: false,
addressDropdownLaunch: {
status: false,
},
selectedAddress: null,
item: {
id: null,
},
status: {
error: false,
message: null,
},
};
},
computed: {
computeWarehouse: {
get() {
return this.warehouse;
},
set(val) {
this.$emit("input", val);
},
},
},
watch: {
},
created() {
},
methods: {
},
};
</script>
@@ -0,0 +1,151 @@
<template>
<div class="row">
<div class="col ">
<div class="col">
<section v-if="step === 1" class="m-b-20">
<order-instruction-component v-if="step === 1" :section="section" v-show="$store.getters.getOrder == 0" v-on:updateStatus="updateStatus($event)"></order-instruction-component>
</section>
<section v-if="step === 2" class="m-b-20">
<validation-wrapper-component :validator="$v.parameters.warehouse_id" class="m-b-15">
<select-warehouse-component
:section="section"
:warehouse="parameters.warehouse_id"
@input="parameters.warehouse_id = $event"
>
</select-warehouse-component>
</validation-wrapper-component>
</section>
<section v-if="step === 3" class="m-b-20">
<validation-wrapper-component :validator="$v.parameters.address_id">
<select-address-component
:section="section"
:key="parameters.address_id"
:company_module_id="parameters.company_module_id"
:address_id="parameters.address_id"
@input="parameters.address_id = $event"
>
<template slot="addressForm">
<div class="row">
<div class="col">
<address-form-component
:address_id="parameters.address_id"
@input="parameters.address_id = $event"
></address-form-component>
</div>
</div>
</template>
</select-address-component>
</validation-wrapper-component>
</section>
<section v-if="step === 4" class="m-b-20">
<order-list-component :section="section"
:company_module_id="parameters.company_module_id"
:completedOrder="completedOrder"
></order-list-component>
</section>
<div class="row">
<div class="col">
<div class="row">
<div class="col text-center" v-if="step === 1">
<button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="changeStep('next')">Next</button>
</div>
<div class="col text-center" v-if="step === 2">
<button v-show="!this.$store.getters.orderExist" type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="changeStep('back')">Back</button>
<button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="changeStep('next')">Next</button>
</div>
<div class="col text-center" v-if="step === 3">
<button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="changeStep('back')">Back</button>
<button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="createOrder">Next(create order)</button>
</div>
<div class="col text-center" v-if="step === 4">
<button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="changeStep('reset')">Done</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import CreateOrderformValitaion from '../../../general/mixins/accounts/validation/createOrderFormValidation';
export default {
data() {
return {
section: 'createOrderSection',
error: '',
step: this.$store.getters.orderExist==0?1:2,
parameters : {
email: '',
warehouse_id:'',
address_id:'',
company_module_id:this.$store.getters.getCompanyModuleId,
street_one:'',
street_two:'',
district_id:'',
post_code:'',
},
completedOrder:null,
status:{
error:false,
message:null,
direction:null,
},
}
},
computed:{
},
methods:{
changeStep(direction){
if(direction === 'next'){
if(!this.validate()){
return;
}
this.step += 1;
this.status.direction = direction;
this.$emit('updateStatus',this.status);
this.$v.$reset();
return;
}else if(direction === 'reset'){
this.$store.dispatch('showOrderList');
this.step = this.$store.getters.orderExist==0?1:2;
this.resetForm();
return;
}
this.step -= 1;
return;
},
createOrder(){
if(!this.validate()){
return;
}
this.step += 1;
this.submit((this.route('api.order.create')), 'post', 'bookingDetailSection', true, true);
},
successHandler(response){
this.completedOrder = response.payload.data;
this.$store.dispatch('updateIfCreateNewOrder','1');
},
updateStatus(event){
console.log("receive event bus" ,event);
if(event.direction === 'next'){
this.step += 1;
}else if(event.direction === 'back'){
this.step -= 1;
}
},
},
mixins: [CreateOrderformValitaion]
}
</script>
@@ -0,0 +1,14 @@
import { required, email, numeric, sameAs, requiredUnless, requiredIf } from "vuelidate/lib/validators";
import authenticationHandler from '../authenticationHandler'
export default {
validations: {
parameters: {
warehouse_id: {
required: requiredIf(function () { return this.step === 2 })
},
address_id: {
required:requiredIf(function () { return this.step === 3})
},
}
},
}
+26
View File
@@ -0,0 +1,26 @@
export default {
state: {
orderExist:localStorage.getItem('new-order') || 0,
},
getters: {
orderExist: (state, getters) => getters.getOrder > 0 || state.orderExist,
},
mutations: {
UPDATE_IF_NEW_ORDER(state){
state.orderExist = 0;
},
},
actions: {
updateIfCreateNewOrder(store ,order){
localStorage.setItem('new-order', order);
store.commit('UPDATE_IF_NEW_ORDER');
},
showCreateOrderForm(store){
store.dispatch('toggleSection', {name: 'createOrderForm', status: true})
},
showOrderList(store){
store.dispatch('toggleSection', {name: 'orderList', status: true})
store.dispatch('toggleSection', {name: 'createOrderForm', status: false})
},
}
}
+3 -1
View File
@@ -6,6 +6,7 @@ import createNotification from './modules/createNotification'
import crudRequest from './modules/crudRequest'
import authentication from './modules/authentication'
import loadRequestQueue from './modules/loadRequestQueue'
import order from './modules/order'
Vue.use(Vuex);
@@ -16,6 +17,7 @@ export default new Vuex.Store({
loadRequestQueue,
createNotification,
crudRequest,
authentication
authentication,
order
}
})
@@ -0,0 +1,4 @@
@extends('layouts.base_portal')
@section('inner_content')
{{-- @include('pages.dashboards.customer') --}}
@endsection
@@ -1,5 +1,5 @@
<div class="row d-none" :class="[{'d-flex': !$store.getters.isAdmin}]" v-if="!$store.getters.isAdmin">
<div class="col">
<customer-dashboard-section-component></customer-dashboard-section-component>
<create-order-component v-show="$store.getters.isLoading('createOrderSection')||!$store.getters.orderExist"></create-order-component>
</div>
</div>
@@ -1,92 +1,94 @@
@extends('layouts.base_portal')
@section('inner_content')
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
@include('pages.dashboards.customer')
<template v-if="$store.getters.orderExist">
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
<h1>TEWTASE</h1>
</template>
@endsection
@@ -0,0 +1,20 @@
@extends('layouts.base_portal')
@section('inner_content')
<order-list-component
v-show="!$store.getters.isShowing('createOrderForm')"
section="orderList"
:company_module_id="$store.getters.getCompanyModuleId"
completedOrder=""
>
<template slot="createOrderButton">
<div class="row m-t-20">
<div class="col text-right">
<button type="button" class="btn btn-sm p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="$store.dispatch('showCreateOrderForm')">Create Order</button>
</div>
</div>
</template>
</order-list-component>
<create-order-component v-show="$store.getters.isShowing('createOrderForm')"></create-order-component>
@endsection
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Route;
Route::group(['prefix' => 'order', 'as' => 'order.', 'namespace' => 'Orders'], function () {
#Route::get('/{id}/show', 'FetchOrderController@fetch')->name('show');
#Route::get('/list', 'ListOrdersController@list')->name('list');
Route::get('/list', 'ListOrdersController@list')->name('list');
Route::post('/create', 'CreateOrderController@create')->name('create');
Route::put('/confirm/{id}', 'ConfirmOrderController@confirm')->name('confirm');
#Route::put('/update/{id}', 'UpdateOrderController@update')->name('update');
+8
View File
@@ -43,3 +43,11 @@ Route::get('/account/password/reset/{token}', function ($token) {
Route::get('/dashboard', function () {
return view('pages.dashboards.index');
})->name('dashboard');
Route::get('/order', function () {
return view('pages.orders.index');
})->name('order');
Route::get('/address', function () {
return view('pages.addresses.index');
})->name('address');