|
|
|
@ -1,15 +1,23 @@
|
|
|
|
|
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', function($scope, $http, $routeParams, config, auth, alertService){
|
|
|
|
|
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', function($scope, $http, $routeParams, config, auth, alertService,rms){
|
|
|
|
|
var vm = $scope;
|
|
|
|
|
var send_id = $routeParams.id;
|
|
|
|
|
|
|
|
|
|
vm.alertService = alertService.create();
|
|
|
|
|
vm.courses = [];
|
|
|
|
|
// vm.courses = [];
|
|
|
|
|
vm.syllabuses = [];
|
|
|
|
|
|
|
|
|
|
var loadClassList = function () {
|
|
|
|
|
$http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then(
|
|
|
|
|
// $http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then(
|
|
|
|
|
// function (response) {
|
|
|
|
|
// console.log(response.data);
|
|
|
|
|
// vm.courses = response.data.data;
|
|
|
|
|
// }
|
|
|
|
|
// );
|
|
|
|
|
$http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then(
|
|
|
|
|
function (response) {
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
vm.courses = response.data.data;
|
|
|
|
|
vm.syllabuses = response.data.data;
|
|
|
|
|
rms.save('syllabuses', vm.syllabuses);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
@ -24,9 +32,11 @@ app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'co
|
|
|
|
|
vm.sendToCourses = function(){
|
|
|
|
|
var course_ids = [];
|
|
|
|
|
|
|
|
|
|
for(var i in vm.courses){
|
|
|
|
|
if(vm.courses[i].checked){
|
|
|
|
|
course_ids.push(vm.courses[i].id);
|
|
|
|
|
for(var i in vm.syllabuses) {
|
|
|
|
|
for (var j in vm.syllabuses[i].courses) {
|
|
|
|
|
if (vm.syllabuses[i].courses[j].checked) {
|
|
|
|
|
course_ids.push(vm.syllabuses[i].courses[j].id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|