jeudi 31 octobre 2019

What method of filter i should use on laravel?

Im now ready all the stuff and ready to use, but then i want to set a filter that ( ' if the item status shows as "freeze", do not show in the drop-down selection again )

For example, i set the first 'description11' as freeze, so i want the dropdown selection for ' description11' don't show up, how to set it ?

VIEW[view]: https://i.stack.imgur.com/PuIBD.png

The Dropdown selection picture:

enter code here

@extends('master')


        @if(\Session::has('success'))
            <div class="alert alert-success">
                <p></p>
            </div>
        @endif

        <form method="post" action="">
            
            @csrf
            <div class="form-group">
                <label for="bit_app_policy_category_code">Code<span class="required">*</span></label>
                <input id="bit_app_policy_category_code" type="text" name="code" class="form-control" placeholder="Please Enter the Code" />
            </div>
            <div class="form-group">
                <label for="bit_app_policy_category_desc">Description<span class="required">*</span></label>
                <input id="bit_app_policy_category_desc" type="text" name="description" class="form-control" placeholder="Please Enter the Description" />
            </div>

            <input  type="hidden"
                    name="parent_id"
                    value=""
            />

            <div class="form-group">
                <label for="bit_app_policy_category_parent">Parent Category</label>

                <select id="bit_app_policy_category_parent"  name="parent_id" class="form-control">

                    @foreach($parents as $parent)
                        <option value=""> </option>
                    @endforeach
                </select>
            </div>

            <div class="form-group">
                <label for="bit_app_policy_category_status">Status<span class="required">*</span></label>

                <select id="bit_app_policy_category_status"  name="status" class="form-control">
                    <option value="Active">Active</option>
                    <option value="Freeze">Freeze</option>
                </select>
            </div>


            <div class="form-group">
                <a href="" class="btn btn-primary">Back</a>
                <a href="" class="btn btn-primary">Back to Home Page</a>
              <input type="submit" class="btn btn-primary"/>
            </div>
        </form>
    </div>
</div>

my index file

@extends('master')

@section('content')

<div class="row">
    <div class="col-md-12">
        <br />
        <h3 align="center">Category Data</h3>
        <br />
        @if($message = Session::get('success'))
            <div class="alert alert-success">
                <p></p>
            </div>
        @endif
        <div align="right">
            <a href="" class="btn btn-primary">Add</a>
            <a href="" class="btn btn-primary">Back to Home Page</a>

            <br />
            <br />
        </div>
        <table class="table table-bordered table-striped">
            <tr>
                <th>Id</th>
                <th>Code</th>
                <th>Description</th>
                <th>Parent</th>
                <th>Status</th>
                <th>Action</th>
                <th>Action</th>
            </tr>
            @foreach($category as $row)

                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>

                    <td><a href="" class="btn btn-warning">Edit</a></td>
                    <td>
                        <form method="post" class="delete_form" action="">
                            
                            

                            <input type="hidden" name="_method" value="DELETE"  />
                            <button type="submit" class="btn btn-danger">Delete</button>
                        </form>
                    </td>
                </tr>
            @endforeach
        </table>
    </div>
</div>
<script>
    $(document).ready(function () {
        $('.delete_form').on('submit', function () {
            if (confirm("Are you sure you want to delete it"))
            {
            return true;
            } else
                {
                return false;
            }
        });
    });
 </script>
@endsection


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire