PatternForm.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. abk = [];
  2. fullpattern = [];
  3. function createPatternForm(){
  4. /* Load pattern config */
  5. //Create form for WAS/Stations/Pattern and WAS/Slicer
  6. var populate = ["FormPattern","FormPattern2", "FormPattern3", "FormPatternAssignment"]
  7. var first = true;
  8. populate.forEach(function(populate2){
  9. $.getJSON( "../server/json/ProductCode.json", function( data ) {
  10. fullpattern = data;
  11. $.each( data["pattern"], function(i, item){
  12. var clone = document.importNode(document.querySelector('#PatternFormInit').content,true);
  13. $('[data-class=Name]',clone).text(item["name"]);
  14. $('[data-class=Abkürzung]',clone).text(item["abk"]);
  15. if(first)
  16. abk.push(item["abk"])
  17. $('[data-class=Optionen]',clone).attr("name",item["abk"])
  18. $.each( item["types"], function(i, item){
  19. $('[data-class=Optionen]',clone).append('<option value="' + item +'">' + item +'</option>');
  20. });
  21. $('[data-class=Optionen]',clone).attr("id", populate2 + "_Form_" + item["abk"]);
  22. $('#' + populate2).append(clone);
  23. });
  24. //Add "Text" to abk to show it within rects
  25. first = false;
  26. //on Patternform2 change trigger assignment default reset
  27. if(populate2 == "FormPattern2"){
  28. abk.forEach(function(localabk){
  29. $("#FormPattern2_Form_" + localabk).change(refreshassignments);
  30. });
  31. }
  32. });
  33. });
  34. abk.length = 0;
  35. //get Save locations
  36. $.getJSON( "../server/json/SlicerConfig.json", function( data ) {
  37. $.each( data["saveLocation"], function(i, item){
  38. $("#savelocation").append('<option value="' + item +'">' + item +'</option>');
  39. });
  40. });
  41. }