Modal window in blade template shows all records instead of selected ID(s)

user7956165

I have table on page which list all orders which user has. Each order can have 1 or more attached documents and a button for download. Basically if the user has 2 orders he will have 2 buttons on his page

<a href="#files-{{ $download->order_id }}">Download</a> // order 1
<a href="#files-{{ $download->order_id }}">Download</a> // order 2

Clicking on the button is open modal window with files listed and link to download.

This is the modal window

        <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>

This is the query which is used

$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);

The problem is that when modal is open it's lists all orders and all files. Should list files only for the clicked order.

Mr.Gandhi

You will have to open the modal box using ajax. So what you need to do is when you click on the Download link ajax will execute, get the data and show it in the modal box.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

MySQL Delete All Records Not Selected

From Dev

Open window such that is shows on all desktops

From Dev

nodejs shows one records instead of three records in the database

From Dev

Get all Rails records from an array of IDs

From Dev

Link to launch modal window instead of image?

From Dev

OpenGL window shows stuff from background windows instead of blank window

From Dev

OpenGL window shows stuff from background windows instead of blank window

From Dev

is there a way to include a blade template instead of plain html using phpwkhtmltopdf?

From Dev

Show all records when a filter option is not selected

From Dev

Show all records when a filter option is not selected

From Dev

Add Selected Users Ids to List Instead of Position in Android

From Dev

Slideshow image shows up in front of Modal window - updated with jsfiddle

From Dev

Morphing Modal Window broke all background fixed

From Dev

check if all functions are true and then execute modal window

From Dev

ActiveRecord deleting all records instead of one

From Dev

Require all records instead of distinct in Sql Server

From Dev

SQL - Find all "Relationship IDs" where key equals value, then select all records containing those "Relationship IDs"

From Dev

SQL - Find all "Relationship IDs" where key equals value, then select all records containing those "Relationship IDs"

From Dev

How to open Angular modal window with selected data from table

From Dev

Get all matching records where IDs are joined to a comma separated list

From Dev

Loop through all classes and Ids of selected element and its childs

From Dev

check if all elements with similar IDs are selected using jQuery

From Dev

How to get all the IDs of selected nodes to root node in jsTree?

From Dev

Laravel 5 blade shows a blank page when there is error instead of throwing exception

From Dev

open external links in modal instead of new tab or new window

From Dev

percolate:synced-cron shows only 2 records all the time

From Dev

Running count shows all values instead of the total number of values

From Dev

How can i select all(selected) records in a mongo find?

From Dev

Minimize all application windows when a modal window gets minimized (on Linux)

Related Related

  1. 1

    MySQL Delete All Records Not Selected

  2. 2

    Open window such that is shows on all desktops

  3. 3

    nodejs shows one records instead of three records in the database

  4. 4

    Get all Rails records from an array of IDs

  5. 5

    Link to launch modal window instead of image?

  6. 6

    OpenGL window shows stuff from background windows instead of blank window

  7. 7

    OpenGL window shows stuff from background windows instead of blank window

  8. 8

    is there a way to include a blade template instead of plain html using phpwkhtmltopdf?

  9. 9

    Show all records when a filter option is not selected

  10. 10

    Show all records when a filter option is not selected

  11. 11

    Add Selected Users Ids to List Instead of Position in Android

  12. 12

    Slideshow image shows up in front of Modal window - updated with jsfiddle

  13. 13

    Morphing Modal Window broke all background fixed

  14. 14

    check if all functions are true and then execute modal window

  15. 15

    ActiveRecord deleting all records instead of one

  16. 16

    Require all records instead of distinct in Sql Server

  17. 17

    SQL - Find all "Relationship IDs" where key equals value, then select all records containing those "Relationship IDs"

  18. 18

    SQL - Find all "Relationship IDs" where key equals value, then select all records containing those "Relationship IDs"

  19. 19

    How to open Angular modal window with selected data from table

  20. 20

    Get all matching records where IDs are joined to a comma separated list

  21. 21

    Loop through all classes and Ids of selected element and its childs

  22. 22

    check if all elements with similar IDs are selected using jQuery

  23. 23

    How to get all the IDs of selected nodes to root node in jsTree?

  24. 24

    Laravel 5 blade shows a blank page when there is error instead of throwing exception

  25. 25

    open external links in modal instead of new tab or new window

  26. 26

    percolate:synced-cron shows only 2 records all the time

  27. 27

    Running count shows all values instead of the total number of values

  28. 28

    How can i select all(selected) records in a mongo find?

  29. 29

    Minimize all application windows when a modal window gets minimized (on Linux)

HotTag

Archive