Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

evripidesk

Experience

450

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

30th November, 2017

evripidesk started a new conversation Listbox Move Items • 2 weeks ago

I have the below listbox that transfer values to other listbox, is working fine but I want to take the values in split show I can use json

html

<?php 

div class="subject-info-box-1">
                    <select name="product_list"  multiple = "multiple"size="20" id="lstBox1" style="width: 250px;" class ="form-control" >
                      @foreach($array['product_name'] as  $product_name['product_name'])
                        @foreach($array['product_directions'] as  $product_directions['product_directions'])

                          <?php $i++ ?>
                          <option  value="{{$product_name['product_name']}}, {{$product_directions['product_directions']}}" style="font-weight:bold" > {{ $i}} ) {{$product_name['product_name']}} {{$product_directions['product_directions']}} </option>
                          @endforeach
                      @endforeach
              </select> </td>
              
            </div>

          <td>    <div class="subject-info-arrows text-center">
                <input type="button" id="btnRight" value=">" class="btn btn-default" /><br />
                <input type="button" id="btnLeft" value="<" class="btn btn-default" /><br />
                <input type="button" id="btnAllRight" value=">>" class="btn btn-default" /><br />
                <input type="button" id="btnAllLeft" value="<<" class="btn btn-default" />
              </div> </td>

            <td>  <div class="subject-info-box-2">
                <select autofocus name = "pending_products[]" multiple="multiple" size="20" id='lstBox2' style="width: 250px;" class="form-control">
                </select> </td>




          <center><button type="submit" id='submit' class="btn btn-success" style="margin-left:38px" >Pending Products</button></center>

javascript

<?php 

<script type="text/javascript">
$('#submit').click(function() {
    $('#lstBox2 option').prop('selected', true);
});
(function () {
    $('#btnRight').click(function (e) {
        var selectedOpts = $('#lstBox1 option:selected');
        if (selectedOpts.length == 0) {
            alert("Nothing to move.");
            e.preventDefault();
        }
        $('#lstBox2').append($(selectedOpts).clone());
        $(selectedOpts).remove();
        e.preventDefault();
    });
    $('#btnAllRight').click(function (e) {
        var selectedOpts = $('#lstBox1 option');
        if (selectedOpts.length == 0) {
            alert("Nothing to move.");
            e.preventDefault();
        }
        var retVal = confirm("Do you want to transfer all drugs to PENDING list ?");
        if( retVal == true ){
        $('#lstBox2').append($(selectedOpts).clone());
        $(selectedOpts).remove();
        e.preventDefault();
      }
    });
    $('#btnLeft').click(function (e) {
        var selectedOpts = $('#lstBox2 option:selected');
        if (selectedOpts.length == 0) {
            alert("Nothing to move.");
            e.preventDefault();
        }
        $('#lstBox1').append($(selectedOpts).clone());
        $(selectedOpts).remove();
        e.preventDefault();
    });
    $('#btnAllLeft').click(function (e) {
        var selectedOpts = $('#lstBox2 option');
        if (selectedOpts.length == 0) {
            alert("Nothing to move.");
            e.preventDefault();
        }
        $('#lstBox1').append($(selectedOpts).clone());
        $(selectedOpts).remove();
        e.preventDefault();
    });


}(jQuery));

Now I get the below

array:2 [▼ "_token" => "RgqpyEVz8ji659bZguBup3fW0YiC0vcRtk186AM2" "pending_products" => array:1 [▼ 0 => "CD Player, Electronics" ] ]

But I want to get it like this:

array:2 [▼ "product_name" => array:1 [▼ 0 => "CD Player" ] "product_directions" => array:1 [▼ 0 => "Electronics" ] ]

25th November, 2017

evripidesk left a reply on Add Show Textbox • 2 weeks ago

also below its my html code

      <form action="{{action('[email protected]', $id)}}" method="post">
<h5 class="text-center">Product</h5>
        <section class="container">
        <div class="table table-responsive">
        <table class="table table-responsive table-striped table-bordered">
        <thead>
          <tr>
              <td>Product Name</td>
              <td>Details</td>
              <td>Remove</td>
            </tr>
        </thead>
        <tbody id="TextBoxContainer" name="TextBoxContainer" method="post" >
        </tbody>
        <tfoot>
          <tr>
            <th colspan="5">
            <button id="btnAdd" type="button" class="btn btn-primary" data-toggle="tooltip" data-original-title="Add more controls"></i>+ Add&nbsp;</button></th>
          </tr>
        </tfoot>
        </table>
        </div>
        </section>

evripidesk left a reply on Add Show Textbox • 2 weeks ago

@Sergiu17 thank you, I changed it but I still I cannot get the value of this textbox,

24th November, 2017

evripidesk left a reply on Add Show Textbox • 2 weeks ago

what I have to specify, what value, I need to send to html post

evripidesk started a new conversation Add Show Textbox • 2 weeks ago

I have the below script to add / remove text boxes but I don't know how to post the value

<?php 
<script type="text/javascript">


$(function () {

$("#btnAdd").bind("click", function () {
var div = $("<tr />");
div.html(GetDynamicTextBox(""));
$("#TextBoxContainer").append(div);
});
$("body").on("click", ".remove", function () {
$(this).closest("tr").remove();
});
});
function GetDynamicTextBox(value) {


return '<td><textarea name = "product"  type="text" ' + value + '" class="form-control" /></td>'  + value + '" /></td>'+ '<td><textarea name = "prescription" type="text"' + value + '" class="form-control" /></td>' + '<td><button type="button" class="btn btn-danger remove">X</button></td>'
}

</script>

20th November, 2017

evripidesk left a reply on After Refresh Go Back • 3 weeks ago

@RamjithAp Perfect I correct the line from ''' return redirect('products/'.$id.'/history'); to ''' return redirect('products/'.$id.'/history/view'); ''' and is working perfect

thank you man

evripidesk left a reply on After Refresh Go Back • 3 weeks ago

I try it but I get blank page updated code

<?php 
 public function searchSecurityCode($id)
     {
       $id=Hashids::decode($id);
       $id = implode(',', $id);

       $security_code = Session::get('security_code');

       $this->validate(request(), [
           'q' => 'required'],
           [
               'q.required'    => 'Please type the security code ',

           ]);
            $q = Input::get ( 'q' );

            $success = Clients::where(function($query) use ($id,$q) {
                                          $query->where('id', 'LIKE', $id)
                                                  ->where('security_code', 'LIKE', $q);

                                      })->get();


            if(count($success) > 0) {
              Session::forget('security_code');
              Session::forget('name');
              $products = Products::with('user’,’clients’)->where(‘client_id','LIKE',$id)->paginate(10);
              $resetsecuritycode = Clients::find($id);
              $resetsecuritycode->security_code = str_random(10);
              $resetsecuritycode->save();
              Session::put('products',$products);


             }else
            return redirect()->back()->with('status', 'No record founded!');


     }

     public function viewhistory($id)
     {
        $products = Session::get('products');
        return redirect('products/'.$id.'/history')-> withProducts($products);
     }

Routes Route::post('/clients/{id}/history/', '[email protected]'); Route::get('/clients/{id}/history/view', '[email protected]');

19th November, 2017

evripidesk left a reply on After Refresh Go Back • 3 weeks ago

I dont have any get for this, do I need this if yes which method can I use for get (eg)

evripidesk started a new conversation After Refresh Go Back • 3 weeks ago

I have the below code that is search for security code (that is in my db) and I use form to search it, is working fine but if I hit the refresh button (browser) then I get back with the error , No record found how can I stop it and with the refresh get the normal details

<?php 
 public function searchSecurityCode($id)
     {
       $id=Hashids::decode($id);
       $id = implode(',', $id);

       $security_code = Session::get('security_code');

       $this->validate(request(), [
           'q' => 'required'],
           [
               'q.required'    => 'Please type the security code ',

           ]);
            $q = Input::get ( 'q' );

            $success = Clients::where(function($query) use ($id,$q) {
                                          $query->where('id', 'LIKE', $id)
                                                  ->where('security_code', 'LIKE', $q);

                                      })->get();


            if(count($success) > 0) {
              Session::forget('security_code');
              Session::forget('name');
              $products = Products::with('user’,’clients’)->where(‘client_id','LIKE',$id)->paginate(10);
              $resetsecuritycode = Clients::find($id);
              $resetsecuritycode->security_code = str_random(10);
              $resetsecuritycode->save();

              return view(‘clients.history')->withClients($products);

             }else
            return redirect()->back()->with('status', 'No record founded!');


     }

My route is below

Route::post('/clients/{id}/history/', '[email protected]');

27th October, 2017

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

the issue as I think is here ->Orwhere('client_story', "%{$q}%") if I search only for name the its fine when I search for client_strory then give me and results from other clients id

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

my search query return me and clients with different id

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

this working, thank you, but I get wrong results, I get and results with different ids

26th October, 2017

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

i try the below but I still dont get any records

<?php 
$clients = Clients::where('client_id', $id)
                                      ->whereHas('user', function ($query) use ($q) {
                                        $query->Orwhere('name', "%{$q}%");})

                                        ->Orwhere('client_story', "%{$q}%")

                                        ->paginate(10);

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

@robrogers3 yes you are correct and I think the wherein cannot help me because my search results cannot find any record, is there any method so I can get the rows for specific ID and only for this ID

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

if I change the WhereIn with orwhere then is working but with wrong results (get results with different id)

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

anywhere after $clients = Clients::where('client_id', 'LIKE', $id) i get the same error before this my variable is null

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

cannot get dd ($clients) give me the same error "Invalid argument supplied for foreach()"

evripidesk left a reply on Get All Rows With Specific ID • 1 month ago

thank you for your reply and sorry for missing code controller

<?php 
public function searchHistory ()
     {
       $this->validate(request(), [
         'q' => 'required',
       ]);
            $q = Input::get ( 'q' );
            $id = Session::get('id');
            $clients = Clients::where('client_id', 'LIKE', $id)
                                      ->whereHas('user', function ($query) use ($q) {
                                        $query->where('name', 'like', "%{$q}%");})
                                        ->whereIN('client_story','LIKE',"%{$q}%")
                                        ->paginate(10); 
  if(count($clients) > 0)
            return view('clients.history',compact('clients'))->withClients($clients);
           else     return redirect('/clients/history')->with('status', 'No record founded!');


    }

history.blade

<?php 

  @foreach($clients as $client)
      <tr>
        <td>{{$client->client->name}}</td>
        <td>{{$client->idcard}}</td>
        <td>{{$client->phone_number}}</td>
        <td>{{$client['client_story']}}</td>
        <td>{{$client['created_at']}}</td>
        <td>{{$client->user->name}}</td>




        </td>
      </tr>
      @endforeach 

evripidesk started a new conversation Get All Rows With Specific ID • 1 month ago

I am trying to get all raws (search) with specific ID with whereIn 'public function searchHistory () { $this->validate(request(), [ 'q' => 'required', ]); $q = Input::get ( 'q' ); $id = Session::get('id'); $clients = Clients::where('client_id', 'LIKE', $id) ->whereHas('user', function ($query) use ($q) { $query->where('name', 'like', "%{$q}%");}) ->whereIN('client_story','LIKE',"%{$q}%") ->paginate(10); '

but I get the following error "Invalid argument supplied for foreach()"

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.