sub-menu.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. function buildOperationsSubMenu() {
  2. subMenuOptionsTitleH3.innerText = `Operações`;
  3. let body = ``;
  4. let allWorkspaceComponents = $(
  5. `input[type="hidden"][name="${WORKSPACE_COMPONENTS_NAME}"]`
  6. );
  7. body += `<hr />`;
  8. // Value attribution manipulation
  9. body += `<div class="p-3 text-center">`;
  10. body += ` <h5>Atribuir</h5>`;
  11. body += `</div>`;
  12. body += `<div>`;
  13. body += ` <div class="row p-3 operation-sub-menu">`;
  14. body += ` <div class="col-md-5 text-center">`;
  15. body += ` <select class="form-control" id="firstOperationSubMenuVariable">`;
  16. for (let i = 0; i < variables.length; i++) {
  17. body += ` <option value="${i}">${variables[i].name}</option>`;
  18. }
  19. body += ` </select>`;
  20. body += ` </div>`;
  21. body += ` <div class="col-2 text-center">`;
  22. body += ` <select class="form-control" id="operationTypeSubMenu">`;
  23. for (let i = 0; i < operators.length; i++) {
  24. body += ` <option value="${operators[i].value}">${operators[i].operator}</option>`;
  25. }
  26. body += ` </select>`;
  27. body += ` </div>`;
  28. body += ` <div class="col-md-5 text-center">`;
  29. body += ` <select class="form-control" id="secondOperationSubMenuVariable">`;
  30. for (let i = 0; i < variables.length; i++) {
  31. body += ` <option value="${i}">${variables[i].name}</option>`;
  32. }
  33. body += ` </select>`;
  34. body += ` </div>`;
  35. body += ` </div>`;
  36. body += ` <div class="row">`;
  37. body += ` <select class="form-control" id="placeOperationAt">`;
  38. body += ` <option value="" disabled>Adicionar após</option>`;
  39. for (let i = 0; i < allWorkspaceComponents.length; i++) {
  40. body += `<option value="${allWorkspaceComponents[i].attributes.universalworkspaceid.value}">${allWorkspaceComponents[i].value}</option>`;
  41. }
  42. body += ` </select>`;
  43. body += ` </div>`;
  44. body += ` <div class="row p-4">`;
  45. body += ` <div class="col-md-12 text-center">`;
  46. body += ` <button type="button" class="btn btn-info" onclick="placeOperationAt()">Posicionar</button>`;
  47. body += ` </div>`;
  48. body += ` </div>`;
  49. body += `</div>`;
  50. body += `<hr />`;
  51. // Add operator to main
  52. body += `<div class="p-3 text-center">`;
  53. body += ` <h5>Operador</h5>`;
  54. body += `</div>`;
  55. body += `<div class="row text-center">`;
  56. body += ` <div class="col-4">`;
  57. body += ` </div>`;
  58. body += ` <div class="col-4">`;
  59. body += ` <select class="form-control" id="operatorTypeSubMenu">`;
  60. for (let i = 0; i < operators.length; i++) {
  61. body += ` <option value="${operators[i].value}">${operators[i].operator}</option>`;
  62. }
  63. body += ` </select>`;
  64. body += ` </div>`;
  65. body += ` <div class="col-4">`;
  66. body += ` </div>`;
  67. body += `</div>`;
  68. body += `<div>`;
  69. body += ` <div class="row p-3">`;
  70. body += ` <select class="form-control" id="placeOperatorAt">`;
  71. body += ` <option value="" disabled>Adicionar após</option>`;
  72. for (let i = 0; i < allWorkspaceComponents.length; i++) {
  73. body += `<option value="${allWorkspaceComponents[i].attributes.universalworkspaceid.value}">${allWorkspaceComponents[i].value}</option>`;
  74. }
  75. body += ` </select>`;
  76. body += ` </div>`;
  77. body += ` <div class="row p-4">`;
  78. body += ` <div class="col-md-12 text-center">`;
  79. body += ` <button type="button" class="btn btn-info" onclick="placeOperatorAt()">Posicionar</button>`;
  80. body += ` </div>`;
  81. body += ` </div>`;
  82. body += `</div>`;
  83. subMenuOptionsBody.innerHTML = body;
  84. showSubMenu();
  85. }