Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/inikoo/aiku into main
Browse files Browse the repository at this point in the history
  • Loading branch information
KirinZero0 committed Feb 14, 2025
2 parents b232972 + 4b8e8a1 commit 19f4e86
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use App\Actions\Catalogue\Asset\Hydrators\AssetHydrateInvoicedCustomers;
use App\Actions\Catalogue\Asset\Hydrators\AssetHydrateInvoices;
use App\Actions\Catalogue\Asset\Hydrators\AssetHydrateSales;
use App\Actions\OrgAction;
use App\Actions\Traits\Rules\WithNoStrictRules;
use App\Actions\Traits\WithOrderExchanges;
Expand Down Expand Up @@ -79,6 +80,7 @@ public function handle(Invoice $invoice, Transaction|HistoricAsset $model, array
]);
}

AssetHydrateSales::dispatch($invoiceTransaction->asset)->delay($this->hydratorsDelay);
AssetHydrateInvoices::dispatch($invoiceTransaction->asset)->delay($this->hydratorsDelay);
AssetHydrateInvoicedCustomers::dispatch($invoiceTransaction->asset)->delay($this->hydratorsDelay);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function handle(Group|Fulfilment $parent, $prefix = null): LengthAwarePag
}

$queryBuilder->join('assets', 'rentals.asset_id', '=', 'assets.id');
$queryBuilder->leftJoin('asset_sales_intervals', 'assets.id', '=', 'asset_sales_intervals.asset_id');
$queryBuilder->join('currencies', 'assets.currency_id', '=', 'currencies.id');

if ($parent instanceof Fulfilment) {
Expand Down Expand Up @@ -100,13 +101,14 @@ public function handle(Group|Fulfilment $parent, $prefix = null): LengthAwarePag
'assets.name',
'assets.code',
'assets.price',
'asset_sales_intervals.sales_all as sales',
'rentals.description',
'currencies.code as currency_code',
'currencies.id as currency_id',
]);


return $queryBuilder->allowedSorts(['code','name','rental_price'])
return $queryBuilder->allowedSorts(['code','name','rental_price', 'sales'])
->allowedFilters([$globalSearch])
->withPaginator($prefix, tableName: request()->route()->getName())
->withQueryString();
Expand Down Expand Up @@ -244,6 +246,7 @@ public function tableStructure(
->column(key: 'name', label: __('name'), canBeHidden: false, sortable: true, searchable: true)
->column(key: 'rental_price', label: __('price'), canBeHidden: false, sortable: true, searchable: true, className: 'text-right font-mono', align: 'right')
->column(key: 'workflow', label: __('workflow'), canBeHidden: false, searchable: true, className: 'hello')
->column(key: 'sales', label: __('sales'), canBeHidden: false, sortable: true)
->defaultSort('code');
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ public function tableStructure(FulfilmentCustomer $parent, ?array $modelOperatio
->withModelOperations($modelOperations)
->withGlobalSearch()
->column(key: 'state', label: ['fal', 'fa-yin-yang'], type: 'icon')
->column(key: 'type', label: __('type'), canBeHidden: false, type: 'icon')
->column(key: 'created_at', label: __('Created at'), canBeHidden: false, type: 'date')
->column(key: 'reference', label: __('reference number'), canBeHidden: false, sortable: true, searchable: true)
->column(key: 'pallets', label: __('pallets'), canBeHidden: false, sortable: true, searchable: true);
->column(key: 'customer', label: __('Customer'), canBeHidden: false, sortable: true, searchable: true)
->column(key: 'pallets', label: __('pallets'), canBeHidden: false, sortable: true, searchable: true, type: 'number')
->column(key: 'total_amount', label: __('total amount'), canBeHidden: false, sortable: false, searchable: false, type: 'currency');
};
}

Expand Down Expand Up @@ -120,6 +122,7 @@ public function htmlResponse(LengthAwarePaginator $palletReturns, ActionRequest
'title' => __('returns'),
'pageHead' => [
'title' => __('returns'),
'model' => __('storage'),
'icon' => [
'icon' => ['fal', 'fa-truck-ramp'],
'title' => __('return')
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Resources/Fulfilment/PalletReturnsResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ public function toArray($request): array
{
/** @var \App\Models\Fulfilment\PalletReturn $palletReturn */
$palletReturn = $this;

// dd($this->fulfilmentCustomer->customer->contact_name);
return [
'id' => $palletReturn->id,
'created_at' => $palletReturn->created_at,
'slug' => $palletReturn->slug,
'reference' => $palletReturn->reference,
'state' => $palletReturn->state,
Expand All @@ -31,7 +32,10 @@ public function toArray($request): array
'number_pallets' => $palletReturn->stats->number_pallets,
'number_services' => $palletReturn->stats->number_services,
'number_physical_goods' => $palletReturn->stats->number_physical_goods,
'dispatched_at' => $palletReturn->dispatched_at
'dispatched_at' => $palletReturn->dispatched_at,
'total_amount' => $palletReturn->total_amount,
'currency_code' => $palletReturn->currency->code,
'customer' => $palletReturn->fulfilmentCustomer->customer,
];
}
}
1 change: 1 addition & 0 deletions app/Http/Resources/Fulfilment/RentalsResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function toArray($request): array
'slug' => $this->slug,
'code' => $this->code,
'name' => $this->name,
'sales' => $this->sales,
'rental_price' => $this->rental_price,
'currency_code' => $this->currency_code,
'unit' => $this->unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Icon from "@/Components/Icon.vue"
import { inject } from "vue"
import { layoutStructure } from "@/Composables/useLayoutStructure"
import { useFormatTime } from "@/Composables/useFormatTime"
import AddressLocation from "@/Components/Elements/Info/AddressLocation.vue"

library.add(faPlus)

Expand Down Expand Up @@ -126,12 +127,17 @@ function storedItemReturnRoute(palletReturn: PalletDelivery) {

<!-- Column: State -->
<template #cell(state)="{ item: palletReturn }">
<Icon :data="palletReturn['type_icon']" class="px-1"/>
<TagPallet v-if="layout.app.name == 'retina'" :stateIcon="palletReturn.state_icon" />
<Icon v-else :data="palletReturn['state_icon']" class="px-1"/>
</template>

<template #cell(type)="{ item: palletReturn }">
<Icon :data="palletReturn['type_icon']" class="px-1"/>
<template #cell(customer)="{ item: palletReturn }">
{{ palletReturn.customer.contact_name || '-' }} <span v-if="palletReturn.customer.company_name">({{ palletReturn.customer.company_name }})</span>
<span class="text-xs text-gray-500">
<AddressLocation :data="palletReturn.customer.location" />
</span>
<!-- <pre>{{ palletReturn.customer }}</pre> -->
</template>

<!-- Column: Pallets -->
Expand Down
21 changes: 21 additions & 0 deletions resources/js/Components/Tables/Grp/Org/Fulfilment/TableRentals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ function rentalRoute(rental: {}) {
</Link>
</template>

<!-- Column: Sales -->
<template #cell(sales)="{ item: rental }">

<div
v-tooltip="
useLocaleStore().currencyFormat(
rental.currency_code,
rental?.sales || 0
)
"
:key="rental?.sales">
{{
useLocaleStore().currencyFormat(
rental.currency_code,
rental?.sales || 0
)
}}
</div>

</template>

<!-- Column: Shop Code -->
<template #cell(shop_code)="{ item: rental }">
<Link v-if="rental['shop_slug']" :href="rentalRoute(rental)" class="secondaryLink">
Expand Down

0 comments on commit 19f4e86

Please sign in to comment.