function Client(data) {
  this.id = data.id
  this.name = data.name;
  this.address = data.address;
  this.phone = data.phone;
  this.email = data.email;
}

Client.prototype.concatPhEmail = function() {
  return "Phone: " + this.phone + " | Email: " + this.email;
}

function loadClient(response) {
  var client = new Client(response);
  client.quickContact = client.concatPhEmail()
  var source = $("#client-show-page-template").html();
  var template = Handlebars.compile(source);
  var result = template(client);
  $("#client-show-page").html(result);
}

function getAdjacentClient(id){
  url = "/clients/" + id;
  $.ajax({
    url: url,
    method: "GET",
    dataType: "JSON",
    success: function(client_data){
      if (client_data) {
        loadClient(client_data);
        attachNextClientListener();
      }
    }
  });
}

function attachNextClientListener(){
  var nextId = parseInt($(".js-next").attr("data-id"));
  $('.js-next').on('click', function(event){
    getAdjacentClient(nextId + 1);
  });
  $('.js-previous').on('click', function(event){
    getAdjacentClient(nextId - 1);
  });
}

$(document).on('turbolinks:load', function(){
  if (!!$('#client-show-page').length) {
    var client_id = window.location.pathname.split("/").pop();
    $.ajax({
      url: '/clients/' + client_id + '.json',
      method: "GET",
      success: function(response) {
        loadClient(response);
        attachNextClientListener();
      }
    });
  };
});

@@ -280,24 +280,27 @@
 dClient(
-response
+client_data
 ) %7B%0A  va
@@ -317,32 +317,35 @@
  new Client(
-response
+client_data
 );%0A  client.
@@ -569,29 +569,32 @@
 tion get
-AdjacentClien
+ClientAjaxReques
 t(id)%7B%0A 
@@ -616,16 +616,26 @@
 s/%22 + id
+ + '.json'
 ;%0A  $.aj
@@ -988,37 +988,40 @@
 nt)%7B%0A    get
-AdjacentClien
+ClientAjaxReques
 t(nextId + 1
@@ -1089,21 +1089,24 @@
  get
-AdjacentClien
+ClientAjaxReques
 t(ne
@@ -1283,199 +1283,38 @@
     
-$.ajax(%7B%0A      url: '/clients/' + client_id + '.json',%0A      method: %22GET%22,%0A      success: function(response) %7B%0A        loadClient(response);%0A        attachNextClientListener();%0A      %7D%0A    %7D
+getClientAjaxRequest(client_id
 );%0A 

refactor client show page