Compare commits
1 Commits
9a2a6bdd9b
...
gha-test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfed40f535 |
30
.github/workflows/pint.yaml
vendored
Normal file
30
.github/workflows/pint.yaml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Laravel Pint
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
pint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Reinstall system libraries to ensure compatibility
|
||||
- name: Ensure system libraries are up-to-date
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --reinstall --yes git libc6
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: "8.3"
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --no-interaction --prefer-dist --no-progress
|
||||
|
||||
# Run pint in test mode, check only files different from master branch
|
||||
- name: Run Laravel Pint in test mode
|
||||
run: vendor/bin/pint --test --diff=master
|
||||
@@ -280,8 +280,8 @@ class SendInvoiceReport extends Command
|
||||
|
||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||
|
||||
// $startDate = now()->setTime(8, 0, 0);
|
||||
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
$startDate = now()->setTime(8, 0, 0);
|
||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
|
||||
$serialTableData = [];
|
||||
$materialTableData = [];
|
||||
@@ -293,16 +293,6 @@ class SendInvoiceReport extends Command
|
||||
: [$plantIdArg];
|
||||
|
||||
$no = 1;
|
||||
if (strtolower($schedule) == 'daily')
|
||||
{
|
||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||
$endDate = now()->setTime(8, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$startDate = now()->setTime(8, 0, 0);
|
||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||
}
|
||||
foreach ($plantIds as $plantId) {
|
||||
$plant = Plant::find($plantId);
|
||||
$plantName = $plant ? $plant->name : $plantId;
|
||||
|
||||
@@ -193,9 +193,6 @@ class SendProductionReport extends Command
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
//..
|
||||
|
||||
//.
|
||||
|
||||
foreach ($plants as $plant)
|
||||
{
|
||||
@@ -207,7 +204,7 @@ class SendProductionReport extends Command
|
||||
->whereBetween('created_at', [$PlanstartDate, $planendDate])
|
||||
->sum('plan_quantity');
|
||||
|
||||
if (strtolower($line->type) == 'fg line') {
|
||||
if (strtolower($line->type) === 'fg line') {
|
||||
$productionQuantity = \App\Models\QualityValidation::where('plant_id', $plant->id)
|
||||
->where('line_id', $line->id)
|
||||
->whereBetween('created_at', [$startDate, $endDate])
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,131 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\DeviceMasterResource\Pages;
|
||||
use App\Filament\Resources\DeviceMasterResource\RelationManagers;
|
||||
use App\Models\DeviceMaster;
|
||||
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\Section;
|
||||
|
||||
class DeviceMasterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DeviceMaster::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationGroup = 'Power House';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('Device Name')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('mac_address')
|
||||
->label('MAC Address'),
|
||||
Forms\Components\TextInput::make('ip_address')
|
||||
->label('IP Address'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
])
|
||||
->columns(4),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
->label('ID')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
->label('Device Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('mac_address')
|
||||
->label('MAC Address')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('ip_address')
|
||||
->label('IP Address')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->alignCenter()
|
||||
->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\ListDeviceMasters::route('/'),
|
||||
'create' => Pages\CreateDeviceMaster::route('/create'),
|
||||
'view' => Pages\ViewDeviceMaster::route('/{record}'),
|
||||
'edit' => Pages\EditDeviceMaster::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DeviceMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DeviceMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDeviceMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DeviceMasterResource::class;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DeviceMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DeviceMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDeviceMaster extends EditRecord
|
||||
{
|
||||
protected static string $resource = DeviceMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DeviceMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DeviceMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDeviceMasters extends ListRecords
|
||||
{
|
||||
protected static string $resource = DeviceMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DeviceMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DeviceMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewDeviceMaster extends ViewRecord
|
||||
{
|
||||
protected static string $resource = DeviceMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ use Filament\Forms;
|
||||
use Filament\Forms\Components\Actions\Action as ActionsAction;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -930,16 +929,6 @@ class InvoiceValidationResource extends Resource
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Radio::make('invoice_type')
|
||||
->label('Type ?')
|
||||
->boolean()
|
||||
->options([
|
||||
'Serial' => 'Serial',
|
||||
'Material' => 'Material'
|
||||
])
|
||||
->default('Serial')
|
||||
->inlineLabel(false)
|
||||
->inline(),
|
||||
Select::make('Plant')
|
||||
->label('Select Plant')
|
||||
->nullable()
|
||||
@@ -949,7 +938,6 @@ class InvoiceValidationResource extends Resource
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
$set('sticker_master_id', null);
|
||||
$set('operator_id', null);
|
||||
}),
|
||||
TextInput::make('invoice_number')
|
||||
->label('Invoice Number')
|
||||
@@ -974,31 +962,6 @@ class InvoiceValidationResource extends Resource
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Select::make('scanned_status')
|
||||
->label('Scanned Status')
|
||||
->nullable()
|
||||
->options([
|
||||
'Scanned' => 'Scanned',
|
||||
'Pending' => 'Pending',
|
||||
])
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Select::make('operator_id')
|
||||
->label('Created By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (!$plantId)
|
||||
{
|
||||
return InvoiceValidation::whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
return InvoiceValidation::where('plant_id', $plantId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
@@ -1012,46 +975,10 @@ class InvoiceValidationResource extends Resource
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['invoice_type']) || (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
|
||||
if(empty($data['invoice_type']))
|
||||
{
|
||||
Notification::make()
|
||||
->title('Please, choose invoice type to filter.')
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
if (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['sticker_master_id'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if ($data['invoice_type'] == 'Serial') {
|
||||
$query->whereNull('quantity');
|
||||
|
||||
if (!empty($data['scanned_status'])) {
|
||||
if ($data['scanned_status'] == 'Scanned') {
|
||||
$query->whereNotNull('scanned_status')->where('scanned_status', '!=', '');
|
||||
} elseif ($data['scanned_status'] == 'Pending') {
|
||||
//$query->whereNull('scanned_status')->orWhere('scanned_status', '');
|
||||
$query->where(function ($query) use ($data) {
|
||||
// if (empty($data['scanned_status']) || $data['scanned_status'] == 'Pending') {
|
||||
$query->whereNull('scanned_status')->orWhere('scanned_status', '!=', 'Scanned');
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
} elseif ($data['invoice_type'] == 'Material') {
|
||||
$query->whereNotNull('quantity');//->where('quantity', '>', 0)
|
||||
|
||||
if (!empty($data['scanned_status'])) {
|
||||
if ($data['scanned_status'] == 'Scanned') {
|
||||
$query->whereNotNull('serial_number')->where('serial_number', '!=', '');
|
||||
} elseif ($data['scanned_status'] == 'Pending') {
|
||||
$query->where(function ($query) use ($data) {
|
||||
$query->whereNull('serial_number')->orWhere('serial_number', '=', '');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data['Plant'])) { //$plant = $data['Plant'] ?? null
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
}
|
||||
@@ -1072,10 +999,6 @@ class InvoiceValidationResource extends Resource
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (!empty($data['operator_id'])) {
|
||||
$query->where('operator_id', $data['operator_id']);
|
||||
}
|
||||
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
|
||||
->pluck('id')
|
||||
@@ -1101,15 +1024,6 @@ class InvoiceValidationResource extends Resource
|
||||
$indicators[] = 'Serial Number: ' . $data['serial_number'];
|
||||
}
|
||||
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Code: ' . $itemCode;
|
||||
}
|
||||
|
||||
if (!empty($data['operator_id'])) {
|
||||
$indicators[] = 'Created By: ' . $data['operator_id'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$indicators[] = 'From: ' . $data['created_from'];
|
||||
}
|
||||
@@ -1118,8 +1032,9 @@ class InvoiceValidationResource extends Resource
|
||||
$indicators[] = 'To: ' . $data['created_to'];
|
||||
}
|
||||
|
||||
if (!empty($data['scanned_status'])) {
|
||||
$indicators[] = 'Scanned Status: ' . $data['scanned_status'];
|
||||
if (!empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Code: ' . $itemCode;
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
|
||||
@@ -521,7 +521,7 @@ class PalletValidationResource extends Resource
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$selectedPalletNumber = $data['pallet_list'];
|
||||
return redirect()->route('download-reprint-qr-pdf', ['palletNo' => $selectedPalletNumber]);
|
||||
return redirect()->route('download-qr-pdf', ['palletNo' => $selectedPalletNumber]);
|
||||
|
||||
})
|
||||
->visible(function() {
|
||||
|
||||
@@ -1035,7 +1035,6 @@ class ProductionQuantityResource extends Resource
|
||||
$set('Shift', null);
|
||||
$set('Item', null);
|
||||
$set('sap_msg_status', null);
|
||||
$set('operator_id', null);
|
||||
}),
|
||||
|
||||
//line
|
||||
@@ -1051,10 +1050,7 @@ class ProductionQuantityResource extends Resource
|
||||
return Line::where('plant_id', $plantId)
|
||||
->pluck('name', 'id');
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('operator_id', null);
|
||||
}),
|
||||
->reactive(),
|
||||
|
||||
//block
|
||||
Select::make('Block')
|
||||
@@ -1071,7 +1067,6 @@ class ProductionQuantityResource extends Resource
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Shift', null);
|
||||
$set('operator_id', null);
|
||||
}),
|
||||
|
||||
//shift
|
||||
@@ -1090,10 +1085,7 @@ class ProductionQuantityResource extends Resource
|
||||
->where('block_id', $blockId)
|
||||
->pluck('name', 'id');
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('operator_id', null);
|
||||
}),
|
||||
->reactive(),
|
||||
|
||||
TextInput::make('production_order')
|
||||
->label('Production Order')
|
||||
@@ -1141,37 +1133,6 @@ class ProductionQuantityResource extends Resource
|
||||
// ->options(QualityValidation::whereNotNull('sap_msg_status')->select('sap_msg_status')->distinct()->pluck('sap_msg_status', 'sap_msg_status'))
|
||||
->reactive(),
|
||||
|
||||
Select::make('operator_id')
|
||||
->label('Created By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
$shiftId = $get('Shift');
|
||||
if (!$plantId && !$lineId && !$shiftId)
|
||||
{
|
||||
return ProductionQuantity::whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
else if ($plantId && !$lineId && !$shiftId)
|
||||
{
|
||||
return ProductionQuantity::where('plant_id', $plantId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
else if ($plantId && $lineId && !$shiftId)
|
||||
{
|
||||
return ProductionQuantity::where('plant_id', $plantId)->where('line_id', $lineId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
else if ($plantId && !$lineId && $shiftId)
|
||||
{
|
||||
return ProductionQuantity::where('plant_id', $plantId)->where('shift_id', $shiftId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
else// if ($plantId && $lineId && $shiftId)
|
||||
{
|
||||
return ProductionQuantity::where('plant_id', $plantId)->where('line_id', $lineId)->where('shift_id', $shiftId)->whereNotNull('operator_id')->select('operator_id')->distinct()->pluck('operator_id', 'operator_id');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
@@ -1185,7 +1146,7 @@ class ProductionQuantityResource extends Resource
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
if (empty($data['Plant']) && empty($data['Shift']) && empty($data['Line']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['Item']) && empty($data['operator_id']) && empty($data['sap_msg_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['Shift']) && empty($data['Line']) && empty($data['production_order']) && empty($data['serial_number']) && empty($data['Item']) && empty($data['sap_msg_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -1217,10 +1178,6 @@ class ProductionQuantityResource extends Resource
|
||||
$query->where('sap_msg_status', $data['sap_msg_status']);
|
||||
}
|
||||
|
||||
if (!empty($data['operator_id'])) {
|
||||
$query->where('operator_id', $data['operator_id']);
|
||||
}
|
||||
|
||||
if ($from = $data['created_from'] ?? null) {
|
||||
$query->where('created_at', '>=', $from);
|
||||
}
|
||||
@@ -1228,7 +1185,6 @@ class ProductionQuantityResource extends Resource
|
||||
if ($to = $data['created_to'] ?? null) {
|
||||
$query->where('created_at', '<=', $to);
|
||||
}
|
||||
|
||||
// return $query;
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
@@ -1262,10 +1218,6 @@ class ProductionQuantityResource extends Resource
|
||||
$indicators[] = 'SAP Message Status: ' . $data['sap_msg_status'];
|
||||
}
|
||||
|
||||
if (!empty($data['operator_id'])) {
|
||||
$indicators[] = 'Created By: ' . $data['operator_id'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$indicators[] = 'From: ' . $data['created_from'];
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,23 +17,23 @@ class PalletController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
public function downloadReprintQrPdf($palletNo)
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
$qrCode = new QrCode($palletNo);
|
||||
$output = new Output\Png();
|
||||
$qrBinary = $output->output($qrCode, 100);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
return '
|
||||
$html = '
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; padding: 0; width: 60mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
||||
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; page-break-after: always; }
|
||||
.qr-cell { width: 14mm; text-align: right; vertical-align: bottom; padding-left: 0mm; padding-top: 0mm; }
|
||||
.text-cell { text-align: left; vertical-align: middle; font-size: 20pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
||||
img.qr { width: 19mm; height: 19mm; display: block; }
|
||||
</style>
|
||||
<style>
|
||||
body { margin: 0; padding: 0; width: 60mm; height: 14mm; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
||||
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; }
|
||||
.qr-cell { width: 14mm; text-align: left; vertical-align: middle; padding-left: 6mm; padding-top: 2mm; }
|
||||
.text-cell { text-align: left; vertical-align: middle; font-size: 15pt; padding-left: 4mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
||||
img.qr { width: 18mm; height: 18mm; display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="sticker-table">
|
||||
@@ -46,89 +46,23 @@ class PalletController extends Controller
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
window.print();
|
||||
setTimeout(function () {
|
||||
window.close();
|
||||
}, 500); // Wait 0.5 seconds before closing
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
// $mpdf = new Mpdf([
|
||||
// 'mode' => 'utf-8',
|
||||
// 'format' => [60, 14],
|
||||
// 'margin_left' => 0,
|
||||
// 'margin_right' => 0,
|
||||
// 'margin_top' => 0,
|
||||
// 'margin_bottom' => 0,
|
||||
// // 'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||
// ]);
|
||||
$mpdf = new Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => [60, 14],
|
||||
'margin_left' => 0,
|
||||
'margin_right' => 0,
|
||||
'margin_top' => 0,
|
||||
'margin_bottom' => 0,
|
||||
'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||
]);
|
||||
|
||||
// $mpdf->WriteHTML($html);
|
||||
// // Output PDF to browser for printing
|
||||
// $mpdf->Output('qr-label.pdf', 'I');
|
||||
}
|
||||
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
$qrCode = new QrCode($palletNo);
|
||||
$output = new Output\Png();
|
||||
$qrBinary = $output->output($qrCode, 100);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
$htmlBlock = '
|
||||
<table class="sticker-table">
|
||||
<tr>
|
||||
<td class="qr-cell">
|
||||
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
||||
</td>
|
||||
<td class="text-cell">
|
||||
' . htmlspecialchars($palletNo) . '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
return '
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; padding: 0; width: 60mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
||||
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; page-break-after: always; }
|
||||
.qr-cell { width: 14mm; text-align: right; vertical-align: bottom; padding-left: -8mm; padding-top: 0mm; }
|
||||
.text-cell { text-align: left; vertical-align: middle; font-size: 22pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
||||
img.qr { width: 19mm; height: 19mm; display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
' . $htmlBlock . $htmlBlock . '
|
||||
<script>
|
||||
window.onload = function () {
|
||||
window.print();
|
||||
setTimeout(function () {
|
||||
window.close();
|
||||
}, 1000); // Wait 1 second before closing
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>';
|
||||
|
||||
// $mpdf = new Mpdf([
|
||||
// 'mode' => 'utf-8',
|
||||
// 'format' => [60, 14],
|
||||
// 'margin_left' => 0,
|
||||
// 'margin_right' => 0,
|
||||
// 'margin_top' => 0,
|
||||
// 'margin_bottom' => 0,
|
||||
// // 'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||
// ]);
|
||||
|
||||
// $mpdf->WriteHTML($html);
|
||||
// // Output PDF to browser for printing
|
||||
// $mpdf->Output('qr-label.pdf', 'I');
|
||||
$mpdf->WriteHTML($html);
|
||||
$mpdf->Output('qr-label.pdf', 'I');
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\ProductionQuantity;
|
||||
use App\Models\StickerMaster;
|
||||
use Illuminate\Http\Request;
|
||||
use Mpdf\Mpdf;
|
||||
use Mpdf\QrCode\Output;
|
||||
use Mpdf\QrCode\QrCode;
|
||||
|
||||
class ProductionStickerReprintController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
|
||||
$parts = explode('|', $palletNo);
|
||||
$itemCode = trim($parts[0]);
|
||||
$serial = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
// Retrieve the item record by item code
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
if (!$item) {
|
||||
abort(404, "Item with code {$itemCode} not found.");
|
||||
}
|
||||
|
||||
$itemId = $item->id;
|
||||
|
||||
$production = ProductionQuantity::where('item_id', $itemId)
|
||||
->where('serial_number', $serial)
|
||||
->first();
|
||||
|
||||
if (!$production) {
|
||||
abort(404, "Production data for item code '{$itemCode}' with serial '{$serial}' not found.");
|
||||
}
|
||||
|
||||
$productionOrder = $production->production_order;
|
||||
|
||||
$qrCode = new QrCode($palletNo);
|
||||
$output = new Output\Png();
|
||||
$qrBinary = $output->output($qrCode, 100);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
$sticker = StickerMaster::where('item_id', $itemId)->first();
|
||||
|
||||
// Decide number of copies
|
||||
$copies = 1;
|
||||
|
||||
if ($sticker) {
|
||||
if ($sticker->serial_number_pump == 1) {
|
||||
// If pump is selected (regardless of motor), 2 copies
|
||||
$copies = 2;
|
||||
} elseif ($sticker->serial_number_motor == 1) {
|
||||
// Only motor selected, 1 copy
|
||||
$copies = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return '
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 60mm;
|
||||
height: 14mm;
|
||||
font-size: 10pt;
|
||||
font-family: Arial Narrow, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.sticker-table {
|
||||
width: 60mm;
|
||||
height: 14mm;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.text-cell {
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
font-size: 10pt;
|
||||
padding: 2mm 2mm 0 0;
|
||||
white-space: normal;
|
||||
font-weight: normal;
|
||||
line-height: 0.3;
|
||||
}
|
||||
|
||||
.text-row {
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
font-weight: bold;
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
||||
.serial {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.po-number {
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
.desc-row {
|
||||
font-weight: normal;
|
||||
font-size: 7pt;
|
||||
}
|
||||
|
||||
.qr-cell {
|
||||
width: 14mm;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
padding-left: 1mm;
|
||||
padding-top: 0mm;
|
||||
}
|
||||
|
||||
img.qr {
|
||||
width: 13mm;
|
||||
height: 13mm;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="print-container"></div>
|
||||
|
||||
<script>
|
||||
const copies = ' . $copies . ';
|
||||
const htmlBlock = `
|
||||
<table class="sticker-table">
|
||||
<tr>
|
||||
<td class="qr-cell">
|
||||
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
||||
</td>
|
||||
<td class="text-cell">
|
||||
<div class="text-row">
|
||||
<pre><span class="serial">' . htmlspecialchars($serial) . '</span> <span class="po-number">' . htmlspecialchars($productionOrder) . '</span></pre>
|
||||
</div>
|
||||
<div class="desc-row">
|
||||
' . htmlspecialchars($item->description) . '
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
`;
|
||||
|
||||
const container = document.getElementById("print-container");
|
||||
for (let i = 0; i < copies; i++) {
|
||||
container.insertAdjacentHTML("beforeend", htmlBlock);
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
window.print();
|
||||
setTimeout(function () {
|
||||
window.close();
|
||||
}, 500);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
|
||||
// //Get sticker master data
|
||||
// $sticker = StickerMaster::where('item_id', $itemId)->first();
|
||||
|
||||
// //Decide number of copies
|
||||
// $copies = 1; // default
|
||||
// if ($sticker) {
|
||||
// if ($sticker->serial_number_motor == 1) {
|
||||
// $copies = 1;
|
||||
// } elseif (is_null($sticker->serial_number_motor) && $sticker->serial_number_pump == 1) {
|
||||
// $copies = 2;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $mpdf = new Mpdf([
|
||||
// 'mode' => 'utf-8',
|
||||
// 'format' => [60, 14],
|
||||
// 'margin_left' => 0,
|
||||
// 'margin_right' => 0,
|
||||
// 'margin_top' => 0,
|
||||
// 'margin_bottom' => 0,
|
||||
// ]);
|
||||
|
||||
// for ($i = 0; $i < $copies; $i++) {
|
||||
// $mpdf->WriteHTML($html);
|
||||
// if ($i < $copies - 1) {
|
||||
// $mpdf->AddPage();
|
||||
// }
|
||||
// }
|
||||
|
||||
// $mpdf->Output('qr-label.pdf', 'I');
|
||||
// exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -81,9 +81,6 @@ class UserController extends Controller
|
||||
//$user = User::where('email', $email)->first();
|
||||
if (Hash::check($header_pass, $existUser->password)) {
|
||||
return response()->json([
|
||||
'created_at' => $existUser->created_at->format('Y-m-d H:i:s'),
|
||||
'updated_at' => $existUser->updated_at->format('Y-m-d H:i:s'),
|
||||
'email' => $existUser->email,
|
||||
'roles' => $existUser->roles()->pluck('name')->toArray()
|
||||
], 200);
|
||||
} else {
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class DeviceMaster extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'name',
|
||||
'mac_address',
|
||||
'ip_address',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\DeviceMaster;
|
||||
use App\Models\User;
|
||||
|
||||
class DeviceMasterPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, DeviceMaster $devicemaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, DeviceMaster $devicemaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, DeviceMaster $devicemaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, DeviceMaster $devicemaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, DeviceMaster $devicemaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, DeviceMaster $devicemaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete DeviceMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any DeviceMaster');
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?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 device_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
name TEXT NOT NULL,
|
||||
mac_address TEXT DEFAULT NULL,
|
||||
ip_address TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
created_by TEXT NULL,
|
||||
|
||||
UNIQUE (name, plant_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('device_masters');
|
||||
}
|
||||
};
|
||||
@@ -1,72 +0,0 @@
|
||||
<x-filament-panels::page>
|
||||
<div class="space-y-4">
|
||||
|
||||
{{-- Heading label --}}
|
||||
<h2 class="text-xl font-semibold text-gray-800">
|
||||
STICKER RE-PRINT
|
||||
</h2>
|
||||
{{-- Render the Select form fields --}}
|
||||
<div class="space-y-4">
|
||||
{{-- {{ $this->filtersForm($this->form) }} --}}
|
||||
{{ $this->form }}
|
||||
</div>
|
||||
|
||||
{{-- <input
|
||||
type="text"
|
||||
id="qr-scan-input"
|
||||
class="border border-gray-300 rounded px-4 py-2 text-sm w-full"
|
||||
placeholder="Scan QR Code & Press Enter"
|
||||
autocomplete="off"
|
||||
autofocus
|
||||
/> --}}
|
||||
<div class="mb-4">
|
||||
<label for="qr-scan-input" class="block text-sm font-medium text-gray-700 mb-2">
|
||||
SCAN QR CODE
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="qr-scan-input"
|
||||
class="border border-gray-300 rounded px-4 py-2 text-sm w-full"
|
||||
placeholder="Scan QR Code & Press Enter"
|
||||
autocomplete="off"
|
||||
autofocus
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const scanInput = document.getElementById('qr-scan-input');
|
||||
if (!scanInput) return;
|
||||
|
||||
scanInput.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
|
||||
const value = scanInput.value.trim();
|
||||
|
||||
if (value !== '') {
|
||||
Livewire.dispatch('handleQrScan', { value: value });
|
||||
scanInput.value = '';
|
||||
}
|
||||
}
|
||||
});
|
||||
window.addEventListener('open-pdf', event => {
|
||||
const pdfUrl = event.detail.url;
|
||||
const win = window.open(pdfUrl, '_blank');
|
||||
if (!win) {
|
||||
console.warn('Popup blocked. Please allow popups for this site.');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
{{-- Render the chart widget below the form --}}
|
||||
<div class="mt-6">
|
||||
@livewire(\App\Filament\Widgets\ItemOverview::class)
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</x-filament-panels::page>
|
||||
@@ -82,8 +82,6 @@ Route::get('sticker/get-master-type-data', [StickerMasterController::class, 'get
|
||||
|
||||
Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf');
|
||||
|
||||
Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf');
|
||||
|
||||
Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf');
|
||||
|
||||
//Production Dashboard Controller
|
||||
|
||||
Reference in New Issue
Block a user