1
0
forked from poc/pds

48 Commits
qds ... master

Author SHA1 Message Date
dhanabalan
8813567f0b Add missing created_at and updated_at fields to fillable attributes in ProductionQuantity model 2025-09-09 19:03:13 +05:30
dhanabalan
ffa2b1f783 Remove redundant 'asc' parameter from created_at orderBy in QualityValidationResource table query 2025-09-09 18:01:19 +05:30
dhanabalan
e29c16c79a Add sorting by created_at in QualityValidationResource table query 2025-09-09 17:55:53 +05:30
dhanabalan
4d516e955c added created_at and updated_at column in quality validation model 2025-09-09 10:56:22 +05:30
dhanabalan
b0d73dbbc6 Add searchable functionality to line name column in QualityValidationResource table 2025-09-09 10:39:20 +05:30
dhanabalan
37c91afe25 Rename subassembly_code to mot_subassembly_code in get_motor_master method for clarity 2025-09-09 10:23:58 +05:30
dhanabalan
77064399cd Update example header for line column in ConfigurationImporter 2025-09-09 08:41:22 +05:30
dhanabalan
3398a60d1b Update label for laser part validation input in StickerMasterResource 2025-09-06 16:25:52 +05:30
dhanabalan
65aafbeb65 Add required validation to load rate input in StickerMasterResource resource 2025-09-06 16:16:35 +05:30
dhanabalan
ad72d38193 Update plant column references in ConfigurationExporter and ConfigurationImporter to use 'code' instead of 'name' 2025-09-06 11:30:07 +05:30
dhanabalan
cac91722c3 Refactor form schema in StickerMasterResource for improved clarity and organization 2025-09-05 17:27:24 +05:30
dhanabalan
bb2b81d0f2 updated header name for leak current limit in motor testing master 2025-09-05 14:41:27 +05:30
dhanabalan
2150f6098f Added required isi model column for motor testing importer and exporter 2025-09-05 14:32:47 +05:30
dhanabalan
a0a1e87440 Added subassembly code to motor master output in TestingPanelController 2025-09-05 14:03:54 +05:30
dhanabalan
8da3c746b9 Added sub assembly column in import and export 2025-09-05 09:35:06 +05:30
dhanabalan
d05623f920 Added subassembly code in resource page of motor testing master 2025-09-05 09:33:16 +05:30
dhanabalan
e3d29cba81 Added subassembly code in model file in motor testing master 2025-09-05 09:31:06 +05:30
dhanabalan
5cbae18532 Added subassembly code column motor testing master 2025-09-05 09:28:50 +05:30
dhanabalan
7e688683d7 corrected bundle logic for invoice quantity 2025-08-27 08:37:21 +05:30
dhanabalan
ab5a8c0874 Removed unwanted column in bundle data in invoice mail 2025-08-26 19:06:51 +05:30
dhanabalan
19e1f12f5d Refactor invoice report generation to include quantity metrics and enhance email content structure 2025-08-26 18:08:06 +05:30
dhanabalan
e57962f023 Merge branch 'master' of ssh://172.31.31.31:2222/poc/pds 2025-08-26 18:01:43 +05:30
dhanabalan
c5a730b71d Added roles column in view reports and Refactor User table columns for improved sorting and searching functionality 2025-08-26 17:57:16 +05:30
root
967a429595 Merge branch 'master' of https://git.iotsignin.com/poc/pds 2025-08-26 16:35:02 +05:30
root
7f0d138383 WIP: local changes before pull 2025-08-26 16:21:53 +05:30
dhanabalan
d5c0303be4 Merge branch 'master' of ssh://172.31.31.31:2222/poc/pds 2025-08-26 16:10:31 +05:30
dhanabalan
c2f9b77e1f Create motor_testing_masters table with comprehensive fields for motor testing data 2025-08-26 16:09:10 +05:30
3053098cfb Updated file name to work migration functionality in order 2025-08-26 10:32:46 +00:00
a5ded4a20a Added plant column with BIGINT type and its default value as 0 2025-08-26 10:25:05 +00:00
dhanabalan
d419973ab5 Add getRedirectUrl method to resource creation classes for consistent redirection 2025-08-26 15:44:51 +05:30
dhanabalan
86e458037f Removed unnecessary lines in alert_mail_rules table 2025-08-25 20:09:24 +05:30
dhanabalan
e6ba543589 Added roles on UserExporter and UserImporter for consistency and enhanced functionality 2025-08-25 17:00:00 +05:30
dhanabalan
1cee8dc71d Enhance item description field to auto-populate based on selected item ID 2025-08-25 12:17:49 +05:30
dhanabalan
3a009543ea Update MachineResource refine line selection logic 2025-08-25 11:43:09 +05:30
dhanabalan
d4045b7b0f Update validation for line stop code to require a minimum length of 3 characters 2025-08-22 14:47:01 +05:30
dhanabalan
a831f6e787 Testing 2025-08-21 18:07:08 +05:30
dhanabalan
b399141c7e Add UserExporter and UserImporter classes with export/import functionality 2025-08-21 17:07:34 +05:30
dhanabalan
8fd2212ec4 Refactor PermissionSeeder to update permissions for user, plant, and block views 2025-08-21 16:32:32 +05:30
dhanabalan
e6f78c60d5 Fix email address for admin in UserSeeder 2025-08-21 16:07:43 +05:30
dhanabalan
a3a421af88 Added logic in quality validation screen to scan capacitor qr code in part validation 5 2025-08-21 14:06:23 +05:30
dhanabalan
d4eeee7d05 Refactor root redirect logic to simplify default behavior 2025-08-20 19:53:01 +05:30
dhanabalan
bd17af8945 Update root redirect logic to handle specific host 2025-08-20 19:49:28 +05:30
dhanabalan
95f1e09304 Added policy file for eb reading 2025-08-12 17:27:36 +05:30
dhanabalan
fc42e7db6c Add TempLiveReadingResource files from qds branch 2025-08-12 17:21:22 +05:30
dhanabalan
0d3e58e7af Add EbReadingImporter and EbReadingExporter from qds branch 2025-08-12 17:18:02 +05:30
dhanabalan
658d7cb42c Add EbReadingResource related files from qds branch 2025-08-12 17:14:40 +05:30
dhanabalan
679d532b17 Add EbReading.php model file from qds branch 2025-08-12 17:07:54 +05:30
dhanabalan
50ddd51f04 Add eb_readings migration from qds branch 2025-08-12 16:52:39 +05:30
62 changed files with 2252 additions and 823 deletions

View File

@@ -30,252 +30,11 @@ class SendInvoiceReport extends Command
* Execute the console command.
*/
// public function handle()
// {
// $schedule = $this->argument('schedule_type');
// $plantid = $this->argument('plant');
// $mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
// $startDate = now()->setTime(8, 0, 0);
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
// $plants = InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id');
// $serialTableData = [];
// $materialTableData = [];
// $bundleTableData = [];
// $noSerial = 1;
// $noMaterial = 1;
// $noBundle = 1;
// foreach ($plants as $plantId) {
// $plant = Plant::find($plantId);
// $plantName = $plant ? $plant->name : $plantId;
// //..Serial Invoice
// $totalSerialCount = InvoiceValidation::where('plant_id', $plantId)
// ->whereNull('quantity')
// ->whereBetween('created_at', [$startDate, $endDate])
// ->distinct('invoice_number')
// ->count('invoice_number');
// $scannedSerialCount = InvoiceValidation::select('invoice_number')
// ->where('plant_id', $plantId)
// ->whereNull('quantity')
// ->whereBetween('updated_at', [$startDate, $endDate])
// ->groupBy('invoice_number')
// ->havingRaw(
// "COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)"
// )
// ->count();
// $serialTableData[] = [
// 'no' => $noSerial++,
// 'plant' => $plantName,
// 'totalInvoice' => $totalSerialCount,
// 'scannedInvoice' => $scannedSerialCount,
// ];
// //..Individual Invoice
// $TotalMatCount = InvoiceValidation::where('plant_id', $plantId)
// ->where('quantity', 1)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->distinct('invoice_number')
// ->count('invoice_number');
// $scannedMatCount = InvoiceValidation::select('invoice_number')
// ->where('plant_id', $plantId)
// ->where('quantity', 1)
// ->whereBetween('updated_at', [$startDate, $endDate])
// ->groupBy('invoice_number')
// ->havingRaw(
// "COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
// )
// ->count();
// $materialTableData[] = [
// 'no' => $noMaterial++,
// 'plant' => $plantName,
// 'totalInvoice' => $TotalMatCount,
// 'scannedInvoice' => $scannedMatCount,
// ];
// //..BUndle Invoice
// $totalBundleCount = InvoiceValidation::where('plant_id', $plantId)
// ->where('quantity', '>', 1)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->distinct('invoice_number')
// ->count('invoice_number');
// $scannedBundleCount = InvoiceValidation::select('invoice_number')
// ->where('plant_id', $plantId)
// ->where('quantity', '>', 1)
// ->whereBetween('updated_at', [$startDate, $endDate])
// ->groupBy('invoice_number')
// ->havingRaw(
// "COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
// )
// ->count();
// $bundleTableData[] = [
// 'no' => $noBundle++,
// 'plant' => $plantName,
// 'totalInvoice' => $totalBundleCount,
// 'scannedInvoice' => $scannedBundleCount,
// ];
// }
// // Send to SerialInvoiceMail recipients
// if ($mailRules->has('SerialInvoiceMail')) {
// $emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
// foreach ($emails as $email) {
// Mail::to($email)->send(new test($serialTableData, [], []));
// }
// }
// // Send to MaterialInvoiceMail recipients (material + bundle table)
// if ($mailRules->has('MaterialInvoiceMail')) {
// $emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
// foreach ($emails as $email) {
// Mail::to($email)->send(new test([], $materialTableData, $bundleTableData));
// }
// }
// // Send to InvoiceMail recipients (all three tables)
// if ($mailRules->has('InvoiceMail')) {
// $emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
// foreach ($emails as $email) {
// Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData));
// }
// }
// //$this->info(json_encode($materialTableData));
// }
// public function handle()
// {
// $schedule = $this->argument('schedule_type');
// $plantId = $this->argument('plant');
// $mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
// $startDate = now()->setTime(8, 0, 0);
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
// $serialTableData = [];
// $materialTableData = [];
// $bundleTableData = [];
// $plant = Plant::find($plantId);
// $plantName = $plant ? $plant->name : $plantId;
// // Serial Invoice
// $totalSerialCount = InvoiceValidation::where('plant_id', $plantId)
// ->whereNull('quantity')
// ->whereBetween('created_at', [$startDate, $endDate])
// ->distinct('invoice_number')
// ->count('invoice_number');
// $scannedSerialCount = InvoiceValidation::select('invoice_number')
// ->where('plant_id', $plantId)
// ->whereNull('quantity')
// ->whereBetween('updated_at', [$startDate, $endDate])
// ->groupBy('invoice_number')
// ->havingRaw(
// "COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)"
// )
// ->count();
// $serialTableData[] = [
// 'no' => 1,
// 'plant' => $plantName,
// 'totalInvoice' => $totalSerialCount,
// 'scannedInvoice' => $scannedSerialCount,
// ];
// // Individual Material Invoice
// $TotalMatCount = InvoiceValidation::where('plant_id', $plantId)
// ->where('quantity', 1)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->distinct('invoice_number')
// ->count('invoice_number');
// $scannedMatCount = InvoiceValidation::select('invoice_number')
// ->where('plant_id', $plantId)
// ->where('quantity', 1)
// ->whereBetween('updated_at', [$startDate, $endDate])
// ->groupBy('invoice_number')
// ->havingRaw(
// "COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
// )
// ->count();
// $materialTableData[] = [
// 'no' => 1,
// 'plant' => $plantName,
// 'totalInvoice' => $TotalMatCount,
// 'scannedInvoice' => $scannedMatCount,
// ];
// // Bundle Invoice
// $totalBundleCount = InvoiceValidation::where('plant_id', $plantId)
// ->where('quantity', '>', 1)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->distinct('invoice_number')
// ->count('invoice_number');
// $scannedBundleCount = InvoiceValidation::select('invoice_number')
// ->where('plant_id', $plantId)
// ->where('quantity', '>', 1)
// ->whereBetween('updated_at', [$startDate, $endDate])
// ->groupBy('invoice_number')
// ->havingRaw(
// "COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
// )
// ->count();
// $bundleTableData[] = [
// 'no' => 1,
// 'plant' => $plantName,
// 'totalInvoice' => $totalBundleCount,
// 'scannedInvoice' => $scannedBundleCount,
// ];
// // Send to SerialInvoiceMail recipients
// if ($mailRules->has('SerialInvoiceMail')) {
// $emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
// foreach ($emails as $email) {
// Mail::to($email)->send(new test($serialTableData, [], []));
// }
// }
// // Send to MaterialInvoiceMail recipients (material + bundle table)
// if ($mailRules->has('MaterialInvoiceMail')) {
// $emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
// foreach ($emails as $email) {
// Mail::to($email)->send(new test([], $materialTableData, $bundleTableData));
// }
// }
// // Send to InvoiceMail recipients (all three tables)
// if ($mailRules->has('InvoiceMail')) {
// $emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
// foreach ($emails as $email) {
// Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData));
// }
// }
// // $this->table(
// // ['No', 'Plant', 'Total Invoice', 'Scanned Invoice'],
// // $serialTableData
// // );
// }
public function handle()
{
$schedule = $this->argument('schedule_type');
//$scheduleType = $this->argument('scheduleType');
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
@@ -303,7 +62,8 @@ class SendInvoiceReport extends Command
$startDate = now()->setTime(8, 0, 0);
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
}
foreach ($plantIds as $plantId) {
foreach ($plantIds as $plantId)
{
$plant = Plant::find($plantId);
$plantName = $plant ? $plant->name : $plantId;
@@ -322,11 +82,27 @@ class SendInvoiceReport extends Command
->havingRaw("COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)")
->count();
$serialInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('quantity', null)
->whereBetween('created_at', [$startDate, $endDate])
->count();
$scannedInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('scanned_status', 'Scanned')
->where(function($query) {
$query->whereNull('quantity')
->orWhere('quantity', 0);
})
->whereBetween('updated_at', [$startDate, $endDate])
->count();
$serialTableData[] = [
'no' => $no,
'plant' => $plantName,
'totalInvoice' => $totalSerialCount,
'scannedInvoice' => $scannedSerialCount,
'totalInvoiceQuan' => $serialInvoiceQuan,
'scannedInvoiceQuan' => $scannedInvoiceQuan,
];
// Material Invoice
@@ -344,11 +120,25 @@ class SendInvoiceReport extends Command
->havingRaw("COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)")
->count();
$totalMatInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('quantity', 1)
->whereBetween('created_at', [$startDate, $endDate])
->count();
$scannedMatInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('quantity', 1)
->whereNotNull('serial_number')
->where('serial_number','!=', '')
->whereBetween('updated_at', [$startDate, $endDate])
->count();
$materialTableData[] = [
'no' => $no,
'plant' => $plantName,
'totalInvoice' => $totalMatCount,
'scannedInvoice' => $scannedMatCount,
'totalInvoiceQuan' => $totalMatInvoiceQuan,
'scannedInvoiceQuan' => $scannedMatInvoiceQuan,
];
// Bundle Invoice
@@ -366,29 +156,49 @@ class SendInvoiceReport extends Command
->havingRaw("COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)")
->count();
$totalBundleInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('quantity', '>', 1)
->whereBetween('created_at', [$startDate, $endDate])
->count();
$scannedBundleInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
->where('quantity', '>', 1)
->whereNotNull('serial_number')
->where('serial_number','!=', '')
->whereBetween('updated_at', [$startDate, $endDate])
->count();
$bundleTableData[] = [
'no' => $no,
'plant' => $plantName,
'totalInvoice' => $totalBundleCount,
'scannedInvoice' => $scannedBundleCount,
'totalInvoiceQuan' => $totalBundleInvoiceQuan,
'scannedInvoiceQuan' => $scannedBundleInvoiceQuan,
];
$no++;
}
$mail = new test($serialTableData, $materialTableData, $bundleTableData, $schedule);
$contentVars = $mail->content()->with;
$this->info($contentVars['greeting'] ?? 'Invoice Report');
// Send to SerialInvoiceMail recipients
if ($mailRules->has('SerialInvoiceMail')) {
$emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
foreach ($emails as $email) {
Mail::to($email)->send(new test($serialTableData, [], []));
Mail::to($email)->send(new test($serialTableData, [], [], $schedule));
}
}
// Send to MaterialInvoiceMail recipients (material + bundle table)
if ($mailRules->has('MaterialInvoiceMail')) {
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
foreach ($emails as $email) {
Mail::to($email)->send(new test([], $materialTableData, $bundleTableData));
Mail::to($email)->send(new test([], $materialTableData, $bundleTableData, $schedule));
}
}
@@ -396,19 +206,21 @@ class SendInvoiceReport extends Command
if ($mailRules->has('InvoiceMail')) {
$emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
foreach ($emails as $email) {
Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData));
Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
}
}
// Show preview in console
$this->info('--- Serial Invoice Table ---');
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice'], $serialTableData);
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $serialTableData);
$this->info('--- Material Invoice Table ---');
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice'], $materialTableData);
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $materialTableData);
$this->info('--- Bundle Invoice Table ---');
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice'], $bundleTableData);
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
$this->info($contentVars['wishes'] ?? '');
}

View File

@@ -33,77 +33,6 @@ class SendProductionReport extends Command
* Execute the console command.
*/
// public function handle()
// {
// $scheduleType = $this->argument('schedule_type');
// $plantId = $this->argument('plant');
// $mailRules = \App\Models\AlertMailRule::where('module', 'ProductionQuantities')
// ->where('rule_name', 'ProductionMail')
// ->where('plant', $plantId)
// ->where('schedule_type', $scheduleType)
// ->get();
// $emails = $mailRules->pluck('email')->unique()->toArray();
// $plant = Plant::find($plantId);
// if (!$plant) {
// $this->error("Invalid plant ID: $plantId");
// return;
// }
// $lines = Line::where('plant_id', $plantId)->get();
// $startDate = now()->setTime(8, 0, 0);
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
// $PlanstartDate = now()->setTime(8, 0, 0);
// $planendDate = now()->copy()->addDay()->setTime(7, 59, 00);
// $tableData = [];
// $no = 1;
// foreach ($lines as $line) {
// $lineId = $line->id;
// $lineName = $line->name;
// $targetQuantity = ProductionPlan::where('plant_id', $plantId)
// ->where('line_id', $lineId)
// ->whereBetween('created_at', [$PlanstartDate, $planendDate])
// ->sum('plan_quantity');
// $productionQuantity = ProductionQuantity::where('plant_id', $plantId)
// ->where('line_id', $lineId)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->count();
// $tableData[] = [
// 'no' => $no++,
// 'plant' => $plant->name,
// 'line' => $lineName,
// 'targetQuantity' => $targetQuantity,
// 'productionQuantity' => $productionQuantity,
// ];
// }
// // $this->table(
// // ['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'],
// // $tableData
// // );
// if (!empty($emails)) {
// foreach ($emails as $email) {
// Mail::to($email)->send(new ProductionMail($tableData));
// }
// } else {
// $this->info('No recipients found for ProductionMailAlert.');
// }
// $this->info("Production report sent to " . count($emails) . " recipient(s).");
// }
public function handle()
{
$scheduleType = $this->argument('schedule_type');
@@ -146,55 +75,6 @@ class SendProductionReport extends Command
$tableData = [];
$no = 1;
// foreach ($plants as $plant) {
// $lines = Line::where('plant_id', $plant->id)->get();
// foreach ($lines as $line) {
// $targetQuantity = ProductionPlan::where('plant_id', $plant->id)
// ->where('line_id', $line->id)
// ->whereBetween('created_at', [$PlanstartDate, $planendDate])
// ->sum('plan_quantity');
// $productionQuantity = ProductionQuantity::where('plant_id', $plant->id)
// ->where('line_id', $line->id)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->count();
// $tableData[] = [
// 'no' => $no++,
// 'plant' => $plant->name,
// 'line' => $line->name,
// 'targetQuantity' => $targetQuantity,
// 'productionQuantity' => $productionQuantity,
// ];
// }
// }
// $fgTableData = []; // store FG Line related data
// foreach ($plants as $plant) {
// // ✅ Only get FG Lines
// $fgLines = Line::where('plant_id', $plant->id)
// ->where('type', 'FG Line')
// ->get();
// foreach ($fgLines as $line) {
// $validationCount = \App\Models\QualityValidation::where('plant_id', $plant->id)
// ->where('line_id', $line->id)
// ->whereBetween('created_at', [$startDate, $endDate])
// ->count();
// $fgTableData[] = [
// 'no' => $no++,
// 'plant' => $plant->name,
// 'line' => $line->name,
// 'targetQuantity' => $targetQuantity,
// 'productionQuantity' => $validationCount,
// ];
// }
// }
//..
//.
foreach ($plants as $plant)
@@ -232,20 +112,38 @@ class SendProductionReport extends Command
///$this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $fgTableData);
//$this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $fgTableData);
$this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $tableData);
// $this->table(['No', 'Plant', 'Line', 'Target Quantity', 'Production Quantity'], $tableData);
// if (!empty($emails)) {
// foreach ($emails as $email) {
// Mail::to($email)->send(new ProductionMail($tableData));
// }
// } else {
// $this->info('No recipients found for ProductionMailAlert.');
// }
// $this->info("Production report sent to " . count($emails) . " recipient(s).");
// Preview in console
$mail = new ProductionMail($scheduleType, $tableData);
$contentVars = $mail->content()->with;
$this->info($contentVars['greeting'] ?? 'Production Report');
$this->table(
['No', 'Plant', 'Line', 'Type', 'Target Quantity', 'Production Quantity'],
$tableData
);
$this->info($contentVars['wishes'] ?? '');
// Send mails
if (!empty($emails)) {
foreach ($emails as $email) {
Mail::to($email)->send(new ProductionMail($tableData));
Mail::to($email)->send(new ProductionMail($scheduleType, $tableData));
}
} else {
$this->info('No recipients found for ProductionMailAlert.');
}
$this->info("Production report sent to " . count($emails) . " recipient(s).");
} else {
$this->warn('No recipients found for ProductionMailAlert.');
}
}
}

View File

@@ -22,7 +22,7 @@ class ConfigurationExporter extends Exporter
// Increment and return the row number
return ++$rowNumber;
}),
ExportColumn::make('plant.name')
ExportColumn::make('plant.code')
->label('PLANT'),
ExportColumn::make('line.name')
->label('LINE'),

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

@@ -28,6 +28,8 @@ class MotorTestingMasterExporter extends Exporter
->label('CATEGORY'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('subassembly_code')
->label('SUBASSEMBLY CODE'),
ExportColumn::make('item.description')
->label('DESCRIPTION'),
ExportColumn::make('isi_model')
@@ -69,9 +71,9 @@ class MotorTestingMasterExporter extends Exporter
ExportColumn::make('res_br_ul')
->label('RESISTANCE BR UL'),
ExportColumn::make('lock_volt_limit')
->label('LOCK VOLT Limit'),
->label('LOCK VOLT LIMIT'),
ExportColumn::make('leak_cur_limit')
->label('Leak CURRENT Limit'),
->label('LEAK CURRENT LIMIT'),
ExportColumn::make('lock_cur_ll')
->label('LOCK CURRENT LL'),
ExportColumn::make('lock_cur_ul')

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Filament\Exports;
use App\Models\User;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Models\Export;
class UserExporter extends Exporter
{
protected static ?string $model = User::class;
public static function getColumns(): array
{
static $rowNumber = 0;
return [
// ExportColumn::make('id')
// ->label('ID'),
ExportColumn::make('no')
->label('NO')
->state(function ($record) use (&$rowNumber) {
// Increment and return the row number
return ++$rowNumber;
}),
ExportColumn::make('name')
->label('NAME'),
ExportColumn::make('email')
->label('E-MAIL'),
ExportColumn::make('password')
->label('PASSWORD'),
ExportColumn::make('roles')
->label('ROLES')
->state(function ($record) {
// Assuming Spatie\Permission: roles() relationship
return $record->roles->pluck('name')->join(', ');
}),
ExportColumn::make('created_at')
->label('CREATED AT'),
ExportColumn::make('updated_at')
->label('UPDATED AT'),
ExportColumn::make('deleted_at')
->enabledByDefault(false)
->label('DELETED AT'),
];
}
public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your user export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
}
return $body;
}
}

View File

@@ -41,15 +41,15 @@ class ConfigurationImporter extends Importer
ImportColumn::make('line')
->requiredMapping()
->relationship(resolveUsing: 'name')
->exampleHeader('Plant')
->exampleHeader('Line')
->example(['4 inch pump line'])
->label('Line')
->rules(['required']),
ImportColumn::make('plant')
->requiredMapping()
->relationship(resolveUsing: 'name')
->relationship(resolveUsing: 'code')
->exampleHeader('Plant')
->example(['Ransar Industries-I'])
->example(['1000'])
->label('Plant')
->rules(['required']),
];

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

@@ -35,7 +35,7 @@ class LineStopImporter extends Importer
public function resolveRecord(): ?LineStop
{
$warnMsg = [];
if (Str::length($this->data['code']) < 6 || !ctype_alnum($this->data['code'])) {
if (Str::length($this->data['code']) < 3 || !ctype_alnum($this->data['code'])) {
$warnMsg[] = "Invalid line stop code found";
}
if (Str::length($this->data['reason']) < 5) {

View File

@@ -22,7 +22,14 @@ class MotorTestingMasterImporter extends Importer
->label('Item Code')
->relationship(resolveUsing: 'code')
->rules(['required']),
ImportColumn::make('subassembly_code')
->requiredMapping()
->exampleHeader('SubAssembly Code')
->example(['123456'])
->label('SubAssembly Code')
->rules(['required']),
ImportColumn::make('isi_model')
->requiredMapping()
->boolean()
->exampleHeader('ISI Model')
->example(['Y','N','Y'])
@@ -144,8 +151,8 @@ class MotorTestingMasterImporter extends Importer
->rules(['required']),
ImportColumn::make('leak_cur_limit')
->requiredMapping()
->exampleHeader('Leakage Current Limit')
->label('Leakage Current Limit')
->exampleHeader('Leak Current Limit')
->label('Leak Current Limit')
->example(['50','50','50'])
->rules(['required']),
ImportColumn::make('lock_cur_ll')

View File

@@ -0,0 +1,114 @@
<?php
namespace App\Filament\Imports;
use App\Models\User;
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;
use Spatie\Permission\Models\Role;
use Str;
class UserImporter extends Importer
{
protected static ?string $model = User::class;
public static function getColumns(): array
{
return [
ImportColumn::make('name')
->requiredMapping()
->exampleHeader('Name')
->example('RAW00001')
->label('Name')
->rules(['required']),//, 'max:255'
ImportColumn::make('email')
->requiredMapping()
->exampleHeader('E-mail')
->example('RAW00001@cripumps.com')
->label('E-mail')
->rules(['required', 'email']),//, 'max:255'
ImportColumn::make('password')
->requiredMapping()
->exampleHeader('Password')
->example('RAW00001')
->label('Password')
->rules(['required']),//, 'max:255'
ImportColumn::make('roles')
->requiredMapping()
->exampleHeader('Roles')
->example('Employee')
->label('Roles')
->rules(['nullable', 'string']), // Optional roles
];
}
public function resolveRecord(): ?User
{
$warnMsg = [];
if (Str::length($this->data['name']) < 1) {
$warnMsg[] = "User name not found!";
}
// || !is_numeric($this->data['code']) || !preg_match('/^[1-9]\d{3,}$/', $this->data['code'])
if (Str::length($this->data['email']) < 5) {
$warnMsg[] = "Invalid email found!";
}
if (Str::length($this->data['password']) < 3) {
$warnMsg[] = "Invalid password found!";
}
// Validate roles if provided
$roles = [];
if (!empty($this->data['roles'])) {
$roles = collect(explode(',', $this->data['roles']))
->map(fn($role) => trim($role))
->filter()
->toArray();
foreach ($roles as $roleName) {
if (!Role::where('name', $roleName)->exists()) {
$warnMsg[] = "Role : '{$roleName}' does not exist!";
}
}
}
else {
$warnMsg[] = "User roles not found!";
}
if (!empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg));
}
$user = User::updateOrCreate([
'email' => $this->data['email'],
],
[
'name' => $this->data['name'],
'password' => $this->data['password'],
]);
// Assign roles
if (!empty($roles)) {
$user->syncRoles($roles);
}
return null;
// return User::firstOrNew([
// // Update existing records, matching them by `$this->data['column_name']`
// 'email' => $this->data['email'],
// ]);
//return new User();
}
public static function getCompletedNotificationBody(Import $import): string
{
$body = 'Your user import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
if ($failedRowsCount = $import->getFailedRowsCount()) {
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
}
return $body;
}
}

View File

@@ -12,11 +12,15 @@ class CreateAlertMailRule extends CreateRecord
protected function mutateFormDataBeforeCreate(array $data): array
{
if ($data['is_active']) {
$data['plant'] = 0;
}
return $data;
}
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateBlock extends CreateRecord
{
protected static string $resource = BlockResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateCompany extends CreateRecord
{
protected static string $resource = CompanyResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateConfiguration extends CreateRecord
{
protected static string $resource = ConfigurationResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateDeviceMaster extends CreateRecord
{
protected static string $resource = DeviceMasterResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

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,17 @@
<?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;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

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

@@ -61,6 +61,11 @@ class CreateInvoiceValidation extends CreateRecord
];
}
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
public function processInvoice($invoiceNumber)
{
$invoiceNumber = trim($invoiceNumber);

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateItem extends CreateRecord
{
protected static string $resource = ItemResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateLine extends CreateRecord
{
protected static string $resource = LineResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateLineStop extends CreateRecord
{
protected static string $resource = LineStopResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -21,7 +21,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-locator-invoice-validation';
public $plantId;
public $invoice_number;
public $pallet_number;
public $serial_number, $snoCount;
@@ -29,8 +31,13 @@ class CreateLocatorInvoiceValidation extends CreateRecord
public $locator_number;
public array $matchedSerialNumbersForRemoval = [];
public bool $showRemoveSerialsModal = false;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
public function processinvoiceSNo()
{

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateLocator extends CreateRecord
{
protected static string $resource = LocatorResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -71,9 +71,7 @@ class MachineResource extends Resource
return [];
}
return Line::where('plant_id', $get('plant_id'))
->pluck('name', 'id')
->toArray();
return Line::where('plant_id', $get('plant_id'))->where('no_of_operation', '>', 0)->pluck('name', 'id')->toArray();
})
->default(function () {
return optional(Machine::latest()->first())->line_id;
@@ -87,13 +85,13 @@ class MachineResource extends Resource
}
else
{
$grpWrkCnr = Line::find($lineId)->group_work_center;
if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
{
$set('mLineError', 'Please select a group work center line.');
$set('line_id', null);
return;
}
// $grpWrkCnr = Line::find($lineId)->group_work_center;
// if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
// {
// $set('mLineError', 'Please select a group work center line.');
// $set('line_id', null);
// return;
// }
$set('mLineError', null);
}
})

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateMachine extends CreateRecord
{
protected static string $resource = MachineResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateMfmMeter extends CreateRecord
{
protected static string $resource = MfmMeterResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateMfmParameter extends CreateRecord
{
protected static string $resource = MfmParameterResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateMfmReading extends CreateRecord
{
protected static string $resource = MfmReadingResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateModuleList extends CreateRecord
{
protected static string $resource = ModuleListResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -28,9 +28,9 @@ class MotorTestingMasterResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Master Entries';
protected static ?string $navigationGroup = 'Testing Panel';
protected static ?int $navigationSort = 12;
protected static ?int $navigationSort = 1;
public static function form(Form $form): Form
{
@@ -61,6 +61,11 @@ class MotorTestingMasterResource extends Resource
])
->hint(fn ($get) => $get('mTmError') ? $get('mTmError') : null)
->hintColor('danger'),
Forms\Components\TimePicker::make('routine_test_time')
->label('Routine Test Time')
->default('00:40:00')
->required()
->reactive(),
Forms\Components\Select::make('item_id')
->label('Item Code')
//->relationship('item', 'name')
@@ -82,11 +87,40 @@ class MotorTestingMasterResource extends Resource
->where('plant_id', $get('plant_id'))
->ignore($get('id')); // Ignore current record during updates
}),
Forms\Components\TimePicker::make('routine_test_time')
->label('Routine Test Time')
->default('00:40:00')
Forms\Components\TextInput::make('subassembly_code')
->label('Subassembly Code')
->required()
->reactive(),
->placeholder('Scan the valid code')
->reactive()
->alphaNum()
->minLength(6)
->afterStateUpdated(function ($state, callable $set, callable $get) {
$code = $get('subassembly_code');
// Ensure `linestop_id` is not cleared
if (!$code) {
$set('iCodeError', 'Scan the valid Subassembly Code.');
return;
}
else
{
if (strlen($code) < 6) {
$set('iCodeError', 'Subassembly code must be at least 6 digits.');
return;
}
else if (!preg_match('/^[a-zA-Z0-9]{6,}$/', $code)) {
$set('code',null);
$set('iCodeError', 'Subassembly code must contain only alpha-numeric characters.');
return;
}
$set('iCodeError', null);
}
})
->extraAttributes(fn ($get) => [
'class' => $get('iCodeError') ? 'border-red-500' : '',
])
->hint(fn ($get) => $get('iCodeError') ? $get('iCodeError') : null)
->hintColor('danger'),
Forms\Components\Select::make('isi_model')
->label('ISI Model')
->options([
@@ -296,6 +330,11 @@ class MotorTestingMasterResource extends Resource
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('subassembly_code')
->label('SubAssembly Code')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('Model')
->alignCenter()

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateMotorTestingMaster extends CreateRecord
{
protected static string $resource = MotorTestingMasterResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -14,17 +14,22 @@ use Illuminate\View\View;
class CreatePalletValidation extends CreateRecord
{
public $plantId;
public $pallet_number;
public $palletNo;
public $pendingPallet;
public $snoCount = 0;
public $pallet_number_locked = false;
public $serial_number;
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
protected static string $resource = PalletValidationResource::class;
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
protected static string $resource = PalletValidationResource::class;
protected $listeners = [
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
@@ -32,6 +37,10 @@ class CreatePalletValidation extends CreateRecord
public ?array $data = null;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
public function processPalletSNo()
{

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreatePlant extends CreateRecord
{
protected static string $resource = PlantResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -2093,10 +2093,52 @@ class QualityValidationResource extends Resource
return;
}
// if ($state == $expectedValue)
// {
// $set('part_validation5_error', null);
// }
// else if (strpos($state, '/') != false) {
// $parts = explode('/', $state);
// if (count($parts) >= 2) {
// $segmentToValidate = $parts[1];
// }
// else
// {
// $segmentToValidate = null;
// }
// }
// else
// {
// $set('part_validation5_error', "Invalid input for part validation 5.");
// $set('part_validation5', null);
// return;
// }
if ($state == $expectedValue)
{
$set('part_validation5_error', null);
}
else if (strpos($state, '/') != false)
{
$parts = explode('/', $state);
if (count($parts) >= 2)
{
$segmentToValidate = $parts[1];
if ($segmentToValidate == $expectedValue) {
$set('part_validation5_error', null);
$set('part_validation5', $segmentToValidate);
} else {
$set('part_validation5_error', "Invalid input for part validation 5.");
$set('part_validation5', null);
return;
}
}
else
{
$set('part_validation5_error', "Invalid input format for part validation 5.");
$set('part_validation5', null);
return;
}
}
else
{
$set('part_validation5_error', "Invalid input for part validation 5.");
@@ -2141,6 +2183,7 @@ class QualityValidationResource extends Resource
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->label('Line')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('production_order')
@@ -2417,6 +2460,8 @@ class QualityValidationResource extends Resource
$query->whereIn('sticker_master_id', $stickerMasterIds);
}
}
$query->orderBy('created_at');
})
->indicateUsing(function (array $data) {
$indicators = [];

View File

@@ -21,6 +21,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
protected static string $resource = ReworkLocatorInvoiceValidationResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
public function processInvoiceRework($invoiceNo)
{
$plantId = $this->form->getState()['plant'];

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateShift extends CreateRecord
{
protected static string $resource = ShiftResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -3,12 +3,12 @@
namespace App\Filament\Resources;
use App\Filament\Exports\StickerMasterExporter;
use App\Filament\Imports\ShiftImporter;
//use App\Filament\Imports\ShiftImporter;
use App\Filament\Imports\StickerMasterImporter;
use App\Filament\Resources\StickerMasterResource\Pages;
use App\Filament\Resources\StickerMasterResource\RelationManagers;
//use App\Filament\Resources\StickerMasterResource\RelationManagers;
use App\Models\StickerMaster;
use Closure;
//use Closure;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
@@ -18,6 +18,7 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Forms\Get;
use Filament\Forms\Set;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
// use Illuminate\Validation\Rule;
@@ -98,7 +99,6 @@ class StickerMasterResource extends Resource
// ->disabled(fn (Get $get) => !empty($get('id')))
->live(debounce: 500) // Enable live updates
->afterStateUpdated(function ($state, callable $set, callable $get) {
$plantId = $get('plant_id');
$itemId = $get('item_id');
@@ -153,32 +153,53 @@ class StickerMasterResource extends Resource
->hint(fn ($get) => $get('item_error') ? $get('item_error') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('item_description')
->label('Description')
->required()
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
if ($get('id')) {
$itemId = StickerMaster::where('id', $get('id'))->first()?->item_id;
if ($itemId) {
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
if ($item) {
$set('item_description', $item);
} else {
$set('item_description', null);
}
} else {
$set('item_description', null);
}
}
})
->reactive()
->readOnly(true),
Forms\Components\TextInput::make('part_validation1')
->label('Part Validation 1')
->nullable(),
Forms\Components\TextInput::make('part_validation2')
->label('Part Validation 2')
->nullable(),
Forms\Components\TextInput::make('part_validation3')
->label('Part Validation 3')
->nullable(),
Forms\Components\TextInput::make('part_validation4')
->label('Part Validation 4')
->nullable(),
Forms\Components\TextInput::make('part_validation5')
->label('Part Validation 5 (Capacitor QR)')
->nullable(),
Forms\Components\TextInput::make('laser_part_validation1')
->label('Laser Part Validation 1')
->nullable(),
Forms\Components\TextInput::make('laser_part_validation2')
->label('Laser Part Validation 2')
->nullable(),
Forms\Components\TextInput::make('panel_box_code')
@@ -189,12 +210,11 @@ class StickerMasterResource extends Resource
Forms\Components\TextInput::make('load_rate')
->label('Load Rate')
->default(0)
->required()
->disabled(function ($get) {
return $get('material_type');
})
->integer()
->nullable(),
->integer(),
Forms\Components\Select::make('material_type')
->label('Material Type')
@@ -410,7 +430,6 @@ class StickerMasterResource extends Resource
Forms\Components\TextInput::make('id')
->hidden()
->readOnly(),
]);
}

View File

@@ -21,4 +21,9 @@ class CreateStickerMaster extends CreateRecord
]);
}
}
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

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

View File

@@ -14,4 +14,9 @@ class CreateTempLiveReading extends CreateRecord
{
return 'Create Live Readings';
}
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -2,13 +2,18 @@
namespace App\Filament\Resources;
use App\Filament\Exports\UserExporter;
use App\Filament\Imports\UserImporter;
use App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource\RelationManagers;
use App\Models\User;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
@@ -80,6 +85,7 @@ class UserResource extends Resource
// ->label('ID')
// ->numeric()
// ->sortable(),
Tables\Columns\TextColumn::make('No.')
->label('No.')
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
@@ -91,18 +97,23 @@ class UserResource extends Resource
Tables\Columns\TextColumn::make('name')
->label('User Name')
->alignCenter()
->sortable()
->searchable(),
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('email')
->label('Email')
->alignCenter()
->sortable()
->searchable(),
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('email_verified_at')
->label('Email Verified At')
->dateTime()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('roles.name')
->label('Roles')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->dateTime()
@@ -134,6 +145,18 @@ class UserResource extends Resource
Tables\Actions\ForceDeleteBulkAction::make(),
Tables\Actions\RestoreBulkAction::make(),
]),
])
->headerActions([
ImportAction::make()
->importer(UserImporter::class)
->visible(function() {
return Filament::auth()->user()->can('view import user');
}),
ExportAction::make()
->exporter(UserExporter::class)
->visible(function() {
return Filament::auth()->user()->can('view export user');
}),
]);
}

View File

@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('create');
}
}

View File

@@ -458,6 +458,7 @@ class TestingPanelController extends Controller
}
$output = [
"mot_subassembly_code" => $motorTestingMaster->subassembly_code ?? "",
"mot_model_name" => $description,
"mot_non_isi_model" => $motorTestingMaster->isi_model ? "0" :"1",
"mot_phase" => $motorTestingMaster->phase ?? "",
@@ -488,7 +489,7 @@ class TestingPanelController extends Controller
"mot_noload_pow_ll" => $motorTestingMaster->noload_pow_ll ?? "",
"mot_noload_pow_ul" => $motorTestingMaster->noload_pow_ul ?? "",
"mot_noload_spd_ll" => $motorTestingMaster->noload_spd_ll ?? "",
"mot_noload_spd_ul" => $motorTestingMaster->noload_spd_ul ?? "",
"mot_noload_spd_ul" => $motorTestingMaster->noload_spd_ul ?? ""
];
return response()->json($output, 200);

View File

@@ -2,6 +2,7 @@
namespace App\Mail;
use DateTime;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
@@ -14,12 +15,14 @@ class ProductionMail extends Mailable
use Queueable, SerializesModels;
public $tableData;
public $scheduleType;
/**
* Create a new message instance.
*/
public function __construct($tableData = [])
public function __construct($scheduleType,$tableData = [])
{
$this->scheduleType = $scheduleType;
$this->tableData = $tableData ?? [];
}
@@ -36,19 +39,57 @@ class ProductionMail extends Mailable
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'mail.production_report',
// with: [
// 'company' => "CRI Digital Manufacturing Solutions",
// 'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,",
// // 'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,<br>" . $reportPeriod,
// 'tableData' => $this->tableData,
// 'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
// ],
// );
// }
public function content(): Content
{
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,";
if ($this->scheduleType == 'Daily') {
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i') . ':000';
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i') . ':999';
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
$greeting .= $reportPeriod;
}
if ($this->scheduleType == 'Hourly') {
$now = now();
$fromHour = $now->copy()->subHour()->format('H:i:s');
$toHour = $now->format('H:i:s');
$reportDate = $now->format('d/m/Y');
$greeting .= "The following report presents results from: $reportDate, $fromHour to $toHour.";
}
if ($this->scheduleType == 'Live') {
$now = now();
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
$toMinute = $now->format('d/m/Y H:i:s');
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
}
return new Content(
view: 'mail.production_report',
with: [
'company' => "CRI Digital Manufacturing Solutions",
'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,",
'greeting' => $greeting,
'tableData' => $this->tableData,
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
],
);
}
/**
* Get the attachments for the message.
*

View File

@@ -2,6 +2,7 @@
namespace App\Mail;
use DateTime;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
@@ -16,16 +17,16 @@ class test extends Mailable
public $materialTableData;
public $bundleTableData;
public $schedule;
/**
* Create a new message instance.
*/
// public function __construct($tableData = [])
// {
// $this->tableData = $tableData ?? [];
// }
public function __construct($serialTableData, $materialTableData, $bundleTableData)
public function __construct($serialTableData, $materialTableData, $bundleTableData, $schedule)
{
$this->schedule = $schedule;
$this->serialTableData = $serialTableData;
$this->materialTableData = $materialTableData;
$this->bundleTableData = $bundleTableData;
@@ -44,18 +45,54 @@ class test extends Mailable
/**
* Get the message content definition.
*/
// public function content(): Content
// {
// return new Content(
// view: 'mail.test_mail',
// with: [
// 'company' => "CRI Digital Manufacturing Solutions",
// 'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached invoice status details for the 'Total Number of Invoices' and 'Scanned Number of Invoices' count,",
// //'tableData' => $this->tableData,
// 'serialTableData' => $this->serialTableData,
// 'materialTableData' => $this->materialTableData,
// 'bundleTableData' => $this->bundleTableData,
// 'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
// ],
// );
// }
public function content(): Content
{
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached invoice status details for the 'Total Number of Invoices' and 'Scanned Number of Invoices' count,";
if ($this->schedule == 'Daily') {
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i') . ':000';
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i') . ':999';
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
//$greeting .= $reportPeriod;
$greeting .= "<br><br>$reportPeriod";
}
if ($this->schedule == 'Hourly') {
$now = now();
$fromHour = $now->copy()->subHour()->format('H:i:s');
$toHour = $now->format('H:i:s');
$reportDate = $now->format('d/m/Y');
$greeting .= "The following report presents results from: $reportDate, $fromHour to $toHour.";
}
if ($this->schedule == 'Live') {
$now = now();
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
$toMinute = $now->format('d/m/Y H:i:s');
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
}
return new Content(
view: 'mail.test_mail',
// with: [
// 'name' => "CRI Digital Manufacturing Solutions<br><br>Dear Sir/Madam,<br><br> Kindly find the attached invoice status details for the 'Total Number Of Invoices' and 'Scanned Number Of Invoices' count,",
// 'tableData' => $this->tableData,
// 'wishes' => "Thanks & Regards<br><br>CRI Digital Manufacturing Solutions"
// ],
with: [
'company' => "CRI Digital Manufacturing Solutions",
'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached invoice status details for the 'Total Number of Invoices' and 'Scanned Number of Invoices' count,",
'greeting' => $greeting,
//'greeting' => "Dear Sir/Madam,<br><br>Kindly find the attached invoice status details for the 'Total Number of Invoices' and 'Scanned Number of Invoices' count,",
//'tableData' => $this->tableData,
'serialTableData' => $this->serialTableData,
'materialTableData' => $this->materialTableData,

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

@@ -13,6 +13,7 @@ class MotorTestingMaster extends Model
protected $fillable = [
'plant_id',
'item_id',
'subassembly_code',
'isi_model',
'phase',
'kw',

View File

@@ -22,6 +22,12 @@ class ProductionQuantity extends Model
"serial_number",
"production_order",
"operator_id",
// "success_status",
// "no_of_employee",
// "list_of_employee",
"created_at",
"updated_at"
];
public function plant(): BelongsTo

View File

@@ -35,6 +35,8 @@ class QualityValidation extends Model
'part_validation5',
'operator_id',
'uom',
'created_at',
'updated_at',
'serial_number',
'sap_msg_status',
'sap_msg_description',

View File

@@ -0,0 +1,106 @@
<?php
namespace App\Policies;
use Illuminate\Auth\Access\Response;
use App\Models\EbReading;
use App\Models\User;
class EbReadingPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->checkPermissionTo('view-any EbReading');
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, EbReading $ebreading): bool
{
return $user->checkPermissionTo('view EbReading');
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->checkPermissionTo('create EbReading');
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, EbReading $ebreading): bool
{
return $user->checkPermissionTo('update EbReading');
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, EbReading $ebreading): bool
{
return $user->checkPermissionTo('delete EbReading');
}
/**
* Determine whether the user can delete any models.
*/
public function deleteAny(User $user): bool
{
return $user->checkPermissionTo('delete-any EbReading');
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, EbReading $ebreading): bool
{
return $user->checkPermissionTo('restore EbReading');
}
/**
* Determine whether the user can restore any models.
*/
public function restoreAny(User $user): bool
{
return $user->checkPermissionTo('restore-any EbReading');
}
/**
* Determine whether the user can replicate the model.
*/
public function replicate(User $user, EbReading $ebreading): bool
{
return $user->checkPermissionTo('replicate EbReading');
}
/**
* Determine whether the user can reorder the models.
*/
public function reorder(User $user): bool
{
return $user->checkPermissionTo('reorder EbReading');
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, EbReading $ebreading): bool
{
return $user->checkPermissionTo('force-delete EbReading');
}
/**
* Determine whether the user can permanently delete any models.
*/
public function forceDeleteAny(User $user): bool
{
return $user->checkPermissionTo('force-delete-any EbReading');
}
}

View File

@@ -70,7 +70,6 @@ return new class extends Migration
DB::statement($sql);
}
/**
* Reverse the migrations.
*/

View File

@@ -15,6 +15,8 @@ return new class extends Migration
CREATE TABLE alert_mail_rules (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant BIGINT NOT NULL DEFAULT(0),
module TEXT NOT NULL,
rule_name TEXT NOT NULL,
@@ -27,6 +29,7 @@ return new class extends Migration
created_by TEXT NOT NULL,
updated_by TEXT NOT NULL
);
SQL;

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

@@ -13,8 +13,8 @@ return new class extends Migration
{
$sql1 = <<<'SQL'
ALTER TABLE alert_mail_rules
ADD plant BIGINT NOT NULL DEFAULT (0);
ALTER TABLE motor_testing_masters
ADD subassembly_code TEXT DEFAULT NULL;
SQL;
@@ -26,7 +26,7 @@ return new class extends Migration
*/
public function down(): void
{
// Schema::table('alert_mail_rules', function (Blueprint $table) {
// Schema::table('motor_testing_masters', function (Blueprint $table) {
// //
// });
}

View File

@@ -34,24 +34,57 @@ class PermissionSeeder extends Seeder
}
//Master and Transaction Pages
Permission::updateOrCreate(['name' => 'view import block']);
Permission::updateOrCreate(['name' => 'view export block']);
Permission::updateOrCreate(['name' => 'view import user']);
Permission::updateOrCreate(['name' => 'view export user']);
Permission::updateOrCreate(['name' => 'view import company']);
Permission::updateOrCreate(['name' => 'view export company']);
Permission::updateOrCreate(['name' => 'view import plant']);
Permission::updateOrCreate(['name' => 'view export plant']);
Permission::updateOrCreate(['name' => 'view import block']);
Permission::updateOrCreate(['name' => 'view export block']);
Permission::updateOrCreate(['name' => 'view import shift']);
Permission::updateOrCreate(['name' => 'view export shift']);
Permission::updateOrCreate(['name' => 'view import line']);
Permission::updateOrCreate(['name' => 'view export line']);
Permission::updateOrCreate(['name' => 'view import item']);
Permission::updateOrCreate(['name' => 'view export item']);
Permission::updateOrCreate(['name' => 'view import line stop']);
Permission::updateOrCreate(['name' => 'view export line stop']);
Permission::updateOrCreate(['name' => 'view import sticker master']);
Permission::updateOrCreate(['name' => 'view export sticker master']);
Permission::updateOrCreate(['name' => 'view import locator']);
Permission::updateOrCreate(['name' => 'view export locator']);
Permission::updateOrCreate(['name' => 'view import configuration']);
Permission::updateOrCreate(['name' => 'view export configuration']);
Permission::updateOrCreate(['name' => 'view import work group master']);
Permission::updateOrCreate(['name' => 'view export work group master']);
Permission::updateOrCreate(['name' => 'view import machine']);
Permission::updateOrCreate(['name' => 'view export machine']);
Permission::updateOrCreate(['name' => 'view import motor testing master']);
Permission::updateOrCreate(['name' => 'view export motor testing master']);
Permission::updateOrCreate(['name' => 'view import guard name']);
Permission::updateOrCreate(['name' => 'view export guard name']);
Permission::updateOrCreate(['name' => 'view import check point name']);
Permission::updateOrCreate(['name' => 'view export check point name']);
Permission::updateOrCreate(['name' => 'view import check point time']);
Permission::updateOrCreate(['name' => 'view export check point time']);
Permission::updateOrCreate(['name' => 'view import guard name']);
Permission::updateOrCreate(['name' => 'view export guard name']);
Permission::updateOrCreate(['name' => 'view import guard patrol entry']);
Permission::updateOrCreate(['name' => 'view export guard patrol entry']);
Permission::updateOrCreate(['name' => 'view import guard patrol entries']);
@@ -60,34 +93,13 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view import material invoice']);
Permission::updateOrCreate(['name' => 'view export invoice']);
Permission::updateOrCreate(['name' => 'view import item']);
Permission::updateOrCreate(['name' => 'view export item']);
Permission::updateOrCreate(['name' => 'view import line']);
Permission::updateOrCreate(['name' => 'view export line']);
Permission::updateOrCreate(['name' => 'view import line stop']);
Permission::updateOrCreate(['name' => 'view export line stop']);
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
Permission::updateOrCreate(['name' => 'view export locator invoice validation']);
Permission::updateOrCreate(['name' => 'view import dispatch serial invoice validation']);
Permission::updateOrCreate(['name' => 'view import locator']);
Permission::updateOrCreate(['name' => 'view export locator']);
Permission::updateOrCreate(['name' => 'view import machine']);
Permission::updateOrCreate(['name' => 'view export machine']);
Permission::updateOrCreate(['name' => 'view import motor testing master']);
Permission::updateOrCreate(['name' => 'view export motor testing master']);
Permission::updateOrCreate(['name' => 'view import pallet validation']);
Permission::updateOrCreate(['name' => 'view export pallet validation']);
Permission::updateOrCreate(['name' => 'view import plant']);
Permission::updateOrCreate(['name' => 'view export plant']);
Permission::updateOrCreate(['name' => 'view import production line stop']);
Permission::updateOrCreate(['name' => 'view export production line stop']);
@@ -100,12 +112,6 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view import quality validation']);
Permission::updateOrCreate(['name' => 'view export quality validation']);
Permission::updateOrCreate(['name' => 'view import shift']);
Permission::updateOrCreate(['name' => 'view export shift']);
Permission::updateOrCreate(['name' => 'view import sticker master']);
Permission::updateOrCreate(['name' => 'view export sticker master']);
Permission::updateOrCreate(['name' => 'view import testing panel reading']);
Permission::updateOrCreate(['name' => 'view export testing panel reading']);
@@ -144,7 +150,6 @@ class PermissionSeeder extends Seeder
Permission::updateOrCreate(['name' => 'view ems trend line analysis dashboard']);
Permission::updateOrCreate(['name' => 'view ems trend chart analysis dashboard']);
//Send To Sap Permissions
Permission::updateOrCreate(['name' => 'view quality data send to sap']);
Permission::updateOrCreate(['name' => 'view production data send to sap']);

View File

@@ -14,7 +14,7 @@ class UserSeeder extends Seeder
public function run(): void
{
$user1 = User::updateOrCreate(
['email' => 'dhanabalan@cripumps.com'],
['email' => 'dhanabalan.saravanan@cripumps.com'],
[
'name' => 'Dhanabalan S',
'password' => bcrypt('SdHaNa@123'),

View File

@@ -98,6 +98,8 @@
<th>Plant</th>
<th>Total Number of Invoice</th>
<th>Scanned Number of Invoice</th>
<th>Total Invoice Quantity</th>
<th>Scanned Invoice Quantity</th>
</tr>
</thead>
<tbody>
@@ -107,6 +109,8 @@
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
<td>{{ $row['totalInvoice'] }}</td>
<td>{{ $row['scannedInvoice'] }}</td>
<td>{{ $row['totalInvoiceQuan'] }}</td>
<td>{{ $row['scannedInvoiceQuan'] }}</td>
</tr>
@endforeach
</tbody>
@@ -123,6 +127,8 @@
<th>Plant</th>
<th>Total Number of Invoice</th>
<th>Scanned Number of Invoice</th>
<th>Total Invoice Quantity</th>
<th>Scanned Invoice Quantity</th>
</tr>
</thead>
<tbody>
@@ -132,6 +138,8 @@
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
<td>{{ $row['totalInvoice'] }}</td>
<td>{{ $row['scannedInvoice'] }}</td>
<td>{{ $row['totalInvoiceQuan'] }}</td>
<td>{{ $row['scannedInvoiceQuan'] }}</td>
</tr>
@endforeach
</tbody>
@@ -148,6 +156,8 @@
<th>Plant</th>
<th>Total Number of Invoice</th>
<th>Scanned Number of Invoice</th>
<th>Total Invoice Quantity</th>
<th>Scanned Invoice Quantity</th>
</tr>
</thead>
<tbody>
@@ -157,6 +167,8 @@
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
<td>{{ $row['totalInvoice'] }}</td>
<td>{{ $row['scannedInvoice'] }}</td>
<td>{{ $row['totalInvoiceQuan'] }}</td>
<td>{{ $row['scannedInvoiceQuan'] }}</td>
</tr>
@endforeach
</tbody>

View File

@@ -9,17 +9,17 @@ Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
// Schedule::command('send:invoice-report');
// Schedule::command('send:invoice-report');
// Schedule::command('send:production-report');
app()->booted(function () {
$schedule = app(Schedule::class);
//Production report scheduling
// Production report scheduling
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
->where('rule_name', 'ProductionMail')
//->select('plant', 'schedule_type')
->select('plant', 'schedule_type')
->select('plant', 'schedule_type')
->distinct()
->get();