123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269 |
- @extends('layouts.app')
- @section('content')
- <style>
- /*.pagination li.active a.page-link {
- color: white !important;
- background: #ffa505 !important;
- }*/
- .category_title{
- margin-top: 17px;
- margin-bottom: 17px;
- }
- .add_btn_div{
- display: flex;
- align-items: center;
- justify-content: end;
- }
- .dataTables_filter input[type='search']
- {
- margin-right: 0;
- }
- .page-link{
- padding: .5em 1em !important;
- border-radius: 2px;
- border: 0;
- margin: 0;
- min-width: 50px !important;
- text-align: center;
- }
- .page-item.active .page-link{
- background-color: #4c95dd;
- }
- table.dataTable {
- clear: both;
- margin-top: 6px !important;
- margin-bottom: 6px !important;
- max-width: none !important;
- border-collapse: collapse !important;
- font-family: 'Open Sans';
- }
- /*table.dataTable td{
- border-width: 1px;
- }*/
- .theme-primary .pagination li a:hover {
- background-color: #000 !important;
- }
- .table > :not(:last-child) > :last-child > * {
- border-bottom-color: transparent;
- }
- table.dataTable th{font-weight: 700 !important;}
- .dataTables_paginate {
- width: 100%;
- text-align: center;
- }
- div.dataTables_wrapper div.dataTables_paginate ul.pagination{
- justify-content: center !important;
- }
- .category_title {
- padding-left: 36px;
- }
- .cate_add_btn{
- margin-right: 36px;
- }
- @media (max-width:767px) {
-
- .category_title {
- padding-left: 0px;
- }
- .cate_add_btn{
- margin-right: 0px;
-
- }
-
- }
- @media (max-width:1024px) {
-
- .content {
- padding-top: 30px;
- }
- .cate_add_btn{
- margin-top: 10px;
- }
-
- }
-
- </style>
- @php
- $resto = \App\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
- $lang = $resto->default_lang;
- app()->setLocale($lang);
- if(session('app_lang') !==null){
- $lang = session('app_lang');
- app()->setLocale($lang);
- }
- @endphp
- <div class="content-wrapper">
- <div class="container-full">
- <section class="content">
- <div class="row">
- <div class="col-6"><h3 class="category_title" style="margin-left: 10px">{{__('label.categories')}}</h3></div>
- <div class="col-6 text-end add_btn_div"><a href="{!! env('APP_URL') !!}category/new{{ isset($_GET['menu'])?'?menu=tablet':''}}" class="btn btn-sm btn-danger float-right cate_add_btn"><i class="glyphicon glyphicon-plus"></i> {{__('label.add_new')}} </a></div>
- </div>
-
-
- <div class="card p-15 rounded-1">
- <div class="jumbotron p-0">
- <div class="row">
- <div class="col-md-12">
- <div class="table-responsive">
- <table class="table table-bordered" id="example" width="100%" cellspacing="0">
- <thead>
- <tr class="text-uppercase">
- <!-- <th></th> -->
- <!-- <th>Display Order</th>-->
- <th>{{__('label.id')}}</th>
- <th>{{__('label.category_name')}}</th>
- <th>{{__('label.category_name_arabic')}}</th>
- <th>{{__('label.actions')}}</th>
- </tr>
- </thead>
- <tbody>
- <!----><!---->
- @if(isset($categories) && $categories->count() > 0)
- @foreach($categories as $k=>$category)
- <tr @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant" && \Illuminate\Support\Facades\Auth::user()->restaurants->id==$category->resto_id) class="data-row" @endif id="{!! $category->id !!}">
- <!-- <td>
- <div style="height: 48px; width: 48px; background-image: url(@if(isset($category->main_images)) {!! $category->main_images->file_name !!} @else {!! env('APP_ASSETS') !!}img/user/1.png @endif); background-size: cover; background-position: center;"></div>
-
- </td> -->
- <!-- <td>{!! $category->display_order !!}</td>-->
- <td>{!! $category->id !!}</td>
- <td> {!! $category->name !!}
- </td>
- <td> {!! $category->arabic_name !!}</td>
- <td>
- @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant" && \Illuminate\Support\Facades\Auth::user()->restaurants->id==$category->resto_id)
- <a href="{!! env('APP_URL') !!}category/edit/{!! $category->id !!}{{ isset($_GET['menu'])?'?menu=tablet':''}}" class="btn btn-sm btn-primary" ><i class="glyphicon glyphicon-edit"></i></a>
- <a href="javascript:;" data-id="{!! $category->id !!}" class="btn btn-sm btn-danger delete-category"><i class="glyphicon glyphicon-trash"></i></a>
- @elseif(\Illuminate\Support\Facades\Auth::user()->role=="restaurant")
- <span class="badge badge-info">{{__('label.not_editable_by_super_admin')}}</span>
- @else
- @if(\Illuminate\Support\Facades\Auth::user()->role=="administrator")
- <a href="{!! env('APP_URL') !!}category/edit/{!! $category->id !!}" class="btn btn-sm btn-primary"><i class="glyphicon glyphicon-edit"></i></a>
- <a href="javascript:;" data-id="{!! $category->id !!}" class="btn btn-sm btn-danger delete-category"><i class="glyphicon glyphicon-trash" ></i></a>
- @endif
- @endif
- </td>
- </tr>
- @endforeach
- @endif
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </section>
- </div>
- </div>
-
- @endsection
- @section('js')
- <script src="{!! env('APP_ASSETS') !!}js/jquery-ui.min.js"></script>
- <script>
- $(function () {
- var fixHelper = function(e, ui) {
- ui.children().each(function() {
- $(this).width($(this).width());
- });
- return ui;
- };
- /* $( "tbody" ).sortable({
- olerance: 'pointer' ,
- items: "tr",
- helper: fixHelper,
- cursor: 'move',
- start:function(event,ui){
- var data = $("tbody").sortable('toArray');
- console.log(data);
- },
- stop: function(event, ui) {
- //alert("New position: " + ui.item.index());
- var data = $("tbody").sortable('toArray');
- var category = [];
- var rows = $("tbody tr.data-row");
- $(rows).each(function(index,element) {
- category.push({
- id: $(this).attr('id'),
- // id:element.DT_RowId,
- position: index+1
- });
- });
- // $
- // console.log(category);
- $.ajax({
- url:'{!! env('APP_URL') !!}update/category/order',
- type:"POST",
- data:{
- ids:category,
- "_token":"{!! csrf_token() !!}"
- },
- success:function () {
-
- }
-
- });
- }
- });*/
- $('#example').DataTable({
- "bSort": true,
- "searching": true,
- "paging": true,
- "info": false,
- "bLengthChange": false,
- language: {
- @if($lang=='ar')
- url:`{{asset('public/assets/js/dataTablear.json')}}`,
- @endif
- paginate: {
- next: '<img src="{!! env("APP_ASSETS") !!}images/icons/next.png">', // or '→'
- previous: '<img src="{!! env("APP_ASSETS") !!}images/icons/preivew.png">' // or '←'
- }
- },
- });
- $("td nav").addClass('d-flex justify-content-center');
- $("body").on('click','.delete-category',function () {
- var id = $(this).data('id');
- $.ajax({
- url:"{!! env('APP_URL') !!}category/delete/"+id,
- success:function (response) {
- location.reload();
- }
- });
- });
- })
- </script>
- @endsection
|