Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8813567f0b | ||
|
|
ffa2b1f783 | ||
|
|
e29c16c79a | ||
|
|
4d516e955c | ||
|
|
b0d73dbbc6 | ||
|
|
37c91afe25 | ||
|
|
77064399cd | ||
|
|
3398a60d1b | ||
|
|
65aafbeb65 | ||
|
|
ad72d38193 | ||
|
|
cac91722c3 | ||
|
|
bb2b81d0f2 | ||
|
|
2150f6098f | ||
|
|
a0a1e87440 | ||
|
|
8da3c746b9 | ||
|
|
d05623f920 | ||
|
|
e3d29cba81 | ||
|
|
5cbae18532 | ||
|
|
7e688683d7 | ||
|
|
ab5a8c0874 | ||
|
|
19e1f12f5d | ||
|
|
e57962f023 | ||
|
|
c5a730b71d | ||
|
|
967a429595 | ||
|
|
7f0d138383 | ||
|
|
d5c0303be4 | ||
|
|
c2f9b77e1f | ||
| 3053098cfb | |||
| a5ded4a20a | |||
|
|
d419973ab5 | ||
|
|
86e458037f | ||
|
|
e6ba543589 | ||
|
|
1cee8dc71d | ||
|
|
3a009543ea | ||
|
|
d4045b7b0f | ||
|
|
a831f6e787 | ||
|
|
b399141c7e | ||
|
|
8fd2212ec4 | ||
|
|
e6f78c60d5 | ||
|
|
a3a421af88 | ||
|
|
d4eeee7d05 | ||
|
|
bd17af8945 | ||
|
|
95f1e09304 | ||
|
|
fc42e7db6c | ||
|
|
0d3e58e7af | ||
|
|
658d7cb42c | ||
|
|
679d532b17 | ||
|
|
50ddd51f04 |
@@ -30,252 +30,11 @@ class SendInvoiceReport extends Command
|
|||||||
* Execute the console 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()
|
public function handle()
|
||||||
{
|
{
|
||||||
$schedule = $this->argument('schedule_type');
|
$schedule = $this->argument('schedule_type');
|
||||||
|
//$scheduleType = $this->argument('scheduleType');
|
||||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
||||||
|
|
||||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
$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);
|
$startDate = now()->setTime(8, 0, 0);
|
||||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||||
}
|
}
|
||||||
foreach ($plantIds as $plantId) {
|
foreach ($plantIds as $plantId)
|
||||||
|
{
|
||||||
$plant = Plant::find($plantId);
|
$plant = Plant::find($plantId);
|
||||||
$plantName = $plant ? $plant->name : $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)")
|
->havingRaw("COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)")
|
||||||
->count();
|
->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[] = [
|
$serialTableData[] = [
|
||||||
'no' => $no,
|
'no' => $no,
|
||||||
'plant' => $plantName,
|
'plant' => $plantName,
|
||||||
'totalInvoice' => $totalSerialCount,
|
'totalInvoice' => $totalSerialCount,
|
||||||
'scannedInvoice' => $scannedSerialCount,
|
'scannedInvoice' => $scannedSerialCount,
|
||||||
|
'totalInvoiceQuan' => $serialInvoiceQuan,
|
||||||
|
'scannedInvoiceQuan' => $scannedInvoiceQuan,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Material Invoice
|
// 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)")
|
->havingRaw("COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)")
|
||||||
->count();
|
->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[] = [
|
$materialTableData[] = [
|
||||||
'no' => $no,
|
'no' => $no,
|
||||||
'plant' => $plantName,
|
'plant' => $plantName,
|
||||||
'totalInvoice' => $totalMatCount,
|
'totalInvoice' => $totalMatCount,
|
||||||
'scannedInvoice' => $scannedMatCount,
|
'scannedInvoice' => $scannedMatCount,
|
||||||
|
'totalInvoiceQuan' => $totalMatInvoiceQuan,
|
||||||
|
'scannedInvoiceQuan' => $scannedMatInvoiceQuan,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Bundle Invoice
|
// 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)")
|
->havingRaw("COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)")
|
||||||
->count();
|
->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[] = [
|
$bundleTableData[] = [
|
||||||
'no' => $no,
|
'no' => $no,
|
||||||
'plant' => $plantName,
|
'plant' => $plantName,
|
||||||
'totalInvoice' => $totalBundleCount,
|
'totalInvoice' => $totalBundleCount,
|
||||||
'scannedInvoice' => $scannedBundleCount,
|
'scannedInvoice' => $scannedBundleCount,
|
||||||
|
'totalInvoiceQuan' => $totalBundleInvoiceQuan,
|
||||||
|
'scannedInvoiceQuan' => $scannedBundleInvoiceQuan,
|
||||||
];
|
];
|
||||||
|
|
||||||
$no++;
|
$no++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mail = new test($serialTableData, $materialTableData, $bundleTableData, $schedule);
|
||||||
|
$contentVars = $mail->content()->with;
|
||||||
|
|
||||||
|
$this->info($contentVars['greeting'] ?? 'Invoice Report');
|
||||||
|
|
||||||
// Send to SerialInvoiceMail recipients
|
// Send to SerialInvoiceMail recipients
|
||||||
if ($mailRules->has('SerialInvoiceMail')) {
|
if ($mailRules->has('SerialInvoiceMail')) {
|
||||||
$emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
|
$emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
foreach ($emails as $email) {
|
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)
|
// Send to MaterialInvoiceMail recipients (material + bundle table)
|
||||||
if ($mailRules->has('MaterialInvoiceMail')) {
|
if ($mailRules->has('MaterialInvoiceMail')) {
|
||||||
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
foreach ($emails as $email) {
|
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')) {
|
if ($mailRules->has('InvoiceMail')) {
|
||||||
$emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
|
$emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
foreach ($emails as $email) {
|
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
|
// Show preview in console
|
||||||
$this->info('--- Serial Invoice Table ---');
|
$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->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->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'] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,77 +33,6 @@ class SendProductionReport extends Command
|
|||||||
* Execute the console 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()
|
public function handle()
|
||||||
{
|
{
|
||||||
$scheduleType = $this->argument('schedule_type');
|
$scheduleType = $this->argument('schedule_type');
|
||||||
@@ -146,55 +75,6 @@ class SendProductionReport extends Command
|
|||||||
$tableData = [];
|
$tableData = [];
|
||||||
$no = 1;
|
$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)
|
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)) {
|
if (!empty($emails)) {
|
||||||
foreach ($emails as $email) {
|
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).");
|
$this->info("Production report sent to " . count($emails) . " recipient(s).");
|
||||||
|
} else {
|
||||||
|
$this->warn('No recipients found for ProductionMailAlert.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class ConfigurationExporter extends Exporter
|
|||||||
// Increment and return the row number
|
// Increment and return the row number
|
||||||
return ++$rowNumber;
|
return ++$rowNumber;
|
||||||
}),
|
}),
|
||||||
ExportColumn::make('plant.name')
|
ExportColumn::make('plant.code')
|
||||||
->label('PLANT'),
|
->label('PLANT'),
|
||||||
ExportColumn::make('line.name')
|
ExportColumn::make('line.name')
|
||||||
->label('LINE'),
|
->label('LINE'),
|
||||||
|
|||||||
@@ -1,92 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Exports;
|
|
||||||
|
|
||||||
use App\Models\MfmReading;
|
|
||||||
use Filament\Actions\Exports\ExportColumn;
|
|
||||||
use Filament\Actions\Exports\Exporter;
|
|
||||||
use Filament\Actions\Exports\Models\Export;
|
|
||||||
|
|
||||||
class MfmReadingExporter extends Exporter
|
|
||||||
{
|
|
||||||
protected static ?string $model = MfmReading::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
static $rowNumber = 0;
|
|
||||||
return [
|
|
||||||
ExportColumn::make('no')
|
|
||||||
->label('NO')
|
|
||||||
->state(function ($record) use (&$rowNumber) {
|
|
||||||
// Increment and return the row number
|
|
||||||
return ++$rowNumber;
|
|
||||||
}),
|
|
||||||
ExportColumn::make('plant.name')
|
|
||||||
->label('PLANT'),
|
|
||||||
ExportColumn::make('mfmMeter.name')
|
|
||||||
->label('MFM METER NAME'),
|
|
||||||
ExportColumn::make('apparent_energy_received')
|
|
||||||
->label('APPARENT ENERGY RECEIVED'),
|
|
||||||
ExportColumn::make('reactive_energy_received')
|
|
||||||
->label('REACTIVE ENERGY RECEIVED'),
|
|
||||||
ExportColumn::make('active_energy_received')
|
|
||||||
->label('ACTIVE ENERGY RECEIVED'),
|
|
||||||
ExportColumn::make('active_power_r')
|
|
||||||
->label('ACTIVE POWER R'),
|
|
||||||
ExportColumn::make('active_power_y')
|
|
||||||
->label('ACTIVE POWER Y'),
|
|
||||||
ExportColumn::make('active_power_b')
|
|
||||||
->label('ACTIVE POWER B'),
|
|
||||||
ExportColumn::make('active_power_total')
|
|
||||||
->label('ACTIVE POWER TOTAL'),
|
|
||||||
ExportColumn::make('voltage_ry')
|
|
||||||
->label('VOLTAGE RY'),
|
|
||||||
ExportColumn::make('voltage_yb')
|
|
||||||
->label('VOLTAGE YB'),
|
|
||||||
ExportColumn::make('voltage_br')
|
|
||||||
->label('VOLTAGE BR'),
|
|
||||||
ExportColumn::make('current_r')
|
|
||||||
->label('CURRENT R'),
|
|
||||||
ExportColumn::make('current_y')
|
|
||||||
->label('CURRENT Y'),
|
|
||||||
ExportColumn::make('current_b')
|
|
||||||
->label('CURRENT B'),
|
|
||||||
ExportColumn::make('current_n')
|
|
||||||
->label('CURRENT N'),
|
|
||||||
ExportColumn::make('voltage_r_n')
|
|
||||||
->label('VOLTAGE R N'),
|
|
||||||
ExportColumn::make('voltage_y_n')
|
|
||||||
->label('VOLTAGE Y N'),
|
|
||||||
ExportColumn::make('voltage_b_n')
|
|
||||||
->label('VOLTAGE B N'),
|
|
||||||
ExportColumn::make('frequency')
|
|
||||||
->label('FREQUENCY'),
|
|
||||||
ExportColumn::make('power_factor_r')
|
|
||||||
->label('POWER FACTOR R'),
|
|
||||||
ExportColumn::make('power_factor_y')
|
|
||||||
->label('POWER FACTOR Y'),
|
|
||||||
ExportColumn::make('power_factor_b')
|
|
||||||
->label('POWER FACTOR B'),
|
|
||||||
ExportColumn::make('power_factor_total')
|
|
||||||
->label('POWER FACTOR TOTAL'),
|
|
||||||
ExportColumn::make('created_at')
|
|
||||||
->label('CREATED AT'),
|
|
||||||
ExportColumn::make('updated_at')
|
|
||||||
->label('UPDATED AT'),
|
|
||||||
ExportColumn::make('deleted_at')
|
|
||||||
->label('DELETED AT')
|
|
||||||
->enabledByDefault(false),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
|
||||||
{
|
|
||||||
$body = 'Your mfm reading export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,6 +28,8 @@ class MotorTestingMasterExporter extends Exporter
|
|||||||
->label('CATEGORY'),
|
->label('CATEGORY'),
|
||||||
ExportColumn::make('item.code')
|
ExportColumn::make('item.code')
|
||||||
->label('ITEM CODE'),
|
->label('ITEM CODE'),
|
||||||
|
ExportColumn::make('subassembly_code')
|
||||||
|
->label('SUBASSEMBLY CODE'),
|
||||||
ExportColumn::make('item.description')
|
ExportColumn::make('item.description')
|
||||||
->label('DESCRIPTION'),
|
->label('DESCRIPTION'),
|
||||||
ExportColumn::make('isi_model')
|
ExportColumn::make('isi_model')
|
||||||
@@ -69,9 +71,9 @@ class MotorTestingMasterExporter extends Exporter
|
|||||||
ExportColumn::make('res_br_ul')
|
ExportColumn::make('res_br_ul')
|
||||||
->label('RESISTANCE BR UL'),
|
->label('RESISTANCE BR UL'),
|
||||||
ExportColumn::make('lock_volt_limit')
|
ExportColumn::make('lock_volt_limit')
|
||||||
->label('LOCK VOLT Limit'),
|
->label('LOCK VOLT LIMIT'),
|
||||||
ExportColumn::make('leak_cur_limit')
|
ExportColumn::make('leak_cur_limit')
|
||||||
->label('Leak CURRENT Limit'),
|
->label('LEAK CURRENT LIMIT'),
|
||||||
ExportColumn::make('lock_cur_ll')
|
ExportColumn::make('lock_cur_ll')
|
||||||
->label('LOCK CURRENT LL'),
|
->label('LOCK CURRENT LL'),
|
||||||
ExportColumn::make('lock_cur_ul')
|
ExportColumn::make('lock_cur_ul')
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Exports;
|
|
||||||
|
|
||||||
use App\Models\TempLiveReading;
|
|
||||||
use Filament\Actions\Exports\ExportColumn;
|
|
||||||
use Filament\Actions\Exports\Exporter;
|
|
||||||
use Filament\Actions\Exports\Models\Export;
|
|
||||||
|
|
||||||
class TempLiveReadingExporter extends Exporter
|
|
||||||
{
|
|
||||||
protected static ?string $model = TempLiveReading::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
static $rowNumber = 0;
|
|
||||||
return [
|
|
||||||
ExportColumn::make('no')
|
|
||||||
->label('NO')
|
|
||||||
->state(function ($record) use (&$rowNumber) {
|
|
||||||
return ++$rowNumber;
|
|
||||||
}),
|
|
||||||
ExportColumn::make('plant.name')
|
|
||||||
->label('PLANT'),
|
|
||||||
ExportColumn::make('mfmMeter.name')
|
|
||||||
->label('MFM METER NAME'),
|
|
||||||
ExportColumn::make('register_data')
|
|
||||||
->label('REGISTER DATA'),
|
|
||||||
ExportColumn::make('created_at')
|
|
||||||
->label('CREATED AT'),
|
|
||||||
ExportColumn::make('updated_at')
|
|
||||||
->label('UPDATED AT'),
|
|
||||||
ExportColumn::make('deleted_at')
|
|
||||||
->label('DELETED AT')
|
|
||||||
->enabledByDefault(false),
|
|
||||||
ExportColumn::make('created_by')
|
|
||||||
->label('CREATED BY'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
|
||||||
{
|
|
||||||
$body = 'Your temp live reading export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
58
app/Filament/Exports/UserExporter.php
Normal file
58
app/Filament/Exports/UserExporter.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class UserExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = User::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
|
return [
|
||||||
|
// ExportColumn::make('id')
|
||||||
|
// ->label('ID'),
|
||||||
|
ExportColumn::make('no')
|
||||||
|
->label('NO')
|
||||||
|
->state(function ($record) use (&$rowNumber) {
|
||||||
|
// Increment and return the row number
|
||||||
|
return ++$rowNumber;
|
||||||
|
}),
|
||||||
|
ExportColumn::make('name')
|
||||||
|
->label('NAME'),
|
||||||
|
ExportColumn::make('email')
|
||||||
|
->label('E-MAIL'),
|
||||||
|
ExportColumn::make('password')
|
||||||
|
->label('PASSWORD'),
|
||||||
|
ExportColumn::make('roles')
|
||||||
|
->label('ROLES')
|
||||||
|
->state(function ($record) {
|
||||||
|
// Assuming Spatie\Permission: roles() relationship
|
||||||
|
return $record->roles->pluck('name')->join(', ');
|
||||||
|
}),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->enabledByDefault(false)
|
||||||
|
->label('DELETED AT'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your user export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,15 +41,15 @@ class ConfigurationImporter extends Importer
|
|||||||
ImportColumn::make('line')
|
ImportColumn::make('line')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship(resolveUsing: 'name')
|
->relationship(resolveUsing: 'name')
|
||||||
->exampleHeader('Plant')
|
->exampleHeader('Line')
|
||||||
->example(['4 inch pump line'])
|
->example(['4 inch pump line'])
|
||||||
->label('Line')
|
->label('Line')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship(resolveUsing: 'name')
|
->relationship(resolveUsing: 'code')
|
||||||
->exampleHeader('Plant')
|
->exampleHeader('Plant')
|
||||||
->example(['Ransar Industries-I'])
|
->example(['1000'])
|
||||||
->label('Plant')
|
->label('Plant')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class DeviceMasterImporter extends Importer
|
|||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('IP Address')
|
->exampleHeader('IP Address')
|
||||||
->label('IP Address')
|
->label('IP Address')
|
||||||
->example('172.31.76.67')
|
|
||||||
->rules(['required', 'ip']),
|
->rules(['required', 'ip']),
|
||||||
ImportColumn::make('created_by')
|
ImportColumn::make('created_by')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class LineStopImporter extends Importer
|
|||||||
public function resolveRecord(): ?LineStop
|
public function resolveRecord(): ?LineStop
|
||||||
{
|
{
|
||||||
$warnMsg = [];
|
$warnMsg = [];
|
||||||
if (Str::length($this->data['code']) < 6 || !ctype_alnum($this->data['code'])) {
|
if (Str::length($this->data['code']) < 3 || !ctype_alnum($this->data['code'])) {
|
||||||
$warnMsg[] = "Invalid line stop code found";
|
$warnMsg[] = "Invalid line stop code found";
|
||||||
}
|
}
|
||||||
if (Str::length($this->data['reason']) < 5) {
|
if (Str::length($this->data['reason']) < 5) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class MfmMeterImporter extends Importer
|
|||||||
->label('Plant Name')
|
->label('Plant Name')
|
||||||
->relationship(resolveUsing:'name')
|
->relationship(resolveUsing:'name')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('devicemaster')
|
ImportColumn::make('Device Name')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Device Name')
|
->exampleHeader('Device Name')
|
||||||
->example('REG001')
|
->example('REG001')
|
||||||
|
|||||||
@@ -1,186 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Imports;
|
|
||||||
|
|
||||||
use App\Models\MfmReading;
|
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
|
||||||
use Filament\Actions\Imports\Importer;
|
|
||||||
use Filament\Actions\Imports\Models\Import;
|
|
||||||
|
|
||||||
class MfmReadingImporter extends Importer
|
|
||||||
{
|
|
||||||
protected static ?string $model = MfmReading::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ImportColumn::make('plant')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Plant Name')
|
|
||||||
->example('Ransar Industries-I')
|
|
||||||
->label('Plant Name')
|
|
||||||
->relationship(resolveUsing:'name')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('mfmMeter')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Mfm Meter Name')
|
|
||||||
->example('Display SSB')
|
|
||||||
->label('Display SSB')
|
|
||||||
->relationship(resolveUsing:'name')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('apparent_energy_received')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Apparent Energy Received')
|
|
||||||
->example('1084610')
|
|
||||||
->label('Apparent Energy Received')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('reactive_energy_received')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Reactive Energy Received')
|
|
||||||
->example('347496.9')
|
|
||||||
->label('Reactive Energy Received')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('active_energy_received')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Active Energy Received')
|
|
||||||
->example('611717.1')
|
|
||||||
->label('Active Energy Received')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('active_power_r')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Active Power R')
|
|
||||||
->example('3.974')
|
|
||||||
->label('Active Power R')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('active_power_y')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Active Power Y')
|
|
||||||
->example('0.796')
|
|
||||||
->label('Active Power Y')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('active_power_b')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Active Power B')
|
|
||||||
->example('1.397')
|
|
||||||
->label('Active Power B')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('active_power_total')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Active Power Total')
|
|
||||||
->example('6.433')
|
|
||||||
->label('Active Power Total')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('voltage_ry')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Voltage RY')
|
|
||||||
->example('413.308')
|
|
||||||
->label('Voltage RY')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('voltage_yb')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Voltage YB')
|
|
||||||
->example('415.305')
|
|
||||||
->label('Voltage YB')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('voltage_br')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Voltage BR')
|
|
||||||
->example('415.216')
|
|
||||||
->label('Voltage BR')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('current_r')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Current R')
|
|
||||||
->example('17.446')
|
|
||||||
->label('Current R')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('current_y')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Current Y')
|
|
||||||
->example('4.801')
|
|
||||||
->label('Current Y')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('current_b')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Current B')
|
|
||||||
->example('7.04')
|
|
||||||
->label('Current B')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('current_n')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Current N')
|
|
||||||
->example('14.063')
|
|
||||||
->label('Current N')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('voltage_r_n')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Voltage R N')
|
|
||||||
->example('237.898')
|
|
||||||
->label('Voltage R N')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('voltage_y_n')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Voltage Y N')
|
|
||||||
->example('239.518')
|
|
||||||
->label('Voltage Y N')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('voltage_b_n')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Voltage B N')
|
|
||||||
->example('240.798')
|
|
||||||
->label('Voltage B N')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('frequency')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Frequency')
|
|
||||||
->example('50.228')
|
|
||||||
->label('Frequency')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('power_factor_r')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Power Factor R')
|
|
||||||
->example('0.988')
|
|
||||||
->label('Power Factor R')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('power_factor_y')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Power Factor Y')
|
|
||||||
->example('0.764')
|
|
||||||
->label('Power Factor Y')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('power_factor_b')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Power Factor B')
|
|
||||||
->example('0.849')
|
|
||||||
->label('Power Factor B')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('power_factor_total')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Power Factor Total')
|
|
||||||
->example('0.919')
|
|
||||||
->label('Power Factor Total')
|
|
||||||
->rules(['required']),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resolveRecord(): ?MfmReading
|
|
||||||
{
|
|
||||||
// return MfmReading::firstOrNew([
|
|
||||||
// // Update existing records, matching them by `$this->data['column_name']`
|
|
||||||
// 'email' => $this->data['email'],
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
return new MfmReading();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
|
||||||
{
|
|
||||||
$body = 'Your mfm reading import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,14 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
->relationship(resolveUsing: 'code')
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
|
ImportColumn::make('subassembly_code')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('SubAssembly Code')
|
||||||
|
->example(['123456'])
|
||||||
|
->label('SubAssembly Code')
|
||||||
|
->rules(['required']),
|
||||||
ImportColumn::make('isi_model')
|
ImportColumn::make('isi_model')
|
||||||
|
->requiredMapping()
|
||||||
->boolean()
|
->boolean()
|
||||||
->exampleHeader('ISI Model')
|
->exampleHeader('ISI Model')
|
||||||
->example(['Y','N','Y'])
|
->example(['Y','N','Y'])
|
||||||
@@ -144,8 +151,8 @@ class MotorTestingMasterImporter extends Importer
|
|||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('leak_cur_limit')
|
ImportColumn::make('leak_cur_limit')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('Leakage Current Limit')
|
->exampleHeader('Leak Current Limit')
|
||||||
->label('Leakage Current Limit')
|
->label('Leak Current Limit')
|
||||||
->example(['50','50','50'])
|
->example(['50','50','50'])
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('lock_cur_ll')
|
ImportColumn::make('lock_cur_ll')
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Imports;
|
|
||||||
|
|
||||||
use App\Models\TempLiveReading;
|
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
|
||||||
use Filament\Actions\Imports\Importer;
|
|
||||||
use Filament\Actions\Imports\Models\Import;
|
|
||||||
|
|
||||||
class TempLiveReadingImporter extends Importer
|
|
||||||
{
|
|
||||||
protected static ?string $model = TempLiveReading::class;
|
|
||||||
|
|
||||||
public static function getColumns(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
ImportColumn::make('plant')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Plant Name')
|
|
||||||
->example('Ransar Industries-I')
|
|
||||||
->label('Plant Name')
|
|
||||||
->relationship(resolveUsing:'name')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('mfmMeter')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Mfm Meter Name')
|
|
||||||
->example('Display SSB')
|
|
||||||
->label('Mfm Meter Name')
|
|
||||||
->relationship(resolveUsing:'name')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('register_data')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Register Data')
|
|
||||||
->example('65165,5646,561,561')
|
|
||||||
->label('Register Data')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('created_by')
|
|
||||||
->requiredMapping()
|
|
||||||
->exampleHeader('Created By')
|
|
||||||
->example('Admin')
|
|
||||||
->label('Created By')
|
|
||||||
->rules(['required']),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function resolveRecord(): ?TempLiveReading
|
|
||||||
{
|
|
||||||
// return TempLiveReading::firstOrNew([
|
|
||||||
// // Update existing records, matching them by `$this->data['column_name']`
|
|
||||||
// 'email' => $this->data['email'],
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
return new TempLiveReading();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
|
||||||
{
|
|
||||||
$body = 'Your temp live reading import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
|
||||||
|
|
||||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $body;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
114
app/Filament/Imports/UserImporter.php
Normal file
114
app/Filament/Imports/UserImporter.php
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||||
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
|
use Filament\Actions\Imports\Importer;
|
||||||
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
use Str;
|
||||||
|
|
||||||
|
class UserImporter extends Importer
|
||||||
|
{
|
||||||
|
protected static ?string $model = User::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ImportColumn::make('name')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Name')
|
||||||
|
->example('RAW00001')
|
||||||
|
->label('Name')
|
||||||
|
->rules(['required']),//, 'max:255'
|
||||||
|
ImportColumn::make('email')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('E-mail')
|
||||||
|
->example('RAW00001@cripumps.com')
|
||||||
|
->label('E-mail')
|
||||||
|
->rules(['required', 'email']),//, 'max:255'
|
||||||
|
ImportColumn::make('password')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Password')
|
||||||
|
->example('RAW00001')
|
||||||
|
->label('Password')
|
||||||
|
->rules(['required']),//, 'max:255'
|
||||||
|
ImportColumn::make('roles')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('Roles')
|
||||||
|
->example('Employee')
|
||||||
|
->label('Roles')
|
||||||
|
->rules(['nullable', 'string']), // Optional roles
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolveRecord(): ?User
|
||||||
|
{
|
||||||
|
$warnMsg = [];
|
||||||
|
if (Str::length($this->data['name']) < 1) {
|
||||||
|
$warnMsg[] = "User name not found!";
|
||||||
|
}
|
||||||
|
// || !is_numeric($this->data['code']) || !preg_match('/^[1-9]\d{3,}$/', $this->data['code'])
|
||||||
|
if (Str::length($this->data['email']) < 5) {
|
||||||
|
$warnMsg[] = "Invalid email found!";
|
||||||
|
}
|
||||||
|
if (Str::length($this->data['password']) < 3) {
|
||||||
|
$warnMsg[] = "Invalid password found!";
|
||||||
|
}
|
||||||
|
// Validate roles if provided
|
||||||
|
$roles = [];
|
||||||
|
if (!empty($this->data['roles'])) {
|
||||||
|
$roles = collect(explode(',', $this->data['roles']))
|
||||||
|
->map(fn($role) => trim($role))
|
||||||
|
->filter()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
foreach ($roles as $roleName) {
|
||||||
|
if (!Role::where('name', $roleName)->exists()) {
|
||||||
|
$warnMsg[] = "Role : '{$roleName}' does not exist!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$warnMsg[] = "User roles not found!";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($warnMsg)) {
|
||||||
|
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = User::updateOrCreate([
|
||||||
|
'email' => $this->data['email'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => $this->data['name'],
|
||||||
|
'password' => $this->data['password'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Assign roles
|
||||||
|
if (!empty($roles)) {
|
||||||
|
$user->syncRoles($roles);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
// return User::firstOrNew([
|
||||||
|
// // Update existing records, matching them by `$this->data['column_name']`
|
||||||
|
// 'email' => $this->data['email'],
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
//return new User();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
{
|
||||||
|
$body = 'Your user import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,11 +12,15 @@ class CreateAlertMailRule extends CreateRecord
|
|||||||
|
|
||||||
protected function mutateFormDataBeforeCreate(array $data): array
|
protected function mutateFormDataBeforeCreate(array $data): array
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($data['is_active']) {
|
if ($data['is_active']) {
|
||||||
$data['plant'] = 0;
|
$data['plant'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateBlock extends CreateRecord
|
class CreateBlock extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = BlockResource::class;
|
protected static string $resource = BlockResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateCompany extends CreateRecord
|
class CreateCompany extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = CompanyResource::class;
|
protected static string $resource = CompanyResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateConfiguration extends CreateRecord
|
class CreateConfiguration extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ConfigurationResource::class;
|
protected static string $resource = ConfigurationResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateDeviceMaster extends CreateRecord
|
class CreateDeviceMaster extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = DeviceMasterResource::class;
|
protected static string $resource = DeviceMasterResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateEbReading extends CreateRecord
|
class CreateEbReading extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = EbReadingResource::class;
|
protected static string $resource = EbReadingResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
|
|
||||||
public function processInvoice($invoiceNumber)
|
public function processInvoice($invoiceNumber)
|
||||||
{
|
{
|
||||||
$invoiceNumber = trim($invoiceNumber);
|
$invoiceNumber = trim($invoiceNumber);
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateItem extends CreateRecord
|
class CreateItem extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ItemResource::class;
|
protected static string $resource = ItemResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateLine extends CreateRecord
|
class CreateLine extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = LineResource::class;
|
protected static string $resource = LineResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateLineStop extends CreateRecord
|
class CreateLineStop extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = LineStopResource::class;
|
protected static string $resource = LineStopResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ class CreateLocatorInvoiceValidation extends CreateRecord
|
|||||||
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-locator-invoice-validation';
|
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-locator-invoice-validation';
|
||||||
|
|
||||||
public $plantId;
|
public $plantId;
|
||||||
|
|
||||||
public $invoice_number;
|
public $invoice_number;
|
||||||
|
|
||||||
public $pallet_number;
|
public $pallet_number;
|
||||||
|
|
||||||
public $serial_number, $snoCount;
|
public $serial_number, $snoCount;
|
||||||
@@ -29,8 +31,13 @@ class CreateLocatorInvoiceValidation extends CreateRecord
|
|||||||
public $locator_number;
|
public $locator_number;
|
||||||
|
|
||||||
public array $matchedSerialNumbersForRemoval = [];
|
public array $matchedSerialNumbersForRemoval = [];
|
||||||
|
|
||||||
public bool $showRemoveSerialsModal = false;
|
public bool $showRemoveSerialsModal = false;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
|
|
||||||
public function processinvoiceSNo()
|
public function processinvoiceSNo()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateLocator extends CreateRecord
|
class CreateLocator extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = LocatorResource::class;
|
protected static string $resource = LocatorResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ class MachineResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $get('plant_id'))
|
return Line::where('plant_id', $get('plant_id'))->where('no_of_operation', '>', 0)->pluck('name', 'id')->toArray();
|
||||||
->pluck('name', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
})
|
||||||
->default(function () {
|
->default(function () {
|
||||||
return optional(Machine::latest()->first())->line_id;
|
return optional(Machine::latest()->first())->line_id;
|
||||||
@@ -87,13 +85,13 @@ class MachineResource extends Resource
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$grpWrkCnr = Line::find($lineId)->group_work_center;
|
// $grpWrkCnr = Line::find($lineId)->group_work_center;
|
||||||
if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
|
// if (!$grpWrkCnr || Str::length($grpWrkCnr) < 1)
|
||||||
{
|
// {
|
||||||
$set('mLineError', 'Please select a group work center line.');
|
// $set('mLineError', 'Please select a group work center line.');
|
||||||
$set('line_id', null);
|
// $set('line_id', null);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
$set('mLineError', null);
|
$set('mLineError', null);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMachine extends CreateRecord
|
class CreateMachine extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MachineResource::class;
|
protected static string $resource = MachineResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMfmMeter extends CreateRecord
|
class CreateMfmMeter extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MfmMeterResource::class;
|
protected static string $resource = MfmMeterResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMfmParameter extends CreateRecord
|
class CreateMfmParameter extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MfmParameterResource::class;
|
protected static string $resource = MfmParameterResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Exports\MfmReadingExporter;
|
|
||||||
use App\Filament\Imports\MfmReadingImporter;
|
|
||||||
use App\Filament\Resources\MfmReadingResource\Pages;
|
use App\Filament\Resources\MfmReadingResource\Pages;
|
||||||
use App\Filament\Resources\MfmReadingResource\RelationManagers;
|
use App\Filament\Resources\MfmReadingResource\RelationManagers;
|
||||||
use App\Models\MfmReading;
|
use App\Models\MfmReading;
|
||||||
@@ -14,9 +12,6 @@ use Filament\Tables;
|
|||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Filament\Tables\Actions\ImportAction;
|
|
||||||
use Filament\Tables\Actions\ExportAction;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
|
|
||||||
class MfmReadingResource extends Resource
|
class MfmReadingResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -201,18 +196,6 @@ class MfmReadingResource extends Resource
|
|||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
])
|
|
||||||
->headerActions([
|
|
||||||
ImportAction::make()
|
|
||||||
->importer(MfmReadingImporter::class)
|
|
||||||
->visible(function() {
|
|
||||||
return Filament::auth()->user()->can('view import mfm reading');
|
|
||||||
}),
|
|
||||||
ExportAction::make()
|
|
||||||
->exporter(MfmReadingExporter::class)
|
|
||||||
->visible(function() {
|
|
||||||
return Filament::auth()->user()->can('view export mfm reading');
|
|
||||||
}),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMfmReading extends CreateRecord
|
class CreateMfmReading extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MfmReadingResource::class;
|
protected static string $resource = MfmReadingResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateModuleList extends CreateRecord
|
class CreateModuleList extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ModuleListResource::class;
|
protected static string $resource = ModuleListResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ class MotorTestingMasterResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
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
|
public static function form(Form $form): Form
|
||||||
{
|
{
|
||||||
@@ -61,6 +61,11 @@ class MotorTestingMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('mTmError') ? $get('mTmError') : null)
|
->hint(fn ($get) => $get('mTmError') ? $get('mTmError') : null)
|
||||||
->hintColor('danger'),
|
->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')
|
Forms\Components\Select::make('item_id')
|
||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
//->relationship('item', 'name')
|
//->relationship('item', 'name')
|
||||||
@@ -82,11 +87,40 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->where('plant_id', $get('plant_id'))
|
->where('plant_id', $get('plant_id'))
|
||||||
->ignore($get('id')); // Ignore current record during updates
|
->ignore($get('id')); // Ignore current record during updates
|
||||||
}),
|
}),
|
||||||
Forms\Components\TimePicker::make('routine_test_time')
|
Forms\Components\TextInput::make('subassembly_code')
|
||||||
->label('Routine Test Time')
|
->label('Subassembly Code')
|
||||||
->default('00:40:00')
|
|
||||||
->required()
|
->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')
|
Forms\Components\Select::make('isi_model')
|
||||||
->label('ISI Model')
|
->label('ISI Model')
|
||||||
->options([
|
->options([
|
||||||
@@ -296,6 +330,11 @@ class MotorTestingMasterResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('subassembly_code')
|
||||||
|
->label('SubAssembly Code')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('item.description')
|
Tables\Columns\TextColumn::make('item.description')
|
||||||
->label('Model')
|
->label('Model')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateMotorTestingMaster extends CreateRecord
|
class CreateMotorTestingMaster extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MotorTestingMasterResource::class;
|
protected static string $resource = MotorTestingMasterResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,17 +14,22 @@ use Illuminate\View\View;
|
|||||||
class CreatePalletValidation extends CreateRecord
|
class CreatePalletValidation extends CreateRecord
|
||||||
{
|
{
|
||||||
public $plantId;
|
public $plantId;
|
||||||
|
|
||||||
public $pallet_number;
|
public $pallet_number;
|
||||||
|
|
||||||
public $palletNo;
|
public $palletNo;
|
||||||
|
|
||||||
public $pendingPallet;
|
public $pendingPallet;
|
||||||
|
|
||||||
public $snoCount = 0;
|
public $snoCount = 0;
|
||||||
|
|
||||||
public $pallet_number_locked = false;
|
public $pallet_number_locked = false;
|
||||||
|
|
||||||
public $serial_number;
|
public $serial_number;
|
||||||
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
|
|
||||||
protected static string $resource = PalletValidationResource::class;
|
|
||||||
|
|
||||||
|
protected static string $view = 'filament.resources.pallet-validation-resource.pages.create-pallet-validation';
|
||||||
|
|
||||||
|
protected static string $resource = PalletValidationResource::class;
|
||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
|
'updateSnoQuantity' => 'handleUpdateSnoQuantity',
|
||||||
@@ -32,6 +37,10 @@ class CreatePalletValidation extends CreateRecord
|
|||||||
|
|
||||||
public ?array $data = null;
|
public ?array $data = null;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
|
|
||||||
public function processPalletSNo()
|
public function processPalletSNo()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreatePlant extends CreateRecord
|
class CreatePlant extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = PlantResource::class;
|
protected static string $resource = PlantResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2093,10 +2093,52 @@ class QualityValidationResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if ($state == $expectedValue)
|
||||||
|
// {
|
||||||
|
// $set('part_validation5_error', null);
|
||||||
|
// }
|
||||||
|
// else if (strpos($state, '/') != false) {
|
||||||
|
// $parts = explode('/', $state);
|
||||||
|
// if (count($parts) >= 2) {
|
||||||
|
// $segmentToValidate = $parts[1];
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $segmentToValidate = null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $set('part_validation5_error', "Invalid input for part validation 5.");
|
||||||
|
// $set('part_validation5', null);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
if ($state == $expectedValue)
|
if ($state == $expectedValue)
|
||||||
{
|
{
|
||||||
$set('part_validation5_error', null);
|
$set('part_validation5_error', null);
|
||||||
}
|
}
|
||||||
|
else if (strpos($state, '/') != false)
|
||||||
|
{
|
||||||
|
$parts = explode('/', $state);
|
||||||
|
if (count($parts) >= 2)
|
||||||
|
{
|
||||||
|
$segmentToValidate = $parts[1];
|
||||||
|
if ($segmentToValidate == $expectedValue) {
|
||||||
|
$set('part_validation5_error', null);
|
||||||
|
$set('part_validation5', $segmentToValidate);
|
||||||
|
} else {
|
||||||
|
$set('part_validation5_error', "Invalid input for part validation 5.");
|
||||||
|
$set('part_validation5', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$set('part_validation5_error', "Invalid input format for part validation 5.");
|
||||||
|
$set('part_validation5', null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$set('part_validation5_error', "Invalid input for part validation 5.");
|
$set('part_validation5_error', "Invalid input for part validation 5.");
|
||||||
@@ -2141,6 +2183,7 @@ class QualityValidationResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('line.name')
|
Tables\Columns\TextColumn::make('line.name')
|
||||||
->label('Line')
|
->label('Line')
|
||||||
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('production_order')
|
Tables\Columns\TextColumn::make('production_order')
|
||||||
@@ -2417,6 +2460,8 @@ class QualityValidationResource extends Resource
|
|||||||
$query->whereIn('sticker_master_id', $stickerMasterIds);
|
$query->whereIn('sticker_master_id', $stickerMasterIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$query->orderBy('created_at');
|
||||||
})
|
})
|
||||||
->indicateUsing(function (array $data) {
|
->indicateUsing(function (array $data) {
|
||||||
$indicators = [];
|
$indicators = [];
|
||||||
@@ -2487,7 +2532,8 @@ class QualityValidationResource extends Resource
|
|||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
//,,
|
|
||||||
|
|
||||||
// public static function mutateFormDataBeforeCreate(array $data): array
|
// public static function mutateFormDataBeforeCreate(array $data): array
|
||||||
// {
|
// {
|
||||||
// $user =Filament::auth()->user();
|
// $user =Filament::auth()->user();
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
protected static string $resource = ReworkLocatorInvoiceValidationResource::class;
|
protected static string $resource = ReworkLocatorInvoiceValidationResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
|
|
||||||
public function processInvoiceRework($invoiceNo)
|
public function processInvoiceRework($invoiceNo)
|
||||||
{
|
{
|
||||||
$plantId = $this->form->getState()['plant'];
|
$plantId = $this->form->getState()['plant'];
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateShift extends CreateRecord
|
class CreateShift extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ShiftResource::class;
|
protected static string $resource = ShiftResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Exports\StickerMasterExporter;
|
use App\Filament\Exports\StickerMasterExporter;
|
||||||
use App\Filament\Imports\ShiftImporter;
|
//use App\Filament\Imports\ShiftImporter;
|
||||||
use App\Filament\Imports\StickerMasterImporter;
|
use App\Filament\Imports\StickerMasterImporter;
|
||||||
use App\Filament\Resources\StickerMasterResource\Pages;
|
use App\Filament\Resources\StickerMasterResource\Pages;
|
||||||
use App\Filament\Resources\StickerMasterResource\RelationManagers;
|
//use App\Filament\Resources\StickerMasterResource\RelationManagers;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Closure;
|
//use Closure;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
@@ -18,6 +18,7 @@ use Filament\Tables\Table;
|
|||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Filament\Forms\Get;
|
use Filament\Forms\Get;
|
||||||
|
use Filament\Forms\Set;
|
||||||
use Filament\Tables\Actions\ExportAction;
|
use Filament\Tables\Actions\ExportAction;
|
||||||
use Filament\Tables\Actions\ImportAction;
|
use Filament\Tables\Actions\ImportAction;
|
||||||
// use Illuminate\Validation\Rule;
|
// use Illuminate\Validation\Rule;
|
||||||
@@ -98,7 +99,6 @@ class StickerMasterResource extends Resource
|
|||||||
// ->disabled(fn (Get $get) => !empty($get('id')))
|
// ->disabled(fn (Get $get) => !empty($get('id')))
|
||||||
->live(debounce: 500) // Enable live updates
|
->live(debounce: 500) // Enable live updates
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$itemId = $get('item_id');
|
$itemId = $get('item_id');
|
||||||
|
|
||||||
@@ -153,32 +153,53 @@ class StickerMasterResource extends Resource
|
|||||||
->hint(fn ($get) => $get('item_error') ? $get('item_error') : null)
|
->hint(fn ($get) => $get('item_error') ? $get('item_error') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
|
|
||||||
|
|
||||||
Forms\Components\TextInput::make('item_description')
|
Forms\Components\TextInput::make('item_description')
|
||||||
->label('Description')
|
->label('Description')
|
||||||
->required()
|
->required()
|
||||||
|
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||||
|
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()
|
->reactive()
|
||||||
->readOnly(true),
|
->readOnly(true),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation1')
|
Forms\Components\TextInput::make('part_validation1')
|
||||||
|
->label('Part Validation 1')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation2')
|
Forms\Components\TextInput::make('part_validation2')
|
||||||
|
->label('Part Validation 2')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation3')
|
Forms\Components\TextInput::make('part_validation3')
|
||||||
|
->label('Part Validation 3')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation4')
|
Forms\Components\TextInput::make('part_validation4')
|
||||||
|
->label('Part Validation 4')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('part_validation5')
|
Forms\Components\TextInput::make('part_validation5')
|
||||||
|
->label('Part Validation 5 (Capacitor QR)')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('laser_part_validation1')
|
Forms\Components\TextInput::make('laser_part_validation1')
|
||||||
|
->label('Laser Part Validation 1')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('laser_part_validation2')
|
Forms\Components\TextInput::make('laser_part_validation2')
|
||||||
|
->label('Laser Part Validation 2')
|
||||||
->nullable(),
|
->nullable(),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('panel_box_code')
|
Forms\Components\TextInput::make('panel_box_code')
|
||||||
@@ -189,12 +210,11 @@ class StickerMasterResource extends Resource
|
|||||||
Forms\Components\TextInput::make('load_rate')
|
Forms\Components\TextInput::make('load_rate')
|
||||||
->label('Load Rate')
|
->label('Load Rate')
|
||||||
->default(0)
|
->default(0)
|
||||||
|
->required()
|
||||||
->disabled(function ($get) {
|
->disabled(function ($get) {
|
||||||
return $get('material_type');
|
return $get('material_type');
|
||||||
})
|
})
|
||||||
->integer()
|
->integer(),
|
||||||
->nullable(),
|
|
||||||
|
|
||||||
|
|
||||||
Forms\Components\Select::make('material_type')
|
Forms\Components\Select::make('material_type')
|
||||||
->label('Material Type')
|
->label('Material Type')
|
||||||
@@ -410,7 +430,6 @@ class StickerMasterResource extends Resource
|
|||||||
Forms\Components\TextInput::make('id')
|
Forms\Components\TextInput::make('id')
|
||||||
->hidden()
|
->hidden()
|
||||||
->readOnly(),
|
->readOnly(),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,4 +21,9 @@ class CreateStickerMaster extends CreateRecord
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,9 @@ class CreateTempLiveReading extends CreateRecord
|
|||||||
{
|
{
|
||||||
return 'Create Live Readings';
|
return 'Create Live Readings';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,18 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Exports\UserExporter;
|
||||||
|
use App\Filament\Imports\UserImporter;
|
||||||
use App\Filament\Resources\UserResource\Pages;
|
use App\Filament\Resources\UserResource\Pages;
|
||||||
use App\Filament\Resources\UserResource\RelationManagers;
|
use App\Filament\Resources\UserResource\RelationManagers;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Filament\Tables\Actions\ImportAction;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@@ -80,6 +85,7 @@ class UserResource extends Resource
|
|||||||
// ->label('ID')
|
// ->label('ID')
|
||||||
// ->numeric()
|
// ->numeric()
|
||||||
// ->sortable(),
|
// ->sortable(),
|
||||||
|
|
||||||
Tables\Columns\TextColumn::make('No.')
|
Tables\Columns\TextColumn::make('No.')
|
||||||
->label('No.')
|
->label('No.')
|
||||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
@@ -91,18 +97,23 @@ class UserResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('name')
|
Tables\Columns\TextColumn::make('name')
|
||||||
->label('User Name')
|
->label('User Name')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->searchable()
|
||||||
->searchable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('email')
|
Tables\Columns\TextColumn::make('email')
|
||||||
->label('Email')
|
->label('Email')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->searchable()
|
||||||
->searchable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('email_verified_at')
|
Tables\Columns\TextColumn::make('email_verified_at')
|
||||||
->label('Email Verified At')
|
->label('Email Verified At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('roles.name')
|
||||||
|
->label('Roles')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
@@ -134,6 +145,18 @@ class UserResource extends Resource
|
|||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
ImportAction::make()
|
||||||
|
->importer(UserImporter::class)
|
||||||
|
->visible(function() {
|
||||||
|
return Filament::auth()->user()->can('view import user');
|
||||||
|
}),
|
||||||
|
ExportAction::make()
|
||||||
|
->exporter(UserExporter::class)
|
||||||
|
->visible(function() {
|
||||||
|
return Filament::auth()->user()->can('view export user');
|
||||||
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
class CreateUser extends CreateRecord
|
class CreateUser extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = UserResource::class;
|
protected static string $resource = UserResource::class;
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl('create');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Gemini\Laravel\Facades\Gemini;
|
|
||||||
|
|
||||||
class ChatbotController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
// public function handleMessage(Request $request)
|
|
||||||
// {
|
|
||||||
// $request->validate(['message' => 'required|string']);
|
|
||||||
// $userMessage = $request->input('message');
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// $result = Gemini::geminiPro()->generateContent($userMessage);
|
|
||||||
// $reply = $result->text() ?? 'Sorry, no response from Gemini AI.';
|
|
||||||
// } catch (\Exception $e) {
|
|
||||||
// \Log::error('Gemini API Exception: ' . $e->getMessage(), ['trace' => $e->getTraceAsString()]);
|
|
||||||
// if (config('app.debug')) {
|
|
||||||
// return response()->json(['reply' => 'Error: ' . $e->getMessage()], 500);
|
|
||||||
// }
|
|
||||||
// return response()->json(['reply' => 'Error communicating with Gemini AI. Please try again later.'], 500);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return response()->json(['reply' => $reply]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function handleMessage(Request $request)
|
|
||||||
// {
|
|
||||||
// $request->validate([
|
|
||||||
// 'message' => 'required|string'
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// $apiKey = env('GEMINI_API_KEY'); // Put this in .env
|
|
||||||
|
|
||||||
// $response = Http::withHeaders([
|
|
||||||
// 'Content-Type' => 'application/json',
|
|
||||||
// 'x-goog-api-key' => $apiKey
|
|
||||||
// ])->post('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent', [
|
|
||||||
// 'contents' => [
|
|
||||||
// ['parts' => [['text' => $request->message]]]
|
|
||||||
// ]
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// if ($response->successful()) {
|
|
||||||
// return response()->json([
|
|
||||||
// 'reply' => $response->json()['candidates'][0]['content']['parts'][0]['text'] ?? 'No response.'
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return response()->json(['reply' => 'Failed to fetch response.'], 500);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*/
|
|
||||||
public function show(string $id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function update(Request $request, string $id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*/
|
|
||||||
public function destroy(string $id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -40,18 +40,6 @@ class InvoiceValidationController extends Controller
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
$plantCode = $request->header('plant-code');
|
|
||||||
$invoiceNo = $request->header('invoice-number');
|
|
||||||
$lineQuan = $request->header('line-quantity');
|
|
||||||
|
|
||||||
if (!$plantCode) {
|
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => "Plant Code value can't be empty"
|
|
||||||
], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
|
|
||||||
if (!isset($data['plant_code']) || trim($data['plant_code']) == '')
|
if (!isset($data['plant_code']) || trim($data['plant_code']) == '')
|
||||||
@@ -70,8 +58,7 @@ class InvoiceValidationController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
$plant = Plant::where('code', $data['plant_code'])->first();
|
||||||
if (!$plant)
|
if (!$plant) {
|
||||||
{
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Plant not found!'
|
'status_description' => 'Plant not found!'
|
||||||
|
|||||||
@@ -73,68 +73,6 @@ class PalletController extends Controller
|
|||||||
// $mpdf->Output('qr-label.pdf', 'I');
|
// $mpdf->Output('qr-label.pdf', 'I');
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function downloadQrPdf($palletNo)
|
|
||||||
// {
|
|
||||||
// $qrCode = new QrCode($palletNo);
|
|
||||||
// $output = new Output\Png();
|
|
||||||
// $qrBinary = $output->output($qrCode, 100);
|
|
||||||
// $qrBase64 = base64_encode($qrBinary);
|
|
||||||
|
|
||||||
// $htmlBlock = '
|
|
||||||
// <table class="sticker-table">
|
|
||||||
// <tr>
|
|
||||||
// <td class="qr-cell">
|
|
||||||
// <img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
|
||||||
// </td>
|
|
||||||
// <td class="text-cell">
|
|
||||||
// ' . htmlspecialchars($palletNo) . '
|
|
||||||
// </td>
|
|
||||||
// </tr>
|
|
||||||
// </table>';
|
|
||||||
|
|
||||||
// return '
|
|
||||||
// <html>
|
|
||||||
// <head>
|
|
||||||
// <style>
|
|
||||||
// body { margin: 0; padding: 0; width: 60mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
|
||||||
// .sticker-table { width: 60mm; height: 14mm; border-collapse: collapse;}
|
|
||||||
// .qr-cell { width: 14mm;}
|
|
||||||
// .text-cell { text-align: left; vertical-align: middle; font-size: 22pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; font-weight: bold; }
|
|
||||||
// img.qr { width: 19mm; height: 19mm; display: block; margin-left: -2mm;}
|
|
||||||
// </style>
|
|
||||||
// </head>
|
|
||||||
// <body>
|
|
||||||
// ' . $htmlBlock . $htmlBlock . '
|
|
||||||
// <script>
|
|
||||||
// window.onload = function () {
|
|
||||||
// window.print();
|
|
||||||
// setTimeout(function () {
|
|
||||||
// window.close();
|
|
||||||
// }, 1000); // Wait 1 second before closing
|
|
||||||
// };
|
|
||||||
// </script>
|
|
||||||
// </body>
|
|
||||||
// </html>';
|
|
||||||
|
|
||||||
// // $mpdf = new Mpdf([
|
|
||||||
// // 'mode' => 'utf-8',
|
|
||||||
// // 'format' => [60, 14],
|
|
||||||
// // 'margin_left' => 0,
|
|
||||||
// // 'margin_right' => 0,
|
|
||||||
// // 'margin_top' => 0,
|
|
||||||
// // 'margin_bottom' => 0,
|
|
||||||
// // // 'tempDir' => '/var/www/storage/mpdf-tmp',
|
|
||||||
// // ]);
|
|
||||||
|
|
||||||
// // $mpdf->WriteHTML($html);
|
|
||||||
// // // Output PDF to browser for printing
|
|
||||||
// // $mpdf->Output('qr-label.pdf', 'I');
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function downloadQrPdf($palletNo)
|
public function downloadQrPdf($palletNo)
|
||||||
{
|
{
|
||||||
$qrCode = new QrCode($palletNo);
|
$qrCode = new QrCode($palletNo);
|
||||||
@@ -154,15 +92,15 @@ class PalletController extends Controller
|
|||||||
</tr>
|
</tr>
|
||||||
</table>';
|
</table>';
|
||||||
|
|
||||||
$html = '
|
return '
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
body { margin: 0; padding: 0; width: 60mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
body { margin: 0; padding: 0; width: 60mm; height: auto; font-size: 10pt; font-family: DejaVu Sans, sans-serif; }
|
||||||
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; page-break-after: always; }
|
.sticker-table { width: 60mm; height: 14mm; border-collapse: collapse; page-break-after: always; }
|
||||||
.qr-cell { width: 14mm; text-align: right; vertical-align: bottom; padding-left: 0mm; padding-top: 0mm; }
|
.qr-cell { width: 14mm; text-align: right; vertical-align: bottom; padding-left: -8mm; padding-top: 0mm; }
|
||||||
.text-cell { text-align: left; vertical-align: middle; font-size: 22pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
.text-cell { text-align: left; vertical-align: middle; font-size: 22pt; padding-left: 1mm; padding-top: 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: bold; }
|
||||||
img.qr { width: 16mm; height: 16mm; display: block; margin-left: -2mm;}
|
img.qr { width: 19mm; height: 19mm; display: block; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -178,19 +116,24 @@ class PalletController extends Controller
|
|||||||
</body>
|
</body>
|
||||||
</html>';
|
</html>';
|
||||||
|
|
||||||
$mpdf = new Mpdf([
|
// $mpdf = new Mpdf([
|
||||||
'mode' => 'utf-8',
|
// 'mode' => 'utf-8',
|
||||||
'format' => [60, 14],
|
// 'format' => [60, 14],
|
||||||
'margin_left' => 0,
|
// 'margin_left' => 0,
|
||||||
'margin_right' => 0,
|
// 'margin_right' => 0,
|
||||||
'margin_top' => 0,
|
// 'margin_top' => 0,
|
||||||
'margin_bottom' => 0,
|
// 'margin_bottom' => 0,
|
||||||
// 'tempDir' => '/var/www/storage/mpdf-tmp',
|
// // 'tempDir' => '/var/www/storage/mpdf-tmp',
|
||||||
]);
|
// ]);
|
||||||
|
|
||||||
$mpdf->WriteHTML($html);
|
// $mpdf->WriteHTML($html);
|
||||||
$mpdf->Output('qr-label.pdf', 'I');
|
// // Output PDF to browser for printing
|
||||||
|
// $mpdf->Output('qr-label.pdf', 'I');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -458,6 +458,7 @@ class TestingPanelController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output = [
|
$output = [
|
||||||
|
"mot_subassembly_code" => $motorTestingMaster->subassembly_code ?? "",
|
||||||
"mot_model_name" => $description,
|
"mot_model_name" => $description,
|
||||||
"mot_non_isi_model" => $motorTestingMaster->isi_model ? "0" :"1",
|
"mot_non_isi_model" => $motorTestingMaster->isi_model ? "0" :"1",
|
||||||
"mot_phase" => $motorTestingMaster->phase ?? "",
|
"mot_phase" => $motorTestingMaster->phase ?? "",
|
||||||
@@ -488,7 +489,7 @@ class TestingPanelController extends Controller
|
|||||||
"mot_noload_pow_ll" => $motorTestingMaster->noload_pow_ll ?? "",
|
"mot_noload_pow_ll" => $motorTestingMaster->noload_pow_ll ?? "",
|
||||||
"mot_noload_pow_ul" => $motorTestingMaster->noload_pow_ul ?? "",
|
"mot_noload_pow_ul" => $motorTestingMaster->noload_pow_ul ?? "",
|
||||||
"mot_noload_spd_ll" => $motorTestingMaster->noload_spd_ll ?? "",
|
"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);
|
return response()->json($output, 200);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
@@ -14,12 +15,14 @@ class ProductionMail extends Mailable
|
|||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
public $tableData;
|
public $tableData;
|
||||||
|
public $scheduleType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct($tableData = [])
|
public function __construct($scheduleType,$tableData = [])
|
||||||
{
|
{
|
||||||
|
$this->scheduleType = $scheduleType;
|
||||||
$this->tableData = $tableData ?? [];
|
$this->tableData = $tableData ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,19 +39,57 @@ class ProductionMail extends Mailable
|
|||||||
/**
|
/**
|
||||||
* Get the message content definition.
|
* 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
|
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(
|
return new Content(
|
||||||
view: 'mail.production_report',
|
view: 'mail.production_report',
|
||||||
with: [
|
with: [
|
||||||
'company' => "CRI Digital Manufacturing Solutions",
|
'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,
|
'tableData' => $this->tableData,
|
||||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attachments for the message.
|
* Get the attachments for the message.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
@@ -16,16 +17,16 @@ class test extends Mailable
|
|||||||
public $materialTableData;
|
public $materialTableData;
|
||||||
public $bundleTableData;
|
public $bundleTableData;
|
||||||
|
|
||||||
|
public $schedule;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
// public function __construct($tableData = [])
|
|
||||||
// {
|
public function __construct($serialTableData, $materialTableData, $bundleTableData, $schedule)
|
||||||
// $this->tableData = $tableData ?? [];
|
|
||||||
// }
|
|
||||||
public function __construct($serialTableData, $materialTableData, $bundleTableData)
|
|
||||||
{
|
{
|
||||||
|
$this->schedule = $schedule;
|
||||||
$this->serialTableData = $serialTableData;
|
$this->serialTableData = $serialTableData;
|
||||||
$this->materialTableData = $materialTableData;
|
$this->materialTableData = $materialTableData;
|
||||||
$this->bundleTableData = $bundleTableData;
|
$this->bundleTableData = $bundleTableData;
|
||||||
@@ -44,18 +45,54 @@ class test extends Mailable
|
|||||||
/**
|
/**
|
||||||
* Get the message content definition.
|
* 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
|
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(
|
return new Content(
|
||||||
view: 'mail.test_mail',
|
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: [
|
with: [
|
||||||
'company' => "CRI Digital Manufacturing Solutions",
|
'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,
|
//'tableData' => $this->tableData,
|
||||||
'serialTableData' => $this->serialTableData,
|
'serialTableData' => $this->serialTableData,
|
||||||
'materialTableData' => $this->materialTableData,
|
'materialTableData' => $this->materialTableData,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class MotorTestingMaster extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'plant_id',
|
'plant_id',
|
||||||
'item_id',
|
'item_id',
|
||||||
|
'subassembly_code',
|
||||||
'isi_model',
|
'isi_model',
|
||||||
'phase',
|
'phase',
|
||||||
'kw',
|
'kw',
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ class ProductionQuantity extends Model
|
|||||||
"serial_number",
|
"serial_number",
|
||||||
"production_order",
|
"production_order",
|
||||||
"operator_id",
|
"operator_id",
|
||||||
|
// "success_status",
|
||||||
|
// "no_of_employee",
|
||||||
|
// "list_of_employee",
|
||||||
|
"created_at",
|
||||||
|
"updated_at"
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function plant(): BelongsTo
|
public function plant(): BelongsTo
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class QualityValidation extends Model
|
|||||||
'part_validation5',
|
'part_validation5',
|
||||||
'operator_id',
|
'operator_id',
|
||||||
'uom',
|
'uom',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
'serial_number',
|
'serial_number',
|
||||||
'sap_msg_status',
|
'sap_msg_status',
|
||||||
'sap_msg_description',
|
'sap_msg_description',
|
||||||
|
|||||||
@@ -86,9 +86,4 @@ return [
|
|||||||
|
|
||||||
'livewire_loading_delay' => 'default',
|
'livewire_loading_delay' => 'default',
|
||||||
|
|
||||||
// 'assets' => [
|
|
||||||
// 'app.js', // or your filament.js file
|
|
||||||
// ],
|
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Laravel\Sanctum\Sanctum;
|
|
||||||
|
|
||||||
return [
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Stateful Domains
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Requests from the following domains / hosts will receive stateful API
|
|
||||||
| authentication cookies. Typically, these should include your local
|
|
||||||
| and production domains which access your API via a frontend SPA.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
|
||||||
'%s%s',
|
|
||||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
|
||||||
Sanctum::currentApplicationUrlWithPort(),
|
|
||||||
// Sanctum::currentRequestHost(),
|
|
||||||
))),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Sanctum Guards
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This array contains the authentication guards that will be checked when
|
|
||||||
| Sanctum is trying to authenticate a request. If none of these guards
|
|
||||||
| are able to authenticate the request, Sanctum will use the bearer
|
|
||||||
| token that's present on an incoming request for authentication.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'guard' => ['web'],
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Expiration Minutes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| This value controls the number of minutes until an issued token will be
|
|
||||||
| considered expired. This will override any values set in the token's
|
|
||||||
| "expires_at" attribute, but first-party sessions are not affected.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'expiration' => null,
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Token Prefix
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Sanctum can prefix new tokens in order to take advantage of numerous
|
|
||||||
| security scanning initiatives maintained by open source platforms
|
|
||||||
| that notify developers if they commit tokens into repositories.
|
|
||||||
|
|
|
||||||
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Sanctum Middleware
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| When authenticating your first-party SPA with Sanctum you may need to
|
|
||||||
| customize some of the middleware Sanctum uses while processing the
|
|
||||||
| request. You may change the middleware listed below as required.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'middleware' => [
|
|
||||||
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
|
||||||
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
|
|
||||||
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
|
||||||
@@ -35,8 +35,4 @@ return [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'gemini' => [
|
|
||||||
'key' => env('GEMINI_API_KEY'),
|
|
||||||
],
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ return new class extends Migration
|
|||||||
DB::statement($sql);
|
DB::statement($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*/
|
*/
|
||||||
@@ -15,6 +15,8 @@ return new class extends Migration
|
|||||||
CREATE TABLE alert_mail_rules (
|
CREATE TABLE alert_mail_rules (
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||||
|
|
||||||
|
plant BIGINT NOT NULL DEFAULT(0),
|
||||||
|
|
||||||
module TEXT NOT NULL,
|
module TEXT NOT NULL,
|
||||||
rule_name TEXT NOT NULL,
|
rule_name TEXT NOT NULL,
|
||||||
|
|
||||||
@@ -27,6 +29,7 @@ return new class extends Migration
|
|||||||
|
|
||||||
created_by TEXT NOT NULL,
|
created_by TEXT NOT NULL,
|
||||||
updated_by TEXT NOT NULL
|
updated_by TEXT NOT NULL
|
||||||
|
|
||||||
);
|
);
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
// Enable TimescaleDB extension
|
|
||||||
DB::statement('CREATE EXTENSION IF NOT EXISTS timescaledb;');
|
|
||||||
|
|
||||||
DB::statement('ALTER TABLE mfm_readings ADD PRIMARY KEY (id, created_at);');
|
|
||||||
|
|
||||||
// Create hypertable partitioned by created_at
|
|
||||||
DB::statement("
|
|
||||||
SELECT create_hypertable(
|
|
||||||
'mfm_readings',
|
|
||||||
'created_at',
|
|
||||||
chunk_time_interval => interval '1 day',
|
|
||||||
if_not_exists => TRUE
|
|
||||||
);
|
|
||||||
");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
// Schema::table('mfm_readings', function (Blueprint $table) {
|
|
||||||
// //
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -13,8 +13,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
$sql1 = <<<'SQL'
|
$sql1 = <<<'SQL'
|
||||||
|
|
||||||
ALTER TABLE alert_mail_rules
|
ALTER TABLE motor_testing_masters
|
||||||
ADD plant BIGINT NOT NULL DEFAULT (0);
|
ADD subassembly_code TEXT DEFAULT NULL;
|
||||||
|
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
// Schema::table('alert_mail_rules', function (Blueprint $table) {
|
// Schema::table('motor_testing_masters', function (Blueprint $table) {
|
||||||
// //
|
// //
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
@@ -34,24 +34,57 @@ class PermissionSeeder extends Seeder
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Master and Transaction Pages
|
//Master and Transaction Pages
|
||||||
Permission::updateOrCreate(['name' => 'view import block']);
|
Permission::updateOrCreate(['name' => 'view import user']);
|
||||||
Permission::updateOrCreate(['name' => 'view export block']);
|
Permission::updateOrCreate(['name' => 'view export user']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import company']);
|
Permission::updateOrCreate(['name' => 'view import company']);
|
||||||
Permission::updateOrCreate(['name' => 'view export company']);
|
Permission::updateOrCreate(['name' => 'view export company']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import plant']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export plant']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import block']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export block']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import shift']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export shift']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import line']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export line']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import item']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export item']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import line stop']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export line stop']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import sticker master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export sticker master']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import locator']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export locator']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import configuration']);
|
Permission::updateOrCreate(['name' => 'view import configuration']);
|
||||||
Permission::updateOrCreate(['name' => 'view export configuration']);
|
Permission::updateOrCreate(['name' => 'view export configuration']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import work group master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export work group master']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import machine']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export machine']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import motor testing master']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export motor testing master']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import guard name']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export guard name']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import check point name']);
|
Permission::updateOrCreate(['name' => 'view import check point name']);
|
||||||
Permission::updateOrCreate(['name' => 'view export check point name']);
|
Permission::updateOrCreate(['name' => 'view export check point name']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import check point time']);
|
Permission::updateOrCreate(['name' => 'view import check point time']);
|
||||||
Permission::updateOrCreate(['name' => 'view export check point time']);
|
Permission::updateOrCreate(['name' => 'view export check point time']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import guard name']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export guard name']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import guard patrol entry']);
|
Permission::updateOrCreate(['name' => 'view import guard patrol entry']);
|
||||||
Permission::updateOrCreate(['name' => 'view export guard patrol entry']);
|
Permission::updateOrCreate(['name' => 'view export guard patrol entry']);
|
||||||
Permission::updateOrCreate(['name' => 'view import guard patrol entries']);
|
Permission::updateOrCreate(['name' => 'view import guard patrol entries']);
|
||||||
@@ -60,34 +93,13 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import material invoice']);
|
Permission::updateOrCreate(['name' => 'view import material invoice']);
|
||||||
Permission::updateOrCreate(['name' => 'view export invoice']);
|
Permission::updateOrCreate(['name' => 'view export invoice']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import item']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export item']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import line']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export line']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import line stop']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export line stop']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
|
Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export locator invoice validation']);
|
Permission::updateOrCreate(['name' => 'view export locator invoice validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view import dispatch serial invoice validation']);
|
Permission::updateOrCreate(['name' => 'view import dispatch serial invoice validation']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import locator']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export locator']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import machine']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export machine']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import motor testing master']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export motor testing master']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import pallet validation']);
|
Permission::updateOrCreate(['name' => 'view import pallet validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export pallet validation']);
|
Permission::updateOrCreate(['name' => 'view export pallet validation']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import plant']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export plant']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import production line stop']);
|
Permission::updateOrCreate(['name' => 'view import production line stop']);
|
||||||
Permission::updateOrCreate(['name' => 'view export production line stop']);
|
Permission::updateOrCreate(['name' => 'view export production line stop']);
|
||||||
|
|
||||||
@@ -100,12 +112,6 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import quality validation']);
|
Permission::updateOrCreate(['name' => 'view import quality validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export quality validation']);
|
Permission::updateOrCreate(['name' => 'view export quality validation']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import shift']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export shift']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import sticker master']);
|
|
||||||
Permission::updateOrCreate(['name' => 'view export sticker master']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import testing panel reading']);
|
Permission::updateOrCreate(['name' => 'view import testing panel reading']);
|
||||||
Permission::updateOrCreate(['name' => 'view export testing panel reading']);
|
Permission::updateOrCreate(['name' => 'view export testing panel reading']);
|
||||||
|
|
||||||
@@ -144,7 +150,6 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view ems trend line analysis dashboard']);
|
Permission::updateOrCreate(['name' => 'view ems trend line analysis dashboard']);
|
||||||
Permission::updateOrCreate(['name' => 'view ems trend chart analysis dashboard']);
|
Permission::updateOrCreate(['name' => 'view ems trend chart analysis dashboard']);
|
||||||
|
|
||||||
|
|
||||||
//Send To Sap Permissions
|
//Send To Sap Permissions
|
||||||
Permission::updateOrCreate(['name' => 'view quality data send to sap']);
|
Permission::updateOrCreate(['name' => 'view quality data send to sap']);
|
||||||
Permission::updateOrCreate(['name' => 'view production data send to sap']);
|
Permission::updateOrCreate(['name' => 'view production data send to sap']);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class UserSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
$user1 = User::updateOrCreate(
|
$user1 = User::updateOrCreate(
|
||||||
['email' => 'dhanabalan@cripumps.com'],
|
['email' => 'dhanabalan.saravanan@cripumps.com'],
|
||||||
[
|
[
|
||||||
'name' => 'Dhanabalan S',
|
'name' => 'Dhanabalan S',
|
||||||
'password' => bcrypt('SdHaNa@123'),
|
'password' => bcrypt('SdHaNa@123'),
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
Markets & Economy:
|
|
||||||
|
|
||||||
* The Reserve Bank of India (RBI) has kept the repo rate unchanged at 5.5% and maintained its GDP growth forecast at 6.5%.
|
|
||||||
* The RBI has lowered its inflation forecast for the 2026 fiscal year to 3.1%.
|
|
||||||
* India's foreign exchange reserves have decreased by $9 billion to $689 billion.
|
|
||||||
* The rupee has seen a rise of 15 paise, reaching 87.73 against the U.S. dollar in early trading.
|
|
||||||
* In the U.K., the services sector has experienced its most significant drop in orders in nearly three years.
|
|
||||||
|
|
||||||
Corporate News:
|
|
||||||
|
|
||||||
* Intel is reportedly facing challenges with a crucial manufacturing process for its upcoming PC chip.
|
|
||||||
* Shareholders are suing Elon Musk, alleging that he made exaggerated claims about Tesla's Robotaxi.
|
|
||||||
* News Corp has issued a warning that Donald Trump's AI is using content from his book, "The Art of the Deal."
|
|
||||||
* Chinese automakers, including BYD, saw significant increases in their U.K. sales in July.
|
|
||||||
|
|
||||||
Global Trade:
|
|
||||||
|
|
||||||
* There are concerns about the potential impact of tariffs proposed by Donald Trump on the Indian economy.
|
|
||||||
|
|
||||||
Other News:
|
|
||||||
|
|
||||||
* Central GST officers in India have uncovered significant tax evasion amounting to approximately Rs 7.08 lakh crore over the past five fiscal years.
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
SIZE 60 mm,40 mm
|
|
||||||
GAP 3 mm,0 mm
|
|
||||||
CLS
|
|
||||||
QRCODE 40,100,M,4,A,0,M2,"HelloWorld123"
|
|
||||||
TEXT 200,100,"3",0,1,1,"HelloWorld123"
|
|
||||||
PRINT 1
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<title>Chart.js Example</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<canvas id="myChart"></canvas>
|
|
||||||
|
|
||||||
<!-- Load Chart.js and plugins -->
|
|
||||||
<script src="js/chart.min.js"></script>
|
|
||||||
<script src="js/chartjs-plugin-datalabels.min.js"></script>
|
|
||||||
<script src="js/chartjs-plugin-annotation.min.js"></script>
|
|
||||||
|
|
||||||
<!-- Your chart initialization code -->
|
|
||||||
<script>
|
|
||||||
const ctx = document.getElementById('myChart').getContext('2d');
|
|
||||||
new Chart(ctx, {
|
|
||||||
type: 'bar',
|
|
||||||
data: {
|
|
||||||
labels: ['Red', 'Blue', 'Yellow'],
|
|
||||||
datasets: [{
|
|
||||||
label: '# of Votes',
|
|
||||||
data: [12, 19, 3]
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
plugins: {
|
|
||||||
datalabels: {
|
|
||||||
// plugin options
|
|
||||||
},
|
|
||||||
annotation: {
|
|
||||||
// plugin options
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scales: {
|
|
||||||
y: {
|
|
||||||
beginAtZero: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
// import ChartDataLabels from 'chartjs-plugin-datalabels'
|
|
||||||
|
|
||||||
// window.filamentChartJsPlugins ??= []
|
|
||||||
// window.filamentChartJsPlugins.push(ChartDataLabels)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
@import '../../../../vendor/filament/filament/resources/css/theme.css';
|
|
||||||
@@ -1,3 +1 @@
|
|||||||
import './bootstrap';
|
import './bootstrap';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Gemini Chat</title>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
margin: 40px;
|
|
||||||
}
|
|
||||||
#chat-box {
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 15px;
|
|
||||||
height: 300px;
|
|
||||||
overflow-y: scroll;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.user, .bot {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.user {
|
|
||||||
text-align: right;
|
|
||||||
color: blue;
|
|
||||||
}
|
|
||||||
.bot {
|
|
||||||
text-align: left;
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h2>Gemini Chat</h2>
|
|
||||||
<div id="chat-box"></div>
|
|
||||||
<textarea id="prompt" rows="3" cols="60" placeholder="Type your message here..."></textarea><br>
|
|
||||||
<button onclick="sendPrompt()">Send</button>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
async function getGeminiResponse(prompt) {
|
|
||||||
try {
|
|
||||||
const res = await fetch('http://172.31.31.51:8000/api/chatbot/message', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ message: prompt })
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!res.ok) {
|
|
||||||
const errorText = await res.text();
|
|
||||||
console.error(`Server returned ${res.status}:`, errorText);
|
|
||||||
throw new Error(`HTTP error! Status: ${res.status}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = await res.json();
|
|
||||||
return data.reply || "Sorry, no response.";
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Fetch error:', e);
|
|
||||||
return "Error fetching response.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function sendPrompt() {
|
|
||||||
const promptInput = document.getElementById('prompt');
|
|
||||||
const prompt = promptInput.value.trim();
|
|
||||||
if (!prompt) return;
|
|
||||||
|
|
||||||
appendMessage('user', prompt);
|
|
||||||
promptInput.value = '';
|
|
||||||
|
|
||||||
const reply = await getGeminiResponse(prompt);
|
|
||||||
appendMessage('bot', reply);
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendMessage(sender, text) {
|
|
||||||
const chatBox = document.getElementById('chat-box');
|
|
||||||
const message = document.createElement('div');
|
|
||||||
message.className = sender;
|
|
||||||
message.textContent = text;
|
|
||||||
chatBox.appendChild(message);
|
|
||||||
chatBox.scrollTop = chatBox.scrollHeight;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<button
|
|
||||||
type="button"
|
|
||||||
wire:click="updateInvoice"
|
|
||||||
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
|
||||||
>
|
|
||||||
Update Invoice
|
|
||||||
</button>
|
|
||||||
|
|
||||||
@@ -98,6 +98,8 @@
|
|||||||
<th>Plant</th>
|
<th>Plant</th>
|
||||||
<th>Total Number of Invoice</th>
|
<th>Total Number of Invoice</th>
|
||||||
<th>Scanned Number of Invoice</th>
|
<th>Scanned Number of Invoice</th>
|
||||||
|
<th>Total Invoice Quantity</th>
|
||||||
|
<th>Scanned Invoice Quantity</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -107,6 +109,8 @@
|
|||||||
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
<td>{{ $row['totalInvoice'] }}</td>
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
<td>{{ $row['scannedInvoice'] }}</td>
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoiceQuan'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoiceQuan'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -123,6 +127,8 @@
|
|||||||
<th>Plant</th>
|
<th>Plant</th>
|
||||||
<th>Total Number of Invoice</th>
|
<th>Total Number of Invoice</th>
|
||||||
<th>Scanned Number of Invoice</th>
|
<th>Scanned Number of Invoice</th>
|
||||||
|
<th>Total Invoice Quantity</th>
|
||||||
|
<th>Scanned Invoice Quantity</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -132,6 +138,8 @@
|
|||||||
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
<td>{{ $row['totalInvoice'] }}</td>
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
<td>{{ $row['scannedInvoice'] }}</td>
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoiceQuan'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoiceQuan'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -148,6 +156,8 @@
|
|||||||
<th>Plant</th>
|
<th>Plant</th>
|
||||||
<th>Total Number of Invoice</th>
|
<th>Total Number of Invoice</th>
|
||||||
<th>Scanned Number of Invoice</th>
|
<th>Scanned Number of Invoice</th>
|
||||||
|
<th>Total Invoice Quantity</th>
|
||||||
|
<th>Scanned Invoice Quantity</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -157,6 +167,8 @@
|
|||||||
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
<td style="white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
<td>{{ $row['totalInvoice'] }}</td>
|
<td>{{ $row['totalInvoice'] }}</td>
|
||||||
<td>{{ $row['scannedInvoice'] }}</td>
|
<td>{{ $row['scannedInvoice'] }}</td>
|
||||||
|
<td>{{ $row['totalInvoiceQuan'] }}</td>
|
||||||
|
<td>{{ $row['scannedInvoiceQuan'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\ChatbotController;
|
|
||||||
use App\Http\Controllers\InvoiceValidationController;
|
use App\Http\Controllers\InvoiceValidationController;
|
||||||
use App\Http\Controllers\MachineController;
|
use App\Http\Controllers\MachineController;
|
||||||
use App\Http\Controllers\MfmParameterController;
|
use App\Http\Controllers\MfmParameterController;
|
||||||
@@ -140,5 +139,3 @@ Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 's
|
|||||||
|
|
||||||
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
||||||
|
|
||||||
Route::post('/chatbot/message', [ChatbotController::class, 'handleMessage']);
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Artisan::command('inspire', function () {
|
|||||||
|
|
||||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
->where('rule_name', 'ProductionMail')
|
->where('rule_name', 'ProductionMail')
|
||||||
//->select('plant', 'schedule_type')
|
->select('plant', 'schedule_type')
|
||||||
->select('plant', 'schedule_type')
|
->select('plant', 'schedule_type')
|
||||||
->distinct()
|
->distinct()
|
||||||
->get();
|
->get();
|
||||||
|
|||||||
@@ -10,11 +10,6 @@ use Illuminate\Support\Facades\Route;
|
|||||||
return redirect('/admin');
|
return redirect('/admin');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/chatbot', function () {
|
|
||||||
return view('chatbot');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Route::get('/scheduler', function() {
|
// Route::get('/scheduler', function() {
|
||||||
// Artisan::call('schedule:run');
|
// Artisan::call('schedule:run');
|
||||||
// });
|
// });
|
||||||
|
|||||||
Reference in New Issue
Block a user