0
私は、ユーザーが持つすべての注文を一覧表示するページを持っています。各注文には1つ以上の添付文書とダウンロード用のボタンがあります。ユーザーが2桁を持っているならば、彼はページ上の2つのボタンブレードテンプレートのモーダルウィンドウは、選択されたIDの代わりにすべてのレコードを表示します
<a href="#files-{{ $download->order_id }}">Download</a> // order 1
<a href="#files-{{ $download->order_id }}">Download</a> // order 2
を持つことになり、基本的にボタンをクリックすると、ダウンロードするには、表示されているファイルやリンクを開いたモーダルウィンドウです。
これは、これは問題がモーダルが開いているとき、それはリストのすべての注文と、すべてのファイルであるということです
$downloadableOrders = Order::where('user_id', getCurrentUser()->user_id)
->select("orders.*",\DB::raw("GROUP_CONCAT(documents.id ) as docname"))
->leftjoin("documents",\DB::raw("FIND_IN_SET(documents.id,orders.order_downloadable)"),">",\DB::raw("'0'"))
->groupBy("orders.order_id")
->paginate(10);
を使用したクエリです
<span id="start" class="target"></span>
<span id="files-{{ $download->order_id }}" class="target"></span>
<div class="modal">
<div class="content vertical-align-middle">
<h2>Click on the button to download it</h2>
<table class="table table-striped">
<thead id="tblHead">
<tr>
<th align="center">File</th>
<th align="center">Action</th>
</tr>
</thead>
<tbody>
@foreach($downloadableOrders as $files)
@if($files->status == 1)
{{--*/ $ids = explode(",", $files->docname); /*--}}
@foreach ($ids as $id)
<tr>
<td></td>
<td><a href="{{ URL::to('/files/download/' . $id . '?_token=' . csrf_token()) }}">Download</a></td>
</tr>
@endforeach
@endif
@endforeach
</tbody>
</table>
<a class="close-btn" href="#start">X</a>
</div>
</div>
モーダルウィンドウです。クリックされたオーダーのファイルのみを一覧表示する必要があります。
ajaxのないオプションはありますか?このモーダルはJSを全く使用しません – Ivan
モーダルはjs構文を使用して開くこともできます。 ex - $( '#myModal')。modal( 'toggle'); 私の答えで言ったことを試してください。そして、ajaxの成功で上記の構文を使ってモーダルボックスを開くことができます。 –
申し訳ありませんが、私はJSを全く使用したくないということです。だから私はこの純粋なCSS/HTMlのモーダルを使用しています – Ivan