Compare commits
1 Commits
renovate/b
...
renovate/l
| Author | SHA1 | Date | |
|---|---|---|---|
| c7620c11b4 |
@@ -39,8 +39,6 @@ class Scheduler extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
// $this->call('approval:trigger-mails');
|
|
||||||
|
|
||||||
// --- Production Rules ---
|
// --- Production Rules ---
|
||||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
->where('rule_name', 'ProductionMail')
|
->where('rule_name', 'ProductionMail')
|
||||||
@@ -76,6 +74,7 @@ class Scheduler extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --- Invoice Validation Rules ---
|
// --- Invoice Validation Rules ---
|
||||||
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
->where('rule_name', 'InvoiceMail')
|
->where('rule_name', 'InvoiceMail')
|
||||||
@@ -175,7 +174,7 @@ class Scheduler extends Command
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Daily':
|
case 'Daily':
|
||||||
if (now()->format('H:i') == '11:30') {
|
if (now()->format('H:i') == '10:00') {
|
||||||
\Artisan::call('send:invoice-data-report', [
|
\Artisan::call('send:invoice-data-report', [
|
||||||
'schedule_type' => $rule->schedule_type,
|
'schedule_type' => $rule->schedule_type,
|
||||||
'plant' => $rule->plant,
|
'plant' => $rule->plant,
|
||||||
@@ -210,25 +209,11 @@ class Scheduler extends Command
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Daily':
|
case 'Daily':
|
||||||
if (now()->format('H:i') == '10:45') {
|
if (now()->format('H:i') == '10:00') {
|
||||||
try {
|
\Artisan::call('send:invoice-transit-report', [
|
||||||
\Artisan::call('send:invoice-transit-report', [
|
'schedule_type' => $rule->schedule_type,
|
||||||
'schedule_type' => $rule->schedule_type,
|
'plant' => $rule->plant,
|
||||||
'plant' => $rule->plant,
|
]);
|
||||||
]);
|
|
||||||
|
|
||||||
Log::info('Invoice Transit executed', [
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
'type' => $rule->schedule_type,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
catch (\Throwable $e) {
|
|
||||||
Log::error('Invoice Transit FAILED', [
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
'error' => $e->getMessage(),
|
|
||||||
'trace' => $e->getTraceAsString(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,12 @@ use App\Mail\InvoiceDataMail;
|
|||||||
use App\Models\AlertMailRule;
|
use App\Models\AlertMailRule;
|
||||||
use App\Models\InvoiceDataValidation;
|
use App\Models\InvoiceDataValidation;
|
||||||
use App\Models\InvoiceOutValidation;
|
use App\Models\InvoiceOutValidation;
|
||||||
|
use App\Models\Line;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
|
use App\Models\ProductionPlan;
|
||||||
|
use App\Models\ProductionQuantity;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
class SendInvoiceDataReport extends Command
|
class SendInvoiceDataReport extends Command
|
||||||
{
|
{
|
||||||
@@ -45,7 +49,7 @@ class SendInvoiceDataReport extends Command
|
|||||||
$plants = ($plantId == 0) ? Plant::all() : Plant::where('id', $plantId)->get();
|
$plants = ($plantId == 0) ? Plant::all() : Plant::where('id', $plantId)->get();
|
||||||
|
|
||||||
if ($plants->isEmpty()) {
|
if ($plants->isEmpty()) {
|
||||||
$this->error('No valid plant(s) found.');
|
$this->error("No valid plant(s) found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +105,7 @@ class SendInvoiceDataReport extends Command
|
|||||||
->where('distribution_channel_desc', $selectedDistribution)
|
->where('distribution_channel_desc', $selectedDistribution)
|
||||||
->whereBetween('document_date', [$startDate, $endDate])
|
->whereBetween('document_date', [$startDate, $endDate])
|
||||||
->orderBy('document_date', 'asc')
|
->orderBy('document_date', 'asc')
|
||||||
->select('customer_code', 'document_number', 'document_date', 'customer_trade_name', 'customer_location', 'location', 'remark')
|
->select('customer_code', 'document_number', 'document_date', 'customer_trade_name', 'customer_location', 'location')
|
||||||
->get()
|
->get()
|
||||||
->unique('document_number')
|
->unique('document_number')
|
||||||
->values();
|
->values();
|
||||||
@@ -110,6 +114,7 @@ class SendInvoiceDataReport extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter invoices directly — exclude ones with '-' in document_number
|
||||||
$invoices = $invoices->filter(function ($inv) {
|
$invoices = $invoices->filter(function ($inv) {
|
||||||
return !empty($inv->document_number) && !str_contains($inv->document_number, '-');
|
return !empty($inv->document_number) && !str_contains($inv->document_number, '-');
|
||||||
});
|
});
|
||||||
@@ -129,6 +134,7 @@ class SendInvoiceDataReport extends Command
|
|||||||
->map(fn($n) => preg_replace('/\s+/', '', strtoupper((string) $n)))
|
->map(fn($n) => preg_replace('/\s+/', '', strtoupper((string) $n)))
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
|
//where('plant_id', $plant->id)
|
||||||
$wentOutInvoices = InvoiceOutValidation::whereIn('qr_code', $invoiceNumbers)
|
$wentOutInvoices = InvoiceOutValidation::whereIn('qr_code', $invoiceNumbers)
|
||||||
//->whereBetween('scanned_at', [$startDate, $endDate])
|
//->whereBetween('scanned_at', [$startDate, $endDate])
|
||||||
->distinct('qr_code')
|
->distinct('qr_code')
|
||||||
@@ -158,6 +164,7 @@ class SendInvoiceDataReport extends Command
|
|||||||
return !in_array($doc, $wentOutInvoices, true);
|
return !in_array($doc, $wentOutInvoices, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if ($pendingInvoices->isEmpty()) {
|
if ($pendingInvoices->isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -175,7 +182,7 @@ class SendInvoiceDataReport extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$tableData[] = [
|
$tableData[] = [
|
||||||
// 'no' => $no++,
|
//'no' => $no++,
|
||||||
'plant' => $plant->name,
|
'plant' => $plant->name,
|
||||||
// 'distribution_type' => $selectedDistribution,
|
// 'distribution_type' => $selectedDistribution,
|
||||||
'customer_code' => $inv->customer_code,
|
'customer_code' => $inv->customer_code,
|
||||||
@@ -187,7 +194,6 @@ class SendInvoiceDataReport extends Command
|
|||||||
'no_of_days_pending' => abs((int)now()->diffInDays($documentDate)),
|
'no_of_days_pending' => abs((int)now()->diffInDays($documentDate)),
|
||||||
'status' => 'Pending',
|
'status' => 'Pending',
|
||||||
'status_class' => $statusColor,
|
'status_class' => $statusColor,
|
||||||
'remark' => $inv->remark,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +203,6 @@ class SendInvoiceDataReport extends Command
|
|||||||
->values()
|
->values()
|
||||||
->map(function ($item, $index) {
|
->map(function ($item, $index) {
|
||||||
$item['no'] = $index + 1;
|
$item['no'] = $index + 1;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
})
|
})
|
||||||
->toArray();
|
->toArray();
|
||||||
@@ -209,7 +214,7 @@ class SendInvoiceDataReport extends Command
|
|||||||
|
|
||||||
$this->info($contentVars['greeting'] ?? 'Invoice Data Report');
|
$this->info($contentVars['greeting'] ?? 'Invoice Data Report');
|
||||||
$this->table(
|
$this->table(
|
||||||
['No', 'Plant', 'Customer Code', 'Document Number', 'Document Date', 'Trade Name', 'Location', 'Pending Days', 'Status', 'Remark'],// 'Distribution Type'
|
['No', 'Plant', 'Customer Code', 'Document Number', 'Document Date', 'Trade Name', 'Location', 'Pending Days', 'Status'],//'Distribution Type'
|
||||||
$tableData
|
$tableData
|
||||||
);
|
);
|
||||||
$this->info($contentVars['wishes'] ?? '');
|
$this->info($contentVars['wishes'] ?? '');
|
||||||
@@ -231,13 +236,13 @@ class SendInvoiceDataReport extends Command
|
|||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
if (empty($toEmails)) {
|
if (empty($toEmails)) {
|
||||||
$this->info("Skipping rule ID {$rule->id} — no valid To emails found.");
|
$this->warn("Skipping rule ID {$rule->id} — no valid To emails found.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
\Mail::to($toEmails)->cc($ccEmails)->send($mail);
|
\Mail::to($toEmails)->cc($ccEmails)->send($mail);
|
||||||
|
|
||||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
$this->info("Mail sent for rule ID {$rule->id} → To: " . implode(', ', $toEmails) . ($ccEmails ? " | CC: " . implode(', ', $ccEmails) : ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class SendInvoiceReport extends Command
|
|||||||
$scannedSerialCount = InvoiceValidation::select('invoice_number')
|
$scannedSerialCount = InvoiceValidation::select('invoice_number')
|
||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
->whereNull('quantity')
|
->whereNull('quantity')
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->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();
|
||||||
@@ -86,7 +86,7 @@ class SendInvoiceReport extends Command
|
|||||||
$query->whereNull('quantity')
|
$query->whereNull('quantity')
|
||||||
->orWhere('quantity', 0);
|
->orWhere('quantity', 0);
|
||||||
})
|
})
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
$serialTableData[] = [
|
$serialTableData[] = [
|
||||||
@@ -108,7 +108,7 @@ class SendInvoiceReport extends Command
|
|||||||
$scannedMatCount = InvoiceValidation::select('invoice_number')
|
$scannedMatCount = InvoiceValidation::select('invoice_number')
|
||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
->where('quantity', 1)
|
->where('quantity', 1)
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->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();
|
||||||
@@ -122,7 +122,7 @@ class SendInvoiceReport extends Command
|
|||||||
->where('quantity', 1)
|
->where('quantity', 1)
|
||||||
->whereNotNull('serial_number')
|
->whereNotNull('serial_number')
|
||||||
->where('serial_number', '!=', '')
|
->where('serial_number', '!=', '')
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
$materialTableData[] = [
|
$materialTableData[] = [
|
||||||
@@ -144,7 +144,7 @@ class SendInvoiceReport extends Command
|
|||||||
$scannedBundleCount = InvoiceValidation::select('invoice_number')
|
$scannedBundleCount = InvoiceValidation::select('invoice_number')
|
||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
->where('quantity', '>', 1)
|
->where('quantity', '>', 1)
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->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();
|
||||||
@@ -158,7 +158,7 @@ class SendInvoiceReport extends Command
|
|||||||
->where('quantity', '>', 1)
|
->where('quantity', '>', 1)
|
||||||
->whereNotNull('serial_number')
|
->whereNotNull('serial_number')
|
||||||
->where('serial_number', '!=', '')
|
->where('serial_number', '!=', '')
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
$bundleTableData[] = [
|
$bundleTableData[] = [
|
||||||
@@ -180,104 +180,25 @@ class SendInvoiceReport extends Command
|
|||||||
|
|
||||||
// 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, [], [], $schedule));
|
Mail::to($email)->send(new test($serialTableData, [], [], $schedule));
|
||||||
// }
|
|
||||||
foreach ($mailRules->get('SerialInvoiceMail') as $rule) {
|
|
||||||
|
|
||||||
$toEmails = collect(explode(',', $rule->email))
|
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$ccEmails = collect(explode(',', $rule->cc_emails ?? ''))
|
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
if (empty($toEmails)) {
|
|
||||||
$this->warn("Skipping rule ID {$rule->id} — no valid To emails found.");
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, [], [], $schedule));
|
|
||||||
|
|
||||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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, $schedule));
|
Mail::to($email)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
||||||
// }
|
|
||||||
foreach ($mailRules->get('MaterialInvoiceMail') as $rule) {
|
|
||||||
|
|
||||||
$toEmails = collect(explode(',', $rule->email))
|
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$ccEmails = collect(explode(',', $rule->cc_emails ?? ''))
|
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
if (empty($toEmails)) {
|
|
||||||
$this->warn("Skipping rule ID {$rule->id} — no valid To emails found.");
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($toEmails)->cc($ccEmails)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
|
||||||
|
|
||||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to InvoiceMail recipients (all three tables)
|
// Send to InvoiceMail recipients (all three tables)
|
||||||
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, $schedule));
|
Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
||||||
// $this->info("✅ Sent InvoiceMail to: {$email}");
|
|
||||||
// }
|
|
||||||
foreach ($mailRules->get('InvoiceMail') as $rule) {
|
|
||||||
|
|
||||||
$toEmails = collect(explode(',', $rule->email))
|
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$ccEmails = collect(explode(',', $rule->cc_emails ?? ''))
|
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
if (empty($toEmails)) {
|
|
||||||
$this->warn("Skipping rule ID {$rule->id} — no valid To emails found.");
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
\Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
|
||||||
|
|
||||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,6 +213,5 @@ class SendInvoiceReport extends Command
|
|||||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
|
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
|
||||||
|
|
||||||
$this->info($contentVars['wishes'] ?? '');
|
$this->info($contentVars['wishes'] ?? '');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Exports;
|
|
||||||
|
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
||||||
use Maatwebsite\Excel\Concerns\FromArray;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
||||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
|
||||||
|
|
||||||
class InvoicePendingReasonExport implements FromArray, WithHeadings, WithMapping
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return \Illuminate\Support\Collection
|
|
||||||
*/
|
|
||||||
protected array $data;
|
|
||||||
|
|
||||||
public function __construct(array $data)
|
|
||||||
{
|
|
||||||
$this->data = $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function array(): array
|
|
||||||
{
|
|
||||||
return $this->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'Plant Code',
|
|
||||||
'Document Number',
|
|
||||||
'Remark',
|
|
||||||
'Customer Trade Name',
|
|
||||||
'Location',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function map($row): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
$row['plant_id'] ?? '',
|
|
||||||
$row['document_number'] ?? '',
|
|
||||||
$row['remark'] ?? '',
|
|
||||||
$row['customer_trade_name'] ?? '',
|
|
||||||
$row['location'] ?? '',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,472 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Pages;
|
|
||||||
|
|
||||||
use App\Imports\InvoicePendingReasonImport;
|
|
||||||
use App\Models\InvoiceDataValidation;
|
|
||||||
use App\Models\InvoiceOutValidation;
|
|
||||||
use App\Models\Plant;
|
|
||||||
use Filament\Pages\Page;
|
|
||||||
use Filament\Forms\Contracts\HasForms;
|
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Forms\Components\FileUpload;
|
|
||||||
use Filament\Forms\Components\Hidden;
|
|
||||||
use Filament\Forms\Components\Select;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
|
||||||
use Storage;
|
|
||||||
|
|
||||||
class InvoicePendingReason extends Page
|
|
||||||
{
|
|
||||||
use HasFiltersForm;
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
|
||||||
|
|
||||||
protected static string $view = 'filament.pages.invoice-pending-reason';
|
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Manufacturing SD';
|
|
||||||
|
|
||||||
public ?string $file = null;
|
|
||||||
|
|
||||||
public array $importErrors = [];
|
|
||||||
|
|
||||||
public array $invoicePending = [];
|
|
||||||
|
|
||||||
|
|
||||||
public function mount(): void
|
|
||||||
{
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'plant_id' => null,
|
|
||||||
'document_number' => null,
|
|
||||||
'remark' => null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function filtersForm(Form $form): Form
|
|
||||||
{
|
|
||||||
return $form
|
|
||||||
->statePath('filters')
|
|
||||||
->schema([
|
|
||||||
Select::make('plant_id')
|
|
||||||
->label('Plant')
|
|
||||||
->reactive()
|
|
||||||
->required()
|
|
||||||
->columnSpan(1)
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function ($state, $set, callable $get,$livewire) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
|
|
||||||
if($plantId){
|
|
||||||
$this->dispatch('loadData' ,$plantId);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$this->dispatch('emptyData');
|
|
||||||
}
|
|
||||||
|
|
||||||
$set('document_number', null);
|
|
||||||
$set('customer_trade_name', null);
|
|
||||||
$set('location', null);
|
|
||||||
})
|
|
||||||
->hint(fn ($get) => $get('pqPlantError') ? $get('pqPlantError') : null)
|
|
||||||
->hintColor('danger'),
|
|
||||||
|
|
||||||
Select::make('document_number')
|
|
||||||
->label('Document Number')
|
|
||||||
->required()
|
|
||||||
->reactive()
|
|
||||||
->columnSpan(1)
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
if (empty($plantId)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$distributions = InvoiceDataValidation::whereNotNull('distribution_channel_desc')
|
|
||||||
->distinct()
|
|
||||||
->pluck('distribution_channel_desc')
|
|
||||||
->filter(fn ($v) => trim($v) !== '')
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$distributions[] = '';
|
|
||||||
|
|
||||||
$pendingInvoices = collect();
|
|
||||||
|
|
||||||
foreach ($distributions as $distribution) {
|
|
||||||
|
|
||||||
$invoices = InvoiceDataValidation::where('plant_id', $plantId)
|
|
||||||
->where('distribution_channel_desc', $distribution)
|
|
||||||
->select('id', 'document_number')
|
|
||||||
->get()
|
|
||||||
->unique('document_number')
|
|
||||||
->filter(fn ($inv) =>
|
|
||||||
! empty($inv->document_number) &&
|
|
||||||
! str_contains($inv->document_number, '-')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (trim($distribution) == '') {
|
|
||||||
$invoices = $invoices->filter(fn ($inv) =>
|
|
||||||
str_starts_with($inv->document_number, '7')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($invoices->isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$invoiceNumbers = $invoices->pluck('document_number')
|
|
||||||
->map(fn ($n) => preg_replace('/\s+/', '', strtoupper($n)))
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$wentOut = InvoiceOutValidation::whereIn('qr_code', $invoiceNumbers)
|
|
||||||
->distinct()
|
|
||||||
->pluck('qr_code')
|
|
||||||
->map(fn ($n) => preg_replace('/\s+/', '', strtoupper($n)))
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$pending = $invoices->filter(function ($inv) use ($wentOut) {
|
|
||||||
$doc = preg_replace('/\s+/', '', strtoupper($inv->document_number));
|
|
||||||
return ! in_array($doc, $wentOut, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
$pendingInvoices = $pendingInvoices->merge($pending);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $pendingInvoices
|
|
||||||
->unique('document_number')
|
|
||||||
->pluck('document_number', 'document_number')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
if (empty($plantId)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
$documentNumber = $get('document_number');
|
|
||||||
|
|
||||||
$customers = InvoiceDataValidation::where('plant_id', $plantId)
|
|
||||||
->where('document_number', $documentNumber)
|
|
||||||
->value('customer_trade_name');
|
|
||||||
|
|
||||||
$location = InvoiceDataValidation::where('plant_id', $plantId)
|
|
||||||
->where('document_number', $documentNumber)
|
|
||||||
->value('location');
|
|
||||||
|
|
||||||
$set('customer_trade_name', $customers);
|
|
||||||
$set('location', $location);
|
|
||||||
})
|
|
||||||
->extraAttributes(fn ($get) => [
|
|
||||||
'class' => $get('pqBlockError') ? 'border-red-500' : '',
|
|
||||||
])
|
|
||||||
->hint(fn ($get) => $get('pqBlockError') ? $get('pqBlockError') : null)
|
|
||||||
->hintColor('danger'),
|
|
||||||
TextInput::make('customer_trade_name')
|
|
||||||
->label('Customer Trade Name')
|
|
||||||
->required()
|
|
||||||
->readOnly()
|
|
||||||
->reactive()
|
|
||||||
->columnSpan(1),
|
|
||||||
TextInput::make('location')
|
|
||||||
->label('Location')
|
|
||||||
->required()
|
|
||||||
->readOnly()
|
|
||||||
->reactive()
|
|
||||||
->columnSpan(1),
|
|
||||||
TextInput::make('remark')
|
|
||||||
->label('Remark')
|
|
||||||
->reactive()
|
|
||||||
->maxLength(40)
|
|
||||||
->helperText('Max 40 characters allowed.')
|
|
||||||
->extraAttributes([
|
|
||||||
'wire:keydown.enter.prevent' => 'addRemark($event.target.value)',
|
|
||||||
])
|
|
||||||
->autofocus()
|
|
||||||
->required(),
|
|
||||||
FileUpload::make('file')
|
|
||||||
->label('Upload Excel File')
|
|
||||||
->required()
|
|
||||||
->disk('local')
|
|
||||||
->multiple(false)
|
|
||||||
->directory('invoice-pending')
|
|
||||||
->dehydrated(false)
|
|
||||||
//->preserveFilenames()
|
|
||||||
//->storeFiles()
|
|
||||||
//storeFileNamesIn('original_name')
|
|
||||||
// ->visibility('private')
|
|
||||||
->acceptedFileTypes([
|
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
||||||
'application/vnd.ms-excel',
|
|
||||||
'text/csv',
|
|
||||||
])
|
|
||||||
->rules(['mimes:xlsx,xls,csv'])
|
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
|
||||||
if ($state instanceof \Livewire\Features\SupportFileUploads\TemporaryUploadedFile) {
|
|
||||||
$set('file', $state->store('invoice-pending'));
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
])
|
|
||||||
->columns(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addRemark(){
|
|
||||||
$plantId = $this->filters['plant_id'] ?? null;
|
|
||||||
$documentNumber = $this->filters['document_number'] ?? null;
|
|
||||||
$remark = $this->filters['remark'] ?? null;
|
|
||||||
|
|
||||||
if (! $plantId) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Plant')
|
|
||||||
->body("please select plant first..!")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (! $documentNumber) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Document Number')
|
|
||||||
->body("please select document number..!")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($remark == '') {
|
|
||||||
Notification::make()
|
|
||||||
->title('Remark')
|
|
||||||
->body("Remark can't be empty..!")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvoiceDataValidation::where('plant_id', $plantId)
|
|
||||||
->where('document_number', $documentNumber)
|
|
||||||
->update([
|
|
||||||
'remark' => $remark,
|
|
||||||
'updated_at' => now(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'document_number' => $documentNumber,
|
|
||||||
'remark' => null,
|
|
||||||
]);
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Remark updated successfully')
|
|
||||||
->success()
|
|
||||||
->send();
|
|
||||||
}
|
|
||||||
|
|
||||||
// public function importPendingReason()
|
|
||||||
// {
|
|
||||||
|
|
||||||
// $file = $this->filters['file'] ?? null;
|
|
||||||
|
|
||||||
// $absolutePath = Storage::disk('local')->path($file);
|
|
||||||
|
|
||||||
// Excel::import(new InvoicePendingReasonImport, $absolutePath);
|
|
||||||
|
|
||||||
// $this->reset('filters.file');
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('File processed and database updated successfully')
|
|
||||||
// ->success()
|
|
||||||
// ->send();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function importPendingReason()
|
|
||||||
{
|
|
||||||
$file = $this->filters['file'] ?? null;
|
|
||||||
|
|
||||||
$plantId = $this->filters['plant_id'] ?? null;
|
|
||||||
|
|
||||||
if (empty($file)) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Please upload a file')
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (
|
|
||||||
// empty($fileFilter) ||
|
|
||||||
// !is_array($fileFilter) ||
|
|
||||||
// empty($fileFilter[0])
|
|
||||||
// ) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Please upload a file')
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// $filePath = $fileFilter[0];
|
|
||||||
|
|
||||||
// if (!is_string($filePath)) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Invalid file upload')
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
$absolutePath = Storage::disk('local')->path($file);
|
|
||||||
|
|
||||||
$import = new InvoicePendingReasonImport();
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Excel::import(
|
|
||||||
$import,
|
|
||||||
$absolutePath
|
|
||||||
);
|
|
||||||
|
|
||||||
if(!empty($import->plantCodeEmpty)) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Import failed')
|
|
||||||
->body("Plant code can't be empty")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'file' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(!empty($import->docNoEmpty)) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Import failed')
|
|
||||||
->body("Document number can't be empty")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'file' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// else if(!empty($import->remarkEmpty)) {
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->title('Import failed')
|
|
||||||
// ->body("Remark can't be empty")
|
|
||||||
// ->danger()
|
|
||||||
// ->send();
|
|
||||||
// $this->filtersForm->fill([
|
|
||||||
// 'file' => null,
|
|
||||||
// ]);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
else if (! empty($import->duplicateExcelDocs)) {
|
|
||||||
|
|
||||||
$duplicates = collect($import->duplicateExcelDocs)
|
|
||||||
->map(function ($rows, $key) {
|
|
||||||
[$plant, $doc] = explode('|', $key);
|
|
||||||
return "{$plant}-{$doc}";
|
|
||||||
})
|
|
||||||
->implode(', ');
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Import failed')
|
|
||||||
->body("Duplicate Document Numbers found in Excel: {$duplicates}")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'file' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(!empty($import->missingPlantCodes)) {
|
|
||||||
$codes = implode(', ', array_keys($import->missingPlantCodes));
|
|
||||||
Notification::make()
|
|
||||||
->title('Import failed')
|
|
||||||
->body("Plant codes not found: {$codes}")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'file' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(!empty($import->missingDocNo)) {
|
|
||||||
$docNo = implode(', ', array_keys($import->missingDocNo));
|
|
||||||
Notification::make()
|
|
||||||
->title('Import failed')
|
|
||||||
->body("Document numbers not found: {$docNo}")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'file' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($import->validRows as $row) {
|
|
||||||
InvoiceDataValidation::where('plant_id', $row['plant_id'])
|
|
||||||
->where('document_number', $row['document_number'])
|
|
||||||
->update([
|
|
||||||
'remark' => $row['remark'],
|
|
||||||
'updated_at' => now(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Import successful')
|
|
||||||
->body('All records updated successfully.')
|
|
||||||
->success()
|
|
||||||
->send();
|
|
||||||
|
|
||||||
$this->dispatch('loadData' ,$plantId);
|
|
||||||
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'file' => null,
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Import error')
|
|
||||||
->body($e->getMessage())
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function exportPendingReason()
|
|
||||||
{
|
|
||||||
$plantId = $this->filters['plant_id'] ?? null;
|
|
||||||
|
|
||||||
if (! $plantId) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Plant')
|
|
||||||
->body("please select plant to export data..!")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->dispatch('loadData1' ,$plantId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function canAccess(): bool
|
|
||||||
{
|
|
||||||
return Auth::check() && Auth::user()->can('view invoice pending reason');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Pages;
|
|
||||||
|
|
||||||
use Filament\Pages\Page;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
|
|
||||||
class Welcome extends Page
|
|
||||||
{
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
|
||||||
|
|
||||||
protected static string $view = 'filament.pages.welcome';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getHeading(): string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// public static function canAccess(): bool
|
|
||||||
// {
|
|
||||||
// return Auth::check() && Auth::user()->can('view welcome page');
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,201 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
|
|
||||||
use App\Models\CharacteristicApproverMaster;
|
|
||||||
use App\Models\Machine;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Resources\Resource;
|
|
||||||
use Filament\Tables;
|
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class CharacteristicApproverMasterResource extends Resource
|
|
||||||
{
|
|
||||||
protected static ?string $model = CharacteristicApproverMaster::class;
|
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Laser Marking';
|
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
|
||||||
{
|
|
||||||
return $form
|
|
||||||
->schema([
|
|
||||||
Forms\Components\Select::make('plant_id')
|
|
||||||
->label('Plant')
|
|
||||||
->reactive()
|
|
||||||
->relationship('plant', 'name')
|
|
||||||
->required(),
|
|
||||||
Forms\Components\Select::make('machine_id')
|
|
||||||
->label('Work Center')
|
|
||||||
// ->relationship('machine', 'name')
|
|
||||||
->reactive()
|
|
||||||
->searchable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
if (empty($plantId)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
|
||||||
})
|
|
||||||
->required(),
|
|
||||||
Forms\Components\TextInput::make('characteristic_field')
|
|
||||||
->label('Characteristic Field'),
|
|
||||||
Forms\Components\TextInput::make('machine_name')
|
|
||||||
->label('Machine Name'),
|
|
||||||
Forms\Components\TextInput::make('name1')
|
|
||||||
->label('Name-1'),
|
|
||||||
Forms\Components\TextInput::make('mail1')
|
|
||||||
->label('Mail-1'),
|
|
||||||
Forms\Components\TextInput::make('duration1')
|
|
||||||
->label('Duration-1 (Hour.Minute)'),
|
|
||||||
Forms\Components\TextInput::make('name2')
|
|
||||||
->label('Name-2'),
|
|
||||||
Forms\Components\TextInput::make('mail2')
|
|
||||||
->label('Mail-2'),
|
|
||||||
Forms\Components\TextInput::make('duration2')
|
|
||||||
->label('Duration-2 (Hour.Minute)'),
|
|
||||||
Forms\Components\TextInput::make('name3')
|
|
||||||
->label('Name-3'),
|
|
||||||
Forms\Components\TextInput::make('mail3')
|
|
||||||
->label('Mail-3'),
|
|
||||||
Forms\Components\TextInput::make('duration3')
|
|
||||||
->label('Duration-3 (Hour.Minute)'),
|
|
||||||
Forms\Components\Hidden::make('created_by')
|
|
||||||
->label('Created By')
|
|
||||||
->default(Filament::auth()->user()?->name),
|
|
||||||
Forms\Components\Hidden::make('updated_by')
|
|
||||||
->label('Updated By')
|
|
||||||
->default(Filament::auth()->user()?->name),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
|
||||||
{
|
|
||||||
return $table
|
|
||||||
->columns([
|
|
||||||
Tables\Columns\TextColumn::make('No.')
|
|
||||||
->label('No.')
|
|
||||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
|
||||||
$paginator = $livewire->getTableRecords();
|
|
||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
|
||||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
|
||||||
|
|
||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
|
||||||
}),
|
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
|
||||||
->label('Plant')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('machine.work_center')
|
|
||||||
->label('Work Center')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('characteristic_field')
|
|
||||||
->label('Characteristic Field')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('machine_name')
|
|
||||||
->label('Machine Name')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('name1')
|
|
||||||
->label('Approver Name 1')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('mail1')
|
|
||||||
->label('Mail 1')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('duration1')
|
|
||||||
->label('Duration 1 (Hour.Minute)')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('name2')
|
|
||||||
->label('Approver Name 2')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('mail2')
|
|
||||||
->label('Mail 2')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('duration2')
|
|
||||||
->label('Duration 2 (Hour.Minute)')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('name3')
|
|
||||||
->label('Approver Name 3')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('mail3')
|
|
||||||
->label('Mail 3')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('duration3')
|
|
||||||
->label('Duration 3 (Hour.Minute)')
|
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
|
||||||
->label('Created At')
|
|
||||||
->alignCenter()
|
|
||||||
->dateTime()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
|
||||||
->label('Updated At')
|
|
||||||
->alignCenter()
|
|
||||||
->dateTime()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
|
||||||
->dateTime()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
])
|
|
||||||
->filters([
|
|
||||||
Tables\Filters\TrashedFilter::make(),
|
|
||||||
])
|
|
||||||
->actions([
|
|
||||||
Tables\Actions\ViewAction::make(),
|
|
||||||
Tables\Actions\EditAction::make(),
|
|
||||||
])
|
|
||||||
->bulkActions([
|
|
||||||
Tables\Actions\BulkActionGroup::make([
|
|
||||||
Tables\Actions\DeleteBulkAction::make(),
|
|
||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getRelations(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPages(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'index' => Pages\ListCharacteristicApproverMasters::route('/'),
|
|
||||||
'create' => Pages\CreateCharacteristicApproverMaster::route('/create'),
|
|
||||||
'view' => Pages\ViewCharacteristicApproverMaster::route('/{record}'),
|
|
||||||
'edit' => Pages\EditCharacteristicApproverMaster::route('/{record}/edit'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
|
||||||
{
|
|
||||||
return parent::getEloquentQuery()
|
|
||||||
->withoutGlobalScopes([
|
|
||||||
SoftDeletingScope::class,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CharacteristicApproverMasterResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
|
||||||
|
|
||||||
class CreateCharacteristicApproverMaster extends CreateRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = CharacteristicApproverMasterResource::class;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CharacteristicApproverMasterResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\EditRecord;
|
|
||||||
|
|
||||||
class EditCharacteristicApproverMaster extends EditRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = CharacteristicApproverMasterResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\ViewAction::make(),
|
|
||||||
Actions\DeleteAction::make(),
|
|
||||||
Actions\ForceDeleteAction::make(),
|
|
||||||
Actions\RestoreAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CharacteristicApproverMasterResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
|
||||||
|
|
||||||
class ListCharacteristicApproverMasters extends ListRecords
|
|
||||||
{
|
|
||||||
protected static string $resource = CharacteristicApproverMasterResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\CreateAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\CharacteristicApproverMasterResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ViewRecord;
|
|
||||||
|
|
||||||
class ViewCharacteristicApproverMaster extends ViewRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = CharacteristicApproverMasterResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\EditAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\ClassCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\ClassCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
|
||||||
|
|
||||||
class CreateClassCharacteristic extends CreateRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = ClassCharacteristicResource::class;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\ClassCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\ClassCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\EditRecord;
|
|
||||||
|
|
||||||
class EditClassCharacteristic extends EditRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = ClassCharacteristicResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\ViewAction::make(),
|
|
||||||
Actions\DeleteAction::make(),
|
|
||||||
Actions\ForceDeleteAction::make(),
|
|
||||||
Actions\RestoreAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\ClassCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\ClassCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
|
||||||
|
|
||||||
class ListClassCharacteristics extends ListRecords
|
|
||||||
{
|
|
||||||
protected static string $resource = ClassCharacteristicResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\CreateAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\ClassCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\ClassCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ViewRecord;
|
|
||||||
|
|
||||||
class ViewClassCharacteristic extends ViewRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = ClassCharacteristicResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\EditAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -59,8 +59,6 @@ class InvoiceDataValidationResource extends Resource
|
|||||||
Forms\Components\TextInput::make('location')
|
Forms\Components\TextInput::make('location')
|
||||||
->label('Location')
|
->label('Location')
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('remark')
|
|
||||||
->label('Remark'),
|
|
||||||
Forms\Components\Hidden::make('created_by')
|
Forms\Components\Hidden::make('created_by')
|
||||||
->label('Created By')
|
->label('Created By')
|
||||||
->default(Filament::auth()->user()?->name),
|
->default(Filament::auth()->user()?->name),
|
||||||
@@ -125,11 +123,6 @@ class InvoiceDataValidationResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('remark')
|
|
||||||
->label('Remark')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
@@ -398,104 +398,122 @@ class InvoiceOutValidationResource extends Resource
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
$successCount = 0;
|
$successCount = 0;
|
||||||
$updateCount = 0;
|
|
||||||
$insertCount = 0;
|
|
||||||
$failedRecords = [];
|
$failedRecords = [];
|
||||||
|
|
||||||
foreach ($rows as $index => $row)
|
DB::beginTransaction();
|
||||||
{
|
|
||||||
if ($index == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rowNumber = $index + 1;
|
try {
|
||||||
|
foreach ($rows as $index => $row) {
|
||||||
try {
|
if ($index == 0) {
|
||||||
$qrcode = trim($row[1]);
|
continue;
|
||||||
$plantCode = trim($row[2]);
|
|
||||||
$scannedAt = trim($row[3]);
|
|
||||||
$scannedBy = trim($row[4]);
|
|
||||||
|
|
||||||
if (empty($qrcode)) {
|
|
||||||
throw new \Exception("Row '{$rowNumber}' Missing QR Code");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$plant = Plant::where('code', $plantCode)->first();
|
$rowNumber = $index + 1;
|
||||||
if (! $plant) {
|
|
||||||
throw new \Exception("Invalid plant code : '{$plantCode}'");
|
|
||||||
}
|
|
||||||
|
|
||||||
$formattedDate = null;
|
try {
|
||||||
if (! empty($scannedAt)) {
|
$qrcode = trim($row[1]);
|
||||||
try {
|
$plantCode = trim($row[2]);
|
||||||
// $formattedDate = Carbon::createFromFormat('d-m-Y H:i:s', $scannedAt)
|
$scannedAt = trim($row[3]);
|
||||||
// ->format('Y-m-d H:i:s');
|
$scannedBy = trim($row[4]);
|
||||||
if (is_numeric($scannedAt)) {
|
|
||||||
$formattedDate = ExcelDate::excelToDateTimeObject($scannedAt)
|
if (empty($qrcode)) {
|
||||||
->format('Y-m-d H:i:s');
|
throw new \Exception("Row '{$rowNumber}' Missing QR Code");
|
||||||
} else {
|
|
||||||
// Or handle as manual string date (d-m-Y H:i:s)
|
|
||||||
$formattedDate = Carbon::createFromFormat('d-m-Y H:i:s', $scannedAt)
|
|
||||||
->format('Y-m-d H:i:s');
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw new \Exception("Invalid date format : '{$scannedAt}'");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
|
if (! $plant) {
|
||||||
|
throw new \Exception("Invalid plant code : '{$plantCode}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
$formattedDate = null;
|
||||||
|
if (! empty($scannedAt)) {
|
||||||
|
try {
|
||||||
|
// $formattedDate = Carbon::createFromFormat('d-m-Y H:i:s', $scannedAt)
|
||||||
|
// ->format('Y-m-d H:i:s');
|
||||||
|
if (is_numeric($scannedAt)) {
|
||||||
|
$formattedDate = ExcelDate::excelToDateTimeObject($scannedAt)
|
||||||
|
->format('Y-m-d H:i:s');
|
||||||
|
} else {
|
||||||
|
// Or handle as manual string date (d-m-Y H:i:s)
|
||||||
|
$formattedDate = Carbon::createFromFormat('d-m-Y H:i:s', $scannedAt)
|
||||||
|
->format('Y-m-d H:i:s');
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new \Exception("Invalid date format : '{$scannedAt}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$record = InvoiceOutValidation::where('plant_id', $plant->id)
|
||||||
|
->where('qr_code', $qrcode)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$curStat = $record ? 'Updation' : 'Insertion';
|
||||||
|
|
||||||
|
if ($record) {
|
||||||
|
$record->update([
|
||||||
|
'scanned_at' => $formattedDate,
|
||||||
|
'scanned_by' => $scannedBy,
|
||||||
|
'updated_by' => $operatorName,
|
||||||
|
]);
|
||||||
|
$inserted = $record;
|
||||||
|
} else {
|
||||||
|
// Record does not exist, create with 'created_by'
|
||||||
|
$inserted = InvoiceOutValidation::create([
|
||||||
|
'plant_id' => $plant->id,
|
||||||
|
'qr_code' => $qrcode,
|
||||||
|
'scanned_at' => $formattedDate,
|
||||||
|
'scanned_by' => $scannedBy,
|
||||||
|
'created_by' => $operatorName,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
// $inserted = InvoiceOutValidation::create([
|
||||||
|
// 'plant_id' => $plant->id,
|
||||||
|
// 'qr_code' => $qrcode,
|
||||||
|
// 'scanned_at' => $formattedDate,
|
||||||
|
// 'scanned_by' => $scannedBy,
|
||||||
|
// 'created_by' => $operatorName
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
if (! $inserted) {
|
||||||
|
throw new \Exception("{$curStat} failed for QR : {$qrcode}");
|
||||||
|
}
|
||||||
|
|
||||||
|
$successCount++;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$failedRecords[] = [
|
||||||
|
'row' => $rowNumber,
|
||||||
|
'qrcode' => $qrcode ?? null,
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$exists = InvoiceOutValidation::where('plant_id', $plant->id)
|
|
||||||
->where('qr_code', $qrcode)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
InvoiceOutValidation::updateOrCreate(
|
|
||||||
[
|
|
||||||
'plant_id' => $plant->id,
|
|
||||||
'qr_code' => $qrcode,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'scanned_at' => $formattedDate,
|
|
||||||
'scanned_by' => $scannedBy,
|
|
||||||
'updated_by' => $operatorName,
|
|
||||||
'created_by' => $operatorName,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$exists ? $updateCount++ : $insertCount++;
|
|
||||||
$successCount++;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (\Exception $e) {
|
|
||||||
$failedRecords[] = [
|
|
||||||
'row' => $rowNumber,
|
|
||||||
'qrcode' => $qrcode ?? null,
|
|
||||||
'error' => $e->getMessage(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($failedRecords) > 0) {
|
DB::commit();
|
||||||
|
|
||||||
|
if (count($failedRecords) > 0) {
|
||||||
$failedSummary = collect($failedRecords)
|
$failedSummary = collect($failedRecords)
|
||||||
->map(fn ($f) => "Row {$f['row']} ({$f['qrcode']}) : {$f['error']}")
|
->map(fn ($f) => "Row {$f['row']} ({$f['qrcode']}) : {$f['error']}")
|
||||||
->take(5)
|
->take(5) // limit preview to first 5 errors
|
||||||
->implode("\n");
|
->implode("\n");
|
||||||
Notification::make()
|
|
||||||
->title('Partial Import Warning')
|
Notification::make()
|
||||||
->body(
|
->title('Partial Import Warning')
|
||||||
"Total Success: {$successCount}\n" .
|
->body("'{$successCount}' records inserted. ".count($failedRecords)." failed.\n\n{$failedSummary}")
|
||||||
"Inserted: {$insertCount}\n" .
|
->warning()
|
||||||
"Updated: {$updateCount}\n" .
|
->send();
|
||||||
"Failed: " . count($failedRecords) . "\n\n" .
|
} else {
|
||||||
$failedSummary
|
Notification::make()
|
||||||
)
|
->title('Import Success')
|
||||||
->warning()
|
->body("Successfully imported '{$successCount}' records.")
|
||||||
->send();
|
->success()
|
||||||
}
|
->send();
|
||||||
else
|
}
|
||||||
{
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Import Success')
|
->title('Import Failed')
|
||||||
->body("Successfully imported '{$successCount}' records.")
|
->body("No records were inserted. Error : {$e->getMessage()}")
|
||||||
->success()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ use Filament\Resources\Pages\CreateRecord;
|
|||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Livewire\Attributes\On;
|
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
use Str;
|
use Str;
|
||||||
|
use Livewire\Attributes\On;
|
||||||
|
|
||||||
class CreateInvoiceValidation extends CreateRecord
|
class CreateInvoiceValidation extends CreateRecord
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
public bool $showCapacitorInput = false;
|
public bool $showCapacitorInput = false;
|
||||||
|
|
||||||
public $excel_file;
|
public $excel_file;
|
||||||
|
|
||||||
public $mInvoiceNo;
|
public $mInvoiceNo;
|
||||||
|
|
||||||
public function getFormActions(): array
|
public function getFormActions(): array
|
||||||
@@ -122,7 +121,8 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// ..GET SERIAL INVOICE API
|
// ..GET SERIAL INVOICE API
|
||||||
|
|
||||||
if (strlen($invoiceNumber) > 15) {
|
if(strlen($invoiceNumber) > 15)
|
||||||
|
{
|
||||||
|
|
||||||
$payloadJson = base64_decode(strtr($parts[1], '-_', '+/'));
|
$payloadJson = base64_decode(strtr($parts[1], '-_', '+/'));
|
||||||
|
|
||||||
@@ -132,44 +132,41 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->danger()
|
->danger()
|
||||||
->seconds(1)
|
->seconds(1)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$payload = json_decode($payloadJson, true);
|
$payload = json_decode($payloadJson, true);
|
||||||
|
|
||||||
if (! isset($payload['data'])) {
|
|
||||||
|
if (!isset($payload['data'])) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid payload for scanned qr code.')
|
->title('Invalid payload for scanned qr code.')
|
||||||
->info()
|
->info()
|
||||||
->seconds(1)
|
->seconds(1)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$documentData = $payload['data'];
|
$documentData = $payload['data'];
|
||||||
|
|
||||||
if ($documentData == '' || $documentData == '') {
|
if($documentData == '' || $documentData == ''){
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid payload for scanned qr code.')
|
->title('Invalid payload for scanned qr code.')
|
||||||
->info()
|
->info()
|
||||||
->seconds(1)
|
->seconds(1)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract DocNo
|
// Extract DocNo
|
||||||
preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches);
|
preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches);
|
||||||
|
|
||||||
if (! isset($matches[1])) {
|
if (!isset($matches[1])) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invoice number not found.')
|
->title('Invoice number not found.')
|
||||||
->info()
|
->info()
|
||||||
->seconds(1)
|
->seconds(1)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +175,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($invoiceNumber);
|
//dd($invoiceNumber);
|
||||||
|
|
||||||
// ..
|
// ..
|
||||||
|
|
||||||
@@ -1430,7 +1427,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$missingCodes = [];
|
|
||||||
foreach ($rows as $index => $row) {
|
foreach ($rows as $index => $row) {
|
||||||
if ($index == 0) {
|
if ($index == 0) {
|
||||||
continue;
|
continue;
|
||||||
@@ -1442,8 +1438,8 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
if (Str::length($materialCode) < 6) {
|
if (Str::length($materialCode) < 6) {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
$sticker = StickerMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($plantId, $materialCode) {
|
$sticker = StickerMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($materialCode) {
|
||||||
$query->where('plant_id', $plantId)->where('code', $materialCode); // $this->plantId >> Check if item.code matches Excel's materialCode
|
$query->where('plant_id', $this->plantId)->where('code', $materialCode); // Check if item.code matches Excel's materialCode
|
||||||
});
|
});
|
||||||
if ($sticker->exists()) {
|
if ($sticker->exists()) {
|
||||||
if ($sticker->first()->material_type && ! empty($sticker->first()->material_type)) {
|
if ($sticker->first()->material_type && ! empty($sticker->first()->material_type)) {
|
||||||
@@ -1454,8 +1450,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$missingCodes[] = $materialCode;
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1464,26 +1458,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$uniqueCodes = array_unique($missingCodes);
|
if ($invoiceType == 'M') {
|
||||||
|
|
||||||
if (! empty($uniqueCodes)) {
|
|
||||||
$missingCount = count($uniqueCodes);
|
|
||||||
|
|
||||||
$message = $missingCount > 10 ? "'$missingCount' item codes are not found in database for choosed plant." : 'The following item codes are not found in database for choosed plant:<br>'.implode(', ', $uniqueCodes);
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Unknown: Item Codes')
|
|
||||||
->body($message)
|
|
||||||
->danger()
|
|
||||||
->seconds(3)
|
|
||||||
->send();
|
|
||||||
$this->dispatch('playWarnSound');
|
|
||||||
|
|
||||||
// if ($disk->exists($filePath)) {
|
|
||||||
// $disk->delete($filePath);
|
|
||||||
// }
|
|
||||||
return;
|
|
||||||
} elseif ($invoiceType == 'M') {
|
|
||||||
$invalidMatCodes = [];
|
$invalidMatCodes = [];
|
||||||
$materialCodes = [];
|
$materialCodes = [];
|
||||||
$missingQuantities = [];
|
$missingQuantities = [];
|
||||||
@@ -3220,7 +3195,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
if (! empty($emails)) {
|
if (! empty($emails)) {
|
||||||
Mail::to($emails)->send(
|
Mail::to($emails)->send(
|
||||||
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, $mUserName, 'NotFoundInvoice')
|
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode,$mUserName,'NotFoundInvoice')
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ class ItemResource extends Resource
|
|||||||
->searchable(),
|
->searchable(),
|
||||||
Tables\Columns\TextColumn::make('category')
|
Tables\Columns\TextColumn::make('category')
|
||||||
->label('Category')
|
->label('Category')
|
||||||
->default('-')
|
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
->searchable(),
|
->searchable(),
|
||||||
@@ -218,7 +217,6 @@ class ItemResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('uom')
|
Tables\Columns\TextColumn::make('uom')
|
||||||
->label('Unit of Measure')
|
->label('Unit of Measure')
|
||||||
->default('-')
|
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
@@ -239,7 +237,6 @@ class ItemResource extends Resource
|
|||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
->searchPlaceholder('Search Item Code')
|
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
Filter::make('advanced_filters')
|
||||||
@@ -259,7 +256,7 @@ class ItemResource extends Resource
|
|||||||
$set('operator_id', null);
|
$set('operator_id', null);
|
||||||
}),
|
}),
|
||||||
Select::make('code')
|
Select::make('code')
|
||||||
->label('Search by Code')
|
->label('Search by Item Code')
|
||||||
->nullable()
|
->nullable()
|
||||||
// ->options(function (callable $get) {
|
// ->options(function (callable $get) {
|
||||||
// $plantId = $get('Plant');
|
// $plantId = $get('Plant');
|
||||||
|
|||||||
@@ -1,573 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources;
|
|
||||||
|
|
||||||
use App\Filament\Resources\RequestCharacteristicResource\Pages;
|
|
||||||
use App\Models\CharacteristicApproverMaster;
|
|
||||||
use App\Models\Item;
|
|
||||||
use App\Models\Machine;
|
|
||||||
use App\Models\RequestCharacteristic;
|
|
||||||
use Filament\Facades\Filament;
|
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Resources\Resource;
|
|
||||||
use Filament\Tables;
|
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
|
|
||||||
class RequestCharacteristicResource extends Resource
|
|
||||||
{
|
|
||||||
protected static ?string $model = RequestCharacteristic::class;
|
|
||||||
|
|
||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Laser Marking';
|
|
||||||
|
|
||||||
public static function form(Form $form): Form
|
|
||||||
{
|
|
||||||
|
|
||||||
// $disableField = function ($get) {
|
|
||||||
// $currentUser = Filament::auth()->user();
|
|
||||||
// $approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
// if (!$approverId) return true; // disable if no approver selected
|
|
||||||
|
|
||||||
// $approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
// if (!$approver) return true;
|
|
||||||
|
|
||||||
// // Enable if Super Admin
|
|
||||||
// if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
|
||||||
// return false; // not disabled
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Enable only if current user is one of the approvers
|
|
||||||
// $userName = $currentUser?->name;
|
|
||||||
|
|
||||||
// return !in_array($userName, [
|
|
||||||
// $approver->name1,
|
|
||||||
// $approver->name2,
|
|
||||||
// $approver->name3,
|
|
||||||
// ]);
|
|
||||||
// };
|
|
||||||
|
|
||||||
return $form
|
|
||||||
->schema([
|
|
||||||
Forms\Components\Select::make('plant_id')
|
|
||||||
->label('Plant')
|
|
||||||
->relationship('plant', 'name')
|
|
||||||
->required()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\Select::make('machine_id')
|
|
||||||
->label('Work Center')
|
|
||||||
// ->relationship('machine', 'name')
|
|
||||||
->reactive()
|
|
||||||
->searchable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
if (empty($plantId)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
|
||||||
})
|
|
||||||
->required()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\TextInput::make('work_flow_id')
|
|
||||||
->label('Work Flow ID')
|
|
||||||
->readOnly()
|
|
||||||
->reactive(),
|
|
||||||
// ->rule(function (callable $get) {
|
|
||||||
// return Rule::unique('request_characteristics', 'work_flow_id')
|
|
||||||
// ->where('plant_id', $get('plant_id'))
|
|
||||||
// ->ignore($get('id'));
|
|
||||||
// }),
|
|
||||||
Forms\Components\Select::make('item_id')
|
|
||||||
->label('Item')
|
|
||||||
// ->relationship('item', 'id')
|
|
||||||
->reactive()
|
|
||||||
->searchable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
if (empty($plantId)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
|
||||||
})
|
|
||||||
->required()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\Select::make('characteristic_approver_master_id')
|
|
||||||
->label('Characteristic Approver')
|
|
||||||
// ->relationship('characteristicApproverMaster', 'id')
|
|
||||||
->reactive()
|
|
||||||
->searchable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
|
|
||||||
$machineId = $get('machine_id');
|
|
||||||
|
|
||||||
if (! $plantId) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$approvers = CharacteristicApproverMaster::where('plant_id', $plantId)
|
|
||||||
->where('machine_id', $machineId)
|
|
||||||
->get();
|
|
||||||
|
|
||||||
$options = [];
|
|
||||||
|
|
||||||
foreach ($approvers as $approver) {
|
|
||||||
if ($approver->name1) {
|
|
||||||
$options[$approver->id.'_name1'] = $approver->name1;
|
|
||||||
}
|
|
||||||
if ($approver->name2) {
|
|
||||||
$options[$approver->id.'_name2'] = $approver->name2;
|
|
||||||
}
|
|
||||||
if ($approver->name3) {
|
|
||||||
$options[$approver->id.'_name3'] = $approver->name3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $options;
|
|
||||||
})
|
|
||||||
->dehydrateStateUsing(function ($state, callable $set) {
|
|
||||||
|
|
||||||
if (empty($state) || ! str_contains($state, '_')) {
|
|
||||||
return $state;
|
|
||||||
}
|
|
||||||
|
|
||||||
$parts = explode('_', $state);
|
|
||||||
|
|
||||||
if (count($parts) != 2) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
[$id, $level] = $parts;
|
|
||||||
|
|
||||||
$set('approver_level', $level);
|
|
||||||
|
|
||||||
return (int) $id;
|
|
||||||
})
|
|
||||||
->required()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\TextInput::make('aufnr')
|
|
||||||
->label('Aufnr')
|
|
||||||
->reactive()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\TextInput::make('characteristic_name')
|
|
||||||
->label('Characteristic Name')
|
|
||||||
->reactive()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\TextInput::make('current_value')
|
|
||||||
->label('Current Value')
|
|
||||||
->reactive()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\TextInput::make('update_value')
|
|
||||||
->label('Update Value')
|
|
||||||
->reactive()
|
|
||||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
|
||||||
Forms\Components\Select::make('approver_status1')
|
|
||||||
->label('Approver Status 1')
|
|
||||||
->reactive()
|
|
||||||
->options([
|
|
||||||
'Approved' => 'Approved',
|
|
||||||
'Hold' => 'Hold',
|
|
||||||
'Rejected' => 'Rejected',
|
|
||||||
])
|
|
||||||
->disabled(function ($get) {
|
|
||||||
$currentUser = Filament::auth()->user();
|
|
||||||
$approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
if (! $approverId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($approverId, '_')) {
|
|
||||||
[$approverId, $level] = explode('_', $approverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
if (! $approver) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Super Admin can edit any
|
|
||||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
|
||||||
return false; // field enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, enable only if the user's name matches
|
|
||||||
return $approver->name1 != $currentUser?->name;
|
|
||||||
}),
|
|
||||||
Forms\Components\TextInput::make('approver_remark1')
|
|
||||||
->label('Approver Remark 1')
|
|
||||||
->reactive(),
|
|
||||||
Forms\Components\DateTimePicker::make('approved1_at')
|
|
||||||
->label('Approved At 1')
|
|
||||||
->reactive()
|
|
||||||
->disabled(function ($get) {
|
|
||||||
$currentUser = Filament::auth()->user(); // logged-in user
|
|
||||||
$approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
if (! $approverId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($approverId, '_')) {
|
|
||||||
[$approverId, $level] = explode('_', $approverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
if (! $approver) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $approver->name1 != $currentUser?->name;
|
|
||||||
}),
|
|
||||||
Forms\Components\Select::make('approver_status2')
|
|
||||||
->label('Approver Status 2')
|
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
if ($state && empty($get('approved2_at'))) {
|
|
||||||
$set('approved2_at', now());
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->options([
|
|
||||||
'Approved' => 'Approved',
|
|
||||||
'Hold' => 'Hold',
|
|
||||||
'Rejected' => 'Rejected',
|
|
||||||
])
|
|
||||||
->disabled(function ($get) {
|
|
||||||
$currentUser = Filament::auth()->user(); // get the User object
|
|
||||||
$approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
if (! $approverId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($approverId, '_')) {
|
|
||||||
[$approverId, $level] = explode('_', $approverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
if (! $approver) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Super Admin can always edit
|
|
||||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
|
||||||
return false; // ENABLE field
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, enable only if the user's name matches
|
|
||||||
return $approver->name2 != $currentUser?->name;
|
|
||||||
}),
|
|
||||||
Forms\Components\TextInput::make('approver_remark2')
|
|
||||||
->label('Approver Remark 2')
|
|
||||||
->reactive(),
|
|
||||||
Forms\Components\DateTimePicker::make('approved2_at')
|
|
||||||
->label('Approverd At 2')
|
|
||||||
->reactive()
|
|
||||||
->disabled(function ($get) {
|
|
||||||
$currentUser = Filament::auth()->user(); // logged-in user
|
|
||||||
$approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
if (! $approverId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($approverId, '_')) {
|
|
||||||
[$approverId, $level] = explode('_', $approverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
if (! $approver) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $approver->name2 != $currentUser?->name;
|
|
||||||
})
|
|
||||||
->dehydrated(true),
|
|
||||||
Forms\Components\Select::make('approver_status3')
|
|
||||||
->label('Approver Status 3')
|
|
||||||
->reactive()
|
|
||||||
->options([
|
|
||||||
'Approved' => 'Approved',
|
|
||||||
'Hold' => 'Hold',
|
|
||||||
'Rejected' => 'Rejected',
|
|
||||||
])
|
|
||||||
->disabled(function ($get) {
|
|
||||||
$currentUser = Filament::auth()->user();
|
|
||||||
$approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
if (! $approverId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($approverId, '_')) {
|
|
||||||
[$approverId, $level] = explode('_', $approverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
if (! $approver) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($currentUser->hasRole('Super Admin')) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return $approver->name3 != $currentUser?->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}),
|
|
||||||
Forms\Components\TextInput::make('approver_remark3')
|
|
||||||
->label('Approver Remark 3')
|
|
||||||
->reactive(),
|
|
||||||
Forms\Components\DateTimePicker::make('approved3_at')
|
|
||||||
->label('Approverd At 3')
|
|
||||||
->reactive()
|
|
||||||
->disabled(function ($get) {
|
|
||||||
$currentUser = Filament::auth()->user(); // logged-in user
|
|
||||||
$approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
if (! $approverId) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($approverId, '_')) {
|
|
||||||
[$approverId, $level] = explode('_', $approverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
if (! $approver) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $approver->name3 != $currentUser?->name;
|
|
||||||
}),
|
|
||||||
Forms\Components\Hidden::make('created_by')
|
|
||||||
->label('Created By')
|
|
||||||
->default(Filament::auth()->user()?->name),
|
|
||||||
Forms\Components\Hidden::make('updated_by')
|
|
||||||
->label('Updated By')
|
|
||||||
->default(Filament::auth()->user()?->name),
|
|
||||||
Forms\Components\TextInput::make('id')
|
|
||||||
->hidden()
|
|
||||||
->readOnly(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static function isFieldDisabled($get): bool
|
|
||||||
{
|
|
||||||
$currentUser = Filament::auth()->user();
|
|
||||||
$approverId = $get('characteristic_approver_master_id');
|
|
||||||
|
|
||||||
if (! $approverId) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (str_contains($approverId, '_')) {
|
|
||||||
[$approverId, $level] = explode('_', $approverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
$approver = CharacteristicApproverMaster::find($approverId);
|
|
||||||
if (! $approver) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($currentUser && $currentUser->hasRole('Super Admin')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$userName = $currentUser?->name;
|
|
||||||
|
|
||||||
return in_array($userName, [
|
|
||||||
$approver->name1,
|
|
||||||
$approver->name2,
|
|
||||||
$approver->name3,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function table(Table $table): Table
|
|
||||||
{
|
|
||||||
return $table
|
|
||||||
->columns([
|
|
||||||
Tables\Columns\TextColumn::make('No.')
|
|
||||||
->label('No.')
|
|
||||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
|
||||||
$paginator = $livewire->getTableRecords();
|
|
||||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
|
||||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
|
||||||
|
|
||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
|
||||||
}),
|
|
||||||
Tables\Columns\TextColumn::make('work_flow_id')
|
|
||||||
->label('Work Flow ID')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable(), // isIndividual: true
|
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
|
||||||
->label('Plant')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('machine.work_center')
|
|
||||||
->label('Work Center')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('item.code')
|
|
||||||
->label('Item Code')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('aufnr')
|
|
||||||
->label('Aufnr')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('characteristic_name')
|
|
||||||
->label('Characteristic Name')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('current_value')
|
|
||||||
->label('Current Value')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('update_value')
|
|
||||||
->label('Update Value')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('characteristicApproverMaster.name1')
|
|
||||||
->label('Approver Name 1')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('approver_status1')
|
|
||||||
->label('Approver Status 1')
|
|
||||||
// ->color('success')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('approved1_at')
|
|
||||||
->label('Approver At 1')
|
|
||||||
->alignCenter()
|
|
||||||
->dateTime()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('characteristicApproverMaster.name2')
|
|
||||||
->label('Approver Name 2')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('approver_status2')
|
|
||||||
->label('Approver Status 2')
|
|
||||||
// ->color('danger')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('approved2_at')
|
|
||||||
->label('Approver At 2')
|
|
||||||
->alignCenter()
|
|
||||||
->dateTime()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('characteristicApproverMaster.name3')
|
|
||||||
->label('Approver Name 3')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('approver_status3')
|
|
||||||
->label('Approver Status 3')
|
|
||||||
// ->color('primary')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('approved3_at')
|
|
||||||
->label('Approver At 3')
|
|
||||||
->alignCenter()
|
|
||||||
->dateTime()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
|
||||||
->dateTime()
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('created_by')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
|
||||||
->dateTime()
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
|
||||||
->dateTime()
|
|
||||||
->alignCenter()
|
|
||||||
->searchable()
|
|
||||||
->sortable()
|
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
|
||||||
])
|
|
||||||
->searchPlaceholder('Search Work Flow ID')
|
|
||||||
->filters([
|
|
||||||
Tables\Filters\TrashedFilter::make(),
|
|
||||||
])
|
|
||||||
->actions([
|
|
||||||
Tables\Actions\ViewAction::make(),
|
|
||||||
Tables\Actions\EditAction::make(),
|
|
||||||
])
|
|
||||||
->bulkActions([
|
|
||||||
Tables\Actions\BulkActionGroup::make([
|
|
||||||
Tables\Actions\DeleteBulkAction::make(),
|
|
||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
|
||||||
]),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getRelations(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getPages(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'index' => Pages\ListRequestCharacteristics::route('/'),
|
|
||||||
'create' => Pages\CreateRequestCharacteristic::route('/create'),
|
|
||||||
'view' => Pages\ViewRequestCharacteristic::route('/{record}'),
|
|
||||||
'edit' => Pages\EditRequestCharacteristic::route('/{record}/edit'),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
|
||||||
{
|
|
||||||
return parent::getEloquentQuery()
|
|
||||||
->withoutGlobalScopes([
|
|
||||||
SoftDeletingScope::class,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\RequestCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\RequestCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
|
||||||
|
|
||||||
class CreateRequestCharacteristic extends CreateRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = RequestCharacteristicResource::class;
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\RequestCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\RequestCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\EditRecord;
|
|
||||||
|
|
||||||
class EditRequestCharacteristic extends EditRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = RequestCharacteristicResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\ViewAction::make(),
|
|
||||||
Actions\DeleteAction::make(),
|
|
||||||
Actions\ForceDeleteAction::make(),
|
|
||||||
Actions\RestoreAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\RequestCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\RequestCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ListRecords;
|
|
||||||
|
|
||||||
class ListRequestCharacteristics extends ListRecords
|
|
||||||
{
|
|
||||||
protected static string $resource = RequestCharacteristicResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\CreateAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Resources\RequestCharacteristicResource\Pages;
|
|
||||||
|
|
||||||
use App\Filament\Resources\RequestCharacteristicResource;
|
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\ViewRecord;
|
|
||||||
|
|
||||||
class ViewRequestCharacteristic extends ViewRecord
|
|
||||||
{
|
|
||||||
protected static string $resource = RequestCharacteristicResource::class;
|
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
Actions\EditAction::make(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,6 @@ 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 Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Validation\Rule;
|
|
||||||
|
|
||||||
// use Illuminate\Validation\Rule;
|
// use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
@@ -94,33 +93,21 @@ class StickerMasterResource extends Resource
|
|||||||
Forms\Components\Select::make('item_id')
|
Forms\Components\Select::make('item_id')
|
||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
|
||||||
if (! $get('plant_id')) {
|
if (! $get('plant_id')) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $get('id')) {
|
return \App\Models\Item::where('plant_id', $get('plant_id'))
|
||||||
// whereHas
|
->pluck('code', 'id')
|
||||||
return Item::where('plant_id', $plantId)->whereDoesntHave('stickerMasters')->pluck('code', 'id');
|
->toArray();
|
||||||
} else {
|
|
||||||
$itemId = StickerMaster::where('id', $get('id'))->first()?->item_id;
|
|
||||||
|
|
||||||
return Item::where('plant_id', $plantId)
|
|
||||||
->where(function ($query) use ($itemId) {
|
|
||||||
$query->whereDoesntHave('stickerMasters')
|
|
||||||
->orWhere('id', $itemId);
|
|
||||||
})
|
|
||||||
->pluck('code', 'id');
|
|
||||||
}
|
|
||||||
// return Item::where('plant_id', $plantId)->pluck('code', 'id')->toArray();
|
|
||||||
})
|
|
||||||
->rule(function (callable $get) {
|
|
||||||
return Rule::unique('sticker_masters', 'item_id')
|
|
||||||
->where('plant_id', $get('plant_id'))
|
|
||||||
->ignore($get('id')); // Ignore current record during updates
|
|
||||||
})
|
})
|
||||||
|
// ->rule(function (callable $get) {
|
||||||
|
// return Rule::unique('items', 'code')
|
||||||
|
// ->where('plant_id', $get('plant_id'))
|
||||||
|
// ->ignore($get('id')); // Ignore current record during updates
|
||||||
|
// })
|
||||||
->required()
|
->required()
|
||||||
// ->nullable()
|
->nullable()
|
||||||
->searchable()
|
->searchable()
|
||||||
->reactive()
|
->reactive()
|
||||||
// ->disabled(fn (Get $get) => !empty($get('id')))
|
// ->disabled(fn (Get $get) => !empty($get('id')))
|
||||||
@@ -145,7 +132,7 @@ class StickerMasterResource extends Resource
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$availableItems = Item::where('plant_id', $plantId)->exists();
|
$availableItems = \App\Models\Item::where('plant_id', $plantId)->exists();
|
||||||
if (! $availableItems) {
|
if (! $availableItems) {
|
||||||
$set('item_error', null);
|
$set('item_error', null);
|
||||||
|
|
||||||
@@ -160,7 +147,7 @@ class StickerMasterResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if item exists for the selected plant
|
// Check if item exists for the selected plant
|
||||||
$item = Item::where('plant_id', $plantId)
|
$item = \App\Models\Item::where('plant_id', $plantId)
|
||||||
->where('id', $itemId)
|
->where('id', $itemId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
@@ -174,8 +161,7 @@ class StickerMasterResource extends Resource
|
|||||||
->where('item_id', $itemId)
|
->where('item_id', $itemId)
|
||||||
->exists();
|
->exists();
|
||||||
if (! $get('id')) {
|
if (! $get('id')) {
|
||||||
// $set('item_error', $duplicateSticker ? 'Item Code already exists for the selected plant.' : null);
|
$set('item_error', $duplicateSticker ? 'Item Code already exists for the selected plant.' : null);
|
||||||
$set('item_error', null);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->extraAttributes(fn ($get) => [
|
->extraAttributes(fn ($get) => [
|
||||||
@@ -191,7 +177,7 @@ class StickerMasterResource extends Resource
|
|||||||
if ($get('id')) {
|
if ($get('id')) {
|
||||||
$itemId = StickerMaster::where('id', $get('id'))->first()?->item_id;
|
$itemId = StickerMaster::where('id', $get('id'))->first()?->item_id;
|
||||||
if ($itemId) {
|
if ($itemId) {
|
||||||
$item = Item::where('id', $itemId)->first()?->description;
|
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
|
||||||
if ($item) {
|
if ($item) {
|
||||||
$set('item_description', $item);
|
$set('item_description', $item);
|
||||||
} else {
|
} else {
|
||||||
@@ -539,35 +525,27 @@ class StickerMasterResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('part_validation1')
|
Tables\Columns\TextColumn::make('part_validation1')
|
||||||
->label('Part Validation 1')
|
->label('Part Validation 1')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('part_validation2')
|
Tables\Columns\TextColumn::make('part_validation2')
|
||||||
->label('Part Validation 2')
|
->label('Part Validation 2')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('part_validation3')
|
Tables\Columns\TextColumn::make('part_validation3')
|
||||||
->label('Part Validation 3')
|
->label('Part Validation 3')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('part_validation4')
|
Tables\Columns\TextColumn::make('part_validation4')
|
||||||
->label('Part Validation 4')
|
->label('Part Validation 4')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('part_validation5')
|
Tables\Columns\TextColumn::make('part_validation5')
|
||||||
->label('Part Validation 5')
|
->label('Part Validation 5')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('laser_part_validation1')
|
Tables\Columns\TextColumn::make('laser_part_validation1')
|
||||||
->label('Laser Part Validation 1')
|
->label('Laser Part Validation 1')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('laser_part_validation2')
|
Tables\Columns\TextColumn::make('laser_part_validation2')
|
||||||
->label('Laser Part Validation 2')
|
->label('Laser Part Validation 2')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('panel_box_code')
|
Tables\Columns\TextColumn::make('panel_box_code')
|
||||||
->label('Panel Box Code')
|
->label('Panel Box Code')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('load_rate')
|
Tables\Columns\TextColumn::make('load_rate')
|
||||||
->label('Load Rate')
|
->label('Load Rate')
|
||||||
@@ -575,22 +553,20 @@ class StickerMasterResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('bundle_quantity')
|
Tables\Columns\TextColumn::make('bundle_quantity')
|
||||||
->label('Bundle Quantity')
|
->label('Bundle Quantity')
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('material_type')
|
Tables\Columns\TextColumn::make('material_type')
|
||||||
->label('Material Type')
|
->label('Material Type')
|
||||||
->default('-')
|
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->formatStateUsing(function ($state) {
|
->formatStateUsing(function ($state) {
|
||||||
if (is_null($state) || $state == '') {
|
if (is_null($state) || $state === '') {
|
||||||
return '-';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return match ($state) {
|
return match ($state) {
|
||||||
1 => 'Individual',
|
1 => 'Individual',
|
||||||
2 => 'Bundle',
|
2 => 'Bundle',
|
||||||
3 => 'Quantity',
|
3 => 'Quantity',
|
||||||
default => '-',
|
default => '',
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
@@ -611,7 +587,9 @@ class StickerMasterResource extends Resource
|
|||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
->searchPlaceholder('Search Item Code')
|
// ->filters([
|
||||||
|
// Tables\Filters\TrashedFilter::make(),
|
||||||
|
// ])
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
Filter::make('advanced_filters')
|
||||||
@@ -657,7 +635,7 @@ class StickerMasterResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->reactive(),
|
->reactive(),
|
||||||
Select::make('material_type')
|
Select::make('material_type')
|
||||||
->label('Select Material Type')
|
->label('Material Type')
|
||||||
->options([
|
->options([
|
||||||
1 => 'Individual',
|
1 => 'Individual',
|
||||||
2 => 'Bundle',
|
2 => 'Bundle',
|
||||||
@@ -666,7 +644,7 @@ class StickerMasterResource extends Resource
|
|||||||
->reactive(),
|
->reactive(),
|
||||||
|
|
||||||
TextInput::make('panel_box_code')
|
TextInput::make('panel_box_code')
|
||||||
->label('Search by Panel Box Code')
|
->label('Panel Box Code')
|
||||||
->placeholder(placeholder: 'Enter Panel Box Code'),
|
->placeholder(placeholder: 'Enter Panel Box Code'),
|
||||||
DateTimePicker::make(name: 'created_from')
|
DateTimePicker::make(name: 'created_from')
|
||||||
->label('Created From')
|
->label('Created From')
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class InvoiceChart extends ChartWidget
|
|||||||
$completedInvoicesCount = InvoiceValidation::select('invoice_number')
|
$completedInvoicesCount = InvoiceValidation::select('invoice_number')
|
||||||
->where('plant_id', $selectedPlant)
|
->where('plant_id', $selectedPlant)
|
||||||
->whereNull('quantity')
|
->whereNull('quantity')
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
"COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)"
|
"COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)"
|
||||||
@@ -99,7 +99,7 @@ class InvoiceChart extends ChartWidget
|
|||||||
$completedInvoicesCount = InvoiceValidation::select('invoice_number')
|
$completedInvoicesCount = InvoiceValidation::select('invoice_number')
|
||||||
->where('plant_id', $selectedPlant)
|
->where('plant_id', $selectedPlant)
|
||||||
->where('quantity', '>', 1)
|
->where('quantity', '>', 1)
|
||||||
->whereBetween('created_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
||||||
@@ -142,7 +142,7 @@ class InvoiceChart extends ChartWidget
|
|||||||
$query->where('quantity', 1)->whereBetween('created_at', [$dayStart, $dayEnd]);
|
$query->where('quantity', 1)->whereBetween('created_at', [$dayStart, $dayEnd]);
|
||||||
|
|
||||||
$completedQuery->where('quantity', 1)
|
$completedQuery->where('quantity', 1)
|
||||||
->whereBetween('created_at', [$dayStart, $dayEnd])
|
->whereBetween('updated_at', [$dayStart, $dayEnd])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
||||||
@@ -153,7 +153,7 @@ class InvoiceChart extends ChartWidget
|
|||||||
$query->whereNull('quantity')->whereBetween('created_at', [$dayStart, $dayEnd]);
|
$query->whereNull('quantity')->whereBetween('created_at', [$dayStart, $dayEnd]);
|
||||||
|
|
||||||
$completedQuery->whereNull('quantity')
|
$completedQuery->whereNull('quantity')
|
||||||
->whereBetween('created_at', [$dayStart, $dayEnd])
|
->whereBetween('updated_at', [$dayStart, $dayEnd])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
"COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)"
|
"COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)"
|
||||||
@@ -164,7 +164,7 @@ class InvoiceChart extends ChartWidget
|
|||||||
$query->where('quantity', '>', 1)->whereBetween('created_at', [$dayStart, $dayEnd]);
|
$query->where('quantity', '>', 1)->whereBetween('created_at', [$dayStart, $dayEnd]);
|
||||||
|
|
||||||
$completedQuery->where('quantity', '>', 1)
|
$completedQuery->where('quantity', '>', 1)
|
||||||
->whereBetween('created_at', [$dayStart, $dayEnd])
|
->whereBetween('updated_at', [$dayStart, $dayEnd])
|
||||||
->groupBy('invoice_number')
|
->groupBy('invoice_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
"COUNT(*) = SUM(CASE WHEN serial_number IS NOT NULL AND serial_number != '' THEN 1 ELSE 0 END)"
|
||||||
@@ -193,31 +193,22 @@ class InvoiceChart extends ChartWidget
|
|||||||
}
|
}
|
||||||
elseif ($activeFilter == 'this_month') {
|
elseif ($activeFilter == 'this_month') {
|
||||||
$startOfMonth = now()->startOfMonth()->setTime(8, 0, 0);
|
$startOfMonth = now()->startOfMonth()->setTime(8, 0, 0);
|
||||||
$endOfMonth = now()->endOfMonth()->addDay()->setTime(23, 59, 59); // include full last day
|
$endOfMonth = now()->endOfMonth()->addDay()->setTime(8, 0, 0); // include full last day
|
||||||
$monthName = $startOfMonth->format('M');
|
$monthName = $startOfMonth->format('M');
|
||||||
|
|
||||||
|
// Prepare weekly labels like "May(1-7)", "May(8-14)", etc.
|
||||||
$labels = [];
|
$labels = [];
|
||||||
$weekStart = $startOfMonth->copy();
|
$weekStart = $startOfMonth->copy();
|
||||||
$importedInvoicesPerWeek = [];
|
$importedInvoicesPerWeek = [];
|
||||||
$completedInvoicesPerWeek = [];
|
$completedInvoicesPerWeek = [];
|
||||||
|
|
||||||
$weekIndex = 0;
|
$weekIndex = 0;
|
||||||
while ($weekStart <= $endOfMonth) {
|
while ($weekStart < $endOfMonth) {
|
||||||
// $weekEnd = $weekStart->copy()->addDays(6);
|
$weekEnd = $weekStart->copy()->addDays(7);
|
||||||
$weekEnd = $weekStart->copy()->addDays(6)->endOfDay();
|
|
||||||
|
|
||||||
// If week end exceeds end of month, limit it
|
|
||||||
if ($weekEnd->greaterThan($endOfMonth)) {
|
|
||||||
$weekEnd = $endOfMonth->copy()->endOfDay();
|
|
||||||
}
|
|
||||||
|
|
||||||
$startDay = $weekStart->format('j');
|
$startDay = $weekStart->format('j');
|
||||||
$endDay = $weekEnd->format('j');
|
$weekEndLimit = $weekEnd->copy()->subDay();
|
||||||
|
$actualEnd = $weekEndLimit->greaterThan($endOfMonth) ? $endOfMonth : $weekEndLimit;
|
||||||
// $startDay = $weekStart->format('j');
|
$endDay = $actualEnd->format('j');
|
||||||
// $weekEndLimit = $weekEnd->copy()->subDay();
|
|
||||||
// $actualEnd = $weekEndLimit->greaterThan($endOfMonth) ? $endOfMonth : $weekEndLimit;
|
|
||||||
// $endDay = $actualEnd->format('j');
|
|
||||||
|
|
||||||
$labels[] = "{$monthName}({$startDay}-{$endDay})";
|
$labels[] = "{$monthName}({$startDay}-{$endDay})";
|
||||||
|
|
||||||
@@ -242,7 +233,7 @@ class InvoiceChart extends ChartWidget
|
|||||||
// --- Completed ---
|
// --- Completed ---
|
||||||
$queryCompleted = InvoiceValidation::select('invoice_number')
|
$queryCompleted = InvoiceValidation::select('invoice_number')
|
||||||
->where('plant_id', $selectedPlant)
|
->where('plant_id', $selectedPlant)
|
||||||
->whereBetween('created_at', [$weekStart, $weekEnd]);
|
->whereBetween('updated_at', [$weekStart, $weekEnd]);
|
||||||
|
|
||||||
if ($selectedInvoice == 'individual_material') {
|
if ($selectedInvoice == 'individual_material') {
|
||||||
$queryCompleted->where('quantity', 1)
|
$queryCompleted->where('quantity', 1)
|
||||||
@@ -261,8 +252,7 @@ class InvoiceChart extends ChartWidget
|
|||||||
$completedInvoicesPerWeek[$weekIndex] = $queryCompleted->count();
|
$completedInvoicesPerWeek[$weekIndex] = $queryCompleted->count();
|
||||||
|
|
||||||
// Move to next week
|
// Move to next week
|
||||||
// $weekStart = $weekEnd;
|
$weekStart = $weekEnd;
|
||||||
$weekStart = $weekEnd->copy()->addDay(1);
|
|
||||||
$weekIndex++;
|
$weekIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,7 +298,6 @@ class InvoiceChart extends ChartWidget
|
|||||||
{
|
{
|
||||||
return 'bar';
|
return 'bar';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDefaultName(): string
|
public static function getDefaultName(): string
|
||||||
{
|
{
|
||||||
return 'invoice-chart';
|
return 'invoice-chart';
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -70,10 +70,6 @@ class ProductionStickerReprintController extends Controller
|
|||||||
{
|
{
|
||||||
$copies = 2;
|
$copies = 2;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$copies = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,126 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Imports;
|
|
||||||
|
|
||||||
use App\Models\InvoiceDataValidation;
|
|
||||||
use App\Models\Plant;
|
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Maatwebsite\Excel\Concerns\ToCollection;
|
|
||||||
|
|
||||||
class InvoicePendingReasonImport implements ToCollection
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param Collection $collection
|
|
||||||
*/
|
|
||||||
|
|
||||||
public array $errors = [];
|
|
||||||
|
|
||||||
public array $missingPlantCodes = [];
|
|
||||||
public array $missingDocNo = [];
|
|
||||||
public array $plantCodeEmpty = [];
|
|
||||||
public array $docNoEmpty = [];
|
|
||||||
public array $remarkEmpty = [];
|
|
||||||
|
|
||||||
public array $duplicateExcelDocs = [];
|
|
||||||
|
|
||||||
private array $seenExcelKeys = [];
|
|
||||||
|
|
||||||
public array $validRows = [];
|
|
||||||
|
|
||||||
public function collection(Collection $collection)
|
|
||||||
{
|
|
||||||
$rows = $collection;
|
|
||||||
// foreach ($rows->skip(1) as $row) {
|
|
||||||
|
|
||||||
// $plantCode = trim($row[0] ?? '');
|
|
||||||
// $documentNumber = trim($row[1] ?? '');
|
|
||||||
// $remark = trim($row[2] ?? '');
|
|
||||||
|
|
||||||
// if (! $plantCode || ! $documentNumber || ! $remark) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $plantId = Plant::where('code', $plantCode)->value('id');
|
|
||||||
|
|
||||||
// InvoiceDataValidation::where('plant_id', $plantId)
|
|
||||||
// ->where('document_number', $documentNumber)
|
|
||||||
// ->update([
|
|
||||||
// 'remark' => $remark,
|
|
||||||
// 'updated_at' => now(),
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
|
|
||||||
foreach ($rows->skip(1) as $index => $row) {
|
|
||||||
|
|
||||||
$rowNo = $index + 2;
|
|
||||||
|
|
||||||
$plantCode = trim($row[0] ?? '');
|
|
||||||
$documentNumber = trim($row[1] ?? '');
|
|
||||||
$remark = trim($row[2] ?? '');
|
|
||||||
|
|
||||||
if (! $plantCode) {
|
|
||||||
$this->plantCodeEmpty[] = [
|
|
||||||
'row' => $rowNo,
|
|
||||||
'reason' => "Plant Code can't be empty!",
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (! $documentNumber) {
|
|
||||||
$this->docNoEmpty[] = [
|
|
||||||
'row' => $rowNo,
|
|
||||||
'reason' => "Document number can't be empty!",
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Excel-level duplicate check
|
|
||||||
$key = $plantCode . '|' . $documentNumber;
|
|
||||||
|
|
||||||
if (isset($this->seenExcelKeys[$key])) {
|
|
||||||
$this->duplicateExcelDocs[$key][] = $rowNo;
|
|
||||||
|
|
||||||
$this->errors[] = [
|
|
||||||
'row' => $rowNo,
|
|
||||||
'reason' => "Duplicate Document Number in Excel ({$plantCode} - {$documentNumber})",
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->seenExcelKeys[$key] = true;
|
|
||||||
|
|
||||||
$plantId = Plant::where('code', $plantCode)->value('id');
|
|
||||||
|
|
||||||
if (! $plantId) {
|
|
||||||
$this->missingPlantCodes[$plantCode] = true;
|
|
||||||
|
|
||||||
$this->errors[] = [
|
|
||||||
'row' => $rowNo,
|
|
||||||
'reason' => "Plant code not found: {$plantCode}",
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$invoiceExists = InvoiceDataValidation::where('plant_id', $plantId)
|
|
||||||
->where('document_number', $documentNumber)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if (! $invoiceExists) {
|
|
||||||
$this->missingDocNo[$documentNumber] = true;
|
|
||||||
|
|
||||||
$this->errors[] = [
|
|
||||||
'row' => $rowNo,
|
|
||||||
'reason' => "Document number not found: {$documentNumber}",
|
|
||||||
];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$this->validRows[] = [
|
|
||||||
'plant_id' => $plantId,
|
|
||||||
'document_number' => $documentNumber,
|
|
||||||
'remark' => $remark,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Livewire;
|
|
||||||
|
|
||||||
use App\Models\InvoiceDataValidation;
|
|
||||||
use App\Models\InvoiceOutValidation;
|
|
||||||
use App\Models\PalletValidation;
|
|
||||||
use Livewire\Component;
|
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
|
||||||
use App\Exports\InvoicePendingReasonExport;
|
|
||||||
use App\Models\Plant;
|
|
||||||
|
|
||||||
class InvoicePending extends Component
|
|
||||||
{
|
|
||||||
|
|
||||||
public $plantId;
|
|
||||||
|
|
||||||
public $invoicePending = [];
|
|
||||||
|
|
||||||
protected $listeners = [
|
|
||||||
'loadData' => 'loadInvoiceData',
|
|
||||||
'emptyData' => 'loadInvoiceEmptyData',
|
|
||||||
'loadData1' => 'exportPendingReason',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function loadInvoiceEmptyData()
|
|
||||||
{
|
|
||||||
$this->invoicePending = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loadInvoiceData($plantId)
|
|
||||||
{
|
|
||||||
$this->plantId = $plantId;
|
|
||||||
|
|
||||||
$distributions = InvoiceDataValidation::whereNotNull('distribution_channel_desc')
|
|
||||||
->distinct()
|
|
||||||
->pluck('distribution_channel_desc')
|
|
||||||
->filter(fn ($v) => trim($v) != '')
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$distributions[] = '';
|
|
||||||
|
|
||||||
$pendingInvoices = collect();
|
|
||||||
|
|
||||||
foreach ($distributions as $distribution) {
|
|
||||||
|
|
||||||
$invoices = InvoiceDataValidation::where('plant_id', $plantId)
|
|
||||||
->where('distribution_channel_desc', $distribution)
|
|
||||||
->select(
|
|
||||||
'id',
|
|
||||||
'document_number',
|
|
||||||
'customer_trade_name',
|
|
||||||
'location',
|
|
||||||
'remark',
|
|
||||||
'created_at',
|
|
||||||
'created_by',
|
|
||||||
'updated_at',
|
|
||||||
'updated_by'
|
|
||||||
)
|
|
||||||
->get()
|
|
||||||
->unique('document_number')
|
|
||||||
->filter(fn ($inv) =>
|
|
||||||
!empty($inv->document_number) &&
|
|
||||||
!str_contains($inv->document_number, '-')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (trim($distribution) == '') {
|
|
||||||
$invoices = $invoices->filter(fn ($inv) =>
|
|
||||||
str_starts_with($inv->document_number, '7')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($invoices->isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$invoiceNumbers = $invoices->pluck('document_number')
|
|
||||||
->map(fn ($n) => preg_replace('/\s+/', '', strtoupper($n)))
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$wentOut = InvoiceOutValidation::whereIn('qr_code', $invoiceNumbers)
|
|
||||||
->distinct()
|
|
||||||
->pluck('qr_code')
|
|
||||||
->map(fn ($n) => preg_replace('/\s+/', '', strtoupper($n)))
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$pending = $invoices->filter(function ($inv) use ($wentOut) {
|
|
||||||
$doc = preg_replace('/\s+/', '', strtoupper($inv->document_number));
|
|
||||||
return !in_array($doc, $wentOut, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
$pendingInvoices = $pendingInvoices->merge($pending);
|
|
||||||
}
|
|
||||||
|
|
||||||
$plantCode = Plant::find($this->plantId)->code ?? '';
|
|
||||||
|
|
||||||
$this->invoicePending = $pendingInvoices
|
|
||||||
->unique('document_number')
|
|
||||||
->map(function ($record) use ($plantCode) {
|
|
||||||
return [
|
|
||||||
'plant_id' => $plantCode ?? '',
|
|
||||||
'document_number' => $record->document_number ?? '',
|
|
||||||
'customer_trade_name' => $record->customer_trade_name ?? '',
|
|
||||||
'location' => $record->location ?? '',
|
|
||||||
'remark' => $record->remark ?? '',
|
|
||||||
];
|
|
||||||
})
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function exportPendingReason()
|
|
||||||
{
|
|
||||||
return Excel::download(
|
|
||||||
new InvoicePendingReasonExport($this->invoicePending),
|
|
||||||
'invoice_pending_reason.xlsx'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function render()
|
|
||||||
{
|
|
||||||
return view('livewire.invoice-pending');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
class CharacteristicApproverMaster extends Model
|
|
||||||
{
|
|
||||||
use SoftDeletes;
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'plant_id',
|
|
||||||
'machine_id',
|
|
||||||
'machine_name',
|
|
||||||
'name1',
|
|
||||||
'mail1',
|
|
||||||
'name2',
|
|
||||||
'mail2',
|
|
||||||
'name3',
|
|
||||||
'mail3',
|
|
||||||
'duration1',
|
|
||||||
'duration2',
|
|
||||||
'duration3',
|
|
||||||
'characteristic_field',
|
|
||||||
|
|
||||||
'created_at',
|
|
||||||
'updated_at',
|
|
||||||
'created_by',
|
|
||||||
'updated_by',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function plant(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Plant::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function machine(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Machine::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,182 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
class ClassCharacteristic extends Model
|
|
||||||
{
|
|
||||||
use SoftDeletes;
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'plant_id',
|
|
||||||
'item_id',
|
|
||||||
'machine_id',
|
|
||||||
'aufnr',
|
|
||||||
'class',
|
|
||||||
'arbid',
|
|
||||||
'gamng',
|
|
||||||
'lmnga',
|
|
||||||
'gernr',
|
|
||||||
'zz1_cn_bill_ord',
|
|
||||||
'zmm_amps',
|
|
||||||
'zmm_brand',
|
|
||||||
'zmm_degreeofprotection',
|
|
||||||
'zmm_delivery',
|
|
||||||
'zmm_dir_rot',
|
|
||||||
'zmm_discharge',
|
|
||||||
'zmm_discharge_max',
|
|
||||||
'zmm_discharge_min',
|
|
||||||
'zmm_duty',
|
|
||||||
'zmm_eff_motor',
|
|
||||||
'zmm_eff_pump',
|
|
||||||
'zmm_frequency',
|
|
||||||
'zmm_head',
|
|
||||||
'zmm_heading',
|
|
||||||
'zmm_head_max',
|
|
||||||
'zmm_head_minimum',
|
|
||||||
'zmm_idx_eff_mtr',
|
|
||||||
'zmm_idx_eff_pump',
|
|
||||||
'zmm_kvacode',
|
|
||||||
'zmm_maxambtemp',
|
|
||||||
'zmm_mincoolingflow',
|
|
||||||
'zmm_motorseries',
|
|
||||||
'zmm_motor_model',
|
|
||||||
'zmm_outlet',
|
|
||||||
'zmm_phase',
|
|
||||||
'zmm_pressure',
|
|
||||||
'zmm_pumpflowtype',
|
|
||||||
'zmm_pumpseries',
|
|
||||||
'zmm_pump_model',
|
|
||||||
'zmm_ratedpower',
|
|
||||||
'zmm_region',
|
|
||||||
'zmm_servicefactor',
|
|
||||||
'zmm_servicefactormaximumamps',
|
|
||||||
'zmm_speed',
|
|
||||||
'zmm_suction',
|
|
||||||
'zmm_suctionxdelivery',
|
|
||||||
'zmm_supplysource',
|
|
||||||
'zmm_temperature',
|
|
||||||
'zmm_thrustload',
|
|
||||||
'zmm_volts',
|
|
||||||
'zmm_wire',
|
|
||||||
'zmm_package',
|
|
||||||
'zmm_pvarrayrating',
|
|
||||||
'zmm_isi',
|
|
||||||
'zmm_isimotor',
|
|
||||||
'zmm_isipump',
|
|
||||||
'zmm_isipumpset',
|
|
||||||
'zmm_pumpset_model',
|
|
||||||
'zmm_stages',
|
|
||||||
'zmm_headrange',
|
|
||||||
'zmm_overall_efficiency',
|
|
||||||
'zmm_connection',
|
|
||||||
'zmm_min_bore_size',
|
|
||||||
'zmm_isireference',
|
|
||||||
'zmm_category',
|
|
||||||
'zmm_submergence',
|
|
||||||
'zmm_capacitorstart',
|
|
||||||
'zmm_capacitorrun',
|
|
||||||
'zmm_inch',
|
|
||||||
'zmm_motor_type',
|
|
||||||
'zmm_dismantle_direction',
|
|
||||||
'zmm_eff_ovrall',
|
|
||||||
'zmm_bodymoc',
|
|
||||||
'zmm_rotormoc',
|
|
||||||
'zmm_dlwl',
|
|
||||||
'zmm_inputpower',
|
|
||||||
'zmm_imp_od',
|
|
||||||
'zmm_ambtemp',
|
|
||||||
'zmm_de',
|
|
||||||
'zmm_dischargerange',
|
|
||||||
'zmm_efficiency_class',
|
|
||||||
'zmm_framesize',
|
|
||||||
'zmm_impellerdiameter',
|
|
||||||
'zmm_insulationclass',
|
|
||||||
'zmm_maxflow',
|
|
||||||
'zmm_minhead',
|
|
||||||
'zmm_mtrlofconst',
|
|
||||||
'zmm_nde',
|
|
||||||
'zmm_powerfactor',
|
|
||||||
'zmm_tagno',
|
|
||||||
'zmm_year',
|
|
||||||
'zmm_laser_name',
|
|
||||||
'zmm_beenote',
|
|
||||||
'zmm_beenumber',
|
|
||||||
'zmm_beestar',
|
|
||||||
'zmm_codeclass',
|
|
||||||
'zmm_colour',
|
|
||||||
'zmm_logo_cp',
|
|
||||||
'zmm_logo_ce',
|
|
||||||
'zmm_logo_nsf',
|
|
||||||
'zmm_grade',
|
|
||||||
'zmm_grwt_pset',
|
|
||||||
'zmm_grwt_cable',
|
|
||||||
'zmm_grwt_motor',
|
|
||||||
'zmm_grwt_pf',
|
|
||||||
'zmm_grwt_pump',
|
|
||||||
'zmm_isivalve',
|
|
||||||
'zmm_isi_wc',
|
|
||||||
'zmm_labelperiod',
|
|
||||||
'zmm_length',
|
|
||||||
'zmm_license_cml_no',
|
|
||||||
'zmm_mfgmonyr',
|
|
||||||
'zmm_modelyear',
|
|
||||||
'zmm_motoridentification',
|
|
||||||
'zmm_newt_pset',
|
|
||||||
'zmm_newt_cable',
|
|
||||||
'zmm_newt_motor',
|
|
||||||
'zmm_newt_pf',
|
|
||||||
'zmm_newt_pump',
|
|
||||||
'zmm_packtype',
|
|
||||||
'zmm_panel',
|
|
||||||
'zmm_performance_factor',
|
|
||||||
'zmm_pumpidentification',
|
|
||||||
'zmm_psettype',
|
|
||||||
'zmm_size',
|
|
||||||
'zmm_eff_ttl',
|
|
||||||
'zmm_type',
|
|
||||||
'zmm_usp',
|
|
||||||
'mark_status',
|
|
||||||
'marked_datetime',
|
|
||||||
'marked_by',
|
|
||||||
'man_marked_status',
|
|
||||||
'man_marked_datetime',
|
|
||||||
'man_marked_by',
|
|
||||||
'motor_marked_status',
|
|
||||||
'motor_marked_by',
|
|
||||||
'pump_marked_status',
|
|
||||||
'pump_marked_by',
|
|
||||||
'motor_pump_pumpset_status',
|
|
||||||
'motor_machine_name',
|
|
||||||
'pump_machine_name',
|
|
||||||
'pumpset_machine_name',
|
|
||||||
'part_validation_1',
|
|
||||||
'part_validation_2',
|
|
||||||
'samlight_logged_name',
|
|
||||||
'pending_released_status',
|
|
||||||
'motor_expected_time',
|
|
||||||
'pump_expected_time',
|
|
||||||
'created_at',
|
|
||||||
'updated_at',
|
|
||||||
'created_by',
|
|
||||||
'updated_by',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function plant(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Plant::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function item(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Item::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function machine(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Machine::class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
||||||
|
|
||||||
class RequestCharacteristic extends Model
|
|
||||||
{
|
|
||||||
use SoftDeletes;
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'plant_id',
|
|
||||||
'machine_id',
|
|
||||||
'item_id',
|
|
||||||
'characteristic_approver_master_id',
|
|
||||||
'aufnr',
|
|
||||||
'characteristic_name',
|
|
||||||
'current_value',
|
|
||||||
'update_value',
|
|
||||||
'approver_status1',
|
|
||||||
'approver_status2',
|
|
||||||
'approver_status3',
|
|
||||||
'approver_remark1',
|
|
||||||
'approver_remark2',
|
|
||||||
'approver_remark3',
|
|
||||||
'approved1_at',
|
|
||||||
'approved2_at',
|
|
||||||
'approved3_at',
|
|
||||||
'mail_status',
|
|
||||||
'trigger_at',
|
|
||||||
'work_flow_id',
|
|
||||||
|
|
||||||
'created_at',
|
|
||||||
'updated_at',
|
|
||||||
'created_by',
|
|
||||||
'updated_by',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function plant(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Plant::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function item(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Item::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function machine(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Machine::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function characteristicApproverMaster(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(CharacteristicApproverMaster::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public function approverName1()
|
|
||||||
// {
|
|
||||||
// return $this->belongsTo(
|
|
||||||
// CharacteristicApproverMaster::class,
|
|
||||||
// 'characteristic_approver_master_id'
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function approverName2()
|
|
||||||
// {
|
|
||||||
// return $this->belongsTo(
|
|
||||||
// CharacteristicApproverMaster::class,
|
|
||||||
// 'characteristic_approver_master_id'
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function approverName3()
|
|
||||||
// {
|
|
||||||
// return $this->belongsTo(
|
|
||||||
// CharacteristicApproverMaster::class,
|
|
||||||
// 'characteristic_approver_master_id'
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function approver()
|
|
||||||
{
|
|
||||||
return $this->belongsTo(
|
|
||||||
CharacteristicApproverMaster::class,
|
|
||||||
'characteristic_approver_master_id'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Policies;
|
|
||||||
|
|
||||||
use Illuminate\Auth\Access\Response;
|
|
||||||
use App\Models\CharacteristicApproverMaster;
|
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class CharacteristicApproverMasterPolicy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view any models.
|
|
||||||
*/
|
|
||||||
public function viewAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view-any CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view the model.
|
|
||||||
*/
|
|
||||||
public function view(User $user, CharacteristicApproverMaster $characteristicapprovermaster): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can create models.
|
|
||||||
*/
|
|
||||||
public function create(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('create CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can update the model.
|
|
||||||
*/
|
|
||||||
public function update(User $user, CharacteristicApproverMaster $characteristicapprovermaster): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('update CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete the model.
|
|
||||||
*/
|
|
||||||
public function delete(User $user, CharacteristicApproverMaster $characteristicapprovermaster): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete any models.
|
|
||||||
*/
|
|
||||||
public function deleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete-any CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore the model.
|
|
||||||
*/
|
|
||||||
public function restore(User $user, CharacteristicApproverMaster $characteristicapprovermaster): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore any models.
|
|
||||||
*/
|
|
||||||
public function restoreAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore-any CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can replicate the model.
|
|
||||||
*/
|
|
||||||
public function replicate(User $user, CharacteristicApproverMaster $characteristicapprovermaster): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('replicate CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can reorder the models.
|
|
||||||
*/
|
|
||||||
public function reorder(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('reorder CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete the model.
|
|
||||||
*/
|
|
||||||
public function forceDelete(User $user, CharacteristicApproverMaster $characteristicapprovermaster): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete any models.
|
|
||||||
*/
|
|
||||||
public function forceDeleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete-any CharacteristicApproverMaster');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Policies;
|
|
||||||
|
|
||||||
use Illuminate\Auth\Access\Response;
|
|
||||||
use App\Models\ClassCharacteristic;
|
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class ClassCharacteristicPolicy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view any models.
|
|
||||||
*/
|
|
||||||
public function viewAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view-any ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view the model.
|
|
||||||
*/
|
|
||||||
public function view(User $user, ClassCharacteristic $classcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can create models.
|
|
||||||
*/
|
|
||||||
public function create(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('create ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can update the model.
|
|
||||||
*/
|
|
||||||
public function update(User $user, ClassCharacteristic $classcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('update ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete the model.
|
|
||||||
*/
|
|
||||||
public function delete(User $user, ClassCharacteristic $classcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete any models.
|
|
||||||
*/
|
|
||||||
public function deleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete-any ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore the model.
|
|
||||||
*/
|
|
||||||
public function restore(User $user, ClassCharacteristic $classcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore any models.
|
|
||||||
*/
|
|
||||||
public function restoreAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore-any ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can replicate the model.
|
|
||||||
*/
|
|
||||||
public function replicate(User $user, ClassCharacteristic $classcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('replicate ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can reorder the models.
|
|
||||||
*/
|
|
||||||
public function reorder(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('reorder ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete the model.
|
|
||||||
*/
|
|
||||||
public function forceDelete(User $user, ClassCharacteristic $classcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete ClassCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete any models.
|
|
||||||
*/
|
|
||||||
public function forceDeleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete-any ClassCharacteristic');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Policies;
|
|
||||||
|
|
||||||
use Illuminate\Auth\Access\Response;
|
|
||||||
use App\Models\RequestCharacteristic;
|
|
||||||
use App\Models\User;
|
|
||||||
|
|
||||||
class RequestCharacteristicPolicy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view any models.
|
|
||||||
*/
|
|
||||||
public function viewAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view-any RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can view the model.
|
|
||||||
*/
|
|
||||||
public function view(User $user, RequestCharacteristic $requestcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('view RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can create models.
|
|
||||||
*/
|
|
||||||
public function create(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('create RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can update the model.
|
|
||||||
*/
|
|
||||||
public function update(User $user, RequestCharacteristic $requestcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('update RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete the model.
|
|
||||||
*/
|
|
||||||
public function delete(User $user, RequestCharacteristic $requestcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can delete any models.
|
|
||||||
*/
|
|
||||||
public function deleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('delete-any RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore the model.
|
|
||||||
*/
|
|
||||||
public function restore(User $user, RequestCharacteristic $requestcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can restore any models.
|
|
||||||
*/
|
|
||||||
public function restoreAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('restore-any RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can replicate the model.
|
|
||||||
*/
|
|
||||||
public function replicate(User $user, RequestCharacteristic $requestcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('replicate RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can reorder the models.
|
|
||||||
*/
|
|
||||||
public function reorder(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('reorder RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete the model.
|
|
||||||
*/
|
|
||||||
public function forceDelete(User $user, RequestCharacteristic $requestcharacteristic): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete RequestCharacteristic');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine whether the user can permanently delete any models.
|
|
||||||
*/
|
|
||||||
public function forceDeleteAny(User $user): bool
|
|
||||||
{
|
|
||||||
return $user->checkPermissionTo('force-delete-any RequestCharacteristic');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/tinker": "^2.9",
|
"laravel/tinker": "^2.9",
|
||||||
"league/flysystem-sftp-v3": "^3.30",
|
"league/flysystem-sftp-v3": "^3.30",
|
||||||
"livewire/livewire": "^3.6",
|
"livewire/livewire": "^4.0",
|
||||||
"maatwebsite/excel": "^3.1",
|
"maatwebsite/excel": "^3.1",
|
||||||
"mike42/escpos-php": "^4.0",
|
"mike42/escpos-php": "^4.0",
|
||||||
"mpdf/mpdf": "^8.2",
|
"mpdf/mpdf": "^8.2",
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"tpetry/laravel-postgresql-enhanced": "^2.3"
|
"tpetry/laravel-postgresql-enhanced": "^2.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"barryvdh/laravel-debugbar": "^4.0",
|
"barryvdh/laravel-debugbar": "^3.15",
|
||||||
"barryvdh/laravel-ide-helper": "^3.5",
|
"barryvdh/laravel-ide-helper": "^3.5",
|
||||||
"beyondcode/laravel-dump-server": "^2.1",
|
"beyondcode/laravel-dump-server": "^2.1",
|
||||||
"fakerphp/faker": "^1.23",
|
"fakerphp/faker": "^1.23",
|
||||||
|
|||||||
@@ -1,186 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
$sql = <<<'SQL'
|
|
||||||
CREATE TABLE class_characteristics (
|
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
|
||||||
plant_id BIGINT NOT NULL,
|
|
||||||
machine_id BIGINT NOT NULL,
|
|
||||||
item_id BIGINT NOT NULL,
|
|
||||||
aufnr TEXT DEFAULT NULL,
|
|
||||||
class TEXT DEFAULT NULL,
|
|
||||||
arbid TEXT DEFAULT NULL,
|
|
||||||
gamng TEXT DEFAULT NULL,
|
|
||||||
lmnga TEXT DEFAULT NULL,
|
|
||||||
gernr TEXT DEFAULT NULL,
|
|
||||||
zz1_cn_bill_ord TEXT DEFAULT NULL,
|
|
||||||
zmm_amps TEXT DEFAULT NULL,
|
|
||||||
zmm_brand TEXT DEFAULT NULL,
|
|
||||||
zmm_degreeofprotection TEXT DEFAULT NULL,
|
|
||||||
zmm_delivery TEXT DEFAULT NULL,
|
|
||||||
zmm_dir_rot TEXT DEFAULT NULL,
|
|
||||||
zmm_discharge TEXT DEFAULT NULL,
|
|
||||||
zmm_discharge_max TEXT DEFAULT NULL,
|
|
||||||
zmm_discharge_min TEXT DEFAULT NULL,
|
|
||||||
zmm_duty TEXT DEFAULT NULL,
|
|
||||||
zmm_eff_motor TEXT DEFAULT NULL,
|
|
||||||
zmm_eff_pump TEXT DEFAULT NULL,
|
|
||||||
zmm_frequency TEXT DEFAULT NULL,
|
|
||||||
zmm_head TEXT DEFAULT NULL,
|
|
||||||
zmm_heading TEXT DEFAULT NULL,
|
|
||||||
zmm_head_max TEXT DEFAULT NULL,
|
|
||||||
zmm_head_minimum TEXT DEFAULT NULL,
|
|
||||||
zmm_idx_eff_mtr TEXT DEFAULT NULL,
|
|
||||||
zmm_idx_eff_pump TEXT DEFAULT NULL,
|
|
||||||
zmm_kvacode TEXT DEFAULT NULL,
|
|
||||||
zmm_maxambtemp TEXT DEFAULT NULL,
|
|
||||||
zmm_mincoolingflow TEXT DEFAULT NULL,
|
|
||||||
zmm_motorseries TEXT DEFAULT NULL,
|
|
||||||
zmm_motor_model TEXT DEFAULT NULL,
|
|
||||||
zmm_outlet TEXT DEFAULT NULL,
|
|
||||||
zmm_phase TEXT DEFAULT NULL,
|
|
||||||
zmm_pressure TEXT DEFAULT NULL,
|
|
||||||
zmm_pumpflowtype TEXT DEFAULT NULL,
|
|
||||||
zmm_pumpseries TEXT DEFAULT NULL,
|
|
||||||
zmm_pump_model TEXT DEFAULT NULL,
|
|
||||||
zmm_ratedpower TEXT DEFAULT NULL,
|
|
||||||
zmm_region TEXT DEFAULT NULL,
|
|
||||||
zmm_servicefactor TEXT DEFAULT NULL,
|
|
||||||
zmm_servicefactormaximumamps TEXT DEFAULT NULL,
|
|
||||||
zmm_speed TEXT DEFAULT NULL,
|
|
||||||
zmm_suction TEXT DEFAULT NULL,
|
|
||||||
zmm_suctionxdelivery TEXT DEFAULT NULL,
|
|
||||||
zmm_supplysource TEXT DEFAULT NULL,
|
|
||||||
zmm_temperature TEXT DEFAULT NULL,
|
|
||||||
zmm_thrustload TEXT DEFAULT NULL,
|
|
||||||
zmm_volts TEXT DEFAULT NULL,
|
|
||||||
zmm_wire TEXT DEFAULT NULL,
|
|
||||||
zmm_package TEXT DEFAULT NULL,
|
|
||||||
zmm_pvarrayrating TEXT DEFAULT NULL,
|
|
||||||
zmm_isi TEXT DEFAULT NULL,
|
|
||||||
zmm_isimotor TEXT DEFAULT NULL,
|
|
||||||
zmm_isipump TEXT DEFAULT NULL,
|
|
||||||
zmm_isipumpset TEXT DEFAULT NULL,
|
|
||||||
zmm_pumpset_model TEXT DEFAULT NULL,
|
|
||||||
zmm_stages TEXT DEFAULT NULL,
|
|
||||||
zmm_headrange TEXT DEFAULT NULL,
|
|
||||||
zmm_overall_efficiency TEXT DEFAULT NULL,
|
|
||||||
zmm_connection TEXT DEFAULT NULL,
|
|
||||||
zmm_min_bore_size TEXT DEFAULT NULL,
|
|
||||||
zmm_isireference TEXT DEFAULT NULL,
|
|
||||||
zmm_category TEXT DEFAULT NULL,
|
|
||||||
zmm_submergence TEXT DEFAULT NULL,
|
|
||||||
zmm_capacitorstart TEXT DEFAULT NULL,
|
|
||||||
zmm_capacitorrun TEXT DEFAULT NULL,
|
|
||||||
zmm_inch TEXT DEFAULT NULL,
|
|
||||||
zmm_motor_type TEXT DEFAULT NULL,
|
|
||||||
zmm_dismantle_direction TEXT DEFAULT NULL,
|
|
||||||
zmm_eff_ovrall TEXT DEFAULT NULL,
|
|
||||||
zmm_bodymoc TEXT DEFAULT NULL,
|
|
||||||
zmm_rotormoc TEXT DEFAULT NULL,
|
|
||||||
zmm_dlwl TEXT DEFAULT NULL,
|
|
||||||
zmm_inputpower TEXT DEFAULT NULL,
|
|
||||||
zmm_imp_od TEXT DEFAULT NULL,
|
|
||||||
zmm_ambtemp TEXT DEFAULT NULL,
|
|
||||||
zmm_de TEXT DEFAULT NULL,
|
|
||||||
zmm_dischargerange TEXT DEFAULT NULL,
|
|
||||||
zmm_efficiency_class TEXT DEFAULT NULL,
|
|
||||||
zmm_framesize TEXT DEFAULT NULL,
|
|
||||||
zmm_impellerdiameter TEXT DEFAULT NULL,
|
|
||||||
zmm_insulationclass TEXT DEFAULT NULL,
|
|
||||||
zmm_maxflow TEXT DEFAULT NULL,
|
|
||||||
zmm_minhead TEXT DEFAULT NULL,
|
|
||||||
zmm_mtrlofconst TEXT DEFAULT NULL,
|
|
||||||
zmm_nde TEXT DEFAULT NULL,
|
|
||||||
zmm_powerfactor TEXT DEFAULT NULL,
|
|
||||||
zmm_tagno TEXT DEFAULT NULL,
|
|
||||||
zmm_year TEXT DEFAULT NULL,
|
|
||||||
zmm_laser_name TEXT DEFAULT NULL,
|
|
||||||
zmm_beenote TEXT DEFAULT NULL,
|
|
||||||
zmm_beenumber TEXT DEFAULT NULL,
|
|
||||||
zmm_beestar TEXT DEFAULT NULL,
|
|
||||||
zmm_codeclass TEXT DEFAULT NULL,
|
|
||||||
zmm_colour TEXT DEFAULT NULL,
|
|
||||||
zmm_grade TEXT DEFAULT NULL,
|
|
||||||
zmm_grwt_pset TEXT DEFAULT NULL,
|
|
||||||
zmm_grwt_cable TEXT DEFAULT NULL,
|
|
||||||
zmm_grwt_motor TEXT DEFAULT NULL,
|
|
||||||
zmm_grwt_pf TEXT DEFAULT NULL,
|
|
||||||
zmm_grwt_pump TEXT DEFAULT NULL,
|
|
||||||
zmm_isivalve TEXT DEFAULT NULL,
|
|
||||||
zmm_isi_wc TEXT DEFAULT NULL,
|
|
||||||
zmm_labelperiod TEXT DEFAULT NULL,
|
|
||||||
zmm_length TEXT DEFAULT NULL,
|
|
||||||
zmm_license_cml_no TEXT DEFAULT NULL,
|
|
||||||
zmm_mfgmonyr TEXT DEFAULT NULL,
|
|
||||||
zmm_modelyear TEXT DEFAULT NULL,
|
|
||||||
zmm_motoridentification TEXT DEFAULT NULL,
|
|
||||||
zmm_newt_pset TEXT DEFAULT NULL,
|
|
||||||
zmm_newt_cable TEXT DEFAULT NULL,
|
|
||||||
zmm_newt_motor TEXT DEFAULT NULL,
|
|
||||||
zmm_newt_pf TEXT DEFAULT NULL,
|
|
||||||
zmm_newt_pump TEXT DEFAULT NULL,
|
|
||||||
zmm_logo_cp TEXT DEFAULT NULL,
|
|
||||||
zmm_logo_ce TEXT DEFAULT NULL,
|
|
||||||
zmm_logo_nsf TEXT DEFAULT NULL,
|
|
||||||
zmm_packtype TEXT DEFAULT NULL,
|
|
||||||
zmm_panel TEXT DEFAULT NULL,
|
|
||||||
zmm_performance_factor TEXT DEFAULT NULL,
|
|
||||||
zmm_pumpidentification TEXT DEFAULT NULL,
|
|
||||||
zmm_psettype TEXT DEFAULT NULL,
|
|
||||||
zmm_size TEXT DEFAULT NULL,
|
|
||||||
zmm_eff_ttl TEXT DEFAULT NULL,
|
|
||||||
zmm_type TEXT DEFAULT NULL,
|
|
||||||
zmm_usp TEXT DEFAULT NULL,
|
|
||||||
mark_status TEXT DEFAULT NULL,
|
|
||||||
marked_datetime TIMESTAMP DEFAULT NULL,
|
|
||||||
marked_by TEXT DEFAULT NULL,
|
|
||||||
man_marked_status TEXT DEFAULT '0',
|
|
||||||
man_marked_datetime TIMESTAMP DEFAULT NULL,
|
|
||||||
man_marked_by TEXT DEFAULT NULL,
|
|
||||||
motor_marked_status TEXT DEFAULT NULL,
|
|
||||||
motor_marked_by TEXT DEFAULT NULL,
|
|
||||||
pump_marked_status TEXT DEFAULT NULL,
|
|
||||||
pump_marked_by TEXT DEFAULT NULL,
|
|
||||||
motor_pump_pumpset_status TEXT DEFAULT NULL,
|
|
||||||
motor_machine_name TEXT DEFAULT NULL,
|
|
||||||
pump_machine_name TEXT DEFAULT NULL,
|
|
||||||
pumpset_machine_name TEXT DEFAULT NULL,
|
|
||||||
part_validation_1 TEXT DEFAULT NULL,
|
|
||||||
part_validation_2 TEXT DEFAULT NULL,
|
|
||||||
samlight_logged_name TEXT DEFAULT NULL,
|
|
||||||
pending_released_status INTEGER DEFAULT 0,
|
|
||||||
motor_expected_time TEXT DEFAULT '0',
|
|
||||||
pump_expected_time TEXT DEFAULT '0',
|
|
||||||
|
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
created_by TEXT DEFAULT NULL,
|
|
||||||
updated_by TEXT DEFAULT NULL,
|
|
||||||
deleted_at TIMESTAMP,
|
|
||||||
|
|
||||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
|
||||||
FOREIGN KEY (machine_id) REFERENCES machines (id),
|
|
||||||
FOREIGN KEY (item_id) REFERENCES items (id)
|
|
||||||
);
|
|
||||||
SQL;
|
|
||||||
DB::statement($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('class_characteristics');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,65 +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
|
|
||||||
{
|
|
||||||
$sql = <<<'SQL'
|
|
||||||
CREATE TABLE request_characteristics (
|
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
|
||||||
|
|
||||||
plant_id BIGINT NOT NULL,
|
|
||||||
machine_id BIGINT NOT NULL,
|
|
||||||
item_id BIGINT NOT NULL,
|
|
||||||
characteristic_approver_master_id BIGINT NOT NULL,
|
|
||||||
aufnr TEXT DEFAULT NULL,
|
|
||||||
characteristic_name TEXT DEFAULT NULL,
|
|
||||||
current_value TEXT DEFAULT NULL,
|
|
||||||
update_value TEXT DEFAULT NULL,
|
|
||||||
|
|
||||||
approver_status1 TEXT DEFAULT NULL,
|
|
||||||
approver_status2 TEXT DEFAULT NULL,
|
|
||||||
approver_status3 TEXT DEFAULT NULL,
|
|
||||||
|
|
||||||
approver_remark1 TEXT DEFAULT NULL,
|
|
||||||
approver_remark2 TEXT DEFAULT NULL,
|
|
||||||
approver_remark3 TEXT DEFAULT NULL,
|
|
||||||
|
|
||||||
work_flow_id TEXT DEFAULT NULL,
|
|
||||||
mail_status TEXT DEFAULT NULL,
|
|
||||||
trigger_at TIMESTAMP,
|
|
||||||
|
|
||||||
approved1_at TIMESTAMP,
|
|
||||||
approved2_at TIMESTAMP,
|
|
||||||
approved3_at TIMESTAMP,
|
|
||||||
|
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
created_by TEXT DEFAULT NULL,
|
|
||||||
updated_by TEXT DEFAULT NULL,
|
|
||||||
deleted_at TIMESTAMP,
|
|
||||||
|
|
||||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
|
||||||
FOREIGN KEY (machine_id) REFERENCES machines(id),
|
|
||||||
FOREIGN KEY (item_id) REFERENCES items(id),
|
|
||||||
FOREIGN KEY (characteristic_approver_master_id) REFERENCES characteristic_approver_masters(id)
|
|
||||||
);
|
|
||||||
SQL;
|
|
||||||
DB::statement($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('request_characteristics');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,49 +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
|
|
||||||
{
|
|
||||||
$sql = <<<'SQL'
|
|
||||||
CREATE TABLE characteristic_approver_masters (
|
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
|
||||||
|
|
||||||
plant_id BIGINT NOT NULL,
|
|
||||||
machine_id BIGINT NOT NULL,
|
|
||||||
machine_name TEXT DEFAULT NULL,
|
|
||||||
characteristic_field TEXT DEFAULT NULL,
|
|
||||||
name1 TEXT DEFAULT NULL,
|
|
||||||
mail1 TEXT DEFAULT NULL,
|
|
||||||
name2 TEXT DEFAULT NULL,
|
|
||||||
mail2 TEXT DEFAULT NULL,
|
|
||||||
name3 TEXT DEFAULT NULL,
|
|
||||||
mail3 TEXT DEFAULT NULL,
|
|
||||||
|
|
||||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
|
||||||
created_by TEXT DEFAULT NULL,
|
|
||||||
updated_by TEXT DEFAULT NULL,
|
|
||||||
deleted_at TIMESTAMP,
|
|
||||||
|
|
||||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
|
||||||
FOREIGN KEY (machine_id) REFERENCES machines(id)
|
|
||||||
);
|
|
||||||
SQL;
|
|
||||||
DB::statement($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('characteristic_approver_masters');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,45 +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
|
|
||||||
{
|
|
||||||
$sql1 = <<<'SQL'
|
|
||||||
ALTER TABLE characteristic_approver_masters
|
|
||||||
ADD COLUMN duration1 NUMERIC(4, 2) DEFAULT 0
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql1);
|
|
||||||
|
|
||||||
$sql2 = <<<'SQL'
|
|
||||||
ALTER TABLE characteristic_approver_masters
|
|
||||||
ADD COLUMN duration2 NUMERIC(4, 2) DEFAULT 0
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql2);
|
|
||||||
|
|
||||||
$sql3 = <<<'SQL'
|
|
||||||
ALTER TABLE characteristic_approver_masters
|
|
||||||
ADD COLUMN duration3 NUMERIC(4, 2) DEFAULT 0
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql3);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
// Schema::table('characteristic_approver_masters', function (Blueprint $table) {
|
|
||||||
// //
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,31 +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
|
|
||||||
{
|
|
||||||
$sql1 = <<<'SQL'
|
|
||||||
ALTER TABLE invoice_data_validations
|
|
||||||
ADD COLUMN remark TEXT DEFAULT NULL
|
|
||||||
SQL;
|
|
||||||
|
|
||||||
DB::statement($sql1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
// Schema::table('invoice_data_validations', function (Blueprint $table) {
|
|
||||||
// //
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -161,9 +161,6 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view production data send to sap']);
|
Permission::updateOrCreate(['name' => 'view production data send to sap']);
|
||||||
Permission::updateOrCreate(['name' => 'create production sticker reject reason page']);
|
Permission::updateOrCreate(['name' => 'create production sticker reject reason page']);
|
||||||
Permission::updateOrCreate(['name' => 'create web capture page']);
|
Permission::updateOrCreate(['name' => 'create web capture page']);
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view invoice pending reason']);
|
|
||||||
|
|
||||||
Permission::updateOrCreate(['name' => 'view import invoice out validation']);
|
Permission::updateOrCreate(['name' => 'view import invoice out validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view export invoice out validation']);
|
Permission::updateOrCreate(['name' => 'view export invoice out validation']);
|
||||||
Permission::updateOrCreate(['name' => 'view import invoice data validation']);
|
Permission::updateOrCreate(['name' => 'view import invoice data validation']);
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
<x-filament-panels::page>
|
|
||||||
<div class="space-y-4">
|
|
||||||
{{ $this->filtersForm($this->form) }}
|
|
||||||
</div>
|
|
||||||
<div class="flex-row gap-2 mt-4">
|
|
||||||
<x-filament::button
|
|
||||||
{{-- type="button" --}}
|
|
||||||
{{-- wire:click="addRemark"
|
|
||||||
class="px-3 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm" --}}
|
|
||||||
wire:click="addRemark"
|
|
||||||
color="primary"
|
|
||||||
class="mt-4"
|
|
||||||
>
|
|
||||||
Save
|
|
||||||
</x-filament::button>
|
|
||||||
|
|
||||||
<x-filament::button
|
|
||||||
wire:click="importPendingReason"
|
|
||||||
color="primary"
|
|
||||||
class="mt-4"
|
|
||||||
>
|
|
||||||
Import
|
|
||||||
</x-filament::button>
|
|
||||||
<x-filament::button
|
|
||||||
wire:click="exportPendingReason"
|
|
||||||
color="primary"
|
|
||||||
class="mt-4"
|
|
||||||
>
|
|
||||||
Export
|
|
||||||
</x-filament::button>
|
|
||||||
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
|
||||||
<livewire:invoice-pending />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</x-filament-panels::page>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<x-filament-panels::page>
|
|
||||||
|
|
||||||
<h1 class="text-3xl font-bold mb-6">Welcome to CRI Digital Manufacturing IIOT</h1>
|
|
||||||
|
|
||||||
<div class="w-full overflow-hidden rounded-xl shadow">
|
|
||||||
<img
|
|
||||||
src="{{ asset('images/iiot-banner.jpg') }}"
|
|
||||||
alt="CRI Digital Manufacturing IIoT"
|
|
||||||
class="w-full h-64 object-cover"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="text-lg text-gray-600 mb-6">
|
|
||||||
This dashboard provides real-time visibility into your manufacturing operations,
|
|
||||||
enabling you to monitor production, track performance, and make data-driven decisions
|
|
||||||
across plants and lines—all from one centralized platform.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</x-filament-panels::page>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<div class="p-4">
|
|
||||||
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
|
|
||||||
PENDING INVOICE DATA TABLE:
|
|
||||||
</h2>
|
|
||||||
<div class="overflow-x-auto rounded-lg shadow">
|
|
||||||
<table class="w-full divide-y divide-gray-200 text-sm text-center">
|
|
||||||
<thead class="bg-gray-100 text-s font-semibold uppercase text-gray-700">
|
|
||||||
<tr>
|
|
||||||
<th class="border px-4 py-2">No</th>
|
|
||||||
<th class="border px-4 py-2">Plant Code</th>
|
|
||||||
<th class="border px-4 py-2">Document Number</th>
|
|
||||||
<th class="border px-4 py-2">Customer Trade Location</th>
|
|
||||||
<th class="border px-4 py-2">Location</th>
|
|
||||||
<th class="border px-4 py-2">Remark</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody class="divide-y divide-gray-100">
|
|
||||||
@if (empty($invoicePending))
|
|
||||||
<tr>
|
|
||||||
<td colspan="6" class="px-4 py-4 text-center text-gray-500">
|
|
||||||
Please select plant to load pending invoice.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@else
|
|
||||||
@forelse ($invoicePending as $index => $locator)
|
|
||||||
<tr class="hover:bg-gray-50">
|
|
||||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['plant_id'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['document_number'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2">{{ $locator['customer_trade_name'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['location'] ?? '-' }}</td>
|
|
||||||
<td class="border px-4 py-2 whitespace-nowrap">{{ $locator['remark'] ?? '-' }}</td>
|
|
||||||
</tr>
|
|
||||||
@empty
|
|
||||||
<tr>
|
|
||||||
<td colspan="9" class="px-4 py-4 text-center text-gray-500">
|
|
||||||
No invoice pending records found.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforelse
|
|
||||||
@endif
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -88,7 +88,6 @@
|
|||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>Pending Days</th>
|
<th>Pending Days</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Remark</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -118,7 +117,6 @@
|
|||||||
<td class="{{ $row['status_class'] ?? '' }}">
|
<td class="{{ $row['status_class'] ?? '' }}">
|
||||||
{{ $row['status'] }}
|
{{ $row['status'] }}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $row['remark'] ?? '-'}}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\CharacteristicApprovalController;
|
|
||||||
use App\Http\Controllers\CharacteristicsController;
|
use App\Http\Controllers\CharacteristicsController;
|
||||||
use App\Http\Controllers\EquipmentMasterController;
|
use App\Http\Controllers\EquipmentMasterController;
|
||||||
use App\Http\Controllers\InvoiceValidationController;
|
use App\Http\Controllers\InvoiceValidationController;
|
||||||
@@ -46,6 +45,7 @@ use Illuminate\Support\Facades\Route;
|
|||||||
|
|
||||||
// Route::post('/user/update', function (Request $request) {
|
// Route::post('/user/update', function (Request $request) {
|
||||||
// // Return the request data as JSON
|
// // Return the request data as JSON
|
||||||
|
|
||||||
// // dd($request);
|
// // dd($request);
|
||||||
// return response()->json([
|
// return response()->json([
|
||||||
// 'message' => 'User updated successfully',
|
// 'message' => 'User updated successfully',
|
||||||
@@ -77,7 +77,7 @@ Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'dow
|
|||||||
|
|
||||||
// Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
|
// Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
|
||||||
|
|
||||||
// Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->where('palletNo', '.*')->name('download-qr1-pdf');
|
//Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->where('palletNo', '.*')->name('download-qr1-pdf');
|
||||||
Route::get('/download-qr1-pdf', [ProductionStickerReprintController::class, 'downloadQrPdf'])
|
Route::get('/download-qr1-pdf', [ProductionStickerReprintController::class, 'downloadQrPdf'])
|
||||||
->name('download-qr1-pdf');
|
->name('download-qr1-pdf');
|
||||||
|
|
||||||
@@ -155,37 +155,29 @@ Route::post('process-order', [PdfController::class, 'storeProcessOrderData']);
|
|||||||
|
|
||||||
Route::get('sap/files', [SapFileController::class, 'readFiles']);
|
Route::get('sap/files', [SapFileController::class, 'readFiles']);
|
||||||
|
|
||||||
Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
// ..Laser Marking - Characteristics
|
||||||
|
|
||||||
// ..Part Validation - Characteristics
|
|
||||||
|
|
||||||
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
||||||
|
|
||||||
// ..Laser Route to SAP
|
|
||||||
|
|
||||||
Route::post('laser/route/data', [CharacteristicsController::class, 'test']); // ->withoutMiddleware(VerifyCsrfToken::class)
|
Route::post('laser/route/data', [CharacteristicsController::class, 'test']); // ->withoutMiddleware(VerifyCsrfToken::class)
|
||||||
|
|
||||||
// ..Job or Serial - Characteristics
|
// ..Part Validation - Characteristics
|
||||||
|
|
||||||
Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
// Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
||||||
|
|
||||||
Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
// ..Serial or job
|
||||||
|
|
||||||
|
// Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
||||||
|
|
||||||
|
// Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
||||||
|
|
||||||
// ..Job or Master - Characteristics
|
// ..Job or Master - Characteristics
|
||||||
|
|
||||||
Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
// Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||||
|
|
||||||
// ..serial (auto or manual)
|
// ..serial auto or manual
|
||||||
|
|
||||||
Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
// Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||||
|
|
||||||
// ..Request Characteristics
|
|
||||||
|
|
||||||
Route::post('laser/characteristics/change', [CharacteristicsController::class, 'storeLaserRequestChar']);
|
|
||||||
|
|
||||||
Route::get('laser/characteristics/request', [CharacteristicsController::class, 'getLaserRequestChar']);
|
|
||||||
|
|
||||||
Route::post('laser-doc-pdf', [PdfController::class, 'storeLaserPdf']);
|
|
||||||
|
|
||||||
// ..Product Characteristics
|
// ..Product Characteristics
|
||||||
|
|
||||||
@@ -203,13 +195,6 @@ Route::post('grmaster-sno-update', [PdfController::class, 'updateGR']);
|
|||||||
|
|
||||||
Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');
|
Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');
|
||||||
|
|
||||||
// routes/api.php
|
|
||||||
// Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave']);
|
|
||||||
|
|
||||||
// Route::post('send-telegram', [TelegramController::class, 'sendMessage']);
|
// Route::post('send-telegram', [TelegramController::class, 'sendMessage']);
|
||||||
|
|
||||||
// Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']);
|
// Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']);
|
||||||
|
|
||||||
|
|
||||||
// Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave'])
|
|
||||||
// ->name('characteristic.hold.save');
|
|
||||||
|
|||||||
247
routes/web.php
247
routes/web.php
@@ -1,116 +1,76 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\CharacteristicApprovalController;
|
use App\Mail\test;
|
||||||
use App\Http\Controllers\FileUploadController;
|
|
||||||
use App\Models\EquipmentMaster;
|
use App\Models\EquipmentMaster;
|
||||||
|
use App\Models\InvoiceValidation;
|
||||||
|
use App\Models\Plant;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use thiagoalessio\TesseractOCR\TesseractOCR;
|
use thiagoalessio\TesseractOCR\TesseractOCR;
|
||||||
|
|
||||||
Route::get('/', function () {
|
|
||||||
return redirect('/admin');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Route::get('/admin', function () {
|
Route::get('/', function () {
|
||||||
// return redirect('/admin/welcome');
|
return redirect('/admin');
|
||||||
// });
|
});
|
||||||
|
|
||||||
// ..Characteristic Approval Routes..//
|
// routes/web.php
|
||||||
|
Route::post('/save-serials-to-session', function (Request $request) {
|
||||||
|
session(['serial_numbers' => $request->serial_numbers]);
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'success',
|
||||||
|
'serial_numbers' => session('serial_numbers'),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
Route::get('/characteristic/hold', [CharacteristicApprovalController::class, 'holdForm'])
|
Route::get('/part-validation-image/{filename}', function ($filename) {
|
||||||
->name('characteristic.hold')
|
$path = storage_path("app/private/uploads/PartValidation/{$filename}");
|
||||||
->middleware('signed');
|
|
||||||
|
|
||||||
Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave'])
|
if (!file_exists($path)) {
|
||||||
->name('characteristic.hold.save');
|
abort(404, 'Image not found');
|
||||||
|
}
|
||||||
|
|
||||||
Route::get('/approval/hold-success', function () {
|
return response()->file($path);
|
||||||
return view('approval.hold-success');
|
})->name('part.validation.image');
|
||||||
})->name('approval.hold.success');
|
|
||||||
|
|
||||||
Route::get('/characteristic/reject', [CharacteristicApprovalController::class, 'rejectForm'])
|
// web.php
|
||||||
->name('characteristic.reject')
|
Route::post('/temp-upload', function (Request $request) {
|
||||||
->middleware('signed');
|
if (!$request->hasFile('photo')) {
|
||||||
|
return response()->json(['success' => false], 400);
|
||||||
|
}
|
||||||
|
|
||||||
Route::post('/characteristic/reject-save', [CharacteristicApprovalController::class, 'rejectSave'])
|
$file = $request->file('photo');
|
||||||
->name('characteristic.reject.save');
|
$filename = 'capture_' . time() . '.jpeg';
|
||||||
|
$path = $file->storeAs('temp', $filename, 'local'); // storage/app/temp
|
||||||
|
|
||||||
Route::get('/approval/reject-success', function () {
|
return response()->json([
|
||||||
return view('approval.reject-success');
|
'success' => true,
|
||||||
})->name('approval.reject.success');
|
'path' => $path,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
Route::post('/verify-ocr', function (Request $request) {
|
||||||
->name('characteristic.approve')
|
|
||||||
->middleware('signed');
|
|
||||||
|
|
||||||
Route::post('/file-upload', [FileUploadController::class, 'upload'])->name('file.upload');
|
if (!$request->has('path')) {
|
||||||
|
return response()->json(['success' => false, 'error' => 'No file path provided']);
|
||||||
|
}
|
||||||
|
|
||||||
// Route::get('/characteristic/hold', [CharacteristicApprovalController::class, 'hold'])
|
$filePath = storage_path('app/private/temp/' . basename($request->path));
|
||||||
// ->name('characteristic.hold')
|
|
||||||
// ->middleware('signed');
|
|
||||||
|
|
||||||
// Route::get('/characteristic/reject', [CharacteristicApprovalController::class, 'reject'])
|
if (!file_exists($filePath)) {
|
||||||
// ->name('characteristic.reject')
|
return response()->json(['success' => false, 'error' => 'File not found']);
|
||||||
// ->middleware('signed');
|
}
|
||||||
|
|
||||||
// routes/web.php
|
try {
|
||||||
Route::post('/save-serials-to-session', function (Request $request) {
|
|
||||||
session(['serial_numbers' => $request->serial_numbers]);
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'status' => 'success',
|
|
||||||
'serial_numbers' => session('serial_numbers'),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::get('/part-validation-image/{filename}', function ($filename) {
|
|
||||||
$path = storage_path("app/private/uploads/PartValidation/{$filename}");
|
|
||||||
|
|
||||||
if (! file_exists($path)) {
|
|
||||||
abort(404, 'Image not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
return response()->file($path);
|
|
||||||
})->name('part.validation.image');
|
|
||||||
|
|
||||||
// web.php
|
|
||||||
Route::post('/temp-upload', function (Request $request) {
|
|
||||||
if (! $request->hasFile('photo')) {
|
|
||||||
return response()->json(['success' => false], 400);
|
|
||||||
}
|
|
||||||
|
|
||||||
$file = $request->file('photo');
|
|
||||||
$filename = 'capture_'.time().'.jpeg';
|
|
||||||
$path = $file->storeAs('temp', $filename, 'local'); // storage/app/temp
|
|
||||||
|
|
||||||
return response()->json([
|
|
||||||
'success' => true,
|
|
||||||
'path' => $path,
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
Route::post('/verify-ocr', function (Request $request) {
|
|
||||||
|
|
||||||
if (! $request->has('path')) {
|
|
||||||
return response()->json(['success' => false, 'error' => 'No file path provided']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$filePath = storage_path('app/private/temp/'.basename($request->path));
|
|
||||||
|
|
||||||
if (! file_exists($filePath)) {
|
|
||||||
return response()->json(['success' => false, 'error' => 'File not found']);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// $text = (new TesseractOCR($filePath))->lang('eng')->run();
|
// $text = (new TesseractOCR($filePath))->lang('eng')->run();
|
||||||
$text = (new TesseractOCR($filePath))
|
$text = (new TesseractOCR($filePath))
|
||||||
->executable('/usr/bin/tesseract')
|
->executable('/usr/bin/tesseract')
|
||||||
->lang('eng')
|
->lang('eng')
|
||||||
->psm(6) // treats the image as a block of text
|
->psm(6) // treats the image as a block of text
|
||||||
->config('tessedit_char_whitelist', '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')
|
->config('tessedit_char_whitelist', '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
$text = trim($text); // remove whitespace
|
$text = trim($text); // remove whitespace
|
||||||
|
|
||||||
@@ -119,19 +79,19 @@ Route::post('/verify-ocr', function (Request $request) {
|
|||||||
return response()->json(['success' => true, 'text' => 'Text not found']);
|
return response()->json(['success' => true, 'text' => 'Text not found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return response()->json(['success' => true, 'text' => $text]);
|
//return response()->json(['success' => true, 'text' => $text]);
|
||||||
$lines = preg_split('/\r\n|\r|\n/', $text);
|
$lines = preg_split('/\r\n|\r|\n/', $text);
|
||||||
$serials = array_filter(array_map('trim', $lines), fn ($line) => preg_match('/^[A-Za-z0-9]+$/', $line));
|
$serials = array_filter(array_map('trim', $lines), fn($line) => preg_match('/^[A-Za-z0-9]+$/', $line));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'text' => array_values($serials), // reindex array
|
'text' => array_values($serials) // reindex array
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// catch (\Exception $e) {
|
//catch (\Exception $e) {
|
||||||
// return response()->json(['success' => false, 'error' => $e->getMessage()]);
|
// return response()->json(['success' => false, 'error' => $e->getMessage()]);
|
||||||
// }
|
// }
|
||||||
catch (\Exception $e) {
|
catch (\Exception $e) {
|
||||||
// Log the full exception class and message
|
// Log the full exception class and message
|
||||||
\Log::error('Tesseract OCR failed', [
|
\Log::error('Tesseract OCR failed', [
|
||||||
'exception_class' => get_class($e),
|
'exception_class' => get_class($e),
|
||||||
@@ -151,61 +111,62 @@ Route::post('/verify-ocr', function (Request $request) {
|
|||||||
'trace' => $e->getTraceAsString(),
|
'trace' => $e->getTraceAsString(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/download/{equipmentNumber}', function ($equipmentNumber) {
|
Route::get('/download/{equipmentNumber}', function ($equipmentNumber) {
|
||||||
$model = EquipmentMaster::where('equipment_number', $equipmentNumber)->firstOrFail();
|
$model = EquipmentMaster::where('equipment_number', $equipmentNumber)->firstOrFail();
|
||||||
|
|
||||||
if (! $model->attachment || ! Storage::disk('local')->exists($model->attachment)) {
|
if (! $model->attachment || ! Storage::disk('local')->exists($model->attachment)) {
|
||||||
abort(404, 'File not found.');
|
abort(404, 'File not found.');
|
||||||
}
|
}
|
||||||
|
return Storage::disk('local')->download($model->attachment);
|
||||||
|
})->name('download.attachment');
|
||||||
|
|
||||||
return Storage::disk('local')->download($model->attachment);
|
// Route::get('/admin/forgot-password', function () {
|
||||||
})->name('download.attachment');
|
// return view('auth.forgot-password');
|
||||||
|
// })->name('filament.admin.forgot-password');
|
||||||
|
|
||||||
// Route::get('/admin/forgot-password', function () {
|
|
||||||
// return view('auth.forgot-password');
|
|
||||||
// })->name('filament.admin.forgot-password');
|
|
||||||
|
|
||||||
// Route::post('/admin/forgot-password', function(Request $request){
|
// Route::post('/admin/forgot-password', function(Request $request){
|
||||||
|
|
||||||
// $validator = Validator::make($request->all(), [
|
// $validator = Validator::make($request->all(), [
|
||||||
// 'email'=>'required|email',
|
// 'email'=>'required|email',
|
||||||
// 'old_password'=>'required',
|
// 'old_password'=>'required',
|
||||||
// 'password'=>'required',
|
// 'password'=>'required',
|
||||||
// 'password_confirmation'=>'required'
|
// 'password_confirmation'=>'required'
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
// if($validator->fails()){
|
// if($validator->fails()){
|
||||||
// return response()->json([
|
// return response()->json([
|
||||||
// 'emailError' => $validator->errors()->first('email'),
|
// 'emailError' => $validator->errors()->first('email'),
|
||||||
// 'oldPasswordError' => $validator->errors()->first('old_password'),
|
// 'oldPasswordError' => $validator->errors()->first('old_password'),
|
||||||
// 'newPasswordError' => $validator->errors()->first('password'),
|
// 'newPasswordError' => $validator->errors()->first('password'),
|
||||||
// 'confirmPasswordError' => $validator->errors()->first('password_confirmation')
|
// 'confirmPasswordError' => $validator->errors()->first('password_confirmation')
|
||||||
// ]);
|
// ]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $user = User::where('email',$request->email)->first();
|
// $user = User::where('email',$request->email)->first();
|
||||||
// if(!$user){
|
// if(!$user){
|
||||||
// return response()->json(['passwordError'=>'No user found with this email.']);
|
// return response()->json(['passwordError'=>'No user found with this email.']);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if(!Hash::check($request->old_password, $user->password)){
|
// if(!Hash::check($request->old_password, $user->password)){
|
||||||
// return response()->json(['oldPasswordError'=>'Old password does not match']);
|
// return response()->json(['oldPasswordError'=>'Old password does not match']);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if($request->password != $request->password_confirmation){
|
// if($request->password != $request->password_confirmation){
|
||||||
// return response()->json(['newPasswordError'=>'New password and confirm password do not match']);
|
// return response()->json(['newPasswordError'=>'New password and confirm password do not match']);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// $user->password = Hash::make($request->password);
|
// $user->password = Hash::make($request->password);
|
||||||
// $user->save();
|
// $user->save();
|
||||||
|
|
||||||
// return response()->json(['success'=>'Password changed successfully!']);
|
// return response()->json(['success'=>'Password changed successfully!']);
|
||||||
// })->name('filament.admin.forgot-password.otp');
|
// })->name('filament.admin.forgot-password.otp');
|
||||||
|
|
||||||
// Route::post('/admin/check-email', function(Request $request){
|
|
||||||
// $request->validate(['email' => 'required|email']);
|
// Route::post('/admin/check-email', function(Request $request){
|
||||||
// $exists = User::where('email', $request->email)->first();
|
// $request->validate(['email' => 'required|email']);
|
||||||
// return response()->json(['exists' => $exists]);
|
// $exists = User::where('email', $request->email)->first();
|
||||||
// })->name('admin.check-email');
|
// return response()->json(['exists' => $exists]);
|
||||||
|
// })->name('admin.check-email');
|
||||||
|
|||||||
Reference in New Issue
Block a user