angular.module('jobsitesService',[]).factory('Jobsites',function($http){
	return {
		getPaging:function(filter){
			return $http({method:'POST',url:url_server + 'jobsitespaging',data:filter});
		},
		getSelect:function(){
			return $http({method:'POST',url:url_server + 'jobsites/getall'});
		},
		getSelect2:function(filter){
			return $http({method:'POST',url:url_server + 'jobsites/search',data:filter});
		},
		getSelect2ByCustomerId:function(filter){
			return $http({method:'POST',url:url_server + 'jobsites/searchbycustomerid',data:filter});
		},
		show:function(id){
			return $http.get(url_server+ 'jobsites/'+id,{withCredentials: true});
		},
		save:function(jobsitesData){
			return $http({method:'POST',
							url:url_server+'jobsites',
							data:jobsitesData});
		},
		update:function(id, jobsitesData){
			return $http.put(url_server+'jobsites/'+id,jobsitesData,{withCredentials: true});
		},
		destroy:function(id){
			return $http.delete(url_server + 'jobsites/'+id);
		}
	};
});
