Updated role from Design to Laser and hasWorkFlowId updated against work flow status #503
@@ -5,16 +5,17 @@ namespace App\Filament\Resources;
|
||||
use App\Filament\Exports\RequestCharacteristicExporter;
|
||||
use App\Filament\Resources\RequestCharacteristicResource\Pages;
|
||||
use App\Models\CharacteristicApproverMaster;
|
||||
use App\Models\InvoiceValidation;
|
||||
use App\Models\Item;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use App\Models\StickerMaster;
|
||||
use Closure;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Forms\Set;
|
||||
@@ -22,15 +23,12 @@ use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
|
||||
class RequestCharacteristicResource extends Resource
|
||||
{
|
||||
@@ -176,6 +174,9 @@ class RequestCharacteristicResource extends Resource
|
||||
Forms\Components\TextInput::make('aufnr')
|
||||
->label('Job Number')
|
||||
->reactive()
|
||||
->numeric()
|
||||
->minlength(7)
|
||||
->maxlength(10)
|
||||
->required(function (callable $get) {
|
||||
$item = $get('item_id');
|
||||
if ($item) {
|
||||
@@ -876,7 +877,8 @@ class RequestCharacteristicResource extends Resource
|
||||
Tables\Columns\TextColumn::make('work_flow_id')
|
||||
->label('Work Flow ID')
|
||||
->alignCenter()
|
||||
->searchable(), // isIndividual: true
|
||||
->searchable()
|
||||
->sortable(), // isIndividual: true
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant Name')
|
||||
->alignCenter()
|
||||
@@ -1109,10 +1111,10 @@ class RequestCharacteristicResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
$set('machine', null);
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
// $set('aufnr', null);
|
||||
}),
|
||||
Select::make('machine')
|
||||
->label('Machine')
|
||||
->label('Search by Work Center')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->reactive()
|
||||
@@ -1130,8 +1132,8 @@ class RequestCharacteristicResource extends Resource
|
||||
})->pluck('work_center', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
$set('item_id', null);
|
||||
$set('aufnr', null);
|
||||
// $set('item_id', null);
|
||||
// $set('aufnr', null);
|
||||
}),
|
||||
Select::make('item_id')
|
||||
->label('Search by Item Code')
|
||||
@@ -1152,25 +1154,28 @@ class RequestCharacteristicResource extends Resource
|
||||
})->pluck('code', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
$set('aufnr', null);
|
||||
// $set('aufnr', null);
|
||||
}),
|
||||
TextInput::make('aufnr')
|
||||
->label('Job Number')
|
||||
->placeholder(placeholder: 'Enter Job Number'),
|
||||
->placeholder('Enter Job Number')
|
||||
->numeric()
|
||||
->minlength(7)
|
||||
->maxlength(10),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->placeholder('Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->placeholder('Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if ((empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -1218,7 +1223,7 @@ class RequestCharacteristicResource extends Resource
|
||||
}
|
||||
|
||||
if (! empty($data['machine'])) {
|
||||
$indicators[] = 'Machine: '.Machine::where('id', $data['machine'])->value('work_center');
|
||||
$indicators[] = 'Work Center: '.Machine::where('id', $data['machine'])->value('work_center');
|
||||
}
|
||||
|
||||
if (! empty($data['item_id'])) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ClassCharacteristic;
|
||||
use App\Models\RequestCharacteristic;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -52,14 +53,13 @@ class CharacteristicApprovalController extends Controller
|
||||
foreach ($levels as $lvl => $column) {
|
||||
if ($lvl != $level && in_array($record->$column, ['Approved', 'Rejected'])) {
|
||||
return view('approval.already-processed', [
|
||||
'status' => $record->$column,
|
||||
'status' => $record->$column,
|
||||
'message' => 'Your request has already been processed by another approver',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($levels as $lvl => $column)
|
||||
{
|
||||
foreach ($levels as $lvl => $column) {
|
||||
if ($record->$column == 'Hold') {
|
||||
|
||||
if ($lvl == $level) {
|
||||
@@ -127,13 +127,12 @@ class CharacteristicApprovalController extends Controller
|
||||
foreach ($levels as $lvl => $column) {
|
||||
if ($lvl != $level && in_array($record->$column, ['Approved', 'Rejected'])) {
|
||||
return view('approval.already-processed', [
|
||||
'status' => $record->$column,
|
||||
'status' => $record->$column,
|
||||
'message' => 'Your request has already been processed by another approver',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// foreach ($levels as $lvl => $column) {
|
||||
// if ($record->$column == 'Hold') {
|
||||
|
||||
@@ -150,7 +149,6 @@ class CharacteristicApprovalController extends Controller
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
$allowedMailStatusByLevel = [
|
||||
1 => 'Sent',
|
||||
2 => 'Sent-Mail2',
|
||||
@@ -161,12 +159,11 @@ class CharacteristicApprovalController extends Controller
|
||||
|
||||
if ($record->mail_status != $expectedMailStatus) {
|
||||
return view('approval.approve-level', [
|
||||
'status'=> $currentStatus,
|
||||
'status' => $currentStatus,
|
||||
'message' => 'Your approval time limit has expired.',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
return view('approval.reject-form', compact('id', 'level'));
|
||||
}
|
||||
|
||||
@@ -203,13 +200,12 @@ class CharacteristicApprovalController extends Controller
|
||||
foreach ($levels as $lvl => $column) {
|
||||
if ($lvl != $level && in_array($record->$column, ['Approved', 'Rejected'])) {
|
||||
return view('approval.already-processed', [
|
||||
'status' => $record->$column,
|
||||
'status' => $record->$column,
|
||||
'message' => 'Your request has already been processed by another approver',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// foreach ($levels as $lvl => $column) {
|
||||
// if ($record->$column == 'Hold') {
|
||||
|
||||
@@ -236,7 +232,7 @@ class CharacteristicApprovalController extends Controller
|
||||
|
||||
if ($record->mail_status != $expectedMailStatus) {
|
||||
return view('approval.approve-level', [
|
||||
'status'=> $currentStatus,
|
||||
'status' => $currentStatus,
|
||||
'message' => 'Your approval time limit has expired.',
|
||||
]);
|
||||
}
|
||||
@@ -328,7 +324,7 @@ class CharacteristicApprovalController extends Controller
|
||||
foreach ($levels as $lvl => $column) {
|
||||
if ($lvl != $level && in_array($record->$column, ['Approved', 'Rejected'])) {
|
||||
return view('approval.already-processed', [
|
||||
'status' => $record->$column,
|
||||
'status' => $record->$column,
|
||||
'message' => 'your request has already been processed by another approver',
|
||||
]);
|
||||
}
|
||||
@@ -345,7 +341,7 @@ class CharacteristicApprovalController extends Controller
|
||||
if ($record->mail_status != $expectedMailStatus) {
|
||||
if ($returnView) {
|
||||
return view('approval.approve-level', [
|
||||
'status' => $currentStatus,
|
||||
'status' => $currentStatus,
|
||||
'message' => 'Your approval time limit has expired.',
|
||||
]);
|
||||
}
|
||||
@@ -384,6 +380,12 @@ class CharacteristicApprovalController extends Controller
|
||||
$r->update($updateData);
|
||||
}
|
||||
|
||||
// UPDATE class characteristics
|
||||
// ClassCharacteristic::where('plant_id', $record->plant_id)
|
||||
// ->where('machine_id', $record->machine_id)
|
||||
// ->where('aufnr', $record->aufnr)
|
||||
// ->update(['has_work_flow_id' => $record->work_flow_id]);
|
||||
|
||||
if ($returnView) {
|
||||
return match ($status) {
|
||||
'Approved' => view('approval.success'),
|
||||
|
||||
@@ -14,7 +14,6 @@ use App\Models\RequestCharacteristic;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\User;
|
||||
use App\Models\WorkGroupMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
@@ -326,7 +325,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "User name '{$userName}' not found for the plant code '{$plantCode}'!",
|
||||
], 403);
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User does not have rights!',
|
||||
@@ -638,7 +637,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (! $userPlant && ! $user->hasRole('Super Admin')) {
|
||||
$missingUsersPlant[$field] = $markUser;
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
$missingUsersRight[$field] = $markUser;
|
||||
}
|
||||
}
|
||||
@@ -1171,7 +1170,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "User '{$userName}' not found for Plant '{$plantCode}'!",
|
||||
], 403);
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User does not have rights!',
|
||||
@@ -1345,7 +1344,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (! $userPlant && ! $user->hasRole('Super Admin')) {
|
||||
$missingUsersPlant[$field] = $markUser;
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
$missingUsersRight[$field] = $markUser;
|
||||
}
|
||||
}
|
||||
@@ -1640,7 +1639,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (! $userPlant && ! $user->hasRole('Super Admin')) {
|
||||
$missingUsersPlant[$field] = $markUser;
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
$missingUsersRight[$field] = $markUser;
|
||||
}
|
||||
}
|
||||
@@ -1929,7 +1928,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User name not found for the plant!',
|
||||
], 403);
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User does not have rights!',
|
||||
@@ -2435,7 +2434,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User Name not found for the plant!',
|
||||
], 403);
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User does not have rights!',
|
||||
@@ -3446,7 +3445,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "User name '{$userName}' not found for the plant code '{$plantCode}'!",
|
||||
], 403);
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User does not have rights!',
|
||||
@@ -3593,7 +3592,137 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
// ..Both Has Pending and Completed Logic
|
||||
// ..completed Logic and pending logic for characteristics and quality
|
||||
|
||||
$classRow = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->first();
|
||||
|
||||
if ($classRow) {
|
||||
if (! empty($characteristics)) {
|
||||
$requestChars = RequestCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->get();
|
||||
|
||||
if (! $requestChars->isEmpty()) {
|
||||
$hasPending = false;
|
||||
$allApproved = true;
|
||||
|
||||
foreach ($requestChars as $row) {
|
||||
|
||||
$isApproved = (
|
||||
$row->approver_status1 == 'Approved' || $row->approver_status1 == 'Rejected' ||
|
||||
$row->approver_status2 == 'Approved' || $row->approver_status2 == 'Rejected' ||
|
||||
$row->approver_status3 == 'Approved' || $row->approver_status2 == 'Rejected'
|
||||
);
|
||||
|
||||
$isPending = ! empty($row->mail_status) &&
|
||||
(
|
||||
empty($row->approver_status1) || $row->approver_status1 == 'Hold' ||
|
||||
empty($row->approver_status2) || $row->approver_status2 == 'Hold' ||
|
||||
empty($row->approver_status3) || $row->approver_status3 == 'Hold'
|
||||
);
|
||||
|
||||
if ($isPending) {
|
||||
$hasPending = true;
|
||||
$allApproved = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (! $isApproved) {
|
||||
$allApproved = false;
|
||||
}
|
||||
}
|
||||
|
||||
$current = $classRow->has_work_flow_id ?? '0';
|
||||
|
||||
if ($hasPending) {
|
||||
if ($current == '0') {
|
||||
$newValue = '1';
|
||||
} elseif ($current == '1') {
|
||||
$newValue = '1';
|
||||
} elseif ($current == '2') {
|
||||
$newValue = '3';
|
||||
} elseif ($current == '3') {
|
||||
$newValue = '3';
|
||||
}
|
||||
} elseif ($allApproved) {
|
||||
if ($current == '0') {
|
||||
$newValue = '0';
|
||||
} elseif ($current == '1') {
|
||||
$newValue = '0';
|
||||
} elseif ($current == '2') {
|
||||
$newValue = '2';
|
||||
} elseif ($current == '3') {
|
||||
$newValue = '2';
|
||||
}
|
||||
}
|
||||
|
||||
ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->update([
|
||||
'has_work_flow_id' => $newValue,
|
||||
'updated_at' => now(),
|
||||
'updated_by' => $userName,
|
||||
]);
|
||||
}
|
||||
} elseif (empty($characteristics)) {
|
||||
|
||||
$requestChar = RequestCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
if ($requestChar) {
|
||||
|
||||
$current = $requestChar->has_work_flow_id ?? '0';
|
||||
|
||||
$isApproved =
|
||||
$requestChar->approver_status1 == 'Approved' ||
|
||||
$requestChar->approver_status2 == 'Approved' ||
|
||||
$requestChar->approver_status3 == 'Approved';
|
||||
|
||||
if ($isApproved) {
|
||||
if ($current == '0') {
|
||||
$newValue = '0';
|
||||
} elseif ($current == '1') {
|
||||
$newValue = '1';
|
||||
} elseif ($current == '2') {
|
||||
$newValue = '0';
|
||||
} elseif ($current == '3') {
|
||||
$newValue = '1';
|
||||
}
|
||||
} elseif (
|
||||
$requestChar->approver_status1 == 'Hold' || $requestChar->approver_status1 == 'Rejected' || $requestChar->approver_status1 == null || $requestChar->approver_status1 == '' ||
|
||||
$requestChar->approver_status2 == 'Hold' || $requestChar->approver_status2 == 'Rejected' || $requestChar->approver_status2 == null || $requestChar->approver_status2 == '' ||
|
||||
$requestChar->approver_status3 == 'Hold' || $requestChar->approver_status3 == 'Rejected' || $requestChar->approver_status3 == null || $requestChar->approver_status3 == ''
|
||||
) {
|
||||
if ($current == '0') {
|
||||
$newValue = '2';
|
||||
} elseif ($current == '1') {
|
||||
$newValue = '3';
|
||||
} elseif ($current == '2') {
|
||||
$newValue = '2';
|
||||
} elseif ($current == '3') {
|
||||
$newValue = '3';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->update([
|
||||
'has_work_flow_id' => $newValue,
|
||||
'updated_at' => now(),
|
||||
'updated_by' => $userName,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($characteristics as $char) {
|
||||
$charNameUpp = strtoupper($char['characteristic_name']) ?? null;
|
||||
@@ -3780,11 +3909,15 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$classChar = ClassCharacteristic::where('plant_id', $plantId)->where('machine_id', $MachineId)->where('aufnr', $jobNo)->first();
|
||||
|
||||
$hasWorkFlowId = $classChar->has_work_flow_id ?? null;
|
||||
$hasWorkFlowId = $classChar?->has_work_flow_id;
|
||||
|
||||
$updatedWorkId = null;
|
||||
|
||||
if ($hasWorkFlowId != '' || $hasWorkFlowId != null) {
|
||||
if ($classChar) {
|
||||
|
||||
if ($hasWorkFlowId == '' || $hasWorkFlowId == null) {
|
||||
$hasWorkFlowId = '0';
|
||||
}
|
||||
|
||||
if ($hasWorkFlowId == '0') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
@@ -3811,16 +3944,16 @@ class CharacteristicsController extends Controller
|
||||
$updatedWorkId = '3';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->update([
|
||||
'has_work_flow_id' => $updatedWorkId,
|
||||
'updated_at' => now(),
|
||||
'updated_by' => Filament::auth()->user->name(),
|
||||
]);
|
||||
ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->update([
|
||||
'has_work_flow_id' => $updatedWorkId,
|
||||
'updated_at' => now(),
|
||||
'updated_by' => $userName,
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'work_flow_ids' => [$workFlowIds],
|
||||
@@ -3947,6 +4080,54 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$classChar = ClassCharacteristic::where('plant_id', $plantId)->where('machine_id', $MachineId)->where('aufnr', $jobNo)->latest()->first();
|
||||
|
||||
$hasWorkFlowId = $classChar?->has_work_flow_id ?? null;
|
||||
|
||||
$updatedWorkId = null;
|
||||
|
||||
if ($classChar) {
|
||||
|
||||
if ($hasWorkFlowId == '' || $hasWorkFlowId == null) {
|
||||
$hasWorkFlowId = '0';
|
||||
}
|
||||
|
||||
if ($hasWorkFlowId == '0') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '1';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '2';
|
||||
}
|
||||
} elseif ($hasWorkFlowId == '1') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '1';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '3';
|
||||
}
|
||||
} elseif ($hasWorkFlowId == '2') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '3';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '2';
|
||||
}
|
||||
} elseif ($hasWorkFlowId == '3') {
|
||||
if ($requestType == 'Characteristic') {
|
||||
$updatedWorkId = '3';
|
||||
} elseif ($requestType == 'Quality') {
|
||||
$updatedWorkId = '3';
|
||||
}
|
||||
}
|
||||
|
||||
ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $MachineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->update([
|
||||
'has_work_flow_id' => $updatedWorkId,
|
||||
'updated_at' => now(),
|
||||
'updated_by' => $userName,
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'work_flow_ids' => [$approvalId],
|
||||
], 200);
|
||||
@@ -4100,7 +4281,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "User name '{$userName}' not found for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Design Manager', 'Design Supervisor', 'Design Employee'])) {
|
||||
} elseif (! $user->hasRole(['Super Admin', 'Laser Manager', 'Laser Supervisor', 'Laser Employee'])) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'User does not have rights!',
|
||||
|
||||
Reference in New Issue
Block a user