ok
Direktori : /home2/selectio/www/3-idiots/resources/views/admin-views/business-settings/language/ |
Current File : /home2/selectio/www/3-idiots/resources/views/admin-views/business-settings/language/index.blade.php |
@extends('layouts.back-end.app') @section('title', \App\CPU\translate('Language')) @section('content') <div class="content container-fluid"> <!-- Page Title --> <div class="mb-4 pb-2"> <h2 class="h1 mb-0 text-capitalize d-flex align-items-center gap-2"> <img src="{{asset('/public/assets/back-end/img/system-setting.png')}}" alt=""> {{\App\CPU\translate('System_Setup')}} </h2> </div> <!-- End Page Title --> <!-- Inlile Menu --> @include('admin-views.business-settings.system-settings-inline-menu') <!-- End Inlile Menu --> <div class="row"> <div class="col-md-12"> <div class="alert alert-danger mb-3" role="alert"> {{\App\CPU\translate('changing_some_settings_will_take_time_to_show_effect_please_clear_session_or_wait_for_60_minutes_else_browse_from_incognito_mode')}} </div> <div class="card"> <div class="px-3 py-4"> <div class="row justify-content-between align-items-center flex-grow-1"> <div class="col-sm-4 col-md-6 col-lg-8 mb-2 mb-sm-0"> <h5 class="mb-0 d-flex"> {{\App\CPU\translate('language_table')}} </h5> </div> <div class="col-sm-8 col-md-6 col-lg-4"> <div class="d-flex gap-10 justify-content-sm-end"> <button class="btn btn--primary btn-icon-split" data-toggle="modal" data-target="#lang-modal"> <i class="tio-add"></i> <span class="text">{{\App\CPU\translate('add_new_language')}}</span> </button> </div> </div> </div> </div> <div class="table-responsive pb-3"> <table class="table table-hover table-borderless table-thead-bordered table-nowrap table-align-middle card-table" style="text-align: {{Session::get('direction') === "rtl" ? 'right' : 'left'}};"> <thead class="thead-light thead-50 text-capitalize"> <tr> <th>{{ \App\CPU\translate('SL')}}</th> <th>{{\App\CPU\translate('Id')}}</th> <th>{{\App\CPU\translate('name')}}</th> <th>{{\App\CPU\translate('Code')}}</th> <th class="text-center">{{\App\CPU\translate('status')}}</th> <th class="text-center">{{\App\CPU\translate('default')}} {{\App\CPU\translate('status')}}</th> <th class="text-center">{{\App\CPU\translate('action')}}</th> </tr> </thead> <tbody> @php($language=App\Model\BusinessSetting::where('type','language')->first()) @foreach(json_decode($language['value'],true) as $key =>$data) <tr> <td>{{$key+1}}</td> <td>{{$data['id']}}</td> <td>{{$data['name']}} ( {{isset($data['direction'])?$data['direction']:'ltr'}} ) </td> <td>{{$data['code']}}</td> <td> <label class="switcher mx-auto"> <input type="checkbox" onclick="updateStatus('{{route('admin.business-settings.language.update-status')}}','{{$data['code']}}')" class="switcher_input" {{$data['status']==1?'checked':''}}> <span class="switcher_control"></span> </label> </td> <td> <label class="switcher mx-auto"> <input type="checkbox" onclick="window.location.href ='{{route('admin.business-settings.language.update-default-status', ['code'=>$data['code']])}}'" class="switcher_input" {{ ((array_key_exists('default', $data) && $data['default']==true) ? 'checked': ((array_key_exists('default', $data) && $data['default']==false) ? '' : 'disabled')) }}> <span class="switcher_control"></span> </label> </td> <td class="text-center"> <div class="dropdown"> <button class="btn btn-seconary btn-sm dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="tio-settings"></i> </button> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> @if($data['code']!='en') <a class="dropdown-item" data-toggle="modal" data-target="#lang-modal-update-{{$data['code']}}">{{\App\CPU\translate('update')}}</a> @if ($data['default']==true) <a class="dropdown-item" href="javascript:" onclick="default_language_delete_alert()">{{\App\CPU\translate('Delete')}}</a> @else <a class="dropdown-item delete" id="{{route('admin.business-settings.language.delete',[$data['code']])}}">{{\App\CPU\translate('Delete')}}</a> @endif @endif <a class="dropdown-item" href="{{route('admin.business-settings.language.translate',[$data['code']])}}">{{\App\CPU\translate('Translate')}}</a> </div> </div> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> <div class="modal fade" id="lang-modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">{{\App\CPU\translate('new_language')}}</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form action="{{route('admin.business-settings.language.add-new')}}" method="post" style="text-align: {{Session::get('direction') === "rtl" ? 'right' : 'left'}};"> @csrf <div class="modal-body"> <div class="row"> <div class="col-12"> <div class="form-group"> <label for="recipient-name" class="col-form-label">{{\App\CPU\translate('language')}} </label> <input type="text" class="form-control" id="recipient-name" name="name"> </div> </div> <div class="col-6"> <div class="form-group"> <label for="message-text" class="col-form-label">{{\App\CPU\translate('country_code')}}</label> <select class="form-control country-var-select w-100" name="code"> @foreach(\Illuminate\Support\Facades\File::files(base_path('public/assets/front-end/img/flags')) as $path) @if(pathinfo($path)['filename'] !='en') <option value="{{ pathinfo($path)['filename'] }}" title="{{ asset('public/assets/front-end/img/flags/'.pathinfo($path)['filename'].'.png') }}"> {{ strtoupper(pathinfo($path)['filename']) }} </option> @endif @endforeach </select> </div> </div> <div class="col-6"> <div class="form-group"> <label class="col-form-label">{{\App\CPU\translate('direction')}} :</label> <select class="form-control" name="direction"> <option value="ltr">LTR</option> <option value="rtl">RTL</option> </select> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">{{\App\CPU\translate('close')}}</button> <button type="submit" class="btn btn--primary">{{\App\CPU\translate('Add')}} <i class="fa fa-plus"></i></button> </div> </form> </div> </div> </div> @foreach(json_decode($language['value'],true) as $key =>$data) <div class="modal fade" id="lang-modal-update-{{$data['code']}}" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">{{\App\CPU\translate('new_language')}}</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form action="{{route('admin.business-settings.language.update')}}" method="post"> @csrf <div class="modal-body"> <div class="row"> <div class="col-12"> <div class="form-group"> <label for="recipient-name" class="col-form-label">{{\App\CPU\translate('language')}} </label> <input type="text" class="form-control" value="{{$data['name']}}" name="name"> </div> </div> <div class="col-6"> <div class="form-group"> <label for="message-text" class="col-form-label">{{\App\CPU\translate('country_code')}}</label> <select class="form-control country-var-select w-100" name="code"> @foreach(\Illuminate\Support\Facades\File::files(base_path('public/assets/front-end/img/flags')) as $path) @if(pathinfo($path)['filename'] !='en' && $data['code']==pathinfo($path)['filename']) <option value="{{ pathinfo($path)['filename'] }}" title="{{ asset('public/assets/front-end/img/flags/'.pathinfo($path)['filename'].'.png') }}"> {{ strtoupper(pathinfo($path)['filename']) }} </option> @endif @endforeach </select> </div> </div> <div class="col-6"> <div class="form-group"> <label class="col-form-label">{{\App\CPU\translate('direction')}} :</label> <select class="form-control" name="direction"> <option value="ltr" {{isset($data['direction'])?$data['direction']=='ltr'?'selected':'':''}}> LTR </option> <option value="rtl" {{isset($data['direction'])?$data['direction']=='rtl'?'selected':'':''}}> RTL </option> </select> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">{{\App\CPU\translate('close')}}</button> <button type="submit" class="btn btn--primary">{{\App\CPU\translate('update')}} <i class="fa fa-plus"></i></button> </div> </form> </div> </div> </div> @endforeach </div> @endsection @push('script') <!-- Page level plugins --> <script src="{{asset('public/assets/back-end')}}/vendor/datatables/jquery.dataTables.min.js"></script> <script src="{{asset('public/assets/back-end')}}/vendor/datatables/dataTables.bootstrap4.min.js"></script> <!-- Page level custom scripts --> <script> // Call the dataTables jQuery plugin $(document).ready(function () { $('#dataTable').DataTable(); }); function updateStatus(route, code) { $.get({ url: route, data: { code: code, }, success: function (data) { toastr.success('{{\App\CPU\translate('status_updated_successfully')}}'); } }); } </script> <script> $(document).ready(function () { // color select select2 $('.country-var-select').select2({ templateResult: codeSelect, templateSelection: codeSelect, escapeMarkup: function (m) { return m; } }); function codeSelect(state) { var code = state.title; if (!code) return state.text; return "<img class='image-preview' src='" + code + "'>" + state.text; } }); </script> <script> $(document).ready(function () { $(".delete").click(function (e) { e.preventDefault(); Swal.fire({ title: '{{\App\CPU\translate('Are you sure to delete this')}}?', text: "{{\App\CPU\translate('You will not be able to revert this')}}!", showCancelButton: true, confirmButtonColor: 'primary', cancelButtonColor: 'secondary', confirmButtonText: '{{\App\CPU\translate('Yes')}}, {{\App\CPU\translate('delete it')}}!' }).then((result) => { if (result.value) { window.location.href = $(this).attr("id"); } }) }); }); </script> <script> function default_language_delete_alert() { toastr.warning('{{\App\CPU\translate('default language can not be deleted! to delete change the default language first!')}}'); } </script> @endpush