Compare commits
112 Commits
fix-migrat
...
d1db3e0dad
| Author | SHA1 | Date | |
|---|---|---|---|
| d1db3e0dad | |||
|
|
395df5eda1 | ||
| f274de00e1 | |||
|
|
562dfa5e59 | ||
| f9c6405b61 | |||
|
|
6cbccc018e | ||
| 7ec34a04fc | |||
|
|
d0bd4afe9b | ||
| 9256e1ed12 | |||
|
|
bf2586eabb | ||
| b334ba60fa | |||
|
|
c90d48be52 | ||
| 8c81c140d1 | |||
|
|
560619beb5 | ||
| 5ff8acac74 | |||
|
|
9e2ec1bc8b | ||
| 2f2bab37d4 | |||
|
|
795e930ec6 | ||
| a8d72923ae | |||
|
|
6d2ae5a324 | ||
|
|
530078a4d8 | ||
| e39ab23142 | |||
|
|
0fa69f3398 | ||
| 2373e1d427 | |||
|
|
cfec8df06d | ||
| baa165e285 | |||
|
|
27b8954134 | ||
| 53e671d612 | |||
|
|
37843fe427 | ||
| 58be303cfe | |||
|
|
2a8e589de3 | ||
| a1c39c5f0e | |||
|
|
8c8bd0a853 | ||
| 41e8c04b9d | |||
|
|
4b857f723c | ||
| 6a30fbc8f2 | |||
|
|
f36c9f0df4 | ||
| 9e57461d3a | |||
|
|
2055a768ef | ||
| ab5a6b94c9 | |||
|
|
9913df30c6 | ||
| 84b78ea0c1 | |||
|
|
832c482da2 | ||
| 5e46b080c5 | |||
|
|
2fc1fb73b7 | ||
| 17f337e8db | |||
|
|
09ef1f174c | ||
| 2781d57e3f | |||
|
|
c0f1363fd5 | ||
| 5628e8abd4 | |||
|
|
38d42c5f68 | ||
| e56733ce44 | |||
|
|
a9fa8775dd | ||
| b3f32f6813 | |||
|
|
807285a7a1 | ||
| b2937ccfa8 | |||
|
|
31bc609f60 | ||
| 026e4982b8 | |||
|
|
c2eb18da50 | ||
| 6478bc3722 | |||
|
|
37a1e9a7f3 | ||
| 1ab7ed2da9 | |||
|
|
de17349372 | ||
| 9ecd04f0e3 | |||
|
|
834c643c57 | ||
| 53179ea538 | |||
|
|
5612fc6ceb | ||
| b4e24c581e | |||
|
|
b2887fbc9c | ||
| 4938fa62a7 | |||
|
|
eeddd5da77 | ||
| 01f6288c63 | |||
|
|
ad8192a83f | ||
| c9c7c38088 | |||
|
|
31bc4a7fd0 | ||
| 90cfe9ef0d | |||
|
|
2b52a6e542 | ||
| aa806f2fe3 | |||
|
|
15374002f1 | ||
| 0eb6f76ca6 | |||
|
|
0ef8ba73cc | ||
| 73366ccd70 | |||
|
|
8446282856 | ||
| acbecedce9 | |||
|
|
cac8cdd7ce | ||
| 614d89932b | |||
|
|
2a7db20796 | ||
| c839c6fdbc | |||
|
|
08aaccf1b8 | ||
| d9445a9d4b | |||
|
|
6f77f8ecbc | ||
| 50476c8a2c | |||
|
|
7f55378541 | ||
| c57cfe71ca | |||
|
|
9040f094c1 | ||
| 96c08c34c1 | |||
|
|
ec98c9b2ce | ||
| 19cf7c8edd | |||
|
|
acf326c6ca | ||
| 66086dd2d7 | |||
|
|
e082d5bb49 | ||
| 5da724c9a4 | |||
|
|
e6276378f8 | ||
| 6b723c0929 | |||
|
|
71e8c29801 | ||
| 8e20d0732d | |||
|
|
2524ad4620 | ||
| 1d8fb1c9aa | |||
|
|
a85faafe90 | ||
| 33bbce47ba | |||
|
|
03033c2365 | ||
| 860ff96134 |
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('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('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_path')
|
||||
->label('IMAGE PATH'),
|
||||
ExportColumn::make('image_type')
|
||||
->label('IMAGE TYPE'),
|
||||
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;
|
||||
}
|
||||
}
|
||||
44
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
44
app/Filament/Exports/StickerStructureDetailExporter.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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
|
||||
{
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
ExportColumn::make('sticker_id'),
|
||||
ExportColumn::make('sticker_width'),
|
||||
ExportColumn::make('sticker_height'),
|
||||
ExportColumn::make('sticker_lmargin'),
|
||||
ExportColumn::make('sticker_rmargin'),
|
||||
ExportColumn::make('sticker_tmargin'),
|
||||
ExportColumn::make('sticker_bmargin'),
|
||||
ExportColumn::make('created_at'),
|
||||
ExportColumn::make('updated_at'),
|
||||
ExportColumn::make('created_by'),
|
||||
ExportColumn::make('updated_by'),
|
||||
ExportColumn::make('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;
|
||||
}
|
||||
}
|
||||
73
app/Filament/Imports/StickerDetailImporter.php
Normal file
73
app/Filament/Imports/StickerDetailImporter.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\StickerDetail;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class StickerDetailImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('stickerStructureDetail')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('design_element_type'),
|
||||
ImportColumn::make('element_id'),
|
||||
ImportColumn::make('element_type'),
|
||||
ImportColumn::make('string_value'),
|
||||
ImportColumn::make('string_font'),
|
||||
ImportColumn::make('string_size'),
|
||||
ImportColumn::make('element_colour'),
|
||||
ImportColumn::make('string_align'),
|
||||
ImportColumn::make('string_x_value'),
|
||||
ImportColumn::make('string_y_value'),
|
||||
ImportColumn::make('shape_name'),
|
||||
ImportColumn::make('shape_pen_size'),
|
||||
ImportColumn::make('shape_x1_value'),
|
||||
ImportColumn::make('shape_y1_value'),
|
||||
ImportColumn::make('shape_x2_value'),
|
||||
ImportColumn::make('shape_y2_value'),
|
||||
ImportColumn::make('image_path'),
|
||||
ImportColumn::make('image_type'),
|
||||
ImportColumn::make('image_x'),
|
||||
ImportColumn::make('image_y'),
|
||||
ImportColumn::make('image_width'),
|
||||
ImportColumn::make('image_height'),
|
||||
ImportColumn::make('qr_value'),
|
||||
ImportColumn::make('qr_align'),
|
||||
ImportColumn::make('qr_size'),
|
||||
ImportColumn::make('qr_x_value'),
|
||||
ImportColumn::make('qr_y_value'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerDetail
|
||||
{
|
||||
// return StickerDetail::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
49
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
49
app/Filament/Imports/StickerStructureDetailImporter.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class StickerStructureDetailImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StickerStructureDetail::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('sticker_id'),
|
||||
ImportColumn::make('sticker_width'),
|
||||
ImportColumn::make('sticker_height'),
|
||||
ImportColumn::make('sticker_lmargin'),
|
||||
ImportColumn::make('sticker_rmargin'),
|
||||
ImportColumn::make('sticker_tmargin'),
|
||||
ImportColumn::make('sticker_bmargin'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StickerStructureDetail
|
||||
{
|
||||
// return StickerStructureDetail::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
|
||||
434
app/Filament/Resources/StickerDetailResource.php
Normal file
434
app/Filament/Resources/StickerDetailResource.php
Normal file
@@ -0,0 +1,434 @@
|
||||
<?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_path')
|
||||
->label('Image Path')
|
||||
->alignCenter(),
|
||||
Tables\Columns\TextColumn::make('image_type')
|
||||
->label('Image Type')
|
||||
->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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,10 @@ class StickerMappingMasterResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Master Entries';
|
||||
|
||||
protected static ?int $navigationSort = 16;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
@@ -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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -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,66 @@ 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);
|
||||
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
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');
|
||||
}
|
||||
|
||||
}
|
||||
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/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');
|
||||
}
|
||||
}
|
||||
432
app/Services/StickerPdfService.php
Normal file
432
app/Services/StickerPdfService.php
Normal file
@@ -0,0 +1,432 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\ItemCharacteristic;
|
||||
use App\Models\StickerDetail;
|
||||
use App\Models\StickerStructureDetail;
|
||||
use Illuminate\Support\Collection;
|
||||
use TCPDF;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class StickerPdfService
|
||||
{
|
||||
|
||||
public function generate1(string $stickerId, Collection $dynamicElements, ?ItemCharacteristic $itemCharacteristic)
|
||||
{
|
||||
|
||||
$dynamicValueMap = [];
|
||||
|
||||
foreach ($dynamicElements as $element) {
|
||||
|
||||
$column = $element->characteristics_type;
|
||||
|
||||
$value = '';
|
||||
|
||||
if (
|
||||
$itemCharacteristic &&
|
||||
$column &&
|
||||
Schema::hasColumn('item_characteristics', $column)
|
||||
) {
|
||||
$value = $itemCharacteristic->{$column};
|
||||
}
|
||||
|
||||
$dynamicValueMap[$element->id] = [
|
||||
'design_type' => $element->design_element_type, // Text / Image
|
||||
'value' => $value,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$structure = StickerStructureDetail::where('sticker_id', $stickerId)
|
||||
->first();
|
||||
|
||||
$structureId = $structure->id;
|
||||
$elements = StickerDetail::where(
|
||||
'sticker_structure_detail_id',
|
||||
$structureId
|
||||
)->get();
|
||||
|
||||
$width = (float) $structure->sticker_width;
|
||||
$height = (float) $structure->sticker_height;
|
||||
|
||||
$pdf = new TCPDF('P', 'mm', [$width, $height], true, 'UTF-8', false);
|
||||
|
||||
// $pdf->SetMargins(
|
||||
// (float) $structure->sticker_lmargin,
|
||||
// (float) $structure->sticker_tmargin,
|
||||
// (float) $structure->sticker_rmargin,
|
||||
// );
|
||||
|
||||
// //$pdf->SetAutoPageBreak(false, (float) $structure->sticker_bmargin);
|
||||
// $pdf->SetAutoPageBreak(false, (float) $structure->sticker_bmargin);
|
||||
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
// $pdf->setCellPaddings(0, 0, 0, 0);
|
||||
// $pdf->setCellMargins(5, 5, 5, 5);
|
||||
|
||||
// Set margins
|
||||
//$pdf->SetMargins(5, 5, 5); // left, top, right
|
||||
|
||||
$pdf->SetMargins(
|
||||
(float) $structure->sticker_lmargin,
|
||||
(float) $structure->sticker_tmargin,
|
||||
(float) $structure->sticker_rmargin,
|
||||
);
|
||||
$pdf->SetAutoPageBreak(false, 0);
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetFont('helvetica', 'B', 10);
|
||||
|
||||
|
||||
foreach ($elements as $row) {
|
||||
|
||||
switch ($row->design_element_type) {
|
||||
|
||||
case 'Text':
|
||||
|
||||
$pdf->SetFont(
|
||||
$row->string_font ?? 'helvetica',
|
||||
'',
|
||||
(int) ($row->string_size ?? 10)
|
||||
);
|
||||
|
||||
$pdf->SetTextColor(
|
||||
...$this->hexToRgb($row->element_colour ?? '#000000')
|
||||
);
|
||||
|
||||
$textValue = $row->string_value ?? '';
|
||||
|
||||
if (
|
||||
$row->element_type == 'Dynamic' &&
|
||||
isset($dynamicValueMap[$row->id])
|
||||
) {
|
||||
$textValue = $dynamicValueMap[$row->id]['value'];
|
||||
}
|
||||
|
||||
$pdf->Text(
|
||||
(float) ($row->string_x_value ?? 0),
|
||||
(float) ($row->string_y_value ?? 0),
|
||||
(string) $textValue
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case 'QR':
|
||||
$pdf->write2DBarcode(
|
||||
$row->qr_value ?? '',
|
||||
'QRCODE,H',
|
||||
(float) ($row->qr_x_value ?? 0),
|
||||
(float) ($row->qr_y_value ?? 0),
|
||||
(float) ($row->qr_size ?? 10),
|
||||
(float) ($row->qr_size ?? 10)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'Image':
|
||||
|
||||
$imagePath = null;
|
||||
|
||||
if (
|
||||
$row->element_type == 'Dynamic' &&
|
||||
isset($dynamicValueMap[$row->id]) &&
|
||||
!empty($dynamicValueMap[$row->id]['value'])
|
||||
)
|
||||
{
|
||||
$imageName = strtolower($dynamicValueMap[$row->id]['value']) . '.png';
|
||||
|
||||
$imagePath = public_path('images/' . ltrim($imageName, '/'));
|
||||
}
|
||||
|
||||
|
||||
$pdf->Image(
|
||||
$imagePath,
|
||||
(float) ($row->image_x ?? 0),
|
||||
(float) ($row->image_y ?? 0),
|
||||
(float) ($row->image_width ?? 0),
|
||||
(float) ($row->image_height ?? 0)
|
||||
);
|
||||
break;
|
||||
case 'Shape':
|
||||
if ($row->shape_name == 'Line') {
|
||||
$pdf->SetLineWidth((float) ($row->shape_pen_size ?? 0.3));
|
||||
|
||||
if (isset($row->element_colour)) {
|
||||
$rgb = $this->hexToRgb($row->element_colour);
|
||||
$pdf->SetDrawColor($rgb[0], $rgb[1], $rgb[2]);
|
||||
} else {
|
||||
$pdf->SetDrawColor(0, 0, 0);
|
||||
}
|
||||
|
||||
$pdf->Line(
|
||||
(float) $row->shape_x1_value,
|
||||
(float) $row->shape_y1_value,
|
||||
(float) $row->shape_x2_value,
|
||||
(float) $row->shape_y2_value
|
||||
);
|
||||
} elseif ($row->shape_name == 'Rectangle') {
|
||||
$pdf->SetLineWidth((float) ($row->shape_pen_size ?? 0.3));
|
||||
|
||||
if (isset($row->element_colour)) {
|
||||
$rgb = $this->hexToRgb($row->element_colour);
|
||||
$pdf->SetDrawColor($rgb[0], $rgb[1], $rgb[2]);
|
||||
} else {
|
||||
$pdf->SetDrawColor(0, 0, 0);
|
||||
}
|
||||
|
||||
$x1 = (float) $row->shape_x1_value;
|
||||
$y1 = (float) $row->shape_y1_value;
|
||||
$x2 = (float) $row->shape_x2_value;
|
||||
$y2 = (float) $row->shape_y2_value;
|
||||
|
||||
$x = min($x1, $x2);
|
||||
$y = min($y1, $y2);
|
||||
$width = abs($x2 - $x1);
|
||||
$height = abs($y2 - $y1);
|
||||
|
||||
$pdf->Rect($x, $y, $width, $height, 'D');
|
||||
}
|
||||
elseif ($row->shape_name == 'CurvedRectangle') {
|
||||
$pdf->SetLineWidth((float) ($row->shape_pen_size ?? 0.3));
|
||||
|
||||
if (isset($row->element_colour)) {
|
||||
$rgb = $this->hexToRgb($row->element_colour);
|
||||
$pdf->SetDrawColor($rgb[0], $rgb[1], $rgb[2]);
|
||||
} else {
|
||||
$pdf->SetDrawColor(0, 0, 0);
|
||||
}
|
||||
|
||||
$x1 = (float) $row->shape_x1_value;
|
||||
$y1 = (float) $row->shape_y1_value;
|
||||
$x2 = (float) $row->shape_x2_value;
|
||||
$y2 = (float) $row->shape_y2_value;
|
||||
|
||||
$x = min($x1, $x2);
|
||||
$y = min($y1, $y2);
|
||||
$width = abs($x2 - $x1);
|
||||
$height = abs($y2 - $y1);
|
||||
|
||||
// radius in mm
|
||||
// $radius = 3;
|
||||
$radius = (float) $row->curve_radius;
|
||||
|
||||
$pdf->RoundedRect(
|
||||
$x,
|
||||
$y,
|
||||
$width,
|
||||
$height,
|
||||
$radius,
|
||||
'1111', // ← round all 4 corners (default)
|
||||
'D'
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//return $pdf->Output('sticker.pdf', 'S');
|
||||
$pdfContent = $pdf->Output('sticker.pdf', 'S');
|
||||
return (new Response($pdfContent, 200))
|
||||
->header('Content-Type', 'application/pdf')
|
||||
->header('Content-Disposition', 'inline; filename="sticker.pdf"');
|
||||
|
||||
}
|
||||
|
||||
public function generate(string $stickerId, array $elements)
|
||||
{
|
||||
$structure = StickerStructureDetail::where('sticker_id', $stickerId)
|
||||
->first();
|
||||
|
||||
// $stickerId = $structure->sticker_id;
|
||||
|
||||
// $elements = StickerDetail::where('sticker_structure_detail_id', $stickerId)->get();
|
||||
|
||||
// dd($elements);
|
||||
$structureId = $structure->id;
|
||||
$elements = StickerDetail::where(
|
||||
'sticker_structure_detail_id',
|
||||
$structureId
|
||||
)->get();
|
||||
|
||||
$width = (float) $structure->sticker_width;
|
||||
$height = (float) $structure->sticker_height;
|
||||
|
||||
$pdf = new TCPDF('P', 'mm', [$width, $height], true, 'UTF-8', false);
|
||||
|
||||
// $pdf->SetMargins(
|
||||
// (float) $structure->sticker_lmargin,
|
||||
// (float) $structure->sticker_tmargin,
|
||||
// (float) $structure->sticker_rmargin,
|
||||
// );
|
||||
|
||||
// //$pdf->SetAutoPageBreak(false, (float) $structure->sticker_bmargin);
|
||||
// $pdf->SetAutoPageBreak(false, (float) $structure->sticker_bmargin);
|
||||
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
// $pdf->setCellPaddings(0, 0, 0, 0);
|
||||
$pdf->setCellMargins(5, 5, 5, 5);
|
||||
|
||||
// Set margins
|
||||
$pdf->SetMargins(5, 5, 5); // left, top, right
|
||||
// $pdf->SetAutoPageBreak(false, 0); // bottom = 0
|
||||
|
||||
$pdf->SetMargins(
|
||||
(float) $structure->sticker_lmargin,
|
||||
(float) $structure->sticker_tmargin,
|
||||
(float) $structure->sticker_rmargin,
|
||||
(float) $structure->sticker_bmargin,
|
||||
);
|
||||
|
||||
//$pdf->SetAutoPageBreak(false, (float) $structure->sticker_bmargin);
|
||||
//$pdf->SetAutoPageBreak(false, (float) $structure->sticker_bmargin);
|
||||
|
||||
|
||||
//dd($pdf->getMargins());
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetFont('helvetica', 'B', 10); // font, style, size in points
|
||||
|
||||
// // 📍 ADD TEXT: 3mm from left, 10mm from top
|
||||
// $pdf->Text(3, 10, 'Sticker ID: ' . $stickerId);
|
||||
|
||||
// // Optional: add more text
|
||||
// $pdf->SetFont('helvetica', '', 8);
|
||||
// $pdf->Text(45, 45, 'Batch: X1');
|
||||
// $pdf->Text(3, 20, '✓ Valid');
|
||||
|
||||
|
||||
foreach ($elements as $row) {
|
||||
|
||||
switch ($row->design_element_type) {
|
||||
|
||||
case 'Text':
|
||||
$pdf->SetFont(
|
||||
$row->string_font ?? 'helvetica',
|
||||
'',
|
||||
(int) ($row->string_size ?? 10)
|
||||
);
|
||||
$pdf->SetTextColor(...$this->hexToRgb($row->element_colour ?? '#000000'));
|
||||
$pdf->Text(
|
||||
(float) ($row->string_x_value ?? 0),
|
||||
(float) ($row->string_y_value ?? 0),
|
||||
$row->string_value ?? ''
|
||||
);
|
||||
break;
|
||||
|
||||
case 'QR':
|
||||
$pdf->write2DBarcode(
|
||||
$row->qr_value ?? '',
|
||||
'QRCODE,H',
|
||||
(float) ($row->qr_x_value ?? 0),
|
||||
(float) ($row->qr_y_value ?? 0),
|
||||
(float) ($row->qr_size ?? 10),
|
||||
(float) ($row->qr_size ?? 10)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'Image':
|
||||
if (empty($row->image_path)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$imagePath = storage_path('app/public/' . ltrim($row->image_path, '/'));
|
||||
|
||||
// Optional: check if file actually exists (avoid TCPDF crash)
|
||||
if (!file_exists($imagePath)) {
|
||||
// Log or skip — or use a placeholder
|
||||
break;
|
||||
}
|
||||
|
||||
$pdf->Image(
|
||||
$imagePath,
|
||||
(float) ($row->image_x ?? 0),
|
||||
(float) ($row->image_y ?? 0),
|
||||
(float) ($row->image_width ?? 0),
|
||||
(float) ($row->image_height ?? 0)
|
||||
);
|
||||
break;
|
||||
case 'Shape':
|
||||
if ($row->shape_name == 'Line') {
|
||||
$pdf->SetLineWidth((float) ($row->shape_pen_size ?? 0.3));
|
||||
|
||||
if (isset($row->element_colour)) {
|
||||
$rgb = $this->hexToRgb($row->element_colour);
|
||||
$pdf->SetDrawColor($rgb[0], $rgb[1], $rgb[2]);
|
||||
} else {
|
||||
$pdf->SetDrawColor(0, 0, 0);
|
||||
}
|
||||
|
||||
$pdf->Line(
|
||||
(float) $row->shape_x1_value,
|
||||
(float) $row->shape_y1_value,
|
||||
(float) $row->shape_x2_value,
|
||||
(float) $row->shape_y2_value
|
||||
);
|
||||
} elseif ($row->shape_name == 'Rectangle') {
|
||||
$pdf->SetLineWidth((float) ($row->shape_pen_size ?? 0.3));
|
||||
|
||||
if (isset($row->element_colour)) {
|
||||
$rgb = $this->hexToRgb($row->element_colour);
|
||||
$pdf->SetDrawColor($rgb[0], $rgb[1], $rgb[2]);
|
||||
} else {
|
||||
$pdf->SetDrawColor(0, 0, 0);
|
||||
}
|
||||
|
||||
$x1 = (float) $row->shape_x1_value;
|
||||
$y1 = (float) $row->shape_y1_value;
|
||||
$x2 = (float) $row->shape_x2_value;
|
||||
$y2 = (float) $row->shape_y2_value;
|
||||
|
||||
$x = min($x1, $x2);
|
||||
$y = min($y1, $y2);
|
||||
$width = abs($x2 - $x1);
|
||||
$height = abs($y2 - $y1);
|
||||
|
||||
$pdf->Rect($x, $y, $width, $height, 'D');
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//return $pdf->Output('sticker.pdf', 'S');
|
||||
$pdfContent = $pdf->Output('sticker.pdf', 'S');
|
||||
return (new Response($pdfContent, 200))
|
||||
->header('Content-Type', 'application/pdf')
|
||||
->header('Content-Disposition', 'inline; filename="sticker.pdf"');
|
||||
}
|
||||
|
||||
// private function hexToRgb($hex)
|
||||
// {
|
||||
// $hex = ltrim($hex, '#');
|
||||
// return [
|
||||
// hexdec(substr($hex, 0, 2)),
|
||||
// hexdec(substr($hex, 2, 2)),
|
||||
// hexdec(substr($hex, 4, 2)),
|
||||
// ];
|
||||
// }
|
||||
private function hexToRgb($hex)
|
||||
{
|
||||
if (!is_string($hex) || ($hex = trim($hex)) === '') {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
$hex = ltrim($hex, '#');
|
||||
if (strlen($hex) == 3) {
|
||||
$hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
|
||||
}
|
||||
if (strlen($hex) !== 6 || !ctype_xdigit($hex)) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
return [
|
||||
hexdec(substr($hex, 0, 2)), // integer
|
||||
hexdec(substr($hex, 2, 2)), // integer
|
||||
hexdec(substr($hex, 4, 2)) // integer
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
117
resources/views/fields/generate-template.blade.php
Normal file
117
resources/views/fields/generate-template.blade.php
Normal file
@@ -0,0 +1,117 @@
|
||||
{{-- @php
|
||||
$sticker_id = $attributes->get('sticker_id');
|
||||
\Log::info('Sticker ID in Blade:', ['sticker_id' => $sticker_id]);
|
||||
@endphp
|
||||
|
||||
<div class="flex flex-col items-start space-y-2">
|
||||
@if (!empty($sticker_id))
|
||||
<a href="{{ route('stickers.pdf', $sticker_id) }}"
|
||||
target="_blank"
|
||||
class="px-2 py-1 border border-success-500 text-success-600 rounded hover:bg-success-50 hover:border-success-700 transition text-sm">
|
||||
Generate Template
|
||||
</a>
|
||||
@else
|
||||
<span class="text-gray-500">
|
||||
Enter Sticker ID to generate template
|
||||
</span>
|
||||
@endif
|
||||
</div> --}}
|
||||
|
||||
{{-- @props(['sticker_id']) --}}
|
||||
@props([
|
||||
'sticker_id',
|
||||
'plant_id',
|
||||
'item_characteristic_id',
|
||||
])
|
||||
|
||||
|
||||
{{-- @php
|
||||
$var = $sticker_id ?? 'undefined';
|
||||
\Log::info('Blade Debug: sticker_id type = ' . gettype($var));
|
||||
\Log::info('Blade Debug: sticker_id value = ', ['value' => $var]);
|
||||
|
||||
$isValid = $sticker_id && $sticker_id != 'empty';
|
||||
$url = $isValid ? route('stickers.pdf', ['stickerId' => $sticker_id]) : '#';
|
||||
@endphp --}}
|
||||
|
||||
{{-- @php
|
||||
use App\Models\StickerStructureDetail;
|
||||
|
||||
$isValid = false;
|
||||
|
||||
if (!empty($sticker_id) && $sticker_id != 'empty') {
|
||||
$isValid = StickerStructureDetail::where('sticker_id', $sticker_id)->exists();
|
||||
}
|
||||
|
||||
$url = $isValid
|
||||
? route('stickers.pdf', ['stickerId' => $sticker_id])
|
||||
: '#';
|
||||
@endphp --}}
|
||||
|
||||
@php
|
||||
use App\Models\StickerStructureDetail;
|
||||
|
||||
$hasStickerId = !empty($sticker_id) && $sticker_id != 'empty';
|
||||
|
||||
$hasPlantAndItem = !empty($plant_id) && !empty($item_characteristic_id);
|
||||
|
||||
$isValid = false;
|
||||
|
||||
if ($hasStickerId) {
|
||||
$isValid = StickerStructureDetail::where('sticker_id', $sticker_id)->exists();
|
||||
}
|
||||
|
||||
$url = $isValid
|
||||
? route('stickers.pdf', [
|
||||
'stickerId' => $sticker_id,
|
||||
// include only if present
|
||||
'plant_id' => $hasPlantAndItem ? $plant_id : null,
|
||||
'item_characteristic_id' => $hasPlantAndItem ? $item_characteristic_id : null,
|
||||
])
|
||||
: '#';
|
||||
@endphp
|
||||
|
||||
|
||||
<div class="flex flex-col items-start space-y-2">
|
||||
<a
|
||||
href="{{ $url }}"
|
||||
@if(!$isValid)
|
||||
onclick="alert('Sticker ID not found in sticker structure details'); return false;"
|
||||
@endif
|
||||
target="_blank"
|
||||
class="px-2 py-1 border
|
||||
{{ $isValid
|
||||
? 'border-success-500 text-success-600 hover:bg-success-50 hover:border-success-700'
|
||||
: 'border-gray-300 text-gray-400 cursor-not-allowed' }}
|
||||
rounded transition text-sm"
|
||||
>
|
||||
Generate Template
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{{-- <div class="flex flex-col items-start space-y-2">
|
||||
<a
|
||||
href="{{ $url }}"
|
||||
@if(!$isValid)
|
||||
onclick="alert('Please enter a Sticker ID first'); return false;"
|
||||
@endif
|
||||
target="_blank"
|
||||
class="px-2 py-1 border
|
||||
{{ $isValid
|
||||
? 'border-success-500 text-success-600 hover:bg-success-50 hover:border-success-700'
|
||||
: 'border-gray-300 text-gray-400 cursor-not-allowed' }}
|
||||
rounded transition text-sm"
|
||||
>
|
||||
Generate Template
|
||||
</a>
|
||||
</div> --}}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\PdfController;
|
||||
use App\Mail\test;
|
||||
use App\Models\EquipmentMaster;
|
||||
use App\Models\InvoiceValidation;
|
||||
@@ -25,6 +26,11 @@ use App\Http\Livewire\CustomLogin;
|
||||
]);
|
||||
});
|
||||
|
||||
Route::get(
|
||||
'/stickers/{stickerId}/pdf/{plantId?}/{itemCharacteristicId?}',
|
||||
[PdfController::class, 'generate']
|
||||
)->name('stickers.pdf');
|
||||
|
||||
Route::get('/part-validation-image/{plant}/{filename}', function ($plant, $filename) {
|
||||
$path = storage_path("app/private/uploads/PartValidation/{$plant}/{$filename}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user