Commit 9673dd61 authored by EXT Hélène David's avatar EXT Hélène David
Browse files

Merge branch 'master' of...

Merge branch 'master' of gricad-gitlab.univ-grenoble-alpes.fr:edcampus/edcampus-front into EDCAMPUS-56-afficher-les-offres-demploi
parents 7e361636 358a17bf
......@@ -158,7 +158,8 @@ root.controller('AdminCompaniesCtrl' ,['$scope','$http','$stateParams', '$univer
})
}
adminCompaniesCtrl.newCompany = function (company){
adminCompaniesCtrl.newCompany = function (){
var company = adminCompaniesCtrl.inputCompany;
var index = $scope._arrayObjectIndexOf(adminCompaniesCtrl.companyList,company,"fullName");
var type = adminCompaniesCtrl.currentScreen;
if(index>-1){
......@@ -203,12 +204,20 @@ root.controller('AdminCompaniesCtrl' ,['$scope','$http','$stateParams', '$univer
$companyFactory.getCompanyDetails(adminCompaniesCtrl.entrepriseId, adminCompaniesCtrl.campus.id, function(data){
if(data.status == "success"){
adminCompaniesCtrl.company = data.details;
$companyFactory.getEntrepriseMetas(adminCompaniesCtrl.entrepriseId, adminCompaniesCtrl.campus.id, function(data){
if(data.status == "success"){
adminCompaniesCtrl.company = $.extend(adminCompaniesCtrl.company, data.details.metas);
}
})
}
else{
}
})
}
adminCompaniesCtrl.sortCompanies = function(){
adminCompaniesCtrl.filterCompanies();
......@@ -243,9 +252,8 @@ root.controller('AdminCompaniesCtrl' ,['$scope','$http','$stateParams', '$univer
}
adminCompaniesCtrl.updateCompany = function(company){
console.log(company);
$companyFactory.setCompanyMainFields(company,function(data){
adminCompaniesCtrl.updateCompany = function(){
$companyFactory.setCompanyMainFields(adminCompaniesCtrl.company,function(data){
if(data.status == "success"){
adminCompaniesCtrl.getCompanyDetails();
}
......
......@@ -2,11 +2,36 @@
/* Controllers */
root.controller('UnivCompanyContacts' ,['$scope','$http','$stateParams','$contactFactory', function($scope,$http,$stateParams,$contactFactory) {
root.controller('UnivCompanyContacts' ,['$scope','$http','$stateParams', '$contactFactory', '$universityFactory', function($scope,$http, $stateParams,$contactFactory, $universityFactory) {
$scope.init = function(){
$scope.contacts = {elements:[]};
if(!$scope.entrepriseId) $scope.entrepriseId = $stateParams.entrepriseId;
$scope.newElement = {organization:$scope.company.fullName};
$scope.entrepriseId = $stateParams.entrepriseId;
$scope.getUnivs();
}
$scope.refresh = function(){
$scope.getContacts();
}
$scope.getUnivs = function(){
var session = $scope._getSession();
$universityFactory.get_userCampus(session.user,function(data){
$scope.ready = true;
if(data.status == "success"){
$scope.campuses = data.details;
for(var index in data.details){
var campus = data.details[index]
if(campus.status=="1"){
$scope.campus = {"id":campus.id,"settings":{},"articles":{},name:campus.name,ownerId:campus.ownerId};
$scope.refresh();
break;
}
}
}
});
};
$scope.getStatus = function(){
......@@ -28,13 +53,8 @@ root.controller('UnivCompanyContacts' ,['$scope','$http','$stateParams','$contac
}
$scope.getContacts = function (){
$scope._log("get contacts");
var session = $scope._getSession();
$scope.contacts.elements = [];
$contactFactory.getUniversityEntrepriseContacts($scope.campus.id, $scope.entrepriseId,function(data){
if(data.status == "success"){
......@@ -46,13 +66,10 @@ root.controller('UnivCompanyContacts' ,['$scope','$http','$stateParams','$contac
}
})
}
$scope.addContact = function(){
var session = $scope._getSession();
$contactFactory.addUniversityEntrepriseContact($scope.campus.id, $scope.entrepriseId,$scope.newElement,function(data){
$scope.addContact = function(){
$contactFactory.addUniversityEntrepriseContact($scope.campus.id, $scope.entrepriseId, $scope.newElement,function(data){
if(data.status == "success"){
$scope.getContacts();
$scope.currentSection='listContacts';
......@@ -63,7 +80,6 @@ root.controller('UnivCompanyContacts' ,['$scope','$http','$stateParams','$contac
})
}
$scope.getStatus();
$scope.getContacts();
$scope.init();
}]);
\ No newline at end of file
......@@ -2,15 +2,15 @@
/* Controllers */
root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '$companyFactory','$languageFactory', function($scope,$http,$stateParams,$companyFactory,$languageFactory) {
root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '$companyFactory','$languageFactory','$universityFactory', function($scope,$http,$stateParams,$companyFactory,$languageFactory,$universityFactory) {
$scope.currentElement = null;
$scope.newField = null;
$scope.newFieldForm = false;
$scope.companyId = $stateParams.entrepriseId;
$scope.init = function(){
$companyFactory.getEntrepriseMetas($scope.entrepriseId,$scope.campus.id, function(data){
$companyFactory.getEntrepriseMetas($scope.companyId,$scope.campus.id, function(data){
$scope._showAlert({status:2,message:""})
if(data.status == "success"){
......@@ -22,12 +22,13 @@ root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '
$scope.metas[key] = [{label:$languageFactory._labels[key],value:val,custom:false,key:key}];
}
if($scope.rawMetas.customMetas) {
for(var key in $scope.rawMetas.customMetas.metas){
var label = "";
if($languageFactory._labels.hasOwnProperty(key)) label = $languageFactory._labels[key];
else if($scope.rawMetas.customMetas.fields.hasOwnProperty(key)) label = $scope.rawMetas.customMetas.fields[key].label;
else label = key;
if(label){
var val = $scope.rawMetas.customMetas.metas[key][0].value;
if(!val) val= $languageFactory._labels.undefined;
var elem = {value:val,label:label,custom:true,key:key,id:$scope.rawMetas.customMetas.metas[key][0].id,visibility:$scope.rawMetas.customMetas.metas[key][0].visibility,count:$scope.rawMetas.customMetas.metas[key].length};
......@@ -37,6 +38,7 @@ root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '
$scope.metas[key].unshift(elem);
}
}
}
$scope._showAlert({status:1,message:""})
}
......@@ -47,6 +49,7 @@ root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '
}
});
}
$scope.setCurrentElement = function(element){
......@@ -54,7 +57,7 @@ root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '
}
$scope.setField = function(element){
$companyFactory.setEntrepriseField($scope.entrepriseId, $scope.campus.id, element, function(data){
$companyFactory.setEntrepriseField($scope.companyId, $scope.campus.id, element, function(data){
if(data.status == "success"){
$scope.init();
$scope.setCurrentElement(null);
......@@ -63,21 +66,12 @@ root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '
}
$scope.showNewField = function(){
$scope.newField = {};
}
$scope.hideNewField = function(){
$scope.newField =null;
}
$scope.submitNewField = function(){
console.log($scope.newField);
$companyFactory.setEntrepriseField($scope.entrepriseId, $scope.campus.id, $scope.newField, function(data){
$companyFactory.setEntrepriseField($scope.companyId, $scope.campus.id, $scope.newField, function(data){
if(data.status == "success"){
$scope.init();
$scope.hideNewField();
$scope.newField = null;
$scope.setCurrentElement(null);
}
});
......@@ -98,7 +92,26 @@ root.controller('AdminCompaniesDetailsCtrl' ,['$scope','$http','$stateParams', '
$scope.setField(element);
}
$scope.getUnivs = function(){
var session = $scope._getSession();
$universityFactory.getUniversitiesByUser(session.user, function(data){
$scope.ready = true;
if(data.status == "success"){
$scope.campuses =data.details;
for(var index in data.details){
var campus = data.details[index]
if(campus.status=="1"){
$scope.campus = {"id":campus.id,"settings":{},"articles":{},name:campus.name,ownerId:campus.ownerId};
$scope.init();
break;
}
}
}
})
}
$scope.init();
$scope.getUnivs();
}]);
\ No newline at end of file
......@@ -2,12 +2,17 @@
/* Controllers */
root.controller('AdminCompaniesNotesCtrl' ,['$scope','$http','$stateParams','$companyFactory', function($scope,$http,$stateParams,$companyFactory) {
root.controller('AdminCompaniesNotesCtrl' ,['$scope','$http','$stateParams','$companyFactory', '$universityFactory', function($scope,$http,$stateParams,$companyFactory, $universityFactory) {
$scope.newNote = {};
$scope.init = function(){
$companyFactory.getUniversityEntrepriseNotes($scope.entrepriseId,$scope.campus.id, function(data){
$scope.entrepriseId = $stateParams.entrepriseId;
$scope.getUnivs();
}
$scope.getNotes = function(){
$companyFactory.getUniversityEntrepriseNotes($scope.entrepriseId, $scope.campus.id, function(data){
if(data.status == "success"){
$scope.notes = {elements:data.details};
}
......@@ -15,11 +20,11 @@ root.controller('AdminCompaniesNotesCtrl' ,['$scope','$http','$stateParams','$co
}
});
}
$scope.addNote = function(note){
$companyFactory.getUniversityEntrepriseNotes($scope.entrepriseId,$scope.campus.id,note, function(data){
$scope.addNote = function(){
var note = $scope.newNote;
$companyFactory.addUniversityEntrepriseNote($scope.entrepriseId, $scope.campus.id, note, function(data){
if(data.status == "success"){
$scope.init();
......@@ -31,7 +36,27 @@ root.controller('AdminCompaniesNotesCtrl' ,['$scope','$http','$stateParams','$co
}
$scope.refresh = function() {
$scope.getNotes();
}
$scope.getUnivs = function(){
var session = $scope._getSession();
$universityFactory.get_userCampus(session.user,function(data){
$scope.ready = true;
if(data.status == "success"){
$scope.campuses = data.details;
for(var index in data.details){
var campus = data.details[index]
if(campus.status=="1"){
$scope.campus = {"id":campus.id,"settings":{},"articles":{},name:campus.name,ownerId:campus.ownerId};
$scope.refresh();
break;
}
}
}
});
};
$scope.init();
}]);
\ No newline at end of file
<div ng-controller="AdminCompaniesDetailsCtrl as adminCompaniesDetailsCtrl">
<button style="position:absolute; right: 20px; top: 35px;" ng-click="adminCompaniesDetailsCtrl.showNewField();">{{::_labels.newFieldBtn}}</button>
<button style="position:absolute; right: 20px; top: 35px;" ng-click="adminCompaniesDetailsCtrl.newFieldForm=true;">{{::_labels.newFieldBtn}}</button>
<div style="height:470px; overflow-y:auto;text-transform:initial;">
<div class="well" ng-if='adminCompaniesDetailsCtrl.newField'>
<div class="well" ng-show='adminCompaniesDetailsCtrl.newFieldForm'>
<label>{{::_labels.newFieldLabel}}</label>
<input ng-model="adminCompaniesDetailsCtrl.newField.label" style="width:100%;"></input>
<input ng-model="newField.label" style="width:100%;"></input>
<label>{{::_labels.newFieldValue}}</label>
<input ng-model="adminCompaniesDetailsCtrl.newField.value" style="width:100%;"></input>
<input ng-model="newField.value" style="width:100%;"></input>
<div style="font-size:0.9em;">
<span><i class="fa fa-eye"></i>{{::_labels.visibility}}</span>
<select ng-model="adminCompaniesDetailsCtrl.newField.visibility" style="display:inline-block;">
<select ng-model="newField.visibility" style="display:inline-block;">
<option value="0" title="{{::_labels.publicFieldTooltip}}">{{::_labels.articleVisibilityList.public}}</option>
<option value="1" title="{{::_labels.myselfFieldTooltip}}">{{::_labels.myself}}</option>
<option value="2" title="{{::_labels.myCampusFieldTooltip}}">{{::_labels.isMainCampus}}</option>
</select>
<span>
<span ng-if="adminCompaniesDetailsCtrl.newField.visibility==0">{{::_labels.publicFieldTooltip}}</span>
<span ng-if="adminCompaniesDetailsCtrl.newField.visibility==1">{{::_labels.myselfFieldTooltip}}</span>
<span ng-if="adminCompaniesDetailsCtrl.newField.visibility==2">{{::_labels.myCampusFieldTooltip}}</span>
<span ng-if="newField.visibility==0">{{::_labels.publicFieldTooltip}}</span>
<span ng-if="newField.visibility==1">{{::_labels.myselfFieldTooltip}}</span>
<span ng-if="newField.visibility==2">{{::_labels.myCampusFieldTooltip}}</span>
</span>
</div>
<button class="pull-right" ng-click="adminCompaniesDetailsCtrl.submitNewField();">{{::_labels.addBtn}}</button>
<button class="pull-right cancel" type="button" ng-click="adminCompaniesDetailsCtrl.hideNewField();">{{::_labels.cancelBtn}}</button>
<button class="pull-right" ng-click="submitNewField();adminCompaniesDetailsCtrl.newFieldForm=false;">{{::_labels.addBtn}}</button>
<button class="pull-right cancel" type="button" ng-click="adminCompaniesDetailsCtrl.newFieldForm=false;">{{::_labels.cancelBtn}}</button>
<div class="clearfix"></div>
</div>
<section ng-repeat="(key, val) in adminCompaniesDetailsCtrl.metas" class="hoverableContent">
<section ng-repeat="(key, val) in metas" class="hoverableContent">
<div class="hoverable pull-right">
<span ng-if="val[0].custom" class="label label-warning">
<span ng-if="val[0].visibility==0"><i class="fa fa-unlock"></i> {{::_labels.articleVisibilityList.public}}</span>
<span ng-if="val[0].visibility==1"><i class="fa fa-lock"></i> {{::_labels.myself}}</span>
<span ng-if="val[0].visibility==2"><i class="fa fa-unlock-alt"></i> {{::_labels.isMainCampus}}</span>
$
</span>
<button ng-click="adminCompaniesDetailsCtrl.setCurrentElement(key)" ng-if="adminCompaniesDetailsCtrl.currentElement!=key" style="margin-left: 5px;"><i class="fa fa-edit"></i> {{::_labels.editMode}}</button>
<button ng-click="setCurrentElement(key)" ng-if="currentElement!=key"
style="margin-left: 5px;"><i class="fa fa-edit"></i> {{::_labels.editMode}}</button>
</div>
<label>{{val[0].label}}: </label>
<p ng-if="adminCompaniesDetailsCtrl.currentElement!=key" style="background: #eee; margin-top: 5px;">{{val[0].value}}</p>
<div ng-if="adminCompaniesDetailsCtrl.currentElement==key">
<p ng-if="currentElement!=key" style="background: #eee; margin-top: 5px;">{{val[0].value}}</p>
<div ng-if="currentElement==key">
<input ng-model="val[0].value" style="width:100%;"></input>
<div style="font-size:0.9em;">
<span><i class="fa fa-eye"></i>{{::_labels.visibility}}</span>
......@@ -59,16 +60,17 @@
</span>
</div>
<div class="separator"></div>
<div class="pull-right">
<button ng-click="adminCompaniesDetailsCtrl.setField(val[0]);">{{::_labels.editMode}}</button>
<button class="cancel" ng-click="adminCompaniesDetailsCtrl.setCurrentElement(null)">{{::_labels.cancelBtn}}</button>
<button ng-click="adminCompaniesDetailsCtrl.deleteField(val[0]);"><i class="fa fa-trash"></i> {{::_labels.deleteMode}}</button>
<button ng-click="setField(val[0]);">{{::_labels.editMode}}</button>
<button class="cancel" ng-click="setCurrentElement(null)">{{::_labels.cancelBtn}}</button>
<button ng-click="deleteField(val[0]);"><i class="fa fa-trash"></i>
{{::_labels.deleteMode}}</button>
</div>
<div class="clearfix"></div>
<div class="clearfix"></div>
</div>
</section>
</div>
</div>
\ No newline at end of file
</div>
\ No newline at end of file
......@@ -20,7 +20,7 @@
</div>
<div class="pull-right">
<button type="submit" ng-click="addNote(newNote)">{{::_labels.addUserBtn}}</button>
<button type="submit" ng-click="addNote(newNote)">{{::_labels.addNoteTitle}}</button>
</div>
<div style="font-size:0.9em;">
<span><i class="fa fa-eye"></i>{{::_labels.visibility}}</span>
......
......@@ -22,6 +22,7 @@ root.controller('AdminProjectsCtrl' ,['$scope','$universityFactory','$stateParam
var refresh = function(){
$universityFactory.get_campusProjects(prjCtrl.currentCampus.id,"",function(data){
console.log(data);
prjCtrl.projects = data.details;
projects = [];
parents = [];
......
......@@ -75,7 +75,7 @@ root.controller('AdminGroupsCtrl' ,['$scope','$http','$universityFactory','$user
var refresh = function(){
$usersGroupFactory.get_group_byCampus(AdminGrpCtrl.currentCampus.id,function(data){
$usersGroupFactory.get_group_byCampus(AdminGrpCtrl.currentCampus.id, null, function(data){
if(data.status=="success") AdminGrpCtrl.groupList = data.details;
},function(error){
......@@ -83,7 +83,8 @@ root.controller('AdminGroupsCtrl' ,['$scope','$http','$universityFactory','$user
})
}
var _init = function(){
$universityFactory.getMainUniversityByUser(null,function(univ){
var session = $scope._getSession();
$universityFactory.getMainUniversityByUser(session.user,function(univ){
AdminGrpCtrl.currentCampus = univ;
refresh();
......
......@@ -3,7 +3,7 @@
<div class="widget-search separator bottom">
<div class="overflow-hidden">
<input type="text" value="" id="inputField" style="width: 100%;" placeholder="{{::_labels.searchUser}}" ng-model="inputField" ng-change="onInputChange(inputField)">
<input type="text" value="" id="inputField" style="width: 100%;" placeholder="{{::_labels.searchGroup}}" ng-model="inputField" ng-change="onInputChange(inputField)">
<datalist id="inputFieldList">
<option ng-if="item.firstName || item.lastName" data-ng-repeat="item in addUserInputList" value="{{item.login}} ({{item.firstName}} {{item.lastName|uppercase}})" />
<option ng-if="!(item.firstName || item.lastName)" data-ng-repeat="item in addUserInputList" value="{{item.login}}" />
......
......@@ -119,7 +119,6 @@ root.controller('UsersSearchCtrl', ['$scope', "$http",'$dropListFactory','$userF
params.searchInMainUniversity = $scope.searchInMainUniversity?$scope.searchInMainUniversity:$scope.customFilters.searchInMainUniversity;
$userFactory.get_users(params.projectId, [elements[elements.length-1]], params.searchInMainUniversity, true,false,function(data){
if(data.status == "success") {
$scope.addUserInputList = data.details
......
......@@ -103,7 +103,7 @@ function $companyFactory($rootScope,$serverFactory) {
* [setEntrepriseField description]
* @param {[int]} entrepriseId [description]
* @param {[int]} universityId [description]
* @param {[object]} field [{visibility, value, key}]
* @param {[object]} field [{visibility, value, label}]
* @param {[type]} success [description]
* @param {[type]} failure [description]
*/
......@@ -132,7 +132,7 @@ function $companyFactory($rootScope,$serverFactory) {
* @return {[type]} [description]
*/
returns.getUniversityEntrepriseNotes=function(entrepriseId, universityId,success, failure){
return $serverFactory.runCommand("getUniversityEntrepriseNotes", {entrepriseId:entrepriseId, universityId:universityId},success,failure);
return $serverFactory.runCommand("get_university_EntrepriseNotes", {entrepriseId:entrepriseId, universityId:universityId},success,failure);
}
/**
......@@ -144,7 +144,7 @@ function $companyFactory($rootScope,$serverFactory) {
* @param {[type]} failure [description]
*/
returns.addUniversityEntrepriseNote=function(entrepriseId, universityId,note,success, failure){
return $serverFactory.runCommand("addUniversityEntrepriseNote", {entrepriseId:entrepriseId, universityId:universityId,note:note},success,failure);
return $serverFactory.runCommand("post_university_EntrepriseNote", {entrepriseId:entrepriseId, universityId:universityId,note:note},success,failure);
}
/**
......
......@@ -151,11 +151,11 @@ function $contactFactory($rootScope,$serverFactory) {
returns.getUniversityEntrepriseContacts=function(universityId, entrepriseId,success, failure){
return $serverFactory.runCommand("getUniversityEntrepriseContacts", {universityId:universityId, entrepriseId:entrepriseId},success,failure);
return $serverFactory.runCommand("get_university_EntrepriseContacts", {universityId:universityId, entrepriseId:entrepriseId},success,failure);
}
returns.addUniversityEntrepriseContact=function(universityId, entrepriseId,element,success, failure){
return $serverFactory.runCommand("addUniversityEntrepriseContact", {universityId:universityId, entrepriseId:entrepriseId,element:element},success,failure);
return $serverFactory.runCommand("post_university_EntrepriseContact", {universityId:universityId, entrepriseId:entrepriseId,element:element},success,failure);
}
......
......@@ -287,7 +287,7 @@ function $fileFactory($rootScope,$serverFactory,$window, $languageFactory, $filt
* @return {[array]} [all datas to insert]
*/
returns.post_file_uploadUserFile = function(projectId, name, type, size, file, success,failure){
return $serverFactory.runCommand("post_file_data", {projectId:projectId,name:name, type:type, size:size, file:file},success,failure);
return $serverFactory.runCommand("post_file_data", {projectId:projectId,name:name, type:type, file:file, size:size},success,failure);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment