Commit 12329c837f2c52f1ba3d7ddaaf19f2dd396abced

Authored by unknown
1 parent dd330b0c

Implemented email template

400-SOURCECODE/AIAHTML5.API/Controllers/LabExerciseController.cs
... ... @@ -260,7 +260,7 @@ namespace AIAHTML5.API.Controllers
260 260 {
261 261 aar.Add(User["EmailAdd"].ToString());
262 262 }
263   - AIAHTML5.API.Models.UserUtility.SendEmail(User, aar, User["EmailAdd"].ToString(), "test", User["reportImage"].ToString());
  263 + AIAHTML5.API.Models.UserUtility.SendEmail(User, aar, User["EmailAdd"].ToString(), User["reportTitle"].ToString(), User["reportImage"].ToString());
264 264 return Request.CreateResponse(HttpStatusCode.OK);
265 265 }
266 266 [Route("api/LabExercise/GetParameter")]
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/LabExercController.js
... ... @@ -1293,15 +1293,38 @@ function ($scope, $rootScope, pages, log, $http, $timeout, DataService, $filter,
1293 1293 console.log(User);
1294 1294 html2canvas($("#submitResultHtml"), {
1295 1295 onrendered: function (canvas) {
1296   - var dataURL = canvas.toDataURL("image/jpeg");
1297   - var imageToPrint = new Image();
1298   - imageToPrint.src = dataURL;
1299   - console.log(imageToPrint.src);
1300   - $scope.reportImage = imageToPrint.src;
  1296 + // var dataURL = canvas.toDataURL("image/jpeg");
  1297 + // dataURL = dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
  1298 + // var imageToPrint = new Image();
  1299 + // imageToPrint.src = dataURL;
  1300 + // console.log(imageToPrint.src);
  1301 + // $scope.reportImage = imageToPrint.src;
  1302 + console.log($("#submitResultHtml").html());
  1303 + // $scope.reportImage = "<html><head><link href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap-theme.css' rel='stylesheet'/><link href='themes/default/css/bootstrap/3.3.6/main.css' rel='stylesheet'/><body>" + $("#submitResultHtml").html() + "</body></head></html>";
  1304 + alert($("#submitResultHtml .panel-heading .row div:nth-child(1)").text());
  1305 + var htm = '';
  1306 + htm += '<table style="width:100%;"><thead><th style="padding:15px;border:1px solid #cccccc"><strong>Question</strong></th><th style="padding:15px;border:1px solid #cccccc"><strong>Activity Title</strong></th><th style="padding:15px;border:1px solid #cccccc"><strong>Status</strong></th></thead><tbody>';
  1307 + $("#resultLabData tr").each(function () {
  1308 + htm += '<tr>';
  1309 + $(this).children("td").each(function () {
  1310 +
  1311 + if ($(this).text() == " Review") { }
  1312 + else{
  1313 + htm += '<td style="border:1px solid #cccccc;padding:15px;">'+$(this).text()+'</td>';
  1314 + alert($(this).text());
  1315 + }
  1316 + });
  1317 + htm += '</tr>';
  1318 +
  1319 + });
  1320 +
  1321 + htm += '</tbody></table>';
  1322 + $scope.reportImage = "<table style='width:100%;'><tr><td style='padding:15px;'><strong>"+$("#submitResultHtml .panel-heading .row div:nth-child(1)").text()+"</strong></td><td style='padding:15px;'>Performance Report</td><td style='padding:15px;text-align:right;'><span>" + $("#submitResultHtml .panel-heading .row div:nth-child(3)").text() + "</span></td></tr></table><table style='width:100%;'><thead><th style='text-align:center;padding:15px;border:1px solid #cccccc;'><strong>Total Question</strong></th><th style='border:1px solid #cccccc;text-align:center;padding:15px;'><strong>Correct Answers</strong></th><th style='border:1px solid #cccccc;padding:15px;text-align:center;'><strong>Incorrect Answers</strong></th></thead><tr><td style='border:1px solid #cccccc;padding:15px;text-align:center;'><span>" + $("#questionStatus tbody tr td:nth-child(1)").text() + "</span></td><td style='text-align:center;border:1px solid #cccccc;padding:15px;'><span>" + $("#questionStatus tbody tr td:nth-child(2)").text() + "</span></td><td style='text-align:center;border:1px solid #cccccc;padding:15px;'><span>" + $("#questionStatus tbody tr td:nth-child(3)").text() + "</span></td></tr></table><br/><br/>" + htm + "";
  1323 + $scope.reportTitle = "Lab Exercise Report for " + $("#submitResultHtml .panel-heading .row div:nth-child(1)").text();
1301 1324 }
1302 1325 });
1303   - debugger;
1304   - LabExerciseService.LabExerciseReport(User, $scope.reportImage).then(
  1326 +
  1327 + LabExerciseService.LabExerciseReport(User, $scope.reportImage, $scope.reportTitle).then(
1305 1328  
1306 1329 function (result) {
1307 1330 console.log(result);
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/LabExerciseService.js
... ... @@ -51,10 +51,10 @@
51 51 },
52 52  
53 53 // code of email report
54   - LabExerciseReport: function (User, reportImage) {
  54 + LabExerciseReport: function (User, reportImage, reportTitle) {
55 55 User.reportImage = reportImage;
  56 + User.reportTitle = reportTitle;
56 57 var deferred = $q.defer();
57   - debugger;
58 58 // var jsonData = { 'EmailTo': User.EmailTo, 'EmailAdd': User.EmailAdd };
59 59 $http.post('http://192.168.90.19:91/API/api/LabExercise/SendEmail', JSON.stringify(User), {
60 60  
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/LabExerc/lab-exercises-detail.html
... ... @@ -201,7 +201,7 @@
201 201 <div class="panel-body no-padding">
202 202 <div class="row">
203 203 <div class="col-sm-12 table-responsive ">
204   - <table class="table table-hover table-condensed bg-white">
  204 + <table class="table table-hover table-condensed bg-white" id="questionStatus">
205 205 <thead>
206 206 <tr class="active">
207 207 <th class="text-center">Total Question</th>
... ...