Category : jquery

I’m trying to generate a word document using Laravel8. So I’m using the following controller to generate the document and save it on a public_path, And then download this file from the public_path. public function generer(Request $request){ $projets_casting= Projet_Casting::whereIn(‘id_contrat’,explode(",", $request->selectedvalues))->where(‘id_projet’,$request->id_projet) ->get(); foreach ($projets_casting as $projet_casting) { $id_modele_contrat = Contrat::where(‘id_contrat’,$projet_casting->id_contrat)->value(‘id_modele_contrat’); $model_file = Model_Contrat::where(‘id_modele_contrat’,$id_modele_contrat)->value(‘fichier’); $castings = Casting::where(‘id_casting’,$projet_casting->id_casting); ..

Read more

I am using datatable in Laravel Project. I use it on many pages. But on two pages I need to show almost 20 columns. and it automatically adds a plus sign to show more details. I have filters on table and following is my JavaScript. $(document).ready(function() { initDatatable(‘/deals/deals_table’, ‘deals_table’); }); function quickFilter(elementId) { var fnServerParams ..

Read more

I have a Laravel Blade View I am displaying about 280 products from database using code below. @if (get_setting(‘best_selling’) == 1) <section class="mb-4"> <div class="container"> <div class="px-2 py-4 px-md-4 py-md-3 bg-white shadow-sm rounded"> <div class="d-flex mb-3 align-items-baseline border-bottom"> <h3 class="h5 fw-700 mb-0"> <span class="border-bottom border-primary border-width-2 pb-3 d-inline-block">{{ translate(‘Just For You’) }}</span> </h3> <a href="../search" ..

Read more

I want to hide a <div> element if the value is_admin === "0" in table admins. Here is my Controller Code function dashboard(Request $request){ $data = [‘LoggedUserInfo’=>Admin::where(‘id’,’=’, session(‘LoggedUser’))->first()]; $count = DB::table(‘candidates’)->count(); $count2 = DB::table(‘admins’)->count(); $data1 = DB::table(‘admins’); $data1 = $data1->paginate(10); return view(‘dashboard’, $data,compact(‘count’,’count2′,’data1′)); } I want to hide this div if is_admin === "0" <div ..

Read more

I’m using ajax request in laravel and passing csrf token also but some times my application gets stuck and getting this error : Code : var formData = $(this).serialize(); $.ajaxSetup({ header:$(‘meta[name="_token"]’).attr(‘content’) }); $.ajax({ url:$(this).attr(‘action’), type:’POST’, data:formData, headers: { Accept: "application/json" }, success:function(response) { This form is in modal popup : <form id="user-login" class="login" action="{{ url(‘login’) ..

Read more

I’m trying to import events from different calendars, and then create invoices from each event. but each time the events count is different, variable event count each time I try to import. login with google function authenticate() { return gapi.auth2.getAuthInstance() .signIn({scope: "https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.readonly"}) .then(function() { console.log("Sign-in successful"); }, function(err) { console.error("Error signing in", err); }); ..

Read more

I’m trying to make a dependent dropdown in laravel using jquery. But somehow I always get error GET http://localhost/getcities/14 404 (Not Found). I have the url in the route but it say not found. Route Route::get(‘/getcities/{provinsi_id}’, ‘[email protected]’); Controller public function getCities($provinsi_id) { $cities = WilKota::where(‘provinsi_id’, $provinsi_id)->get(); return json_encode($cities); } Jquery $(document).ready(function() { $(‘select[name="province"]’).on(‘change’, function() { ..

Read more

i want to make a statement if is_participant is one then check the box, but i tried but it doesn’t work $user = User::with(‘regency.province’); return DataTables::of($user) ->editColumn(‘is_participant’, function ($user) { return ‘<input ‘ . $user->is_participant == 1 ? "checked" : "" . ‘ type="checkbox" id="’ . $user->id . ‘">’; }) is there something missing in ..

Read more

I have a form in Laravel Blade which contains data that need to be hidden and shown dynamically. Here is the code. @foreach ($working_orders as $key => $order) <div class="col-lg-12 row "> <div class="title-md">Work Order # {{$order->id}}</div> <div class="form-group col-lg-6"> <label style="color: #44484d;">Camión</label> <select class="form-control kt-selectpicker truck_type" required name="truck_type" onchange="getOrderFields()"> <option value="1" selected>No asignar</option> <option ..

Read more

This is my code ajax that send the DATA $.ajax({ url: ‘{{url("path")}}’, data: aux, type: ‘POST’, success:function(response){ console.log(response); }, error: function(response) { console.log("error"); } }); The problem is when i want manipulate this $request in my controller to create a new object with the datas that goes in the data. this is my controller en ..

Read more

I did live search by using ajax and have other jquery customizations (Tilt.js etc..) for my card component. I get search results successfully but it doesn’t have whole js customizations . Component that returns from Controller $output =”; foreach($data as $post){ $output .=’ <div class="card mb-4" id="card" data-tilt data-tilt-max="5" data-tilt-glare data-tilt-max-glare="0.2"> <div class="card-body"> <div class="card ..

Read more

I have an ajax to a route where i validate my form fields and return the errors to the api $validator = Validator::make($request->all(),$rules,$messages); if ($validator->fails()) { $arr = array( ‘validator’ => ‘error’, ‘result’ => $validator->errors() ); echo json_encode($arr); } else{//my code here } I wont post any more code because everything works fine and i ..

Read more

All of my var statements uses identifiers: let count = document.getElementsByClassName(‘product_filter_div’).length + 1; let id1 = "’"+’filter_div-‘+count+"’"; let id2 = count; let id3 = ‘filter-‘+count; let html = ‘<div id="filter_div-‘+count+’" class="product_filter_div position-relative">’+ So why am I getting a null error? And in my browsers Firefox and Chrome I don’t get any errors or warnings. When ..

Read more

All of my var statements uses identifiers: let count = document.getElementsByClassName(‘product_filter_div’).length + 1; let id1 = "’"+’filter_div-‘+count+"’"; let id2 = count; let id3 = ‘filter-‘+count; let html = ‘<div id="filter_div-‘+count+’" class="product_filter_div position-relative">’+ So why am I getting a null error? I ran this code in the Javascript runner and got the null error message. And ..

Read more

if the only 2nd box is checked then the 3rd one and 4th one must be checked automatically. and if the only 3rd box is checked then the 4th one must be checked automatically. <tr class="all"> <!–Guarito–> <th style="width:30vh" class="table-info">Guarito/2</th> @for($i=0;$i<4;$i++) <td> <input type="checkbox" class="selectall" name="Guarito-{{$i}}" id="Guarito-{{$i}}" @if(!empty($FollowupTreatment[$i] ->guarito) && $FollowupTreatment[$i] ->guarito == 1) checked ..

Read more

I have tried this code but it only worked once after that i have to refresh the page and then again it will work only once. `enter code here`<tr class="all"> <!–Guarito=Healed –> <th style="width:30vh" class="table-info">Guarito</th> @for($i=0;$i<4;$i++) <td> <input type="checkbox" name="Guarito-{{$i}}" id="Guarito-{{$i}}" class="selectall" @if(!empty($FollowupTreatment[$i] ->guarito) && $FollowupTreatment[$i] ->guarito == 1) checked @endif > </td> </tr> Here ..

Read more

I have dropdown like this: <div class="row"> <div class="col-md-12 col-sm-6"> <div class="form-group"> <label for="">{{ __(‘Product Plan’) }}<span class="required"></span></label> <select name="product_plan" class="form-control" id="product_plan" style="width: 50%"> @foreach ($product_plan as $val) <option value="{{ $val->productplanID }}"> {{ $val->productplanID }}</option> @endforeach </select> </div> </div> </div> I using modal to update this data, so I use AJAX. This is my ajax ..

Read more