large commit

This commit is contained in:
Omair Saleh
2019-07-20 11:02:05 +08:00
parent f46dd05d6b
commit 74138388be
35 changed files with 786 additions and 430 deletions
@@ -6,6 +6,8 @@ use App\Classes\Constants;
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
use App\Classes\Modules\Orders\DataTransferObjects\TrackingNumberObject;
use App\Classes\Modules\Orders\Services\Attachments\UpdatesTrackingNumber;
use App\Classes\Modules\Orders\Services\SetsOrderWarehouse;
use App\Classes\Modules\Orders\Services\Steps\UpdatesStepCompleteDate;
use App\Classes\ValueObjects\Constants\HttpStatus;
@@ -20,15 +22,20 @@ class UpdateReceiveNoteLogic
/** @var UpdatesStepCompleteDate */
private $updatesStepCompleteDate;
/** @var UpdatesTrackingNumber */
private $updatesTrackingNumber;
/**
* UpdateReceiveNoteLogic constructor.
* @param SetsOrderWarehouse $setsOrderWarehouse
* @param UpdatesStepCompleteDate $updatesStepCompleteDate
* @param UpdatesTrackingNumber $updatesTrackingNumber
*/
public function __construct(SetsOrderWarehouse $setsOrderWarehouse, UpdatesStepCompleteDate $updatesStepCompleteDate)
public function __construct(SetsOrderWarehouse $setsOrderWarehouse, UpdatesStepCompleteDate $updatesStepCompleteDate, UpdatesTrackingNumber $updatesTrackingNumber)
{
$this->setsOrderWarehouse = $setsOrderWarehouse;
$this->updatesStepCompleteDate = $updatesStepCompleteDate;
$this->updatesTrackingNumber = $updatesTrackingNumber;
}
@@ -41,17 +48,20 @@ class UpdateReceiveNoteLogic
public function execute(string $orderId, Request $request){
try{
$orderObject = new OrderObject($orderId, null, $request->input('warehouse_id'));
$this->setsOrderWarehouse->execute($orderObject);
$stepObject = new StepObject(Constants::ORDER_WAREHOUSE_RECEIVING_STEP, $request->input('complete_date'));
$this->updatesStepCompleteDate->execute($orderObject, $stepObject);
$this->setsOrderWarehouse->execute($orderObject);
$this->updatesStepCompleteDate->execute($orderId, $stepObject);
$trackingNumberObject = new TrackingNumberObject(0, $request->input('tracking_number'));
$this->updatesTrackingNumber->execute($orderObject, $trackingNumberObject);
return new JsonResponse([], HttpStatus::RESOURCE_CREATED);
}catch(\Exception $exception) {
throw new InternalServerErrorException("Failed to update order's packing list because {$exception->getMessage()}");
throw new InternalServerErrorException("Failed to update order's receive note because {$exception->getMessage()}");
}
@@ -43,7 +43,7 @@ class UpdateWarehouseLogic
return new JsonResponse(null, HttpStatus::REQUEST_ACCEPTED);
} catch (\Exception $exception){
throw new InternalServerErrorException("Failed to update order's packing list because {$exception->getMessage()}");
throw new InternalServerErrorException("Failed to set warehouse because {$exception->getMessage()}");
}
@@ -23,8 +23,6 @@ class ListsOrder
public function execute(String $category){
//$order = $this->repository->where('complete',1)->paginate(10);
$category === 'complete' ? $order = $this->repository->where('complete',true)->paginate(10) :
$order = $this->repository->where('complete',false)->paginate(10);
return OrderResource::collection($order);
@@ -25,7 +25,7 @@ class ListsOrderHistory
}
public function execute(string $orderId, Carbon $createdAt, bool $complete, Carbon $lastUpdate){
public function execute(string $orderId, Carbon $createdAt){
/** @var Order $order */
$order = Order::findOrFail($orderId);
@@ -39,14 +39,14 @@ class ListsOrderHistory
switch ($step->reference_id){
case Constants::ORDER_PROCESSING_STEP:
if($order->warehouse_id){
$this->history->push(['type' => 1, 'date' => $completeDate, 'description' => Warehouse::find($order->warehouse_id)->first()->name.' confirmed as your order\'s warehouse']);
$this->history->push(['type' => 1, 'date' => $completeDate, 'description' => Warehouse::where('id', $order->warehouse_id)->first()->name.' confirmed as your order\'s warehouse']);
}
break;
case Constants::ORDER_NO_WAREHOUSE_PENDING_SUPPLIER:
$this->history->push(['type' => 1, 'date' => $completeDate, 'description' => 'Your Order has been loaded into container']);
break;
case Constants::ORDER_WAREHOUSE_RECEIVING_STEP:
$warehouse = Warehouse::find($order->warehouse_id)->first();
$warehouse = Warehouse::where('id', $order->warehouse_id)->first();
$this->history->push(['type' => 1, 'date' => $completeDate, 'description' => 'Arrived at '. $warehouse->name .' warehouse in china']);
break;
case Constants::ORDER_WAREHOUSE_PACKING_STEP:
@@ -29,10 +29,10 @@ class SetsOrderWarehouse
*/
public function execute(OrderObject $order){
try {
/** @var Order $repository */
$repository = $this->repository->findOrFail($order->getOrderId());
$repository->warehouse_id = $order->getWarehouseId();
$repository->save();
/** @var Order $orderRepository */
$orderRepository = $this->repository->findOrFail($order->getOrderId());
$orderRepository->warehouse_id = $order->getWarehouseId();
$orderRepository->save();
} catch (\Exception $exception){
throw new CannotUpdateOrderWarehouseException($exception->getMessage());
+1
View File
@@ -29,6 +29,7 @@ class TestController extends Controller
public function index(Request $request){
dd(Company::find(1)->contacts()->get());
$companiesImport = Excel::toArray(new CompaniesImport(), $request->file('xsl'));
$companies = new Collection();
+7 -2
View File
@@ -6,6 +6,7 @@ use App\Classes\Constants;
use App\Classes\Modules\Documents\ListDocuments;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\AddressBook;
use Illuminate\Support\Facades\DB;
class Company extends JsonResource
{
@@ -20,7 +21,7 @@ class Company extends JsonResource
{
$billing = AddressBook::where('company_id', $this->id)
->where('billing', true)->first();
$reports = \App\Models\Order::select(DB::raw('count(*) total'), DB::raw('SUM(CASE WHEN complete = 0 THEN 0 ELSE 1 END) active'))->where('company_id', $this->id)->first();
return [
'id' => $this->id,
'name' => $this->name,
@@ -35,7 +36,11 @@ class Company extends JsonResource
'post_code' => $billing ? $billing->post_code : null,
'country' => $billing ? $billing->country : null,
'registration_certificate' => (new ListDocuments(Constants::MODULE_TYPES['company'], $this->id, 'registration_certificate'))->execute(),
'logo' => (new ListDocuments(Constants::MODULE_TYPES['company'], $this->id, 'logo'))->execute()
'logo' => (new ListDocuments(Constants::MODULE_TYPES['company'], $this->id, 'logo'))->execute(),
'order_reports' => [
'total' => (int) $reports->total,
'active' => (int) $reports->active
]
];
}
}
+14 -3
View File
@@ -7,11 +7,15 @@ use App\Classes\Modules\Steps\GetStep;
use App\Classes\Modules\Steps\StepAttachments;
use App\Models\OrderStep;
use App\Http\Resources\OrderStep as OrderStepResource;
use App\Models\TrackingNumber;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\AddressBook as AddressBookModel;
use App\Models\DeliveryArrangement as DeliveryArrangementModel;
use App\Models\PackingList as PackingListModel;
use App\Models\ShippingArrangement as ShippingArrangementModel;
use App\Models\Warehouse as WarehouseModel;
use App\Models\Company as CompanyModel;
class Order extends JsonResource
{
@@ -23,14 +27,16 @@ class Order extends JsonResource
*/
public function toArray($request)
{
$addressBook = AddressBookModel::where('id', $this->address_id)->first();
$warehouse = $this->warehouse_id ? WarehouseModel::where('id', $this->warehouse_id)->first() : null;
$receiveDate = OrderStep::where('order_id', $this->id)->where('reference_id', 'MS_WAREHOUSE_RECEIVING')->pluck('complete_date')->first();
return [
'id' => $this->id,
'marking' => $this->marking,
'company' => CompanyModel::where('id', $this->company_id)->first(),
'forwarder_id' => $this->forwarder_id,
'supplier_id' => $this->supplier_id,
'warehouse_id' => $this->warehouse_id,
'address' => new AddressBook($addressBook),
'address' => new AddressBook(AddressBookModel::where('id', $this->address_id)->first()),
'complete' => (int)$this->complete,
'date' => $this->created_at->format('d/m/Y'),
'current_step' => [
@@ -38,7 +44,12 @@ class Order extends JsonResource
'attachments' => (new StepAttachments())->execute($this->id, $this->current_step)
],
'steps' => OrderStepResource::collection(OrderStep::where('order_id', $this->id)->orderBy('sequence')->get()),
'details' => (new ListsOrderHistory())->execute($this->id, $this->created_at, $this->complete, $this->updated_at),
'details' => (new ListsOrderHistory())->execute($this->id, $this->created_at),
'receive_note' => [
'warehouse_name' => $warehouse ? $warehouse->name : null,
'tracking_number' => TrackingNumber::Where('order_id', $this->id)->where('type', 0)->pluck('tracking_no')->first(),
'receive_date' => $receiveDate ? Carbon::parse($receiveDate)->format('d-m-Y') : null
],
'packing_list' => new PackingList(PackingListModel::where('order_id', $this->id)->first()),
'shipping_arrangement' => new ShippingArrangement(ShippingArrangementModel::where('order_id', $this->id)->first()),
'delivery_arrangement' => new DeliveryArrangement(DeliveryArrangementModel::where('order_id', $this->id)->first())
+5 -1
View File
@@ -3,6 +3,8 @@
namespace App\Providers;
use App\Http\ViewComposers\CountriesListComposer;
use Faker\Factory;
use Faker\Generator;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
@@ -28,6 +30,8 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
//
$this->app->singleton(Generator::class, function () {
return Factory::create('ms_MY');
});
}
}
+14
View File
@@ -0,0 +1,14 @@
<?php
namespace App\Traits;
use App\Models\Order;
trait ChecksIfFirstOrder
{
public function checkPackingListIsComplete(int $importerId): bool {
return Order::Where('company_id', $importerId)->get()->isEmpty();
}
}
+6 -5
View File
@@ -4,13 +4,14 @@ use Faker\Generator as Faker;
$factory->define(App\Models\AddressBook::class, function (Faker $faker) {
return [
'company_id' => $faker->numberBetween(1, 30),
'reference' => $faker->name,
'contact' => $faker->numerify('01########'),
'reference' => $faker->firstName.' '.$faker->lastName,
'contact' => $faker->phoneNumber,
'street_one' => $faker->streetAddress,
'city' => $faker->city,
'state' => $faker->city,
'state' => $faker->state,
'post_code' => $faker->postcode,
'country' => $faker->country
'country' => 'Malaysia',
'default' => 1,
'billing' => 1
];
});
+1 -1
View File
@@ -4,7 +4,7 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Company::class, function (Faker $faker) {
return [
'name' => $faker->company,
'name' => $faker->firstName.' '.$faker->companySuffix,
'marking' => 'CIEF/'.$faker->numerify('###').$faker->regexify('[A-Z]{3}'),
'email' => $faker->companyEmail,
'registration_no' => $faker->numerify('######-W'),
@@ -15,7 +15,7 @@ class CreateCompaniesTable extends Migration
{
Schema::create('companies', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 80);
$table->string('name');
$table->string('marking', 80)->unique();
$table->string('email', 80)->nullable();
$table->string('wechat_id', 80)->nullable();
@@ -16,7 +16,7 @@ class CreateAddressBookTable extends Migration
Schema::create('address_book', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id')->unsigned()->index();
$table->string('reference', 50)->nullable();
$table->string('reference')->nullable();
$table->string('contact', 25)->nullable();
$table->string('street_one', 80)->nullable();
$table->string('street_two', 80)->nullable();
@@ -15,7 +15,7 @@ class CreateWarehousesTable extends Migration
{
Schema::create('warehouses', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 50);
$table->string('name');
$table->string('email', 80)->nullable();
$table->string('street_one', 80)->nullable();
$table->string('street_two', 80)->nullable();
+1 -1
View File
@@ -11,6 +11,6 @@ class AddressBookTableSeeder extends Seeder
*/
public function run()
{
factory(App\Models\AddressBook::class, 300)->create();
factory(App\Models\AddressBook::class, 2)->create();
}
}
+3 -1
View File
@@ -11,6 +11,8 @@ class CompaniesTableSeeder extends Seeder
*/
public function run()
{
factory(App\Models\Company::class, 30)->create();
factory(App\Models\Company::class, 30)->create()->each(function ($company) {
$company->addressBook()->save(factory(App\Models\AddressBook::class)->make());
});
}
}
+1 -1
View File
@@ -12,7 +12,7 @@ class DatabaseSeeder extends Seeder
public function run(): void {
if(app()->environment() !== "production"){
$this->call(CompaniesTableSeeder::class);
$this->call(AddressBookTableSeeder::class);
// $this->call(AddressBookTableSeeder::class);
$this->call(ContactsTableSeeder::class);
$this->call(WarehousesTableSeeder::class);
// $this->call(OrdersTableSeeder::class);
Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

+1
View File
@@ -112,6 +112,7 @@ Vue.component('warehouse-form-component', require('./components/warehouse/forms/
Vue.component('order-form-component', require('./components/order/forms/OrderFormComponent.vue'));
Vue.component('addon-order-form-component', require('./components/order/forms/AddonOrderFormComponent.vue'));
Vue.component('warehouse-receive-note-form-component', require('./components/order/forms/WarehouseReceiveNoteFormComponent.vue'));
Vue.component('warehouse-bulk-receive-note-form-component', require('./components/order/forms/WarehouseBulkReceiveNoteFormComponent.vue'));
Vue.component('packing-list-form-component', require('./components/order/forms/PackingFormComponenet.vue'));
Vue.component('shipping-arrangement-form-component', require('./components/order/forms/ShippingArrangmentFormComponenet.vue'));
Vue.component('delivery-arrangement-form-component', require('./components/order/forms/DeliveryArrangmentFormComponenet.vue'));
@@ -36,7 +36,6 @@
<div class="col-auto">
<!--<div class="text-success fs-12 bold">Advanced Search</div>-->
</div>
<div class="col-1"></div>
</div>
</template>
<script>
File diff suppressed because one or more lines are too long
@@ -1,11 +1,8 @@
<template>
<div class="h-100">
<accounts-search-component placeholder="Search importer by name, marking..."></accounts-search-component>
<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>
</div>
<div class="row" 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 ml-auto" ref="pagination" v-on:changePage="fetchCompanies($event)"></pagination-component>
</div>
</template>
<script>
@@ -5,14 +5,14 @@
import Select2 from 'select2';
export default {
props: ['options', 'value'],
props: ['options', 'value', 'type'],
mounted(){
var vm = this;
$(this.$el)
.select2({
data: this.options,
containerCssClass: "error",
dropdownCssClass: "select2-dark"
dropdownCssClass: this.type ? 'select2-dark':''
})
.val(this.value)
.trigger('change')
@@ -12,7 +12,7 @@
</div>
<div class="row">
<div class="col">
<div class="fs-10 muted">Created: <span class="text-success semi-bold">{{this.order.date}}</span></div>
<div class="fs-9 muted all-caps">Importer: <a :href="route('companies.profile', {companyId: this.order.company.id})"><small class="fs-10 text-complete bold">{{this.order.company.marking}}</small></a></div>
</div>
</div>
</div>
@@ -54,5 +54,8 @@
this.order = this.data;
}
},
methods: {
route: route
}
}
</script>
@@ -50,7 +50,7 @@
</div>
</div>
</div>
<div class="row m-t-30">
<div class="row m-t-30 parentContainer">
<div class="col-3">
<div class="row no-margin">
<div class="col bg-white p-t-20 p-b-20 hint-text">
@@ -66,21 +66,22 @@
</div>
</div>
</div>
<div class="row m-l-0 m-r-0 m-t-15 m-b-20">
<div class="col bg-info p-t-20 p-b-20">
<div class="row m-b-20">
<div class="col"><span class="all-caps text-info-lighter hint-text fs-11 bold">Receive Note</span></div>
<div class="row m-l-0 m-r-0 m-t-15 m-b-20" v-if="order.receive_note.receive_date">
<div class="col bg-white p-t-0 p-b-20 p-l-0 p-r-0">
<div class="order-history-border"></div>
<div class="row m-b-20 m-l-0 m-r-0 p-t-20">
<div class="col"><span class="all-caps text-info fs-11 bold">Receive Note</span></div>
</div>
<div class="row fs-12">
<div class="row fs-12 no-margin">
<div class="col">
<div class="row m-b-15">
<div class="col">
<div class="row m-b-5">
<div class="col"><span class="all-caps text-white hint-text fs-9">Warehouse</span></div>
<div class="col"><span class="all-caps muted fs-9">Warehouse</span></div>
</div>
<div class="row">
<div class="col">
<p class="all-caps fs-11 text-white no-margin">GZ-BY-V01 广州白云江高仓库</p>
<p class="all-caps fs-11 no-margin">{{order.receive_note.warehouse_name}}</p>
</div>
</div>
</div>
@@ -88,32 +89,39 @@
<div class="row">
<div class="col-auto">
<div class="row m-b-5">
<div class="col"><span class="all-caps text-white hint-text fs-9">Receive Date</span></div>
<div class="col"><span class="all-caps muted fs-9">Receive Date</span></div>
</div>
<div class="row">
<div class="col">
<p class="all-caps text-warning no-margin bold fs-11">06/05/2019</p>
<p class="all-caps text-success no-margin fs-11">{{order.receive_note.receive_date ? order.receive_note.receive_date : 'empty' }}</p>
</div>
</div>
</div>
<div class="col-auto">
<div class="row m-b-5">
<div class="col"><span class="all-caps text-white hint-text fs-9 ">Tracking Number</span></div>
<div class="col"><span class="all-caps muted fs-9">Tracking Number</span></div>
</div>
<div class="row">
<div class="col">
<p class="all-caps no-margin text-white fs-11">432456453</p>
<p class="all-caps no-margin text-info fs-11">{{order.receive_note.tracking_number ? order.receive_note.tracking_number : 'empty' }}</p>
</div>
</div>
</div>
</div>
<div class="row m-t-20">
<div class="col"><small class="block text-complete-lighter pointer all-caps">Edit Note</small></div>
<div class="col"><small class="block text-white bold pointer all-caps p-t-5 p-b-5 bg-info text-center pointer requestModal" data-type="receiveNote">Edit Note</small></div>
</div>
</div>
</div>
</div>
</div>
<modal-component type="receiveNote" v-if="order.receive_note.receive_date">
<div class="card card-default no-border">
<div class="card-block no-padding">
<warehouse-receive-note-form-component :data="this.order"></warehouse-receive-note-form-component>
</div>
</div>
</modal-component>
</div>
<div class="col-7">
<div class="row m-l-0 m-r-0 m-b-20">
@@ -260,7 +268,7 @@
<small class="bold all-caps no-margin" >Shipping</small>
</div>
<div class="col-4 no-padding" v-show="showArrangements && order.shipping_arrangement !== null">
<small class="btn btn-xs btn-block fs-9 h-100 lh-18 p-t-5 p-b-5 bg-warning all-caps bold no-border pointer requestModal " data-type="shippingArrangement">Reschedule Shipping</small>
<small class="btn btn-xs btn-block fs-9 h-100 lh-18 p-t-5 p-b-5 bg-warning all-caps bold no-border b-rad-none bg-warning text-master-dark pointer requestModal " data-type="shippingArrangement">Reschedule Shipping</small>
</div>
</div>
</div>
@@ -289,7 +297,7 @@
<div class="col"><small class="muted">Remark</small></div>
</div>
<div class="row">
<div class="col"><small class="bold" v-if="schedule.remark">{{schedule.remark}}</small><small class="muted" v-else>...</small></div>
<div class="col"><small class="bold" v-if="schedule.issue_remark">{{schedule.issue_remark}}</small><small class="muted" v-else>...</small></div>
</div>
</div>
<div class="col text-right">
@@ -335,7 +343,7 @@
<small class="bold all-caps no-margin " >Delivery</small>
</div>
<div class="col-4 no-padding" v-show="showArrangements && order.shipping_arrangement !== null">
<small class="btn btn-xs btn-block fs-9 h-100 lh-18 p-t-5 p-b-5 bg-warning all-caps bold no-border pointer requestModal " data-type="deliveryArrangement">Reschedule Delivery</small>
<small class="btn btn-xs btn-block fs-9 h-100 lh-18 p-t-5 p-b-5 bg-warning all-caps bold no-border b-rad-none bg-warning text-master-dark pointer requestModal " data-type="deliveryArrangement">Reschedule Delivery</small>
</div>
</div>
</div>
@@ -359,7 +367,19 @@
<div class="col"><small class="bold">{{schedule.ETA}}</small></div>
</div>
</div>
<div class="col-auto ml-auto p-l-0"><i class="fa fa-circle text-success fs-8" :class="[{'text-success': schedule.status === 0}, {'text-danger': schedule.status === 2}]"></i></div>
<div class="col-auto" v-show="showArrangements">
<div class="row">
<div class="col"><small class="muted">Remark</small></div>
</div>
<div class="row">
<div class="col"><small class="bold" v-if="schedule.issue_remark">{{schedule.issue_remark}}</small><small class="muted" v-else>...</small></div>
</div>
</div>
<div class="col text-right">
<i class="fa fa-circle fs-8" :class="[{'text-success': schedule.status === 0}, {'text-danger': schedule.status === 2}]"></i>
<i class="fa fa-times text-danger fs-10 m-l-5" v-show="showArrangements"></i>
<i class="fa fa-pencil text-info fs-10 m-l-5" v-show="showArrangements"></i>
</div>
</div>
</div>
</div>
@@ -40,7 +40,7 @@
</div>
<div class="form-group form-group-default form-group-default-select2 select2-dark bg-info-light m-b-0">
<label class="muted">Importer</label>
<select-component :options="companies" v-model="order.companyId"></select-component>
<select-component :options="companies" v-model="order.companyId" type="dark"></select-component>
</div>
</div>
</div>
@@ -147,7 +147,7 @@
</div>
<div class="col no-padding">
<input type="text" class="fs-12 bold bg-white b-b b-r b-grey w-100 h-100 font-montserrat p-l-15 p-r-15 p-t-5 p-b-5 thumbnail-input" placeholder="Description" v-model="item.description">
<input type="text" class="fs-12 bold bg-white b-b b-r b-grey w-100 h-100 font-montserrat p-l-15 p-r-15 p-t-5 p-b-5 thumbnail-input" @keydown="openMessurments($event)" placeholder="Description" v-model="item.description">
</div>
</div>
</div>
@@ -260,6 +260,16 @@
}
},
methods: {
openMessurments(event){
var code = event.keyCode || event.which;
if (code === 9) {
event.preventDefault();
$(event.target).parents('.package-thumbnail').find('.dropdown').addClass('show');
$(event.target).parents('.package-thumbnail').find('.dropdown-menu').addClass('show');
$(event.target).parents('.package-thumbnail').find('.dropdown-menu input').first().select();
}
},
updatePackingList() {
//turn on loading animation
this.isLoading = true;
@@ -0,0 +1,180 @@
<template>
<div class="row">
<div class="col">
<div class="row">
<div class="col">
<div class="row">
<div class="col">
<h3 class="all-caps hint-text">Receive Note</h3>
</div>
</div>
<div class="row m-t-15">
<div class="col">
<div class="row justify-content-between">
<div class="col-6">
<div class="row">
<div class="col">
<small class="all-caps fs-12 no-margin hint-text">Warehouse</small>
</div>
</div>
<div class="row">
<div class="col">
<h6 class="bold m-t-5">{{this.warehouse.name}}</h6>
</div>
</div>
<div class="row">
<div class="col">
<small>{{this.warehouse.street_one}} {{this.warehouse.street_two}}, {{this.warehouse.city}}, {{this.warehouse.state}}, {{this.warehouse.post_code}}, {{this.warehouse.country}}</small>
</div>
</div>
</div>
<div class="col-5 text-right">
<div class="row m-b-10">
<div class="col">
<small class="all-caps fs-12 no-margin hint-text">Receive Date</small>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group m-b-0">
<div class="input-group">
<date-picker-component class="no-border" placeholder="Select Date" v-on:updateDate="updateReceiveDate($event)"></date-picker-component>
<span class="input-group-addon bg-info text-white no-border b-rad-none">
<i class="fa fa-calendar-o fa-align-justify"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-50">
<div class="col">
<div class="row no-margin" v-show="!receive_note.orders.length">
<div class="col bg-master-lightest text-center p-t-20 p-b-20">
<div class="row">
<div class="col">
<h6 class="bold all-caps m-t-0 fs-12 text-primary">You have no orders selected</h6>
</div>
</div>
<div class="row justify-content-center">
<div class="col-8">
<small class="muted fs-10 all-caps">Select at least one order from the list on the left to proceed with creating a receive note.</small>
</div>
</div>
</div>
</div>
<div class="row" v-show="receive_note.orders.length">
<div class="col">
<div class="row m-b-10 m-l-0 m-r-0">
<div class="col p-b-5 p-l-0 b-b b-grey">
<small class="fs-10 all-caps muted">Received Orders</small>
</div>
</div>
<div class="row m-b-10 m-l-0 m-r-0" v-for="(order, index) in receive_note.orders" v-bind:key="index" >
<div class="col bg-master-lighter p-t-10 p-b-10">
<div class="row align-items-center justify-content-center">
<div class="col">
<div class="row">
<div class="col">
<div class="bold fs-12 text-master">
<span class="v-align-middle">#{{ order.marking }} </span>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="fs-11 all-caps muted">Tracking No: <span class="semi-bold text-success" v-if="order.tracking_number">{{ order.tracking_number }}</span><span class="muted all-caps fs-10" v-else>Empty</span></div>
</div>
</div>
</div>
<!--<div class="col-auto">-->
<!--<i class="fa fa-times muted"></i>-->
<!--</div>-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-30">
<div class="col text-right">
<div class="btn btn-sm btn-primary b-rad-none all-caps pointer" v-show="receive_note.orders.length" @click="createReceiveNotes()">Confirm Receive Note</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
'id': {
type: String,
required: false
}
},
data() {
return {
warehouse: '',
receive_note: {
receive_date: null,
orders: []
},
}
},
created() {
this.fetchWarehouse()
},
mounted(){
Event.$on('orderSelected', (order) => {
this.updateSelection(order);
});
},
methods: {
updateReceiveDate(date){
this.receive_note.receive_date = date;
},
fetchWarehouse(){
fetch(route('api.warehouse.profile', {'id': this.id})).then(response => response.json())
.then(response => {
this.warehouse = response.data;
})
.catch(error => console.log(error))
},
updateSelection(order){
let index = this.receive_note.orders.findIndex(x => x.id === order.id);
if(index === -1){
this.receive_note.orders.push(order);
} else {
if(order.selected){
Vue.set(this.receive_note.orders, index, order)
} else {
this.receive_note.orders.splice(index, 1)
}
}
},
createReceiveNotes(){
fetch(route('api.order.bulk.receive.update'), {
method: 'post',
body: JSON.stringify(this.receive_note),
headers: {
'content-type': 'application/json'
}
}).then(() => {
this.receive_note = {
receive_date: null,
orders: []
};
Event.$emit('updateOrdersSelectList');
})
}
}
}
</script>
@@ -1,179 +1,111 @@
<template>
<div class="row">
<div class="col">
<div class="row">
<div class="col">
<div class="row">
<div class="col">
<h3 class="all-caps hint-text">Receive Note</h3>
</div>
</div>
<div class="row m-t-15">
<div class="col">
<div class="row justify-content-between">
<div class="col-6">
<div class="row">
<div class="col">
<small class="all-caps fs-12 no-margin hint-text">Warehouse</small>
</div>
</div>
<div class="row">
<div class="col">
<h6 class="bold m-t-5">{{this.warehouse.name}}</h6>
</div>
</div>
<div class="row">
<div class="col">
<small>{{this.warehouse.street_one}} {{this.warehouse.street_two}}, {{this.warehouse.city}}, {{this.warehouse.state}}, {{this.warehouse.post_code}}, {{this.warehouse.country}}</small>
</div>
</div>
</div>
<div class="col-5 text-right">
<div class="row m-b-10">
<div class="col">
<small class="all-caps fs-12 no-margin hint-text">Receive Date</small>
</div>
</div>
<div class="row">
<div class="col">
<div class="form-group m-b-0">
<div class="input-group">
<date-picker-component class="no-border" placeholder="Select Date" v-on:updateDate="updateReceiveDate($event)"></date-picker-component>
<span class="input-group-addon bg-info text-white no-border b-rad-none">
<i class="fa fa-calendar-o fa-align-justify"></i>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-50">
<div class="col">
<div class="row no-margin" v-show="!receive_note.orders.length">
<div class="col bg-master-lightest text-center p-t-20 p-b-20">
<div class="row">
<div class="col">
<h6 class="bold all-caps m-t-0 fs-12 text-primary">You have no orders selected</h6>
</div>
</div>
<div class="row justify-content-center">
<div class="col-8">
<small class="muted fs-10 all-caps">Select at least one order from the list on the left to proceed with creating a receive note.</small>
</div>
</div>
</div>
</div>
<div class="row" v-show="receive_note.orders.length">
<div class="col">
<div class="row m-b-10 m-l-0 m-r-0">
<div class="col p-b-5 p-l-0 b-b b-grey">
<small class="fs-10 all-caps muted">Received Orders</small>
</div>
</div>
<div class="row m-b-10 m-l-0 m-r-0" v-for="(order, index) in receive_note.orders" v-bind:key="index" >
<div class="col bg-master-lighter p-t-10 p-b-10">
<div class="row align-items-center justify-content-center">
<div class="col">
<div class="row">
<div class="col">
<div class="bold fs-12 text-master">
<span class="v-align-middle">#{{ order.marking }} </span>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="fs-11 all-caps muted">Tracking No: <span class="semi-bold text-success" v-if="order.tracking_number">{{ order.tracking_number }}</span><span class="muted all-caps fs-10" v-else>Empty</span></div>
</div>
</div>
</div>
<!--<div class="col-auto">-->
<!--<i class="fa fa-times muted"></i>-->
<!--</div>-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-30">
<div class="col text-right">
<div class="btn btn-sm btn-primary b-rad-none all-caps pointer" v-show="receive_note.orders.length" @click="createReceiveNotes()">Confirm Receive Note</div>
<div class="block">
<notification-component ref="notification"></notification-component>
<div class="row p-t-30">
<div class="col no-padding">
<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">Warehouse Receive Note</h6>
<div class="muted all-caps fs-12">Order Receive Note Details</div>
</div>
</div>
</div>
<form method="post" class="receiveForm">
<div class="row">
<div class="col no-padding">
<div class="form-group form-group-default form-group-default-select2 b-rad-none" >
<label class="muted" style="z-index: 10000;">Warehouse</label>
<select-component :options="this.warehouses" v-model="receiveNote.warehouse_id"></select-component>
</div>
<div class="row">
<div class="col p-l-0 p-r-5">
<div class="form-group form-group-default input-group" style=" overflow: visible; ">
<div class="form-input-group">
<label>Date Received</label>
<date-picker-component v-model="receiveNote.complete_date" :value="receiveNote.complete_date" name="complete_date"></date-picker-component>
</div>
</div>
</div>
<div class="col p-r-0 p-l-5">
<div class="form-group form-group-default input-group">
<div class="row w-100">
<div class="col no-padding">
<label class="muted block">Tracking Number</label>
<input class="form-control block" name="tracking_number" v-model="receiveNote.tracking_number">
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col text-right no-padding">
<div class="row">
<div class="col no-padding">
<button class="btn b-rad-none btn-default" data-dismiss="modal">Cancel</button>
<button type="button" data-dismiss="modal" @click="updateReceiveNote()" class="btn b-rad-none btn-success">Confirm</button>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</template>
<script>
import notificationConstant from '../../../../js/notification';
export default {
props: {
'id': {
type: String,
required: false
'data': {
required: true
}
},
data() {
data(){
return {
warehouse: '',
receive_note: {
receive_date: null,
orders: []
receiveNote: {
warehouse_id: this.data.warehouse_id,
complete_date: this.data.receive_note.receive_date,
tracking_number: this.data.receive_note.tracking_number,
},
warehouses: []
}
},
created() {
this.fetchWarehouse()
},
mounted(){
Event.$on('orderSelected', (order) => {
this.updateSelection(order);
});
created(){
this.fetchWarehouses();
},
methods: {
updateReceiveDate(date){
this.receive_note.receive_date = date;
},
fetchWarehouse(){
fetch(route('api.warehouse.profile', {'id': this.id})).then(response => response.json())
fetchWarehouses(){
//turn on loading animation
this.isLoading = true;
fetch(route('api.warehouse.list', {'all': true})).then(response => response.json())
.then(response => {
this.warehouse = response.data;
this.warehouses = $.map(response.data, function(value){
return {'id': value.id, 'text': value.name};
});
//turn off loading animation
this.isLoading = false;
})
.catch(error => console.log(error))
},
updateSelection(order){
let index = this.receive_note.orders.findIndex(x => x.id === order.id);
if(index === -1){
this.receive_note.orders.push(order);
} else {
if(order.selected){
Vue.set(this.receive_note.orders, index, order)
} else {
this.receive_note.orders.splice(index, 1)
}
updateReceiveNote() {
}
},
createReceiveNotes(){
fetch(route('api.order.bulk.receive.update'), {
fetch(route('api.order.receive.update', {orderId: this.data.id}), {
method: 'post',
body: JSON.stringify(this.receive_note),
body: JSON.stringify(this.receiveNote),
headers: {
'content-type': 'application/json'
}
}).then(() => {
this.receive_note = {
receive_date: null,
orders: []
};
Event.$emit('updateOrdersSelectList');
})
Event.$emit('updateOrdersList');
let notification = this.$refs.notification;
notification.title = notificationConstant.ORDER.WAREHOUSE_RECEIVE.TITLE;
notification.message = "Receive note has been updated successfully";
notification.execute();
});
}
}
}
@@ -18,8 +18,6 @@
<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>
File diff suppressed because one or more lines are too long
@@ -17,7 +17,7 @@
<div class="col-6">
<div class="card card-default">
<div class="card-block">
<warehouse-receive-note-form-component id="{{$warehouseId}}"></warehouse-receive-note-form-component>
<warehouse-bulk-receive-note-form-component id="{{$warehouseId}}"></warehouse-bulk-receive-note-form-component>
</div>
</div>
</div>
+1 -1
View File
@@ -142,7 +142,7 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
Route::post('/{orderId}/address','UpdateOrderAddressController@update')->name('address.order.update');
Route::post('/{orderId}/update-receive-note', 'UpdateReceiveNoteController@update')->name('receive.note.update');
Route::post('/{orderId}/update-receive-note', 'UpdateReceiveNoteController@update')->name('receive.update');
});
+1 -1
View File
@@ -28,7 +28,7 @@ Route::group(['middleware' => ['secure', 'clearcache']], function (): void {
return view('pages.accounts.profile');
})->name('user.profile');
Route::post('/test', 'TestController@index')->name('test');
Route::get('/test', 'TestController@index')->name('test');
Route::get('/accounts', function(){
return view('pages.accounts.index');