ranjith-dev #973
@@ -22,79 +22,79 @@ class CharacteristicApproverMasterImporter extends Importer
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->examples(['1000', '1000'])
|
||||
->examples(['1000', '1000', '1000'])
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Work Center')
|
||||
->examples(['RMGLAS02', 'RMGLAS02'])
|
||||
->examples(['RMGLAS02', 'RMGLAS02', 'RMGLAS02'])
|
||||
->label('Work Center')
|
||||
->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('approver_type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Type')
|
||||
->examples(['Characteristic', 'Quality'])
|
||||
->examples(['Characteristic', 'Quality', 'Stop'])
|
||||
->label('Approver Type'),
|
||||
ImportColumn::make('machine_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Machine Name')
|
||||
->examples(['15002635', '17002635'])
|
||||
->examples(['15002635', '16002635', '17002635'])
|
||||
->label('Machine Name'),
|
||||
ImportColumn::make('characteristic_field')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Master Characteristic Field')
|
||||
->examples(['NIL', 'MV SERIES'])
|
||||
->examples(['NIL', 'MV SERIES', 'MVHS SERIES'])
|
||||
->label('Master Characteristic Field'),
|
||||
ImportColumn::make('name1')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 1')
|
||||
->examples(['Test 1', 'Test 4'])
|
||||
->examples(['Test 1', 'Test 4', 'Test 7'])
|
||||
->label('Approver Name 1'),
|
||||
ImportColumn::make('mail1')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 1')
|
||||
->examples(['test1@cripumps.com', 'test4@cripumps.com'])
|
||||
->examples(['test1@cripumps.com', 'test4@cripumps.com', 'test7@cripumps.com'])
|
||||
->label('Mail 1'),
|
||||
ImportColumn::make('duration1')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 1')
|
||||
->examples(['0.05', '0.30'])
|
||||
->examples(['0.05', '0.30', '0.30'])
|
||||
->label('Duration 1'),
|
||||
ImportColumn::make('name2')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 2')
|
||||
->examples(['Test 2', 'Test 5'])
|
||||
->examples(['Test 2', 'Test 5', 'Test 8'])
|
||||
->label('Approver Name 2'),
|
||||
ImportColumn::make('mail2')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 2')
|
||||
->examples(['test2@cripumps.com', 'test5@cripumps.com'])
|
||||
->examples(['test2@cripumps.com', 'test5@cripumps.com', 'test8@cripumps.com'])
|
||||
->label('Mail 2'),
|
||||
ImportColumn::make('duration2')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 2')
|
||||
->examples(['0.05', '0.30'])
|
||||
->examples(['0.05', '0.30', '0.30'])
|
||||
->label('Duration 2'),
|
||||
ImportColumn::make('name3')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Approver Name 3')
|
||||
->examples(['Test 3', 'Test 6'])
|
||||
->examples(['Test 3', 'Test 6', 'Test 9'])
|
||||
->label('Approver Name 3'),
|
||||
ImportColumn::make('mail3')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Mail 3')
|
||||
->examples(['test3@cripumps.com', 'test6@cripumps.com'])
|
||||
->examples(['test3@cripumps.com', 'test6@cripumps.com', 'test9@cripumps.com'])
|
||||
->label('Mail 3'),
|
||||
ImportColumn::make('duration3')
|
||||
->numeric()
|
||||
->requiredMapping()
|
||||
->exampleHeader('Duration 3')
|
||||
->examples(['0.05', '0.30'])
|
||||
->examples(['0.05', '0.30', '0.30'])
|
||||
->label('Duration 3'),
|
||||
];
|
||||
}
|
||||
@@ -135,8 +135,8 @@ class CharacteristicApproverMasterImporter extends Importer
|
||||
if ($workCenter == null || $workCenter == '') {
|
||||
$warnMsg[] = "Work center can't be empty!";
|
||||
}
|
||||
if ($apprTyp == '' || $apprTyp == null || ($apprTyp != 'Characteristic' && $apprTyp != 'Quality')) {
|
||||
$warnMsg[] = "Approver type must be either 'Characteristic' or 'Quality'!";
|
||||
if ($apprTyp == '' || $apprTyp == null || ($apprTyp != 'Characteristic' && $apprTyp != 'Quality' && $apprTyp != 'Stop')) {
|
||||
$warnMsg[] = "Approver type must be either 'Characteristic', 'Quality', or 'Stop'!";
|
||||
}
|
||||
if ($machineNam == null || $machineNam == '') {
|
||||
$warnMsg[] = "Machine name can't be empty!";
|
||||
|
||||
@@ -128,6 +128,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
return [
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
];
|
||||
})
|
||||
->default(function () {
|
||||
@@ -452,6 +453,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->options([
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
])
|
||||
->placeholder('Select Type')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
@@ -467,7 +469,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
->placeholder('Enter Characteristic Field'),
|
||||
TextInput::make('name1')
|
||||
->label('Approver Name 1')
|
||||
->placeholder('Enter Approver Name 2')
|
||||
->placeholder('Enter Approver Name 1')
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('name2', null);
|
||||
$set('name3', null);
|
||||
@@ -480,7 +482,7 @@ class CharacteristicApproverMasterResource extends Resource
|
||||
}),
|
||||
TextInput::make('name3')
|
||||
->label('Approver Name 3')
|
||||
->placeholder('Enter Approver Name 2'),
|
||||
->placeholder('Enter Approver Name 3'),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder('Select From DateTime')
|
||||
|
||||
@@ -10,7 +10,6 @@ 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;
|
||||
@@ -30,7 +29,6 @@ use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
@@ -42,6 +40,8 @@ class RequestCharacteristicResource extends Resource
|
||||
|
||||
protected static ?string $navigationGroup = 'Laser Marking';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -133,8 +133,8 @@ class RequestCharacteristicResource extends Resource
|
||||
})
|
||||
->disabled(fn ($get) => self::isFieldDisabled($get)),
|
||||
Forms\Components\Hidden::make('show_validation_image')
|
||||
->reactive()
|
||||
->default(false),
|
||||
->reactive()
|
||||
->default(false),
|
||||
Forms\Components\Hidden::make('validation1_image_url')
|
||||
->reactive(),
|
||||
|
||||
@@ -165,17 +165,19 @@ class RequestCharacteristicResource extends Resource
|
||||
|
||||
if ($currentState == true) {
|
||||
$set('validation1_image_url', null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$workFlowId = $get('work_flow_id');
|
||||
|
||||
if (!$workFlowId) {
|
||||
if (! $workFlowId) {
|
||||
Notification::make()
|
||||
->title('Missing Workflow ID')
|
||||
->body('Please select a Workflow ID.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -320,11 +322,13 @@ class RequestCharacteristicResource extends Resource
|
||||
return [
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
];
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$appTyp = $get('approver_type');
|
||||
$set('characteristic_approver_master_id', null);
|
||||
if ($get('approver_type') != 'Characteristic') {
|
||||
if ($appTyp != 'Characteristic') {
|
||||
$set('characteristic_name', null);
|
||||
$set('current_value', null);
|
||||
$set('update_value', null);
|
||||
@@ -1245,6 +1249,7 @@ class RequestCharacteristicResource extends Resource
|
||||
->options([
|
||||
'Characteristic' => 'Characteristic',
|
||||
'Quality' => 'Quality',
|
||||
'Stop' => 'Stop',
|
||||
])
|
||||
->placeholder('Select Request Type'),
|
||||
TextInput::make('master_characteristic_field')
|
||||
@@ -1308,7 +1313,7 @@ class RequestCharacteristicResource extends Resource
|
||||
])
|
||||
->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['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field'])&& empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field']) && empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
@@ -1342,19 +1347,19 @@ class RequestCharacteristicResource extends Resource
|
||||
$query->where('work_flow_id', 'like', '%'.$data['work_flow_id'].'%');
|
||||
}
|
||||
|
||||
if (!empty($data['machine_name'])) {
|
||||
if (! empty($data['machine_name'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.machine_name', '=', (string) $data['machine_name']);
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($data['request_type'])) {
|
||||
if (! empty($data['request_type'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.approver_type', '=', (string) $data['request_type']);
|
||||
});
|
||||
}
|
||||
|
||||
if (!empty($data['master_characteristic_field'])) {
|
||||
if (! empty($data['master_characteristic_field'])) {
|
||||
$query->whereHas('characteristicApproverMaster', function ($q) use ($data) {
|
||||
$q->where('characteristic_approver_masters.characteristic_field', '=', (string) $data['master_characteristic_field']);
|
||||
});
|
||||
@@ -1372,7 +1377,7 @@ class RequestCharacteristicResource extends Resource
|
||||
$query->where('approver_status3', 'like', '%'.$data['approver_status3'].'%');
|
||||
}
|
||||
|
||||
if (!empty($data['approver_status'])) {
|
||||
if (! empty($data['approver_status'])) {
|
||||
|
||||
$status = $data['approver_status'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user