1
0
forked from poc/pds

Added No column for all resource tables page

This commit is contained in:
dhanabalan
2025-07-31 18:16:51 +05:30
parent 1ea00b6901
commit 4bfbebb254
5 changed files with 40 additions and 21 deletions

View File

@@ -54,10 +54,14 @@ class DeviceMasterResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id') Tables\Columns\TextColumn::make('No.')
->label('ID') ->label('No.')
->numeric() ->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
->sortable(), $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') Tables\Columns\TextColumn::make('plant.name')
->label('Plant') ->label('Plant')
->alignCenter() ->alignCenter()

View File

@@ -66,10 +66,14 @@ class MfmMeterResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id') Tables\Columns\TextColumn::make('No.')
->label('ID') ->label('No.')
->numeric() ->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
->sortable(), $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') Tables\Columns\TextColumn::make('plant.name')
->label('Plant') ->label('Plant')
->sortable(), ->sortable(),

View File

@@ -73,10 +73,14 @@ class MfmParameterResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id') Tables\Columns\TextColumn::make('No.')
->label('ID') ->label('No.')
->numeric() ->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
->sortable(), $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') Tables\Columns\TextColumn::make('plant.name')
->label('Plant') ->label('Plant')
->alignCenter() ->alignCenter()

View File

@@ -60,11 +60,14 @@ class MfmReadingResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id') Tables\Columns\TextColumn::make('No.')
->label('ID') ->label('No.')
->alignCenter() ->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
->numeric() $paginator = $livewire->getTableRecords();
->sortable(), $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') Tables\Columns\TextColumn::make('plant.name')
->label('Plant') ->label('Plant')
->alignCenter() ->alignCenter()

View File

@@ -62,10 +62,14 @@ class TempLiveReadingResource extends Resource
{ {
return $table return $table
->columns([ ->columns([
Tables\Columns\TextColumn::make('id') Tables\Columns\TextColumn::make('No.')
->label('ID') ->label('No.')
->numeric() ->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
->sortable(), $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') Tables\Columns\TextColumn::make('plant.name')
->numeric() ->numeric()
->sortable(), ->sortable(),