From 422c207a805d98e8074aa562c74342b47abc1117 Mon Sep 17 00:00:00 2001 From: Raju Chaudhary Date: Mon, 26 Jun 2017 10:11:40 +0545 Subject: [PATCH] [#840]:list career added --- app/MyApp/app/Router.js | 4 +- app/MyApp/app/collections/CourseCareerPath.js | 18 +---- app/MyApp/app/views/AddCourseCareer.js | 67 +++++++++++-------- app/MyApp/index.html | 8 ++- init_docs/Text.json | 3 +- 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/app/MyApp/app/Router.js b/app/MyApp/app/Router.js index 1f531e217..4a1e49c88 100644 --- a/app/MyApp/app/Router.js +++ b/app/MyApp/app/Router.js @@ -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 diff --git a/app/MyApp/app/collections/CourseCareerPath.js b/app/MyApp/app/collections/CourseCareerPath.js index 6bd3dd53a..105277a85 100644 --- a/app/MyApp/app/collections/CourseCareerPath.js +++ b/app/MyApp/app/collections/CourseCareerPath.js @@ -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' @@ -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() - } */ + } }) }) diff --git a/app/MyApp/app/views/AddCourseCareer.js b/app/MyApp/app/views/AddCourseCareer.js index 8d92c8b1f..1825f6c94 100644 --- a/app/MyApp/app/views/AddCourseCareer.js +++ b/app/MyApp/app/views/AddCourseCareer.js @@ -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) { }, @@ -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')); @@ -63,17 +63,16 @@ $(function() { $(".btable").append(""+career.models[0].attributes.CoursePathName+"") 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 @@ -81,19 +80,27 @@ $(function() { 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") } @@ -106,29 +113,27 @@ $(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") - } - }); } }, @@ -136,17 +141,21 @@ $(function() { render: function() { var arrcourses = [] var arrCourseIds = [] - for(var i = 0; i
- + +