Merge remote-tracking branch 'origin/master'

This commit is contained in:
gandhimathi 2018-02-27 18:04:05 +05:30
commit 7e909d912f
2 changed files with 143 additions and 5 deletions

View File

@ -1177,7 +1177,7 @@ app.controller('studentCtrl', ["$scope", "toaster", "$filter", "ngTableParams",
if (response.data.deleteStatus == true) {
// swal("Success!", response.data.message, "success");
$scope.documentTrackAddDetailsLoading = false;
$scope.studentDocumentsList = '';
// $scope.studentDocumentsList = '';
$scope.getStudentPendingEntrolDocDetails(StuID);
} else {
swal(" ", res.data.message, "error");
@ -2457,6 +2457,139 @@ app.controller('studentSuperAdminCtrl', ["$scope", "toaster", "$filter", "ngTabl
}
}
// $scope.PendingDocNotFound = false;
// student pending document details
$scope.getStudentPendingEntrolDocDetails = function(stuId) {
// $scope.studentDocumentsList = '';
var getStudentPendingDocDetails = {
method: 'POST',
url: apiPoint.url + 'getListofStuPendingDocDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
exceptId: stuId,
localData: localDetail
}
};
$http(getStudentPendingDocDetails).then(function (response) {
if (response.data.PendingDocListStatus == true) {
// $scope.PendingDocNotFound = false;
$scope.studentPendingDocumentsDetails = response.data.student_pending_doc_details;
} else {
// $scope.PendingDocNotFound = true;
}
});
}
$scope.myModelAddPendingDocDetails = {
"documentDetails": "",
"checkTracking": false
}
$scope.documentTrackAddDetailsLoading = false;
$scope.studentEntrollPendingDocFORM = {
submit: function (form, myModelAddPendingDocDetails, stuID) {
$scope.documentTrackAddDetailsLoading = true;
var firstError = null;
if (form.$invalid) {
var field = null, firstError = null;
for (field in form) {
if (field[0] != '$') {
if (firstError === null && !form[field].$valid) {
firstError = form[field].$name;
}
if (form[field].$pristine) {
form[field].$dirty = true;
}
}
}
angular.element('.ng-invalid[name=' + firstError + ']').focus();
// swal("The form cannot be submitted because it contains validation errors!", "Errors are marked with a red, dashed border!", "error");
} else {
var ModelDetails = {
"student" : stuID,
"doc_Details": myModelAddPendingDocDetails.documentDetails,
"checkTracking": myModelAddPendingDocDetails.checkTracking
};
var updateStudentPendingDocDetails = {
method: 'POST',
url: apiPoint.url + 'addStudentEnrollPendingDocDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
updateDetails: ModelDetails,
localData: localDetail
}
};
$http(updateStudentPendingDocDetails).then(function (response) {
if (response.data.AddStuPendingDocStatus == true) {
$scope.getStudentPendingEntrolDocDetails(stuID);
$scope.documentTrackAddDetailsLoading = false;
$scope.myModelAddPendingDocDetails = {
"documentDetails": "",
"checkTracking": false
}
} else {
swal(" ", res.data.message, "error");
$scope.documentTrackAddDetailsLoading = false;
}
});
}
},
reset: function (form) {
$scope.myModelAddPendingDocDetails = {
"documentDetails": "",
"checkTracking": false
}
}
}
$scope.deletePendingDocDetails = function(details, StuID, Url) {
// alert(JSON.stringify(details));
SweetAlert.swal({
title: "Warning!",
text: "Want to Delete this Entry ?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#007aff",
confirmButtonText: "Yes!"
}, function (res) {
if (res === true) {
$scope.documentTrackAddDetailsLoading = true;
var deleteDocEntry = {
method: 'POST',
url: apiPoint.url + 'deleteDocPendingDetails/',
headers: {
'Content-Type': 'application/json'
},
data: {
exceptId: details.ID,
localData: localDetail
}
};
$http(deleteDocEntry).then(function (response) {
if (response.data.deleteStatus == true) {
// swal("Success!", response.data.message, "success");
$scope.documentTrackAddDetailsLoading = false;
// $scope.studentDocumentsList = '';
$scope.getStudentPendingEntrolDocDetails(StuID);
} else {
swal(" ", res.data.message, "error");
$scope.documentTrackAddDetailsLoading = false;
}
});
}
});
}
// end : entrollment document upload ====================================
@ -2772,14 +2905,19 @@ app.controller('ModalInstanceCtrl1', ["$scope", "$modalInstance", "items1", "Wor
// Hook in a directive
app.directive('fileDownload', function(){
app.directive('fileDownload', function($window){
// alert(path);
return {
restrict: 'E', // applied on 'element'
scope: {
fileurl: '@fileurl',
linktext: '@linktext'
linktext: '@linktext'
},
template: '<a href="{{ fileurl }}" download><button tooltip="Download" class="btn btn-xs btn-primary"><i class="ti-download"> </i></button></a>', // need this so that the inner HTML can be re-used
controller: function($scope) {
$scope.path = $window.location.origin + $window.location.pathname + 'images/';
},
template: '<a href="{{ path }}{{ fileurl }}" download><button tooltip="Download" class="btn btn-xs btn-primary"><i class="ti-download"> </i></button></a>', // need this so that the inner HTML can be re-used
link: function(scope, elem, attrs) {
/* Ref: https://thinkster.io/egghead/isolate-scope-at
* This block is used when we have

View File

@ -467,7 +467,7 @@
<td class="center">
<!--<td class="center"><button tooltip="Download" class="btn btn-xs btn-primary" ng-click="printPdf(doc.DocumentStorePath)"><i class="ti-download">
<a ng-href="http://localhost/apollo_New_Update_20_02_2018/apollodec/Apollo/images/{{doc.DocumentStorePath}}" target="_blank"></a> </i></button>-->
<file-download fileurl="http://localhost/apollo_New_Update_20_02_2018/apollodec/Apollo/images/{{doc.DocumentStorePath}}" linktext="Click here!"></file-download>
<file-download fileurl="{{doc.DocumentStorePath}}" linktext="Click here!"></file-download>
<button tooltip="Delete" class="btn btn-xs btn-danger" ng-click="deleteDocDetails(doc.ID, p.StudentID)"><i class="ti-trash">
</i></button>
</td>