Add TimescaleDB migration for QDS

This commit is contained in:
dhanabalan
2025-08-12 16:14:41 +05:30
parent dc9f929fa2
commit 390e013ccb
36 changed files with 2002 additions and 44 deletions

View File

@@ -0,0 +1,140 @@
<?php
namespace App\Filament\Exports;
use App\Models\EbReading;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class EbReadingExporter extends Exporter
{
protected static ?string $model = EbReading::class;
static $rowNumber = 0;
public static function getColumns(): array
{
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('lcd_segment_check')
->label('LCD SEGMENT CHECK'),
ExportColumn::make('meter_serial_no')
->label('METER SERIAL NO'),
ExportColumn::make('eb_date_time')
->label('EB DATE TIME'),
ExportColumn::make('ph_seq_of_volt')
->label('PH SEQ OF VOLT'),
ExportColumn::make('ph_assoc_conn_check')
->label('PH ASSOC CONN CHECK'),
ExportColumn::make('instantaneous_ph_volt')
->label('INSTANTANEOUS PH VOLT'),
ExportColumn::make('instantaneous_curr')
->label('INSTANTANEOUS CURR'),
ExportColumn::make('instantaneous_freq')
->label('INSTANTANEOUS FREQ'),
ExportColumn::make('instantaneous_kw_with_sign')
->label('INSTANTANEOUS KW WITH SIGN'),
ExportColumn::make('instantaneous_kva')
->label('INSTANTANEOUS KVA'),
ExportColumn::make('instantaneous_kv_ar')
->label('INSTANTANEOUS KV AR'),
ExportColumn::make('instantaneous_pf_with_sign')
->label('INSTANTANEOUS PF WITH SIGN'),
ExportColumn::make('rd_with_elapsed_time_kva')
->label('RD WITH ELAPSED TIME KVA'),
ExportColumn::make('cum_active_import_energy')
->label('CUM ACTIVE IMPORT ENERGY'),
ExportColumn::make('tod1_active_energy_6_9')
->label('TOD1 ACTIVE ENERGY 6-9'),
ExportColumn::make('tod2_active_energy_18_21')
->label('TOD2 ACTIVE ENERGY 18-21'),
ExportColumn::make('tod3_active_energy_21_22')
->label('TOD3 ACTIVE ENERGY 21-22'),
ExportColumn::make('tod4_active_energy_5_6_9_18')
->label('TOD4 ACTIVE ENERGY 5-6-9-18'),
ExportColumn::make('tod5_active_energy_22_5')
->label('TOD5 ACTIVE ENERGY 22-5'),
ExportColumn::make('cum_reac_lag_energy')
->label('CUM REAC LAG ENERGY'),
ExportColumn::make('cum_reac_lead_energy')
->label('CUM REAC LEAD ENERGY'),
ExportColumn::make('cum_appar_energy')
->label('CUM APPAR ENERGY'),
ExportColumn::make('tod1_appar_energy_6_9')
->label('TOD1 APPAR ENERGY 6-9'),
ExportColumn::make('tod2_appar_energy_18_21')
->label('TOD2 APPAR ENERGY 18-21'),
ExportColumn::make('tod3_appar_energy_21_22')
->label('TOD3 APPAR ENERGY 21-22'),
ExportColumn::make('tod4_appar_energy_5_6_9_18')
->label('TOD4 APPAR ENERGY 5-6-9-18'),
ExportColumn::make('tod5_appar_energy_22_5')
->label('TOD5 APPAR ENERGY 22-5'),
ExportColumn::make('avg_pow_factor')
->label('AVG POW FACTOR'),
ExportColumn::make('avg_freq_15min_last_ip')
->label('AVG FREQ 15MIN LAST IP'),
ExportColumn::make('net_kv_arh_high')
->label('NET KV ARH HIGH'),
ExportColumn::make('net_kv_arh_low')
->label('NET KV ARH LOW'),
ExportColumn::make('cum_md_kva')
->label('CUM MD KVA'),
ExportColumn::make('present_md_kva')
->label('PRESENT MD KVA'),
ExportColumn::make('present_md_kva_date_time')
->label('PRESENT MD KVA DATE TIME'),
ExportColumn::make('tod1_md_kva_6_9')
->label('TOD1 MD KVA 6-9'),
ExportColumn::make('tod2_md_kva_18_21')
->label('TOD2 MD KVA 18-21'),
ExportColumn::make('tod3_md_kva_21_22')
->label('TOD3 MD KVA 21-22'),
ExportColumn::make('tod4_md_kva_5_6_9_18')
->label('TOD4 MD KVA 5-6-9-18'),
ExportColumn::make('tod5_md_kva_22_5')
->label('TOD5 MD KVA 22-5'),
ExportColumn::make('total_pow_off_hours')
->label('TOTAL POW OFF HOURS'),
ExportColumn::make('programming_count')
->label('PROGRAMMING COUNT'),
ExportColumn::make('last_occ_res_event_type')
->label('LAST OCC RES EVENT TYPE'),
ExportColumn::make('last_occ_res_event_date_time')
->label('LAST OCC RES EVENT DATE TIME'),
ExportColumn::make('tamper_count')
->label('TAMPER COUNT'),
ExportColumn::make('reset_count')
->label('RESET COUNT'),
ExportColumn::make('last_md_reset_date_time')
->label('LAST MD RESET DATE TIME'),
ExportColumn::make('electrician_sign')
->label('ELECTRICIAN SIGN'),
ExportColumn::make('created_at')
->label('CREATED AT'),
ExportColumn::make('updated_at')
->label('UPDATED AT'),
ExportColumn::make('deleted_at')
->enabledByDefault(false),
ExportColumn::make('updated_by')
->label('UPDATED BY'),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your eb 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;
}
}

View 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;
}
}

View 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;
}
}

View File

@@ -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()

View File

@@ -0,0 +1,243 @@
<?php
namespace App\Filament\Imports;
use App\Models\EbReading;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
class EbReadingImporter extends Importer
{
protected static ?string $model = EbReading::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('lcd_segment_check')
->label('LCD Segment Check')
->example('Ok')
->exampleHeader('LCD Segment Check'),
ImportColumn::make('meter_serial_no')
->label('Meter Serial No')
->example('572880')
->exampleHeader('Meter Serial No'),
ImportColumn::make('eb_date_time')
->label('EB Date Time')
->example('2025-08-05 08:32:58')
->exampleHeader('EB Date Time')
->requiredMapping()
->rules(['required', 'datetime']),
ImportColumn::make('ph_seq_of_volt')
->label('Phase Sequence of Volt')
->example('RYB')
->exampleHeader('Phase Sequence of Volt'),
ImportColumn::make('ph_assoc_conn_check')
->example('GOOD')
->exampleHeader('Phase Associated Connection Check')
->label('Phase Associated Connection Check'),
ImportColumn::make('instantaneous_ph_volt')
->exampleHeader('Instantaneous Phase Volt')
->example('64.35,64.91,64.93')
->label('Instantaneous Phase Volt'),
ImportColumn::make('instantaneous_curr')
->exampleHeader('Instantaneous Current')
->example('1.02,1.00,0.94')
->label('Instantaneous Current'),
ImportColumn::make('instantaneous_freq')
->exampleHeader('Instantaneous Frequency')
->example('50.07')
->label('Instantaneous Frequency'),
ImportColumn::make('instantaneous_kw_with_sign')
->exampleHeader('Instantaneous KW with Sign')
->example('0.176')
->label('Instantaneous KW with Sign'),
ImportColumn::make('instantaneous_kva')
->exampleHeader('Instantaneous KVA')
->example('0.176')
->label('Instantaneous KVA'),
ImportColumn::make('instantaneous_kv_ar')
->exampleHeader('Instantaneous KV AR')
->example('0.02')
->label('Instantaneous KV AR'),
ImportColumn::make('instantaneous_pf_with_sign')
->exampleHeader('Instantaneous PF with Sign')
->example('0.99')
->label('Instantaneous PF with Sign'),
ImportColumn::make('rd_with_elapsed_time_kva')
->exampleHeader('RD with Elapsed Time KVA')
->example('0.047')
->label('RD with Elapsed Time KVA'),
ImportColumn::make('cum_active_import_energy')
->exampleHeader('Cumulative Active Import Energy')
->example('13246.46')
->label('Cumulative Active Import Energy'),
ImportColumn::make('tod1_active_energy_6_9')
->exampleHeader('TOD1 Active Energy 6-9')
->example('1367.75')
->label('TOD1 Active Energy 6-9'),
ImportColumn::make('tod2_active_energy_18_21')
->exampleHeader('TOD2 Active Energy 18-21')
->example('1759.08')
->label('TOD2 Active Energy 18-21'),
ImportColumn::make('tod3_active_energy_21_22')
->exampleHeader('TOD3 Active Energy 21-22')
->example('457.67')
->label('TOD3 Active Energy 21-22'),
ImportColumn::make('tod4_active_energy_5_6_9_18')
->exampleHeader('TOD4 Active Energy 5-6-9-18')
->example('6253.85')
->label('TOD4 Active Energy 5-6-9-18'),
ImportColumn::make('tod5_active_energy_22_5')
->exampleHeader('TOD5 Active Energy 22-5')
->example('3408.11')
->label('TOD5 Active Energy 22-5'),
ImportColumn::make('cum_reac_lag_energy')
->exampleHeader('Cumulative Reactive Lag Energy')
->example('685.11')
->label('Cumulative Reactive Lag Energy'),
ImportColumn::make('cum_reac_lead_energy')
->exampleHeader('Cumulative Reactive Lead Energy')
->example('426.1')
->label('Cumulative Reactive Lead Energy'),
ImportColumn::make('cum_appar_energy')
->exampleHeader('Cumulative Apparent Energy')
->example('13306.57')
->label('Cumulative Apparent Energy'),
ImportColumn::make('tod1_appar_energy_6_9')
->exampleHeader('TOD1 Apparent Energy 6-9')
->example('1374.63')
->label('TOD1 Apparent Energy 6-9'),
ImportColumn::make('tod2_appar_energy_18_21')
->exampleHeader('TOD2 Apparent Energy 18-21')
->example('1766.61')
->label('TOD2 Apparent Energy 18-21'),
ImportColumn::make('tod3_appar_energy_21_22')
->exampleHeader('TOD3 Apparent Energy 21-22')
->example('459.47')
->label('TOD3 Apparent Energy 21-22'),
ImportColumn::make('tod4_appar_energy_5_6_9_18')
->exampleHeader('TOD4 Apparent Energy 5-6-9-18')
->example('6283.28')
->label('TOD4 Apparent Energy 5-6-9-18'),
ImportColumn::make('tod5_appar_energy_22_5')
->exampleHeader('TOD5 Apparent Energy 22-5')
->example('3422.56')
->label('TOD5 Apparent Energy 22-5'),
ImportColumn::make('avg_pow_factor')
->exampleHeader('Average Power Factor')
->example('0.98')
->label('Average Power Factor'),
ImportColumn::make('avg_freq_15min_last_ip')
->exampleHeader('Average Frequency 15min Last IP')
->example('50')
->label('Average Frequency 15min Last IP'),
ImportColumn::make('net_kv_arh_high')
->exampleHeader('Net KV ARH High')
->example('2.99')
->label('Net KV ARH High'),
ImportColumn::make('net_kv_arh_low')
->exampleHeader('Net KV ARH Low')
->example('143.14')
->label('Net KV ARH Low'),
ImportColumn::make('cum_md_kva')
->exampleHeader('Cumulative MD KVA')
->example('43.816')
->label('Cumulative MD KVA'),
ImportColumn::make('present_md_kva')
->exampleHeader('Present MD KVA')
->example('0.379')
->label('Present MD KVA'),
ImportColumn::make('present_md_kva_date_time')
->label('Present MD KVA Date Time')
->exampleHeader('Present MD KVA Date Time')
->example('2025-08-05 08:32:58')
->requiredMapping()
->rules(['required', 'datetime']),
ImportColumn::make('tod1_md_kva_6_9')
->exampleHeader('TOD1 MD KVA 6-9')
->example('0.282')
->label('TOD1 MD KVA 6-9'),
ImportColumn::make('tod2_md_kva_18_21')
->exampleHeader('TOD2 MD KVA 18-21')
->example('0.268')
->label('TOD2 MD KVA 18-21'),
ImportColumn::make('tod3_md_kva_21_22')
->exampleHeader('TOD3 MD KVA 21-22')
->example('0')
->label('TOD3 MD KVA 21-22'),
ImportColumn::make('tod4_md_kva_5_6_9_18')
->exampleHeader('TOD4 MD KVA 5-6-9-18')
->example('0.379')
->label('TOD4 MD KVA 5-6-9-18'),
ImportColumn::make('tod5_md_kva_22_5')
->exampleHeader('TOD5 MD KVA 22-5')
->example('0.379')
->label('TOD5 MD KVA 22-5'),
ImportColumn::make('total_pow_off_hours')
->exampleHeader('Total Power Off Hours')
->example('6480.56')
->label('Total Power Off Hours'),
ImportColumn::make('programming_count')
->exampleHeader('Programming Count')
->example('3')
->label('Programming Count'),
ImportColumn::make('last_occ_res_event_type')
->exampleHeader('Last Occurrence/Reset Event Type')
->example('-')
->label('Last Occurrence/Reset Event Type'),
ImportColumn::make('last_occ_res_event_date_time')
->label('Last Occurrence/Reset Event Date Time')
->example('2025-08-05 08:32:58')
->exampleHeader('Last Occurrence/Reset Event Date Time')
->requiredMapping()
->rules(['required', 'datetime']),
ImportColumn::make('tamper_count')
->exampleHeader('Tamper Count')
->example('24')
->label('Tamper Count'),
ImportColumn::make('reset_count')
->exampleHeader('Reset Count')
->example('108')
->label('Reset Count'),
ImportColumn::make('last_md_reset_date_time')
->exampleHeader('Last MD Reset Date Time')
->example('2025-08-05 08:32:58')
->label('Last MD Reset Date Time')
->requiredMapping()
->rules(['required', 'datetime']),
ImportColumn::make('electrician_sign')
->exampleHeader('Electrician Sign')
->example('Admin')
->label('Electrician Sign'),
];
}
public function resolveRecord(): ?EbReading
{
// return EbReading::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
return new EbReading();
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your eb 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;
}
}

View File

@@ -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')

View 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;
}
}

View 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;
}
}

View File

@@ -0,0 +1,443 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Exports\EbReadingExporter;
use App\Filament\Imports\EbReadingImporter;
use App\Filament\Resources\EbReadingResource\Pages;
use App\Filament\Resources\EbReadingResource\RelationManagers;
use App\Models\EbReading;
use App\Models\Plant;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Actions\ExportAction;
use Filament\Facades\Filament;
use Filament\Tables\Filters\Filter;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\DateTimePicker;
class EbReadingResource extends Resource
{
protected static ?string $model = EbReading::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Power House';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('plant_id')
->relationship('plant', 'name')
->required(),
Forms\Components\TextInput::make('lcd_segment_check')
->label('LCD Segment Check'),
Forms\Components\TextInput::make('meter_serial_no')
->label('Meter Serial No'),
Forms\Components\DateTimePicker::make('eb_date_time')
->required()
->label('EB Date Time'),
Forms\Components\TextInput::make('ph_seq_of_volt')
->label('PH Sequence of Volt'),
Forms\Components\TextInput::make('ph_assoc_conn_check')
->label('PH Association Connection Check'),
Forms\Components\TextInput::make('instantaneous_ph_volt')
->label('Instantaneous PH Volt'),
Forms\Components\TextInput::make('instantaneous_curr')
->label('Instantaneous Current'),
Forms\Components\TextInput::make('instantaneous_freq')
->label('Instantaneous Frequency'),
Forms\Components\TextInput::make('instantaneous_kw_with_sign')
->label('Instantaneous KW with Sign'),
Forms\Components\TextInput::make('instantaneous_kva')
->label('Instantaneous KVA'),
Forms\Components\TextInput::make('instantaneous_kv_ar')
->label('Instantaneous KV AR'),
Forms\Components\TextInput::make('instantaneous_pf_with_sign')
->label('Instantaneous PF with Sign'),
Forms\Components\TextInput::make('rd_with_elapsed_time_kva')
->label('RD with Elapsed Time KVA'),
Forms\Components\TextInput::make('cum_active_import_energy')
->label('Cumulative Active Import Energy'),
Forms\Components\TextInput::make('tod1_active_energy_6_9')
->label('TOD1 Active Energy 6-9'),
Forms\Components\TextInput::make('tod2_active_energy_18_21')
->label('TOD2 Active Energy 18-21'),
Forms\Components\TextInput::make('tod3_active_energy_21_22')
->label('TOD3 Active Energy 21-22'),
Forms\Components\TextInput::make('tod4_active_energy_5_6_9_18')
->label('TOD4 Active Energy 5-6-9-18'),
Forms\Components\TextInput::make('tod5_active_energy_22_5')
->label('TOD5 Active Energy 22-5'),
Forms\Components\TextInput::make('cum_reac_lag_energy')
->label('Cumulative Reactive Lag Energy'),
Forms\Components\TextInput::make('cum_reac_lead_energy')
->label('Cumulative Reactive Lead Energy'),
Forms\Components\TextInput::make('cum_appar_energy')
->label('Cumulative Apparent Energy'),
Forms\Components\TextInput::make('tod1_appar_energy_6_9')
->label('TOD1 Apparent Energy 6-9'),
Forms\Components\TextInput::make('tod2_appar_energy_18_21')
->label('TOD2 Apparent Energy 18-21'),
Forms\Components\TextInput::make('tod3_appar_energy_21_22')
->label('TOD3 Apparent Energy 21-22'),
Forms\Components\TextInput::make('tod4_appar_energy_5_6_9_18')
->label('TOD4 Apparent Energy 5-6-9-18'),
Forms\Components\TextInput::make('tod5_appar_energy_22_5')
->label('TOD5 Apparent Energy 22-5'),
Forms\Components\TextInput::make('avg_pow_factor')
->label('Average Power Factor'),
Forms\Components\TextInput::make('avg_freq_15min_last_ip')
->label('Average Frequency 15min Last IP'),
Forms\Components\TextInput::make('net_kv_arh_high')
->label('Net KV ARH High'),
Forms\Components\TextInput::make('net_kv_arh_low')
->label('Net KV ARH Low'),
Forms\Components\TextInput::make('cum_md_kva')
->label('Cumulative MD KVA'),
Forms\Components\TextInput::make('present_md_kva')
->label('Present MD KVA'),
Forms\Components\DateTimePicker::make('present_md_kva_date_time')
->label('Present MD KVA Date Time')
->required(),
Forms\Components\TextInput::make('tod1_md_kva_6_9')
->label('TOD1 MD KVA 6-9'),
Forms\Components\TextInput::make('tod2_md_kva_18_21')
->label('TOD2 MD KVA 18-21'),
Forms\Components\TextInput::make('tod3_md_kva_21_22')
->label('TOD3 MD KVA 21-22'),
Forms\Components\TextInput::make('tod4_md_kva_5_6_9_18')
->label('TOD4 MD KVA 5-6-9-18'),
Forms\Components\TextInput::make('tod5_md_kva_22_5')
->label('TOD5 MD KVA 22-5'),
Forms\Components\TextInput::make('total_pow_off_hours')
->label('Total Power Off Hours'),
Forms\Components\TextInput::make('programming_count')
->label('Programming Count'),
Forms\Components\TextInput::make('last_occ_res_event_type')
->label('Last Occurrence/Reset Event Type'),
Forms\Components\DateTimePicker::make('last_occ_res_event_date_time')
->label('Last Occurrence/Reset Event Date Time')
->required(),
Forms\Components\TextInput::make('tamper_count')
->label('Tamper Count'),
Forms\Components\TextInput::make('reset_count')
->label('Reset Count'),
Forms\Components\DateTimePicker::make('last_md_reset_date_time')
->label('Last MD Reset Date Time')
->required(),
Forms\Components\Hidden::make('electrician_sign')
->default(Filament::auth()->user()?->name),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('No.')
->label('No.')
->alignCenter()
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
$paginator = $livewire->getTableRecords();
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('lcd_segment_check')
->alignCenter()
->label('LCD Segment Check'),
Tables\Columns\TextColumn::make('meter_serial_no')
->alignCenter()
->label('Meter Serial No'),
Tables\Columns\TextColumn::make('eb_date_time')
->alignCenter()
->label('EB Date Time'),
Tables\Columns\TextColumn::make('ph_seq_of_volt')
->alignCenter()
->label('PH Sequence of Volt'),
Tables\Columns\TextColumn::make('ph_assoc_conn_check')
->alignCenter()
->label('PH Association Connection Check'),
Tables\Columns\TextColumn::make('instantaneous_ph_volt')
->alignCenter()
->label('Instantaneous PH Volt'),
Tables\Columns\TextColumn::make('instantaneous_curr')
->alignCenter()
->label('Instantaneous Current'),
Tables\Columns\TextColumn::make('instantaneous_freq')
->alignCenter()
->label('Instantaneous Frequency'),
Tables\Columns\TextColumn::make('instantaneous_kw_with_sign')
->alignCenter()
->label('Instantaneous KW with Sign'),
Tables\Columns\TextColumn::make('instantaneous_kva')
->alignCenter()
->label('Instantaneous KVA'),
Tables\Columns\TextColumn::make('instantaneous_kv_ar')
->alignCenter()
->label('Instantaneous KV AR'),
Tables\Columns\TextColumn::make('instantaneous_pf_with_sign')
->alignCenter()
->label('Instantaneous PF with Sign'),
Tables\Columns\TextColumn::make('rd_with_elapsed_time_kva')
->alignCenter()
->label('RD with Elapsed Time KVA'),
Tables\Columns\TextColumn::make('cum_active_import_energy')
->alignCenter()
->label('Cumulative Active Import Energy'),
Tables\Columns\TextColumn::make('tod1_active_energy_6_9')
->alignCenter()
->label('TOD1 Active Energy 6-9'),
Tables\Columns\TextColumn::make('tod2_active_energy_18_21')
->alignCenter()
->label('TOD2 Active Energy 18-21'),
Tables\Columns\TextColumn::make('tod3_active_energy_21_22')
->alignCenter()
->label('TOD3 Active Energy 21-22'),
Tables\Columns\TextColumn::make('tod4_active_energy_5_6_9_18')
->alignCenter()
->label('TOD4 Active Energy 5-6-9-18'),
Tables\Columns\TextColumn::make('tod5_active_energy_22_5')
->alignCenter()
->label('TOD5 Active Energy 22-5'),
Tables\Columns\TextColumn::make('cum_reac_lag_energy')
->alignCenter()
->label('Cumulative Reactive Lag Energy'),
Tables\Columns\TextColumn::make('cum_reac_lead_energy')
->alignCenter()
->label('Cumulative Reactive Lead Energy'),
Tables\Columns\TextColumn::make('cum_appar_energy')
->alignCenter()
->label('Cumulative Apparent Energy'),
Tables\Columns\TextColumn::make('tod1_appar_energy_6_9')
->alignCenter()
->label('TOD1 Apparent Energy 6-9'),
Tables\Columns\TextColumn::make('tod2_appar_energy_18_21')
->alignCenter()
->label('TOD2 Apparent Energy 18-21'),
Tables\Columns\TextColumn::make('tod3_appar_energy_21_22')
->alignCenter()
->label('TOD3 Apparent Energy 21-22'),
Tables\Columns\TextColumn::make('tod4_appar_energy_5_6_9_18')
->alignCenter()
->label('TOD4 Apparent Energy 5-6-9-18'),
Tables\Columns\TextColumn::make('tod5_appar_energy_22_5')
->alignCenter()
->label('TOD5 Apparent Energy 22-5'),
Tables\Columns\TextColumn::make('avg_pow_factor')
->alignCenter()
->label('Average Power Factor'),
Tables\Columns\TextColumn::make('avg_freq_15min_last_ip')
->alignCenter()
->label('Average Frequency 15min Last IP'),
Tables\Columns\TextColumn::make('net_kv_arh_high')
->alignCenter()
->label('Net KV ARH High'),
Tables\Columns\TextColumn::make('net_kv_arh_low')
->alignCenter()
->label('Net KV ARH Low'),
Tables\Columns\TextColumn::make('cum_md_kva')
->alignCenter()
->label('Cumulative MD KVA'),
Tables\Columns\TextColumn::make('present_md_kva')
->alignCenter()
->label('Present MD KVA'),
Tables\Columns\TextColumn::make('present_md_kva_date_time')
->alignCenter()
->label('Present MD KVA Date Time'),
Tables\Columns\TextColumn::make('tod1_md_kva_6_9')
->alignCenter()
->label('TOD1 MD KVA 6-9'),
Tables\Columns\TextColumn::make('tod2_md_kva_18_21')
->alignCenter()
->label('TOD2 MD KVA 18-21'),
Tables\Columns\TextColumn::make('tod3_md_kva_21_22')
->alignCenter()
->label('TOD3 MD KVA 21-22'),
Tables\Columns\TextColumn::make('tod4_md_kva_5_6_9_18')
->alignCenter()
->label('TOD4 MD KVA 5-6-9-18'),
Tables\Columns\TextColumn::make('tod5_md_kva_22_5')
->alignCenter()
->label('TOD5 MD KVA 22-5'),
Tables\Columns\TextColumn::make('total_pow_off_hours')
->alignCenter()
->label('Total Power Off Hours'),
Tables\Columns\TextColumn::make('programming_count')
->alignCenter()
->label('Programming Count'),
Tables\Columns\TextColumn::make('last_occ_res_event_type')
->alignCenter()
->label('Last Occurrence/Reset Event Type'),
Tables\Columns\TextColumn::make('last_occ_res_event_date_time')
->alignCenter()
->label('Last Occurrence/Reset Event Date Time'),
Tables\Columns\TextColumn::make('tamper_count')
->alignCenter()
->label('Tamper Count'),
Tables\Columns\TextColumn::make('reset_count')
->alignCenter()
->label('Reset Count'),
Tables\Columns\TextColumn::make('last_md_reset_date_time')
->alignCenter()
->label('Last MD Reset Date Time'),
Tables\Columns\TextColumn::make('electrician_sign')
->alignCenter()
->label('Created By'),
Tables\Columns\TextColumn::make('created_at')
->alignCenter()
->label('Created At')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
// ->filters([
// Tables\Filters\TrashedFilter::make(),
// ])
->filters([
Tables\Filters\TrashedFilter::make(),
Filter::make('advanced_filters')
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Select Plant')
->nullable()
->options(function () {
return Plant::pluck('name', 'id');
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('electrician_sign', null);
}),
TextInput::make('electrician_sign')
->label('Created By'),
DateTimePicker::make(name: 'created_from')
->label('Created From')
->placeholder(placeholder: 'Select From DateTime')
->reactive()
->native(false),
DateTimePicker::make('created_to')
->label('Created To')
->placeholder(placeholder: 'Select To DateTime')
->reactive()
->native(false),
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['electrician_sign'])) {
return $query->whereRaw('1 = 0');
}
if (!empty($data['Plant'])) {
$query->where('plant_id', $data['Plant']);
}
if (!empty($data['created_from'])) {
$query->where('created_at', '>=', $data['created_from']);
}
if (!empty($data['created_to'])) {
$query->where('created_at', '<=', $data['created_to']);
}
if (!empty($data['electrician_sign'])) {
$query->where('electrician_sign', $data['electrician_sign']);
}
})
->indicateUsing(function (array $data) {
$indicators = [];
if (!empty($data['Plant'])) {
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
}
if (!empty($data['electrician_sign'])) {
$indicators[] = 'Created By: ' . $data['electrician_sign'];
}
if (!empty($data['created_from'])) {
$indicators[] = 'From: ' . $data['created_from'];
}
if (!empty($data['created_to'])) {
$indicators[] = 'To: ' . $data['created_to'];
}
return $indicators;
})
])
->filtersFormMaxHeight('280px')
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->importer(EbReadingImporter::class)
->visible(function() {
return Filament::auth()->user()->can('view import eb reading');
}),
ExportAction::make()
->exporter(EbReadingExporter::class)
->visible(function() {
return Filament::auth()->user()->can('view export eb reading');
}),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListEbReadings::route('/'),
'create' => Pages\CreateEbReading::route('/create'),
'view' => Pages\ViewEbReading::route('/{record}'),
'edit' => Pages\EditEbReading::route('/{record}/edit'),
];
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\EbReadingResource\Pages;
use App\Filament\Resources\EbReadingResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateEbReading extends CreateRecord
{
protected static string $resource = EbReadingResource::class;
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Filament\Resources\EbReadingResource\Pages;
use App\Filament\Resources\EbReadingResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditEbReading extends EditRecord
{
protected static string $resource = EbReadingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
Actions\ForceDeleteAction::make(),
Actions\RestoreAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\EbReadingResource\Pages;
use App\Filament\Resources\EbReadingResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListEbReadings extends ListRecords
{
protected static string $resource = EbReadingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\EbReadingResource\Pages;
use App\Filament\Resources\EbReadingResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewEbReading extends ViewRecord
{
protected static string $resource = EbReadingResource::class;
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -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() {

View File

@@ -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');
}),
]); ]);
} }

View File

@@ -2,6 +2,8 @@
namespace App\Filament\Resources; namespace App\Filament\Resources;
use App\Filament\Exports\TempLiveReadingExporter;
use App\Filament\Imports\TempLiveReadingImporter;
use App\Filament\Resources\TempLiveReadingResource\Pages; use App\Filament\Resources\TempLiveReadingResource\Pages;
use App\Filament\Resources\TempLiveReadingResource\RelationManagers; use App\Filament\Resources\TempLiveReadingResource\RelationManagers;
use App\Models\MfmMeter; use App\Models\MfmMeter;
@@ -15,6 +17,9 @@ 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\Components\Section; use Filament\Forms\Components\Section;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Actions\ExportAction;
class TempLiveReadingResource extends Resource class TempLiveReadingResource extends Resource
{ {
@@ -108,6 +113,18 @@ class TempLiveReadingResource extends Resource
Tables\Actions\ForceDeleteBulkAction::make(), Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(), Tables\Actions\RestoreBulkAction::make(),
]), ]),
])
->headerActions([
ImportAction::make()
->importer(TempLiveReadingImporter::class)
->visible(function() {
return Filament::auth()->user()->can('view import temp live reading');
}),
ExportAction::make()
->exporter(TempLiveReadingExporter::class)
->visible(function() {
return Filament::auth()->user()->can('view export temp live reading');
}),
]); ]);
} }

View 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)
{
//
}
}

View File

@@ -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!'

View File

@@ -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)
{ {
// //

69
app/Models/EbReading.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class EbReading extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'lcd_segment_check',
'meter_serial_no',
'eb_date_time',
'ph_seq_of_volt',
'ph_assoc_conn_check',
'instantaneous_ph_volt',
'instantaneous_curr',
'instantaneous_freq',
'instantaneous_kw_with_sign',
'instantaneous_kva',
'instantaneous_kv_ar',
'instantaneous_pf_with_sign',
'rd_with_elapsed_time_kva',
'cum_active_import_energy',
'tod1_active_energy_6_9',
'tod2_active_energy_18_21',
'tod3_active_energy_21_22',
'tod4_active_energy_5_6_9_18',
'tod5_active_energy_22_5',
'cum_reac_lag_energy',
'cum_reac_lead_energy',
'cum_appar_energy',
'tod1_appar_energy_6_9',
'tod2_appar_energy_18_21',
'tod3_appar_energy_21_22',
'tod4_appar_energy_5_6_9_18',
'tod5_appar_energy_22_5',
'avg_pow_factor',
'avg_freq_15min_last_ip',
'net_kv_arh_high',
'net_kv_arh_low',
'cum_md_kva',
'present_md_kva',
'present_md_kva_date_time',
'tod1_md_kva_6_9',
'tod2_md_kva_18_21',
'tod3_md_kva_21_22',
'tod4_md_kva_5_6_9_18',
'tod5_md_kva_22_5',
'total_pow_off_hours',
'programming_count',
'last_occ_res_event_type',
'last_occ_res_event_date_time',
'tamper_count',
'reset_count',
'last_md_reset_date_time',
'electrician_sign',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}

View File

@@ -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
View 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,
],
];

View File

@@ -35,4 +35,8 @@ return [
], ],
], ],
'gemini' => [
'key' => env('GEMINI_API_KEY'),
],
]; ];

View File

@@ -0,0 +1,87 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$sql = <<<'SQL'
CREATE TABLE eb_readings (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
lcd_segment_check TEXT DEFAULT NULL,
meter_serial_no TEXT DEFAULT NULL,
eb_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
ph_seq_of_volt TEXT DEFAULT NULL,
ph_assoc_conn_check TEXT DEFAULT NULL,
instantaneous_ph_volt TEXT DEFAULT NULL,
instantaneous_curr TEXT DEFAULT NULL,
instantaneous_freq TEXT DEFAULT NULL,
instantaneous_kw_with_sign TEXT DEFAULT NULL,
instantaneous_kva TEXT DEFAULT NULL,
instantaneous_kv_ar TEXT DEFAULT NULL,
instantaneous_pf_with_sign TEXT DEFAULT NULL,
rd_with_elapsed_time_kva TEXT DEFAULT NULL,
cum_active_import_energy TEXT DEFAULT NULL,
tod1_active_energy_6_9 TEXT DEFAULT NULL,
tod2_active_energy_18_21 TEXT DEFAULT NULL,
tod3_active_energy_21_22 TEXT DEFAULT NULL,
tod4_active_energy_5_6_9_18 TEXT DEFAULT NULL,
tod5_active_energy_22_5 TEXT DEFAULT NULL,
cum_reac_lag_energy TEXT DEFAULT NULL,
cum_reac_lead_energy TEXT DEFAULT NULL,
cum_appar_energy TEXT DEFAULT NULL,
tod1_appar_energy_6_9 TEXT DEFAULT NULL,
tod2_appar_energy_18_21 TEXT DEFAULT NULL,
tod3_appar_energy_21_22 TEXT DEFAULT NULL,
tod4_appar_energy_5_6_9_18 TEXT DEFAULT NULL,
tod5_appar_energy_22_5 TEXT DEFAULT NULL,
avg_pow_factor TEXT DEFAULT NULL,
avg_freq_15min_last_ip TEXT DEFAULT NULL,
net_kv_arh_high TEXT DEFAULT NULL,
net_kv_arh_low TEXT DEFAULT NULL,
cum_md_kva TEXT DEFAULT NULL,
present_md_kva TEXT DEFAULT NULL,
present_md_kva_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
tod1_md_kva_6_9 TEXT DEFAULT NULL,
tod2_md_kva_18_21 TEXT DEFAULT NULL,
tod3_md_kva_21_22 TEXT DEFAULT NULL,
tod4_md_kva_5_6_9_18 TEXT DEFAULT NULL,
tod5_md_kva_22_5 TEXT DEFAULT NULL,
total_pow_off_hours TEXT DEFAULT NULL,
programming_count TEXT DEFAULT NULL,
last_occ_res_event_type TEXT DEFAULT NULL,
last_occ_res_event_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
tamper_count TEXT DEFAULT NULL,
reset_count TEXT DEFAULT NULL,
last_md_reset_date_time TIMESTAMP NOT NULL DEFAULT NOW(),
electrician_sign TEXT DEFAULT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
deleted_at TIMESTAMP,
updated_by TEXT NULL,
FOREIGN KEY (plant_id) REFERENCES plants (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('eb_readings');
}
};

View File

@@ -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) {
// //
// });
}
};

22
finance-news-today.txt Normal file
View 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.

View 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
View 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>

View File

@@ -0,0 +1,4 @@
// import ChartDataLabels from 'chartjs-plugin-datalabels'
// window.filamentChartJsPlugins ??= []
// window.filamentChartJsPlugins.push(ChartDataLabels)

View File

@@ -0,0 +1 @@
@import '../../../../vendor/filament/filament/resources/css/theme.css';

View File

@@ -1 +1,3 @@
import './bootstrap'; import './bootstrap';

View 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>

View File

@@ -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>

View 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']);

View File

@@ -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');
// }); // });