Compare commits
21 Commits
qds
...
3053098cfb
| Author | SHA1 | Date | |
|---|---|---|---|
| 3053098cfb | |||
| a5ded4a20a | |||
|
|
d419973ab5 | ||
|
|
86e458037f | ||
|
|
e6ba543589 | ||
|
|
1cee8dc71d | ||
|
|
3a009543ea | ||
|
|
d4045b7b0f | ||
|
|
a831f6e787 | ||
|
|
b399141c7e | ||
|
|
8fd2212ec4 | ||
|
|
e6f78c60d5 | ||
|
|
a3a421af88 | ||
|
|
d4eeee7d05 | ||
|
|
bd17af8945 | ||
|
|
95f1e09304 | ||
|
|
fc42e7db6c | ||
|
|
0d3e58e7af | ||
|
|
658d7cb42c | ||
|
|
679d532b17 | ||
|
|
50ddd51f04 |
@@ -1,92 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
58
app/Filament/Exports/UserExporter.php
Normal file
58
app/Filament/Exports/UserExporter.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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,7 +36,6 @@ class DeviceMasterImporter extends Importer
|
||||
->requiredMapping()
|
||||
->exampleHeader('IP Address')
|
||||
->label('IP Address')
|
||||
->example('172.31.76.67')
|
||||
->rules(['required', 'ip']),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
|
||||
@@ -35,7 +35,7 @@ class LineStopImporter extends Importer
|
||||
public function resolveRecord(): ?LineStop
|
||||
{
|
||||
$warnMsg = [];
|
||||
if (Str::length($this->data['code']) < 6 || !ctype_alnum($this->data['code'])) {
|
||||
if (Str::length($this->data['code']) < 3 || !ctype_alnum($this->data['code'])) {
|
||||
$warnMsg[] = "Invalid line stop code found";
|
||||
}
|
||||
if (Str::length($this->data['reason']) < 5) {
|
||||
|
||||
@@ -15,13 +15,13 @@ class MfmMeterImporter extends Importer
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('devicemaster')
|
||||
ImportColumn::make('Device Name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Device Name')
|
||||
->example('REG001')
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
114
app/Filament/Imports/UserImporter.php
Normal file
114
app/Filament/Imports/UserImporter.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?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,11 +12,15 @@ class CreateAlertMailRule extends CreateRecord
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
|
||||
if ($data['is_active']) {
|
||||
$data['plant'] = 0;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateBlock extends CreateRecord
|
||||
{
|
||||
protected static string $resource = BlockResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateCompany extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CompanyResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateConfiguration extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ConfigurationResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateDeviceMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DeviceMasterResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateEbReading extends CreateRecord
|
||||
{
|
||||
protected static string $resource = EbReadingResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,11 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
|
||||
public function processInvoice($invoiceNumber)
|
||||
{
|
||||
$invoiceNumber = trim($invoiceNumber);
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateItem extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ItemResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateLine extends CreateRecord
|
||||
{
|
||||
protected static string $resource = LineResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateLineStop extends CreateRecord
|
||||
{
|
||||
protected static string $resource = LineStopResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
|
||||
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-locator-invoice-validation';
|
||||
|
||||
public $plantId;
|
||||
|
||||
public $invoice_number;
|
||||
|
||||
public $pallet_number;
|
||||
|
||||
public $serial_number, $snoCount;
|
||||
@@ -29,8 +31,13 @@ class CreateLocatorInvoiceValidation extends CreateRecord
|
||||
public $locator_number;
|
||||
|
||||
public array $matchedSerialNumbersForRemoval = [];
|
||||
|
||||
public bool $showRemoveSerialsModal = false;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
|
||||
public function processinvoiceSNo()
|
||||
{
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateLocator extends CreateRecord
|
||||
{
|
||||
protected static string $resource = LocatorResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ class MachineResource extends Resource
|
||||
return [];
|
||||
}
|
||||
|
||||
return Line::where('plant_id', $get('plant_id'))
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
return Line::where('plant_id', $get('plant_id'))->where('no_of_operation', '>', 0)->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->default(function () {
|
||||
return optional(Machine::latest()->first())->line_id;
|
||||
@@ -87,13 +85,13 @@ class MachineResource extends Resource
|
||||
}
|
||||
else
|
||||
{
|
||||
$grpWrkCnr = Line::find($lineId)->group_work_center;
|
||||
if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
|
||||
{
|
||||
$set('mLineError', 'Please select a group work center line.');
|
||||
$set('line_id', null);
|
||||
return;
|
||||
}
|
||||
// $grpWrkCnr = Line::find($lineId)->group_work_center;
|
||||
// if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
|
||||
// {
|
||||
// $set('mLineError', 'Please select a group work center line.');
|
||||
// $set('line_id', null);
|
||||
// return;
|
||||
// }
|
||||
$set('mLineError', null);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateMachine extends CreateRecord
|
||||
{
|
||||
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(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(MfmMeterImporter::class)
|
||||
->visible(function() {
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateMfmMeter extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MfmMeterResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateMfmParameter extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MfmParameterResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
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\RelationManagers;
|
||||
use App\Models\MfmReading;
|
||||
@@ -14,9 +12,6 @@ use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Facades\Filament;
|
||||
|
||||
class MfmReadingResource extends Resource
|
||||
{
|
||||
@@ -201,18 +196,6 @@ class MfmReadingResource extends Resource
|
||||
Tables\Actions\ForceDeleteBulkAction::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,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateMfmReading extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MfmReadingResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateModuleList extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ModuleListResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateMotorTestingMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MotorTestingMasterResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,17 +14,22 @@ use Illuminate\View\View;
|
||||
class CreatePalletValidation extends CreateRecord
|
||||
{
|
||||
public $plantId;
|
||||
|
||||
public $pallet_number;
|
||||
|
||||
public $palletNo;
|
||||
|
||||
public $pendingPallet;
|
||||
|
||||
public $snoCount = 0;
|
||||
|
||||
public $pallet_number_locked = false;
|
||||
|
||||
public $serial_number;
|
||||
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
|
||||
protected static string $resource = PalletValidationResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
|
||||
|
||||
protected static string $resource = PalletValidationResource::class;
|
||||
|
||||
protected $listeners = [
|
||||
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
|
||||
@@ -32,6 +37,10 @@ class CreatePalletValidation extends CreateRecord
|
||||
|
||||
public ?array $data = null;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
|
||||
public function processPalletSNo()
|
||||
{
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreatePlant extends CreateRecord
|
||||
{
|
||||
protected static string $resource = PlantResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2093,10 +2093,52 @@ class QualityValidationResource extends Resource
|
||||
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)
|
||||
{
|
||||
$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
|
||||
{
|
||||
$set('part_validation5_error', "Invalid input for part validation 5.");
|
||||
@@ -2487,7 +2529,8 @@ class QualityValidationResource extends Resource
|
||||
}),
|
||||
]);
|
||||
}
|
||||
//,,
|
||||
|
||||
|
||||
// public static function mutateFormDataBeforeCreate(array $data): array
|
||||
// {
|
||||
// $user =Filament::auth()->user();
|
||||
|
||||
@@ -21,6 +21,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
||||
|
||||
protected static string $resource = ReworkLocatorInvoiceValidationResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
|
||||
public function processInvoiceRework($invoiceNo)
|
||||
{
|
||||
$plantId = $this->form->getState()['plant'];
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateShift extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ShiftResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Forms\Set;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
// use Illuminate\Validation\Rule;
|
||||
@@ -153,12 +154,26 @@ class StickerMasterResource extends Resource
|
||||
->hint(fn ($get) => $get('item_error') ? $get('item_error') : null)
|
||||
->hintColor('danger'),
|
||||
|
||||
|
||||
Forms\Components\TextInput::make('item_description')
|
||||
->label('Description')
|
||||
->required()
|
||||
->reactive()
|
||||
->readOnly(true),
|
||||
->label('Description')
|
||||
->required()
|
||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||
if ($get('id')) {
|
||||
$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')
|
||||
->nullable(),
|
||||
|
||||
@@ -21,4 +21,9 @@ class CreateStickerMaster extends CreateRecord
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,9 @@ class CreateTempLiveReading extends CreateRecord
|
||||
{
|
||||
return 'Create Live Readings';
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
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\RelationManagers;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -80,6 +85,7 @@ class UserResource extends Resource
|
||||
// ->label('ID')
|
||||
// ->numeric()
|
||||
// ->sortable(),
|
||||
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
@@ -134,6 +140,18 @@ class UserResource extends Resource
|
||||
Tables\Actions\ForceDeleteBulkAction::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,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateUser extends CreateRecord
|
||||
{
|
||||
protected static string $resource = UserResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
<?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,18 +40,6 @@ class InvoiceValidationController extends Controller
|
||||
|
||||
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();
|
||||
|
||||
if (!isset($data['plant_code']) || trim($data['plant_code']) == '')
|
||||
@@ -70,8 +58,7 @@ class InvoiceValidationController extends Controller
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
||||
if (!$plant)
|
||||
{
|
||||
if (!$plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant not found!'
|
||||
|
||||
@@ -73,68 +73,6 @@ class PalletController extends Controller
|
||||
// $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)
|
||||
{
|
||||
$qrCode = new QrCode($palletNo);
|
||||
@@ -142,7 +80,7 @@ class PalletController extends Controller
|
||||
$qrBinary = $output->output($qrCode, 100);
|
||||
$qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
$htmlBlock = '
|
||||
$htmlBlock = '
|
||||
<table class="sticker-table">
|
||||
<tr>
|
||||
<td class="qr-cell">
|
||||
@@ -154,43 +92,48 @@ class PalletController extends Controller
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
$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: 22pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
||||
img.qr { width: 16mm; height: 16mm; 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>';
|
||||
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 = 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);
|
||||
$mpdf->Output('qr-label.pdf', 'I');
|
||||
// $mpdf->WriteHTML($html);
|
||||
// // Output PDF to browser for printing
|
||||
// $mpdf->Output('qr-label.pdf', 'I');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
@@ -86,9 +86,4 @@ return [
|
||||
|
||||
'livewire_loading_delay' => 'default',
|
||||
|
||||
// 'assets' => [
|
||||
// 'app.js', // or your filament.js file
|
||||
// ],
|
||||
|
||||
|
||||
];
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
<?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,8 +35,4 @@ return [
|
||||
],
|
||||
],
|
||||
|
||||
'gemini' => [
|
||||
'key' => env('GEMINI_API_KEY'),
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -14,6 +14,7 @@ return new class extends Migration
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE alert_mail_rules (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant BIGINT NOT NULL DEFAULT (0),
|
||||
|
||||
module TEXT NOT NULL,
|
||||
rule_name TEXT NOT NULL,
|
||||
@@ -27,6 +28,7 @@ return new class extends Migration
|
||||
|
||||
created_by TEXT NOT NULL,
|
||||
updated_by TEXT NOT NULL
|
||||
|
||||
);
|
||||
SQL;
|
||||
|
||||
|
||||
@@ -1,40 +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
|
||||
{
|
||||
// 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,24 +34,57 @@ class PermissionSeeder extends Seeder
|
||||
}
|
||||
|
||||
//Master and Transaction Pages
|
||||
Permission::updateOrCreate(['name' => 'view import block']);
|
||||
Permission::updateOrCreate(['name' => 'view export block']);
|
||||
Permission::updateOrCreate(['name' => 'view import user']);
|
||||
Permission::updateOrCreate(['name' => 'view export user']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import 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 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 export check point name']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import 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 export guard patrol entry']);
|
||||
Permission::updateOrCreate(['name' => 'view import guard patrol entries']);
|
||||
@@ -60,34 +93,13 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'view import material 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 export locator 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 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 export production line stop']);
|
||||
|
||||
@@ -100,12 +112,6 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'view import 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 export testing panel reading']);
|
||||
|
||||
@@ -144,7 +150,6 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'view ems trend line analysis dashboard']);
|
||||
Permission::updateOrCreate(['name' => 'view ems trend chart analysis dashboard']);
|
||||
|
||||
|
||||
//Send To Sap Permissions
|
||||
Permission::updateOrCreate(['name' => 'view quality 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
|
||||
{
|
||||
$user1 = User::updateOrCreate(
|
||||
['email' => 'dhanabalan@cripumps.com'],
|
||||
['email' => 'dhanabalan.saravanan@cripumps.com'],
|
||||
[
|
||||
'name' => 'Dhanabalan S',
|
||||
'password' => bcrypt('SdHaNa@123'),
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
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.
|
||||
@@ -1,6 +0,0 @@
|
||||
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
|
||||
@@ -1,44 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,4 +0,0 @@
|
||||
// import ChartDataLabels from 'chartjs-plugin-datalabels'
|
||||
|
||||
// window.filamentChartJsPlugins ??= []
|
||||
// window.filamentChartJsPlugins.push(ChartDataLabels)
|
||||
@@ -1 +0,0 @@
|
||||
@import '../../../../vendor/filament/filament/resources/css/theme.css';
|
||||
@@ -1,3 +1 @@
|
||||
import './bootstrap';
|
||||
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
<!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>
|
||||
@@ -1,8 +0,0 @@
|
||||
<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>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\ChatbotController;
|
||||
use App\Http\Controllers\InvoiceValidationController;
|
||||
use App\Http\Controllers\MachineController;
|
||||
use App\Http\Controllers\MfmParameterController;
|
||||
@@ -140,5 +139,3 @@ Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 's
|
||||
|
||||
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
||||
|
||||
Route::post('/chatbot/message', [ChatbotController::class, 'handleMessage']);
|
||||
|
||||
|
||||
@@ -10,11 +10,6 @@ use Illuminate\Support\Facades\Route;
|
||||
return redirect('/admin');
|
||||
});
|
||||
|
||||
Route::get('/chatbot', function () {
|
||||
return view('chatbot');
|
||||
});
|
||||
|
||||
|
||||
// Route::get('/scheduler', function() {
|
||||
// Artisan::call('schedule:run');
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user