Compare commits
170 Commits
main
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a796a670a | ||
|
|
4577f67d0a | ||
|
|
be2151a072 | ||
|
|
a4251ae532 | ||
|
|
93d55765ae | ||
|
|
17d54cc52e | ||
|
|
61467d88cd | ||
|
|
af0b17e674 | ||
|
|
dd7111a8d9 | ||
|
|
464ee6c3c7 | ||
|
|
984d686182 | ||
|
|
fd87748a38 | ||
|
|
f9aa6cd1ba | ||
|
|
d743b2df26 | ||
|
|
814281a6bf | ||
|
|
dc445b17f5 | ||
|
|
cd553651f3 | ||
|
|
ac20e96358 | ||
|
|
0fb9c91b28 | ||
|
|
21d602d86a | ||
|
|
06628072dc | ||
|
|
cdf9f60ffd | ||
|
|
b419a538dc | ||
|
|
fea15e0d1b | ||
|
|
f5a1e453d5 | ||
|
|
fd6149ccbe | ||
|
|
085a4f72fa | ||
|
|
6b41a27d31 | ||
|
|
648b676453 | ||
|
|
6f4d81025b | ||
|
|
42bbad16aa | ||
|
|
3fcc2de515 | ||
|
|
d14200e40e | ||
|
|
a34322c87a | ||
|
|
547d73e1f4 | ||
|
|
d93d55bb69 | ||
|
|
ad00321dff | ||
|
|
d333324935 | ||
|
|
a1b8cc0eed | ||
|
|
d2a2a35410 | ||
|
|
28503a25c3 | ||
|
|
20b17d446b | ||
|
|
0de50e12b8 | ||
|
|
9767e0547d | ||
|
|
92da8af6d2 | ||
|
|
1adfd59a0e | ||
|
|
92bf1ee401 | ||
|
|
99a605196d | ||
|
|
e075a510d9 | ||
|
|
2a7d012ec8 | ||
|
|
d63e8f7a37 | ||
|
|
9c4679a5a5 | ||
|
|
f6f3ab803c | ||
|
|
64b5c129ee | ||
|
|
955359b92c | ||
|
|
3ffc59f0cf | ||
|
|
9b5e66c834 | ||
|
|
7dbeb0afd3 | ||
|
|
fdfa5d0cf1 | ||
|
|
fce45b5386 | ||
|
|
6a62dce305 | ||
|
|
9ae6dede23 | ||
|
|
2f470c5c54 | ||
|
|
529850f0b9 | ||
|
|
61637bc3d5 | ||
|
|
c248a42a9d | ||
|
|
aeb49c40eb | ||
|
|
8fc963dc0a | ||
|
|
14844f1e1e | ||
|
|
cfc5845768 | ||
|
|
f0a6f924d9 | ||
|
|
f6f9730587 | ||
|
|
b42f5ffe84 | ||
|
|
376899e277 | ||
|
|
e53fb15c01 | ||
|
|
953999459e | ||
|
|
d2ab947b1d | ||
|
|
9b965d5a2b | ||
|
|
f48de19e0d | ||
|
|
48ce416cbf | ||
|
|
39b5cf77e4 | ||
|
|
46649d0459 | ||
|
|
2f593326e5 | ||
|
|
bb9c344e5b | ||
|
|
10e595a4a3 | ||
|
|
31ab56d46c | ||
|
|
a8f566ca04 | ||
|
|
00d9cfc291 | ||
|
|
7e45c611a0 | ||
|
|
7cab79c7e0 | ||
|
|
2d81d41f34 | ||
|
|
4daa72db8e | ||
|
|
504c125ca8 | ||
|
|
79f91bf444 | ||
|
|
628d85fda8 | ||
|
|
b837a02a5e | ||
|
|
5c403340ca | ||
|
|
3b02f9e4cd | ||
|
|
3d1b60f0cc | ||
|
|
b0e2e9fe04 | ||
|
|
b3e0db6815 | ||
|
|
4a6ced748f | ||
|
|
b92419b927 | ||
|
|
0c7e55595a | ||
|
|
44ed90354d | ||
|
|
a365e4222a | ||
|
|
92db525f36 | ||
|
|
0c90d51025 | ||
|
|
b3cf28edba | ||
|
|
395df5eda1 | ||
|
|
562dfa5e59 | ||
|
|
6cbccc018e | ||
|
|
d0bd4afe9b | ||
|
|
bf2586eabb | ||
|
|
c90d48be52 | ||
|
|
560619beb5 | ||
|
|
9e2ec1bc8b | ||
|
|
795e930ec6 | ||
|
|
6d2ae5a324 | ||
|
|
530078a4d8 | ||
|
|
0fa69f3398 | ||
|
|
cfec8df06d | ||
|
|
27b8954134 | ||
|
|
37843fe427 | ||
|
|
2a8e589de3 | ||
|
|
8c8bd0a853 | ||
|
|
4b857f723c | ||
|
|
f36c9f0df4 | ||
|
|
2055a768ef | ||
|
|
9913df30c6 | ||
|
|
832c482da2 | ||
|
|
2fc1fb73b7 | ||
|
|
09ef1f174c | ||
|
|
c0f1363fd5 | ||
|
|
38d42c5f68 | ||
|
|
a9fa8775dd | ||
|
|
807285a7a1 | ||
|
|
31bc609f60 | ||
|
|
c2eb18da50 | ||
|
|
37a1e9a7f3 | ||
|
|
de17349372 | ||
|
|
834c643c57 | ||
|
|
5612fc6ceb | ||
|
|
b2887fbc9c | ||
|
|
eeddd5da77 | ||
|
|
ad8192a83f | ||
|
|
31bc4a7fd0 | ||
|
|
2b52a6e542 | ||
|
|
15374002f1 | ||
|
|
0ef8ba73cc | ||
|
|
8446282856 | ||
|
|
cac8cdd7ce | ||
|
|
2a7db20796 | ||
|
|
08aaccf1b8 | ||
|
|
6f77f8ecbc | ||
|
|
7f55378541 | ||
|
|
9040f094c1 | ||
|
|
ec98c9b2ce | ||
|
|
acf326c6ca | ||
|
|
e082d5bb49 | ||
|
|
e6276378f8 | ||
|
|
71e8c29801 | ||
|
|
2524ad4620 | ||
|
|
a85faafe90 | ||
|
|
03033c2365 | ||
|
|
31a4e10158 | ||
| f12856f1a3 | |||
|
|
de2c05c817 | ||
|
|
7b0fa092f4 | ||
|
|
536c7d176a |
33
.github/workflows/gemini-pr-review.yaml
vendored
33
.github/workflows/gemini-pr-review.yaml
vendored
@@ -1,19 +1,23 @@
|
||||
# Filename: .github/workflows/gemini-pr-review.yaml
|
||||
|
||||
name: Gemini PR Review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
review:
|
||||
gemini-pr-review:
|
||||
runs-on: ubuntu-latest
|
||||
name: Gemini PR Review
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0 # This fetches the full history
|
||||
|
||||
@@ -22,7 +26,6 @@ jobs:
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
|
||||
- name: Get npm cache directory
|
||||
id: npm-cache-dir
|
||||
run: |
|
||||
@@ -36,8 +39,14 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-npm-global-
|
||||
|
||||
- name: Install Gemini CLI globally
|
||||
run: npm install -g --loglevel=http @google/gemini-cli
|
||||
- name: Install Gemini CLI globally (if not already installed)
|
||||
run: |
|
||||
if ! command -v gemini &> /dev/null; then
|
||||
echo "Gemini CLI not found, installing..."
|
||||
npm install -g --loglevel=http @google/gemini-cli
|
||||
else
|
||||
echo "Gemini CLI already installed."
|
||||
fi
|
||||
|
||||
- name: Generate git diff and review with Gemini
|
||||
id: review
|
||||
@@ -48,11 +57,17 @@ jobs:
|
||||
git diff "${{ gitea.event.pull_request.base.sha }}...${{ gitea.event.pull_request.head.sha }}" > pr.diff
|
||||
|
||||
echo "Performing code review with Gemini..."
|
||||
cat .github/workflows/gemini-pr-review.md pr.diff | gemini > /tmp/gemini-output.txt
|
||||
if cat .github/workflows/gemini-pr-review.md pr.diff | gemini --model=gemini-pro > /tmp/gemini-output.txt; then
|
||||
echo "Gemini review completed."
|
||||
else
|
||||
echo "⚠️ Gemini review failed (quota / API issue)." > /tmp/gemini-output.txt
|
||||
echo "" >> /tmp/gemini-output.txt
|
||||
echo "Check logs for details." >> /tmp/gemini-output.txt
|
||||
fi
|
||||
|
||||
echo "Gemini error logs (if any):"
|
||||
cat /tmp/gemini-client-error*.json || true
|
||||
|
||||
|
||||
- name: Post output to PR comment
|
||||
id: post_comment
|
||||
run: |
|
||||
|
||||
102
app/Filament/Exports/StickerDetailExporter.php
Normal file
102
app/Filament/Exports/StickerDetailExporter.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerDetail;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerDetailExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('stickerStructureDetail.sticker_id')
|
||||
->label('STICKER ID'),
|
||||
ExportColumn::make('design_element_type')
|
||||
->label('DESIGN ELEMENT TYPE'),
|
||||
ExportColumn::make('element_id')
|
||||
->label('ELEMENT ID'),
|
||||
ExportColumn::make('element_type')
|
||||
->label('ELEMENT TYPE'),
|
||||
ExportColumn::make('characteristics_type')
|
||||
->label('CHARACTERISTICS TYPE'),
|
||||
ExportColumn::make('string_value')
|
||||
->label('STRING VALUE'),
|
||||
ExportColumn::make('string_font')
|
||||
->label('STRING FONT'),
|
||||
ExportColumn::make('string_size')
|
||||
->label('STRING SIZE'),
|
||||
ExportColumn::make('element_colour')
|
||||
->label('ELEMENT COLOUR'),
|
||||
ExportColumn::make('string_align')
|
||||
->label('STRING ALIGN'),
|
||||
ExportColumn::make('string_x_value')
|
||||
->label('STRING X VALUE'),
|
||||
ExportColumn::make('string_y_value')
|
||||
->label('STRING Y VALUE'),
|
||||
ExportColumn::make('shape_name')
|
||||
->label('SHAPE NAME'),
|
||||
ExportColumn::make('shape_pen_size')
|
||||
->label('SHAPE PEN SIZE'),
|
||||
ExportColumn::make('curve_radius')
|
||||
->label('CURVE RADIUS'),
|
||||
ExportColumn::make('shape_x1_value')
|
||||
->label('SHAPE X1 VALUE'),
|
||||
ExportColumn::make('shape_y1_value')
|
||||
->label('SHAPE Y1 VALUE'),
|
||||
ExportColumn::make('shape_x2_value')
|
||||
->label('SHAPE X2 VALUE'),
|
||||
ExportColumn::make('shape_y2_value')
|
||||
->label('SHAPE Y2 VALUE'),
|
||||
ExportColumn::make('image_x')
|
||||
->label('IMAGE X'),
|
||||
ExportColumn::make('image_y')
|
||||
->label('IMAGE Y'),
|
||||
ExportColumn::make('image_width')
|
||||
->label('IMAGE WIDTH'),
|
||||
ExportColumn::make('image_height')
|
||||
->label('IMAGE HEIGHT'),
|
||||
ExportColumn::make('qr_value')
|
||||
->label('QR VALUE'),
|
||||
ExportColumn::make('qr_align')
|
||||
->label('QR ALIGN'),
|
||||
ExportColumn::make('qr_size')
|
||||
->label('QR SIZE'),
|
||||
ExportColumn::make('qr_x_value')
|
||||
->label('QR X VALUE'),
|
||||
ExportColumn::make('qr_y_value')
|
||||
->label('QR Y VALUE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker detail export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -21,28 +21,117 @@ class StickerMappingMasterExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('item.code')
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('itemCharacteristic.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('sticker1')
|
||||
->label('STICKER LABEL 1'),
|
||||
ExportColumn::make('sticker2')
|
||||
->label('STICKER LABEL 2'),
|
||||
ExportColumn::make('sticker3')
|
||||
->label('STICKER LABEL 3'),
|
||||
ExportColumn::make('sticker4')
|
||||
->label('STICKER LABEL 4'),
|
||||
ExportColumn::make('sticker5')
|
||||
->label('STICKER LABEL 5'),
|
||||
ExportColumn::make('sticker_structure1_id')
|
||||
->label('STICKER 1')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker1Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker1_machine_id')
|
||||
->label('WC STICKER 1')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker1Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker1_print_ip')
|
||||
->label('STICKER 1 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure2_id')
|
||||
->label('STICKER 2')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker2_machine_id')
|
||||
->label('WC STICKER 2')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker2_print_ip')
|
||||
->label('STICKER 2 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure3_id')
|
||||
->label('STICKER 3')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker3Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker3_machine_id')
|
||||
->label('WC STICKER 3')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker3Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker3_print_ip')
|
||||
->label('STICKER 3 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure4_id')
|
||||
->label('STICKER 4')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker4Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker4_machine_id')
|
||||
->label('WC STICKER 4')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker4Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker4_print_ip')
|
||||
->label('STICKER 4 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure5_id')
|
||||
->label('STICKER 5')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker5Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker5_machine_id')
|
||||
->label('WC STICKER 5')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker5Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker5_print_ip')
|
||||
->label('STICKER 5 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure6_id')
|
||||
->label('STICKER 6')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker6Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker6_machine_id')
|
||||
->label('WC STICKER 6')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker6Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker6_print_ip')
|
||||
->label('STICKER 6 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure7_id')
|
||||
->label('STICKER 7')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker7Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker7_machine_id')
|
||||
->label('WC STICKER 7')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker2Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker7_print_ip')
|
||||
->label('STICKER 7 PRINT IP'),
|
||||
ExportColumn::make('sticker_structure8_id')
|
||||
->label('STICKER 8')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker8Structure?->sticker_id ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker8_machine_id')
|
||||
->label('WC STICKER 8')
|
||||
->getStateUsing(function ($record) {
|
||||
return $record->sticker8Machine?->work_center ?? '-';
|
||||
}),
|
||||
ExportColumn::make('sticker8_print_ip')
|
||||
->label('STICKER 8 PRINT IP'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by'),
|
||||
ExportColumn::make('deleted_at'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
66
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
66
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StickerStructureDetailExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('itemCharacteristic.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('sticker_id')
|
||||
->label('STICKER ID'),
|
||||
ExportColumn::make('sticker_width')
|
||||
->label('STICKER WIDTH'),
|
||||
ExportColumn::make('sticker_height')
|
||||
->label('STICKER HEIGHT'),
|
||||
ExportColumn::make('sticker_lmargin')
|
||||
->label('STICKER LEFT MARGIN'),
|
||||
ExportColumn::make('sticker_rmargin')
|
||||
->label('STICKER RIGHT MARGIN'),
|
||||
ExportColumn::make('sticker_tmargin')
|
||||
->label('STICKER TOP MARGIN'),
|
||||
ExportColumn::make('sticker_bmargin')
|
||||
->label('STICKER BOTTOM MARGIN'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your sticker structure detail export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
322
app/Filament/Imports/StickerDetailImporter.php
Normal file
322
app/Filament/Imports/StickerDetailImporter.php
Normal file
@@ -0,0 +1,322 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
|
||||
class StickerDetailImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('sticker_structure_detail_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker ID')
|
||||
->example('123456')
|
||||
->label('STICKER ID')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('design_element_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Design Element Type')
|
||||
->label('DESIGN ELEMENT TYPE')
|
||||
->example('Text/Shape/Image/QR'),
|
||||
ImportColumn::make('element_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Element ID')
|
||||
->label('ELEMENT ID')
|
||||
->example('001'),
|
||||
ImportColumn::make('element_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Element Type')
|
||||
->label('ELEMENT TYPE')
|
||||
->example('Static/Dynamic'),
|
||||
ImportColumn::make('characteristics_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Characteristics Type')
|
||||
->label('CHARACTERISTICS TYPE')
|
||||
->example('ZMM values'),
|
||||
ImportColumn::make('string_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Value')
|
||||
->label('STRING VALUE')
|
||||
->example('1'),
|
||||
ImportColumn::make('string_font')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Font')
|
||||
->label('STRING FONT')
|
||||
->example('Arial'),
|
||||
ImportColumn::make('string_size')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Size')
|
||||
->label('STRING SIZE')
|
||||
->example('12'),
|
||||
ImportColumn::make('element_colour')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Element Colour')
|
||||
->label('ELEMENT COLOUR')
|
||||
->example('Black'),
|
||||
ImportColumn::make('string_align')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Align')
|
||||
->label('STRING ALIGN')
|
||||
->example('Left/Center/Right'),
|
||||
ImportColumn::make('string_x_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String X Value')
|
||||
->label('STRING X VALUE')
|
||||
->example('10'),
|
||||
ImportColumn::make('string_y_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('String Y Value')
|
||||
->label('STRING Y VALUE')
|
||||
->example('20'),
|
||||
ImportColumn::make('shape_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Name')
|
||||
->label('SHAPE NAME')
|
||||
->example('Line/Rectangle/CurvedRectangle'),
|
||||
ImportColumn::make('shape_pen_size')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Pen Size')
|
||||
->label('SHAPE PEN SIZE')
|
||||
->example('0.3'),
|
||||
ImportColumn::make('curve_radius')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Curve Radius')
|
||||
->label('CURVE RADIUS')
|
||||
->example('3'),
|
||||
ImportColumn::make('shape_x1_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape X1 Value')
|
||||
->label('SHAPE X1 VALUE')
|
||||
->example('10'),
|
||||
ImportColumn::make('shape_y1_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Y1 Value')
|
||||
->label('SHAPE Y1 VALUE')
|
||||
->example('20'),
|
||||
ImportColumn::make('shape_x2_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape X2 Value')
|
||||
->label('SHAPE X2 VALUE')
|
||||
->example('30'),
|
||||
ImportColumn::make('shape_y2_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Shape Y2 Value')
|
||||
->label('SHAPE Y2 VALUE')
|
||||
->example('40'),
|
||||
ImportColumn::make('image_x')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image X')
|
||||
->label('IMAGE X')
|
||||
->example('15'),
|
||||
ImportColumn::make('image_y')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image Y')
|
||||
->label('IMAGE Y')
|
||||
->example('25'),
|
||||
ImportColumn::make('image_width')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image Width')
|
||||
->label('IMAGE WIDTH')
|
||||
->example('100'),
|
||||
ImportColumn::make('image_height')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Image Height')
|
||||
->label('IMAGE HEIGHT')
|
||||
->example('100'),
|
||||
ImportColumn::make('qr_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Value')
|
||||
->label('QR VALUE')
|
||||
->example('246118|53246735267'),
|
||||
ImportColumn::make('qr_align')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Align')
|
||||
->label('QR ALIGN')
|
||||
->example('Left/Center/Right'),
|
||||
ImportColumn::make('qr_size')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Size')
|
||||
->label('QR SIZE')
|
||||
->example('10'),
|
||||
ImportColumn::make('qr_x_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR X Value')
|
||||
->label('QR X VALUE')
|
||||
->example('30'),
|
||||
ImportColumn::make('qr_y_value')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QR Y Value')
|
||||
->label('QR Y VALUE')
|
||||
->example('40'),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->label('CREATED BY')
|
||||
->example('RAW001234'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerDetail
|
||||
{
|
||||
|
||||
$warnMsg = [];
|
||||
|
||||
$sticker = $this->data['sticker_structure_detail_id'] ?? null;
|
||||
|
||||
$stickerCode = StickerStructureDetail::where('sticker_id', $sticker)->first();
|
||||
if (!$stickerCode) {
|
||||
$warnMsg[] = "Sticker Id not found in Sticker Structure Detail";
|
||||
}
|
||||
|
||||
$stickerId = $stickerCode->id;
|
||||
|
||||
$user = User::where('name', $this->data['created_by'])->first();
|
||||
if (!$user) {
|
||||
$warnMsg[] = "User not found";
|
||||
}
|
||||
|
||||
$designType = strtolower($this->data['design_element_type'] ?? '');
|
||||
|
||||
$rules = [
|
||||
'text' => [
|
||||
'required' => ['string_x_value', 'string_y_value'],
|
||||
'allowed' => [
|
||||
'string_value',
|
||||
'string_font',
|
||||
'string_size',
|
||||
'string_align',
|
||||
'string_colour',
|
||||
'string_x_value',
|
||||
'string_y_value',
|
||||
],
|
||||
],
|
||||
|
||||
'image' => [
|
||||
'required' => ['image_x', 'image_y', 'image_width', 'image_height'],
|
||||
'allowed' => [
|
||||
'image_x',
|
||||
'image_y',
|
||||
'image_width',
|
||||
'image_height',
|
||||
],
|
||||
],
|
||||
|
||||
'shape' => [
|
||||
'required' => ['shape_name', 'shape_pen_size', 'shape_x1_value', 'shape_y1_value', 'shape_x2_value', 'shape_y2_value'],
|
||||
'allowed' => [
|
||||
'shape_name',
|
||||
'shape_pen_size',
|
||||
'curve_radius',
|
||||
'shape_x1_value',
|
||||
'shape_y1_value',
|
||||
'shape_x2_value',
|
||||
'shape_y2_value',
|
||||
],
|
||||
],
|
||||
|
||||
'qr' => [
|
||||
'required' => ['qr_value', 'qr_x_value', 'qr_y_value', 'qr_size'],
|
||||
'allowed' => [
|
||||
'qr_value',
|
||||
'qr_align',
|
||||
'qr_size',
|
||||
'qr_x_value',
|
||||
'qr_y_value',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
if (!isset($rules[$designType])) {
|
||||
$warnMsg[] = "Invalid Design Element Type: {$designType}";
|
||||
}
|
||||
|
||||
if (isset($rules[$designType])) {
|
||||
foreach ($rules[$designType]['required'] as $field) {
|
||||
if (empty($this->data[$field])) {
|
||||
$warnMsg[] = ucfirst($designType) . " requires {$field}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$allElementFields = [
|
||||
'string_value','string_font','string_size','string_align','string_colour',
|
||||
'string_x_value','string_y_value',
|
||||
'image_x','image_y','image_width','image_height',
|
||||
'shape_name','shape_pen_size','curve_radius',
|
||||
'shape_x1_value','shape_y1_value','shape_x2_value','shape_y2_value',
|
||||
'qr_value','qr_align','qr_size','qr_x_value','qr_y_value',
|
||||
];
|
||||
|
||||
if (isset($rules[$designType])) {
|
||||
$allowed = $rules[$designType]['allowed'];
|
||||
|
||||
foreach ($allElementFields as $field) {
|
||||
if (!in_array($field, $allowed, true) && !empty($this->data[$field])) {
|
||||
$warnMsg[] = "Field {$field} is not allowed for {$designType} element";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(' | ', $warnMsg));
|
||||
}
|
||||
|
||||
StickerDetail::Create([
|
||||
'sticker_structure_detail_id' => $stickerId,
|
||||
'design_element_type' => $this->data['design_element_type'],
|
||||
'element_id' => $this->data['element_id'],
|
||||
'element_type' => $this->data['element_type'],
|
||||
'characteristics_type' => $this->data['characteristics_type'],
|
||||
'string_value' => $this->data['string_value'],
|
||||
'string_font' => $this->data['string_font'],
|
||||
'string_size' => $this->data['string_size'],
|
||||
'element_colour' => $this->data['element_colour'],
|
||||
'string_align' => $this->data['string_align'],
|
||||
'string_x_value' => $this->data['string_x_value'],
|
||||
'string_y_value' => $this->data['string_y_value'],
|
||||
'shape_name' => $this->data['shape_name'],
|
||||
'shape_pen_size' => $this->data['shape_pen_size'],
|
||||
'curve_radius' => $this->data['curve_radius'],
|
||||
'shape_x1_value' => $this->data['shape_x1_value'],
|
||||
'shape_y1_value' => $this->data['shape_y1_value'],
|
||||
'shape_x2_value' => $this->data['shape_x2_value'],
|
||||
'shape_y2_value' => $this->data['shape_y2_value'],
|
||||
'image_x' => $this->data['image_x'],
|
||||
'image_y' => $this->data['image_y'],
|
||||
'image_width' => $this->data['image_width'],
|
||||
'image_height' => $this->data['image_height'],
|
||||
'qr_value' => $this->data['qr_value'],
|
||||
'qr_align' => $this->data['qr_align'],
|
||||
'qr_size' => $this->data['qr_size'],
|
||||
'qr_x_value' => $this->data['qr_x_value'],
|
||||
'qr_y_value' => $this->data['qr_y_value'],
|
||||
'created_by' => $this->data['created_by'],
|
||||
]);
|
||||
|
||||
return null;
|
||||
|
||||
//return new StickerDetail();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your sticker detail import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -14,43 +14,56 @@ class StickerMappingMasterImporter extends Importer
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
ImportColumn::make('plant_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->numeric()
|
||||
->rules(['required', 'integer']),
|
||||
ImportColumn::make('item_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example('630987')
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing:'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker1')
|
||||
->label('Sticker Label 1')
|
||||
->exampleHeader('Sticker Label 1')
|
||||
->example('Label 1')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker2')
|
||||
->label('Sticker Label 2')
|
||||
->exampleHeader('Sticker Label 2')
|
||||
->example('601468'),
|
||||
ImportColumn::make('sticker3')
|
||||
->label('Sticker Label 3')
|
||||
->exampleHeader('Sticker Label 3'),
|
||||
//->example(''),
|
||||
ImportColumn::make('sticker4')
|
||||
->label('Sticker Label 4')
|
||||
->exampleHeader('Sticker Label 4'),
|
||||
ImportColumn::make('sticker5')
|
||||
->label('Sticker Label 5')
|
||||
->exampleHeader('Sticker Label 5'),
|
||||
ImportColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->exampleHeader('Created By'),
|
||||
// ImportColumn::make('updated_by'),
|
||||
->numeric()
|
||||
->rules(['required', 'integer']),
|
||||
ImportColumn::make('sticker1'),
|
||||
ImportColumn::make('sticker1_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker1_print_ip'),
|
||||
ImportColumn::make('sticker2'),
|
||||
ImportColumn::make('sticker2_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker2_print_ip'),
|
||||
ImportColumn::make('sticker3'),
|
||||
ImportColumn::make('sticker3_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker3_print_ip'),
|
||||
ImportColumn::make('sticker4'),
|
||||
ImportColumn::make('sticker4_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker4_print_ip'),
|
||||
ImportColumn::make('sticker5'),
|
||||
ImportColumn::make('sticker5_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker5_print_ip'),
|
||||
ImportColumn::make('sticker6'),
|
||||
ImportColumn::make('sticker6_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker6_print_ip'),
|
||||
ImportColumn::make('sticker7'),
|
||||
ImportColumn::make('sticker7_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker7_print_ip'),
|
||||
ImportColumn::make('sticker8'),
|
||||
ImportColumn::make('sticker8_machine_id')
|
||||
->numeric()
|
||||
->rules(['integer']),
|
||||
ImportColumn::make('sticker8_print_ip'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
161
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
161
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\User;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
|
||||
class StickerStructureDetailImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('PLANT CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item_characteristic_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example('123456')
|
||||
->label('ITEM CODE')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker ID')
|
||||
->example('123456')
|
||||
->label('STICKER ID')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_width')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker Width')
|
||||
->example('90')
|
||||
->label('STICKER WIDTH')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_height')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker Height')
|
||||
->example('90')
|
||||
->label('STICKER HEIGHT')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_lmargin')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker Left Margin')
|
||||
->example('0')
|
||||
->label('STICKER LEFT MARGIN')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_rmargin')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker Right Margin')
|
||||
->example('0')
|
||||
->label('STICKER RIGHT MARGIN')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_tmargin')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker Top Margin')
|
||||
->example('0')
|
||||
->label('STICKER TOP MARGIN')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('sticker_bmargin')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Sticker Bottom Margin')
|
||||
->example('0')
|
||||
->label('STICKER BOTTOM MARGIN')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->example('RAW001234')
|
||||
->label('CREATED BY')
|
||||
->rules(['required']),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerStructureDetail
|
||||
{
|
||||
$warnMsg = [];
|
||||
|
||||
$plant = Plant::where('code', $this->data['plant'])->first();
|
||||
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant code not found";
|
||||
}
|
||||
|
||||
// $item = null;
|
||||
// if ($plant) {
|
||||
// $item = Item::where('code', $this->data['itemCharacteristic.item'])->where('plant_id', $plant->id)->first();
|
||||
// }
|
||||
// if (!$item) {
|
||||
// $warnMsg[] = "Item not found";
|
||||
// }
|
||||
|
||||
$itemCode = $this->data['item_characteristic_id'] ?? null;
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
if (!$item) {
|
||||
$warnMsg[] = "Item not found";
|
||||
}
|
||||
|
||||
$itemChar = ItemCharacteristic::where('item_id', $item->id)->first();
|
||||
if (!$itemChar) {
|
||||
$warnMsg[] = "Item not found in item characteristic";
|
||||
}
|
||||
|
||||
$user = User::where('name', $this->data['created_by'])->first();
|
||||
if (!$user) {
|
||||
$warnMsg[] = "User not found";
|
||||
}
|
||||
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
else { //if (empty($warnMsg))
|
||||
$stickerId = StickerStructureDetail::where('sticker_id', $this->data['sticker_id'])
|
||||
->first();
|
||||
|
||||
if ($stickerId) {
|
||||
throw new RowImportFailedException("Sticker ID already exist!");
|
||||
}
|
||||
}
|
||||
|
||||
StickerStructureDetail::Create([
|
||||
'plant_id' => $plant->id,
|
||||
'item_characteristic_id' => $itemChar->id,
|
||||
'sticker_id' => $this->data['sticker_id'],
|
||||
'sticker_width' => $this->data['sticker_width'],
|
||||
'sticker_height' => $this->data['sticker_height'],
|
||||
'sticker_lmargin' => $this->data['sticker_lmargin'],
|
||||
'sticker_rmargin' => $this->data['sticker_rmargin'],
|
||||
'sticker_tmargin' => $this->data['sticker_tmargin'],
|
||||
'sticker_bmargin' => $this->data['sticker_bmargin'],
|
||||
'created_by' => $this->data['created_by'],
|
||||
]);
|
||||
|
||||
return null;
|
||||
|
||||
//return new StickerStructureDetail();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your sticker structure detail import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
20
app/Filament/Pages/NotificationSettings.php
Normal file
20
app/Filament/Pages/NotificationSettings.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use Filament\Pages\Page;
|
||||
|
||||
class NotificationSettings extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.notification-settings';
|
||||
|
||||
|
||||
public static function getScripts(): array
|
||||
{
|
||||
return [
|
||||
asset('js/push.js')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ class ProductionRejectReason extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static ?string $navigationGroup = 'Production Reject';
|
||||
|
||||
protected static string $view = 'filament.pages.production-reject-reason';
|
||||
|
||||
public $qrData, $pId, $bId, $sId, $lId, $iId, $succId, $sNoId, $succStat, $recQr, $prodOrder;
|
||||
|
||||
163
app/Filament/Pages/RfqDashboard.php
Normal file
163
app/Filament/Pages/RfqDashboard.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Plant;
|
||||
use App\Models\RequestQuotation;
|
||||
use App\Models\RfqTransporterBid;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Widgets\Widget;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
|
||||
|
||||
class RfqDashboard extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.rfq-dashboard';
|
||||
|
||||
protected static ?string $navigationGroup = 'RFQ Dashboard';
|
||||
|
||||
use HasFiltersForm;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
session()->forget(['transport_name']);
|
||||
session()->forget(['rfq_number']);
|
||||
$this->filtersForm->fill([
|
||||
'transport_name' => null,
|
||||
'rfq_number' => null
|
||||
]);
|
||||
}
|
||||
|
||||
public function filtersForm(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters')
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
// Select::make('plant')
|
||||
// ->label('Select Plant')
|
||||
// ->reactive()
|
||||
// ->options(function (callable $get) {
|
||||
// $userHas = Filament::auth()->user()->plant_id;
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
// })
|
||||
// ->afterStateUpdated(function ($state,callable $set) {
|
||||
// session(['selected_plant' => $state]);
|
||||
// // $set('rfq_number', null);
|
||||
// session()->forget('rfq_number');
|
||||
// }),
|
||||
|
||||
Select::make('rfq_number')
|
||||
->label('Select RFQ Number')
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
|
||||
return RequestQuotation::orderBy('rfq_number')
|
||||
->pluck('rfq_number', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
session(['rfq_id' => $state]);
|
||||
$set('transport_name', null);
|
||||
session()->forget('transport_name');
|
||||
}),
|
||||
|
||||
Select::make('transport_name')
|
||||
->label('User name')
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$rfqId = $get('rfq_number');
|
||||
|
||||
if (!$rfqId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
if ($user->hasRole(['Super Admin', 'Rfq Supervisor'])) {
|
||||
return RfqTransporterBid::query()
|
||||
->where('request_quotation_id', $rfqId)
|
||||
->whereNotNull('transporter_name')
|
||||
->distinct()
|
||||
->pluck('transporter_name', 'transporter_name')
|
||||
->toArray();
|
||||
}
|
||||
|
||||
return RfqTransporterBid::query()
|
||||
->where('request_quotation_id', $rfqId)
|
||||
->where('transporter_name', $user->name)
|
||||
->distinct()
|
||||
->pluck('transporter_name', 'transporter_name')
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
session(['transport_name' => $state]);
|
||||
}),
|
||||
|
||||
// Select::make('transport_name')
|
||||
// ->label('User name')
|
||||
// ->reactive()
|
||||
// ->options(function () {
|
||||
// $user = Filament::auth()->user();
|
||||
|
||||
// if ($user->hasRole(['Super Admin', 'Rfq Supervisor'])) {
|
||||
// return RfqTransporterBid::query()
|
||||
// ->whereNotNull('transporter_name')
|
||||
// ->distinct()
|
||||
// ->pluck('transporter_name', 'transporter_name')
|
||||
// ->toArray();
|
||||
// }
|
||||
|
||||
// return RfqTransporterBid::query()
|
||||
// ->where('transporter_name', $user->name)
|
||||
// ->distinct()
|
||||
// ->pluck('transporter_name', 'transporter_name')
|
||||
// ->toArray();
|
||||
// })
|
||||
// ->afterStateUpdated(function ($state, callable $set) {
|
||||
// session(['transport_name' => $state]);
|
||||
// $set('rfq_number', null);
|
||||
// session()->forget('rfq_number');
|
||||
// }),
|
||||
|
||||
// Select::make('rfq_number')
|
||||
// ->label('Select RFQ Number')
|
||||
// ->reactive()
|
||||
// ->options(function (callable $get) {
|
||||
// $transportName = $get('transport_name');
|
||||
|
||||
// if (!$transportName) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
// return RequestQuotation::where('transporter_name', $transportName)
|
||||
// ->pluck('rfq_number', 'rfq_number')
|
||||
// ->toArray();
|
||||
// })
|
||||
// ->afterStateUpdated(function ($state) {
|
||||
// session(['rfq_number' => $state]);
|
||||
// }),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view rfq dashboard');
|
||||
}
|
||||
}
|
||||
58
app/Filament/Pages/RfqOverview.php
Normal file
58
app/Filament/Pages/RfqOverview.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Models\RequestQuotation;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RfqOverview extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.rfq-overview';
|
||||
|
||||
protected static ?string $navigationGroup = 'RFQ Dashboard';
|
||||
|
||||
use HasFiltersForm;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
session()->forget(['rfq_id']);
|
||||
$this->filtersForm->fill([
|
||||
'rfq_id' => null
|
||||
]);
|
||||
}
|
||||
|
||||
public function filtersForm(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters')
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Select::make('rfq_number')
|
||||
->label('Select RFQ Number')
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
return RequestQuotation::orderBy('rfq_number')
|
||||
->pluck('rfq_number', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
session(['rfq_id' => $state]);
|
||||
}),
|
||||
])
|
||||
->columns(1),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view rfq overview dashboard');
|
||||
}
|
||||
}
|
||||
240
app/Filament/Pages/StickerStructurePreviewPage.php
Normal file
240
app/Filament/Pages/StickerStructurePreviewPage.php
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Services\StickerPdfService;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\ViewField;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Filament\Pages\Page;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class StickerStructurePreviewPage extends Page
|
||||
{
|
||||
use HasFiltersForm;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.sticker-structure-preview-page';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public $stickerId;
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $itemId;
|
||||
|
||||
public ?string $pdfPreview = null;
|
||||
|
||||
// public array $filters = [];
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
session()->forget(['stick_id', 'selected_plant', 'selected_item']);
|
||||
$this->form->fill([
|
||||
'sticker_id' => null,
|
||||
'plant' => null,
|
||||
'item' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters') // Store form state in 'filters'
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Select::make('sticker_id')
|
||||
->label('Sticker ID')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
|
||||
return StickerStructureDetail::orderByDesc('id')->pluck('sticker_id', 'sticker_id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(callback: function ($state, callable $set) {
|
||||
session(['stick_id' => $state]);
|
||||
$set('plant', null);
|
||||
$set('item', null);
|
||||
$this->pdfPreview = null;
|
||||
})
|
||||
->searchable()
|
||||
->reactive()
|
||||
->required(),
|
||||
Select::make('plant')
|
||||
->label('Select Plant')
|
||||
->reactive()
|
||||
// ->options(Plant::pluck('name', 'id'))
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
session(['stick_id' => $state]);
|
||||
session(['selected_plant' => $state]);
|
||||
$set('item', null);
|
||||
session()->forget('item');
|
||||
$this->pdfPreview = null;
|
||||
}),
|
||||
Select::make('item')
|
||||
->label('Search by Item Code')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plant = $get('plant');
|
||||
|
||||
return $plant ? ItemCharacteristic::where('plant_id', $plant)->with('item')->get()->pluck('item.code', 'id')->toArray() : []; // ->orderBy('plant_id')
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
session(['stick_id' => $state]);
|
||||
session(['selected_plant' => $state]);
|
||||
session(['selected_item' => $state]);
|
||||
$this->pdfPreview = null;
|
||||
// $set('item_id', null);
|
||||
// session()->forget('item');
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
// ViewField::make('generate_template')
|
||||
// ->view('fields.generate-template-preview')
|
||||
// ->reactive()
|
||||
// // ->key(fn ($get) => 'generate-template' . ($get('sticker_id_live') ?? 'empty'))
|
||||
// ->key(fn (Get $get) => 'generate-template-'.
|
||||
// ($get('sticker_id') ?? 'empty').'-'.
|
||||
// ($get('plant') ?? 'empty').'-'.
|
||||
// ($get('item_characteristic_id') ?? 'empty')
|
||||
// )
|
||||
// // ->viewData(fn (Get $get) => [
|
||||
// // 'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
// // ]),
|
||||
// ->viewData(fn (Get $get) => [
|
||||
// 'sticker_id' => $get('sticker_id') ?? 'empty',
|
||||
// 'plant_id' => $get('plant') ?? 'empty',
|
||||
// 'item_characteristic_id' => $get('item') ?? 'empty',
|
||||
// ])
|
||||
// ->hidden(fn (callable $get) => ($get('sticker_id') == null || $get('sticker_id') == '0' || empty($get('sticker_id'))) || (($get('plant') != null || $get('plant') != '') &&
|
||||
// ($get('item') == null || $get('item') == '' || empty($get('item'))))),
|
||||
])
|
||||
->columns(3),
|
||||
]);
|
||||
}
|
||||
|
||||
public function showPreview()
|
||||
{
|
||||
$state = $this->form->getState();
|
||||
$stickerId = trim($state['sticker_id'] ?? '') ?: null;
|
||||
// $stickerId = $this->form->getState()['sticker_id'];
|
||||
// $stickerId = trim($stickerId) ?? null;
|
||||
$this->stickerId = $stickerId;
|
||||
|
||||
$plantId = trim($state['plant'] ?? '') ?: null;
|
||||
// $plantId = $this->form->getState()['plant'];
|
||||
// $plantId = trim($plantId) ?? null;
|
||||
$this->plantId = $plantId;
|
||||
|
||||
$itemId = trim($state['item'] ?? '') ?: null;
|
||||
// $itemId = $this->form->getState()['item'];
|
||||
// $itemId = trim($itemId) ?? null;
|
||||
$this->itemId = $itemId;
|
||||
|
||||
$this->pdfPreview = null;
|
||||
|
||||
// $operatorName = Filament::auth()->user()->name;
|
||||
|
||||
if (! $stickerId) {
|
||||
Notification::make()->title('Please select a Sticker ID first!')->danger()->duration(2000)->send();
|
||||
|
||||
$this->form->fill([
|
||||
'sticker_id' => $stickerId ?? null,
|
||||
'plant' => $plantId ?? null,
|
||||
'item' => $itemId ?? null,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif ($plantId && ! $itemId) {
|
||||
Notification::make()->title('Please select an Item Code!')->danger()->duration(2000)->send();
|
||||
|
||||
$this->form->fill([
|
||||
'sticker_id' => $stickerId,
|
||||
'plant' => $plantId ?? null,
|
||||
'item' => $itemId ?? null,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif ($stickerId && $plantId && $itemId != null && $itemId != '') {
|
||||
|
||||
$itemCharacteristic = $itemId ? ItemCharacteristic::find($itemId) : null;
|
||||
|
||||
$structure = StickerStructureDetail::where('sticker_id', $stickerId)->first();
|
||||
if (! $structure) {
|
||||
Notification::make()->title('Sticker structure not found!')->danger()->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$dynamicElements = StickerDetail::where('sticker_structure_detail_id', $structure->id)->get();
|
||||
|
||||
try {
|
||||
$stickerPdfService = new StickerPdfService;
|
||||
$this->pdfPreview = $stickerPdfService->generateStickerItem($stickerId, $dynamicElements, $itemCharacteristic);
|
||||
|
||||
Notification::make()
|
||||
->title('Sticker Preview Generated!')
|
||||
->success()
|
||||
->duration(2000)
|
||||
->send();
|
||||
} catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Error generating sticker preview!')
|
||||
->body($e->getMessage())
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
} else {
|
||||
$elements = StickerStructureDetail::where('sticker_id', $stickerId)->first();
|
||||
|
||||
try {
|
||||
$stickerPdfService = new StickerPdfService;
|
||||
$this->pdfPreview = $stickerPdfService->generateSticker($stickerId, $elements->toArray());
|
||||
|
||||
Notification::make()
|
||||
->title('Sticker Preview Generated!')
|
||||
->success()
|
||||
->duration(2000)
|
||||
->send();
|
||||
} catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Error generating sticker preview!')
|
||||
->body($e->getMessage())
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Sticker Structure Preview';
|
||||
}
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return 'Sticker Structure Preview';
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view sticker structure preview');
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ class WebcamCapture extends Page implements HasForms
|
||||
use HasFiltersForm;
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static ?string $navigationGroup = 'OCR Validations';
|
||||
|
||||
protected static string $view = 'filament.pages.webcam-capture';
|
||||
|
||||
public $photo;
|
||||
|
||||
17
app/Filament/Pages/Welcome.php
Normal file
17
app/Filament/Pages/Welcome.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use Filament\Pages\Page;
|
||||
|
||||
class Welcome extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.welcome';
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ class ClassCharacteristicResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Laser';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
@@ -39,6 +39,8 @@ class GrMasterResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Process Order';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Models\InvoiceValidation;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Notifications\PushAlertNotification;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Concerns\ExposesTableToWidgets;
|
||||
@@ -136,6 +137,10 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
$user1 = Filament::auth()->user();
|
||||
|
||||
$user1->notify(new PushAlertNotification());
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
@@ -2285,6 +2290,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->danger()
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
$this->form->fill([
|
||||
|
||||
955
app/Filament/Resources/ItemCharacteristicResource.php
Normal file
955
app/Filament/Resources/ItemCharacteristicResource.php
Normal file
@@ -0,0 +1,955 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
use App\Filament\Resources\ItemCharacteristicResource\RelationManagers;
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class ItemCharacteristicResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ItemCharacteristic::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item Code')
|
||||
//->relationship('item', 'id')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('class')
|
||||
->label('Class'),
|
||||
Forms\Components\TextInput::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN Bill Ord'),
|
||||
Forms\Components\TextInput::make('zmm_amps')
|
||||
->label('ZMM Amps'),
|
||||
Forms\Components\TextInput::make('zmm_brand')
|
||||
->label('ZMM Brand'),
|
||||
Forms\Components\TextInput::make('zmm_degreeofprotection')
|
||||
->label('ZMM Degree of Protection'),
|
||||
Forms\Components\TextInput::make('zmm_delivery')
|
||||
->label('ZMM Delivery'),
|
||||
Forms\Components\TextInput::make('zmm_dir_rot')
|
||||
->label('ZMM Direction Rotation'),
|
||||
Forms\Components\TextInput::make('zmm_discharge')
|
||||
->label('ZMM Discharge'),
|
||||
Forms\Components\TextInput::make('zmm_discharge_max')
|
||||
->label('ZMM Discharge Max'),
|
||||
Forms\Components\TextInput::make('zmm_discharge_min')
|
||||
->label('ZMM Discharge Min'),
|
||||
Forms\Components\TextInput::make('zmm_duty')
|
||||
->label('ZMM Duty'),
|
||||
Forms\Components\TextInput::make('zmm_eff_motor')
|
||||
->label('ZMM Eff Motor'),
|
||||
Forms\Components\TextInput::make('zmm_eff_pump')
|
||||
->label('ZMM Eff Pump'),
|
||||
Forms\Components\TextInput::make('zmm_frequency')
|
||||
->label('ZMM Frequency'),
|
||||
Forms\Components\TextInput::make('zmm_head')
|
||||
->label('ZMM Head'),
|
||||
Forms\Components\TextInput::make('zmm_heading')
|
||||
->label('ZMM Heading'),
|
||||
Forms\Components\TextInput::make('zmm_head_max')
|
||||
->label('ZMM Head Max'),
|
||||
Forms\Components\TextInput::make('zmm_head_minimum')
|
||||
->label('ZMM Head Minimum'),
|
||||
Forms\Components\TextInput::make('zmm_idx_eff_mtr')
|
||||
->label('ZMM Idx Eff Mtr'),
|
||||
Forms\Components\TextInput::make('zmm_idx_eff_pump')
|
||||
->label('ZMM Idx Eff Pump'),
|
||||
Forms\Components\TextInput::make('zmm_kvacode')
|
||||
->label('ZMM KVACode'),
|
||||
Forms\Components\TextInput::make('zmm_maxambtemp')
|
||||
->label('ZMM Max Amb Temp'),
|
||||
Forms\Components\TextInput::make('zmm_mincoolingflow')
|
||||
->label('ZMM Min Cooling Flow'),
|
||||
Forms\Components\TextInput::make('zmm_motorseries')
|
||||
->label('ZMM Motor Series'),
|
||||
Forms\Components\TextInput::make('zmm_motor_model')
|
||||
->label('ZMM Motor Model'),
|
||||
Forms\Components\TextInput::make('zmm_outlet')
|
||||
->label('ZMM Outlet'),
|
||||
Forms\Components\TextInput::make('zmm_phase')
|
||||
->label('ZMM Phase'),
|
||||
Forms\Components\TextInput::make('zmm_pressure')
|
||||
->label('ZMM Pressure'),
|
||||
Forms\Components\TextInput::make('zmm_pumpflowtype')
|
||||
->label('ZMM Pump Flow Type'),
|
||||
Forms\Components\TextInput::make('zmm_pumpseries')
|
||||
->label('ZMM Pump Series'),
|
||||
Forms\Components\TextInput::make('zmm_pump_model')
|
||||
->label('ZMM Pump Model'),
|
||||
Forms\Components\TextInput::make('zmm_ratedpower')
|
||||
->label('ZMM Rated Power'),
|
||||
Forms\Components\TextInput::make('zmm_region')
|
||||
->label('ZMM Region'),
|
||||
Forms\Components\TextInput::make('zmm_servicefactor')
|
||||
->label('ZMM Service Factor'),
|
||||
Forms\Components\TextInput::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM Service Factor Maximum Amps'),
|
||||
Forms\Components\TextInput::make('zmm_speed')
|
||||
->label('ZMM Speed'),
|
||||
Forms\Components\TextInput::make('zmm_suction')
|
||||
->label('ZMM Suction'),
|
||||
Forms\Components\TextInput::make('zmm_suctionxdelivery')
|
||||
->label('ZMM Suction X Delivery'),
|
||||
Forms\Components\TextInput::make('zmm_supplysource')
|
||||
->label('ZMM Supply Source'),
|
||||
Forms\Components\TextInput::make('zmm_temperature')
|
||||
->label('ZMM Temperature'),
|
||||
Forms\Components\TextInput::make('zmm_thrustload')
|
||||
->label('ZMM Thrust Load'),
|
||||
Forms\Components\TextInput::make('zmm_volts')
|
||||
->label('ZMM Volts'),
|
||||
Forms\Components\TextInput::make('zmm_wire')
|
||||
->label('ZMM Wire'),
|
||||
Forms\Components\TextInput::make('zmm_package')
|
||||
->label('ZMM Package'),
|
||||
Forms\Components\TextInput::make('zmm_pvarrayrating')
|
||||
->label('ZMM PV Array Rating'),
|
||||
Forms\Components\TextInput::make('zmm_isi')
|
||||
->label('ZMM ISI'),
|
||||
Forms\Components\TextInput::make('zmm_isimotor')
|
||||
->label('ZMM ISI Motor'),
|
||||
Forms\Components\TextInput::make('zmm_isipump')
|
||||
->label('ZMM ISI Pump'),
|
||||
Forms\Components\TextInput::make('zmm_isipumpset')
|
||||
->label('ZMM ISI Pump Set'),
|
||||
Forms\Components\TextInput::make('zmm_pumpset_model')
|
||||
->label('ZMM Pump Set Model'),
|
||||
Forms\Components\TextInput::make('zmm_stages')
|
||||
->label('ZMM Stages'),
|
||||
Forms\Components\TextInput::make('zmm_headrange')
|
||||
->label('ZMM Head Range'),
|
||||
Forms\Components\TextInput::make('zmm_overall_efficiency')
|
||||
->label('ZMM Overall Efficiency'),
|
||||
Forms\Components\TextInput::make('zmm_connection')
|
||||
->label('ZMM Connection'),
|
||||
Forms\Components\TextInput::make('zmm_min_bore_size')
|
||||
->label('ZMM Min Bore Size'),
|
||||
Forms\Components\TextInput::make('zmm_isireference')
|
||||
->label('ZMM ISI Reference'),
|
||||
Forms\Components\TextInput::make('zmm_category')
|
||||
->label('ZMM Category'),
|
||||
Forms\Components\TextInput::make('zmm_submergence')
|
||||
->label('ZMM Submergence'),
|
||||
Forms\Components\TextInput::make('zmm_capacitorstart')
|
||||
->label('ZMM Capacitor Start'),
|
||||
Forms\Components\TextInput::make('zmm_capacitorrun')
|
||||
->label('ZMM Capacitor Run'),
|
||||
Forms\Components\TextInput::make('zmm_inch')
|
||||
->label('ZMM Inch'),
|
||||
Forms\Components\TextInput::make('zmm_motor_type')
|
||||
->label('ZMM Motor Type'),
|
||||
Forms\Components\TextInput::make('zmm_dismantle_direction')
|
||||
->label('ZMM Dismantle Direction'),
|
||||
Forms\Components\TextInput::make('zmm_eff_ovrall')
|
||||
->label('ZMM Overall Efficiency'),
|
||||
Forms\Components\TextInput::make('zmm_bodymoc')
|
||||
->label('ZMM Body MOC'),
|
||||
Forms\Components\TextInput::make('zmm_rotormoc')
|
||||
->label('ZMM Rotor MOC'),
|
||||
Forms\Components\TextInput::make('zmm_dlwl')
|
||||
->label('ZMM DLWL'),
|
||||
Forms\Components\TextInput::make('zmm_inputpower')
|
||||
->label('ZMM Input Power'),
|
||||
Forms\Components\TextInput::make('zmm_imp_od')
|
||||
->label('ZMM Imp OD'),
|
||||
Forms\Components\TextInput::make('zmm_ambtemp')
|
||||
->label('ZMM Ambient Temperature'),
|
||||
Forms\Components\TextInput::make('zmm_de')
|
||||
->label('ZMM DE'),
|
||||
Forms\Components\TextInput::make('zmm_dischargerange')
|
||||
->label('ZMM Discharge Range'),
|
||||
Forms\Components\TextInput::make('zmm_efficiency_class')
|
||||
->label('ZMM Efficiency Class'),
|
||||
Forms\Components\TextInput::make('zmm_framesize')
|
||||
->label('ZMM Frame Size'),
|
||||
Forms\Components\TextInput::make('zmm_impellerdiameter')
|
||||
->label('ZMM Impeller Diameter'),
|
||||
Forms\Components\TextInput::make('zmm_insulationclass')
|
||||
->label('ZMM Insulation Class'),
|
||||
Forms\Components\TextInput::make('zmm_maxflow')
|
||||
->label('ZMM Max Flow'),
|
||||
Forms\Components\TextInput::make('zmm_minhead')
|
||||
->label('ZMM Min Head'),
|
||||
Forms\Components\TextInput::make('zmm_mtrlofconst')
|
||||
->label('ZMM Motor Load Constant'),
|
||||
Forms\Components\TextInput::make('zmm_nde')
|
||||
->label('ZMM NDE'),
|
||||
Forms\Components\TextInput::make('zmm_powerfactor')
|
||||
->label('ZMM Power Factor'),
|
||||
Forms\Components\TextInput::make('zmm_tagno')
|
||||
->label('ZMM Tag No'),
|
||||
Forms\Components\TextInput::make('zmm_year')
|
||||
->label('ZMM Year'),
|
||||
Forms\Components\TextInput::make('zmm_laser_name')
|
||||
->label('ZMM Laser Name'),
|
||||
Forms\Components\TextInput::make('zmm_beenote')
|
||||
->label('ZMM Bee Note'),
|
||||
Forms\Components\TextInput::make('zmm_beenumber')
|
||||
->label('ZMM Bee Number'),
|
||||
Forms\Components\TextInput::make('zmm_beestar')
|
||||
->label('ZMM Bee Star'),
|
||||
Forms\Components\TextInput::make('zmm_logo_ce')
|
||||
->label('ZMM Logo CE'),
|
||||
Forms\Components\TextInput::make('zmm_codeclass')
|
||||
->label('ZMM Code Class'),
|
||||
Forms\Components\TextInput::make('zmm_colour')
|
||||
->label('ZMM Colour'),
|
||||
Forms\Components\TextInput::make('zmm_logo_cp')
|
||||
->label('ZMM Logo CP'),
|
||||
Forms\Components\TextInput::make('zmm_grade')
|
||||
->label('ZMM Grade'),
|
||||
Forms\Components\TextInput::make('zmm_grwt_pset')
|
||||
->label('ZMM Grwt Pset'),
|
||||
Forms\Components\TextInput::make('zmm_grwt_cable')
|
||||
->label('ZMM Grwt Cable'),
|
||||
Forms\Components\TextInput::make('zmm_grwt_motor')
|
||||
->label('ZMM Grwt Motor'),
|
||||
Forms\Components\TextInput::make('zmm_grwt_pf')
|
||||
->label('ZMM Grwt PF'),
|
||||
Forms\Components\TextInput::make('zmm_grwt_pump')
|
||||
->label('ZMM Grwt Pump'),
|
||||
Forms\Components\TextInput::make('zmm_isivalve')
|
||||
->label('ZMM ISIV Alve'),
|
||||
Forms\Components\TextInput::make('zmm_isi_wc')
|
||||
->label('ZMM ISIV WC'),
|
||||
Forms\Components\TextInput::make('zmm_labelperiod')
|
||||
->label('ZMM Label Period'),
|
||||
Forms\Components\TextInput::make('zmm_length')
|
||||
->label('ZMM Length'),
|
||||
Forms\Components\TextInput::make('zmm_license_cml_no')
|
||||
->label('ZMM License CML No'),
|
||||
Forms\Components\TextInput::make('zmm_mfgmonyr')
|
||||
->label('ZMM Mfg Mon Yr'),
|
||||
Forms\Components\TextInput::make('zmm_modelyear')
|
||||
->label('ZMM Model Year'),
|
||||
Forms\Components\TextInput::make('zmm_motoridentification')
|
||||
->label('ZMM Motor Identification'),
|
||||
Forms\Components\TextInput::make('zmm_newt_pset')
|
||||
->label('ZMM Newt Pset'),
|
||||
Forms\Components\TextInput::make('zmm_newt_cable')
|
||||
->label('ZMM Newt Cable'),
|
||||
Forms\Components\TextInput::make('zmm_newt_motor')
|
||||
->label('ZMM Newt Motor'),
|
||||
Forms\Components\TextInput::make('zmm_newt_pf')
|
||||
->label('ZMM Newt PF'),
|
||||
Forms\Components\TextInput::make('zmm_newt_pump')
|
||||
->label('ZMM Newt Pump'),
|
||||
Forms\Components\TextInput::make('zmm_logo_nsf')
|
||||
->label('ZMM Logo NSF'),
|
||||
Forms\Components\TextInput::make('zmm_packtype')
|
||||
->label('ZMM Pack Type'),
|
||||
Forms\Components\TextInput::make('zmm_panel')
|
||||
->label('ZMM Panel'),
|
||||
Forms\Components\TextInput::make('zmm_performance_factor')
|
||||
->label('ZMM Performance Factor'),
|
||||
Forms\Components\TextInput::make('zmm_pumpidentification')
|
||||
->label('ZMM Pump Identification'),
|
||||
Forms\Components\TextInput::make('zmm_psettype')
|
||||
->label('ZMM Pset Type'),
|
||||
Forms\Components\TextInput::make('zmm_size')
|
||||
->label('ZMM Size'),
|
||||
Forms\Components\TextInput::make('zmm_eff_ttl')
|
||||
->label('ZMM Eff TTL'),
|
||||
Forms\Components\TextInput::make('zmm_type')
|
||||
->label('ZMM Type'),
|
||||
Forms\Components\TextInput::make('zmm_usp')
|
||||
->label('ZMM USP'),
|
||||
Forms\Components\TextInput::make('zmm_1')
|
||||
->label('ZMM 1'),
|
||||
Forms\Components\TextInput::make('zmm_2')
|
||||
->label('ZMM 2'),
|
||||
Forms\Components\TextInput::make('zmm_3')
|
||||
->label('ZMM 3'),
|
||||
Forms\Components\TextInput::make('zmm_4')
|
||||
->label('ZMM 4'),
|
||||
Forms\Components\TextInput::make('zmm_5')
|
||||
->label('ZMM 5'),
|
||||
Forms\Components\TextInput::make('zmm_6')
|
||||
->label('ZMM 6'),
|
||||
Forms\Components\TextInput::make('zmm_7')
|
||||
->label('ZMM 7'),
|
||||
Forms\Components\TextInput::make('zmm_8')
|
||||
->label('ZMM 8'),
|
||||
Forms\Components\TextInput::make('zmm_9')
|
||||
->label('ZMM 9'),
|
||||
Forms\Components\TextInput::make('zmm_10')
|
||||
->label('ZMM 10'),
|
||||
Forms\Components\TextInput::make('zmm_11')
|
||||
->label('ZMM 11'),
|
||||
Forms\Components\TextInput::make('zmm_12')
|
||||
->label('ZMM 12'),
|
||||
Forms\Components\TextInput::make('zmm_13')
|
||||
->label('ZMM 13'),
|
||||
Forms\Components\TextInput::make('zmm_14')
|
||||
->label('ZMM 14'),
|
||||
Forms\Components\TextInput::make('zmm_15')
|
||||
->label('ZMM 15'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
// Tables\Columns\TextColumn::make('id')
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('class')
|
||||
->label('Class')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zz1_cn_bill_ord')
|
||||
->label('ZZ1 CN Bill Ord')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_amps')
|
||||
->label('ZMM Amps')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_brand')
|
||||
->label('ZMM Brand')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_degreeofprotection')
|
||||
->label('ZMM Degree of Protection')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_delivery')
|
||||
->label('ZMM Delivery')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_dir_rot')
|
||||
->label('ZMM Direction Rotation')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_discharge')
|
||||
->label('ZMM Discharge')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_discharge_max')
|
||||
->label('ZMM Discharge Max')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_discharge_min')
|
||||
->label('ZMM Discharge Min')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_duty')
|
||||
->label('ZMM Duty')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_eff_motor')
|
||||
->label('ZMM Eff Motor')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_eff_pump')
|
||||
->label('ZMM Eff Pump')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_frequency')
|
||||
->label('ZMM Frequency')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_head')
|
||||
->label('ZMM Head')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_heading')
|
||||
->label('ZMM Heading')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_head_max')
|
||||
->label('ZMM Head Max')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_head_minimum')
|
||||
->label('ZMM Head Minimum')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_idx_eff_mtr')
|
||||
->label('ZMM Idx Eff Mtr')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_idx_eff_pump')
|
||||
->label('ZMM Idx Eff Pump')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_kvacode')
|
||||
->label('ZMM KVACode')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_maxambtemp')
|
||||
->label('ZMM Max Amb Temp')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_mincoolingflow')
|
||||
->label('ZMM Min Cooling Flow')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_motorseries')
|
||||
->label('ZMM Motor Series')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_motor_model')
|
||||
->label('ZMM Motor Model')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_outlet')
|
||||
->label('ZMM Outlet')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_phase')
|
||||
->label('ZMM Phase')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_pressure')
|
||||
->label('ZMM Pressure')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_pumpflowtype')
|
||||
->label('ZMM Pump Flow Type')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_pumpseries')
|
||||
->label('ZMM Pump Series')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_pump_model')
|
||||
->label('ZMM Pump Model')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_ratedpower')
|
||||
->label('ZMM Rated Power')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_region')
|
||||
->label('ZMM Region')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_servicefactor')
|
||||
->label('ZMM Service Factor')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_servicefactormaximumamps')
|
||||
->label('ZMM Service Factor Maximum Amps')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_speed')
|
||||
->label('ZMM Speed')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_suction')
|
||||
->label('ZMM Suction')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_suctionxdelivery')
|
||||
->label('ZMM Suction X Delivery')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_supplysource')
|
||||
->label('ZMM Supply Source')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_temperature')
|
||||
->label('ZMM Temperature')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_thrustload')
|
||||
->label('ZMM Thrust Load')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_volts')
|
||||
->label('ZMM Volts')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_wire')
|
||||
->label('ZMM Wire')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_package')
|
||||
->label('ZMM Package')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_pvarrayrating')
|
||||
->label('ZMM PV Array Rating')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_isi')
|
||||
->label('ZMM ISI')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_isimotor')
|
||||
->label('ZMM ISI Motor')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_isipump')
|
||||
->label('ZMM ISI Pump')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_isipumpset')
|
||||
->label('ZMM ISI Pump Set')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_pumpset_model')
|
||||
->label('ZMM Pump Set Model')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_stages')
|
||||
->label('ZMM Stages')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_headrange')
|
||||
->label('ZMM Head Range')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_overall_efficiency')
|
||||
->label('ZMM Overall Efficiency')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_connection')
|
||||
->label('ZMM Connection')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_min_bore_size')
|
||||
->label('ZMM Min Bore Size')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_isireference')
|
||||
->label('ZMM ISI Reference')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_category')
|
||||
->label('ZMM Category')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_submergence')
|
||||
->label('ZMM Submergence')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_capacitorstart')
|
||||
->label('ZMM Capacitor Start')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_capacitorrun')
|
||||
->label('ZMM Capacitor Run')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_inch')
|
||||
->label('ZMM Inch')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_motor_type')
|
||||
->label('ZMM Motor Type')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_dismantle_direction')
|
||||
->label('ZMM Dismantle Direction')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_eff_ovrall')
|
||||
->label('ZMM Overall Efficiency')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_bodymoc')
|
||||
->label('ZMM Body MOC')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_rotormoc')
|
||||
->label('ZMM Rotor MOC')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_dlwl')
|
||||
->label('ZMM DLWL')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_inputpower')
|
||||
->label('ZMM Input Power')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_imp_od')
|
||||
->label('ZMM Imp OD')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_ambtemp')
|
||||
->label('ZMM Ambient Temperature')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_de')
|
||||
->label('ZMM DE')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_dischargerange')
|
||||
->label('ZMM Discharge Range')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_efficiency_class')
|
||||
->label('ZMM Efficiency Class')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_framesize')
|
||||
->label('ZMM Frame Size')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_impellerdiameter')
|
||||
->label('ZMM Impeller Diameter')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_insulationclass')
|
||||
->label('ZMM Insulation Class')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_maxflow')
|
||||
->label('ZMM Max Flow')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_minhead')
|
||||
->label('ZMM Min Head')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_mtrlofconst')
|
||||
->label('ZMM Motor Load Constant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_nde')
|
||||
->label('ZMM NDE')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_powerfactor')
|
||||
->label('ZMM Power Factor')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_tagno')
|
||||
->label('ZMM Tag No')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_year')
|
||||
->label('ZMM Year')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_laser_name')
|
||||
->label('ZMM Laser Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_beenote')
|
||||
->label('ZMM Bee Note')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_beenumber')
|
||||
->label('ZMM Bee Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_beestar')
|
||||
->label('ZMM Bee Star')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_logo_ce')
|
||||
->label('ZMM Logo CE')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_codeclass')
|
||||
->label('ZMM Code Class')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_colour')
|
||||
->label('ZMM Colour')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_logo_cp')
|
||||
->label('ZMM Logo CP')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_grade')
|
||||
->label('ZMM Grade')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_grwt_pset')
|
||||
->label('ZMM Grwt Pset')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_grwt_cable')
|
||||
->label('ZMM Grwt Cable')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_grwt_motor')
|
||||
->label('ZMM Grwt Motor')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_grwt_pf')
|
||||
->label('ZMM Grwt PF')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_grwt_pump')
|
||||
->label('ZMM Grwt Pump')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_isivalve')
|
||||
->label('ZMM ISIV Alve')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_isi_wc')
|
||||
->label('ZMM ISIV WC')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_labelperiod')
|
||||
->label('ZMM Label Period')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_length')
|
||||
->label('ZMM Length')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_license_cml_no')
|
||||
->label('ZMM License CML No')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_mfgmonyr')
|
||||
->label('ZMM Mfg Mon Yr')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_modelyear')
|
||||
->label('ZMM Model Year')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_motoridentification')
|
||||
->label('ZMM Motor Identification')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_newt_pset')
|
||||
->label('ZMM Newt Pset')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_newt_cable')
|
||||
->label('ZMM Newt Cable')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_newt_motor')
|
||||
->label('ZMM Newt Motor')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_newt_pf')
|
||||
->label('ZMM Newt PF')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_newt_pump')
|
||||
->label('ZMM Newt Pump')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_logo_nsf')
|
||||
->label('ZMM Logo NSF')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_packtype')
|
||||
->label('ZMM Pack Type')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_panel')
|
||||
->label('ZMM Panel')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_performance_factor')
|
||||
->label('ZMM Performance Factor')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_pumpidentification')
|
||||
->label('ZMM Pump Identification')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_psettype')
|
||||
->label('ZMM Pset Type')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_size')
|
||||
->label('ZMM Size')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_eff_ttl')
|
||||
->label('ZMM Eff TTL')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_type')
|
||||
->label('ZMM Type')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_usp')
|
||||
->label('ZMM USP')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_1')
|
||||
->label('ZMM 1')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_2')
|
||||
->label('ZMM 2')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_3')
|
||||
->label('ZMM 3')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_4')
|
||||
->label('ZMM 4')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_5')
|
||||
->label('ZMM 5')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_6')
|
||||
->label('ZMM 6')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_7')
|
||||
->label('ZMM 7')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_8')
|
||||
->label('ZMM 8')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_9')
|
||||
->label('ZMM 9')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_10')
|
||||
->label('ZMM 10')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_11')
|
||||
->label('ZMM 11')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_12')
|
||||
->label('ZMM 12')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_13')
|
||||
->label('ZMM 13')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_14')
|
||||
->label('ZMM 14')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('zmm_15')
|
||||
->label('ZMM 15')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListItemCharacteristics::route('/'),
|
||||
'create' => Pages\CreateItemCharacteristic::route('/create'),
|
||||
'view' => Pages\ViewItemCharacteristic::route('/{record}'),
|
||||
'edit' => Pages\EditItemCharacteristic::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateItemCharacteristic extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditItemCharacteristic extends EditRecord
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListItemCharacteristics extends ListRecords
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\ItemCharacteristicResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ItemCharacteristicResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewItemCharacteristic extends ViewRecord
|
||||
{
|
||||
protected static string $resource = ItemCharacteristicResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ class OcrValidationResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'OCR Validations';
|
||||
|
||||
public $camera_capture;
|
||||
public $serialNumbers = [];
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Process Order';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
@@ -36,6 +36,8 @@ class RejectReasonResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Production Reject';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
295
app/Filament/Resources/RequestQuotationResource.php
Normal file
295
app/Filament/Resources/RequestQuotationResource.php
Normal file
@@ -0,0 +1,295 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\RequestQuotationExporter;
|
||||
use App\Filament\Imports\RequestQuotationImporter;
|
||||
use App\Filament\Resources\RequestQuotationResource\Pages;
|
||||
use App\Filament\Resources\RequestQuotationResource\RelationManagers;
|
||||
use App\Models\RequestQuotation;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
|
||||
class RequestQuotationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = RequestQuotation::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Request For Quotation';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
$canEdit = Auth::user()?->can('edit_transport_fields');
|
||||
$canEditData = Auth::user()?->can('edit_all_transport_fields');
|
||||
return $form
|
||||
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('rfq_number')
|
||||
->label('RFQ Number')
|
||||
->readOnly()
|
||||
->required(),
|
||||
Forms\Components\Select::make('spot_rate_transport_master_id')
|
||||
->label('Group Name')
|
||||
->relationship('spotRateTransportMaster', 'group_name')
|
||||
->required(),
|
||||
Forms\Components\DateTimePicker::make('rfq_date_time')
|
||||
->label('RFQ Date Time')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('pickup_address')
|
||||
->label('PickUp Address')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('delivery_address')
|
||||
->label('Delivery Address')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('weight')
|
||||
->label('Weight')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('volumetrice_size_inch')
|
||||
->label('Volumetrice')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('type_of_vehicle')
|
||||
->label('Type of Vehicle')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('special_type')
|
||||
->label('Special Type')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('no_of_vehicle')
|
||||
->label('No of Vehicle')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('product_name')
|
||||
->label('Product Name')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('loading_by')
|
||||
->label('Loading By')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('unloading_by')
|
||||
->label('Unloading By')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('pick_and_delivery')
|
||||
->label('Pick and Delivery')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('payment_term')
|
||||
->label('Payment Term')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('paid_topay')
|
||||
->label('Paid Today')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\DateTimePicker::make('require_date_time')
|
||||
->label('Require Date Time')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
Forms\Components\DateTimePicker::make('rfq_rec_on_or_before')
|
||||
->label('RFQ Receive On Or Before')
|
||||
->disabled(fn () => !$canEditData)
|
||||
->required(),
|
||||
// Forms\Components\TextInput::make('transporter_name')
|
||||
// ->label('Transporter Name')
|
||||
// ->disabled(fn () => !($canEdit || $canEditData)),
|
||||
// Forms\Components\TextInput::make('total_freight_charge')
|
||||
// ->label('Total Freight Charge')
|
||||
// ->disabled(fn () => !($canEdit || $canEditData)),
|
||||
// Forms\Components\TextInput::make('transit_day')
|
||||
// ->label('Transit Day')
|
||||
// ->disabled(fn () => !($canEdit || $canEditData)),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By'),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->alignCenter()
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('rfq_number')
|
||||
->label('RFQ Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('spotRateTransportMaster.group_name')
|
||||
->label('Group Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('rfq_date_time')
|
||||
->label('RFQ Date Time')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pickup_address')
|
||||
->label('PickUp Address')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('delivery_address')
|
||||
->label('Delivery Address')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('weight')
|
||||
->label('Weight')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('volumetrice_size_inch')
|
||||
->label('Volumetrice Size Inch')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('type_of_vehicle')
|
||||
->label('Type Of Vehicle')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('product_name')
|
||||
->label('Product Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('loading_by')
|
||||
->label('Loading By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('unloading_by')
|
||||
->label('Unloading By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('unloading_by')
|
||||
->label('Unloading By')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pick_and_delivery')
|
||||
->label('Pick and Delivery')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('payment_term')
|
||||
->label('Payment Term')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('paid_topay')
|
||||
->label('Paid Today')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('require_date_time')
|
||||
->label('Require Date Time')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('rfq_rec_on_or_before')
|
||||
->label('RFQ Receive On Or Before')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('transporter_name')
|
||||
->label('Transporter Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('total_freight_charge')
|
||||
->label('Total Freight Charge')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('transit_day')
|
||||
->label('Transit Day')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import RequestQuotation')
|
||||
->color('warning')
|
||||
->importer(RequestQuotationImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import request quotation');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export RequestQuotation')
|
||||
->color('warning')
|
||||
->exporter(RequestQuotationExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export request quotation');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListRequestQuotations::route('/'),
|
||||
'create' => Pages\CreateRequestQuotation::route('/create'),
|
||||
'view' => Pages\ViewRequestQuotation::route('/{record}'),
|
||||
'edit' => Pages\EditRequestQuotation::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RequestQuotationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RequestQuotationResource;
|
||||
use App\Models\RequestQuotation;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateRequestQuotation extends CreateRecord
|
||||
{
|
||||
protected static string $resource = RequestQuotationResource::class;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
parent::mount();
|
||||
|
||||
$this->form->fill([
|
||||
'rfq_number' => $this->generateRfqNumber(),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function generateRfqNumber(): string
|
||||
{
|
||||
$year = now()->year;
|
||||
|
||||
$lastRfq = RequestQuotation::whereYear('created_at', $year)
|
||||
->orderBy('id', 'desc')
|
||||
->value('rfq_number');
|
||||
|
||||
if ($lastRfq) {
|
||||
$lastNumber = (int) substr($lastRfq, -3);
|
||||
$nextNumber = str_pad($lastNumber + 1, 3, '0', STR_PAD_LEFT);
|
||||
} else {
|
||||
$nextNumber = '001';
|
||||
}
|
||||
|
||||
return "C.R.I-{$year}-{$nextNumber}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RequestQuotationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RequestQuotationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditRequestQuotation extends EditRecord
|
||||
{
|
||||
protected static string $resource = RequestQuotationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RequestQuotationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RequestQuotationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListRequestQuotations extends ListRecords
|
||||
{
|
||||
protected static string $resource = RequestQuotationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RequestQuotationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RequestQuotationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewRequestQuotation extends ViewRecord
|
||||
{
|
||||
protected static string $resource = RequestQuotationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
345
app/Filament/Resources/RfqTransporterBidResource.php
Normal file
345
app/Filament/Resources/RfqTransporterBidResource.php
Normal file
@@ -0,0 +1,345 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
use App\Filament\Resources\RfqTransporterBidResource\RelationManagers;
|
||||
use App\Models\RfqTransporterBid;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
|
||||
class RfqTransporterBidResource extends Resource
|
||||
{
|
||||
protected static ?string $model = RfqTransporterBid::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Request For Quotation';
|
||||
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
])
|
||||
->when(
|
||||
! $user->hasAnyRole(['Super Admin', 'TransporterBidSupervisor']),
|
||||
fn (Builder $query) => $query
|
||||
->where('transporter_name', $user->name)
|
||||
->whereNotNull('request_quotation_id')
|
||||
);
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('request_quotation_id')
|
||||
->label('RFQ Number')
|
||||
// ->relationship('requestQuotation', 'rfq_number')
|
||||
->relationship(
|
||||
'requestQuotation',
|
||||
'rfq_number',
|
||||
function (Builder $query) {
|
||||
|
||||
$userName = Filament::auth()->user()?->name;
|
||||
|
||||
$masterIds = \App\Models\SpotRateTransportMaster::whereRaw(
|
||||
"user_name::jsonb @> ?",
|
||||
[json_encode([$userName])]
|
||||
)
|
||||
->pluck('id')
|
||||
->unique()
|
||||
->toArray();
|
||||
|
||||
if (empty($masterIds)) {
|
||||
$query->whereRaw('1 = 0');
|
||||
return;
|
||||
}
|
||||
|
||||
$query->whereIn('spot_rate_transport_master_id', $masterIds);
|
||||
}
|
||||
)
|
||||
->reactive()
|
||||
// ->disabled(fn ($record) => !Filament::auth()->user()?->hasAnyRole(['Super Admin', 'TransporterBidSupervisor']))
|
||||
->disabled(fn ($record) =>
|
||||
!Filament::auth()->user()?->hasAnyRole(['Super Admin', 'TransporterBidSupervisor'])
|
||||
&& $record
|
||||
)
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$rfq = \App\Models\RequestQuotation::find($state);
|
||||
if ($rfq) {
|
||||
$set('pickup_address', $rfq->pickup_address);
|
||||
$set('delivery_address', $rfq->delivery_address);
|
||||
$set('type_of_vehicle', $rfq->type_of_vehicle);
|
||||
$set('weight', $rfq->weight);
|
||||
$set('volumetrice_size_inch', $rfq->volumetrice_size_inch);
|
||||
$set('no_of_vehicle', $rfq->no_of_vehicle);
|
||||
$set('product_name', $rfq->product_name);
|
||||
$set('pick_and_delivery', $rfq->pick_and_delivery);
|
||||
$set('payment_term', $rfq->payment_term);
|
||||
$set('paid_topay', $rfq->paid_topay);
|
||||
$set('loading_by', $rfq->loading_by);
|
||||
$set('unloading_by', $rfq->unloading_by);
|
||||
$set('special_type', $rfq->special_type);
|
||||
$set('rfq_date_time', $rfq->rfq_date_time);
|
||||
$set('require_date_time', $rfq->require_date_time);
|
||||
$set('rfq_rec_on_or_before', $rfq->rfq_rec_on_or_before);
|
||||
}
|
||||
})
|
||||
->afterStateHydrated(function ($state, callable $set) {
|
||||
$rfq = \App\Models\RequestQuotation::find($state);
|
||||
if ($rfq) {
|
||||
$set('pickup_address', $rfq->pickup_address);
|
||||
$set('delivery_address', $rfq->delivery_address);
|
||||
$set('type_of_vehicle', $rfq->type_of_vehicle);
|
||||
$set('weight', $rfq->weight);
|
||||
$set('volumetrice_size_inch', $rfq->volumetrice_size_inch);
|
||||
$set('no_of_vehicle', $rfq->no_of_vehicle);
|
||||
$set('product_name', $rfq->product_name);
|
||||
$set('pick_and_delivery', $rfq->pick_and_delivery);
|
||||
$set('payment_term', $rfq->payment_term);
|
||||
$set('paid_topay', $rfq->paid_topay);
|
||||
$set('loading_by', $rfq->loading_by);
|
||||
$set('unloading_by', $rfq->unloading_by);
|
||||
$set('special_type', $rfq->special_type);
|
||||
$set('rfq_date_time', $rfq->rfq_date_time);
|
||||
$set('require_date_time', $rfq->require_date_time);
|
||||
$set('rfq_rec_on_or_before', $rfq->rfq_rec_on_or_before);
|
||||
}
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Section::make('RFQ Details')
|
||||
->visible(fn ($get) => $get('request_quotation_id') != null)
|
||||
->reactive()
|
||||
->schema([
|
||||
TextInput::make('pickup_address')->label('Pickup Address')->disabled(),
|
||||
TextInput::make('delivery_address')->label('Delivery Address')->disabled(),
|
||||
TextInput::make('type_of_vehicle')->label('Vehicle Type')->disabled(),
|
||||
TextInput::make('weight')->label('Weight')->disabled(),
|
||||
TextInput::make('volumetrice_size_inch')->label('Volumetric Size')->disabled(),
|
||||
TextInput::make('no_of_vehicle')->label('No. of Vehicle')->disabled(),
|
||||
TextInput::make('product_name')->label('Product Name')->disabled(),
|
||||
TextInput::make('pick_and_delivery')->label('Pick & Delivery')->disabled(),
|
||||
TextInput::make('payment_term')->label('Payment Term')->disabled(),
|
||||
TextInput::make('paid_topay')->label('Paid / To Pay')->disabled(),
|
||||
TextInput::make('loading_by')->label('Loading By')->disabled(),
|
||||
TextInput::make('unloading_by')->label('Unloading By')->disabled(),
|
||||
TextInput::make('special_type')->label('Special Type')->disabled(),
|
||||
TextInput::make('rfq_date_time')->label('RFQ Created On')->disabled(),
|
||||
TextInput::make('require_date_time')->label('Required Date')->disabled(),
|
||||
TextInput::make('rfq_rec_on_or_before')->label('RFQ Received On/Before')->disabled(),
|
||||
]),
|
||||
Forms\Components\TextInput::make('transporter_name')
|
||||
->label('Transporter Name')
|
||||
->readOnly()
|
||||
->default(Filament::auth()->user()?->name)
|
||||
->required()
|
||||
->rule(function (callable $get) {
|
||||
return Rule::unique('rfq_transporter_bids', 'transporter_name')
|
||||
->where('request_quotation_id', $get('request_quotation_id'))
|
||||
->ignore($get('id'));
|
||||
}),
|
||||
Forms\Components\TextInput::make('total_freight_charge')
|
||||
->label('Total Freight Charge')
|
||||
->required()
|
||||
// ->disabled(fn ($record) => $record && $record->created_by != Filament::auth()->user()?->name)
|
||||
// ->hidden(fn ($record) => !Filament::auth()->user()?->hasAnyRole(['Super Admin', 'TransporterBidSupervisor']) && $record->transporter_name != Filament::auth()->user()?->name),
|
||||
->hidden(fn ($record) =>
|
||||
!Filament::auth()->user()?->hasAnyRole(['Super Admin', 'TransporterBidSupervisor'])
|
||||
&& ($record && $record->transporter_name != Filament::auth()->user()?->name) // Ensure $record is not null before checking transporter_name
|
||||
),
|
||||
Forms\Components\TextInput::make('transit_day')
|
||||
->label('Transit Day')
|
||||
->required()
|
||||
// ->disabled(fn ($record) => $record && $record->created_by != Filament::auth()->user()?->name),
|
||||
// ->hidden(fn ($record) => !Filament::auth()->user()?->hasAnyRole(['Super Admin', 'TransporterBidSupervisor']) && $record->transporter_name != Filament::auth()->user()?->name),
|
||||
->hidden(fn ($record) =>
|
||||
!Filament::auth()->user()?->hasAnyRole(['Super Admin', 'TransporterBidSupervisor'])
|
||||
&& ($record && $record->transporter_name != Filament::auth()->user()?->name) // Ensure $record is not null before checking transporter_name
|
||||
),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->alignCenter()
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.rfq_number')
|
||||
->label('RFQ Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.pickup_address')
|
||||
->label('PickUp Address')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.delivery_address')
|
||||
->label('Delivery Address')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.type_of_vehicle')
|
||||
->label('Type Of Vehicle')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.weight')
|
||||
->label('Weight')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.volumetrice_size_inch')
|
||||
->label('Volumetrice Size Inch')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.no_of_vehicle')
|
||||
->label('No Of Vehicle')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.product_name')
|
||||
->label('Product Name')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.pick_and_delivery')
|
||||
->label('Pick And Delivery')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.payment_term')
|
||||
->label('Payment Term')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.paid_topay')
|
||||
->label('Paid Today')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.loading_by')
|
||||
->label('Loading By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.unloading_by')
|
||||
->label('Unloading By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.special_type')
|
||||
->label('Special Type')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.rfq_date_time')
|
||||
->label('RFQ DateTime')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.require_date_time')
|
||||
->label('RFQ Require DateTime')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('requestQuotation.rfq_rec_on_or_before')
|
||||
->label('RFQ Rec On Or Before')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_by')
|
||||
->label('Updated By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListRfqTransporterBids::route('/'),
|
||||
'create' => Pages\CreateRfqTransporterBid::route('/create'),
|
||||
'view' => Pages\ViewRfqTransporterBid::route('/{record}'),
|
||||
'edit' => Pages\EditRfqTransporterBid::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
// public static function getEloquentQuery(): Builder
|
||||
// {
|
||||
// return parent::getEloquentQuery()
|
||||
// ->withoutGlobalScopes([
|
||||
// SoftDeletingScope::class,
|
||||
// ]);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use App\Models\RfqTransporterBid;
|
||||
use App\Models\User;
|
||||
use App\Notifications\PushAlertNotification;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateRfqTransporterBid extends CreateRecord
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
$record = $this->record;
|
||||
|
||||
// Calculate rank based on total_freight_charge
|
||||
$rank = RfqTransporterBid::where('request_quotation_id', $this->record->request_quotation_id)
|
||||
->orderBy('total_freight_charge')
|
||||
->pluck('id')
|
||||
->search($this->record->id) + 1;
|
||||
|
||||
$recipients = User::role(['Super Admin', 'Rfq Supervisor'])->get();
|
||||
$currentUser = Filament::auth()->user();
|
||||
|
||||
|
||||
if ($currentUser && ! $recipients->contains('id', $currentUser->id)) {
|
||||
$recipients->push($currentUser);
|
||||
}
|
||||
|
||||
// $user1 = Filament::auth()->user();
|
||||
|
||||
$rfqNumber = $this->record->requestQuotation->rfq_number;
|
||||
$body = "{$currentUser->name} has updated the bid for RFQ No '{$rfqNumber}'. The current rank is #{$rank}.";
|
||||
|
||||
Notification::make()
|
||||
->title('Rank Updated')
|
||||
->body("{$currentUser->name} has updated the bid for RFQ No '{$rfqNumber}'. The current rank is #{$rank}.")
|
||||
->success()
|
||||
->sendToDatabase($recipients);
|
||||
|
||||
// Push notification
|
||||
foreach ($recipients as $user) {
|
||||
$user->notify(
|
||||
new PushAlertNotification(
|
||||
'New Bid Added',
|
||||
$body
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
\Log::info('Create bid notification sent', [
|
||||
'bid_id' => $record->id,
|
||||
'rank' => $rank,
|
||||
'recipients' => $recipients->pluck('id'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use App\Models\RequestQuotation;
|
||||
use App\Models\RfqTransporterBid;
|
||||
use App\Models\SpotRateTransportMaster;
|
||||
use App\Models\User;
|
||||
use App\Notifications\PushAlertNotification;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class EditRfqTransporterBid extends EditRecord
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
|
||||
protected function afterSave(): void
|
||||
{
|
||||
if (! $this->record->wasChanged('total_freight_charge')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rank = RfqTransporterBid::where('request_quotation_id', $this->record->request_quotation_id)
|
||||
->orderBy('total_freight_charge')
|
||||
->pluck('id')
|
||||
->search($this->record->id) + 1;
|
||||
|
||||
$requestQuotation = RequestQuotation::findOrFail(
|
||||
$this->record->request_quotation_id
|
||||
);
|
||||
|
||||
$spotRateId = $requestQuotation->spot_rate_transport_master_id;
|
||||
|
||||
$spotRate = SpotRateTransportMaster::findOrFail($spotRateId);
|
||||
|
||||
$userNames = $spotRate->user_name;
|
||||
|
||||
Log::info('User names from spot rate', [
|
||||
'user_name_raw' => $spotRate->user_name,
|
||||
]);
|
||||
|
||||
if (!is_array($userNames)) {
|
||||
Log::warning('user_name is not array, resetting', [
|
||||
'user_name' => $userNames,
|
||||
]);
|
||||
$userNames = [];
|
||||
}
|
||||
|
||||
|
||||
$users = User::whereIn('name', $userNames)->get();
|
||||
|
||||
Log::info('Matched users', [
|
||||
'count' => $users->count(),
|
||||
'user_ids' => $users->pluck('id'),
|
||||
]);
|
||||
|
||||
// $recipients = User::role(['Super Admin', 'Rfq Supervisor', 'TransporterBid Employee'])->get();
|
||||
|
||||
// $recipients1 = User::role(['Super Admin', 'Rfq Supervisor', 'TransporterBid Employee'])->whereHas('pushSubscriptions')->get();
|
||||
|
||||
$currentUser = Filament::auth()->user();
|
||||
|
||||
// if ($currentUser && ! $recipients1->contains('id', $currentUser->id)) {
|
||||
// $recipients1->push($currentUser);
|
||||
// }
|
||||
|
||||
// if ($currentUser && ! $recipients->contains('id', $currentUser->id)) {
|
||||
// $recipients->push($currentUser);
|
||||
// }
|
||||
|
||||
// $user1 = Filament::auth()->user();
|
||||
|
||||
|
||||
$rfqNumber = $this->record->requestQuotation->rfq_number;
|
||||
$body = "{$currentUser->name} has updated the bid for RFQ No '{$rfqNumber}'. The current rank is #{$rank}.";
|
||||
|
||||
// Notification::make()
|
||||
// ->title('Rank Updated')
|
||||
// ->body("{$currentUser->name} current rank is #{$rank}")
|
||||
// ->success()
|
||||
// ->sendToDatabase($recipients);
|
||||
|
||||
// \Log::info('Notification sent', [
|
||||
// 'rank' => $rank,
|
||||
// 'recipients' => $recipients->pluck('id'),
|
||||
// ]);
|
||||
|
||||
Notification::make()
|
||||
->title('Rank Updated')
|
||||
->body("{$currentUser->name} has updated the bid for RFQ No '{$rfqNumber}'. The current rank is #{$rank}.")
|
||||
->success()
|
||||
->sendToDatabase($users);
|
||||
|
||||
// foreach ($recipients1 as $user) {
|
||||
// $user->notify(
|
||||
// new PushAlertNotification(
|
||||
// 'Rank Updated',
|
||||
// $body
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
// foreach ($users as $user) {
|
||||
|
||||
// Log::info('Checking push subscription for user', [
|
||||
// 'user_id' => $user->id,
|
||||
// 'name' => $user->name,
|
||||
// 'subscription_count' => $user->pushSubscriptions()->count(),
|
||||
// ]);
|
||||
// if ($user->pushSubscriptions()->exists()) {
|
||||
|
||||
// Log::info('Sending push notification', [
|
||||
// 'user_id' => $user->id,
|
||||
// ]);
|
||||
// $user->notify(
|
||||
// new PushAlertNotification(
|
||||
// 'Rank Updated',
|
||||
// $body
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
// else {
|
||||
// Log::warning('User has NO push subscription', [
|
||||
// 'user_id' => $user->id,
|
||||
// ]);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
foreach ($users as $user) {
|
||||
|
||||
$count = $user->pushSubscriptions()->count();
|
||||
|
||||
Log::info('Checking push subscription for user', [
|
||||
'user_id' => $user->id,
|
||||
'name' => $user->name,
|
||||
'subscription_count' => $count,
|
||||
]);
|
||||
|
||||
if ($count == 0) {
|
||||
Log::warning('User has NO push subscription', [
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
|
||||
Log::info('Sending push notification', [
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
// ✅ THIS IS ALL YOU NEED
|
||||
$user->notify(new PushAlertNotification(
|
||||
'Rank Updated',
|
||||
$body
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListRfqTransporterBids extends ListRecords
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\RfqTransporterBidResource\Pages;
|
||||
|
||||
use App\Filament\Resources\RfqTransporterBidResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewRfqTransporterBid extends ViewRecord
|
||||
{
|
||||
protected static string $resource = RfqTransporterBidResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
130
app/Filament/Resources/SpotRateTransportMasterResource.php
Normal file
130
app/Filament/Resources/SpotRateTransportMasterResource.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\SpotRateTransportMasterResource\Pages;
|
||||
use App\Filament\Resources\SpotRateTransportMasterResource\RelationManagers;
|
||||
use App\Models\SpotRateTransportMaster;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SpotRateTransportMasterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SpotRateTransportMaster::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Request For Quotation';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('group_name')
|
||||
->label('Group Name')
|
||||
->required(),
|
||||
Forms\Components\Select::make('user_name')
|
||||
->label('User')
|
||||
->multiple()
|
||||
->preload()
|
||||
->reactive()
|
||||
->options(
|
||||
User::pluck('name', 'name')->toArray()
|
||||
)
|
||||
->searchable()
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('id')
|
||||
->label('id'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('group_name')
|
||||
->label('Group Name')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('user_name')
|
||||
->label('User Name')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSpotRateTransportMasters::route('/'),
|
||||
'create' => Pages\CreateSpotRateTransportMaster::route('/create'),
|
||||
'view' => Pages\ViewSpotRateTransportMaster::route('/{record}'),
|
||||
'edit' => Pages\EditSpotRateTransportMaster::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SpotRateTransportMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SpotRateTransportMasterResource;
|
||||
use App\Models\SpotRateTransportMaster;
|
||||
use Filament\Actions;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSpotRateTransportMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SpotRateTransportMasterResource::class;
|
||||
|
||||
protected function beforeCreate(): void
|
||||
{
|
||||
$groupName = $this->data['group_name'] ?? null;
|
||||
$userNames = $this->data['user_name'] ?? [];
|
||||
|
||||
foreach ($userNames as $userName) {
|
||||
|
||||
$query = SpotRateTransportMaster::where('group_name', $groupName)
|
||||
->whereJsonContains('user_name', $userName);
|
||||
|
||||
if ($query->exists()) {
|
||||
|
||||
Notification::make()
|
||||
->title('Duplicate User')
|
||||
->body("User {$userName} already exists in this group.")
|
||||
->danger()
|
||||
->persistent()
|
||||
->send();
|
||||
|
||||
// Prevent create
|
||||
$this->halt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SpotRateTransportMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SpotRateTransportMasterResource;
|
||||
use App\Models\SpotRateTransportMaster;
|
||||
use Filament\Actions;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSpotRateTransportMaster extends EditRecord
|
||||
{
|
||||
protected static string $resource = SpotRateTransportMasterResource::class;
|
||||
|
||||
protected function beforeSave(): void
|
||||
{
|
||||
$groupName = $this->data['group_name'] ?? null;
|
||||
$userNames = $this->data['user_name'] ?? [];
|
||||
$recordId = $this->record->id ?? null;
|
||||
|
||||
foreach ($userNames as $userName) {
|
||||
|
||||
$query = SpotRateTransportMaster::where('group_name', $groupName)
|
||||
->whereJsonContains('user_name', $userName);
|
||||
|
||||
// Exclude current record for update
|
||||
if ($recordId) {
|
||||
$query->where('id', '!=', $recordId);
|
||||
}
|
||||
|
||||
if ($query->exists()) {
|
||||
|
||||
Notification::make()
|
||||
->title('Duplicate User')
|
||||
->body("User {$userName} already exists in this group.")
|
||||
->danger()
|
||||
->persistent()
|
||||
->send();
|
||||
|
||||
// Prevent save/update
|
||||
$this->halt();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SpotRateTransportMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SpotRateTransportMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSpotRateTransportMasters extends ListRecords
|
||||
{
|
||||
protected static string $resource = SpotRateTransportMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SpotRateTransportMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SpotRateTransportMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewSpotRateTransportMaster extends ViewRecord
|
||||
{
|
||||
protected static string $resource = SpotRateTransportMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
428
app/Filament/Resources/StickerDetailResource.php
Normal file
428
app/Filament/Resources/StickerDetailResource.php
Normal file
@@ -0,0 +1,428 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StickerDetailExporter;
|
||||
use App\Filament\Imports\StickerDetailImporter;
|
||||
use App\Filament\Resources\StickerDetailResource\Pages;
|
||||
use App\Filament\Resources\StickerDetailResource\RelationManagers;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Closure;
|
||||
|
||||
class StickerDetailResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerDetail::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('sticker_structure_detail_id')
|
||||
->label('Sticker ID')
|
||||
->reactive()
|
||||
->relationship('stickerStructureDetail', 'sticker_id')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function (callable $get, callable $set) {
|
||||
// if ($get('element_id')) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
$structureId = $get('sticker_structure_detail_id');
|
||||
$set('design_element_type', null);
|
||||
$set('element_id', null);
|
||||
|
||||
if (!$structureId) {
|
||||
$set('element_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$maxId = StickerDetail::where('sticker_structure_detail_id', $structureId)
|
||||
->max('element_id');
|
||||
|
||||
$nextId = $maxId ? ((int) $maxId + 1) : 1;
|
||||
|
||||
$formattedId = str_pad($nextId, 3, '0', STR_PAD_LEFT);
|
||||
|
||||
$set('element_id', $formattedId);
|
||||
}),
|
||||
Forms\Components\Select::make('design_element_type')
|
||||
->label('Design Element Type')
|
||||
->reactive()
|
||||
->options([
|
||||
'Text' => 'Text',
|
||||
'Shape' => 'Shape',
|
||||
'Image' => 'Image',
|
||||
'QR' => 'QR',
|
||||
]),
|
||||
Forms\Components\TextInput::make('element_id')
|
||||
->label('Element ID')
|
||||
->readOnly()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('element_type')
|
||||
->label('Element Type')
|
||||
->options([
|
||||
'Static' => 'Static',
|
||||
'Dynamic' => 'Dynamic',
|
||||
]),
|
||||
Forms\Components\Select::make('characteristics_type')
|
||||
->label('Characteristics')
|
||||
->reactive()
|
||||
->options(
|
||||
collect(Schema::getColumnListing('item_characteristics'))
|
||||
->reject(fn ($column) => in_array($column, [
|
||||
'id',
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'class',
|
||||
'zz1_cn_bill_ord',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
]))
|
||||
->mapWithKeys(fn ($column) => [
|
||||
$column => ucfirst(str_replace('_', ' ', $column))
|
||||
])
|
||||
->toArray()
|
||||
),
|
||||
Forms\Components\TextInput::make('string_value')
|
||||
->label('String Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\TextInput::make('string_font')
|
||||
->label('String Font')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\TextInput::make('string_size')
|
||||
->label('String Size')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\Select::make('element_colour')
|
||||
->label('Element Colour')
|
||||
->options([
|
||||
'' => 'Default (Black)',
|
||||
'#000000' => 'Black',
|
||||
'#FFFFFF' => 'White',
|
||||
'#FF0000' => 'Red',
|
||||
'#00FF00' => 'Lime',
|
||||
'#0000FF' => 'Blue',
|
||||
'#FFFF00' => 'Yellow',
|
||||
'#00FFFF' => 'Cyan',
|
||||
'#FF00FF' => 'Magenta',
|
||||
'#800000' => 'Maroon',
|
||||
'#808000' => 'Olive',
|
||||
'#008000' => 'Green',
|
||||
'#800080' => 'Purple',
|
||||
'#008080' => 'Teal',
|
||||
'#808080' => 'Gray',
|
||||
'#C0C0C0' => 'Silver',
|
||||
'#FFA500' => 'Orange',
|
||||
'#FFC0CB' => 'Pink',
|
||||
'#A52A2A' => 'Brown',
|
||||
'#87CEEB' => 'Sky Blue',
|
||||
])
|
||||
->nullable()
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('string_align')
|
||||
->label('String Align')
|
||||
->options([
|
||||
'Left' => 'Left',
|
||||
'Right' => 'Right',
|
||||
'Center' => 'Center',
|
||||
])
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\TextInput::make('string_x_value')
|
||||
->label('String X Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\TextInput::make('string_y_value')
|
||||
->label('String Y Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Text'),
|
||||
Forms\Components\Select::make('shape_name')
|
||||
->label('Shape Name')
|
||||
->reactive()
|
||||
->options([
|
||||
'Line' => 'Line',
|
||||
'Rectangle' => 'Rectangle',
|
||||
'CurvedRectangle' => 'CurvedRectangle',
|
||||
])
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_pen_size')
|
||||
->label('Shape Pen Size')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('curve_radius')
|
||||
->label('Curve Radius')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('shape_name') == 'CurvedRectangle'),
|
||||
Forms\Components\TextInput::make('shape_x1_value')
|
||||
->label('Shape X1 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_y1_value')
|
||||
->label('Shape Y1 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_x2_value')
|
||||
->label('Shape X2 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
Forms\Components\TextInput::make('shape_y2_value')
|
||||
->label('Shape Y2 Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Shape'),
|
||||
// Forms\Components\FileUpload::make('image_path')
|
||||
// ->label('Image')
|
||||
// ->image()
|
||||
// ->directory('sticker-images')
|
||||
// ->visibility('public')
|
||||
// ->preserveFilenames(false)
|
||||
// ->required(false)
|
||||
// ->reactive()
|
||||
// ->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
// Forms\Components\TextInput::make('image_type')
|
||||
// ->label('Image Type')
|
||||
// ->reactive()
|
||||
// ->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_x')
|
||||
->label('Image X')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_y')
|
||||
->label('Image Y')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_width')
|
||||
->label('Image Width')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('image_height')
|
||||
->label('Image Height')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'Image'),
|
||||
Forms\Components\TextInput::make('qr_value')
|
||||
->label('QR Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_align')
|
||||
->label('QR Align')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_size')
|
||||
->label('QR Size')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_x_value')
|
||||
->label('QR X Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\TextInput::make('qr_y_value')
|
||||
->label('QR Y Value')
|
||||
->reactive()
|
||||
->visible(fn ($get) => $get('design_element_type') == 'QR'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('created_by')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('updated_by')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('stickerStructureDetail.sticker_id')
|
||||
->label('Sticker ID')
|
||||
->sortable()
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('design_element_type')
|
||||
->label('Design Element Type')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('element_id')
|
||||
->label('Element ID')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('element_type')
|
||||
->label('Element Type')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('characteristics_type')
|
||||
->label('Characteristics Type')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_value')
|
||||
->label('String Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_font')
|
||||
->label('String Font')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_size')
|
||||
->label('String Size')
|
||||
->alignCenter(),
|
||||
// Tables\Columns\TextColumn::make('element_colour')
|
||||
// ->label('Element Colour')
|
||||
// ->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_align')
|
||||
->label('String Align')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_x_value')
|
||||
->label('String X Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('string_y_value')
|
||||
->label('String Y Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_name')
|
||||
->label('Shape Name')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_pen_size')
|
||||
->label('Shape Pen Size')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('curve_radius')
|
||||
->label('Curve Radius'),
|
||||
Tables\Columns\TextColumn::make('shape_x1_value')
|
||||
->label('Shape X1 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_y1_value')
|
||||
->label('Shape Y1 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_x2_value')
|
||||
->label('Shape X2 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('shape_y2_value')
|
||||
->label('Shape Y2 Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_x')
|
||||
->label('Image X')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_y')
|
||||
->label('Image Y')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_width')
|
||||
->label('Image Width')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_height')
|
||||
->label('Image Height')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_value')
|
||||
->label('QR Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_align')
|
||||
->label('QR Align')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_size')
|
||||
->label('QR Size')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_x_value')
|
||||
->label('QR X Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('qr_y_value')
|
||||
->label('QR Y Value')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Sticker Details')
|
||||
->color('warning')
|
||||
->importer(StickerDetailImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import sticker details');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Sticker Details')
|
||||
->color('warning')
|
||||
->exporter(StickerDetailExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export sticker details');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerDetails::route('/'),
|
||||
'create' => Pages\CreateStickerDetail::route('/create'),
|
||||
'view' => Pages\ViewStickerDetail::route('/{record}'),
|
||||
'edit' => Pages\EditStickerDetail::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerDetail extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerDetail extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerDetails extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerDetail extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,24 @@ use App\Filament\Exports\StickerMappingMasterExporter;
|
||||
use App\Filament\Imports\StickerMappingMasterImporter;
|
||||
use App\Filament\Resources\StickerMappingMasterResource\Pages;
|
||||
use App\Filament\Resources\StickerMappingMasterResource\RelationManagers;
|
||||
use App\Models\Plant;
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Machine;
|
||||
use App\Models\StickerMappingMaster;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
|
||||
class StickerMappingMasterResource extends Resource
|
||||
{
|
||||
@@ -25,139 +31,424 @@ class StickerMappingMasterResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
// public static function form(Form $form): Form
|
||||
// {
|
||||
// return $form
|
||||
// ->schema([
|
||||
// Forms\Components\TextInput::make('plant_id')
|
||||
// ->required()
|
||||
// ->numeric(),
|
||||
// Forms\Components\TextInput::make('item_id')
|
||||
// ->required()
|
||||
// ->numeric(),
|
||||
// Forms\Components\Textarea::make('sticker1')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker2')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker3')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker4')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('sticker5')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('created_by')
|
||||
// ->columnSpanFull(),
|
||||
// Forms\Components\Textarea::make('updated_by')
|
||||
// ->columnSpanFull(),
|
||||
// ]);
|
||||
// }
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item')
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
/* -------- Basic Mapping -------- */
|
||||
Section::make('Basic Mapping')
|
||||
->schema([
|
||||
Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
|
||||
Select::make('item_characteristic_id')
|
||||
->label('Item Code')
|
||||
->reactive()
|
||||
//->relationship('item', 'code')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
return \App\Models\Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker1')
|
||||
->label('Sticker Label 1')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker2')
|
||||
->label('Sticker Label 2'),
|
||||
Forms\Components\TextInput::make('sticker3')
|
||||
->label('Sticker Label 3'),
|
||||
Forms\Components\TextInput::make('sticker4')
|
||||
->label('Sticker Label 4'),
|
||||
Forms\Components\TextInput::make('sticker5')
|
||||
->label('Sticker Label 5'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
return ItemCharacteristic::query()
|
||||
->whereHas('item', function ($query) use ($plantId) {
|
||||
$query->where('plant_id', $plantId);
|
||||
})
|
||||
->with('item')
|
||||
->get()
|
||||
->mapWithKeys(fn ($ic) => [
|
||||
$ic->id => $ic->item->code,
|
||||
]);
|
||||
})
|
||||
->searchable()
|
||||
->required(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 1 -------- */
|
||||
Section::make('Sticker 1')
|
||||
->schema([
|
||||
Select::make('sticker_structure1_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker1_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker1Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker1_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 2 -------- */
|
||||
Section::make('Sticker 2')
|
||||
->schema([
|
||||
Select::make('sticker_structure2_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker2_machine_id')
|
||||
->label('Work Center')
|
||||
// ->relationship('sticker2Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker2_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 3 -------- */
|
||||
Section::make('Sticker 3')
|
||||
->schema([
|
||||
Select::make('sticker_structure3_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker3_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker3Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker3_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 4 -------- */
|
||||
Section::make('Sticker 4')
|
||||
->schema([
|
||||
Select::make('sticker_structure4_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker4_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker4Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker4_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 5 -------- */
|
||||
Section::make('Sticker 5')
|
||||
->schema([
|
||||
Select::make('sticker_structure5_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker5_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker5Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker5_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 6 -------- */
|
||||
Section::make('Sticker 6')
|
||||
->schema([
|
||||
Select::make('sticker_structure6_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker6_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker6Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker6_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 7 -------- */
|
||||
Section::make('Sticker 7')
|
||||
->schema([
|
||||
Select::make('sticker_structure7_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker7_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker7Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker7_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
|
||||
/* -------- Sticker 8 -------- */
|
||||
Section::make('Sticker 8')
|
||||
->schema([
|
||||
Select::make('sticker_structure8_id')
|
||||
->label('Sticker ID')
|
||||
->options(function (callable $get) {
|
||||
return StickerStructureDetail::pluck('sticker_id', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Select::make('sticker8_machine_id')
|
||||
->label('Work Center')
|
||||
//->relationship('sticker8Machine', 'name')
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
TextInput::make('sticker8_print_ip')
|
||||
->label('Printer IP')
|
||||
->ipv4(),
|
||||
])
|
||||
->columns(2),
|
||||
]);
|
||||
}
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker1')
|
||||
->label('Sticker Label 1')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker2')
|
||||
->label('Sticker Label 2')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker3')
|
||||
->label('Sticker Label 3')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker4')
|
||||
->label('Sticker Label 4')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker5')
|
||||
->label('Sticker Label 5')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Sticker Mapping Masters')
|
||||
->color('warning')
|
||||
->importer(StickerMappingMasterImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import sticker mapping master');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Sticker Mapping Masters')
|
||||
->color('warning')
|
||||
->exporter(StickerMappingMasterExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export sticker mapping master');
|
||||
}),
|
||||
]);
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('itemCharacteristic.item.code')
|
||||
->label('Item')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker1Structure.sticker_id')
|
||||
->label('Sticker 1')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker1Machine.work_center')
|
||||
->label('WC 1')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker1_print_ip')
|
||||
->label('Printer IP 1')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker2Structure.sticker_id')
|
||||
->label('Sticker 2')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker2Machine.work_center')
|
||||
->label('WC 2')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker2_print_ip')
|
||||
->label('Printer IP 2')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker3Structure.sticker_id')
|
||||
->label('Sticker 3')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker3Machine.work_center')
|
||||
->label('WC 3')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker3_print_ip')
|
||||
->label('Printer IP 3')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker4Structure.sticker_id')
|
||||
->label('Sticker 4')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker4Machine.work_center')
|
||||
->label('WC 4')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker4_print_ip')
|
||||
->label('Printer IP 4')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker5Structure.sticker_id')
|
||||
->label('Sticker 5')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker5Machine.work_center')
|
||||
->label('WC 5')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker5_print_ip')
|
||||
->label('Printer IP 5')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker6Structure.sticker_id')
|
||||
->label('Sticker 6')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker6Machine.work_center')
|
||||
->label('WC 6')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker6_print_ip')
|
||||
->label('Printer IP 6')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker7Structure.sticker_id')
|
||||
->label('Sticker 7')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker7Machine.work_center')
|
||||
->label('WC 7')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker7_print_ip')
|
||||
->label('Printer IP 7')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker8Structure.sticker_id')
|
||||
->label('Sticker 8')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker8Machine.work_center')
|
||||
->label('WC 8')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('sticker8_print_ip')
|
||||
->label('Printer IP 8')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(StickerMappingMasterImporter::class)
|
||||
->label('Import Sticker Mapping Master')
|
||||
->color('warning')
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import sticker mapping master');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(StickerMappingMasterExporter::class)
|
||||
->label('Export Sticker Mapping Master')
|
||||
->color('warning')
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export sticker mapping master');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
|
||||
@@ -26,6 +26,8 @@ class StickerPrintingResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Sticker Reprint';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
217
app/Filament/Resources/StickerStructureDetailResource.php
Normal file
217
app/Filament/Resources/StickerStructureDetailResource.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StickerStructureDetailExporter;
|
||||
use App\Filament\Imports\StickerStructureDetailImporter;
|
||||
use App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
use App\Filament\Resources\StickerStructureDetailResource\RelationManagers;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Components\Actions\Action;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Filament\Forms\Components\Html;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
|
||||
class StickerStructureDetailResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->relationship('plant', 'name')
|
||||
->reactive(),
|
||||
Forms\Components\Select::make('item_characteristic_id')
|
||||
->label('Item')
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
|
||||
if (! $plantId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return ItemCharacteristic::query()
|
||||
->whereHas('item', function ($query) use ($plantId) {
|
||||
$query->where('plant_id', $plantId);
|
||||
})
|
||||
->with('item')
|
||||
->get()
|
||||
->mapWithKeys(fn ($ic) => [
|
||||
$ic->id => $ic->item->code,
|
||||
]);
|
||||
})
|
||||
->searchable(),
|
||||
Forms\Components\TextInput::make('sticker_id')
|
||||
->label('Sticker ID')
|
||||
->reactive()
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
//\Log::info('Sticker ID typed:', ['sticker_id' => $state]);
|
||||
$set('sticker_id_live', $state);
|
||||
}),
|
||||
Forms\Components\TextInput::make('sticker_width')
|
||||
->label('Sticker Width')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_height')
|
||||
->label('Sticker Height')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_lmargin')
|
||||
->label('Sticker Left Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_rmargin')
|
||||
->label('Sticker Right Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_tmargin')
|
||||
->label('Sticker Top Margin')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('sticker_bmargin')
|
||||
->label('Sticker Bottom Margin')
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('sticker_id_live')
|
||||
->default(fn ($get) => $get('sticker_id'))
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('sticker_id_live', $state);
|
||||
}),
|
||||
Forms\Components\ViewField::make('generate_template')
|
||||
->view('fields.generate-template')
|
||||
->reactive()
|
||||
//->key(fn ($get) => 'generate-template' . ($get('sticker_id_live') ?? 'empty'))
|
||||
->key(fn (Get $get) =>
|
||||
'generate-template-' .
|
||||
($get('sticker_id_live') ?? 'empty') . '-' .
|
||||
($get('plant_id') ?? 'empty') . '-' .
|
||||
($get('item_characteristic_id') ?? 'empty')
|
||||
)
|
||||
// ->viewData(fn (Get $get) => [
|
||||
// 'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
// ]),
|
||||
->viewData(fn (Get $get) => [
|
||||
'sticker_id' => $get('sticker_id_live') ?? 'empty',
|
||||
'plant_id' => $get('plant_id') ?? 'empty',
|
||||
'item_characteristic_id' => $get('item_characteristic_id') ?? 'empty',
|
||||
])
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('sticker_id')
|
||||
->label('Sticker ID'),
|
||||
Tables\Columns\TextColumn::make('sticker_width')
|
||||
->label('Sticker Width'),
|
||||
Tables\Columns\TextColumn::make('sticker_height')
|
||||
->label('Sticker Height'),
|
||||
Tables\Columns\TextColumn::make('sticker_lmargin')
|
||||
->label('Sticker Left Margin'),
|
||||
Tables\Columns\TextColumn::make('sticker_rmargin')
|
||||
->label('Sticker Right Margin'),
|
||||
Tables\Columns\TextColumn::make('sticker_tmargin')
|
||||
->label('Sticker Top Margin'),
|
||||
Tables\Columns\TextColumn::make('sticker_bmargin')
|
||||
->label('Sticker Bottom Margin'),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Sticker Structure Details')
|
||||
->color('warning')
|
||||
->importer(StickerStructureDetailImporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view import sticker structure details');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Sticker Structure Details')
|
||||
->color('warning')
|
||||
->exporter(StickerStructureDetailExporter::class)
|
||||
->visible(function() {
|
||||
return Filament::auth()->user()->can('view export sticker structure details');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerStructureDetails::route('/'),
|
||||
'create' => Pages\CreateStickerStructureDetail::route('/create'),
|
||||
'view' => Pages\ViewStickerStructureDetail::route('/{record}'),
|
||||
'edit' => Pages\EditStickerStructureDetail::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerStructureDetail extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerStructureDetail extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerStructureDetails extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerStructureDetailResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerStructureDetailResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerStructureDetail extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerStructureDetailResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
165
app/Filament/Resources/StickerValidationResource.php
Normal file
165
app/Filament/Resources/StickerValidationResource.php
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource\Pages;
|
||||
use App\Filament\Resources\StickerValidationResource\RelationManagers;
|
||||
use App\Models\Machine;
|
||||
use App\Models\StickerValidation;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class StickerValidationResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StickerValidation::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Customized Sticker Printing';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Work Center')
|
||||
->required()
|
||||
->reactive()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
if (empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||
})
|
||||
->searchable(),
|
||||
Forms\Components\TextInput::make('production_order')
|
||||
->label('Production Order')
|
||||
->reactive()
|
||||
->extraAttributes([
|
||||
'id' => 'production_order_input',
|
||||
'x-data' => '{ value: "" }',
|
||||
'x-model' => 'value',
|
||||
'wire:keydown.enter.prevent' => 'processProOrder(value)',
|
||||
]),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->reactive()
|
||||
->extraAttributes([
|
||||
'id' => 'serial_number_input',
|
||||
'x-data' => '{ value: "" }',
|
||||
'x-model' => 'value',
|
||||
'wire:keydown.enter.prevent' => 'processSno(value)',
|
||||
]),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
])
|
||||
->columns(4),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.code')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('machine.work_center')
|
||||
->label('Work Center')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('production_order')
|
||||
->label('Production Order')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStickerValidations::route('/'),
|
||||
'create' => Pages\CreateStickerValidation::route('/create'),
|
||||
'view' => Pages\ViewStickerValidation::route('/{record}'),
|
||||
'edit' => Pages\EditStickerValidation::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\ProductionQuantity;
|
||||
use App\Models\StickerMappingMaster;
|
||||
use App\Models\StickerValidation;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStickerValidation extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.sticker-validation-resource.create-sticker-validation';
|
||||
|
||||
public $ref_number;
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $workCenter;
|
||||
|
||||
public $serNo;
|
||||
|
||||
public function getFormActions(): array
|
||||
{
|
||||
return [
|
||||
$this->getCancelFormAction(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
|
||||
|
||||
public function processProOrder($value)
|
||||
{
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$this->plantId = $plantId;
|
||||
|
||||
$this->ref_number = $value;
|
||||
|
||||
$this->dispatch('refreshEmptySticker', $plantId, $value);
|
||||
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
|
||||
public function processSno($serNo)
|
||||
{
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
|
||||
$this->plantId = $plantId;
|
||||
|
||||
$workCenter = $this->form->getState()['machine_id'];
|
||||
|
||||
$this->workCenter = $workCenter;
|
||||
|
||||
$this->ref_number = $this->form->getState()['production_order'];
|
||||
|
||||
$this->serNo = $serNo;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})\|?$/', $this->serNo, $matches)) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Serial QR Format')
|
||||
->body('Scan valid Serial QR code proceed!<br>Sample formats are:<br>123456|1234567890123| OR 123456|1234567890123')
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
$this->dispatch('focus-serial-number');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})\|?$/', $this->serNo, $matches)) {
|
||||
$itemCode = $matches[1];
|
||||
$serialNumber = $matches[2];
|
||||
|
||||
$recFound = ProductionQuantity::where('plant_id', $this->plantId)
|
||||
->where('production_order', $this->ref_number)
|
||||
->where('serial_number', $serialNumber)
|
||||
->first();
|
||||
|
||||
if(!$recFound){
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Unknown Serial Number')
|
||||
->body("Scanned serial number '$serialNumber' not found for the given plant and production order")
|
||||
->seconds(3)
|
||||
->send();
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$duplicate = StickerValidation::where('plant_id', $this->plantId)
|
||||
->where('production_order', $this->ref_number)
|
||||
->where('serial_number', $serialNumber)
|
||||
->first();
|
||||
|
||||
if ($duplicate) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Duplicate Serial Number')
|
||||
->body("Serial number $serialNumber already exists for this plant and production order!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$itemC = Item::where('code', $itemCode)
|
||||
->where('plant_id',$this->plantId)
|
||||
->first();
|
||||
|
||||
$itemId = $itemC->id;
|
||||
|
||||
$item = ItemCharacteristic::where('item_id', $itemId)
|
||||
->where('plant_id',$this->plantId)
|
||||
->first();
|
||||
|
||||
$itemI = $item->id;
|
||||
|
||||
$mapping = StickerMappingMaster::where('plant_id', $this->plantId)
|
||||
->where('item_characteristic_id', $itemI)
|
||||
->first();
|
||||
|
||||
if (!$mapping) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Sticker Mapping Not Found')
|
||||
->body("No sticker mapping found for this item and plant.")
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$stickers = [];
|
||||
|
||||
for ($i = 1; $i <= 8; $i++) {
|
||||
$machineColumn = "sticker{$i}_machine_id";
|
||||
$ipColumn = "sticker{$i}_print_ip";
|
||||
$stickerColumn = "sticker_structure{$i}_id";
|
||||
$itemColumn = "item_characteristic_id";
|
||||
|
||||
if (
|
||||
!empty($mapping->$machineColumn) &&
|
||||
!empty($mapping->$stickerColumn)
|
||||
) {
|
||||
$stickers[] = [
|
||||
'machine_id' => $mapping->$machineColumn,
|
||||
'sticker_id' => $mapping->$stickerColumn,
|
||||
'item_characteristic' => $mapping->$itemColumn,
|
||||
'print_ip' => $mapping->$ipColumn,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($stickers)) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('No Sticker Configuration Found')
|
||||
->body('No sticker and machine mappings configured for this item and plant.')
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$urls = [];
|
||||
|
||||
foreach ($stickers as $sticker) {
|
||||
$urls[] = route('stickers1.pdf', [
|
||||
'stickerId' => $sticker['sticker_id'],
|
||||
'plant_id' => $this->plantId,
|
||||
'item_characteristic_id' => $sticker['item_characteristic'],
|
||||
'serial_number' => $serialNumber,
|
||||
]);
|
||||
}
|
||||
|
||||
$this->dispatch('open-stickers-sequence', urls: $urls);
|
||||
|
||||
// $pdfPath = storage_path('app/private/uploads/StickerTemplateOcr/multi.pdf');
|
||||
|
||||
// if (! file_exists($pdfPath)) {
|
||||
// Notification::make()
|
||||
// ->danger()
|
||||
// ->title('Pdf Not Found')
|
||||
// ->body("pdf file not exist.")
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (! $printerName) {
|
||||
// Notification::make()
|
||||
// ->danger()
|
||||
// ->title('Printer Not Found')
|
||||
// ->body("No CUPS printer configured for IP: $iotsPrintIp")
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// putenv('CUPS_SERVER=printer.iotsignin.com');
|
||||
|
||||
// $cmd = "lp -d " . escapeshellarg($printerName)
|
||||
// . " -o fit-to-page "
|
||||
// . escapeshellarg($pdfPath);
|
||||
|
||||
// exec($cmd, $out, $status);
|
||||
|
||||
// if ($status != 0) {
|
||||
// Notification::make()
|
||||
// ->danger()
|
||||
// ->title('Print Failed')
|
||||
// ->body('CUPS print command failed.')
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
|
||||
//dd($iotsPrintIp, $matchedSticker);
|
||||
|
||||
StickerValidation::create([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number ?? null,
|
||||
'serial_number' => $serialNumber,
|
||||
'status' => 'Printed',
|
||||
// 'sticker_id' => $matchedSticker,
|
||||
'created_by' => $operatorName,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Sticker Recorded')
|
||||
->body("Item: $itemCode, Serial: $serialNumber recorded successfully!")
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $this->plantId,
|
||||
'machine_id' => $this->workCenter,
|
||||
'production_order' => $this->ref_number,
|
||||
'serial_number' => null,
|
||||
]);
|
||||
|
||||
$this->dispatch('refreshEmptySticker', $plantId, $this->ref_number);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getPrinterNameByIp(string $ip): ?string
|
||||
{
|
||||
exec('lpstat -v', $output);
|
||||
|
||||
foreach ($output as $line) {
|
||||
// Example:
|
||||
// device for TSC_WC_01: socket://192.168.1.50:9100
|
||||
if (str_contains($line, $ip)) {
|
||||
preg_match('/device for (.+?):/', $line, $matches);
|
||||
return $matches[1] ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStickerValidation extends EditRecord
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStickerValidations extends ListRecords
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StickerValidationResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StickerValidationResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStickerValidation extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StickerValidationResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
146
app/Filament/Widgets/RfqChart.php
Normal file
146
app/Filament/Widgets/RfqChart.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\RequestQuotation;
|
||||
use App\Models\RfqTransporterBid;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
|
||||
class RfqChart extends BaseWidget
|
||||
{
|
||||
// protected function getStats(): array
|
||||
// {
|
||||
// $transporter = session('transport_name');
|
||||
// $rfqNumber = session('rfq_number');
|
||||
|
||||
// if (!$transporter || !$rfqNumber) {
|
||||
// return [
|
||||
// Stat::make('Total Freight Charge', '-'),
|
||||
// Stat::make('Rank', '-'),
|
||||
// ];
|
||||
// }
|
||||
|
||||
// $selectedRfq = RequestQuotation::query()
|
||||
// ->where('transporter_name', $transporter)
|
||||
// ->where('rfq_number', $rfqNumber)
|
||||
// ->first();
|
||||
|
||||
// if (!$selectedRfq) {
|
||||
// return [
|
||||
// Stat::make('Total Freight Charge', '-'),
|
||||
// Stat::make('Rank', '-'),
|
||||
// ];
|
||||
// }
|
||||
|
||||
// $myAmount = (float) $selectedRfq->total_freight_charge;
|
||||
|
||||
// $rank = RequestQuotation::query()
|
||||
// ->whereRaw(
|
||||
// 'CAST(total_freight_charge AS DECIMAL(10,2)) < ?',
|
||||
// [$myAmount]
|
||||
// )
|
||||
// ->selectRaw('CAST(total_freight_charge AS DECIMAL(10,2))')
|
||||
// ->distinct()
|
||||
// ->count() + 1;
|
||||
|
||||
// $medal = match (true) {
|
||||
// $rank == 1 => '🥇',
|
||||
// $rank == 2 => '🥈',
|
||||
// $rank == 3 => '🥉',
|
||||
// default => '',
|
||||
// };
|
||||
|
||||
// return [
|
||||
// Stat::make(
|
||||
// 'Total Freight Charge',
|
||||
// number_format($selectedRfq->total_freight_charge, 2)
|
||||
// )
|
||||
// ->description('Transporter: ' . $selectedRfq->transporter_name)
|
||||
// ->color($rank == 1 ? 'success' : 'primary'),
|
||||
|
||||
// Stat::make(
|
||||
// 'Rank',
|
||||
// trim("{$medal} #{$rank}")
|
||||
// )
|
||||
// ->description('Among all transporters')
|
||||
// ->color(
|
||||
// $rank == 1 ? 'success' :
|
||||
// ($rank <= 3 ? 'warning' : 'gray')
|
||||
// ),
|
||||
// ];
|
||||
// }
|
||||
|
||||
protected function getStats(): array
|
||||
{
|
||||
$transporter = session('transport_name');
|
||||
$rfqNumber = session('rfq_id');
|
||||
|
||||
if (!$transporter || !$rfqNumber) {
|
||||
return [
|
||||
Stat::make('Total Freight Charge', '-'),
|
||||
Stat::make('Rank', '-'),
|
||||
];
|
||||
}
|
||||
|
||||
$selectedRfq = RfqTransporterBid::query()
|
||||
->where('transporter_name', $transporter)
|
||||
->where('request_quotation_id', $rfqNumber)
|
||||
->first();
|
||||
|
||||
if (!$selectedRfq) {
|
||||
return [
|
||||
Stat::make('Total Freight Charge', '-'),
|
||||
Stat::make('Rank', '-'),
|
||||
];
|
||||
}
|
||||
|
||||
$myAmount = (float) $selectedRfq->total_freight_charge;
|
||||
|
||||
// $rank = RfqTransporterBid::query()
|
||||
// ->whereRaw(
|
||||
// 'CAST(total_freight_charge AS DECIMAL(10,2)) < ?',
|
||||
// [$myAmount]
|
||||
// )
|
||||
// ->selectRaw('CAST(total_freight_charge AS DECIMAL(10,2))')
|
||||
// ->distinct()
|
||||
// ->count() + 1;
|
||||
$rank = RfqTransporterBid::query()
|
||||
->where('request_quotation_id', $rfqNumber) // 🔥 MISSING CONDITION
|
||||
->whereRaw(
|
||||
'CAST(total_freight_charge AS DECIMAL(10,2)) < ?',
|
||||
[$myAmount]
|
||||
)
|
||||
->selectRaw('CAST(total_freight_charge AS DECIMAL(10,2))')
|
||||
->distinct()
|
||||
->count() + 1;
|
||||
|
||||
|
||||
$medal = match (true) {
|
||||
$rank == 1 => '🥇',
|
||||
$rank == 2 => '🥈',
|
||||
$rank == 3 => '🥉',
|
||||
default => '',
|
||||
};
|
||||
|
||||
return [
|
||||
Stat::make(
|
||||
'Total Freight Charge',
|
||||
number_format($selectedRfq->total_freight_charge, 2)
|
||||
)
|
||||
->description('Transporter: ' . $selectedRfq->transporter_name)
|
||||
->color($rank == 1 ? 'success' : 'primary'),
|
||||
|
||||
Stat::make(
|
||||
'Rank',
|
||||
trim("{$medal} #{$rank}")
|
||||
)
|
||||
->description('Among all transporters')
|
||||
->color(
|
||||
$rank == 1 ? 'success' :
|
||||
($rank <= 3 ? 'warning' : 'gray')
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
205
app/Filament/Widgets/RfqRankChart.php
Normal file
205
app/Filament/Widgets/RfqRankChart.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\RfqTransporterBid;
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Illuminate\Support\Js;
|
||||
|
||||
class RfqRankChart extends ChartWidget
|
||||
{
|
||||
protected static ?string $heading = 'Chart';
|
||||
|
||||
// protected function getData(): array
|
||||
// {
|
||||
// $rfqId = session('rfq_id');
|
||||
|
||||
// if (!$rfqId) {
|
||||
// return [
|
||||
// 'datasets' => [],
|
||||
// 'labels' => [],
|
||||
// ];
|
||||
// }
|
||||
|
||||
// // Get bids ordered by lowest freight charge
|
||||
// $bids = RfqTransporterBid::query()
|
||||
// ->where('request_quotation_id', $rfqId)
|
||||
// ->orderByRaw('CAST(total_freight_charge AS DECIMAL(10,2)) ASC')
|
||||
// ->get();
|
||||
|
||||
// // $labels = [];
|
||||
// // $ranks = [];
|
||||
|
||||
// // $rank = 1;
|
||||
// // foreach ($bids as $bid) {
|
||||
// // $labels[] = $bid->transporter_name;
|
||||
// // $ranks[] = $rank++;
|
||||
// // }
|
||||
|
||||
// // return [
|
||||
// // 'datasets' => [
|
||||
// // [
|
||||
// // 'label' => 'Rank (Lower is Better)',
|
||||
// // 'data' => $ranks,
|
||||
// // 'fill' => false,
|
||||
// // 'tension' => 0.3,
|
||||
// // ],
|
||||
// // ],
|
||||
// // 'labels' => $labels,
|
||||
// // ];
|
||||
// $labels = [];
|
||||
// $ranks = [];
|
||||
// $colors = [];
|
||||
|
||||
// $rank = 1;
|
||||
// foreach ($bids as $bid) {
|
||||
// $labels[] = $bid->transporter_name;
|
||||
// $ranks[] = $rank;
|
||||
|
||||
// // Rank-based colors
|
||||
// $colors[] = match ($rank) {
|
||||
// 1 => '#FFD700', // Gold
|
||||
// 2 => '#C0C0C0', // Silver
|
||||
// 3 => '#CD7F32', // Bronze
|
||||
// default => '#3B82F6', // Blue
|
||||
// };
|
||||
|
||||
// $rank++;
|
||||
// }
|
||||
|
||||
// return [
|
||||
// 'datasets' => [
|
||||
// [
|
||||
// 'label' => 'Rank (1 = Best)',
|
||||
// 'data' => $ranks,
|
||||
|
||||
// // 🎨 Styling
|
||||
// 'borderColor' => '#3B82F6',
|
||||
// 'backgroundColor' => $colors,
|
||||
// 'pointBackgroundColor' => $colors,
|
||||
// 'pointBorderColor' => '#000',
|
||||
// 'pointRadius' => 7,
|
||||
// 'pointHoverRadius' => 10,
|
||||
// 'borderWidth' => 3,
|
||||
// 'tension' => 0.4,
|
||||
// 'fill' => false,
|
||||
// ],
|
||||
// ],
|
||||
// 'labels' => $labels,
|
||||
// ];
|
||||
// }
|
||||
|
||||
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
$rfqId = session('rfq_id');
|
||||
|
||||
if (!$rfqId) {
|
||||
return [
|
||||
'datasets' => [],
|
||||
'labels' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* STEP 1: Get bids sorted by freight charge (for ranking)
|
||||
*/
|
||||
$rankedBids = RfqTransporterBid::query()
|
||||
->where('request_quotation_id', $rfqId)
|
||||
->orderByRaw('CAST(total_freight_charge AS DECIMAL(10,2)) ASC')
|
||||
->get();
|
||||
|
||||
$rankMap = [];
|
||||
$rank = 1;
|
||||
|
||||
foreach ($rankedBids as $bid) {
|
||||
$rankMap[$bid->id] = $rank++;
|
||||
}
|
||||
|
||||
/**
|
||||
* STEP 2: Get bids in natural order (for wave effect)
|
||||
* You can change orderBy to:
|
||||
* - created_at
|
||||
* - transporter_name
|
||||
*/
|
||||
$chartBids = RfqTransporterBid::query()
|
||||
->where('request_quotation_id', $rfqId)
|
||||
->orderBy('id')
|
||||
->get();
|
||||
|
||||
$labels = [];
|
||||
$amounts = [];
|
||||
$colors = [];
|
||||
|
||||
$ranks = [];
|
||||
|
||||
foreach ($chartBids as $bid) {
|
||||
$labels[] = $bid->transporter_name;
|
||||
$amounts[] = (float) $bid->total_freight_charge;
|
||||
|
||||
$rank = $rankMap[$bid->id];
|
||||
$ranks[] = $rank;
|
||||
|
||||
$colors[] = match ($rank) {
|
||||
1 => '#FFD700',
|
||||
2 => '#C0C0C0',
|
||||
3 => '#CD7F32',
|
||||
default => '#2563EB',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return [
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => 'Freight Charge',
|
||||
'data' => $amounts,
|
||||
'rankData' => $ranks,
|
||||
|
||||
'borderColor' => '#2563EB',
|
||||
'backgroundColor' => $colors,
|
||||
'pointBackgroundColor' => $colors,
|
||||
'pointBorderColor' => '#000',
|
||||
'pointRadius' => 7,
|
||||
'pointHoverRadius' => 11,
|
||||
'borderWidth' => 3,
|
||||
'tension' => 0.45,
|
||||
'fill' => false,
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
];
|
||||
}
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'plugins' => [
|
||||
'datalabels' => [
|
||||
'anchor' => 'start',
|
||||
'align' => 'start',
|
||||
'offset' => -15,
|
||||
'color' => '#000',
|
||||
'font' => [
|
||||
'weight' => 'bold',
|
||||
],
|
||||
'formatter' => Js::from("function(value) { return Number(value); }"),
|
||||
],
|
||||
],
|
||||
'scales' => [
|
||||
'y' => [
|
||||
'beginAtZero' => true,
|
||||
'ticks' => [
|
||||
'stepSize' => 0.5,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
protected function getType(): string
|
||||
{
|
||||
return 'bar';
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,14 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\GrMaster;
|
||||
use App\Models\Item;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProcessOrder;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\User;
|
||||
use App\Services\StickerPdfService;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
@@ -889,4 +894,155 @@ class PdfController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// public function generate(string $stickerId)
|
||||
// {
|
||||
|
||||
// $stickerId = trim($stickerId);
|
||||
|
||||
// $elements = StickerStructureDetail::where('sticker_id', $stickerId)
|
||||
// ->first();
|
||||
|
||||
// $pdfService = new StickerPdfService();
|
||||
// return $pdfService->generate($stickerId, $elements->toArray());
|
||||
// }
|
||||
|
||||
public function generate(Request $request, $stickerId)
|
||||
{
|
||||
$plantId = $request->query('plant_id');
|
||||
$itemCharacteristicId = $request->query('item_characteristic_id');
|
||||
$stickerId = trim($stickerId);
|
||||
|
||||
//dd($plantId,$itemCharacteristicId,$stickerId);
|
||||
|
||||
// Normalize "empty" or "" to null
|
||||
$plantId = ($plantId && $plantId != 'empty') ? $plantId : null;
|
||||
$itemCharacteristicId = ($itemCharacteristicId && $itemCharacteristicId != 'empty') ? $itemCharacteristicId : null;
|
||||
|
||||
|
||||
if ($plantId && $itemCharacteristicId)
|
||||
{
|
||||
$plantId = $request->query('plant_id');
|
||||
$itemCharacteristicId = $request->query('item_characteristic_id');
|
||||
|
||||
$sticId = StickerStructureDetail::where('sticker_id', $stickerId)->first();
|
||||
|
||||
$sId = $sticId->id;
|
||||
|
||||
$dynamicElements = StickerDetail::where('sticker_structure_detail_id', $sId)
|
||||
->where('element_type', 'Dynamic')
|
||||
->get();
|
||||
|
||||
$itemCharacteristic = null;
|
||||
|
||||
if ($plantId && $itemCharacteristicId) {
|
||||
$itemCharacteristic = ItemCharacteristic::where('plant_id', $plantId)
|
||||
->where('id', $itemCharacteristicId)
|
||||
->first();
|
||||
}
|
||||
|
||||
$pdfService = new StickerPdfService();
|
||||
|
||||
return $pdfService->generate1(
|
||||
$stickerId,
|
||||
$dynamicElements,
|
||||
$itemCharacteristic
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$elements = StickerStructureDetail::where('sticker_id', $stickerId)
|
||||
->first();
|
||||
|
||||
$pdfService = new StickerPdfService();
|
||||
return $pdfService->generate($stickerId, $elements->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// public function generatePdf(Request $request, $stickerId)
|
||||
// {
|
||||
// $plantId = $request->query('plant_id');
|
||||
// $itemCharacteristicId = $request->query('item_characteristic_id');
|
||||
// $stickerId = trim($stickerId);
|
||||
|
||||
// //dd($plantId,$itemCharacteristicId,$stickerId);
|
||||
|
||||
// // Normalize "empty" or "" to null
|
||||
// $plantId = ($plantId && $plantId != 'empty') ? $plantId : null;
|
||||
// $itemCharacteristicId = ($itemCharacteristicId && $itemCharacteristicId != 'empty') ? $itemCharacteristicId : null;
|
||||
|
||||
|
||||
// if ($plantId && $itemCharacteristicId)
|
||||
// {
|
||||
// $plantId = $request->query('plant_id');
|
||||
// $itemCharacteristicId = $request->query('item_characteristic_id');
|
||||
|
||||
|
||||
// $sticId = StickerStructureDetail::where('id', $stickerId)->first();
|
||||
|
||||
// $sId = $sticId->id;
|
||||
|
||||
// $stickerId = $sticId->sticker_id;
|
||||
|
||||
// $dynamicElements = StickerDetail::where('sticker_structure_detail_id', $sId)
|
||||
// ->where('element_type', 'Dynamic')
|
||||
// ->get();
|
||||
|
||||
// $itemCharacteristic = null;
|
||||
|
||||
// if ($plantId && $itemCharacteristicId) {
|
||||
// $itemCharacteristic = ItemCharacteristic::where('plant_id', $plantId)
|
||||
// ->where('id', $itemCharacteristicId)
|
||||
// ->first();
|
||||
// }
|
||||
|
||||
// $pdfService = new StickerPdfService();
|
||||
|
||||
// return $pdfService->generatePdf1(
|
||||
// $stickerId,
|
||||
// $dynamicElements,
|
||||
// $itemCharacteristic
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $elements = StickerStructureDetail::where('sticker_id', $stickerId)
|
||||
// ->first();
|
||||
|
||||
// $pdfService = new StickerPdfService();
|
||||
// return $pdfService->generate($stickerId, $elements->toArray());
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public function generatePdf(Request $request, $stickerId)
|
||||
{
|
||||
$plantId = $request->query('plant_id');
|
||||
$itemCharacteristicId = $request->query('item_characteristic_id');
|
||||
$serialNumber = $request->query('serial_number');
|
||||
|
||||
if ($plantId && $itemCharacteristicId) {
|
||||
$structure = StickerStructureDetail::findOrFail($stickerId);
|
||||
|
||||
$dynamicElements = StickerDetail::where(
|
||||
'sticker_structure_detail_id',
|
||||
$structure->id
|
||||
)->where('element_type', 'Dynamic')->get();
|
||||
|
||||
$itemCharacteristic = ItemCharacteristic::where('plant_id', $plantId)
|
||||
->where('id', $itemCharacteristicId)
|
||||
->first();
|
||||
|
||||
return (new StickerPdfService())->generatePdf1(
|
||||
$structure->sticker_id,
|
||||
$dynamicElements,
|
||||
$itemCharacteristic,
|
||||
$serialNumber
|
||||
);
|
||||
}
|
||||
|
||||
return abort(404);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
65
app/Livewire/StickerValidation.php
Normal file
65
app/Livewire/StickerValidation.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\ProductionQuantity;
|
||||
use Livewire\Component;
|
||||
|
||||
class StickerValidation extends Component
|
||||
{
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $refNumber;
|
||||
|
||||
public $serialNumber;
|
||||
|
||||
public bool $materialInvoice = false;
|
||||
|
||||
public $records = [];
|
||||
|
||||
protected $listeners = [
|
||||
'refreshEmptySticker' => 'loadStickerData',
|
||||
'addStickerToList' => 'loadSticker'
|
||||
];
|
||||
|
||||
public function loadStickerData($plantId, $refNumber)
|
||||
{
|
||||
$this->plantId = $plantId;
|
||||
$this->refNumber = $refNumber;
|
||||
// $this->records = ProductionQuantity::where('plant_id', $plantId)
|
||||
// ->where('production_order', $refNumber)
|
||||
// ->orderBy('created_at', 'asc')
|
||||
// ->get(['serial_number', 'operator_id']);
|
||||
|
||||
$this->records = ProductionQuantity::query()
|
||||
->where('production_quantities.plant_id', $plantId)
|
||||
->where('production_quantities.production_order', $refNumber)
|
||||
->leftJoin(
|
||||
'sticker_validations',
|
||||
'sticker_validations.serial_number',
|
||||
'=',
|
||||
'production_quantities.serial_number'
|
||||
)
|
||||
->orderBy('production_quantities.created_at', 'asc')
|
||||
->get([
|
||||
'production_quantities.serial_number',
|
||||
'production_quantities.operator_id',
|
||||
'sticker_validations.status',
|
||||
'sticker_validations.sticker_id',
|
||||
])
|
||||
->map(function ($row) {
|
||||
$row->status = $row->status ?? '';
|
||||
return $row;
|
||||
});
|
||||
|
||||
//dd($this->records);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.sticker-validation');
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,15 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Item extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
"plant_id",
|
||||
'plant_id',
|
||||
'category',
|
||||
'code',
|
||||
'description',
|
||||
@@ -43,4 +43,9 @@ class Item extends Model
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
}
|
||||
|
||||
public function itemCharacteristics()
|
||||
{
|
||||
return $this->hasMany(ItemCharacteristic::class, 'item_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
166
app/Models/ItemCharacteristic.php
Normal file
166
app/Models/ItemCharacteristic.php
Normal file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ItemCharacteristic extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'class',
|
||||
'zz1_cn_bill_ord',
|
||||
'zmm_amps',
|
||||
'zmm_brand',
|
||||
'zmm_degreeofprotection',
|
||||
'zmm_delivery',
|
||||
'zmm_dir_rot',
|
||||
'zmm_discharge',
|
||||
'zmm_discharge_max',
|
||||
'zmm_discharge_min',
|
||||
'zmm_duty',
|
||||
'zmm_eff_motor',
|
||||
'zmm_eff_pump',
|
||||
'zmm_frequency',
|
||||
'zmm_head',
|
||||
'zmm_heading',
|
||||
'zmm_head_max',
|
||||
'zmm_head_minimum',
|
||||
'zmm_idx_eff_mtr',
|
||||
'zmm_idx_eff_pump',
|
||||
'zmm_kvacode',
|
||||
'zmm_maxambtemp',
|
||||
'zmm_mincoolingflow',
|
||||
'zmm_motorseries',
|
||||
'zmm_motor_model',
|
||||
'zmm_outlet',
|
||||
'zmm_phase',
|
||||
'zmm_pressure',
|
||||
'zmm_pumpflowtype',
|
||||
'zmm_pumpseries',
|
||||
'zmm_pump_model',
|
||||
'zmm_ratedpower',
|
||||
'zmm_region',
|
||||
'zmm_servicefactor',
|
||||
'zmm_servicefactormaximumamps',
|
||||
'zmm_speed',
|
||||
'zmm_suction',
|
||||
'zmm_suctionxdelivery',
|
||||
'zmm_supplysource',
|
||||
'zmm_temperature',
|
||||
'zmm_thrustload',
|
||||
'zmm_volts',
|
||||
'zmm_wire',
|
||||
'zmm_package',
|
||||
'zmm_pvarrayrating',
|
||||
'zmm_isi',
|
||||
'zmm_isimotor',
|
||||
'zmm_isipump',
|
||||
'zmm_isipumpset',
|
||||
'zmm_pumpset_model',
|
||||
'zmm_stages',
|
||||
'zmm_headrange',
|
||||
'zmm_overall_efficiency',
|
||||
'zmm_connection',
|
||||
'zmm_min_bore_size',
|
||||
'zmm_isireference',
|
||||
'zmm_category',
|
||||
'zmm_submergence',
|
||||
'zmm_capacitorstart',
|
||||
'zmm_capacitorrun',
|
||||
'zmm_inch',
|
||||
'zmm_motor_type',
|
||||
'zmm_dismantle_direction',
|
||||
'zmm_eff_ovrall',
|
||||
'zmm_bodymoc',
|
||||
'zmm_rotormoc',
|
||||
'zmm_dlwl',
|
||||
'zmm_inputpower',
|
||||
'zmm_imp_od',
|
||||
'zmm_ambtemp',
|
||||
'zmm_de',
|
||||
'zmm_dischargerange',
|
||||
'zmm_efficiency_class',
|
||||
'zmm_framesize',
|
||||
'zmm_impellerdiameter',
|
||||
'zmm_insulationclass',
|
||||
'zmm_maxflow',
|
||||
'zmm_minhead',
|
||||
'zmm_mtrlofconst',
|
||||
'zmm_nde',
|
||||
'zmm_powerfactor',
|
||||
'zmm_tagno',
|
||||
'zmm_year',
|
||||
'zmm_laser_name',
|
||||
'zmm_beenote',
|
||||
'zmm_beenumber',
|
||||
'zmm_beestar',
|
||||
'zmm_logo_ce',
|
||||
'zmm_codeclass',
|
||||
'zmm_colour',
|
||||
'zmm_logo_cp',
|
||||
'zmm_grade',
|
||||
'zmm_grwt_pset',
|
||||
'zmm_grwt_cable',
|
||||
'zmm_grwt_motor',
|
||||
'zmm_grwt_pf',
|
||||
'zmm_grwt_pump',
|
||||
'zmm_isivalve',
|
||||
'zmm_isi_wc',
|
||||
'zmm_labelperiod',
|
||||
'zmm_length',
|
||||
'zmm_license_cml_no',
|
||||
'zmm_mfgmonyr',
|
||||
'zmm_modelyear',
|
||||
'zmm_motoridentification',
|
||||
'zmm_newt_pset',
|
||||
'zmm_newt_cable',
|
||||
'zmm_newt_motor',
|
||||
'zmm_newt_pf',
|
||||
'zmm_newt_pump',
|
||||
'zmm_logo_nsf',
|
||||
'zmm_packtype',
|
||||
'zmm_panel',
|
||||
'zmm_performance_factor',
|
||||
'zmm_pumpidentification',
|
||||
'zmm_psettype',
|
||||
'zmm_size',
|
||||
'zmm_eff_ttl',
|
||||
'zmm_type',
|
||||
'zmm_usp',
|
||||
'zmm_1',
|
||||
'zmm_2',
|
||||
'zmm_3',
|
||||
'zmm_4',
|
||||
'zmm_5',
|
||||
'zmm_6',
|
||||
'zmm_7',
|
||||
'zmm_8',
|
||||
'zmm_9',
|
||||
'zmm_10',
|
||||
'zmm_11',
|
||||
'zmm_12',
|
||||
'zmm_13',
|
||||
'zmm_14',
|
||||
'zmm_15',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
}
|
||||
@@ -102,4 +102,9 @@ class Plant extends Model
|
||||
{
|
||||
return $this->hasMany(User::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function itemCharacteristics()
|
||||
{
|
||||
return $this->hasMany(ItemCharacteristic::class, 'plant_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
46
app/Models/RequestQuotation.php
Normal file
46
app/Models/RequestQuotation.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class RequestQuotation extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'rfq_number',
|
||||
'rfq_date_time',
|
||||
'pickup_address',
|
||||
'delivery_address',
|
||||
'weight',
|
||||
'volumetrice_size_inch',
|
||||
'type_of_vehicle',
|
||||
'special_type',
|
||||
'no_of_vehicle',
|
||||
'product_name',
|
||||
'loading_by',
|
||||
'unloading_by',
|
||||
'pick_and_delivery',
|
||||
'payment_term',
|
||||
'paid_topay',
|
||||
'require_date_time',
|
||||
'transporter_name',
|
||||
'total_freight_charge',
|
||||
'transit_day',
|
||||
'spot_rate_transport_master_id',
|
||||
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function spotRateTransportMaster(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SpotRateTransportMaster::class);
|
||||
}
|
||||
|
||||
}
|
||||
30
app/Models/RfqTransporterBid.php
Normal file
30
app/Models/RfqTransporterBid.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use phpseclib3\Crypt\Common\Formats\Signature\Raw;
|
||||
|
||||
class RfqTransporterBid extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'request_quotation_id',
|
||||
'transporter_name',
|
||||
'total_freight_charge',
|
||||
'transit_day',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function requestQuotation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(RequestQuotation::class);
|
||||
// return $this->belongsTo(RequestQuotation::class, 'request_quotation_id');
|
||||
}
|
||||
}
|
||||
25
app/Models/SpotRateTransportMaster.php
Normal file
25
app/Models/SpotRateTransportMaster.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SpotRateTransportMaster extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $casts = [
|
||||
'user_name' => 'array',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'group_name',
|
||||
'user_name',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
}
|
||||
55
app/Models/StickerDetail.php
Normal file
55
app/Models/StickerDetail.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerDetail extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'sticker_structure_detail_id',
|
||||
'design_element_type',
|
||||
'element_id',
|
||||
'element_type',
|
||||
'characteristics_type',
|
||||
'string_value',
|
||||
'string_font',
|
||||
'string_size',
|
||||
'element_colour',
|
||||
'string_align',
|
||||
'string_x_value',
|
||||
'string_y_value',
|
||||
'shape_name',
|
||||
'shape_pen_size',
|
||||
'curve_radius',
|
||||
'shape_x1_value',
|
||||
'shape_y1_value',
|
||||
'shape_x2_value',
|
||||
'shape_y2_value',
|
||||
// 'image_path',
|
||||
// 'image_type',
|
||||
'image_x',
|
||||
'image_y',
|
||||
'image_width',
|
||||
'image_height',
|
||||
'qr_value',
|
||||
'qr_align',
|
||||
'qr_size',
|
||||
'qr_x_value',
|
||||
'qr_y_value',
|
||||
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function stickerStructureDetail(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class);
|
||||
}
|
||||
}
|
||||
@@ -8,28 +8,136 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerMappingMaster extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_id',
|
||||
'sticker1',
|
||||
'sticker2',
|
||||
'sticker3',
|
||||
'sticker4',
|
||||
'sticker5',
|
||||
'item_characteristic_id',
|
||||
|
||||
'sticker_structure1_id',
|
||||
'sticker1_machine_id',
|
||||
'sticker1_print_ip',
|
||||
'sticker_structure2_id',
|
||||
'sticker2_machine_id',
|
||||
'sticker2_print_ip',
|
||||
'sticker_structure3_id',
|
||||
'sticker3_machine_id',
|
||||
'sticker3_print_ip',
|
||||
'sticker_structure4_id',
|
||||
'sticker4_machine_id',
|
||||
'sticker4_print_ip',
|
||||
'sticker_structure5_id',
|
||||
'sticker5_machine_id',
|
||||
'sticker5_print_ip',
|
||||
'sticker_structure7_id',
|
||||
'sticker6_machine_id',
|
||||
'sticker6_print_ip',
|
||||
'sticker_structure7_id',
|
||||
'sticker7_machine_id',
|
||||
'sticker7_print_ip',
|
||||
'sticker_structure8_id',
|
||||
'sticker8_machine_id',
|
||||
'sticker8_print_ip',
|
||||
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
public function plant()
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function itemCharacteristic()
|
||||
{
|
||||
return $this->belongsTo(ItemCharacteristic::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
return $this->belongsTo(Item::class, 'item_id');
|
||||
}
|
||||
|
||||
public function sticker1Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure1_id');
|
||||
}
|
||||
|
||||
public function sticker2Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure2_id');
|
||||
}
|
||||
|
||||
public function sticker3Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure3_id');
|
||||
}
|
||||
|
||||
public function sticker4Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure4_id');
|
||||
}
|
||||
|
||||
public function sticker5Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure5_id');
|
||||
}
|
||||
|
||||
public function sticker6Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure6_id');
|
||||
}
|
||||
|
||||
public function sticker7Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure7_id');
|
||||
}
|
||||
|
||||
public function sticker8Structure()
|
||||
{
|
||||
return $this->belongsTo(StickerStructureDetail::class, 'sticker_structure8_id');
|
||||
}
|
||||
|
||||
// Machine relationships (per sticker)
|
||||
public function sticker1Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker1_machine_id');
|
||||
}
|
||||
|
||||
public function sticker2Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker2_machine_id');
|
||||
}
|
||||
|
||||
public function sticker3Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker3_machine_id');
|
||||
}
|
||||
|
||||
public function sticker4Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker4_machine_id');
|
||||
}
|
||||
|
||||
public function sticker5Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker5_machine_id');
|
||||
}
|
||||
|
||||
public function sticker6Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker6_machine_id');
|
||||
}
|
||||
|
||||
public function sticker7Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker7_machine_id');
|
||||
}
|
||||
|
||||
public function sticker8Machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class, 'sticker8_machine_id');
|
||||
}
|
||||
}
|
||||
|
||||
40
app/Models/StickerStructureDetail.php
Normal file
40
app/Models/StickerStructureDetail.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerStructureDetail extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'item_characteristic_id',
|
||||
'sticker_id',
|
||||
'sticker_width',
|
||||
'sticker_height',
|
||||
'sticker_lmargin',
|
||||
'sticker_rmargin',
|
||||
'sticker_tmargin',
|
||||
'sticker_bmargin',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function itemCharacteristic(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ItemCharacteristic::class, 'item_characteristic_id');
|
||||
}
|
||||
|
||||
}
|
||||
33
app/Models/StickerValidation.php
Normal file
33
app/Models/StickerValidation.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StickerValidation extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'machine_id',
|
||||
'sticker_id',
|
||||
'production_order',
|
||||
'serial_number',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public function plant()
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function machine()
|
||||
{
|
||||
return $this->belongsTo(Machine::class);
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,13 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use NotificationChannels\WebPush\HasPushSubscriptions;
|
||||
use NotificationChannels\WebPush\PushSubscription;
|
||||
|
||||
class User extends Authenticatable implements FilamentUser
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasFactory, HasRoles, Notifiable, SoftDeletes, HasSuperAdmin;
|
||||
use HasFactory, HasRoles, Notifiable, SoftDeletes, HasSuperAdmin, HasPushSubscriptions;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
@@ -63,4 +65,9 @@ class User extends Authenticatable implements FilamentUser
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function pushSubscriptions()
|
||||
{
|
||||
return $this->morphMany(PushSubscription::class, 'subscribable');
|
||||
}
|
||||
}
|
||||
|
||||
19
app/Models/WebPushSubscription.php
Normal file
19
app/Models/WebPushSubscription.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WebPushSubscription extends Model
|
||||
{
|
||||
protected $table = 'push_subscriptions';
|
||||
|
||||
protected $fillable = [
|
||||
'subscribable_type',
|
||||
'subscribable_id',
|
||||
'endpoint',
|
||||
'public_key',
|
||||
'auth_token',
|
||||
'content_encoding',
|
||||
];
|
||||
}
|
||||
108
app/Notifications/PushAlertNotification.php
Normal file
108
app/Notifications/PushAlertNotification.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use NotificationChannels\WebPush\WebPushMessage;
|
||||
use NotificationChannels\WebPush\WebPushChannel;
|
||||
|
||||
|
||||
class PushAlertNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*/
|
||||
// public function __construct()
|
||||
// {
|
||||
// //
|
||||
// }
|
||||
|
||||
public $title;
|
||||
public $body;
|
||||
|
||||
public function __construct($title, $body)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
// public function via($notifiable)
|
||||
// {
|
||||
// return [WebPushChannel::class];
|
||||
// }
|
||||
|
||||
public function via($notifiable)
|
||||
{
|
||||
return [
|
||||
'database', // ✅ Filament toast
|
||||
WebPushChannel::class // ✅ Browser / PWA push
|
||||
];
|
||||
}
|
||||
|
||||
public function toDatabase($notifiable): array
|
||||
{
|
||||
return [
|
||||
'title' => $this->title,
|
||||
'body' => $this->body,
|
||||
];
|
||||
}
|
||||
|
||||
// public function toWebPush($notifiable, $notification)
|
||||
// {
|
||||
// return (new WebPushMessage)
|
||||
// ->title('New Alert 🚨')
|
||||
// ->icon('/pwa-192x192.png')
|
||||
// ->body('You have a new notification')
|
||||
// ->action('Open App', 'open_app')
|
||||
// ->data(['url' => '/admin']);
|
||||
// }
|
||||
|
||||
public function toWebPush($notifiable, $notification)
|
||||
{
|
||||
|
||||
return (new WebPushMessage)
|
||||
->title($this->title)
|
||||
->icon('/pwa-192x192.png')
|
||||
->body($this->body)
|
||||
->action('Open App', 'open_app')
|
||||
->data(['url' => '/admin']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
// public function via(object $notifiable): array
|
||||
// {
|
||||
// return ['mail'];
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*/
|
||||
// public function toMail(object $notifiable): MailMessage
|
||||
// {
|
||||
// return (new MailMessage)
|
||||
// ->line('The introduction to the notification.')
|
||||
// ->action('Notification Action', url('/'))
|
||||
// ->line('Thank you for using our application!');
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
106
app/Policies/ItemCharacteristicPolicy.php
Normal file
106
app/Policies/ItemCharacteristicPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\User;
|
||||
|
||||
class ItemCharacteristicPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, ItemCharacteristic $itemcharacteristic): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete ItemCharacteristic');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any ItemCharacteristic');
|
||||
}
|
||||
}
|
||||
106
app/Policies/RequestQuotationPolicy.php
Normal file
106
app/Policies/RequestQuotationPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\RequestQuotation;
|
||||
use App\Models\User;
|
||||
|
||||
class RequestQuotationPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, RequestQuotation $requestquotation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, RequestQuotation $requestquotation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, RequestQuotation $requestquotation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, RequestQuotation $requestquotation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, RequestQuotation $requestquotation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, RequestQuotation $requestquotation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete RequestQuotation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any RequestQuotation');
|
||||
}
|
||||
}
|
||||
106
app/Policies/RfqTransporterBidPolicy.php
Normal file
106
app/Policies/RfqTransporterBidPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\RfqTransporterBid;
|
||||
use App\Models\User;
|
||||
|
||||
class RfqTransporterBidPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, RfqTransporterBid $rfqtransporterbid): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, RfqTransporterBid $rfqtransporterbid): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, RfqTransporterBid $rfqtransporterbid): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, RfqTransporterBid $rfqtransporterbid): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, RfqTransporterBid $rfqtransporterbid): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, RfqTransporterBid $rfqtransporterbid): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete RfqTransporterBid');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any RfqTransporterBid');
|
||||
}
|
||||
}
|
||||
106
app/Policies/SpotRateTransportMasterPolicy.php
Normal file
106
app/Policies/SpotRateTransportMasterPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\SpotRateTransportMaster;
|
||||
use App\Models\User;
|
||||
|
||||
class SpotRateTransportMasterPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, SpotRateTransportMaster $spotratetransportmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, SpotRateTransportMaster $spotratetransportmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, SpotRateTransportMaster $spotratetransportmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, SpotRateTransportMaster $spotratetransportmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, SpotRateTransportMaster $spotratetransportmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, SpotRateTransportMaster $spotratetransportmaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete SpotRateTransportMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any SpotRateTransportMaster');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerDetailPolicy.php
Normal file
106
app/Policies/StickerDetailPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerDetailPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerDetail $stickerdetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerDetail');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerStructureDetailPolicy.php
Normal file
106
app/Policies/StickerStructureDetailPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerStructureDetailPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerStructureDetail $stickerstructuredetail): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerStructureDetail');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerStructureDetail');
|
||||
}
|
||||
}
|
||||
106
app/Policies/StickerValidationPolicy.php
Normal file
106
app/Policies/StickerValidationPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StickerValidation;
|
||||
use App\Models\User;
|
||||
|
||||
class StickerValidationPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StickerValidation $stickervalidation): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StickerValidation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StickerValidation');
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Providers\Filament;
|
||||
|
||||
use Althinect\FilamentSpatieRolesPermissions\FilamentSpatieRolesPermissionsPlugin;
|
||||
use App\Filament\Pages\InvoiceDashboard;
|
||||
use App\Filament\Pages\NotificationSettings;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\AuthenticateSession;
|
||||
@@ -59,6 +60,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||
->pages([
|
||||
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||
// ->widgets([
|
||||
@@ -123,6 +125,15 @@ class AdminPanelProvider extends PanelProvider
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
|
||||
FilamentView::registerRenderHook('panels::body.end', function () {
|
||||
if (url()->current() == config('app.url') . '/admin') {
|
||||
return '<script src="' . asset('js/push.js') . '"></script>';
|
||||
}
|
||||
|
||||
return '';
|
||||
});
|
||||
|
||||
FilamentView::registerRenderHook('panels::head.end', function () {
|
||||
// Only inject on the "home" page (or specific route)
|
||||
if (url()->current() == config('app.url') . '/admin') {
|
||||
|
||||
1056
app/Services/StickerPdfService.php
Normal file
1056
app/Services/StickerPdfService.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,11 @@
|
||||
"althinect/filament-spatie-roles-permissions": "^2.3",
|
||||
"diogogpinto/filament-auth-ui-enhancer": "^1.0",
|
||||
"erag/laravel-pwa": "^1.9",
|
||||
"ffhs/filament-package_ffhs_approvals": "^1.0",
|
||||
"filament/filament": "^3.3",
|
||||
"intervention/image": "^3.11",
|
||||
"irazasyed/telegram-bot-sdk": "^3.15",
|
||||
"laravel-notification-channels/webpush": "^10.4",
|
||||
"laravel/framework": "^11.31",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.9",
|
||||
|
||||
477
composer.lock
generated
477
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "69ede7e9877dd08efdeb795bfb6b7d29",
|
||||
"content-hash": "0e64d9b0a3c4d596ff8cd51b521c0565",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alperenersoy/filament-export",
|
||||
@@ -1810,6 +1810,85 @@
|
||||
},
|
||||
"time": "2025-10-17T16:34:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ffhs/filament-package_ffhs_approvals",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ffhs/filament-package_ffhs_approvals.git",
|
||||
"reference": "712475522b63bf45a9e63a649d391cfe22132818"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ffhs/filament-package_ffhs_approvals/zipball/712475522b63bf45a9e63a649d391cfe22132818",
|
||||
"reference": "712475522b63bf45a9e63a649d391cfe22132818",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"filament/filament": "^3.0",
|
||||
"php": "^8.2",
|
||||
"spatie/laravel-package-tools": "^1.15.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^3.0",
|
||||
"laravel/pint": "^1.0",
|
||||
"nunomaduro/collision": "^8.0",
|
||||
"orchestra/testbench": "^9.9",
|
||||
"pestphp/pest": "^3.7",
|
||||
"pestphp/pest-plugin-arch": "^3.0",
|
||||
"pestphp/pest-plugin-laravel": "^3.0",
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"spatie/laravel-ray": "^1.26"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Approvals": "Ffhs\\Approvals\\Facades\\Approvals"
|
||||
},
|
||||
"providers": [
|
||||
"Ffhs\\Approvals\\ApprovalsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Ffhs\\Approvals\\": "src/",
|
||||
"Ffhs\\Approvals\\Database\\Factories\\": "database/factories/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kromer Luc",
|
||||
"email": "luc.kromer@ffhs.ch",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Matthew Ballou",
|
||||
"email": "mballou@kirschbaumdevelopment.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "This is my package filament-package_ffhs_approvals",
|
||||
"homepage": "https://github.com/ffhs/filament-package_ffhs_approvals",
|
||||
"keywords": [
|
||||
"ffhs",
|
||||
"filament-package_ffhs_approvals",
|
||||
"kirschbaum-development",
|
||||
"laravel"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ffhs/filament-package_ffhs_approvals/issues",
|
||||
"source": "https://github.com/ffhs/filament-package_ffhs_approvals"
|
||||
},
|
||||
"time": "2025-07-24T14:32:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "filament/actions",
|
||||
"version": "v3.3.45",
|
||||
@@ -3076,6 +3155,72 @@
|
||||
},
|
||||
"time": "2025-11-13T14:57:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel-notification-channels/webpush",
|
||||
"version": "10.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel-notification-channels/webpush.git",
|
||||
"reference": "a504bcbdd6258091b1fafdef6ca95b0891a47c9e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel-notification-channels/webpush/zipball/a504bcbdd6258091b1fafdef6ca95b0891a47c9e",
|
||||
"reference": "a504bcbdd6258091b1fafdef6ca95b0891a47c9e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/notifications": "^11.0|^12.0",
|
||||
"illuminate/support": "^11.0|^12.0",
|
||||
"minishlink/web-push": "^10.0",
|
||||
"php": "^8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^3.1",
|
||||
"laravel/pint": "^1.25",
|
||||
"mockery/mockery": "^1.0",
|
||||
"orchestra/testbench": "^9.2|^10.0",
|
||||
"phpunit/phpunit": "^10.5|^11.5.3",
|
||||
"rector/rector": "^2.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"NotificationChannels\\WebPush\\WebPushServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"NotificationChannels\\WebPush\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Cretu Eusebiu",
|
||||
"email": "me@cretueusebiu.com",
|
||||
"homepage": "http://cretueusebiu.com",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Joost de Bruijn",
|
||||
"email": "joost@aqualabs.nl",
|
||||
"role": "Maintainer"
|
||||
}
|
||||
],
|
||||
"description": "Web Push Notifications driver for Laravel.",
|
||||
"homepage": "https://github.com/laravel-notification-channels/webpush",
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel-notification-channels/webpush/issues",
|
||||
"source": "https://github.com/laravel-notification-channels/webpush/tree/10.4.0"
|
||||
},
|
||||
"time": "2025-12-19T15:47:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v11.46.1",
|
||||
@@ -4880,6 +5025,73 @@
|
||||
},
|
||||
"time": "2019-10-05T02:44:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "minishlink/web-push",
|
||||
"version": "v10.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/web-push-libs/web-push-php.git",
|
||||
"reference": "08463189d3501cbd78a8625c87ab6680a7397aad"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/web-push-libs/web-push-php/zipball/08463189d3501cbd78a8625c87ab6680a7397aad",
|
||||
"reference": "08463189d3501cbd78a8625c87ab6680a7397aad",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-openssl": "*",
|
||||
"guzzlehttp/guzzle": "^7.9.2",
|
||||
"php": ">=8.2",
|
||||
"spomky-labs/base64url": "^2.0.4",
|
||||
"web-token/jwt-library": "^3.4.9|^4.0.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^v3.91.3",
|
||||
"phpstan/phpstan": "^2.1.33",
|
||||
"phpstan/phpstan-strict-rules": "^2.0",
|
||||
"phpunit/phpunit": "^11.5.46|^12.5.2",
|
||||
"symfony/polyfill-iconv": "^1.33"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "Optional for performance.",
|
||||
"ext-gmp": "Optional for performance."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Minishlink\\WebPush\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Louis Lagrange",
|
||||
"email": "lagrange.louis@gmail.com",
|
||||
"homepage": "https://github.com/Minishlink"
|
||||
}
|
||||
],
|
||||
"description": "Web Push library for PHP",
|
||||
"homepage": "https://github.com/web-push-libs/web-push-php",
|
||||
"keywords": [
|
||||
"Push API",
|
||||
"WebPush",
|
||||
"notifications",
|
||||
"push",
|
||||
"web"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/web-push-libs/web-push-php/issues",
|
||||
"source": "https://github.com/web-push-libs/web-push-php/tree/v10.0.1"
|
||||
},
|
||||
"time": "2025-12-15T10:04:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "3.9.0",
|
||||
@@ -7696,6 +7908,180 @@
|
||||
],
|
||||
"time": "2025-09-24T06:40:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spomky-labs/base64url",
|
||||
"version": "v2.0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Spomky-Labs/base64url.git",
|
||||
"reference": "7752ce931ec285da4ed1f4c5aa27e45e097be61d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Spomky-Labs/base64url/zipball/7752ce931ec285da4ed1f4c5aa27e45e097be61d",
|
||||
"reference": "7752ce931ec285da4ed1f4c5aa27e45e097be61d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^0.11|^0.12",
|
||||
"phpstan/phpstan-beberlei-assert": "^0.11|^0.12",
|
||||
"phpstan/phpstan-deprecation-rules": "^0.11|^0.12",
|
||||
"phpstan/phpstan-phpunit": "^0.11|^0.12",
|
||||
"phpstan/phpstan-strict-rules": "^0.11|^0.12"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Base64Url\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Florent Morselli",
|
||||
"homepage": "https://github.com/Spomky-Labs/base64url/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Base 64 URL Safe Encoding/Decoding PHP Library",
|
||||
"homepage": "https://github.com/Spomky-Labs/base64url",
|
||||
"keywords": [
|
||||
"base64",
|
||||
"rfc4648",
|
||||
"safe",
|
||||
"url"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Spomky-Labs/base64url/issues",
|
||||
"source": "https://github.com/Spomky-Labs/base64url/tree/v2.0.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Spomky",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/FlorentMorselli",
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"time": "2020-11-03T09:10:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spomky-labs/pki-framework",
|
||||
"version": "1.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Spomky-Labs/pki-framework.git",
|
||||
"reference": "f0e9a548df4e3942886adc9b7830581a46334631"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Spomky-Labs/pki-framework/zipball/f0e9a548df4e3942886adc9b7830581a46334631",
|
||||
"reference": "f0e9a548df4e3942886adc9b7830581a46334631",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"brick/math": "^0.10|^0.11|^0.12|^0.13|^0.14",
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"ekino/phpstan-banned-code": "^1.0|^2.0|^3.0",
|
||||
"ext-gmp": "*",
|
||||
"ext-openssl": "*",
|
||||
"infection/infection": "^0.28|^0.29|^0.31",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.3",
|
||||
"phpstan/extension-installer": "^1.3|^2.0",
|
||||
"phpstan/phpstan": "^1.8|^2.0",
|
||||
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
|
||||
"phpstan/phpstan-phpunit": "^1.1|^2.0",
|
||||
"phpstan/phpstan-strict-rules": "^1.3|^2.0",
|
||||
"phpunit/phpunit": "^10.1|^11.0|^12.0",
|
||||
"rector/rector": "^1.0|^2.0",
|
||||
"roave/security-advisories": "dev-latest",
|
||||
"symfony/string": "^6.4|^7.0|^8.0",
|
||||
"symfony/var-dumper": "^6.4|^7.0|^8.0",
|
||||
"symplify/easy-coding-standard": "^12.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "For better performance (or GMP)",
|
||||
"ext-gmp": "For better performance (or BCMath)",
|
||||
"ext-openssl": "For OpenSSL based cyphering"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"SpomkyLabs\\Pki\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Joni Eskelinen",
|
||||
"email": "jonieske@gmail.com",
|
||||
"role": "Original developer"
|
||||
},
|
||||
{
|
||||
"name": "Florent Morselli",
|
||||
"email": "florent.morselli@spomky-labs.com",
|
||||
"role": "Spomky-Labs PKI Framework developer"
|
||||
}
|
||||
],
|
||||
"description": "A PHP framework for managing Public Key Infrastructures. It comprises X.509 public key certificates, attribute certificates, certification requests and certification path validation.",
|
||||
"homepage": "https://github.com/spomky-labs/pki-framework",
|
||||
"keywords": [
|
||||
"DER",
|
||||
"Private Key",
|
||||
"ac",
|
||||
"algorithm identifier",
|
||||
"asn.1",
|
||||
"asn1",
|
||||
"attribute certificate",
|
||||
"certificate",
|
||||
"certification request",
|
||||
"cryptography",
|
||||
"csr",
|
||||
"decrypt",
|
||||
"ec",
|
||||
"encrypt",
|
||||
"pem",
|
||||
"pkcs",
|
||||
"public key",
|
||||
"rsa",
|
||||
"sign",
|
||||
"signature",
|
||||
"verify",
|
||||
"x.509",
|
||||
"x.690",
|
||||
"x509",
|
||||
"x690"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Spomky-Labs/pki-framework/issues",
|
||||
"source": "https://github.com/Spomky-Labs/pki-framework/tree/1.4.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Spomky",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/FlorentMorselli",
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"time": "2025-12-20T12:57:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.3.0",
|
||||
@@ -10504,6 +10890,95 @@
|
||||
}
|
||||
],
|
||||
"time": "2024-11-21T01:49:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "web-token/jwt-library",
|
||||
"version": "4.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/web-token/jwt-library.git",
|
||||
"reference": "690d4dd47b78f423cb90457f858e4106e1deb728"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/web-token/jwt-library/zipball/690d4dd47b78f423cb90457f858e4106e1deb728",
|
||||
"reference": "690d4dd47b78f423cb90457f858e4106e1deb728",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"brick/math": "^0.12|^0.13|^0.14",
|
||||
"php": ">=8.2",
|
||||
"psr/clock": "^1.0",
|
||||
"spomky-labs/pki-framework": "^1.2.1"
|
||||
},
|
||||
"conflict": {
|
||||
"spomky-labs/jose": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-bcmath": "GMP or BCMath is highly recommended to improve the library performance",
|
||||
"ext-gmp": "GMP or BCMath is highly recommended to improve the library performance",
|
||||
"ext-openssl": "For key management (creation, optimization, etc.) and some algorithms (AES, RSA, ECDSA, etc.)",
|
||||
"ext-sodium": "Sodium is required for OKP key creation, EdDSA signature algorithm and ECDH-ES key encryption with OKP keys",
|
||||
"paragonie/sodium_compat": "Sodium is required for OKP key creation, EdDSA signature algorithm and ECDH-ES key encryption with OKP keys",
|
||||
"spomky-labs/aes-key-wrap": "For all Key Wrapping algorithms (AxxxKW, AxxxGCMKW, PBES2-HSxxx+AyyyKW...)",
|
||||
"symfony/console": "Needed to use console commands",
|
||||
"symfony/http-client": "To enable JKU/X5U support."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Jose\\Component\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Florent Morselli",
|
||||
"homepage": "https://github.com/Spomky"
|
||||
},
|
||||
{
|
||||
"name": "All contributors",
|
||||
"homepage": "https://github.com/web-token/jwt-framework/contributors"
|
||||
}
|
||||
],
|
||||
"description": "JWT library",
|
||||
"homepage": "https://github.com/web-token",
|
||||
"keywords": [
|
||||
"JOSE",
|
||||
"JWE",
|
||||
"JWK",
|
||||
"JWKSet",
|
||||
"JWS",
|
||||
"Jot",
|
||||
"RFC7515",
|
||||
"RFC7516",
|
||||
"RFC7517",
|
||||
"RFC7518",
|
||||
"RFC7519",
|
||||
"RFC7520",
|
||||
"bundle",
|
||||
"jwa",
|
||||
"jwt",
|
||||
"symfony"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/web-token/jwt-library/issues",
|
||||
"source": "https://github.com/web-token/jwt-library/tree/4.1.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Spomky",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/FlorentMorselli",
|
||||
"type": "patreon"
|
||||
}
|
||||
],
|
||||
"time": "2025-12-18T14:27:35+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
||||
@@ -28,7 +28,6 @@ return new class extends Migration
|
||||
|
||||
UNIQUE (name, plant_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ return new class extends Migration
|
||||
identification1 TEXT DEFAULT NULL,
|
||||
identification2 TEXT DEFAULT NULL,
|
||||
identification3 TEXT DEFAULT NULL,
|
||||
contact_number TEXT DEFAULT NULL,
|
||||
alternate_number TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_details (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
sticker_structure_detail_id BIGINT NOT NULL,
|
||||
design_element_type TEXT,
|
||||
element_id TEXT,
|
||||
element_type TEXT,
|
||||
string_value TEXT,
|
||||
string_font TEXT,
|
||||
string_size TEXT,
|
||||
element_colour TEXT,
|
||||
string_align TEXT,
|
||||
string_x_value TEXT,
|
||||
string_y_value TEXT,
|
||||
shape_name TEXT,
|
||||
shape_pen_size TEXT,
|
||||
shape_x1_value TEXT,
|
||||
shape_y1_value TEXT,
|
||||
shape_x2_value TEXT,
|
||||
shape_y2_value TEXT,
|
||||
image_path TEXT,
|
||||
image_type TEXT,
|
||||
image_x TEXT,
|
||||
image_y TEXT,
|
||||
image_width TEXT,
|
||||
image_height TEXT,
|
||||
qr_value TEXT,
|
||||
qr_align TEXT,
|
||||
qr_size TEXT,
|
||||
qr_x_value TEXT,
|
||||
qr_y_value TEXT,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (sticker_structure_detail_id) REFERENCES sticker_structure_details (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_details');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_structure_details (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
sticker_id TEXT,
|
||||
sticker_width TEXT,
|
||||
sticker_height TEXT,
|
||||
sticker_lmargin TEXT,
|
||||
sticker_rmargin TEXT,
|
||||
sticker_tmargin TEXT,
|
||||
sticker_bmargin TEXT,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_structure_details');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE item_characteristics (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
class TEXT,
|
||||
zz1_cn_bill_ord TEXT,
|
||||
zmm_amps TEXT,
|
||||
zmm_brand TEXT,
|
||||
zmm_degreeofprotection TEXT,
|
||||
zmm_delivery TEXT,
|
||||
zmm_dir_rot TEXT,
|
||||
zmm_discharge TEXT,
|
||||
zmm_discharge_max TEXT,
|
||||
zmm_discharge_min TEXT,
|
||||
zmm_duty TEXT,
|
||||
zmm_eff_motor TEXT,
|
||||
zmm_eff_pump TEXT,
|
||||
zmm_frequency TEXT,
|
||||
zmm_head TEXT,
|
||||
zmm_heading TEXT,
|
||||
zmm_head_max TEXT,
|
||||
zmm_head_minimum TEXT,
|
||||
zmm_idx_eff_mtr TEXT,
|
||||
zmm_idx_eff_pump TEXT,
|
||||
zmm_kvacode TEXT,
|
||||
zmm_maxambtemp TEXT,
|
||||
zmm_mincoolingflow TEXT,
|
||||
zmm_motorseries TEXT,
|
||||
zmm_motor_model TEXT,
|
||||
zmm_outlet TEXT,
|
||||
zmm_phase TEXT,
|
||||
zmm_pressure TEXT,
|
||||
zmm_pumpflowtype TEXT,
|
||||
zmm_pumpseries TEXT,
|
||||
zmm_pump_model TEXT,
|
||||
zmm_ratedpower TEXT,
|
||||
zmm_region TEXT,
|
||||
zmm_servicefactor TEXT,
|
||||
zmm_servicefactormaximumamps TEXT,
|
||||
zmm_speed TEXT,
|
||||
zmm_suction TEXT,
|
||||
zmm_suctionxdelivery TEXT,
|
||||
zmm_supplysource TEXT,
|
||||
zmm_temperature TEXT,
|
||||
zmm_thrustload TEXT,
|
||||
zmm_volts TEXT,
|
||||
zmm_wire TEXT,
|
||||
zmm_package TEXT,
|
||||
zmm_pvarrayrating TEXT,
|
||||
zmm_isi TEXT,
|
||||
zmm_isimotor TEXT,
|
||||
zmm_isipump TEXT,
|
||||
zmm_isipumpset TEXT,
|
||||
zmm_pumpset_model TEXT,
|
||||
zmm_stages TEXT,
|
||||
zmm_headrange TEXT,
|
||||
zmm_overall_efficiency TEXT,
|
||||
zmm_connection TEXT,
|
||||
zmm_min_bore_size TEXT,
|
||||
zmm_isireference TEXT,
|
||||
zmm_category TEXT,
|
||||
zmm_submergence TEXT,
|
||||
zmm_capacitorstart TEXT,
|
||||
zmm_capacitorrun TEXT,
|
||||
zmm_inch TEXT,
|
||||
zmm_motor_type TEXT,
|
||||
zmm_dismantle_direction TEXT,
|
||||
zmm_eff_ovrall TEXT,
|
||||
zmm_bodymoc TEXT,
|
||||
zmm_rotormoc TEXT,
|
||||
zmm_dlwl TEXT,
|
||||
zmm_inputpower TEXT,
|
||||
zmm_imp_od TEXT,
|
||||
zmm_ambtemp TEXT,
|
||||
zmm_de TEXT,
|
||||
zmm_dischargerange TEXT,
|
||||
zmm_efficiency_class TEXT,
|
||||
zmm_framesize TEXT,
|
||||
zmm_impellerdiameter TEXT,
|
||||
zmm_insulationclass TEXT,
|
||||
zmm_maxflow TEXT,
|
||||
zmm_minhead TEXT,
|
||||
zmm_mtrlofconst TEXT,
|
||||
zmm_nde TEXT,
|
||||
zmm_powerfactor TEXT,
|
||||
zmm_tagno TEXT,
|
||||
zmm_year TEXT,
|
||||
zmm_laser_name TEXT,
|
||||
zmm_beenote TEXT,
|
||||
zmm_beenumber TEXT,
|
||||
zmm_beestar TEXT,
|
||||
zmm_logo_ce TEXT,
|
||||
zmm_codeclass TEXT,
|
||||
zmm_colour TEXT,
|
||||
zmm_logo_cp TEXT,
|
||||
zmm_grade TEXT,
|
||||
zmm_grwt_pset TEXT,
|
||||
zmm_grwt_cable TEXT,
|
||||
zmm_grwt_motor TEXT,
|
||||
zmm_grwt_pf TEXT,
|
||||
zmm_grwt_pump TEXT,
|
||||
zmm_isivalve TEXT,
|
||||
zmm_isi_wc TEXT,
|
||||
zmm_labelperiod TEXT,
|
||||
zmm_length TEXT,
|
||||
zmm_license_cml_no TEXT,
|
||||
zmm_mfgmonyr TEXT,
|
||||
zmm_modelyear TEXT,
|
||||
zmm_motoridentification TEXT,
|
||||
zmm_newt_pset TEXT,
|
||||
zmm_newt_cable TEXT,
|
||||
zmm_newt_motor TEXT,
|
||||
zmm_newt_pf TEXT,
|
||||
zmm_newt_pump TEXT,
|
||||
zmm_logo_nsf TEXT,
|
||||
zmm_packtype TEXT,
|
||||
zmm_panel TEXT,
|
||||
zmm_performance_factor TEXT,
|
||||
zmm_pumpidentification TEXT,
|
||||
zmm_psettype TEXT,
|
||||
zmm_size TEXT,
|
||||
zmm_eff_ttl TEXT,
|
||||
zmm_type TEXT,
|
||||
zmm_usp TEXT,
|
||||
zmm_1 TEXT,
|
||||
zmm_2 TEXT,
|
||||
zmm_3 TEXT,
|
||||
zmm_4 TEXT,
|
||||
zmm_5 TEXT,
|
||||
zmm_6 TEXT,
|
||||
zmm_7 TEXT,
|
||||
zmm_8 TEXT,
|
||||
zmm_9 TEXT,
|
||||
zmm_10 TEXT,
|
||||
zmm_11 TEXT,
|
||||
zmm_12 TEXT,
|
||||
zmm_13 TEXT,
|
||||
zmm_14 TEXT,
|
||||
zmm_15 TEXT,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('item_characteristics');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE sticker_structure_details
|
||||
ADD COLUMN plant_id BIGINT NOT NULL,
|
||||
ADD CONSTRAINT sticker_structure_details_plant_id_fkey
|
||||
FOREIGN KEY (plant_id) REFERENCES plants(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
|
||||
$sql2 = <<<'SQL'
|
||||
ALTER TABLE sticker_structure_details
|
||||
ADD COLUMN item_characteristic_id BIGINT NULL,
|
||||
ADD CONSTRAINT sticker_structure_details_item_characteristic_id_fkey
|
||||
FOREIGN KEY (item_characteristic_id) REFERENCES item_characteristics(id);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('sticker_structure_details', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE sticker_details
|
||||
ADD COLUMN characteristics_type TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('sticker_details', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE sticker_details
|
||||
ADD COLUMN curve_radius TEXT DEFAULT NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('sticker_details', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_mapping_masters (
|
||||
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_characteristic_id BIGINT DEFAULT NULL,
|
||||
sticker_structure1_id BIGINT DEFAULT NULL,
|
||||
sticker1_machine_id BIGINT DEFAULT NULL,
|
||||
sticker1_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure2_id BIGINT DEFAULT NULL,
|
||||
sticker2_machine_id BIGINT DEFAULT NULL,
|
||||
sticker2_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure3_id BIGINT DEFAULT NULL,
|
||||
sticker3_machine_id BIGINT DEFAULT NULL,
|
||||
sticker3_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure4_id BIGINT DEFAULT NULL,
|
||||
sticker4_machine_id BIGINT DEFAULT NULL,
|
||||
sticker4_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure5_id BIGINT DEFAULT NULL,
|
||||
sticker5_machine_id BIGINT DEFAULT NULL,
|
||||
sticker5_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure6_id BIGINT DEFAULT NULL,
|
||||
sticker6_machine_id BIGINT DEFAULT NULL,
|
||||
sticker6_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure7_id BIGINT DEFAULT NULL,
|
||||
sticker7_machine_id BIGINT DEFAULT NULL,
|
||||
sticker7_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
sticker_structure8_id BIGINT DEFAULT NULL,
|
||||
sticker8_machine_id BIGINT DEFAULT NULL,
|
||||
sticker8_print_ip TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
||||
FOREIGN KEY (item_characteristic_id) REFERENCES item_characteristics(id),
|
||||
|
||||
FOREIGN KEY (sticker_structure1_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure2_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure3_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure4_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure5_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure6_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure7_id) REFERENCES sticker_structure_details(id),
|
||||
FOREIGN KEY (sticker_structure8_id) REFERENCES sticker_structure_details(id),
|
||||
|
||||
FOREIGN KEY (sticker1_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker2_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker3_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker4_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker5_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker6_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker7_machine_id) REFERENCES machines(id),
|
||||
FOREIGN KEY (sticker8_machine_id) REFERENCES machines(id)
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_mapping_masters');
|
||||
}
|
||||
};
|
||||
@@ -12,23 +12,23 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE sticker_mapping_masters (
|
||||
CREATE TABLE sticker_validations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
sticker1 TEXT DEFAULT NULL,
|
||||
sticker2 TEXT DEFAULT NULL,
|
||||
sticker3 TEXT DEFAULT NULL,
|
||||
sticker4 TEXT DEFAULT NULL,
|
||||
sticker5 TEXT DEFAULT NULL,
|
||||
plant_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
production_order TEXT DEFAULT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
status TEXT DEFAULT NULL,
|
||||
sticker_id TEXT DEFAULT NULL
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items(id)
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
@@ -39,6 +39,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sticker_mapping_masters');
|
||||
Schema::dropIfExists('sticker_validations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('sticker_details', function (Blueprint $table) {
|
||||
$table->dropColumn('image_path');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('sticker_details', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('sticker_details', function (Blueprint $table) {
|
||||
$table->dropColumn('image_type');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('sticker_details', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE spot_rate_transport_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
group_name TEXT NOT NULL,
|
||||
user_name TEXT DEFAULT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('spot_rate_transport_masters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE request_quotations (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
spot_rate_transport_master_id BIGINT NOT NULL,
|
||||
rfq_number TEXT NOT NULL,
|
||||
rfq_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
pickup_address TEXT NOT NULL,
|
||||
delivery_address TEXT NOT NULL,
|
||||
weight TEXT NOT NULL,
|
||||
volumetrice_size_inch TEXT NOT NULL,
|
||||
type_of_vehicle TEXT NOT NULL,
|
||||
special_type TEXT NOT NULL,
|
||||
no_of_vehicle TEXT NOT NULL,
|
||||
product_name TEXT NOT NULL,
|
||||
loading_by TEXT NOT NULL,
|
||||
unloading_by TEXT NOT NULL,
|
||||
pick_and_delivery TEXT NOT NULL,
|
||||
payment_term TEXT NOT NULL,
|
||||
paid_topay TEXT NOT NULL,
|
||||
require_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
rfq_rec_on_or_before TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
transporter_name TEXT NULL,
|
||||
total_freight_charge TEXT NULL,
|
||||
transit_day TEXT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (spot_rate_transport_master_id) REFERENCES spot_rate_transport_masters (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('request_quotations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE rfq_transporter_bids (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
request_quotation_id BIGINT NOT NULL,
|
||||
|
||||
transporter_name TEXT NULL,
|
||||
total_freight_charge TEXT NULL,
|
||||
transit_day TEXT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (request_quotation_id) REFERENCES request_quotations(id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('rfq_transporter_bids');
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user