vendredi 4 octobre 2019

How to display tags on pop up? laravel

I have a simple page table in which I am displaying page list, visual looks like this.

enter image description here

Expected result :

Now I want when a user clicks view tags it should display the tags related to that page

eg if a user clicks view tag on row one with ID 6 it should display tag tes1 in a pop up modal if a user clicks view tag on row one with ID 7 it should display a tag named test2 in a pop up modal

Problem:

Now when user clicks a button view tags in either row I get the following result

enter image description here

Here is how I display tags in a pop up when user clicks view tags button

<button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#exampleModal">
    
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Tag List</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <table class="table">
                    <thead class=" text-primary">
                        <th>
                            ID
                        </th>
                        <th>
                            name
                        </th>
                    </thead>
                    <tbody>
                        @foreach ($page->tags as $tag)
                        <tr>
                            <td>
                                
                            </td>
                            <td>
                                
                            </td>
                        </tr>
                        @endforeach

                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div>
    </div>
</div>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire