nagendrabhat

nagendrabhat

Member Since 3 Months Ago

Experience Points 440
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

04 Sep
3 months ago

nagendrabhat left a reply on Present Location Of A User.

Hi @Cronix

Here is the code which you gave for reference-

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get your coordinates.</p>

<button onclick="getLocation()">Try It</button>

<p id="demo"></p>

<script>
var x = document.getElementById("demo");

function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else { 
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}

function showPosition(position) {
    x.innerHTML = "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude;
}
</script>

</body>
</html>

And i just want to send this lat/long to http://maps.googleapis.com/maps/api/geocode/json?latlng=13.046192,77.6221824&sensor=true url and get only the city name out of it.

And i also read some article which says getting geolocation api from developers account and map the script in the code. My query is Google gelocation api is free for use or any billing is required for the official use? And do i really need to get the api to parse these lat/long? Can not i send lat/long to the above mentioned url and get the only city name?

03 Sep
3 months ago

nagendrabhat left a reply on Present Location Of A User.

Yes. Thanks a lot for the help. I really appreciate for the the quick help

nagendrabhat left a reply on Present Location Of A User.

And does it work only if the site is https?

nagendrabhat left a reply on Present Location Of A User.

Yes. Thanks Cronix. Something which i can refer and implement using this ref. And one more add up question is how can i parse these lat and long inorder to get the place? Example, 13.071736999999999 77.62134089999999

I just want to get the location as bangalore.

nagendrabhat started a new conversation Present Location Of A User.

Hey Team, I have a custom login page and dashboard page for user login. And I need to get his present location when he clicks on Check In Button present in the dashboard.

To be specific, I have a check-in button. and when a user clicks on it. I want to get his present location (lat, lang) and that should be saved into the database.

Searched all over. And end up with finding google maps implementation and user manually clicks on it to get location either autocomplete search box where it finds the location.

Please help me out with this. I would be really helpful to get the solution.

02 Sep
3 months ago

nagendrabhat left a reply on Data Of A Week.

Well. Got the solution for the code. And here is the solution,

   Carbon::setWeekStartsAt(Carbon::SUNDAY);
  Carbon::setWeekEndsAt(Carbon::SATURDAY);

  $samplingData = DB::table('sampling_order')
                ->select('id','doctorselected','date','products','quantity')
                ->whereBetween('created_at', [Carbon::now()->startOfWeek(), 
               Carbon::now()->endOfWeek()])
                ->get();

    return view('layouts.Representativesampling')->with('data',['doctor_name' => $doctor_name, 'samplingData' => $samplingData ]);

Thanks, Edris899 for the guidance.

nagendrabhat left a reply on Data Of A Week.

Sure. Thanks for your response.

nagendrabhat left a reply on Data Of A Week.

Yes. May I know how does it work? SubWeek takes only the this week's dates?

And can you please explain me the third line of code.

Here is the code i have written to get the data.

$samplingData = DB::table('sampling_order')
            ->select('id','doctorselected','date','products','quantity')
            ->get();
  return view('layouts.Representativesampling')->with('data',['doctor_name' => $doctor_name, 'samplingData' => $samplingData ]);

I just want to filter the data with considering only this week.

nagendrabhat left a reply on Data Of A Week.

Yeah. Finding out a query. Those dates are bootstrap dates and present in the database. I just want to fetch the data of a week.

nagendrabhat started a new conversation Data Of A Week.

Hey. Actually, I have a data in a table contains a date, name, and so and so.

My task is to get the data of a week.

For example.

Data is (YYYY-DD-MM)

2018-02-09 Data1 11

2018-08-09 Data2 12

I just want to get the weekly data and print over a screen.

Can anyone help me out how to parse these dates and takes the weekly where condition and print it over.

01 Sep
3 months ago

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

Okay.. Thanks for the document which you have shared.

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

Now. I commented on the app.js from app.blade And it works fine for me.

But i just want to make sure where this is gonna impacted in the future development.

Anyone has any information on where is app.js present in layouts.app is required

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

Yes I removed the jQuery and bootstrap links from the page which I have created and extended the app. Still not able to make work on the ajax call created in newpage

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

@Snapey, Yeah its a big set of code which i am debugging, so could not explain in single thread. Please review it.

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

@Nash, I exactly didn't follow you. Can you please elaborate more on this. Or can you help me out with a code? I believe we dont need to change anything on App. Because its system generated file.

Can you please help me out with the code. You help would really moves my work further .

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

Not able to call the Add customer Ajax function. Its not even calling alert. When i remove the app file. It works fine.

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

@topvillas Updated only the code. Please review it

nagendrabhat left a reply on App.layout Crashing The Ajax Function Used In View

And Here is my Page

@extends('layouts.app')

@section('content')

Representative Ordering jQuery.noConflict();

Enter Sampling @include('layouts.newRepresentativesampling') Please confirm the data which you been saved into the database Sampling ID Doctor's name Date Sampling Tablets Quantity Action @foreach ($data['samplingData'] as $key => $samplingData) {{$samplingData->id}} {{$samplingData->doctorselected}} {{$samplingData->date}} {{$samplingData->products}} {{$samplingData->quantity}} Edit Delete @endforeach $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }) //----------------- Clicking on Add Customer ------ jQuery('#add').on('click',function(){ alert("hi"); $('#save').val('Save'); $('#frmRepresentative').trigger('reset');
$('#Retailer').modal('show');

});

@endsection

nagendrabhat started a new conversation App.layout Crashing The Ajax Function Used In View

App.layout

<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'Healthfix Pharma') }}</title>

<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">

<script>
    window.Laravel = {!! json_encode([
        'csrfToken' => csrf_token(),
    ]) !!};
</script>

                <!-- Collapsed Hamburger -->
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
                    <span class="sr-only">Toggle Navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <!-- Branding Image -->
                <a class="navbar-brand" href="{{ url('/') }}">
                    {{ config('app.name', 'Healthfix Pharma') }}
                </a>
            </div>

            <div class="collapse navbar-collapse" id="app-navbar-collapse">
                <!-- Left Side Of Navbar -->
                <ul class="nav navbar-nav">
                    &nbsp;
                </ul>

                <!-- Right Side Of Navbar -->
                <ul class="nav navbar-nav navbar-right">
                    <!-- Authentication Links -->
                    @if (Auth::guest())
                        <li><a href="{{ route('login') }}">Login</a></li>
                        <!--li><a href="{{ route('register') }}">Register</a></li-->
                    @else
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                                {{ Auth::user()->username }} <span class="caret"></span>
                            </a>

                            <ul class="dropdown-menu" role="menu">
                                <li>
                                    <a href="{{ route('logout') }}"
                                        onclick="event.preventDefault();
                                                 document.getElementById('logout-form').submit();">
                                        Logout
                                    </a>

                                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                        {{ csrf_field() }}
                                    </form>
                                </li>
                            </ul>
                        </li>
                    @endif
                </ul>
            </div>
        </div>
    </nav>

    @yield('content')
</div>

<!-- Scripts -->

<script src="{{ asset('js/app.js') }}"></script>

And Mypage.

@extends('layouts.app')

@section('content')

Representative Ordering jQuery.noConflict();

Enter Sampling @include('layouts.newRepresentativesampling') Please confirm the data which you been saved into the database Sampling ID Doctor's name Date Sampling Tablets Quantity Action @foreach ($data['samplingData'] as $key => $samplingData) {{$samplingData->id}} {{$samplingData->doctorselected}} {{$samplingData->date}} {{$samplingData->products}} {{$samplingData->quantity}} Edit Delete @endforeach $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }) //----------------- Clicking on Add Customer ------ jQuery('#add').on('click',function(){ alert("hi"); $('#save').val('Save'); $('#frmRepresentative').trigger('reset');
$('#Retailer').modal('show');

});

@endsection

This page should open when i click on Enter button

×

Sampling Details

        <div class='col-sm-6'>
          <label> Please select the Date </label>
          <div class="form-group">
           <div class='input-group date pickWeek' id='datetimepicker1' name="date">
               <input type='text' class="form-control" name="date" />
               <span class="input-group-addon">
                   <span class="glyphicon glyphicon-calendar"></span>
               </span>
             </div>
           </div>
         </div>
         <!-- Script for picking up the date -->
         <script type="text/javascript">
            $(function () {
              $('.pickWeek').datetimepicker({
                  format: "YYYY-MM-DD",
                  sideBySide: true,
                  daysOfWeekDisabled: [0]
              });
              $('#datetimepicker1').data('DateTimePicker').minDate(moment().startOf('week'));
              $('#datetimepicker1').data('DateTimePicker').maxDate(moment().endOf('week'));
          });
      </script>
        <div class="col-lg-6 col-sm-4">
          <label> Please select the doctor </label>
          <div class="form-group">
            <select name="doctorselected" id="doctorselected" class="form-control">
              <option value="0" disabled="true" selected="true">Please select</option>
              @foreach($data['doctor_name'] as $item)
                <option value="{{ $item->doctorid }}">{{ $item->doctor_name }}</option>
              @endforeach
            </select>
          </div>
        </div>
        <!--Sampling details -->
        <div class="panel-body">
          <table class ="table table-hover" id="TableData">
            <caption>Sampling Tablets</caption>
            <thead>
              <th>Tablet name</th>
              <th>Quantity</th>
             </thead>
             <tbody id="tbody"></tbody>
           </table>
        </div>
      </div>
    </div>
    <input type="hidden" name="id" id="id" value="">
    <div class="modal-footer">
      <input type="submit" value="save" id="save" class="btn btn-primary">
      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    </div>
  </form>
$('#doctorselected').on('change', function(e){ console.log(e); var doctorid = e.target.value; var url = '{{URL::to('getdocDetails')}}'; $.ajax({ type : 'get', url : url, data : {'doctorid':doctorid}, success:function(data){ console.log(data); var d = $.parseJSON(data); console.log(d); var output = ''; var $tabledata = $('#tbody'); $tabledata.empty(); $.each(d[0].products.split(","), function (index, product) { output += '' +'' + product + '' + '' + ''+ '' }); $('#tbody').append(output); }, error:function(data) { console.log(data); } }); });

I am tying to open the page using ajax call. When i remove app extends, it works and i tied with adding noConflict. But its not working.

nagendrabhat left a reply on Extending The App.blade Crashing My Date Picker Used In View.

@Snapey : Yeah, Added 3 files at the same time. Let me edit and repost. Thanks for your response on this.

nagendrabhat left a reply on Extending The App.blade Crashing My Date Picker Used In View.

@Dry7 Thanks for the code review. If i add noConflict after the JQuery, it is solving my Datepicker issue but not letting some other ajax scripts to workout.

nagendrabhat left a reply on Extending The App.blade Crashing My Date Picker Used In View.

@Dry7 , Thanks for the response. I am just trying to figure out where can i add noConflict. It would really helpful for me if you can help me out of this.

nagendrabhat started a new conversation Extending The App.blade Crashing My Date Picker Used In View.

Here is the view-source

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

 <!-- CSRF Token -->
    <meta name="csrf-token"     content="XWWmBWBkKxpdQhQR3ikcjWpBtQeXFntXuoUvgZQb">

    <title>Laravel</title>

    <!-- Styles -->
        <link href="http://localhost/public/css/app.css" rel="stylesheet">

    <script>
        window.Laravel =    {"csrfToken":"XWWmBWBkKxpdQhQR3ikcjWpBtQeXFntXuoUvgZQb"};
    </script>
</head>
<body>
    <div id="app">
        <nav class="navbar navbar-default navbar-static-top">
            <div class="container">
            <div class="navbar-header">

                <!-- Collapsed Hamburger -->
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
                    <span class="sr-only">Toggle Navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <!-- Branding Image -->
                <a class="navbar-brand" href="http://localhost/public">
                    Laravel
                </a>
            </div>

            <div class="collapse navbar-collapse" id="app-navbar-collapse">
                <!-- Left Side Of Navbar -->
                <ul class="nav navbar-nav">
                    &nbsp;
                </ul>

                <!-- Right Side Of Navbar -->
                <ul class="nav navbar-nav navbar-right">
                    <!-- Authentication Links -->
                                                <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                                 <span class="caret"></span>
                            </a>

                            <ul class="dropdown-menu" role="menu">
                                <li>
                                    <a href="http://localhost/public/logout"
                                        onclick="event.preventDefault();
                                                 document.getElementById('logout-form').submit();">
                                        Logout
                                    </a>

                                    <form id="logout-form" action="http://localhost/public/logout" method="POST" style="display: none;">
                                        <input type="hidden" name="_token" value="XWWmBWBkKxpdQhQR3ikcjWpBtQeXFntXuoUvgZQb">
                                    </form>
                                </li>
                            </ul>
                        </li>
                                        </ul>
            </div>
        </div>
    </nav>

    <!DOCTYPE html>
<html lang="en">
<head>
<title>Representative Ordering</title>
<meta charset="utf-8">
<meta name="_token"     content="XWWmBWBkKxpdQhQR3ikcjWpBtQeXFntXuoUvgZQb"></meta>
  <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"  href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
<div class="panel panel-default">
 <div class="panel-heading">
    <button type="button" class="btn btn-info" id="add" value="add">Enter   Sampling</button>
</div>

<div class="panel-body">
 <html>
<head>
<meta charset="utf-8">
<meta name="_token" content="XWWmBWBkKxpdQhQR3ikcjWpBtQeXFntXuoUvgZQb"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"  href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css" />
×

Sampling Details

        <div class='col-sm-6'>
          <label> Please select the Date </label>
          <div class="form-group">
           <div class='input-group date pickWeek' id='datetimepicker1' name="date">
               <input type='text' class="form-control" name="date" />
               <span class="input-group-addon">
                   <span class="glyphicon glyphicon-calendar"></span>
               </span>
             </div>
           </div>
         </div>
         <!-- Script for picking up the date -->
         <script type="text/javascript">
            $(function () {
              $('.pickWeek').datetimepicker({
                  format: "YYYY-MM-DD",
                  sideBySide: true,
                  daysOfWeekDisabled: [0]
              });
              $('#datetimepicker1').data('DateTimePicker').minDate(moment().startOf('week'));
              $('#datetimepicker1').data('DateTimePicker').maxDate(moment().endOf('week'));
          });
      </script>
        <div class="col-lg-6 col-sm-4">
          <label> Please select the doctor </label>
          <div class="form-group">
            <select name="doctorselected" id="doctorselected" class="form-control">
              <option value="0" disabled="true" selected="true">Please select</option>
                                  <option value="4">k</option>
                                  <option value="5">Nagendra</option>
                                  <option value="6">Test</option>
                                  <option value="7">Test</option>
                                  <option value="8">Pass</option>
                              </select>
          </div>
        </div>
        <!--Sampling details -->
        <div class="panel-body">
          <table class ="table table-hover" id="TableData">
            <caption>Sampling Tablets</caption>
            <thead>
              <th>Tablet name</th>
              <th>Quantity</th>
             </thead>
             <tbody id="tbody"></tbody>
           </table>
        </div>
      </div>
    </div>
    <input type="hidden" name="id" id="id" value="">
    <div class="modal-footer">
      <input type="submit" value="save" id="save" class="btn btn-primary">
      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    </div>
  </form>
$('#doctorselected').on('change', function(e){ console.log(e); var doctorid = e.target.value; var url = 'http://localhost/public/getdocDetails'; $.ajax({ type : 'get', url : url, data : {'doctorid':doctorid}, success:function(data){ console.log(data); var d = $.parseJSON(data); console.log(d); var output = ''; var $tabledata = $('#tbody'); $tabledata.empty(); $.each(d[0].products.split(","), function (index, product) { output += '' +'' + product + '' + '' + ''+ '' }); $('#tbody').append(output); }, error:function(data) { console.log(data); } }); }); Please confirm the data which you been saved into the database Sampling ID Doctor's name Date Sampling Tablets Quantity Action 24 6 2018-08-23 Sinarest,Globate -G 10,30 Edit Delete 25 5 2018-08-21 Crocin,Sinarest 10,10 Edit Delete 26 7 2018-08-22 Sinarest,Mankind 1,2 Edit Delete 27 5 2018-08-22 Crocin,Sinarest , Edit Delete 28 6 2018-08-22 Sinarest,Globate -G 10,2 Edit Delete 29 7 2018-08-21 Sinarest,Mankind 10,20 Edit Delete 30 5 2018-08-28 Crocin,Sinarest 10,30 Edit Delete 31 6 2018-08-28 Sinarest,Globate -G 10,20 Edit Delete 32 6 2018-08-31 Sinarest,Globate -G 2,3 Edit Delete 33 5 2018-08-29 Crocin,Sinarest 10,20 Edit Delete $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }) //----------------- Clicking on Add Customer ------ $('#add').on('click',function(){ $('#save').val('Save'); $('#frmRepresentative').trigger('reset'); $('#Retailer').modal('show'); }); $('#frmRepresentative').on('submit',function(e){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }) e.preventDefault(); var form = $('#frmRepresentative'); var formData = form.serialize(); console.log(formData); var url='http://localhost/public/StoreSampling'; console.log(url); var state = $('#save').val(); $.ajax({ type : 'post', url : url, data : formData, success:function(data){ var row = '' + '' + data.id + ''+ '' + data.doctorselected+ ''+ '' + data.date+ ''+ '' + data.products + ''+ '' + data.quantity + ''+ ' Edit'+ ' Delete'+ ''; $('#test').append(row); $('#frmRepresentative').trigger('reset'); }, error:function(data){ console.log('Failed'); console.log(data); } }); });
<!-- Scripts -->

<script src="http://localhost/public/js/app.js"></script>

Removing the app.blade extends solves the problem.