Skip to content
This repository has been archived by the owner on Aug 21, 2018. It is now read-only.

Commit

Permalink
[#840]:list career added
Browse files Browse the repository at this point in the history
  • Loading branch information
razu9861 committed Jun 26, 2017
1 parent 979fa97 commit 422c207
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions app/MyApp/app/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6808,15 +6808,15 @@ $(function() {
uncheckAllText: App.languageDict.attributes.unCheckAll,
selectedText: '# '+App.languageDict.attributes.Selected
});
$('#LCourse').multiselect().multiselectfilter("widget")[0].children[0].firstChild.data=App.languageDict.attributes.Filter;
$('#LCareer').multiselect().multiselectfilter("widget")[0].children[0].firstChild.data=App.languageDict.attributes.Filter;
$('.ui-multiselect-filter').find('input').attr('placeholder',App.languageDict.attributes.KeyWord_s);
$('#LCareer').attr("multiple", true);
$('#LCareer').multiselect("uncheckAll");
///
var directionOfLang = App.languageDict.get('directionOfLang');
applyCorrectStylingSheet(directionOfLang)

},

manageCourseCareer: function(cname,cId){
var courseCareerPath = new App.Models.CoursecareerPath({
_id : cId
Expand Down
18 changes: 2 additions & 16 deletions app/MyApp/app/collections/CourseCareerPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $(function() {
url: function() {
if (this.CoursePathName!= undefined && this.MemberID!= undefined ) {
return App.Server + '/coursecareerpath/_design/bell/_view/GetCourseCareerByLevelNameMemberIds?key=["' +this.CoursePathName + '","' +this.MemberID+ '"]&include_docs=true'
} else if (this.CoursePathName!= undefined && this.MemberID == undefined ) {
} else if (this.CoursePathName!= undefined ) {
return App.Server + '/coursecareerpath/_design/bell/_view/getCourseCareerByName?key=["' +this.CoursePathName + '"]&include_docs=true'
} else {
return App.Server + '/coursecareerpath/_all_docs?include_docs=true'
Expand All @@ -20,21 +20,7 @@ $(function() {
},
initialize: function() {
this.sort_key = 'CoursePathName';
},
comparator: function(a, b) {
// Assuming that the sort_key values can be compared with '>' and '<',
// modifying this to account for extra processing on the sort_key model
// attributes is fairly straight forward.
a = a.get(this.sort_key);
b = b.get(this.sort_key);
if (a > b)
console.log("before")
return a > b ? 1 : a < b ? -1 : 0;
},
/*comparator: function(model) {
var type = model.get('Type')
if (type) return type.toLowerCase()
} */
}
})

})
67 changes: 39 additions & 28 deletions app/MyApp/app/views/AddCourseCareer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ $(function() {
this.renderTable($('#searchText').val().toLowerCase())
},
"click #buttonCareer": function(){
alert('Hello')
},
"click #AddCareerPath": function() {
this.saveCareerPath();
var a1 = $("#careerPath").val()
if(a1 != "")
this.saveCareerPath();
},
"click #CancelCoursePath": function(e) {
},
Expand Down Expand Up @@ -40,7 +41,6 @@ $(function() {
$('#careerPath').val(courseCareer.attributes.CoursePathName);
$('#UpdateCareerPath').css('display','');
$('#UpdateCareerPath').attr('data-id',currentId);
console.log($('#UpdateCareerPath').attr('data-id'))
},
"click #UpdateCareerPath": function(e) {
this.saveCareerPath($('#UpdateCareerPath').attr('data-id'));
Expand All @@ -63,37 +63,44 @@ $(function() {
$(".btable").append("<tr><td>"+career.models[0].attributes.CoursePathName+"</td><td><ul><li>"+career.models[0].attributes.Courses+"</ul></li></td><td></td></tr>")
App.stopActivityIndicator()
},

error: function() {
App.stopActivityIndicator()
}
})
console.log(career)

},

saveCareerPath: function(previousId){
var selectedCourseId = []
var selectedCourseName = []
var selectedCareerIds = []
if(previousId){
var courseCareer = new App.Models.CoursecareerPath({
_id : previousId
})
courseCareer.fetch({
async: false
});
console.log(courseCareer)
$('#LCourse option:selected').each(function(){
if ($(this).length) {
selectedCourseId.push($(this).val());
selectedCourseName.push($(this).text());
}
});
$('#LCareer option:selected').each(function(){
if ($(this).length) {
selectedCareerIds.push($(this).val());
}
});
var courseCareerTitle = $('#careerPath').val()
courseCareer.set('CareerPathName',courseCareerTitle);
courseCareer.set('Courses',selectedCourseName);
courseCareer.set('CourseIds',selectedCourseId);
courseCareer.set('MemberID',$.cookie('Member._id'));
courseCareer.set('requiredCareerPathIds',selectedCareerIds);
courseCareer.save(null, {
success: function(response){
location.reload();
},
error: function() {
console.log("Not Saved")
}
Expand All @@ -106,47 +113,49 @@ $(function() {
selectedCourseName.push($(this).text());
}
});
$('#LCareer option:selected').each(function(){
if ($(this).length) {
selectedCareerIds.push($(this).val());
}
});
var courseCareerTitle = $('#careerPath').val()
var savecoursecareer = new App.Models.CoursecareerPath()
savecoursecareer.set('CoursePathName',courseCareerTitle);
savecoursecareer.set('Courses',selectedCourseName);
savecoursecareer.set('CourseIds',selectedCourseId);
savecoursecareer.set('MemberID',$.cookie('Member._id'));
savecoursecareer.set('requiredCareerPathIds',selectedCareerIds);
savecoursecareer.save(null, {
error: function() {
success: function(response){
location.reload();
},
error: function(status) {
console.log(status)
console.log("Not Saved")
}
})
var selectedCareerIds = []
$('#LCareer option:selected').each(function(){
if ($(this).length) {
selectedCareerIds.push($(this).val());
}
});
savecoursecareer.set('requiredCareerPathIds',selectedCareerIds);
savecoursecareer.save(null, {
error: function() {
console.log("Not Saved")
}
});
}
},


render: function() {
var arrcourses = []
var arrCourseIds = []
for(var i = 0; i <this.collection.models.length-1; i++){
var courseslist = this.collection.models[i].attributes.CourseTitle
var courseId = this.collection.models[i].attributes._id
arrcourses.push(courseslist)
arrCourseIds.push(courseId)
for(var i = 0; i <this.collection.models.length; i++){
if(this.collection.models[i].id != '_design/bell'){
var courseslist = this.collection.models[i].attributes.CourseTitle
var courseId = this.collection.models[i].attributes._id
arrcourses.push(courseslist)
arrCourseIds.push(courseId)
}

}
var courseCareers = new App.Collections.CourseCareerPath()
courseCareers.memberId = $.cookie('Member._id');
courseCareers.fetch({
async:false
});

this.vars.careerList = [];
for(var i = 0; i < (courseCareers.length); i++) {
if(courseCareers.models[i].attributes._id !== "_design/bell"){
Expand All @@ -159,12 +168,14 @@ $(function() {
////PushRequired ID
this.vars.CareerList = [];
this.vars.careerListIds = [];
for(var j = 1; j< courseCareers.length; j++){
for(var j = 0; j< courseCareers.length; j++){
if(courseCareers.models[j].attributes._id != '_design/bell'){
this.vars.CareerList.push(courseCareers.models[j].attributes.CoursePathName);
this.vars.careerListIds.push(courseCareers.models[j].attributes._id);

this.vars.careerlength = j + 1
}

}
this.vars.careerlength =courseCareers.length-2
this.$el.html(_.template(this.template,this.vars))
},
})
Expand Down
8 changes: 5 additions & 3 deletions app/MyApp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1465,15 +1465,17 @@ <h4 style="width:25em;word-wrap:break-word;">
<div class ="multipleCourse">
<form>
<label for="cpName"><b><%= languageDict.attributes.Career_Path_Name %></b></label>
<input type="text" id="careerPath" placeholder="Career Path Name" style="padding: 2px; margin-top: 8px;">
<input type="text" id="careerPath" placeholder="Career Path Name" style="padding: 2px; margin-top: 8px;" required>
<label for="LCourse"><b><%= languageDict.attributes.List_of_Courses %></b></label>
<select id="LCourse">
<%for(var i =0; i<Course_Length;i++){%>
<option value='<%=Courseid[i]%>'><%=Courselist[i]%></option>
<%}%>
</select>
<label for="LCareer"><b><%= languageDict.attributes.Required_Course_Career_Path %></b></label>

<select id="LCareer">

<% for (var j =0; j<careerlength;j++){%>
<option value ='<%=CareerList[j]%>'><%=CareerList[j]%></option>
<%}%>
Expand All @@ -1486,9 +1488,9 @@ <h4 style="width:25em;word-wrap:break-word;">
<table class="btable btable-striped">
<tbody>
<tr>
<th>Career Lists</th>
<th><%=languageDict.attributes.Career_Path_Name%></th>
<th><%=languageDict.attributes.Courses_List%></th>
<th>Career List</th>
<th><%= languageDict.attributes.Career_List %></th>
<th><%= languageDict.attributes.Actions %></th>
</tr>
<%for (var i=0; i < careerList.length; i++) {%>
Expand Down
3 changes: 2 additions & 1 deletion init_docs/Text.json
Original file line number Diff line number Diff line change
Expand Up @@ -942,5 +942,6 @@
"Note_Password_Reset_Duration_HH": "Note : 0 hr means Manual",
"Nation_Rejected": "Community registration request rejected",
"Nation_Pending": "Community registration request pending",
"Marks_Should_not_be_Zero_or_Negative":"Marks Should not be Zero or Negative"
"Marks_Should_not_be_Zero_or_Negative":"Marks Should not be Zero or Negative",
"Career_List": "Career List"
}

0 comments on commit 422c207

Please sign in to comment.