Added view rights against plant on import and export
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
This commit is contained in:
@@ -14,59 +14,60 @@ class EquipmentMasterExporter extends Exporter
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('machine.name')
|
||||
->label('MACHINE NAME'),
|
||||
->label('MACHINE NAME'),
|
||||
ExportColumn::make('name')
|
||||
->label('NAME'),
|
||||
->label('NAME'),
|
||||
ExportColumn::make('description')
|
||||
->label('DESCRIPTION'),
|
||||
->label('DESCRIPTION'),
|
||||
ExportColumn::make('make')
|
||||
->label('MAKE'),
|
||||
->label('MAKE'),
|
||||
ExportColumn::make('model')
|
||||
->label('MODEL'),
|
||||
->label('MODEL'),
|
||||
ExportColumn::make('equipment_number')
|
||||
->label('EQUIPMENT NUMBER'),
|
||||
->label('EQUIPMENT NUMBER'),
|
||||
ExportColumn::make('instrument_serial_number')
|
||||
->label('INSTRUMENT SERIAL NUMBER'),
|
||||
->label('INSTRUMENT SERIAL NUMBER'),
|
||||
ExportColumn::make('calibrated_on')
|
||||
->label('CALIBRATED ON'),
|
||||
->label('CALIBRATED ON'),
|
||||
ExportColumn::make('frequency')
|
||||
->label('FREQUENCY'),
|
||||
->label('FREQUENCY'),
|
||||
ExportColumn::make('next_calibration_date')
|
||||
->label('NEXT CALIBRATION DATE'),
|
||||
->label('NEXT CALIBRATION DATE'),
|
||||
ExportColumn::make('calibrated_by')
|
||||
->label('CALIBRATED BY'),
|
||||
->label('CALIBRATED BY'),
|
||||
ExportColumn::make('calibration_certificate')
|
||||
->label('CALIBRATION CERTIFICATE'),
|
||||
->label('CALIBRATION CERTIFICATE'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your equipment master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
$body = 'Your equipment master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -16,17 +16,17 @@ class EquipmentMasterImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Machine Name')
|
||||
->example('1006378')
|
||||
->label('Machine Name')
|
||||
->relationship(resolveUsing:'name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('name')
|
||||
->label('Name')
|
||||
@@ -93,15 +93,15 @@ class EquipmentMasterImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new EquipmentMaster();
|
||||
return new EquipmentMaster;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your equipment master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
$body = 'Your equipment master import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
Reference in New Issue
Block a user