Compare commits
5 Commits
3053098cfb
...
qds
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c070c9763e | ||
|
|
2116ea422e | ||
|
|
acc98ad876 | ||
|
|
45898b2fa2 | ||
|
|
390e013ccb |
92
app/Filament/Exports/MfmReadingExporter.php
Normal file
92
app/Filament/Exports/MfmReadingExporter.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\MfmReading;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class MfmReadingExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = MfmReading::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
|
return [
|
||||||
|
ExportColumn::make('no')
|
||||||
|
->label('NO')
|
||||||
|
->state(function ($record) use (&$rowNumber) {
|
||||||
|
// Increment and return the row number
|
||||||
|
return ++$rowNumber;
|
||||||
|
}),
|
||||||
|
ExportColumn::make('plant.name')
|
||||||
|
->label('PLANT'),
|
||||||
|
ExportColumn::make('mfmMeter.name')
|
||||||
|
->label('MFM METER NAME'),
|
||||||
|
ExportColumn::make('apparent_energy_received')
|
||||||
|
->label('APPARENT ENERGY RECEIVED'),
|
||||||
|
ExportColumn::make('reactive_energy_received')
|
||||||
|
->label('REACTIVE ENERGY RECEIVED'),
|
||||||
|
ExportColumn::make('active_energy_received')
|
||||||
|
->label('ACTIVE ENERGY RECEIVED'),
|
||||||
|
ExportColumn::make('active_power_r')
|
||||||
|
->label('ACTIVE POWER R'),
|
||||||
|
ExportColumn::make('active_power_y')
|
||||||
|
->label('ACTIVE POWER Y'),
|
||||||
|
ExportColumn::make('active_power_b')
|
||||||
|
->label('ACTIVE POWER B'),
|
||||||
|
ExportColumn::make('active_power_total')
|
||||||
|
->label('ACTIVE POWER TOTAL'),
|
||||||
|
ExportColumn::make('voltage_ry')
|
||||||
|
->label('VOLTAGE RY'),
|
||||||
|
ExportColumn::make('voltage_yb')
|
||||||
|
->label('VOLTAGE YB'),
|
||||||
|
ExportColumn::make('voltage_br')
|
||||||
|
->label('VOLTAGE BR'),
|
||||||
|
ExportColumn::make('current_r')
|
||||||
|
->label('CURRENT R'),
|
||||||
|
ExportColumn::make('current_y')
|
||||||
|
->label('CURRENT Y'),
|
||||||
|
ExportColumn::make('current_b')
|
||||||
|
->label('CURRENT B'),
|
||||||
|
ExportColumn::make('current_n')
|
||||||
|
->label('CURRENT N'),
|
||||||
|
ExportColumn::make('voltage_r_n')
|
||||||
|
->label('VOLTAGE R N'),
|
||||||
|
ExportColumn::make('voltage_y_n')
|
||||||
|
->label('VOLTAGE Y N'),
|
||||||
|
ExportColumn::make('voltage_b_n')
|
||||||
|
->label('VOLTAGE B N'),
|
||||||
|
ExportColumn::make('frequency')
|
||||||
|
->label('FREQUENCY'),
|
||||||
|
ExportColumn::make('power_factor_r')
|
||||||
|
->label('POWER FACTOR R'),
|
||||||
|
ExportColumn::make('power_factor_y')
|
||||||
|
->label('POWER FACTOR Y'),
|
||||||
|
ExportColumn::make('power_factor_b')
|
||||||
|
->label('POWER FACTOR B'),
|
||||||
|
ExportColumn::make('power_factor_total')
|
||||||
|
->label('POWER FACTOR TOTAL'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->label('DELETED AT')
|
||||||
|
->enabledByDefault(false),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your mfm reading 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
51
app/Filament/Exports/TempLiveReadingExporter.php
Normal file
51
app/Filament/Exports/TempLiveReadingExporter.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\TempLiveReading;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class TempLiveReadingExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = TempLiveReading::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
|
return [
|
||||||
|
ExportColumn::make('no')
|
||||||
|
->label('NO')
|
||||||
|
->state(function ($record) use (&$rowNumber) {
|
||||||
|
return ++$rowNumber;
|
||||||
|
}),
|
||||||
|
ExportColumn::make('plant.name')
|
||||||
|
->label('PLANT'),
|
||||||
|
ExportColumn::make('mfmMeter.name')
|
||||||
|
->label('MFM METER NAME'),
|
||||||
|
ExportColumn::make('register_data')
|
||||||
|
->label('REGISTER DATA'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->label('DELETED AT')
|
||||||
|
->enabledByDefault(false),
|
||||||
|
ExportColumn::make('created_by')
|
||||||
|
->label('CREATED BY'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your temp live reading 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Exports;
|
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Filament\Actions\Exports\ExportColumn;
|
|
||||||
use Filament\Actions\Exports\Exporter;
|
|
||||||
use Filament\Actions\Exports\Models\Export;
|
|
||||||
|
|
||||||
class UserExporter extends Exporter
|
|
||||||
{
|
|
||||||
protected static ?string $model = User::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
static $rowNumber = 0;
|
|
||||||
return [
|
|
||||||
// ExportColumn::make('id')
|
|
||||||
// ->label('ID'),
|
|
||||||
ExportColumn::make('no')
|
|
||||||
->label('NO')
|
|
||||||
->state(function ($record) use (&$rowNumber) {
|
|
||||||
// Increment and return the row number
|
|
||||||
return ++$rowNumber;
|
|
||||||
}),
|
|
||||||
ExportColumn::make('name')
|
|
||||||
->label('NAME'),
|
|
||||||
ExportColumn::make('email')
|
|
||||||
->label('E-MAIL'),
|
|
||||||
ExportColumn::make('password')
|
|
||||||
->label('PASSWORD'),
|
|
||||||
ExportColumn::make('roles')
|
|
||||||
->label('ROLES')
|
|
||||||
->state(function ($record) {
|
|
||||||
// Assuming Spatie\Permission: roles() relationship
|
|
||||||
return $record->roles->pluck('name')->join(', ');
|
|
||||||
}),
|
|
||||||
ExportColumn::make('created_at')
|
|
||||||
->label('CREATED AT'),
|
|
||||||
ExportColumn::make('updated_at')
|
|
||||||
->label('UPDATED AT'),
|
|
||||||
ExportColumn::make('deleted_at')
|
|
||||||
->enabledByDefault(false)
|
|
||||||
->label('DELETED AT'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
|
||||||
{
|
|
||||||
$body = 'Your user 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -36,6 +36,7 @@ class DeviceMasterImporter extends Importer
|
|||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('IP Address')
|
->exampleHeader('IP Address')
|
||||||
->label('IP Address')
|
->label('IP Address')
|
||||||
|
->example('172.31.76.67')
|
||||||
->rules(['required', 'ip']),
|
->rules(['required', 'ip']),
|
||||||
ImportColumn::make('created_by')
|
ImportColumn::make('created_by')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class LineStopImporter extends Importer
|
|||||||
public function resolveRecord(): ?LineStop
|
public function resolveRecord(): ?LineStop
|
||||||
{
|
{
|
||||||
$warnMsg = [];
|
$warnMsg = [];
|
||||||
if (Str::length($this->data['code']) < 3 || !ctype_alnum($this->data['code'])) {
|
if (Str::length($this->data['code']) < 6 || !ctype_alnum($this->data['code'])) {
|
||||||
$warnMsg[] = "Invalid line stop code found";
|
$warnMsg[] = "Invalid line stop code found";
|
||||||
}
|
}
|
||||||
if (Str::length($this->data['reason']) < 5) {
|
if (Str::length($this->data['reason']) < 5) {
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ class MfmMeterImporter extends Importer
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Plant Name')
|
->exampleHeader('Plant Name')
|
||||||
->example('Ransar Industries-I')
|
->example('Ransar Industries-I')
|
||||||
->label('Plant Name')
|
->label('Plant Name')
|
||||||
->relationship(resolveUsing:'name')
|
->relationship(resolveUsing:'name')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('Device Name')
|
ImportColumn::make('devicemaster')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Device Name')
|
->exampleHeader('Device Name')
|
||||||
->example('REG001')
|
->example('REG001')
|
||||||
|
|||||||
186
app/Filament/Imports/MfmReadingImporter.php
Normal file
186
app/Filament/Imports/MfmReadingImporter.php
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
|
use App\Models\MfmReading;
|
||||||
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
|
use Filament\Actions\Imports\Importer;
|
||||||
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
|
||||||
|
class MfmReadingImporter extends Importer
|
||||||
|
{
|
||||||
|
protected static ?string $model = MfmReading::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ImportColumn::make('plant')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Plant Name')
|
||||||
|
->example('Ransar Industries-I')
|
||||||
|
->label('Plant Name')
|
||||||
|
->relationship(resolveUsing:'name')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('mfmMeter')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Mfm Meter Name')
|
||||||
|
->example('Display SSB')
|
||||||
|
->label('Display SSB')
|
||||||
|
->relationship(resolveUsing:'name')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('apparent_energy_received')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Apparent Energy Received')
|
||||||
|
->example('1084610')
|
||||||
|
->label('Apparent Energy Received')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('reactive_energy_received')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Reactive Energy Received')
|
||||||
|
->example('347496.9')
|
||||||
|
->label('Reactive Energy Received')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('active_energy_received')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Active Energy Received')
|
||||||
|
->example('611717.1')
|
||||||
|
->label('Active Energy Received')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('active_power_r')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Active Power R')
|
||||||
|
->example('3.974')
|
||||||
|
->label('Active Power R')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('active_power_y')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Active Power Y')
|
||||||
|
->example('0.796')
|
||||||
|
->label('Active Power Y')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('active_power_b')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Active Power B')
|
||||||
|
->example('1.397')
|
||||||
|
->label('Active Power B')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('active_power_total')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Active Power Total')
|
||||||
|
->example('6.433')
|
||||||
|
->label('Active Power Total')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('voltage_ry')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Voltage RY')
|
||||||
|
->example('413.308')
|
||||||
|
->label('Voltage RY')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('voltage_yb')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Voltage YB')
|
||||||
|
->example('415.305')
|
||||||
|
->label('Voltage YB')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('voltage_br')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Voltage BR')
|
||||||
|
->example('415.216')
|
||||||
|
->label('Voltage BR')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('current_r')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Current R')
|
||||||
|
->example('17.446')
|
||||||
|
->label('Current R')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('current_y')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Current Y')
|
||||||
|
->example('4.801')
|
||||||
|
->label('Current Y')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('current_b')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Current B')
|
||||||
|
->example('7.04')
|
||||||
|
->label('Current B')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('current_n')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Current N')
|
||||||
|
->example('14.063')
|
||||||
|
->label('Current N')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('voltage_r_n')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Voltage R N')
|
||||||
|
->example('237.898')
|
||||||
|
->label('Voltage R N')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('voltage_y_n')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Voltage Y N')
|
||||||
|
->example('239.518')
|
||||||
|
->label('Voltage Y N')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('voltage_b_n')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Voltage B N')
|
||||||
|
->example('240.798')
|
||||||
|
->label('Voltage B N')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('frequency')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Frequency')
|
||||||
|
->example('50.228')
|
||||||
|
->label('Frequency')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('power_factor_r')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Power Factor R')
|
||||||
|
->example('0.988')
|
||||||
|
->label('Power Factor R')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('power_factor_y')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Power Factor Y')
|
||||||
|
->example('0.764')
|
||||||
|
->label('Power Factor Y')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('power_factor_b')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Power Factor B')
|
||||||
|
->example('0.849')
|
||||||
|
->label('Power Factor B')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('power_factor_total')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Power Factor Total')
|
||||||
|
->example('0.919')
|
||||||
|
->label('Power Factor Total')
|
||||||
|
->rules(['required']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolveRecord(): ?MfmReading
|
||||||
|
{
|
||||||
|
// return MfmReading::firstOrNew([
|
||||||
|
// // Update existing records, matching them by `$this->data['column_name']`
|
||||||
|
// 'email' => $this->data['email'],
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
return new MfmReading();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
{
|
||||||
|
$body = 'Your mfm reading 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
66
app/Filament/Imports/TempLiveReadingImporter.php
Normal file
66
app/Filament/Imports/TempLiveReadingImporter.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
|
use App\Models\TempLiveReading;
|
||||||
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
|
use Filament\Actions\Imports\Importer;
|
||||||
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
|
||||||
|
class TempLiveReadingImporter extends Importer
|
||||||
|
{
|
||||||
|
protected static ?string $model = TempLiveReading::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ImportColumn::make('plant')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Plant Name')
|
||||||
|
->example('Ransar Industries-I')
|
||||||
|
->label('Plant Name')
|
||||||
|
->relationship(resolveUsing:'name')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('mfmMeter')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Mfm Meter Name')
|
||||||
|
->example('Display SSB')
|
||||||
|
->label('Mfm Meter Name')
|
||||||
|
->relationship(resolveUsing:'name')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('register_data')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Register Data')
|
||||||
|
->example('65165,5646,561,561')
|
||||||
|
->label('Register Data')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('created_by')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Created By')
|
||||||
|
->example('Admin')
|
||||||
|
->label('Created By')
|
||||||
|
->rules(['required']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolveRecord(): ?TempLiveReading
|
||||||
|
{
|
||||||
|
// return TempLiveReading::firstOrNew([
|
||||||
|
// // Update existing records, matching them by `$this->data['column_name']`
|
||||||
|
// 'email' => $this->data['email'],
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
return new TempLiveReading();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
{
|
||||||
|
$body = 'Your temp live reading 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Imports;
|
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
|
||||||
use Filament\Actions\Imports\Importer;
|
|
||||||
use Filament\Actions\Imports\Models\Import;
|
|
||||||
use Spatie\Permission\Models\Role;
|
|
||||||
use Str;
|
|
||||||
|
|
||||||
class UserImporter extends Importer
|
|
||||||
{
|
|
||||||
protected static ?string $model = User::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ImportColumn::make('name')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Name')
|
|
||||||
->example('RAW00001')
|
|
||||||
->label('Name')
|
|
||||||
->rules(['required']),//, 'max:255'
|
|
||||||
ImportColumn::make('email')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('E-mail')
|
|
||||||
->example('RAW00001@cripumps.com')
|
|
||||||
->label('E-mail')
|
|
||||||
->rules(['required', 'email']),//, 'max:255'
|
|
||||||
ImportColumn::make('password')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Password')
|
|
||||||
->example('RAW00001')
|
|
||||||
->label('Password')
|
|
||||||
->rules(['required']),//, 'max:255'
|
|
||||||
ImportColumn::make('roles')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Roles')
|
|
||||||
->example('Employee')
|
|
||||||
->label('Roles')
|
|
||||||
->rules(['nullable', 'string']), // Optional roles
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resolveRecord(): ?User
|
|
||||||
{
|
|
||||||
$warnMsg = [];
|
|
||||||
if (Str::length($this->data['name']) < 1) {
|
|
||||||
$warnMsg[] = "User name not found!";
|
|
||||||
}
|
|
||||||
// || !is_numeric($this->data['code']) || !preg_match('/^[1-9]\d{3,}$/', $this->data['code'])
|
|
||||||
if (Str::length($this->data['email']) < 5) {
|
|
||||||
$warnMsg[] = "Invalid email found!";
|
|
||||||
}
|
|
||||||
if (Str::length($this->data['password']) < 3) {
|
|
||||||
$warnMsg[] = "Invalid password found!";
|
|
||||||
}
|
|
||||||
// Validate roles if provided
|
|
||||||
$roles = [];
|
|
||||||
if (!empty($this->data['roles'])) {
|
|
||||||
$roles = collect(explode(',', $this->data['roles']))
|
|
||||||
->map(fn($role) => trim($role))
|
|
||||||
->filter()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
foreach ($roles as $roleName) {
|
|
||||||
if (!Role::where('name', $roleName)->exists()) {
|
|
||||||
$warnMsg[] = "Role : '{$roleName}' does not exist!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$warnMsg[] = "User roles not found!";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($warnMsg)) {
|
|
||||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
|
||||||
}
|
|
||||||
|
|
||||||
$user = User::updateOrCreate([
|
|
||||||
'email' => $this->data['email'],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'name' => $this->data['name'],
|
|
||||||
'password' => $this->data['password'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Assign roles
|
|
||||||
if (!empty($roles)) {
|
|
||||||
$user->syncRoles($roles);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
// return User::firstOrNew([
|
|
||||||
// // Update existing records, matching them by `$this->data['column_name']`
|
|
||||||
// 'email' => $this->data['email'],
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
//return new User();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
|
||||||
{
|
|
||||||
$body = 'Your user 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,15 +12,11 @@ class CreateAlertMailRule extends CreateRecord
|
|||||||
|
|
||||||
protected function mutateFormDataBeforeCreate(array $data): array
|
protected function mutateFormDataBeforeCreate(array $data): array
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($data['is_active']) {
|
if ($data['is_active']) {
|
||||||
$data['plant'] = 0;
|
$data['plant'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateBlock extends CreateRecord
|
class CreateBlock extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = BlockResource::class;
|
protected static string $resource = BlockResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateCompany extends CreateRecord
|
class CreateCompany extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = CompanyResource::class;
|
protected static string $resource = CompanyResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateConfiguration extends CreateRecord
|
class CreateConfiguration extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ConfigurationResource::class;
|
protected static string $resource = ConfigurationResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateDeviceMaster extends CreateRecord
|
class CreateDeviceMaster extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = DeviceMasterResource::class;
|
protected static string $resource = DeviceMasterResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateEbReading extends CreateRecord
|
class CreateEbReading extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = EbReadingResource::class;
|
protected static string $resource = EbReadingResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,11 +61,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processInvoice($invoiceNumber)
|
public function processInvoice($invoiceNumber)
|
||||||
{
|
{
|
||||||
$invoiceNumber = trim($invoiceNumber);
|
$invoiceNumber = trim($invoiceNumber);
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateItem extends CreateRecord
|
class CreateItem extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ItemResource::class;
|
protected static string $resource = ItemResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateLine extends CreateRecord
|
class CreateLine extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = LineResource::class;
|
protected static string $resource = LineResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateLineStop extends CreateRecord
|
class CreateLineStop extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = LineStopResource::class;
|
protected static string $resource = LineStopResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord
|
|||||||
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-locator-invoice-validation';
|
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-locator-invoice-validation';
|
||||||
|
|
||||||
public $plantId;
|
public $plantId;
|
||||||
|
|
||||||
public $invoice_number;
|
public $invoice_number;
|
||||||
|
|
||||||
public $pallet_number;
|
public $pallet_number;
|
||||||
|
|
||||||
public $serial_number, $snoCount;
|
public $serial_number, $snoCount;
|
||||||
@@ -31,13 +29,8 @@ class CreateLocatorInvoiceValidation extends CreateRecord
|
|||||||
public $locator_number;
|
public $locator_number;
|
||||||
|
|
||||||
public array $matchedSerialNumbersForRemoval = [];
|
public array $matchedSerialNumbersForRemoval = [];
|
||||||
|
|
||||||
public bool $showRemoveSerialsModal = false;
|
public bool $showRemoveSerialsModal = false;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processinvoiceSNo()
|
public function processinvoiceSNo()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateLocator extends CreateRecord
|
class CreateLocator extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = LocatorResource::class;
|
protected static string $resource = LocatorResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ class MachineResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $get('plant_id'))->where('no_of_operation', '>', 0)->pluck('name', 'id')->toArray();
|
return Line::where('plant_id', $get('plant_id'))
|
||||||
|
->pluck('name', 'id')
|
||||||
|
->toArray();
|
||||||
})
|
})
|
||||||
->default(function () {
|
->default(function () {
|
||||||
return optional(Machine::latest()->first())->line_id;
|
return optional(Machine::latest()->first())->line_id;
|
||||||
@@ -85,13 +87,13 @@ class MachineResource extends Resource
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// $grpWrkCnr = Line::find($lineId)->group_work_center;
|
$grpWrkCnr = Line::find($lineId)->group_work_center;
|
||||||
// if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
|
if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
|
||||||
// {
|
{
|
||||||
// $set('mLineError', 'Please select a group work center line.');
|
$set('mLineError', 'Please select a group work center line.');
|
||||||
// $set('line_id', null);
|
$set('line_id', null);
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
$set('mLineError', null);
|
$set('mLineError', null);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMachine extends CreateRecord
|
class CreateMachine extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MachineResource::class;
|
protected static string $resource = MachineResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class MfmMeterResource extends Resource
|
|||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
ImportAction::make()
|
ImportAction::make()
|
||||||
->importer(MfmMeterImporter::class)
|
->importer(MfmMeterImporter::class)
|
||||||
->visible(function() {
|
->visible(function() {
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMfmMeter extends CreateRecord
|
class CreateMfmMeter extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MfmMeterResource::class;
|
protected static string $resource = MfmMeterResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMfmParameter extends CreateRecord
|
class CreateMfmParameter extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MfmParameterResource::class;
|
protected static string $resource = MfmParameterResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Exports\MfmReadingExporter;
|
||||||
|
use App\Filament\Imports\MfmReadingImporter;
|
||||||
use App\Filament\Resources\MfmReadingResource\Pages;
|
use App\Filament\Resources\MfmReadingResource\Pages;
|
||||||
use App\Filament\Resources\MfmReadingResource\RelationManagers;
|
use App\Filament\Resources\MfmReadingResource\RelationManagers;
|
||||||
use App\Models\MfmReading;
|
use App\Models\MfmReading;
|
||||||
@@ -12,6 +14,9 @@ use Filament\Tables;
|
|||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Filament\Tables\Actions\ImportAction;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
|
||||||
class MfmReadingResource extends Resource
|
class MfmReadingResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -196,6 +201,18 @@ class MfmReadingResource extends Resource
|
|||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
ImportAction::make()
|
||||||
|
->importer(MfmReadingImporter::class)
|
||||||
|
->visible(function() {
|
||||||
|
return Filament::auth()->user()->can('view import mfm reading');
|
||||||
|
}),
|
||||||
|
ExportAction::make()
|
||||||
|
->exporter(MfmReadingExporter::class)
|
||||||
|
->visible(function() {
|
||||||
|
return Filament::auth()->user()->can('view export mfm reading');
|
||||||
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMfmReading extends CreateRecord
|
class CreateMfmReading extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MfmReadingResource::class;
|
protected static string $resource = MfmReadingResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateModuleList extends CreateRecord
|
class CreateModuleList extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ModuleListResource::class;
|
protected static string $resource = ModuleListResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMotorTestingMaster extends CreateRecord
|
class CreateMotorTestingMaster extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MotorTestingMasterResource::class;
|
protected static string $resource = MotorTestingMasterResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,33 +14,24 @@ use Illuminate\View\View;
|
|||||||
class CreatePalletValidation extends CreateRecord
|
class CreatePalletValidation extends CreateRecord
|
||||||
{
|
{
|
||||||
public $plantId;
|
public $plantId;
|
||||||
|
|
||||||
public $pallet_number;
|
public $pallet_number;
|
||||||
|
|
||||||
public $palletNo;
|
public $palletNo;
|
||||||
|
|
||||||
public $pendingPallet;
|
public $pendingPallet;
|
||||||
|
|
||||||
public $snoCount = 0;
|
public $snoCount = 0;
|
||||||
|
|
||||||
public $pallet_number_locked = false;
|
public $pallet_number_locked = false;
|
||||||
|
|
||||||
public $serial_number;
|
public $serial_number;
|
||||||
|
|
||||||
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
|
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
|
||||||
|
|
||||||
protected static string $resource = PalletValidationResource::class;
|
protected static string $resource = PalletValidationResource::class;
|
||||||
|
|
||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
|
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
|
||||||
];
|
];
|
||||||
|
|
||||||
public ?array $data = null;
|
public ?array $data = null;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processPalletSNo()
|
public function processPalletSNo()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreatePlant extends CreateRecord
|
class CreatePlant extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = PlantResource::class;
|
protected static string $resource = PlantResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2093,52 +2093,10 @@ class QualityValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($state == $expectedValue)
|
|
||||||
// {
|
|
||||||
// $set('part_validation5_error', null);
|
|
||||||
// }
|
|
||||||
// else if (strpos($state, '/') != false) {
|
|
||||||
// $parts = explode('/', $state);
|
|
||||||
// if (count($parts) >= 2) {
|
|
||||||
// $segmentToValidate = $parts[1];
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// $segmentToValidate = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// $set('part_validation5_error', "Invalid input for part validation 5.");
|
|
||||||
// $set('part_validation5', null);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
if ($state == $expectedValue)
|
if ($state == $expectedValue)
|
||||||
{
|
{
|
||||||
$set('part_validation5_error', null);
|
$set('part_validation5_error', null);
|
||||||
}
|
}
|
||||||
else if (strpos($state, '/') != false)
|
|
||||||
{
|
|
||||||
$parts = explode('/', $state);
|
|
||||||
if (count($parts) >= 2)
|
|
||||||
{
|
|
||||||
$segmentToValidate = $parts[1];
|
|
||||||
if ($segmentToValidate == $expectedValue) {
|
|
||||||
$set('part_validation5_error', null);
|
|
||||||
$set('part_validation5', $segmentToValidate);
|
|
||||||
} else {
|
|
||||||
$set('part_validation5_error', "Invalid input for part validation 5.");
|
|
||||||
$set('part_validation5', null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$set('part_validation5_error', "Invalid input format for part validation 5.");
|
|
||||||
$set('part_validation5', null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$set('part_validation5_error', "Invalid input for part validation 5.");
|
$set('part_validation5_error', "Invalid input for part validation 5.");
|
||||||
@@ -2529,8 +2487,7 @@ class QualityValidationResource extends Resource
|
|||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
//,,
|
||||||
|
|
||||||
// public static function mutateFormDataBeforeCreate(array $data): array
|
// public static function mutateFormDataBeforeCreate(array $data): array
|
||||||
// {
|
// {
|
||||||
// $user =Filament::auth()->user();
|
// $user =Filament::auth()->user();
|
||||||
|
|||||||
@@ -21,11 +21,6 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
protected static string $resource = ReworkLocatorInvoiceValidationResource::class;
|
protected static string $resource = ReworkLocatorInvoiceValidationResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processInvoiceRework($invoiceNo)
|
public function processInvoiceRework($invoiceNo)
|
||||||
{
|
{
|
||||||
$plantId = $this->form->getState()['plant'];
|
$plantId = $this->form->getState()['plant'];
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateShift extends CreateRecord
|
class CreateShift extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ShiftResource::class;
|
protected static string $resource = ShiftResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ use Filament\Tables\Table;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Filament\Forms\Get;
|
use Filament\Forms\Get;
|
||||||
use Filament\Forms\Set;
|
|
||||||
use Filament\Tables\Actions\ExportAction;
|
use Filament\Tables\Actions\ExportAction;
|
||||||
use Filament\Tables\Actions\ImportAction;
|
use Filament\Tables\Actions\ImportAction;
|
||||||
// use Illuminate\Validation\Rule;
|
// use Illuminate\Validation\Rule;
|
||||||
@@ -154,26 +153,12 @@ class StickerMasterResource extends Resource
|
|||||||
->hint(fn ($get) => $get('item_error') ? $get('item_error') : null)
|
->hint(fn ($get) => $get('item_error') ? $get('item_error') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
|
|
||||||
|
|
||||||
Forms\Components\TextInput::make('item_description')
|
Forms\Components\TextInput::make('item_description')
|
||||||
->label('Description')
|
->label('Description')
|
||||||
->required()
|
->required()
|
||||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
->reactive()
|
||||||
if ($get('id')) {
|
->readOnly(true),
|
||||||
$itemId = StickerMaster::where('id', $get('id'))->first()?->item_id;
|
|
||||||
if ($itemId) {
|
|
||||||
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
|
|
||||||
if ($item) {
|
|
||||||
$set('item_description', $item);
|
|
||||||
} else {
|
|
||||||
$set('item_description', null);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$set('item_description', null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->reactive()
|
|
||||||
->readOnly(true),
|
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation1')
|
Forms\Components\TextInput::make('part_validation1')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|||||||
@@ -21,9 +21,4 @@ class CreateStickerMaster extends CreateRecord
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,4 @@ class CreateTempLiveReading extends CreateRecord
|
|||||||
{
|
{
|
||||||
return 'Create Live Readings';
|
return 'Create Live Readings';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Exports\UserExporter;
|
|
||||||
use App\Filament\Imports\UserImporter;
|
|
||||||
use App\Filament\Resources\UserResource\Pages;
|
use App\Filament\Resources\UserResource\Pages;
|
||||||
use App\Filament\Resources\UserResource\RelationManagers;
|
use App\Filament\Resources\UserResource\RelationManagers;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Actions\ExportAction;
|
|
||||||
use Filament\Tables\Actions\ImportAction;
|
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@@ -85,7 +80,6 @@ class UserResource extends Resource
|
|||||||
// ->label('ID')
|
// ->label('ID')
|
||||||
// ->numeric()
|
// ->numeric()
|
||||||
// ->sortable(),
|
// ->sortable(),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('No.')
|
Tables\Columns\TextColumn::make('No.')
|
||||||
->label('No.')
|
->label('No.')
|
||||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
@@ -140,18 +134,6 @@ class UserResource extends Resource
|
|||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
])
|
|
||||||
->headerActions([
|
|
||||||
ImportAction::make()
|
|
||||||
->importer(UserImporter::class)
|
|
||||||
->visible(function() {
|
|
||||||
return Filament::auth()->user()->can('view import user');
|
|
||||||
}),
|
|
||||||
ExportAction::make()
|
|
||||||
->exporter(UserExporter::class)
|
|
||||||
->visible(function() {
|
|
||||||
return Filament::auth()->user()->can('view export user');
|
|
||||||
}),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,4 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateUser extends CreateRecord
|
class CreateUser extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = UserResource::class;
|
protected static string $resource = UserResource::class;
|
||||||
|
|
||||||
protected function getRedirectUrl(): string
|
|
||||||
{
|
|
||||||
return $this->getResource()::getUrl('create');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
90
app/Http/Controllers/ChatbotController.php
Normal file
90
app/Http/Controllers/ChatbotController.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Gemini\Laravel\Facades\Gemini;
|
||||||
|
|
||||||
|
class ChatbotController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
// public function handleMessage(Request $request)
|
||||||
|
// {
|
||||||
|
// $request->validate(['message' => 'required|string']);
|
||||||
|
// $userMessage = $request->input('message');
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// $result = Gemini::geminiPro()->generateContent($userMessage);
|
||||||
|
// $reply = $result->text() ?? 'Sorry, no response from Gemini AI.';
|
||||||
|
// } catch (\Exception $e) {
|
||||||
|
// \Log::error('Gemini API Exception: ' . $e->getMessage(), ['trace' => $e->getTraceAsString()]);
|
||||||
|
// if (config('app.debug')) {
|
||||||
|
// return response()->json(['reply' => 'Error: ' . $e->getMessage()], 500);
|
||||||
|
// }
|
||||||
|
// return response()->json(['reply' => 'Error communicating with Gemini AI. Please try again later.'], 500);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return response()->json(['reply' => $reply]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function handleMessage(Request $request)
|
||||||
|
// {
|
||||||
|
// $request->validate([
|
||||||
|
// 'message' => 'required|string'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $apiKey = env('GEMINI_API_KEY'); // Put this in .env
|
||||||
|
|
||||||
|
// $response = Http::withHeaders([
|
||||||
|
// 'Content-Type' => 'application/json',
|
||||||
|
// 'x-goog-api-key' => $apiKey
|
||||||
|
// ])->post('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent', [
|
||||||
|
// 'contents' => [
|
||||||
|
// ['parts' => [['text' => $request->message]]]
|
||||||
|
// ]
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// if ($response->successful()) {
|
||||||
|
// return response()->json([
|
||||||
|
// 'reply' => $response->json()['candidates'][0]['content']['parts'][0]['text'] ?? 'No response.'
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return response()->json(['reply' => 'Failed to fetch response.'], 500);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,18 @@ class InvoiceValidationController extends Controller
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$plantCode = $request->header('plant-code');
|
||||||
|
$invoiceNo = $request->header('invoice-number');
|
||||||
|
$lineQuan = $request->header('line-quantity');
|
||||||
|
|
||||||
|
if (!$plantCode) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Plant Code value can't be empty"
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
|
|
||||||
if (!isset($data['plant_code']) || trim($data['plant_code']) == '')
|
if (!isset($data['plant_code']) || trim($data['plant_code']) == '')
|
||||||
@@ -58,7 +70,8 @@ class InvoiceValidationController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
$plant = Plant::where('code', $data['plant_code'])->first();
|
||||||
if (!$plant) {
|
if (!$plant)
|
||||||
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Plant not found!'
|
'status_description' => 'Plant not found!'
|
||||||
|
|||||||
@@ -73,6 +73,68 @@ class PalletController extends Controller
|
|||||||
// $mpdf->Output('qr-label.pdf', 'I');
|
// $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;}
|
||||||
|
// .qr-cell { width: 14mm;}
|
||||||
|
// .text-cell { text-align: left; vertical-align: middle; font-size: 22pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; font-weight: bold; }
|
||||||
|
// img.qr { width: 19mm; height: 19mm; display: block; margin-left: -2mm;}
|
||||||
|
// </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');
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
|
||||||
public function downloadQrPdf($palletNo)
|
public function downloadQrPdf($palletNo)
|
||||||
{
|
{
|
||||||
$qrCode = new QrCode($palletNo);
|
$qrCode = new QrCode($palletNo);
|
||||||
@@ -80,7 +142,7 @@ class PalletController extends Controller
|
|||||||
$qrBinary = $output->output($qrCode, 100);
|
$qrBinary = $output->output($qrCode, 100);
|
||||||
$qrBase64 = base64_encode($qrBinary);
|
$qrBase64 = base64_encode($qrBinary);
|
||||||
|
|
||||||
$htmlBlock = '
|
$htmlBlock = '
|
||||||
<table class="sticker-table">
|
<table class="sticker-table">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="qr-cell">
|
<td class="qr-cell">
|
||||||
@@ -92,48 +154,43 @@ class PalletController extends Controller
|
|||||||
</tr>
|
</tr>
|
||||||
</table>';
|
</table>';
|
||||||
|
|
||||||
return '
|
$html = '
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
body { margin: 0; padding: 0; width: 60mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
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; }
|
.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; }
|
.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: 22pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
.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; }
|
img.qr { width: 16mm; height: 16mm; display: block; margin-left: -2mm;}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
' . $htmlBlock . $htmlBlock . '
|
' . $htmlBlock . $htmlBlock . '
|
||||||
<script>
|
<script>
|
||||||
window.onload = function () {
|
window.onload = function () {
|
||||||
window.print();
|
window.print();
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
window.close();
|
window.close();
|
||||||
}, 1000); // Wait 1 second before closing
|
}, 1000); // Wait 1 second before closing
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>';
|
</html>';
|
||||||
|
|
||||||
// $mpdf = new Mpdf([
|
$mpdf = new Mpdf([
|
||||||
// 'mode' => 'utf-8',
|
'mode' => 'utf-8',
|
||||||
// 'format' => [60, 14],
|
'format' => [60, 14],
|
||||||
// 'margin_left' => 0,
|
'margin_left' => 0,
|
||||||
// 'margin_right' => 0,
|
'margin_right' => 0,
|
||||||
// 'margin_top' => 0,
|
'margin_top' => 0,
|
||||||
// 'margin_bottom' => 0,
|
'margin_bottom' => 0,
|
||||||
// // 'tempDir' => '/var/www/storage/mpdf-tmp',
|
// 'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||||
// ]);
|
]);
|
||||||
|
|
||||||
// $mpdf->WriteHTML($html);
|
$mpdf->WriteHTML($html);
|
||||||
// // Output PDF to browser for printing
|
$mpdf->Output('qr-label.pdf', 'I');
|
||||||
// $mpdf->Output('qr-label.pdf', 'I');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -86,4 +86,9 @@ return [
|
|||||||
|
|
||||||
'livewire_loading_delay' => 'default',
|
'livewire_loading_delay' => 'default',
|
||||||
|
|
||||||
|
// 'assets' => [
|
||||||
|
// 'app.js', // or your filament.js file
|
||||||
|
// ],
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
84
config/sanctum.php
Normal file
84
config/sanctum.php
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Sanctum\Sanctum;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Stateful Domains
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Requests from the following domains / hosts will receive stateful API
|
||||||
|
| authentication cookies. Typically, these should include your local
|
||||||
|
| and production domains which access your API via a frontend SPA.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||||
|
'%s%s',
|
||||||
|
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||||
|
Sanctum::currentApplicationUrlWithPort(),
|
||||||
|
// Sanctum::currentRequestHost(),
|
||||||
|
))),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This array contains the authentication guards that will be checked when
|
||||||
|
| Sanctum is trying to authenticate a request. If none of these guards
|
||||||
|
| are able to authenticate the request, Sanctum will use the bearer
|
||||||
|
| token that's present on an incoming request for authentication.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guard' => ['web'],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Expiration Minutes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value controls the number of minutes until an issued token will be
|
||||||
|
| considered expired. This will override any values set in the token's
|
||||||
|
| "expires_at" attribute, but first-party sessions are not affected.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'expiration' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Token Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Sanctum can prefix new tokens in order to take advantage of numerous
|
||||||
|
| security scanning initiatives maintained by open source platforms
|
||||||
|
| that notify developers if they commit tokens into repositories.
|
||||||
|
|
|
||||||
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Middleware
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When authenticating your first-party SPA with Sanctum you may need to
|
||||||
|
| customize some of the middleware Sanctum uses while processing the
|
||||||
|
| request. You may change the middleware listed below as required.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'middleware' => [
|
||||||
|
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
||||||
|
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
|
||||||
|
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
||||||
@@ -35,4 +35,8 @@ return [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'gemini' => [
|
||||||
|
'key' => env('GEMINI_API_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ return new class extends Migration
|
|||||||
$sql = <<<'SQL'
|
$sql = <<<'SQL'
|
||||||
CREATE TABLE alert_mail_rules (
|
CREATE TABLE alert_mail_rules (
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||||
plant BIGINT NOT NULL DEFAULT (0),
|
|
||||||
|
|
||||||
module TEXT NOT NULL,
|
module TEXT NOT NULL,
|
||||||
rule_name TEXT NOT NULL,
|
rule_name TEXT NOT NULL,
|
||||||
@@ -28,7 +27,6 @@ return new class extends Migration
|
|||||||
|
|
||||||
created_by TEXT NOT NULL,
|
created_by TEXT NOT NULL,
|
||||||
updated_by TEXT NOT NULL
|
updated_by TEXT NOT NULL
|
||||||
|
|
||||||
);
|
);
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
// Enable TimescaleDB extension
|
||||||
|
DB::statement('CREATE EXTENSION IF NOT EXISTS timescaledb;');
|
||||||
|
|
||||||
|
DB::statement('ALTER TABLE mfm_readings ADD PRIMARY KEY (id, created_at);');
|
||||||
|
|
||||||
|
// Create hypertable partitioned by created_at
|
||||||
|
DB::statement("
|
||||||
|
SELECT create_hypertable(
|
||||||
|
'mfm_readings',
|
||||||
|
'created_at',
|
||||||
|
chunk_time_interval => interval '1 day',
|
||||||
|
if_not_exists => TRUE
|
||||||
|
);
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('mfm_readings', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -34,57 +34,24 @@ class PermissionSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Master and Transaction Pages
|
//Master and Transaction Pages
|
||||||
Permission::updateOrCreate(['name' => 'view import user']);
|
Permission::updateOrCreate(['name' => 'view import block']);
|
||||||
Permission::updateOrCreate(['name' => 'view export user']);
|
Permission::updateOrCreate(['name' => 'view export block']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import company']);
|
Permission::updateOrCreate(['name' => 'view import company']);
|
||||||
Permission::updateOrCreate(['name' => 'view export company']);
|
Permission::updateOrCreate(['name' => 'view export company']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import plant']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export plant']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import block']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export block']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import shift']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export shift']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import line']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export line']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import item']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export item']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import line stop']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export line stop']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import sticker master']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export sticker master']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import locator']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export locator']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import configuration']);
|
Permission::updateOrCreate(['name' => 'view import configuration']);
|
||||||
Permission::updateOrCreate(['name' => 'view export configuration']);
|
Permission::updateOrCreate(['name' => 'view export configuration']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import work group master']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export work group master']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import machine']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export machine']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import motor testing master']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export motor testing master']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import guard name']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export guard name']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import check point name']);
|
Permission::updateOrCreate(['name' => 'view import check point name']);
|
||||||
Permission::updateOrCreate(['name' => 'view export check point name']);
|
Permission::updateOrCreate(['name' => 'view export check point name']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import check point time']);
|
Permission::updateOrCreate(['name' => 'view import check point time']);
|
||||||
Permission::updateOrCreate(['name' => 'view export check point time']);
|
Permission::updateOrCreate(['name' => 'view export check point time']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import guard name']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export guard name']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import guard patrol entry']);
|
Permission::updateOrCreate(['name' => 'view import guard patrol entry']);
|
||||||
Permission::updateOrCreate(['name' => 'view export guard patrol entry']);
|
Permission::updateOrCreate(['name' => 'view export guard patrol entry']);
|
||||||
Permission::updateOrCreate(['name' => 'view import guard patrol entries']);
|
Permission::updateOrCreate(['name' => 'view import guard patrol entries']);
|
||||||
@@ -93,13 +60,34 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import material invoice']);
|
Permission::updateOrCreate(['name' => 'view import material invoice']);
|
||||||
Permission::updateOrCreate(['name' => 'view export invoice']);
|
Permission::updateOrCreate(['name' => 'view export invoice']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import item']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export item']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import line']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export line']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import line stop']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export line stop']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
|
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export locator invoice validation']);
|
Permission::updateOrCreate(['name' => 'view export locator invoice validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view import dispatch serial invoice validation']);
|
Permission::updateOrCreate(['name' => 'view import dispatch serial invoice validation']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import locator']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export locator']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import machine']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export machine']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import motor testing master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export motor testing master']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import pallet validation']);
|
Permission::updateOrCreate(['name' => 'view import pallet validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export pallet validation']);
|
Permission::updateOrCreate(['name' => 'view export pallet validation']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import plant']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export plant']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import production line stop']);
|
Permission::updateOrCreate(['name' => 'view import production line stop']);
|
||||||
Permission::updateOrCreate(['name' => 'view export production line stop']);
|
Permission::updateOrCreate(['name' => 'view export production line stop']);
|
||||||
|
|
||||||
@@ -112,6 +100,12 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import quality validation']);
|
Permission::updateOrCreate(['name' => 'view import quality validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export quality validation']);
|
Permission::updateOrCreate(['name' => 'view export quality validation']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import shift']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export shift']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import sticker master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export sticker master']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import testing panel reading']);
|
Permission::updateOrCreate(['name' => 'view import testing panel reading']);
|
||||||
Permission::updateOrCreate(['name' => 'view export testing panel reading']);
|
Permission::updateOrCreate(['name' => 'view export testing panel reading']);
|
||||||
|
|
||||||
@@ -150,6 +144,7 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view ems trend line analysis dashboard']);
|
Permission::updateOrCreate(['name' => 'view ems trend line analysis dashboard']);
|
||||||
Permission::updateOrCreate(['name' => 'view ems trend chart analysis dashboard']);
|
Permission::updateOrCreate(['name' => 'view ems trend chart analysis dashboard']);
|
||||||
|
|
||||||
|
|
||||||
//Send To Sap Permissions
|
//Send To Sap Permissions
|
||||||
Permission::updateOrCreate(['name' => 'view quality data send to sap']);
|
Permission::updateOrCreate(['name' => 'view quality data send to sap']);
|
||||||
Permission::updateOrCreate(['name' => 'view production data send to sap']);
|
Permission::updateOrCreate(['name' => 'view production data send to sap']);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class UserSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$user1 = User::updateOrCreate(
|
$user1 = User::updateOrCreate(
|
||||||
['email' => 'dhanabalan.saravanan@cripumps.com'],
|
['email' => 'dhanabalan@cripumps.com'],
|
||||||
[
|
[
|
||||||
'name' => 'Dhanabalan S',
|
'name' => 'Dhanabalan S',
|
||||||
'password' => bcrypt('SdHaNa@123'),
|
'password' => bcrypt('SdHaNa@123'),
|
||||||
|
|||||||
22
finance-news-today.txt
Normal file
22
finance-news-today.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Markets & Economy:
|
||||||
|
|
||||||
|
* The Reserve Bank of India (RBI) has kept the repo rate unchanged at 5.5% and maintained its GDP growth forecast at 6.5%.
|
||||||
|
* The RBI has lowered its inflation forecast for the 2026 fiscal year to 3.1%.
|
||||||
|
* India's foreign exchange reserves have decreased by $9 billion to $689 billion.
|
||||||
|
* The rupee has seen a rise of 15 paise, reaching 87.73 against the U.S. dollar in early trading.
|
||||||
|
* In the U.K., the services sector has experienced its most significant drop in orders in nearly three years.
|
||||||
|
|
||||||
|
Corporate News:
|
||||||
|
|
||||||
|
* Intel is reportedly facing challenges with a crucial manufacturing process for its upcoming PC chip.
|
||||||
|
* Shareholders are suing Elon Musk, alleging that he made exaggerated claims about Tesla's Robotaxi.
|
||||||
|
* News Corp has issued a warning that Donald Trump's AI is using content from his book, "The Art of the Deal."
|
||||||
|
* Chinese automakers, including BYD, saw significant increases in their U.K. sales in July.
|
||||||
|
|
||||||
|
Global Trade:
|
||||||
|
|
||||||
|
* There are concerns about the potential impact of tariffs proposed by Donald Trump on the Indian economy.
|
||||||
|
|
||||||
|
Other News:
|
||||||
|
|
||||||
|
* Central GST officers in India have uncovered significant tax evasion amounting to approximately Rs 7.08 lakh crore over the past five fiscal years.
|
||||||
6
public/C:\Users\Admin\Downloads
Normal file
6
public/C:\Users\Admin\Downloads
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
SIZE 60 mm,40 mm
|
||||||
|
GAP 3 mm,0 mm
|
||||||
|
CLS
|
||||||
|
QRCODE 40,100,M,4,A,0,M2,"HelloWorld123"
|
||||||
|
TEXT 200,100,"3",0,1,1,"HelloWorld123"
|
||||||
|
PRINT 1
|
||||||
44
public/index.html
Normal file
44
public/index.html
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Chart.js Example</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<canvas id="myChart"></canvas>
|
||||||
|
|
||||||
|
<!-- Load Chart.js and plugins -->
|
||||||
|
<script src="js/chart.min.js"></script>
|
||||||
|
<script src="js/chartjs-plugin-datalabels.min.js"></script>
|
||||||
|
<script src="js/chartjs-plugin-annotation.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Your chart initialization code -->
|
||||||
|
<script>
|
||||||
|
const ctx = document.getElementById('myChart').getContext('2d');
|
||||||
|
new Chart(ctx, {
|
||||||
|
type: 'bar',
|
||||||
|
data: {
|
||||||
|
labels: ['Red', 'Blue', 'Yellow'],
|
||||||
|
datasets: [{
|
||||||
|
label: '# of Votes',
|
||||||
|
data: [12, 19, 3]
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
plugins: {
|
||||||
|
datalabels: {
|
||||||
|
// plugin options
|
||||||
|
},
|
||||||
|
annotation: {
|
||||||
|
// plugin options
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
beginAtZero: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
4
public/js/filament-chart-js-plugins.js
Normal file
4
public/js/filament-chart-js-plugins.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
// import ChartDataLabels from 'chartjs-plugin-datalabels'
|
||||||
|
|
||||||
|
// window.filamentChartJsPlugins ??= []
|
||||||
|
// window.filamentChartJsPlugins.push(ChartDataLabels)
|
||||||
1
resources/css/filament/admin/theme.css
Normal file
1
resources/css/filament/admin/theme.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@import '../../../../vendor/filament/filament/resources/css/theme.css';
|
||||||
@@ -1 +1,3 @@
|
|||||||
import './bootstrap';
|
import './bootstrap';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
86
resources/views/chatbot.blade.php
Normal file
86
resources/views/chatbot.blade.php
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Gemini Chat</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
margin: 40px;
|
||||||
|
}
|
||||||
|
#chat-box {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 15px;
|
||||||
|
height: 300px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.user, .bot {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.user {
|
||||||
|
text-align: right;
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
.bot {
|
||||||
|
text-align: left;
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>Gemini Chat</h2>
|
||||||
|
<div id="chat-box"></div>
|
||||||
|
<textarea id="prompt" rows="3" cols="60" placeholder="Type your message here..."></textarea><br>
|
||||||
|
<button onclick="sendPrompt()">Send</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
async function getGeminiResponse(prompt) {
|
||||||
|
try {
|
||||||
|
const res = await fetch('http://172.31.31.51:8000/api/chatbot/message', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ message: prompt })
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
const errorText = await res.text();
|
||||||
|
console.error(`Server returned ${res.status}:`, errorText);
|
||||||
|
throw new Error(`HTTP error! Status: ${res.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = await res.json();
|
||||||
|
return data.reply || "Sorry, no response.";
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Fetch error:', e);
|
||||||
|
return "Error fetching response.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sendPrompt() {
|
||||||
|
const promptInput = document.getElementById('prompt');
|
||||||
|
const prompt = promptInput.value.trim();
|
||||||
|
if (!prompt) return;
|
||||||
|
|
||||||
|
appendMessage('user', prompt);
|
||||||
|
promptInput.value = '';
|
||||||
|
|
||||||
|
const reply = await getGeminiResponse(prompt);
|
||||||
|
appendMessage('bot', reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendMessage(sender, text) {
|
||||||
|
const chatBox = document.getElementById('chat-box');
|
||||||
|
const message = document.createElement('div');
|
||||||
|
message.className = sender;
|
||||||
|
message.textContent = text;
|
||||||
|
chatBox.appendChild(message);
|
||||||
|
chatBox.scrollTop = chatBox.scrollHeight;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="updateInvoice"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Update Invoice
|
||||||
|
</button>
|
||||||
|
|
||||||
0
resources/views/vendor/filament/components/layouts/app.blade.php
vendored
Normal file
0
resources/views/vendor/filament/components/layouts/app.blade.php
vendored
Normal file
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Controllers\ChatbotController;
|
||||||
use App\Http\Controllers\InvoiceValidationController;
|
use App\Http\Controllers\InvoiceValidationController;
|
||||||
use App\Http\Controllers\MachineController;
|
use App\Http\Controllers\MachineController;
|
||||||
use App\Http\Controllers\MfmParameterController;
|
use App\Http\Controllers\MfmParameterController;
|
||||||
@@ -139,3 +140,5 @@ Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 's
|
|||||||
|
|
||||||
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
||||||
|
|
||||||
|
Route::post('/chatbot/message', [ChatbotController::class, 'handleMessage']);
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ use Illuminate\Support\Facades\Route;
|
|||||||
return redirect('/admin');
|
return redirect('/admin');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::get('/chatbot', function () {
|
||||||
|
return view('chatbot');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Route::get('/scheduler', function() {
|
// Route::get('/scheduler', function() {
|
||||||
// Artisan::call('schedule:run');
|
// Artisan::call('schedule:run');
|
||||||
// });
|
// });
|
||||||
|
|||||||
Reference in New Issue
Block a user