Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
100 changes: 95 additions & 5 deletions gcore-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,49 @@ angular.module('gcore', ['ngCookies'])

});
},

/*** Orders ***/

/*** Re-factored Reports ***/
reports: {
list: function( store, type, params ) {
var url = endpoint + "/stores/" + store + "/reports/" + type;
url += self.url_params(params);
return $http.get(
url, {headers: self.get_request_headers()}
);
},
update: function ( store, type, params ) {
var url = endpoint + "/stores/" + store + "/reports/" + type;
url += self.url_params(params);
return $http.put(
url,
params['_json'] ? JSON.stringify(params['_json']) : JSON.stringify(params),
{headers: self.get_request_headers()}
);
}
},

/*** Re-factored Orders ***/
orders: {
list: function( id, params ) {

if (id !== null || undefined) {
self.list_orders(params);
}
else {
self.show_orders(id, params);
}
},
update: function ( id, params ) {
if (id !== null || undefined) {
self.update_orders(id, params);
}
else {
self.mass_update_orders(params);
}
}
},

/*** Orders ***/
list_orders: function(params) {


Expand Down Expand Up @@ -226,9 +267,58 @@ angular.module('gcore', ['ngCookies'])
{headers: self.get_request_headers()}
);
},


/*** Products ***/

/*** Re-Factored Products ***/
products: {
list: function( id, params ) {
var url;
if (id !== null || undefined) {
url = endpoint + "/stores/" + params['stores'] + "/products" + id;
url += self.url_params(params);
return $http.get(
url, {headers: self.get_request_headers()}
);
}
else {
self.list_products(params);
}
},
update: function ( id, params ) {
var url;
if (id !== null || undefined) {
url = endpoint + "/stores/" + params['stores'] + "/products" + id;
}
else {
url = endpoint + "/stores/" + params['stores'] + "/products";
}
return $http.put(
url,
params['_json'] ? JSON.stringify(params['_json']) : JSON.stringify(params),
{headers: self.get_request_headers()}
);
},
create: function ( params ) {
var url = endpoint + "/stores/" + params['stores'] + "/products";
return $http.post(
url,
params['_json'] ? JSON.stringify(params['_json']) : JSON.stringify(params),
{headers: self.get_request_headers()}
);
},
remove: function ( id, params ) {
var url = null;
if (id !== null || undefined) {
url = endpoint + "/stores/" + params['stores'] + "/products" + id;
}
return $http.delete(
url,
params['_json'] ? JSON.stringify(params['_json']) : JSON.stringify(params),
{headers: self.get_request_headers()}
);
}
},

/*** Products ***/
list_products: function(params) {


Expand Down