|
@@ -335,20 +335,25 @@
|
335
|
335
|
id: id
|
336
|
336
|
},
|
337
|
337
|
function(json) {
|
338
|
|
-
|
339
|
|
- var text = json.objective[0].text;
|
|
338
|
+// console.log(json.objective.length);
|
|
339
|
+ if((json.objective.length))
|
|
340
|
+ {
|
|
341
|
+ var text = json.objective[0].text;
|
340
|
342
|
|
341
|
343
|
|
342
|
344
|
// Display info
|
343
|
345
|
$('#objective-text').val(text);
|
344
|
|
-
|
|
346
|
+ }
|
345
|
347
|
|
346
|
348
|
// Select associated outcome
|
347
|
349
|
for (var i = counterAssoc; i != 1; i--) {
|
348
|
350
|
deleteLastAssoc(i);
|
349
|
351
|
|
350
|
352
|
}
|
351
|
|
- $('#assoc_outcome0').val(json.outcome[0].outcome_id);
|
|
353
|
+ if((json.objective.length))
|
|
354
|
+ {
|
|
355
|
+ $('#assoc_outcome0').val(json.outcome[0].outcome_id);
|
|
356
|
+ }
|
352
|
357
|
$('#assoc_outcome0').selectpicker('refresh');
|
353
|
358
|
counterAssoc = 1;
|
354
|
359
|
for (var i = 1; i < json.outcome.length; i++) {
|
|
@@ -399,9 +404,11 @@
|
399
|
404
|
$('#assoc_program_id_' + prog).prop("checked", true);
|
400
|
405
|
}
|
401
|
406
|
|
|
407
|
+ // if((json.objective.length))
|
|
408
|
+// {
|
402
|
409
|
|
403
|
410
|
// Select status
|
404
|
|
- if (json.objective[0].deleted_at)
|
|
411
|
+ if (json.objective.length && json.objective[0].deleted_at)
|
405
|
412
|
$('#status').val(0);
|
406
|
413
|
else
|
407
|
414
|
$('#status').val(1);
|
|
@@ -413,10 +420,11 @@
|
413
|
420
|
modal =
|
414
|
421
|
'<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
|
415
|
422
|
'Delete' +
|
416
|
|
- '</button>' +
|
417
|
|
- '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
|
|
423
|
+ '</button>';
|
|
424
|
+ if(json.objective.lenght)
|
|
425
|
+ modal +='<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">';
|
418
|
426
|
|
419
|
|
- '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
|
|
427
|
+ modal +='<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
|
420
|
428
|
'<div class="modal-dialog" role="document">' +
|
421
|
429
|
'<div class="modal-content">' +
|
422
|
430
|
' <div class="modal-header">' +
|
|
@@ -448,10 +456,11 @@
|
448
|
456
|
modal =
|
449
|
457
|
'<button type="button" class="btn btn-primary btn-block" data-toggle="modal" data-target="#delete">' +
|
450
|
458
|
'Delete' +
|
451
|
|
- '</button>' +
|
452
|
|
- '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' +
|
|
459
|
+ '</button>';
|
|
460
|
+ if(json.objective.length)
|
|
461
|
+ modal += '<input type="hidden" value =' + json.objective[0].id + ' name="deleteObj">' ;
|
453
|
462
|
|
454
|
|
- '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
|
|
463
|
+ modal += '<div class="modal fade" id="delete" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">' +
|
455
|
464
|
'<div class="modal-dialog" role="document">' +
|
456
|
465
|
'<div class="modal-content">' +
|
457
|
466
|
' <div class="modal-header">' +
|
|
@@ -599,7 +608,7 @@
|
599
|
608
|
|
600
|
609
|
$('#outcome-display').parent().hide();
|
601
|
610
|
|
602
|
|
- fetchObjectiveForEditing();
|
|
611
|
+<!-- fetchObjectiveForEditing(); -->
|
603
|
612
|
// setCriterionStatus();
|
604
|
613
|
|
605
|
614
|
fetchAllObjectives("select-program", "assoc_outcomes_fetch")
|