Skip to content

Commit

Permalink
Merge pull request #213 from lomamech/refGroup
Browse files Browse the repository at this point in the history
Ref group
  • Loading branch information
sfount committed Mar 30, 2016
2 parents a2cbcf9 + fa0f2c5 commit 1c45a67
Show file tree
Hide file tree
Showing 12 changed files with 683 additions and 353 deletions.
4 changes: 2 additions & 2 deletions client/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2510,9 +2510,9 @@
"NEW_REFERENCE" : "New Reference Group",
"NO_REFERENCES" : "No grave Reference Group have been registered.",
"REGISTERED" : "Registered References Groups",
"SAVE_SUCCES" : "Successfully saving Reference Group",
"SAVE_SUCCESS" : "Successfully saving Reference Group",
"TITLE" : "Reference group management",
"UPDATE_SUCCES" : "Updated successfully",
"UPDATE_SUCCESS" : "Updated successfully",
"UPD_REFERENCE" : "Update Reference Group"
},
"REPORT": {
Expand Down
4 changes: 2 additions & 2 deletions client/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2500,9 +2500,9 @@
"NEW_REFERENCE" : "Nouveau groupe de référence",
"NO_REFERENCES" : "Aucun groupe de référence n'est encore enregistré",
"REGISTERED" : "Groupes de références enregistrés",
"SAVE_SUCCES" : "Enregistrement avec succès",
"SAVE_SUCCESS" : "Enregistrement avec succès",
"TITLE" : "Gestion de groupe de référence",
"UPDATE_SUCCES" : "Mis à jour avec succès",
"UPDATE_SUCCESS" : "Mis à jour avec succès",
"UPD_REFERENCE" : "Modifier un groupe de référence"
},
"RENEWAL": {
Expand Down
2 changes: 1 addition & 1 deletion client/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function bhimaconfig($routeProvider) {
templateUrl: 'partials/references/references.html'
})
.when('/references/groups', {
controller: 'ReferenceGroupController',
controller: 'ReferenceGroupController as ReferenceGroupCtrl',
templateUrl: 'partials/references/groups/groups.html'
})

Expand Down
76 changes: 76 additions & 0 deletions client/src/js/services/ReferenceGroupService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
angular.module('bhima.services')
.service('ReferenceGroupService', ReferenceGroupService);

ReferenceGroupService.$inject = ['$http', 'util'];

function ReferenceGroupService($http, util) {
var service = this;
var baseUrl = '/reference_group/';

service.read = read;
service.create = create;
service.update = update;
service.delete = del;

/**
* @desc Get an id (optionnal) and return back a list of Reference Groups or a Reference Group
* @param {Integer} id, the id of the Reference Group (optionnal)
* @return {object} a promise object, with the response.body inside.
* @example
* service.read()
* .then(function (ReferenceGroups){
* your code here
* });
**/
function read(id, params) {
var url = baseUrl.concat(id || '');
return $http.get(url, { params : params })
.then(util.unwrapHttpResponse);
}

/**
* @desc It create an Reference Group
* @param {object} Reference Group, Reference Group to create
* @example
* service.create(ReferenceGroup)
* .then(function (res){
* your code here
* });
**/
function create(ReferenceGroup) {
return $http.post(baseUrl, ReferenceGroup)
.then(util.unwrapHttpResponse);
}

/**
* @desc It updates an ReferenceGroup
* @param {Integer} id, ReferenceGroup id to update
* @param {object} ReferenceGroup, ReferenceGroup to update
* @example
* service.update(id, ReferenceGroup)
* .then(function (res){
* your code here
* });
**/
function update(id, ReferenceGroup) {
return $http.put(baseUrl.concat(id), ReferenceGroup)
.then(util.unwrapHttpResponse);
}

/**
* @desc It Delete a ReferenceGroup
* @param {Integer} id, ReferenceGroup id to delete
* @example
* service.del(id)
* .then(function (res){
* your code here
* });
**/

function del(id) {
return $http.delete(baseUrl + id)
.then(util.unwrapHttpResponse);
}

return service;
}
Loading

0 comments on commit 1c45a67

Please sign in to comment.