Where clause with multiple values in Laravel 5.7 - php

I'm trying to make a report for the bus transport system, the report's form has "Driver" and "Route" fields. It works fine when I select "Driver" to get a report or select only "Route" to get the report, but there is something wrong when I choose both "Driver and Route." Any assistance would be appreciated
View/Form
<form action="" method="get">
<div class="row">
<div class="col-md-3 form-group">
<label>From Date:</label>
<input type="date" name="start" class="form-control">
</div>
<div class="col-md-3 form-group">
<label>To Date:</label>
<input type="date" name="end" class="form-control">
</div>
</div>
<div class="row">
<div class="col-md-3" id="route_content">
<label>Route</label>
<select name="routeid" id="route_id" class="js-example-placeholder-singleuserid js-states form-control"
style="width: 100%; height:40px;">
<option></option>
<?php foreach ($routes as $key => $value): ?>
<option value="{{$value->id}}">{{$value->from}} -> {{$value->to}}</option>
<?php endforeach ?>
</select>
</div>
<div class="col-md-3" id="driver_content" z>
<label>Driver</label>
<select name="driverid" id="driver_id" class="js-example-placeholder-single js-states form-control"
style="width: 100%; height:40px;">
<option></option>
<?php foreach ($driver as $key => $value): ?>
<option value="{{$value->id}}"> {{$value->name}} </option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="row">
<div class="col-md-3 form-group">
<button class="btn btn-info btn-md" style="margin-top: 27px;">Search</button>
</div>
</div>
</form>
Route
Route::get('post_genral_report/{start?}/{end?}' ,
'reportController#post_genral_report')->name('abd');
Controller
public function post_genral_report(Request $request, $start = null, $end = null)
{
$data = DB::table('registration_tickets')
->join('trips', 'trips.id', 'registration_tickets.trip_id')
->join('buses', 'buses.id', 'trips.bus_id')
->join('drivers', 'drivers.id', 'trips.driver_id')
->join('routes', 'routes.id', 'trips.route_id')
->join('provinces as p1', 'p1.id', 'routes.from')
->join('provinces as p2', 'p2.id', 'routes.to')
->select('registration_tickets.*', 'p1.name as from', 'p2.name as to', 'buses.type', 'buses.plate',
'drivers.name as d_name', 'drivers.lastname as lname');
if ($start and $end) {
$data->whereBetween('registration_tickets.date', [
$start,
$end
]);
}
if ($request->driverid) {
$data->where('trips.driver_id', $request->driverid);
}
if ($request->routeid) {
$data->where('trips.route_id', $request->routeid);
}
if ($request->driverid and $request->routeid) {
$data->where([
'trips.driver_id', '=', $request->driverid,
'trips.route_id', '=', $request->routeid
]);
}
$data = $data->get();
return Datatables::of($data)->make(true);
}

You need to modify the part where you are using both driver_id and route_id to below to achieve your purpose (because as per your code, it seems that you want the results when both of route_id or driver_id falls between the start and end date, however your code checks the driver_id and route_id individually for where condition. You need to wrap them in a where and use nested where in it):
if ($request->driverid and $request->routeid) {
$data->where(function($q) use ($request)
{
$q->where('trips.driver_id', '=', $request->driverid)
->where('trips.route_id', '=', $request->routeid);
});
}

Related

Laravel 8 throws undefined offset how to handle it?

here I have form to retrieve data from database using date and time issue is iam able to retrive data succesfuly most times but some time i get this error
here is the code
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\PricingDetail;
use App\AccessoryCharge;
use App\Discount;
use App\MonthlyCourtCharge;
class PricingDetailController extends Controller
{
public function index(Request $request){
$op_id=$request->session()->get('op_id');
$inf_id=$request->session()->get('inf_id');
if(is_null($inf_id)){
return redirect('/infrastructure_details');
}else if(is_null($op_id)){
return redirect('/operational_details');
}else{
$timings=DB::table('operational_details')
->select('opening_time','closing_time')
->where('infrastructure_details_id',$inf_id)
->first();
$pricing_details=[];
$pricing_details=DB::table('pricing_details')
->where('infrastructure_details_id','=',$inf_id)
->get();
$accessory_charges=[];
$accessory_charges=DB::table('accessory_charges')
->where('infrastructure_details_id','=',$inf_id)
->get();
$discounts=[];
$discounts=DB::table('discounts')
->where('infrastructure_details_id','=',$inf_id)
->get();
$monthly_charges=[];
$monthly_charges=DB::table('monthly_court_charges')
->where('infrastructure_details_id','=',$inf_id)
->get();
if(($pricing_details->count())>0){
$request->session()->put('price_id',$pricing_details[0]->id);
}
return view('pricing_details',['inf_id'=>$inf_id,'op_id'=>$op_id,'timings'=>$timings,'pricing_details'=>$pricing_details,'acc_charges'=>$accessory_charges,'discounts'=>$discounts,'monthly_charges'=>$monthly_charges]);
}
//return view('pricing_details',['timings'=>$timings]);
//return view('home',['court_types'=>$court_types]);
}
public function create(Request $request){
$diff=$request->input('diff');
$no_accessories=$request->input('no_accessories');
$no_discounts=$request->input('no_discounts');
$no_monthly_charges=$request->input('no_monthly_charges');
for($i=0;$i<$diff;$i++){
$pricing_details=new PricingDetail;
$pricing_details->timings=$request->input('time'.$i);
$pricing_details->price=$request->input('price'.$i);
$pricing_details->discount=$request->input('discount'.$i);
$pricing_details->discounted_price=$request->input('discounted_price'.$i);
$pricing_details->disc_from_date=$request->input('disc_from_date'.$i);
$pricing_details->disc_to_date=$request->input('disc_to_date'.$i);
$pricing_details->infrastructure_details_id=$request->input('inf_id');
$pricing_details->operational_details_id=$request->input('op_id');
$pricing_details->day_types_id=$request->input('day_type'.$i);
$pricing_details->save();
}
for($i=1;$i<=$no_accessories;$i++){
$accessory_charge=new AccessoryCharge;
$accessory_charge->item=ucfirst($request->input('item'.$i));
$accessory_charge->brand=ucfirst($request->input('brand'.$i));
$accessory_charge->price=$request->input('acc_price'.$i);
$accessory_charge->quantity=$request->input('quantity'.$i);
$accessory_charge->return_type=$request->input('return_type'.$i);
$accessory_charge->infrastructure_details_id=$request->input('inf_id');
$accessory_charge->operational_details_id=$request->input('op_id');
$accessory_charge->save();
}
for($i=1;$i<=$no_monthly_charges;$i++){
$monthly_charge=new MonthlyCourtCharge;
$monthly_charge->infrastructure_details_id=$request->input('inf_id');
$no_days=0;
$scheme_type=$request->input('scheme_type'.$i);
if($scheme_type=="scheme1"){
$no_days=22;
}else{
$no_days=31;
}
$monthly_charge->scheme_type=$scheme_type;
$monthly_charge->no_days=$no_days;
$monthly_charge->hour_type=$request->input('hour_type'.$i);
$monthly_charge->from_time=date('H:i',strtotime($request->input('from_time'.$i)));
$monthly_charge->to_time=date('H:i',strtotime($request->input('to_time'.$i)));
$monthly_charge->price=$request->input('price'.$i);
$monthly_charge->save();
}
$id=$pricing_details->id;
$request->session()->put('price_id', $id);
return redirect('/facility_details');
}
public function update(Request $request){
$diff=$request->input('diff');
$no_accessories=$request->input('no_accessories');
//$no_discounts=$request->input('no_discounts');
$no_monthly_charges=$request->input('no_monthly_charges');
for($i=0;$i<$diff;$i++){
$pr_id=$request->input('pricing_id'.$i);
$pricing_details=PricingDetail::find($pr_id);
$pricing_details->timings=$request->input('time'.$i);
$pricing_details->price=$request->input('price'.$i);
$pricing_details->discount=$request->input('discount'.$i);
$pricing_details->discounted_price=$request->input('discounted_price'.$i);
$pricing_details->disc_from_date=$request->input('disc_from_date'.$i);
$pricing_details->disc_to_date=$request->input('disc_to_date'.$i);
$pricing_details->infrastructure_details_id=$request->input('inf_id');
$pricing_details->operational_details_id=$request->input('op_id');
$pricing_details->day_types_id=$request->input('day_type'.$i);
$pricing_details->save();
}
for($i=1;$i<=$no_accessories;$i++){
$acc_id=$request->input('acc_id'.$i);
$accessory_charge=AccessoryCharge::find($acc_id);
$accessory_charge->item=ucfirst($request->input('item'.$i));
$accessory_charge->brand=ucfirst($request->input('brand'.$i));
$accessory_charge->price=$request->input('acc_price'.$i);
$accessory_charge->quantity=$request->input('quantity'.$i);
$accessory_charge->return_type=$request->input('return_type'.$i);
$accessory_charge->infrastructure_details_id=$request->input('inf_id');
$accessory_charge->operational_details_id=$request->input('op_id');
$accessory_charge->save();
}
for($i=1;$i<=$no_monthly_charges;$i++){
$monthly_id=$request->input('monthly_id'.$i);
$monthly_charge=MonthlyCourtCharge::find($monthly_id);
//$monthly_charge->infrastructure_details_id=$request->input('inf_id');
$no_days=0;
$scheme_type=$request->input('scheme_type'.$i);
if($scheme_type=="scheme1"){
$no_days=22;
}else{
$no_days=31;
}
$monthly_charge->scheme_type=$scheme_type;
$monthly_charge->no_days=$no_days;
$monthly_charge->hour_type=$request->input('hour_type'.$i);
$monthly_charge->from_time=date('H:i',strtotime($request->input('from_time'.$i)));
$monthly_charge->to_time=date('H:i',strtotime($request->input('to_time'.$i)));
$monthly_charge->price=$request->input('price'.$i);
$monthly_charge->save();
}
$id=$pricing_details->id;
$request->session()->put('price_id', $id);
return redirect('/facility_details');
}
}
here is the layout code
<div class="dynamic_row2">
<div class="row">
<div class="col-md-12 bg-info text-white">
<h4 calss="h4-responsive">4. Monthly Charges</h4>
</div>
</div>
<div class="row">
<div class="col-md-2">
<h4 class="h4-responsive">Scheme Type</h4>
</div>
<div class="col-md-2">
<h4 class="h4-responsive">Hour Type</h4>
</div>
<div class="col-md-3">
<h4 class="h4-responsive">From Time</h4>
</div>
<div class="col-md-3">
<h4 class="h4-responsive">To Time</h4>
</div>
<div class="col-md-2">
<h4 class="h4-responsive">Price / hour</h4>
</div>
</div>
#php
$i=1;
#endphp
#foreach($monthly_charges as $monthly)
{{Form::hidden('monthly_id'.$i,$monthly->id)}}
<div class="row" id="discount_row1">
<div class="col-md-2">
<div class="form-group">
<select name="scheme_type<?php echo $i; ?>" class="form-control" required>
<option value="<?php echo $monthly->scheme_type; ?>" selected><?php echo $monthly->scheme_type; ?></option>
<option value="" disabled>Select Scheme</option>
<option value="scheme1">Scheme1 - 22 days</option>
<option value="scheme2">Scheme2 - 30/31 days</option>
</select>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<select name="hour_type<?php echo $i; ?>" class="form-control" required>
<option value="<?php echo $monthly->hour_type; ?>" selected><?php echo $monthly->hour_type; ?></option>
<option value="" disabled>Select hour type</option>
<option value="Peak hour">Peak hour</option>
<option value="NonPeak hour">NonPeak hour</option>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{{ Form::time('from_time'.$i,$monthly->from_time,['class'=>'form-control','placeholder'=>'From Time','required']) }}
</div>
</div>
<div class="col-md-3">
<div class="form-group">
{{ Form::time('to_time'.$i,$monthly->to_time,['class'=>'form-control','placeholder'=>'From Time','required']) }}
</div>
</div>
<div class="col-md-2">
<div class="form-group">
{{ Form::number('price'.$i++,$monthly->price,['class'=>'form-control','placeholder'=>'From Time','required']) }}
</div>
</div>
</div>
#endforeach
</div>
{{Form::submit('Update',['class'=>'btn btn-primary'])}}
{!! Form::close() !!}
#endif
i have checked database datatypes since i works most of the time no problem there. i don't what iam missing

Edit page is not working(Undefinded variable branch) In Laravel

I have edit page contains 3 fields company, dealership, branch, when I click one of the save list of the branch I need to show the details into the page but when I did this it shows undefined variable error throwing up, how to fix this and also need to update the form after listing the details in the corresponding fields
Edit Page
#include('theme.header')
<?php
use App\Company;
?>
<div class="page-content-wrapper ">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<div class="btn-group float-right">
</div>
<h4 class="page-title">Branch Management</h4>
</div>
</div>
</div>
<!-- end page title end breadcrumb -->
<div class="row">
<div class="col-12">
<div class="card m-b-30">
<div class="card-body">
<h4 class="mt-0 header-title">Branch</h4>
<br>
<br>
{!! Form::open(['method' => 'PUT', 'route' => ['branchs.update',$branch->id]] ) !!}
<div class="form-group row">
<label class="col-sm-2 col-form-label">Company</label>
<div class="col-sm-10">
<?php
$comp=Company::where('comp_id',$branch->comp_id)->first();
$companies=Company::where('status','0')
->get();
?>
<input type="hidden" name="br_id" id="br_id" value="{{$branch->br_id}}">
<select class="form-control" id="company" name="company">
<option selected value="{{$branch->br_id}}">{{$comp->name}}</option>
#foreach($companies as $company)
<option value="{{$company->comp_id}}">{{$company->name}}</option>
#endforeach
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Dealership</label>
<div class="col-sm-10">
<?php
$cn = App\Dealership::where('dlr_id', $branch->dlr_id)->first();
$companies =App\Dealership::where('status', '0')
->get();
?>
<select class="form-control" id="dealer" name=" dealer">
<option>Select Dealership</option>
#foreach($dealership as $dealerships)
<option value="{{$dealerships->dlr_id}}">{{$dealerships->name}}</option>
#endforeach
</select>
</div>
</div>
<div class="form-group row">
<label for="example-text-input" class="col-sm-2 col-form-label">Branch Name</label>
<div class="col-sm-10">
<input class="form-control" type="text" id="branch" name="branch" value="{{$branch->name}}">
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="page-title-box">
<div class="btn-group float-right">
<button class="btn btn-primary" type="submit">Button</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div> <!-- end col -->
</div> <!-- end row -->
</div>
</div>
#include('theme.footer')
Controller File
<?php
namespace App\Http\Controllers;
use App\Branch;
use App\Company;
use App\Dealership;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class BranchController extends Controller
{
public function index()
{
$companies = Company::where('status', '0')->get();
$dealership = Dealership::where('status', '0')->get();
$branches = Branch::where('status', '0')->get();
return view('branch.index', compact('branches'));
}
public function store(Request $request)
{
$branch_id = new Branch;
$branch_id = Branch::orderBy('br_id', 'desc')->take(1)->get();
if (count($branch_id) > 0) {
$id = $branch_id[0]->br_id;
$id = $id + 1;
} else {
$id = 1;
}
$branch = new Branch;
$branch->br_id = $id;
$branch->name = $request->input('branch');
$branch->dlr_id = $request->input('dealer');
$branch->comp_id = $request->input('company');
$branch->created_id = '0';
$branch->save();
return redirect()->back()->with('message', 'Successfully saved');
}
public function edit(Branch $branch)
{
$branch=Branch::where('id',$branch->id)->first();
return view('branch.edit',['branches'=>$branch]);
}
public function update(Request $request,$id)
{
$branch = Branch::findOrFail($id);
$branch->status = '1';
$branch->save();
if ($branch) {
$branchs = new Branch();
$branchs->comp_id = $request->input('company');
$branchs->dlr_id = $request->input('dealer');
$branchs->name = $request->input('branch');
$branchs->created_id = '0';
$branchs->save();
if ($branchs) {
return redirect('/branch')->with('message', 'Successfully saved');
}
}
}
public function destroy(Branch $branch)
{
DB::table('branches')
->where('id', $branch->id)
->update(['status' => '-1']);
return back()->with('message', 'Successfully Deleted');
}
}
You are passing branch with parameter name branches. Change your controller code to:
public function edit(Branch $branch)
{
$branch=Branch::where('id',$branch->id)->first();
return view('branch.edit',['branch'=>$branch]);
}
You are sending 'branches' from your controller and used $branch in your view! Try to change it in your edit() function like:
public function edit(Branch $branch)
{
$branch=Branch::where('id',$branch->id)->first();
return view('branch.edit',['branch' => $branch]);
}
And also, in your index() function change
return view('branch.index', compact('branches'));
To
return view('branch.index', compact(['branches', 'companies', 'dealership']));
Hope this will helps you!
Everything seems to be correct just that you are sending branches instead of branch and when the view looks up for branch it's not available .. that's the error you are getting

How to view data based on date range using laravel and mysql

Route:
Route::post('dategraph','Chatbot\TrackerController#dategraph');
Controller:
public function dategraph(Request $request)
{
$dategraph = DiraStatistics::all()->whereBetween('date_access', [$from, $to])->get();
$dates = $dategraph('date_access');
return view('AltHr.Chatbot.graph', compact('dates'));
}
View:
<form id="form-project" role="form" action="{{action('AltHr\Chatbot\TrackerController#dategraph')}}" autocomplete="off" method="POST">
{{csrf_field()}}
<!-- <canvas id="myChart" width="150" height="50"></canvas> -->
<div class="form-group-attached">
<div class="row">
<div class="col-lg-6">
<div class="form-group form-group-default required" >
<label>From</label>
<input type="date" class="form-control" name="from" required>
</div>
</div>
<div class="col-lg-6">
<div class="form-group form-group-default required" >
<label>To</label>
<input type="date" class="form-control" name="to">
</div>
</div>
</div>
</div>
<button class="btn alt-btn-black btn-xs alt-btn pull-right" type="submit">Next</button>
</form>
Hi guys, so im trying to view the data from the selected dates as the code ive written. But im getting an error. Did i write it correctly? or am i missing something?
You do not have a $from variable.
You need to pull out posted variables from the request.
The method get() will return a Collection of objects. You can, for example, turn it to a flat array by plucking the column and turning it toArray()
$dategraph = DiraStatistics::whereBetween(
'date_access',
[
$request->get('from'),
$request->get('to')
]
)->get();
$dates = $dategraph->pluck('date_access')->toArray();

How Can I Get Admin Id and Use it across the application?

In codeigniter I want to add the product on admin Id which is required in DB Table. when Admin log in his ID must be catch. whenever and where Id is needed it must be available.
here is my VIEW in which
<?php echo form_open_multipart('admin/add_product');?>
<!------------------Product Name------------------------>
<div class="row form-group">
<div class="col-sm-10">
<label>Product Name: *</label>
<?php echo form_input(['name'=>'name','class'=>'form-
control','placeholder'=>'Product name..','value'=>
set_value('name')])?>
<div>
<?php echo form_error('name');?>
</div>
</div></div>
<!------------------Product Cat---------------------------->
<div class="row form-group">
<div class="col-sm-12">
<label>Category: *</label> <br>
<select class="selectpicker" name="pro_cat_id">
<option label="Select Category">Category</option>
<?php
foreach($product_cat as $cat)
{?>
<option value="<?= $cat['pro_cat_id'] ?>"><?= $cat['category'] ?>
</option>
<?php }?>
</select>
<div>
<!------------------Product Price---------------------------->
<div class="row form-group">
<div class="col-md-10">
<label>Product Price: *</label>
<?php echo form_input(['name'=>'price','class'=>'form-
control','placeholder'=>'Product Price..','value'=>
set_value('price')])?>
<div>
<?php echo form_error('price');?>
</div>
</div></div>
<!------------------Product Location---------------------------->
<div class="row form-group">
<div class="col-md-10">
<label>Product Location: *</label>
<?php //echo form_input(['name'=>'location','class'=>'form-
control','placeholder'=>'Product Location'])?>
</div></div>
</div></div>
<!-----------End of body---------------->
</div>
<div class="modal-footer">
<input name="" type="submit" value="ADD" class="btn btn-success">
</div>
<?php echo form_close();?>
</div>
</div>
</div>
Here is my Controller
function add_product(){
$data['product_size'] = $this->show->show_product_size();
$data['product_cat']= $this->show->show_product_category();
$data['product_color'] = $this->show->show_product_color();
$data['pr']= $this->show->show_provider();
$post= $this->input->post();
$ =this->form_validation->set_error_delimiters("<p class='text-danger'>","
</p>");
if($this->form_validation->run('add_product')){
if($this->add->add_product($post)==TRUE){
$this->db->close();
$this->session->set_flashdata('success','Product has been added
successfully');
return redirect('admins/pages/add_product_page');
//$this->load->admin_template('admin/add_product',$data);
}
}
else
{
$this->session->set_flashdata('failled','Sorry, fail to add product');
//return redirect('admins/pages/add_product_page');
$upload_error= $this->upload->display_errors();
$this->load->admin_template('admin/add_product',$data);
}
}
Use this query, preferably in your controller:
$this->session->userdata('id');

Codeigniter: Parser issue in a form. Only one is saved

I have a strange issue with one form in Codeigniter. I am also using DataMapper PHP. So I have one form with two select statements with a couple of options. If one is selected the other one becomes 0 if the other is selected then the first one becomes 0. Any ideas why the strange behavior ?
Controller
public function edit($id)
{
// Check if the user is logged in
if (!$this->ion_auth->logged_in())
{
redirect('/');
}
elseif ($this->ion_auth->is_admin())
{
// Create Object
$predictions = new Prediction_model();
$predictions->where('id', $id)->get();
$categories = new Categories_model();
$bookmakers = new Bookmakers_model();
$categories->order_by('id', 'asc')->get();
$bookmakers->order_by('id', 'asc')->get();
// Default Object Options
$defaultCategory = new Categories_model();
$defaultCategory->where('id', $predictions->category_id)->get();
$defaultBookmaker = new Bookmakers_model();
$defaultBookmaker->where('id', $predictions->bookmaker_id)->get();
$recent_categories = array();
foreach ($categories as $category)
{
$single_category = array
(
'category_id' => $category->id,
'sport' => $category->sport,
);
array_push($recent_categories, $single_category);
}
$recent_bookmakers = array();
foreach ($bookmakers as $bookmaker)
{
$single_bookmaker = array
(
'bookmaker_id' => $bookmaker->id,
'bookmaker' => $bookmaker->bookmaker,
);
array_push($recent_bookmakers, $single_bookmaker);
}
// Validation rules
$rules = $this->prediction_model->rules;
$this->form_validation->set_rules($rules);
$data = array
(
'prediction_id' => $predictions->id,
'defaultCategory' => $defaultCategory->sport,
'defaultBookmaker' => $defaultBookmaker->bookmaker,
'eventDate' => $predictions->eventDate,
'event' => $predictions->event,
'tip' => $predictions->tip,
'bestOdd' => $predictions->bestOdd,
'bookmakers' => $recent_bookmakers,
'categories' => $recent_categories,
'admin_content' => 'admin/predictions/edit',
);
if ($this->input->post('submit'))
{
$predictions->eventDate = $this->input->post('eventDate');
$predictions->event = $this->input->post('event');
$predictions->tip = $this->input->post('tip');
$predictions->bestOdd = $this->input->post('bestOdd');
$predictions->bookmaker_id = $this->input->post('bookmaker');
$predictions->category_id = $this->input->post('icon');
}
if ($this->form_validation->run() == FALSE)
{
$this->parser->parse('admin/template_admin', $data);
}
else
{
$predictions->save();
redirect('admin/predictions/');
}
}
else
{
// NO ACCESS
}
} // function edit
and here is the VIEW:
<?php echo form_open('admin/predictions/edit/{prediction_id}', 'class="form-horizontal"'); ?>
<div class="form-group">
<label for="category" class="col-sm-2 control-label">Category</label>
<div class="col-sm-10">
<select name="icon" class="form-control">
<option selected='selected'>{defaultCategory}</option>
<option>--------</option>
{categories}
<option value="{category_id}">{sport}</option>
{/categories}
</select>
</div>
</div>
<div class="form-group">
<label for="event" class="col-sm-2 control-label">Event</label>
<div class="col-sm-10">
<input type="text" name="event" class="form-control" value="{event}">
</div>
</div>
<div class="form-group">
<label for="tip" class="col-sm-2 control-label">Tip</label>
<div class="col-sm-10">
<input type="text" name="tip" class="form-control" value="{tip}">
</div>
</div>
<div class="form-group">
<label for="bookmaker" class="col-sm-2 control-label">Bookmaker</label>
<div class="col-sm-5">
<select name="bookmaker" class="form-control">
<option selected='selected'>{defaultBookmaker}</option>
<option>--------</option>
{bookmakers}
<option value="{bookmaker_id}">{bookmaker}</option>
{/bookmakers}
</select>
</div>
<label for="bestOdd" class="col-sm-2 control-label">Odd</label>
<div class="col-sm-3">
<input type="text" name="bestOdd" class="form-control" value="{bestOdd}">
</div>
</div>
<div class="form-group">
<label for="date" class="col-sm-2 control-label">Date</label>
<div class="col-sm-4">
<div class="input-group">
<input size="16" name="eventDate" type="text" class="form-control eventDate" value="{eventDate}" readonly>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<input type="submit" name="submit" value="Save" class="btn btn-success btn-lg">
</div>
</div>
<?php echo form_close(); ?>

Categories