BulkAction not getting data from modal submit

I have a table of facture, my bulk action should open a modal displaying a table where user can select for each $row which one of the associated files whants to download.
BulkAction::make('Descargar Documentos')
->icon('heroicon-m-arrow-down')
->action(function ($records, array $data){
//Code for navigate modal response and create zip file
})
->modalContent(function ($records) {
return new HtmlString(
Blade::render('livewire.balance.download-documents-table', [
'records' => $records,
])
);
})
->modalHeading('Descargar documentos')
->modalSubmitActionLabel('OK')
->modalCancelActionLabel('Cancelar'),
BulkAction::make('Descargar Documentos')
->icon('heroicon-m-arrow-down')
->action(function ($records, array $data){
//Code for navigate modal response and create zip file
})
->modalContent(function ($records) {
return new HtmlString(
Blade::render('livewire.balance.download-documents-table', [
'records' => $records,
])
);
})
->modalHeading('Descargar documentos')
->modalSubmitActionLabel('OK')
->modalCancelActionLabel('Cancelar'),
How can I access the downloadForm data in the action to create the zip. Thanks in advance.
1 Reply
ScareCrow
ScareCrowOP2mo ago
<div style="overflow-x: auto;">
<form id="downloadForm">
<table style="width: 100%; border-collapse: collapse;">
<thead>
<tr>
<th>PDF</th>
<th>XML</th>
<th>Remisiones</th>
</tr>
</thead>
<tbody>
@foreach ($records as $record)
<tr>
<td>
<input type="checkbox" name="pdf_{{ $record->id }}" {{ !$record->pdf ? 'disabled' : 'checked' }}>
</td>
<td>
<input type="checkbox" name="xml_{{ $record->id }}" {{ !$record->xml ? 'disabled' : 'checked' }}>
</td>
<td>
<input type="checkbox" name="remisiones_{{ $record->id }}" {{ !$record->remisiones ? 'disabled' : 'checked' }}>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
<div style="overflow-x: auto;">
<form id="downloadForm">
<table style="width: 100%; border-collapse: collapse;">
<thead>
<tr>
<th>PDF</th>
<th>XML</th>
<th>Remisiones</th>
</tr>
</thead>
<tbody>
@foreach ($records as $record)
<tr>
<td>
<input type="checkbox" name="pdf_{{ $record->id }}" {{ !$record->pdf ? 'disabled' : 'checked' }}>
</td>
<td>
<input type="checkbox" name="xml_{{ $record->id }}" {{ !$record->xml ? 'disabled' : 'checked' }}>
</td>
<td>
<input type="checkbox" name="remisiones_{{ $record->id }}" {{ !$record->remisiones ? 'disabled' : 'checked' }}>
</td>
</tr>
@endforeach
</tbody>
</table>
</form>
</div>
This is the 'livewire.balance.download-documents-table'

Did you find this page helpful?