Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OniiCoder committed Feb 5, 2024
1 parent 8bdf99f commit d833450
Show file tree
Hide file tree
Showing 27 changed files with 182 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public function up()
$table->string('slug');
$table->string('phone');
$table->string('email');
$table->string('contact_person_name')->nullable();
$table->string('contact_person_phone')->nullable();
$table->dateTime('contact_person_dob')->nullable();
$table->json('meta')->nullable();
$table->dateTime('created_at')->nullable();
$table->dateTime('updated_at')->nullable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function up()
Schema::create('pamtechoga_drivers', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('nickname')->nullable();
$table->string('phone');
$table->string('email')->nullable();
$table->string('address');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function up()
$table->string('name');
$table->text('address');
$table->json('meta')->nullable();
$table->dateTime('order_date')->nullable();
$table->dateTime('created_at')->nullable();
$table->dateTime('updated_at')->nullable();
});
Expand Down
42 changes: 22 additions & 20 deletions resources/views/models/branches/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,32 @@
<x-fab::lists.table.header x-show="showColumnFilters" x-cloak class="bg-gray-100" />

@foreach($models as $branch)
<x-fab::lists.table.row :odd="$loop->odd">
@if($this->shouldShowColumn('address'))
<x-fab::lists.table.column primary full>
<a href="{{ route('lego.pamtechoga.branches.edit', $branch) }}">{{ $branch->address }}</a>
</x-fab::lists.table.column>
@endisset
@if($branch->organization)
<x-fab::lists.table.row :odd="$loop->odd">
@if($this->shouldShowColumn('address'))
<x-fab::lists.table.column primary full>
<a href="{{ route('lego.pamtechoga.branches.edit', $branch) }}">{{ $branch->address }}</a>
</x-fab::lists.table.column>
@endisset

@if($this->shouldShowColumn('organization'))
<x-fab::lists.table.column>
<a href="{{ route('lego.pamtechoga.branches.edit', $branch) }}">{{ $branch->organization->name }}</a>
</x-fab::lists.table.column>
@endif
@if($this->shouldShowColumn('organization'))
<x-fab::lists.table.column>
<a href="{{ route('lego.pamtechoga.branches.edit', $branch) }}">{{ $branch->organization->name }}</a>
</x-fab::lists.table.column>
@endif


@if($this->shouldShowColumn('updated_at'))
<x-fab::lists.table.column align="right">
{{ $branch->updated_at->toFormattedDateString() }}
</x-fab::lists.table.column>
@endisset
@if($this->shouldShowColumn('updated_at'))
<x-fab::lists.table.column align="right">
{{ $branch->updated_at->toFormattedDateString() }}
</x-fab::lists.table.column>
@endisset

<x-fab::lists.table.column align="right" slim>
<a href="{{ route('lego.pamtechoga.branches.edit', $branch) }}">Edit</a>
</x-fab::lists.table.column>
</x-fab::lists.table.row>
<x-fab::lists.table.column align="right" slim>
<a href="{{ route('lego.pamtechoga.branches.edit', $branch) }}">Edit</a>
</x-fab::lists.table.column>
</x-fab::lists.table.row>
@endif
@endforeach
</x-fab::lists.table>

Expand Down
8 changes: 4 additions & 4 deletions resources/views/models/dashboard/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@

{{-- $totalPMSDepotOrdersVolume = DepotOrder::join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_depot_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_orders.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'PMS')--}}
{{-- ->where('pamtechoga_products.type', 'LIKE', 'PMS%')--}}
{{-- ->sum('pamtechoga_depot_orders.volume');--}}

{{-- $totalPMSDepotPickupsVolume = DepotPickup::join('pamtechoga_customer_orders','pamtechoga_customer_orders.id', '=', 'pamtechoga_depot_pickups.depot_order_id')--}}
{{-- ->join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_customer_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_pickups.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'PMS')--}}
{{-- ->where('pamtechoga_products.type', 'LIKE', 'PMS%')--}}
{{-- ->sum('pamtechoga_depot_pickups.volume_assigned');--}}

{{-- $totalVolumeOfPMSAtDepot = $totalPMSDepotOrdersVolume - $totalPMSDepotPickupsVolume;--}}

{{-- $totalAGODepotOrdersVolume = DepotOrder::join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_depot_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_orders.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'AGO')--}}
{{-- ->where('pamtechoga_products.type', 'LIKE', 'AGO%')--}}
{{-- ->sum('pamtechoga_depot_orders.volume');--}}

{{-- $totalAGODepotPickupsVolume = DepotPickup::join('pamtechoga_customer_orders','pamtechoga_customer_orders.id', '=', 'pamtechoga_depot_pickups.depot_order_id')--}}
{{-- ->join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_customer_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_pickups.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'AGO')--}}
{{-- ->where('pamtechoga_products.type', 'LIKE', 'AGO%')--}}
{{-- ->sum('pamtechoga_depot_pickups.volume_assigned');--}}

{{-- $totalVolumeOfAGOAtDepot = $totalAGODepotOrdersVolume - $totalAGODepotPickupsVolume;--}}
Expand Down
14 changes: 13 additions & 1 deletion resources/views/models/depot-orders/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
<x-fab::layouts.main-with-aside>
<x-fab::layouts.panel>

<x-fab::forms.date-picker
wire:model="model.order_date"
label="Order Date"
help="This is the date this order was placed."
:options="[
'dateFormat' => 'Y-m-d H:i',
'altInput' => true,
'altFormat' => 'D, M J, Y | G:i K',
'enableTime' => true
]"
/>

<x-fab::forms.select
wire:model="model.product_id"
label="Product"
Expand Down Expand Up @@ -71,7 +83,7 @@ class="sh-mt-4"
x-sortable.products.item="{{ $data->id }}"
>
<x-fab::lists.stacked.grouped-with-actions
:title="$data?->driver?->name"
:title="$data?->driver?->name . '(' . $data?->driver->nickname . ')'"
description="{{ $data->updated_at->toFormattedDateString() }} | {{ $data->status }}"
>
<x-slot name="avatar">
Expand Down
76 changes: 5 additions & 71 deletions resources/views/models/depot-orders/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,72 +1,6 @@

{{--@php--}}
{{-- use Illuminate\Support\Facades\DB;--}}
{{-- use Vibraniuum\Pamtechoga\Models\Order;--}}
{{-- use Vibraniuum\Pamtechoga\Models\DepotOrder;--}}
{{-- use Vibraniuum\Pamtechoga\Models\DepotPickup;--}}
{{-- use Vibraniuum\Pamtechoga\Models\Product;--}}
{{-- use Vibraniuum\Pamtechoga\Models\Organization;--}}

{{-- $totalDepotOrdersAmount = DepotOrder::where('status', '<>', 'CANCELED')--}}
{{-- //->whereBetween('pamtechoga_customer_orders.created_at', [$startDate, $endDate])--}}
{{-- ->select(DB::raw('SUM(volume * unit_price) AS total'))--}}
{{-- ->first();--}}
{{-- $totalDepotOrders = DepotOrder::where('status', '<>', 'CANCELED')->count();--}}
{{-- $totalDepotOrdersVolume = DepotOrder::where('status', '<>', 'CANCELED')->sum('volume');--}}

{{-- $ordersBreakDownByProduct = Order::select( 'pamtechoga_customer_orders.product_id', 'pamtechoga_products.type', DB::raw('SUM(pamtechoga_customer_orders.volume) as total'))--}}
{{-- ->join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_customer_orders.product_id')--}}
{{-- ->where('status', '<>', 'CANCELED')--}}
{{-- //->whereBetween('pamtechoga_customer_orders.created_at', [$startDate, $endDate])--}}
{{-- ->groupBy('product_id')--}}
{{-- ->get();--}}

{{-- $totalPMSDepotOrdersVolume = DepotOrder::join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_depot_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_orders.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'PMS')--}}
{{-- ->sum('pamtechoga_depot_orders.volume');--}}

{{-- $totalPMSDepotPickupsVolume = DepotPickup::join('pamtechoga_customer_orders','pamtechoga_customer_orders.id', '=', 'pamtechoga_depot_pickups.depot_order_id')--}}
{{-- ->join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_customer_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_pickups.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'PMS')--}}
{{-- ->sum('pamtechoga_depot_pickups.volume_assigned');--}}

{{-- $totalVolumeOfPMSAtDepot = $totalPMSDepotOrdersVolume - $totalPMSDepotPickupsVolume;--}}

{{-- $totalAGODepotOrdersVolume = DepotOrder::join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_depot_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_orders.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'AGO')--}}
{{-- ->sum('pamtechoga_depot_orders.volume');--}}

{{-- $totalAGODepotPickupsVolume = DepotPickup::join('pamtechoga_customer_orders','pamtechoga_customer_orders.id', '=', 'pamtechoga_depot_pickups.depot_order_id')--}}
{{-- ->join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_customer_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_pickups.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_products.type', 'AGO')--}}
{{-- ->sum('pamtechoga_depot_pickups.volume_assigned');--}}

{{-- $totalVolumeOfAGOAtDepot = $totalAGODepotOrdersVolume - $totalAGODepotPickupsVolume;--}}

{{-- $totalVolumeOfPMSInTrucks = $totalAGODepotOrdersVolume - $totalAGODepotPickupsVolume;--}}

{{-- $deliveredOrdersVolumeByProduct = Order::select( 'pamtechoga_customer_orders.product_id', 'pamtechoga_products.type', DB::raw('SUM(pamtechoga_customer_orders.volume) as total'))--}}
{{-- ->join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_customer_orders.product_id')--}}
{{-- ->where('status', '=', 'DELIVERED')--}}
{{-- ->orWhere('status', '=', 'DISPATCHED')--}}
{{-- //->whereBetween('pamtechoga_customer_orders.created_at', [$startDate, $endDate])--}}
{{-- ->groupBy('product_id')--}}
{{-- ->get();--}}

{{-- $totalVolumeOfLoadedProductPickup = function ($type) {--}}
{{-- DepotPickup::join('pamtechoga_customer_orders','pamtechoga_customer_orders.id', '=', 'pamtechoga_depot_pickups.depot_order_id')--}}
{{-- ->join('pamtechoga_products','pamtechoga_products.id', '=', 'pamtechoga_customer_orders.product_id')--}}
{{-- ->where('pamtechoga_depot_pickups.status', '<>', 'CANCELED')--}}
{{-- ->where('pamtechoga_depot_pickups.status', '=', 'LOADED') // Ask Pamtech if LOADed means it is already in the truck or still at the depot.--}}
{{-- ->where('pamtechoga_products.type', $type)--}}
{{-- ->sum('pamtechoga_depot_pickups.volume_assigned');--}}
{{-- }--}}

{{--@endphp--}}
@php
use Carbon\Carbon;
@endphp

<x-fab::layouts.page
title="Depot Orders"
Expand Down Expand Up @@ -159,9 +93,9 @@
</x-fab::lists.table.column>
@endif

@if($this->shouldShowColumn('updated_at'))
@if($this->shouldShowColumn('order_date'))
<x-fab::lists.table.column align="right">
{{ $data->updated_at->toFormattedDateString() }}
{{ Carbon::parse($data->order_date)->toFormattedDateString() }}
</x-fab::lists.table.column>
@endisset

Expand Down
24 changes: 12 additions & 12 deletions resources/views/models/depot-pickups/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
@endforeach
</x-fab::forms.select>

<x-fab::forms.date-picker
wire:model="model.pickup_datetime"
label="Date for pickup"
help="This is the datetime product should be picked up."
:options="[
'dateFormat' => 'Y-m-d H:i',
'altInput' => true,
'altFormat' => 'D, M J, Y | G:i K',
'enableTime' => true
]"
/>
{{-- <x-fab::forms.date-picker--}}
{{-- wire:model="model.pickup_datetime"--}}
{{-- label="Date for pickup"--}}
{{-- help="This is the datetime product should be picked up."--}}
{{-- :options="[--}}
{{-- 'dateFormat' => 'Y-m-d H:i',--}}
{{-- 'altInput' => true,--}}
{{-- 'altFormat' => 'D, M J, Y | G:i K',--}}
{{-- 'enableTime' => true--}}
{{-- ]"--}}
{{-- />--}}

<x-fab::forms.date-picker
wire:model="model.loaded_datetime"
Expand All @@ -63,7 +63,7 @@
>
<option value="0">-- Choose Truck (can be assigned later)</option>
@foreach($this->allDrivers() as $data)
<option value="{{ $data->id }}"> {{ $data->name }} </option>
<option value="{{ $data->id }}"> {{ $data->name }} ({{ $data->nickname ?? '' }}) </option>
@endforeach
</x-fab::forms.select>

Expand Down
7 changes: 5 additions & 2 deletions resources/views/models/depot-pickups/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@php
use Carbon\Carbon;
@endphp
<x-fab::layouts.page
title="Depot Pickups"
:breadcrumbs="[
Expand Down Expand Up @@ -53,9 +56,9 @@
</x-fab::lists.table.column>
@endif

@if($this->shouldShowColumn('updated_at'))
@if($this->shouldShowColumn('loaded_datetime'))
<x-fab::lists.table.column align="right">
{{ $data->updated_at->toFormattedDateString() }}
{{ Carbon::parse($data->loaded_datetime)->toFormattedDateString() }}
</x-fab::lists.table.column>
@endisset

Expand Down
6 changes: 6 additions & 0 deletions resources/views/models/drivers/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
help="Name of the driver."
/>

<x-fab::forms.input
wire:model="model.nickname"
label="Nickname"
help="Nickname of the driver."
/>

<x-fab::forms.input
wire:model="model.phone"
label="Phone"
Expand Down
2 changes: 1 addition & 1 deletion resources/views/models/drivers/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<x-fab::lists.table.row :odd="$loop->odd">
@if($this->shouldShowColumn('name'))
<x-fab::lists.table.column primary full>
<a href="{{ route('lego.pamtechoga.drivers.edit', $data) }}">{{ $data->name }}</a>
<a href="{{ route('lego.pamtechoga.drivers.edit', $data) }}">{{ $data->name }} ({{ $data->nickname ?? '' }})</a>
</x-fab::lists.table.column>
@endisset

Expand Down
17 changes: 16 additions & 1 deletion resources/views/models/orders/form.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@php
use Carbon\Carbon;
@endphp
<x-fab::layouts.page
:title="$model?->organization?->name ?: 'Untitled'"
:breadcrumbs="[
Expand Down Expand Up @@ -38,6 +41,18 @@
<x-fab::layouts.main-with-aside>
<x-fab::layouts.panel>

<x-fab::forms.date-picker
wire:model="model.date_ordered"
label="Date of Order"
help="This is the date this order was placed."
:options="[
'dateFormat' => 'Y-m-d',
'altInput' => true,
'altFormat' => 'D, M J, Y',
'enableTime' => false
]"
/>

<x-fab::forms.select
wire:model="model.depot_order_id"
label="Depot Order"
Expand All @@ -46,7 +61,7 @@
>
<option value="0">-- Choose Depot Order --</option>
@foreach($this->allDepotOrders() as $data)
<option value="{{ $data->id }}">{{ $data->id }} - {{ $data->product->type }} - {{ $data->depot->name }} - {{ number_format($data->volume) }}(LITRES - NGN{{ number_format($data->unit_price) }} / LITRE - Trucking EXP: NGN{{ number_format($data->trucking_expense) }}) - {{ $data->created_at->toFormattedDateString() }} </option>
<option value="{{ $data->id }}"> - {{ Carbon::parse($data->order_date)->toFormattedDateString() }} - {{ $data->product->type }} - {{ $data->depot->name }} - {{ number_format($data->volume) }}(LITRES - NGN{{ number_format($data->unit_price) }} / LITRE - Trucking EXP: NGN{{ number_format($data->trucking_expense) }})</option>
@endforeach
</x-fab::forms.select>

Expand Down
7 changes: 5 additions & 2 deletions resources/views/models/orders/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@php
use Carbon\Carbon;
@endphp
<x-fab::layouts.page
title="Orders"
:breadcrumbs="[
Expand Down Expand Up @@ -94,9 +97,9 @@
</x-fab::lists.table.column>
@endif

@if($this->shouldShowColumn('updated_at'))
@if($this->shouldShowColumn('date_ordered'))
<x-fab::lists.table.column align="right">
{{ $data->updated_at->toFormattedDateString() }}
{{ Carbon::parse($data->order_date)->toFormattedDateString() }}
</x-fab::lists.table.column>
@endisset

Expand Down
Loading

0 comments on commit d833450

Please sign in to comment.