I made simple paging with the collection macro to paginate the data in the series. How can I use simple paging result-> total () is not used? I want to do it briefly like gmaila. It has 1-50 / 200 <> style.
<div class="btn-group">
<a href="{{ $dataArray->previousPageUrl() }}">
<button type="button" class="btn btn-default btn-sm">
<i class="fas fa-chevron-left"></i>
</button>
</a>
<a href="{{ $dataArray->nextPageUrl() }}">
<button type="button" class="btn btn-default btn-sm">
<i class="fas fa-chevron-right"></i>
</button>
</a>
</div>
To have a pagination text similar to that of Gmail you can do this:
{{($items->currentPage() - 1) * $items->perPage() + 1 . '-' . $items->currentPage() * $items->perPage() . ' of ' . $items->total()}}
You can enter the code where you prefer in your view.
Related
Below is my blade codes, the error shows thats its caused by line 307 of the codes.
#endwhile
#endif
Total Request
</table>
<div class="text-center {{$visibility}}">
<button class="btn btn-secondary btn-s add_row_after">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use plus"></i>
Add Row After
</button>
<button class="btn btn-secondary btn-s add_row_before">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use plus"></i>
Add Row Before
</button>
<button class="btn btn-secondary btn-s remove_row">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use minus"></i>
Remove Line
</button>
</div>
does anyone know how to add the decimal number_format here?, I don't use the blade from Laravel but I route the view directly to html... so if I add the number_format attribute, I'm confused ;(
<tr dir-paginate="income in incomes | filter:searchText | itemsPerPage:20" total-items="totalItems">
<td>{{income.incomeTitle}}</td>
<td>{{income_cat[income.incomeCategory]}}</td>
<td>Rp.{{income.incomeAmount}}</td>
<td>{{income.incomeDate}}</td>
<td>{{income.incomeNotes}}</td>
<td>
<a ng-show="income.incomeImage != ''" target="_blank" href="{{'index.php/incomes/download/'+income.id}}"><button type="button" class="btn btn-success btn-circle" title="{{phrase.Download}}" tooltip><i class="fa fa-cloud-download"></i></button></a>
<button ng-show="$root.can('Incomes.editIncome')" ng-click="edit(income.id)" type="button" class="btn btn-info btn-circle" title="{{phrase.Edit}}" tooltip><i class="fa fa-pencil"></i></button>
<button ng-show="$root.can('Incomes.delIncome')" ng-click="remove(income,$index)" type="button" class="btn btn-danger btn-circle" title="{{phrase.Remove}}" tooltip><i class="fa fa-trash-o"></i></button>
</td>
</tr>
i am using codeigniter.i am trying to convert this bootstrap code into a php variable for HTML table class
<div class="btn-group">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
Action <span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-default pull-right" role="menu">
<li>
<a href="#" onclick="showAjaxModal('<?php echo base_url();?>index.php?modal/popup/modal_take_payment/<?php echo $row['invoice_id'];?>');">
<i class="entypo-bookmarks"></i>
Take Payment </a>
</li>
<li class="divider"></li>
<!-- VIEWING LINK -->
<li>
<a href="#" onclick="showAjaxModal('<?php echo base_url();?>index.php?modal/popup/modal_view_invoice/<?php echo $row['invoice_id'];?>');">
<i class="entypo-credit-card"></i>
View Invoice </a>
</li>
<li class="divider"></li>
<!-- EDITING LINK -->
<li>
<a href="#" onclick="showAjaxModal('<?php echo base_url();?>index.php?modal/popup/modal_edit_invoice/<?php echo $row['invoice_id'];?>');">
<i class="entypo-pencil"></i>
Edit </a>
</li>
<li class="divider"></li>
<!-- DELETION LINK -->
<li>
<a href="#" onclick="confirm_modal('<?php echo base_url();?>index.php?admin/invoice/delete/<?php echo $row['invoice_id'];?>');">
<i class="entypo-trash"></i>
Delete </a>
</li>
</ul>
</div>
result of above HTML code
now i want to convert this complete html code into a php syntax so i can use it in HTML table class and code for this is as below-
[$edit_url =base_url().'index.php?modal/popup/modal_edit_invoice/'. $row\['invoice_id'\];
$url = base_url().'index.php?modal/popup/modal_take_payment/'. $row\['invoice_id'\];
$url_delete= base_url().'index.php?admin/invoice/delete/'. $row\['invoice_id'\];
$url_invoice= base_url().'index.php?modal/popup/modal_view_invoice/'. $row\['invoice_id'\];
$onclick_delete = array('onclick'=>"return confirm_modal('{$url_delete}')" , 'class'=>"btn-default btn-sm dropdown-toggle");
$onclick_edit = array('onclick'=>"return showAjaxModal('{$edit_url}')" , 'class'=>"btn btn-default btn-sm dropdown-toggle");
$onclick_take = array('onclick'=>"return showAjaxModal('{$url}')",'class'=>"btn btn-default btn-sm dropdown-toggle");
$onclick_invoice = array('onclick'=>"return showAjaxModal('{$url_invoice}')",'class'=>"btn btn-default btn-sm dropdown-toggle");
$links = anchor('#', 'Take Payment',$onclick_take);
$links .= anchor('#', 'edit',$onclick_edit);
$links .= anchor('#', 'Invoice',$onclick_invoice);
$links .= anchor('#', 'delete',$onclick_delete);
but this is not giving me the result as above html code. so can you please suggest me the changes in the code.
problem_II
and when i am using above code bootstrap model properties also not working as expected.the problem is Body is not auto scrolling to top when model is popup and for that reason model is not coming properly on my screen. although i didn't made any changes in body.modal-open.
please help me out. thanks in advance
I need some help on the backpack, the buttons.
I have a list of products, and in the edit and delete buttons I have added two more to the nutrient of a product and its price. Using the backpack I do not know how to load the id of the product in question to put this additional information. How can I do it?
Image
Inside the button view you created you should be able to use $entry. Check out https://laravel-backpack.readme.io/docs/crud-buttons for more info.
Even though this event happened more than 1 month, I'll try to share some information to help others.
1. First of all you need to create a new blade file
resources\views\vendor\backpack\buttons\crud\buttons.
2. Inside of your file
<i class='fa fa-list'></i>Listar Nutrientes
The $entry->getKey() is going to provide the "id" to you.
3. Connecting the "Button" to your CrudCrontroller
Inside your ProductCrudController you need to add a new entry.
$this->crud->addButtonFromView('line', 'extra_button', 'extra_button', 'beginning');
the extra_button "just a example" needs to have the name of your blade file in the third parameter "if i'm not wrong".
After this you should get your new button for each line listed in the table.
Just a tip: If you're going to add "a lot of buttons" try to use a
drop down button.
<div class="btn-group">
<button type="submit" class="btn btn-primary btn btn-xs btn-default">
<span class="fa fa-list" role="presentation" aria-hidden="true" style="color: #f1f1f1"></span>
<span data-value="save_and_back" style="color: #fff">Opções</span>
</button>
<button type="button" class="btn btn-primary dropdown-toggle btn-xs btn-default" data-toggle="dropdown" aria-haspopup="true" aira-expanded="false" aria-expanded="true">
<span class="caret"></span>
<span class="sr-only">▼</span>
</button><div class="dropdown-backdrop"></div>
<ul class="dropdown-menu" style="font-size: 12px;">
<li><i class='fa fa-plus'></i>Add new nutriente</li>
<li><i class='fa fa-list'></i>Listar nutrientes</li>
<li><i class='fa fa-arrow-right'></i>Second Action</li>
<li><i class='fa fa-times'></i>Cancel</li>
</ul>
</div>
I'm trying to get the ID from the query when I use edit_column but I get it only for the 'id' column, when I try to get it for the 'operations' column I get the html markup of the 'id' column.
Here is the code:
public function ajaxGetAllPages()
{
$pages = Page::select(array('id','title','updated_at','status'));
return Datatables::of($pages)
->edit_column('id', '<input type="checkbox" class="checkboxes tooltips" value="{{ $id }}" data-placement="left" data-original-title=" אינדקס # {{ $id }} " />')
->edit_column('title','{{ $title }}')
->edit_column('updated_at', '{{ date("d-m-Y | H:i",strtotime($updated_at)) }}')
->edit_column('status', '{{ $status }}')
->edit_column('operations',
'<i class="fa fa-pencil"></i>
<i class="fa fa-trash-o"></i>
<i class="fa fa-times"></i>
<div class="btn-group">
<button class="btn default btn-xs dropdown-toggle" type="button" data-toggle="dropdown">עוד <i class="fa fa-angle-down"></i></button>
<ul class="dropdown-menu pull-right" role="menu">
<li>פעולה</li>
<li>פעולה</li>
</ul>
</div>'
)
->make();
}
Markup result - http://screencast.com/t/nIefrpqc8
Am I doing something wrong or is it a bug?
Thanks,
Chen
According to Bllim docs:
If you use double quotes while giving content of add_column or edit_column, you should escape variables with backslash () else you get error. For example:
edit_column('id',"- {{ \$id }}")
Use backslash before $id.
->edit_column('operations',
'<i class="fa fa-pencil"></i>
<i class="fa fa-trash-o"></i>
<i class="fa fa-times"></i>
<div class="btn-group">
<button class="btn default btn-xs dropdown-toggle" type="button" data-toggle="dropdown">עוד <i class="fa fa-angle-down"></i></button>
<ul class="dropdown-menu pull-right" role="menu">
<li>פעולה</li>
<li>פעולה</li>
</ul>
</div>'
)