-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created CoursesFinalInscriptionsClose Method (#125)
Crated Close Final Modal
- Loading branch information
1 parent
8075a8d
commit af5239b
Showing
12 changed files
with
172 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
define(['paw', 'services/modalFactory', 'services/Courses', 'services/flashMessages'], function(paw) { | ||
paw.controller('CloseFinalController', | ||
['modalFactory', '$log', 'Courses', '$route', 'flashMessages', | ||
function (modalFactory, $log, Courses, $route, flashMessages) { | ||
var modalTemplateUrl = 'views/modals/close_final.html'; | ||
var onSuccess = function(result) { | ||
Courses.closeFinalInscription(result.courseId, result.id) | ||
.then(function(response) { | ||
flashMessages.setSuccess('i18nCloseFinalSuccess'); | ||
$route.reload(); | ||
}, function(response) { | ||
flashMessages.setError('i18nFormErrors'); | ||
$log.warn('[ERROR] - Response: ' + JSON.stringify(response)); | ||
$route.reload(); | ||
}); | ||
}; | ||
|
||
var onFailure = function(msg) { | ||
$log.info(msg); | ||
}; | ||
this.open = function (size, title, courseId, courseName, finalExamDate, id) { | ||
var resolve = getResolve(title, courseId, courseName, finalExamDate, id); | ||
modalFactory.create(size, 'CloseFinalModalInstanceController', modalTemplateUrl, resolve, onSuccess, onFailure); | ||
}; | ||
}]); | ||
|
||
paw.controller('CloseFinalModalInstanceController', | ||
function($uibModalInstance, title, courseId, courseName, finalExamDate, id) { | ||
this.title = title; | ||
this.courseId = courseId; | ||
this.courseName = courseName; | ||
this.finalExamDate = finalExamDate; | ||
this.id = id; | ||
|
||
var _this = this; | ||
|
||
this.ok = function () { | ||
$uibModalInstance.close({ | ||
courseId: courseId, | ||
courseName: courseName, | ||
finalExamDate: finalExamDate, | ||
id: id | ||
}); | ||
}; | ||
|
||
this.cancel = function () { | ||
$uibModalInstance.dismiss('Close Final modal dismissed at: ' + new Date()); | ||
}; | ||
}); | ||
|
||
function getResolve(title, courseId, courseName, finalExamDate, id) { | ||
return { | ||
title: function() { | ||
return title; | ||
}, | ||
courseId: function () { | ||
return courseId; | ||
}, | ||
courseName: function () { | ||
return courseName; | ||
}, | ||
finalExamDate: function () { | ||
return finalExamDate; | ||
}, | ||
id: function() { | ||
return id; | ||
} | ||
}; | ||
}; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class='modal-header'> | ||
<h4 class='modal-title' id='modal-title' translate='i18nModalCloseFinal'></h4> | ||
</div> | ||
<div class='modal-body'> | ||
<p class='break-words'> | ||
<span class='bold' translate='i18nModalCourseId'></span>: {{ controller.courseId }} | ||
</p> | ||
<p class='break-words'> | ||
<span class='bold' translate='i18nModalCourseName'></span>: {{ controller.courseName }} | ||
</p> | ||
<p class='break-words'> | ||
<span class='bold' translate='i18nFinalExamDate'></span>: {{ controller.finalExamDate | date: 'dd/MM/yyyy HH:mm'}} | ||
</p> | ||
</div> | ||
<div class='modal-footer'> | ||
<button class='btn btn-default' type='button' ng-click="controller.cancel()" translate='i18nCancel'></button> | ||
<button class='btn btn-info' type='button' ng-click='controller.ok()' translate='i18nConfirm'></button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters