diff --git a/app/Filament/Exports/EbReadingExporter.php b/app/Filament/Exports/EbReadingExporter.php
new file mode 100644
index 000000000..051943040
--- /dev/null
+++ b/app/Filament/Exports/EbReadingExporter.php
@@ -0,0 +1,140 @@
+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;
+ }
+}
diff --git a/app/Filament/Exports/MfmReadingExporter.php b/app/Filament/Exports/MfmReadingExporter.php
new file mode 100644
index 000000000..478fc3adf
--- /dev/null
+++ b/app/Filament/Exports/MfmReadingExporter.php
@@ -0,0 +1,92 @@
+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;
+ }
+}
diff --git a/app/Filament/Exports/TempLiveReadingExporter.php b/app/Filament/Exports/TempLiveReadingExporter.php
new file mode 100644
index 000000000..11fdc70cb
--- /dev/null
+++ b/app/Filament/Exports/TempLiveReadingExporter.php
@@ -0,0 +1,51 @@
+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;
+ }
+}
diff --git a/app/Filament/Imports/DeviceMasterImporter.php b/app/Filament/Imports/DeviceMasterImporter.php
index 8b72103e6..cedefa919 100644
--- a/app/Filament/Imports/DeviceMasterImporter.php
+++ b/app/Filament/Imports/DeviceMasterImporter.php
@@ -36,6 +36,7 @@ class DeviceMasterImporter extends Importer
->requiredMapping()
->exampleHeader('IP Address')
->label('IP Address')
+ ->example('172.31.76.67')
->rules(['required', 'ip']),
ImportColumn::make('created_by')
->requiredMapping()
diff --git a/app/Filament/Imports/EbReadingImporter.php b/app/Filament/Imports/EbReadingImporter.php
new file mode 100644
index 000000000..731878a8d
--- /dev/null
+++ b/app/Filament/Imports/EbReadingImporter.php
@@ -0,0 +1,243 @@
+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;
+ }
+}
diff --git a/app/Filament/Imports/MfmMeterImporter.php b/app/Filament/Imports/MfmMeterImporter.php
index 90d4358a2..0cf320230 100644
--- a/app/Filament/Imports/MfmMeterImporter.php
+++ b/app/Filament/Imports/MfmMeterImporter.php
@@ -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('Device Name')
+ ImportColumn::make('devicemaster')
->requiredMapping()
->exampleHeader('Device Name')
->example('REG001')
diff --git a/app/Filament/Imports/MfmReadingImporter.php b/app/Filament/Imports/MfmReadingImporter.php
new file mode 100644
index 000000000..54749f08c
--- /dev/null
+++ b/app/Filament/Imports/MfmReadingImporter.php
@@ -0,0 +1,186 @@
+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;
+ }
+}
diff --git a/app/Filament/Imports/TempLiveReadingImporter.php b/app/Filament/Imports/TempLiveReadingImporter.php
new file mode 100644
index 000000000..2a52c1bb0
--- /dev/null
+++ b/app/Filament/Imports/TempLiveReadingImporter.php
@@ -0,0 +1,66 @@
+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;
+ }
+}
diff --git a/app/Filament/Resources/EbReadingResource.php b/app/Filament/Resources/EbReadingResource.php
new file mode 100644
index 000000000..2abd52688
--- /dev/null
+++ b/app/Filament/Resources/EbReadingResource.php
@@ -0,0 +1,443 @@
+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,
+ ]);
+ }
+}
diff --git a/app/Filament/Resources/EbReadingResource/Pages/CreateEbReading.php b/app/Filament/Resources/EbReadingResource/Pages/CreateEbReading.php
new file mode 100644
index 000000000..d78d54d81
--- /dev/null
+++ b/app/Filament/Resources/EbReadingResource/Pages/CreateEbReading.php
@@ -0,0 +1,12 @@
+headerActions([
+ ->headerActions([
ImportAction::make()
->importer(MfmMeterImporter::class)
->visible(function() {
diff --git a/app/Filament/Resources/MfmReadingResource.php b/app/Filament/Resources/MfmReadingResource.php
index 4beb7a33d..41c138c8c 100644
--- a/app/Filament/Resources/MfmReadingResource.php
+++ b/app/Filament/Resources/MfmReadingResource.php
@@ -2,6 +2,8 @@
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;
@@ -12,6 +14,9 @@ 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
{
@@ -196,6 +201,18 @@ 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');
+ }),
]);
}
diff --git a/app/Filament/Resources/TempLiveReadingResource.php b/app/Filament/Resources/TempLiveReadingResource.php
index 85f9dfca4..c7d7452b8 100644
--- a/app/Filament/Resources/TempLiveReadingResource.php
+++ b/app/Filament/Resources/TempLiveReadingResource.php
@@ -2,6 +2,8 @@
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\RelationManagers;
use App\Models\MfmMeter;
@@ -15,6 +17,9 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Components\Section;
+use Filament\Tables\Actions\ImportAction;
+use Filament\Tables\Actions\ExportAction;
+
class TempLiveReadingResource extends Resource
{
@@ -108,6 +113,18 @@ class TempLiveReadingResource extends Resource
Tables\Actions\ForceDeleteBulkAction::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');
+ }),
]);
}
diff --git a/app/Http/Controllers/ChatbotController.php b/app/Http/Controllers/ChatbotController.php
new file mode 100644
index 000000000..cdd701de0
--- /dev/null
+++ b/app/Http/Controllers/ChatbotController.php
@@ -0,0 +1,90 @@
+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)
+ {
+ //
+ }
+}
diff --git a/app/Http/Controllers/InvoiceValidationController.php b/app/Http/Controllers/InvoiceValidationController.php
index 5f8499246..0c6c1bb56 100644
--- a/app/Http/Controllers/InvoiceValidationController.php
+++ b/app/Http/Controllers/InvoiceValidationController.php
@@ -40,6 +40,18 @@ 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']) == '')
@@ -58,7 +70,8 @@ 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!'
diff --git a/app/Http/Controllers/PalletController.php b/app/Http/Controllers/PalletController.php
index 3126fb839..ad57fb25a 100644
--- a/app/Http/Controllers/PalletController.php
+++ b/app/Http/Controllers/PalletController.php
@@ -73,6 +73,68 @@ 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 = '
+ //
+ //
+ //
+ //
+ //
+ //
+ // ' . htmlspecialchars($palletNo) . '
+ //
+ //
+ //
';
+
+ // return '
+ //
+ //
+ //
+ //
+ //
+ // ' . $htmlBlock . $htmlBlock . '
+ //
+ //
+ // ';
+
+ // // $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);
@@ -80,7 +142,7 @@ class PalletController extends Controller
$qrBinary = $output->output($qrCode, 100);
$qrBase64 = base64_encode($qrBinary);
- $htmlBlock = '
+ $htmlBlock = '
@@ -92,48 +154,43 @@ class PalletController extends Controller
';
- return '
-
-
-
-
-
- ' . $htmlBlock . $htmlBlock . '
-
-
- ';
+ $html = '
+
+
+
+
+
+ ' . $htmlBlock . $htmlBlock . '
+
+
+ ';
- // $mpdf = new Mpdf([
- // 'mode' => 'utf-8',
- // 'format' => [60, 14],
- // 'margin_left' => 0,
- // 'margin_right' => 0,
- // 'margin_top' => 0,
- // 'margin_bottom' => 0,
- // // 'tempDir' => '/var/www/storage/mpdf-tmp',
- // ]);
+ $mpdf = new Mpdf([
+ 'mode' => 'utf-8',
+ 'format' => [60, 14],
+ 'margin_left' => 0,
+ 'margin_right' => 0,
+ 'margin_top' => 0,
+ 'margin_bottom' => 0,
+ // 'tempDir' => '/var/www/storage/mpdf-tmp',
+ ]);
- // $mpdf->WriteHTML($html);
- // // Output PDF to browser for printing
- // $mpdf->Output('qr-label.pdf', 'I');
+ $mpdf->WriteHTML($html);
+ $mpdf->Output('qr-label.pdf', 'I');
}
-
- /**
- * Store a newly created resource in storage.
- */
public function store(Request $request)
{
//
diff --git a/app/Models/EbReading.php b/app/Models/EbReading.php
new file mode 100644
index 000000000..c5d7529c3
--- /dev/null
+++ b/app/Models/EbReading.php
@@ -0,0 +1,69 @@
+belongsTo(Plant::class);
+ }
+}
diff --git a/config/filament.php b/config/filament.php
index 65b4bf0e8..39114296f 100644
--- a/config/filament.php
+++ b/config/filament.php
@@ -86,4 +86,9 @@ return [
'livewire_loading_delay' => 'default',
+// 'assets' => [
+// 'app.js', // or your filament.js file
+// ],
+
+
];
diff --git a/config/sanctum.php b/config/sanctum.php
new file mode 100644
index 000000000..44527d684
--- /dev/null
+++ b/config/sanctum.php
@@ -0,0 +1,84 @@
+ 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,
+ ],
+
+];
diff --git a/config/services.php b/config/services.php
index 27a36175f..aafeb1129 100644
--- a/config/services.php
+++ b/config/services.php
@@ -35,4 +35,8 @@ return [
],
],
+ 'gemini' => [
+ 'key' => env('GEMINI_API_KEY'),
+ ],
+
];
diff --git a/database/migrations/2025_08_04_185137_create_eb_readings_table.php b/database/migrations/2025_08_04_185137_create_eb_readings_table.php
new file mode 100644
index 000000000..eb1567e71
--- /dev/null
+++ b/database/migrations/2025_08_04_185137_create_eb_readings_table.php
@@ -0,0 +1,87 @@
+ interval '1 day',
+ if_not_exists => TRUE
+ );
+ ");
+ }
+
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ // Schema::table('mfm_readings', function (Blueprint $table) {
+ // //
+ // });
+ }
+};
diff --git a/finance-news-today.txt b/finance-news-today.txt
new file mode 100644
index 000000000..45233a1f5
--- /dev/null
+++ b/finance-news-today.txt
@@ -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.
diff --git "a/public/C:\\Users\\Admin\\Downloads" "b/public/C:\\Users\\Admin\\Downloads"
new file mode 100644
index 000000000..873fc53a6
--- /dev/null
+++ "b/public/C:\\Users\\Admin\\Downloads"
@@ -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
diff --git a/public/index.html b/public/index.html
new file mode 100644
index 000000000..ddc0df229
--- /dev/null
+++ b/public/index.html
@@ -0,0 +1,44 @@
+
+
+
+ Chart.js Example
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/js/filament-chart-js-plugins.js b/public/js/filament-chart-js-plugins.js
new file mode 100644
index 000000000..2fed8eaa2
--- /dev/null
+++ b/public/js/filament-chart-js-plugins.js
@@ -0,0 +1,4 @@
+// import ChartDataLabels from 'chartjs-plugin-datalabels'
+
+// window.filamentChartJsPlugins ??= []
+// window.filamentChartJsPlugins.push(ChartDataLabels)
diff --git a/resources/css/filament/admin/theme.css b/resources/css/filament/admin/theme.css
new file mode 100644
index 000000000..150d42673
--- /dev/null
+++ b/resources/css/filament/admin/theme.css
@@ -0,0 +1 @@
+@import '../../../../vendor/filament/filament/resources/css/theme.css';
diff --git a/resources/js/app.js b/resources/js/app.js
index e59d6a0ad..29f5ccf58 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -1 +1,3 @@
import './bootstrap';
+
+
diff --git a/resources/views/chatbot.blade.php b/resources/views/chatbot.blade.php
new file mode 100644
index 000000000..19bb794b5
--- /dev/null
+++ b/resources/views/chatbot.blade.php
@@ -0,0 +1,86 @@
+
+
+
+
+ Gemini Chat
+
+
+
+
+ Gemini Chat
+
+
+ Send
+
+
+
+
+
diff --git a/resources/views/forms/components/update-invoice-button.php b/resources/views/forms/components/update-invoice-button.php
new file mode 100644
index 000000000..7846950b8
--- /dev/null
+++ b/resources/views/forms/components/update-invoice-button.php
@@ -0,0 +1,8 @@
+
+ Update Invoice
+
+
diff --git a/resources/views/vendor/filament/components/layouts/app.blade.php b/resources/views/vendor/filament/components/layouts/app.blade.php
new file mode 100644
index 000000000..e69de29bb
diff --git a/routes/api.php b/routes/api.php
index 6bcaab17e..d2ff92703 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -1,5 +1,6 @@