Brak opisu

editQuestion.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. $('#EditQuestion').on('show.bs.modal', function(event) {
  2. var tableRow = $(event.relatedTarget);
  3. var questionNumber = $(tableRow).data('question-number');
  4. // var questionnaireID = $(tableRow).data('questionnaire-id');
  5. var questionID = $(tableRow).data('question-id');
  6. var premise = $(tableRow).data('premise');
  7. var type = $(tableRow).data('type');
  8. var min_text = $(tableRow).data('min_text');
  9. var max_val = $(tableRow).data('max_val');
  10. var max_text = $(tableRow).data('max_text');
  11. var categoryID = $(tableRow).data('categoryid');
  12. var subcategoryID = $(tableRow).data('subcategoryid');
  13. var modal = $(this);
  14. // console.log('questionNumber' + questionNumber);
  15. // console.log('questionnaireID' + questionnaireID);
  16. // console.log('questionID' + questionID);
  17. // console.log('premise' + premise);
  18. // console.log('type' + type);
  19. // console.log('min_text' + min_text);
  20. // console.log('max_val' + max_val);
  21. // console.log('max_text' + max_text);
  22. // console.log('categoryID' + categoryID);
  23. // console.log('subcategoryID' + subcategoryID);
  24. // console.log(modal);
  25. deleteModal = $('#Delete');
  26. deleteModal.find('.modal-body [name=questionID]').val(questionID);
  27. deleteModal.find('.modal-body .question-number').text(questionNumber);
  28. modal.find('.modal-body .question-number').text(questionNumber);
  29. // modal.find('.modal-body input[name="questionnaireID"]').val(questionnaireID);
  30. modal.find('.modal-body input[name="questionID"]').val(questionID);
  31. modal.find('.modal-body input[name="update_q_premise"]').val(premise);
  32. modal.find('.modal-body select[name="update_q_type"]').val(type);
  33. // min_val not necessary (always 1)
  34. modal.find('.modal-body input[name="update_min_text"]').val(min_text);
  35. modal.find('.modal-body input[name="update_max_val"]').val(max_val);
  36. modal.find('.modal-body input[name="update_max_text"]').val(max_text);
  37. modal.find('.modal-body select[name="update_q_category"]').val(categoryID);
  38. modal.find('.modal-body select[name="update_q_subcategory"]').val(subcategoryID);
  39. if(type === 2) {
  40. modal.find('.modal-body .range').css('display', 'none');
  41. } else if(type === 1) {
  42. modal.find('.modal-body .range').css('display', 'block');
  43. }
  44. });