Skip to content

Commit

Permalink
Merge branch 'main' of github.com:inikoo/aiku
Browse files Browse the repository at this point in the history
  • Loading branch information
dandiAW committed Jan 7, 2025
2 parents 88d1ca7 + 42e119a commit f7f55b6
Show file tree
Hide file tree
Showing 43 changed files with 1,164 additions and 145 deletions.
14 changes: 12 additions & 2 deletions app/Actions/Fulfilment/Pallet/Search/PalletRecordSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace App\Actions\Fulfilment\Pallet\Search;

use App\Models\Billables\Rental;
use App\Models\Fulfilment\Pallet;
use Lorisleiva\Actions\Concerns\AsAction;

Expand All @@ -27,6 +28,8 @@ public function handle(Pallet $pallet): void
return;
}

$rental = Rental::find($pallet->rental_id) ?? null;

$pallet->universalSearch()->updateOrCreate(
[],
[
Expand All @@ -38,7 +41,7 @@ public function handle(Pallet $pallet): void
'warehouse_id' => $pallet->warehouse_id,
'warehouse_slug' => $pallet->warehouse->slug,
'sections' => ['fulfilment'],
'haystack_tier_1' => $pallet->reference ?? $pallet->id,
'haystack_tier_1' => trim($pallet->reference . ' ' . $rental->name . ' ' . $pallet->customer_reference),
'keyword' => $pallet->slug,
'keyword_2' => $pallet->reference,
'result' => [
Expand All @@ -59,7 +62,7 @@ public function handle(Pallet $pallet): void
'tooltip' => __('Reference')
],
'description' => [
'label' => $pallet->customer_reference
'label' => $rental->name
],
'state_icon' => $pallet->type->typeIcon()[$pallet->type->value],
'meta' => [
Expand All @@ -70,9 +73,16 @@ public function handle(Pallet $pallet): void
],
[
'key' => __("state"),
'icon' => $pallet->state->stateIcon()[$pallet->state->value],
'label' => __("State") . ': ' . __($pallet->state->value),
'tooltip' => __("State")
],
[
'key' => __("status"),
'icon' => $pallet->status->statusIcon()[$pallet->status->value],
'label' => __("Status") . ': ' . __($pallet->status->value),
'tooltip' => __("Status")
],
],
]
]
Expand Down
3 changes: 1 addition & 2 deletions app/Actions/Fulfilment/Pallet/Search/ReindexPalletSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
namespace App\Actions\Fulfilment\Pallet\Search;

use App\Actions\HydrateModel;
use App\Models\Accounting\Invoice;
use App\Models\Fulfilment\Pallet;
use Illuminate\Support\Collection;

Expand All @@ -24,7 +23,7 @@ public function handle(Pallet $pallet): void
}


protected function getModel(string $slug): Invoice
protected function getModel(string $slug): Pallet
{
return Pallet::withTrashed()->where('slug', $slug)->first();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function handle(PalletDelivery $palletDelivery): void
]
],
'description' => [
'tooltip' => 'Warehouse',
'label' => $palletDelivery->warehouse->name
],
'code' => [
Expand All @@ -48,19 +47,16 @@ public function handle(PalletDelivery $palletDelivery): void
'icon' => [
'icon' => 'fal fa-truck-couch',
],
'state_icon' => $palletDelivery->state->stateIcon()[$palletDelivery->state->value],
'meta' => [
[
'type' => 'date',
'label' => $palletDelivery->created_at,
'tooltip' => __("Created date")
],
[
'label' => $palletDelivery->state->labels()[$palletDelivery->state->value],
'tooltip' => __("State")
'key' => __("customer_name"),
'label' => __("Customer") . ': ' . __($palletDelivery->fulfilmentCustomer->customer->name),
'tooltip' => __("Customer")
],
[
'type' => 'number',
'label' => 'Pallets: ',
'afterLabel' => __('Pallets') . ': ',
'number' => $palletDelivery->stats->number_pallets,
'tooltip' => __("Pallet's count")
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,22 @@ public function handle(PalletReturn $palletReturn): void
'icon' => [
'icon' => 'fal fa-truck-couch',
],
'state_icon' => $palletReturn->state->stateIcon()[$palletReturn->state->value],
'meta' => [
[
'type' => 'date',
'label' => $palletReturn->created_at,
'tooltip' => __("Created date")
'key' => "customer_reference",
'label' => $palletReturn->customer_reference,
'tooltip' => __("Return name")
],
[
'label' => $palletReturn->state->labels()[$palletReturn->state->value],
'tooltip' => __("State")
'label' => $palletReturn->state->labels()[$palletReturn->type->value],
'tooltip' => __("Type")
],
[
'type' => 'number',
'label' => __('Pallets') . ': ',
'number' => $palletReturn->stats->number_pallets,
'tooltip' => __("Pallet's count")
'tooltip' => __("Pallets")
],
],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,29 @@ public function handle(RecurringBill $recurringBill): void
'icon' => [
'icon' => 'fal fa-receipt',
],
'aaa' => $recurringBill,
'code' => [
'label' => $recurringBill->reference,
'tooltip' => __('Reference')
],
'state_icon' => $recurringBill->status->labels()[$recurringBill->status->value],
'meta' => [
[
'key' => 'status',
'tooltip' => 'Status',
'label' => $recurringBill->status->labels()[$recurringBill->status->value]
'type' => 'number',
'label' => __('Net') . ': ',
'number' => $recurringBill->net_amount,
'tooltip' => __("Net")
],
[
'key' => 'start_date',
'type' => 'date',
'label' => $recurringBill->start_date,
'tooltip' => __('Start date')
],
[
'key' => 'created_date',
'key' => 'end_date',
'type' => 'date',
'label' => $recurringBill->created_at,
'tooltip' => __('Created date')
'label' => $recurringBill->end_date,
'tooltip' => __('End date')
],
[
'key' => 'total',
Expand Down
7 changes: 6 additions & 1 deletion app/Actions/Helpers/RetinaSearch/UI/IndexRetinalSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ class IndexRetinalSearch extends InertiaAction

public function handle(string $query, Customer $customer): Collection
{
$query = trim($query);
$query = preg_replace('/(\+|\-|\=|&&|\|\||\>|\<|\!|\(|\)|\{|\}|\[|\]|\^|"|~|\*|\?|\:|\\\\|\/)/', '\\\\$1', $query);
$query = preg_replace('/\b(AND|OR|NOT)\b/', '\\\\$0', $query);

$query = RetinaSearch::search($query)->where('customer_id', $customer->id);

return $query->get();
}

public function asController(ActionRequest $request): AnonymousResourceCollection
{
$searchResults = $this->handle(
query: $request->input('q', ''),
customer: $request->user()->customer
customer: $request->user()->customer,
);

return RetinaSearchResource::collection($searchResults);
Expand Down
4 changes: 2 additions & 2 deletions app/Actions/HumanResources/Employee/UI/EditEmployee.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public function authorize(ActionRequest $request): bool

public function asController(Organisation $organisation, Employee $employee, ActionRequest $request): Employee
{

$this->organisation = $organisation;
$this->initialisation($organisation, $request);

return $this->handle($employee);
}

Expand All @@ -58,7 +58,7 @@ public function htmlResponse(Employee $employee, ActionRequest $request): Respon
$user = $employee->getUser();

$jobPositionsOrganisationData = GetJobPositionsOrganisationData::run($employee, $this->organisation);
$jobPositionsGroupData = GetJobPositionsGroupData::run($employee, $this->organisation->group);
$jobPositionsGroupData = GetPermissionGroupData::run($employee, $this->group);

$sections['properties'] = [
'label' => __('Properties'),
Expand Down

This file was deleted.

29 changes: 29 additions & 0 deletions app/Actions/HumanResources/Employee/UI/GetPermissionGroupData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* Author: Raul Perusquia <[email protected]>
* Created: Tue, 14 Mar 2023 19:13:28 Malaysia Time, Kuala Lumpur, Malaysia
* Copyright (c) 2023, Raul A Perusquia Flores
*/

namespace App\Actions\HumanResources\Employee\UI;

use App\Models\HumanResources\Employee;
use App\Models\SysAdmin\Group;
use App\Models\SysAdmin\Guest;
use App\Models\SysAdmin\User;
use Lorisleiva\Actions\Concerns\AsAction;

class GetPermissionGroupData
{
use AsAction;

public function handle(Employee|User|Guest $user, Group $group): array
{
return (array) $user->permissions->map(function ($permission) use ($group) {
return [$permission->name];
})->reduce(function ($carry, $item) {
return array_merge_recursive($carry, $item);
}, []);
}
}
86 changes: 86 additions & 0 deletions app/Actions/Retina/Storage/Pallet/Search/PalletRecordSearch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

/*
* Author: Ganes <[email protected]>
* Created on: 07-01-2025, Bali, Indonesia
* Github: https://github.com/Ganes556
* Copyright: 2025
*
*/

namespace App\Actions\Retina\Storage\Pallet\Search;

use App\Models\Billables\Rental;
use App\Models\Fulfilment\Pallet;
use Lorisleiva\Actions\Concerns\AsAction;

class PalletRecordSearch
{
use AsAction;

public string $jobQueue = 'retina-search';

public function handle(Pallet $pallet): void
{
if ($pallet->trashed()) {

if ($pallet->retinaSearch) {
$pallet->retinaSearch()->delete();
}
return;
}

$rental = Rental::find($pallet->rental_id) ?? null;

$pallet->retinaSearch()->updateOrCreate(
[],
[
'group_id' => $pallet->group_id,
'organisation_id' => $pallet->organisation_id,
'customer_id' => $pallet->fulfilmentCustomer->customer_id,
'haystack_tier_1' => trim($pallet->reference . ' ' . $rental->name),
'keyword' => $pallet->slug,
'keyword_2' => $pallet->reference,
'result' => [
'route' => [
'name' => 'retina.storage.pallets.show',
'parameters' => [
'pallet' => $pallet->slug
]
],
'icon' => [
'icon' => 'fal fa-pallet',
],
'code' => [
'label' => $pallet->reference,
'tooltip' => __('Reference')
],
'description' => [
'label' => $rental->name
],
'state_icon' => $pallet->type->typeIcon()[$pallet->type->value],
'meta' => [
[
'key' => __("customer_reference"),
'label' => __("Pallet reference (customer's), notes") . ': ' . __($pallet->customer_reference),
'tooltip' => __("Pallet reference (customer's), notes")
],
[
'key' => __("state"),
'icon' => $pallet->state->stateIcon()[$pallet->state->value],
'label' => __("State") . ': ' . __($pallet->state->value),
'tooltip' => __("State")
],
[
'key' => __("status"),
'icon' => $pallet->status->statusIcon()[$pallet->status->value],
'label' => __("Status") . ': ' . __($pallet->status->value),
'tooltip' => __("Status")
],
],
]
]
);
}

}
Loading

0 comments on commit f7f55b6

Please sign in to comment.