function buscarClienPed(b, a){
  const parametros = new FormData();
  parametros.append("txtNom", document.formClienPed.txtNom.value);
  parametros.append("txtCel", document.formClienPed.txtCel.value);
  parametros.append("txtTel", document.formClienPed.txtTel.value);
  parametros.append("txtNit", document.formClienPed.txtNit.value);

  $.ajax({
    data:  parametros,
    url:   "busClienPed/data.php",
    type:  "post",
    contentType: false,
    processData: false,
    beforeSend: function () {
      alLoad("Consultando...")
    },
    success: function (jsonPhp) {
      //console.log(jsonPhp);
      const jsonJS = JSON.parse(jsonPhp);

      tblClear("tblClienPed");
      jsonJS.clien_ped.forEach(function(i){
        addRowClienPed(i.Id, i.clip_cel, i.clip_nom, i.clip_dir, i.clip_zona);
      });

      $("#tblClienPed tbody tr").dblclick(function() {
        selectClienPed(a, $(this));
      });

      $("#tblClienPed tbody #btnSelecClienPed").click(function() {
        selectClienPed(a, $(this).parents("tr"));
      });

      alClose();
    }
  });
}

function addRowClienPed(cod, cel, nom, dir, zona) {
  const markup =  "<tr>"
                    +"<td>"+cod+"</td>"
                    +"<td>"+cel+"</td>"
                    +"<td>"+nom+"</td>"
                    +"<td>"+dir+"</td>"
                    +"<td>"+zona+"</td>"
                    +"<td><button class='btn btn-sm btn-warning badge' id='btnSelecClienPed'>"+textBtnSelec+"</button></td>"
                  +"</tr>";
  $("#tblClienPed tbody").append(markup);
}

function selectClienPed(a, tr) {
  $("#pills-"+a+"-tab").click();
  /*if (inputClien == "txtNit") {
    document.thisform.txtNit.value = tr.find("td:eq(0)").text();
    $("form[name='thisform'] #txtNit").trigger("change");
  } else {*/
    $("#"+inputIdPed).val(tr.find("td:eq(0)").text());
    $("#"+inputIdPed).trigger("change");
  //}

  //$('html, body').animate( { scrollTop : 0 }, 500 );
  tblClear("tblClienPed");
}