I want when I click link in my table row , it call 'Dialog' box and show selected row table value. So, I want to pass my click link id or some parameter through URL.I use Laravel 5 to code this project.
this is my table code.
<tbody>
@foreach ($basl_officers as $basl_officer)
<tr>
<td><a href="#myModal?id = <?php echo $basl_officer->code ?>" class="" data-toggle="modal" > {{ $basl_officer->code }} </a></td>
<td><a href="#myModal" class="" data-toggle="modal"> {{ $basl_officer->officerName }} </a></td>
<td align='center'>
{!! Form::open(['method' => 'DELETE', 'route'=>['basl_officers_page.destroy',$basl_officer->id]]) !!}
<a href="{{route('basl_officers_page.edit',$basl_officer->id)}}" class="btn btn-default btn-sm"> <span class="glyphicon glyphicon-pencil"></span> </a>    
<button type="submit" class="btn btn-default btn-sm" onclick="return confirm('Are you sure?')"> <span class="glyphicon glyphicon-trash"></span> </button>
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
when i click first link it url show like this.
http://ift.tt/1V4Cqf7 = B002
but I couldn't call myModel.
Dialog box code.
<div class="modal fade" id="myModal/id ={id}" role="dialog">
<div class="modal-dialog">
echo $basl_officers[];
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn btn-default" style='float: right;' data-dismiss="modal"><span class="glyphicon glyphicon-remove-circle"></span></button>
<a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-trash"></span> </a>
<a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-pencil"></span> </a>
<h4 class="modal-title">BASL Officers Details</h4>
</div>
<!-- text input -->
<div class="modal-body">
{!! Form::label('o_code', 'Officers Code: '); !!}
{!! Form::text('officers_code', null, ['class' => 'form-control', 'id' => 'officers_code','disabled' => 'disabled']); !!}
{!! Form::label('o_name', 'Officers Name: '); !!}
{!! Form::text('officers_name', null, ['class' => 'form-control', 'id' => 'officers_name','disabled' => 'disabled']); !!}
</div>
</div>
</div>
if I change id like in 2 nd link ,when put URl #myModel and model id also change only myModel every thing working fine. please , expect some help. I try to do this within one week.
All class code for your better understanding.
@extends('layouts.app')
@section('slide_bar')
@include('layouts.master_entry_slide_bar')
@endsection
@section('content')
<section class="content-header">
<h1>BASL Officers <small>page </small></h1>
</section>
<br/>
<!-- Main content -->
<section class="content fluid">
<div class="row">
<div class="box">
<div class="gap">
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<col width='auto'>
<col width='auto'>
<col width='100'>
<thead>
<tr>
<th>BASL Officers Code</th>
<th>BASL Officers Name</th>
<th><p id='buttons'> <a href="{{ route('basl_officers_page.create')}}" class="btn btn-success"> <strong> Add New Officers   </strong> <span class="glyphicon glyphicon-plus"></span> </a> </p></th>
</tr>
</thead>
<tbody>
@foreach ($basl_officers as $basl_officer)
<tr>
<td><a href="#myModal?id = <?php echo $basl_officer->code ?>" class="" data-toggle="modal" > {{ $basl_officer->code }} </a></td>
<td><a href="#myModal" class="" data-toggle="modal"> {{ $basl_officer->officerName }} </a></td>
<td align='center'>
{!! Form::open(['method' => 'DELETE', 'route'=>['basl_officers_page.destroy',$basl_officer->id]]) !!}
<a href="{{route('basl_officers_page.edit',$basl_officer->id)}}" class="btn btn-default btn-sm"> <span class="glyphicon glyphicon-pencil"></span> </a>    
<button type="submit" class="btn btn-default btn-sm" onclick="return confirm('Are you sure?')"> <span class="glyphicon glyphicon-trash"></span> </button>
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th>BASL Officers Code</th>
<th>BASL Officers Name</th>
<th></th>
</tr>
</tfoot>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
</div><!-- /.row -->
</section><!-- /.content -->
<!-- Modal -->
<div class="modal fade" id="myModal/id ={id}" role="dialog">
<div class="modal-dialog">
echo $basl_officers[];
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="btn btn-default" style='float: right;' data-dismiss="modal"><span class="glyphicon glyphicon-remove-circle"></span></button>
<a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-trash"></span> </a>
<a href="#" class="btn btn-default" style='float: right;'> <span class="glyphicon glyphicon-pencil"></span> </a>
<h4 class="modal-title">BASL Officers Details</h4>
</div>
<!-- text input -->
<div class="modal-body">
{!! Form::label('o_code', 'Officers Code: '); !!}
{!! Form::text('officers_code', null, ['class' => 'form-control', 'id' => 'officers_code','disabled' => 'disabled']); !!}
{!! Form::label('o_name', 'Officers Name: '); !!}
{!! Form::text('officers_name', null, ['class' => 'form-control', 'id' => 'officers_name','disabled' => 'disabled']); !!}
</div>
</div>
</div>
</div>
<script>
var name = document.getElementById("master_entry");
document.getElementById("master_entry").className = "active";
var slide_bar_element = document.getElementById("bd_menu");
document.getElementById("bd_menu").className = "active";
var slide_bar_element = document.getElementById("bd_submenu1");
document.getElementById("bd_submenu1").className = "active";
</script>
@endsection
Really ,I want $basl_officers array iterate and get value by index. eg. $basl_officers[0]. so I try to pass this index through url.expect some help.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire