Parcourir la source

Updated Assignment Search, Added config files for URLS

Manuel Gall il y a 3 ans
Parent
commit
839c41dc32

+ 9 - 0
server/json/ProductCode.json

@@ -4,6 +4,8 @@
       "name": "Produktbereich",
       "abk": "Pb",
       "types": [
+        "",
+        "*",
         "E"
       ]
     },
@@ -11,6 +13,8 @@
       "name": "System",
       "abk": "Sy",
       "types": [
+        "",
+        "*",
         "X",
         "A"
       ]
@@ -19,6 +23,8 @@
       "name": "Produktkategorie",
       "abk": "Pk",
       "types": [
+        "",
+        "*",
         "PZ"
       ]
     },
@@ -26,6 +32,7 @@
       "name": "Bauart",
       "abk": "Ba",
       "types": [
+        "",
         "*",
         "KZ-S",
         "RKZ-S",
@@ -39,6 +46,7 @@
       "name": "Zylinderlänge außen",
       "abk": "Za",
       "types": [
+        "",
         "*",
         "31",
         "36",
@@ -53,6 +61,7 @@
       "name": "Zylinderlänge Innen",
       "abk": "Zi",
       "types": [
+        "",
         "*",
         "31",
         "36",

+ 13 - 13
server/json/Rectangle.json

@@ -173,14 +173,14 @@
       ]
     },
     {
-      "name": "Station3_SEP",
+      "name": "Station3",
       "rects": [
         {
           "id": "0",
           "X": "535",
           "Y": "100",
           "W": "410",
-          "H": "180",
+          "H": "200",
           "pattern": {
             "Ba": true,
             "Za": true,
@@ -191,14 +191,14 @@
             "Va": true,
             "Sn": false
           },
-          "idtext": ""
+          "idtext": "SRP"
         },
         {
           "id": "1",
           "X": "945",
           "Y": "100",
           "W": "109",
-          "H": "180",
+          "H": "200",
           "pattern": {
             "Ba": true,
             "Za": false,
@@ -209,14 +209,14 @@
             "Va": false,
             "Sn": true
           },
-          "idtext": ""
+          "idtext": "SRP"
         },
         {
           "id": "2",
           "X": "1054",
           "Y": "100",
           "W": "411",
-          "H": "180",
+          "H": "200",
           "pattern": {
             "Ba": true,
             "Za": false,
@@ -227,14 +227,14 @@
             "Va": false,
             "Sn": false
           },
-          "idtext": ""
+          "idtext": "SRP"
         },
         {
           "id": "3",
           "X": "535",
-          "Y": "280",
+          "Y": "300",
           "W": "449",
-          "H": "200",
+          "H": "180",
           "pattern": {
             "Ba": true,
             "Za": true,
@@ -250,9 +250,9 @@
         {
           "id": "4",
           "X": "984",
-          "Y": "280",
+          "Y": "300",
           "W": "42",
-          "H": "200",
+          "H": "180",
           "pattern": {
             "Ba": true,
             "Za": false,
@@ -268,9 +268,9 @@
         {
           "id": "5",
           "X": "1024",
-          "Y": "280",
+          "Y": "300",
           "W": "440",
-          "H": "200",
+          "H": "180",
           "pattern": {
             "Ba": true,
             "Za": false,

+ 1 - 0
server/was.conf

@@ -1,4 +1,5 @@
 :port: 9323
 :appconf:
   wizurl: https://centurio.work/wiz/wiztest/
+  wasurl: https://centurio.work/customers/evva/was/
   stations: [ 1, 2, 3, 8, 99]

+ 60 - 36
server/was.rb

@@ -376,7 +376,7 @@ class GetImages < Riddl::Implementation
     builder = Nokogiri::XML::Builder.new do |xml|
       xml.images(){
         result.each do |row|
-          xml<< GetImage::prepare(@r[0], @r[1], row[0]).to_xml( save_with:formatted_no_decl )
+          xml<< GetImage::prepare(@r[0], @r[1], row[0], @a[0][:appconf]["wasurl"]).to_xml( save_with:formatted_no_decl )
         end
       }
     end
@@ -513,20 +513,20 @@ end
 
 
 class GetImage < Riddl::Implementation
-  def self::prepare(station, pattern, imageID)
+  def self::prepare(station, pattern, imageID, wasurl)
     result = $db.execute "SELECT * FROM image WHERE internalID = #{pattern} and imageID = #{imageID}"
     Nokogiri::XML::Builder.new do |xml|
       xml.image(:id => imageID){
         result.each do |row|
           xml.variant(:lang => row[2], :label => row[3]){
-            xml.text("https://centurio.work/customers/evva/was/images/uploads/#{station}/#{pattern}/#{imageID}/#{row[3]}.svg")
+            xml.text(wasurl + "images/uploads/#{station}/#{pattern}/#{imageID}/#{row[3]}.svg")
           }
         end
       }
     end
   end
   def response
-    builder = GetImage::prepare(@r[0], @r[1], @r[3])
+    builder = GetImage::prepare(@r[0], @r[1], @r[3], @a[0][:appconf]["wasurl"])
     Riddl::Parameter::Complex.new('image','application/xml',builder.to_xml)
   end
 end
@@ -635,7 +635,7 @@ class SearchImages < Riddl::Implementation
   def response
     #https://centurio.work/customers/evva/was/ui/TransformProductCode.php?ProductCode=E.A.PZ.DZ-S.31.31.MP.SEP
   
-    pattern = JSON.parse(Net::HTTP.get URI("https://centurio.work/customers/evva/was/ui/TransformProductCode.php?ProductCode=" + @p[0].value))
+    pattern = JSON.parse(Net::HTTP.get URI(@a[0][:appconf]["wasurl"] + "ui/TransformProductCode.php?ProductCode=" + @p[0].value))
 
     
     #Get first key dynamicly and then build sql query
@@ -664,7 +664,7 @@ end
 
 class SearchImagesSingle < Riddl::Implementation
   def response
-    pattern = JSON.parse(Net::HTTP.get URI("https://centurio.work/customers/evva/was/ui/TransformProductCode.php?ProductCode=" + @p[0].value))
+    pattern = JSON.parse(Net::HTTP.get URI(@a[0][:appconf]["wasurl"] + "ui/TransformProductCode.php?ProductCode=" + @p[0].value))
 
     searchstring = "SELECT " + pattern.keys[0] + ".internalID AS ID"
     searchstring = searchstring + " FROM " + pattern.map{ |key, val| "pattern " + key}.join(', ')
@@ -686,7 +686,7 @@ class SearchImagesSingle < Riddl::Implementation
                 result3 = $db.execute "SELECT DISTINCT internalID, imageID, language, label FROM image WHERE internalID = #{item[0]} and imageID =#{item2[1]}"
                 
                 result3.each do |item3|                
-                  uri = "https://centurio.work/customers/evva/was/ui/imageReplacement.php?___image___=" +  @r[0].to_s + "/" + item3[0].to_s + "/" + item3[1].to_s + "/" + item3[2].to_s + ".svg"
+                  uri = @a[0][:appconf]["wasurl"] + "ui/imageReplacement.php?___image___=" +  @r[0].to_s + "/" + item3[0].to_s + "/" + item3[1].to_s + "/" + item3[2].to_s + ".svg"
                   
                   @p.each_with_index do |item, index|
                     if index != 0
@@ -716,7 +716,7 @@ end
 
 class SearchErrors < Riddl::Implementation
   def response
-    pattern = JSON.parse(Net::HTTP.get URI("https://centurio.work/customers/evva/was/ui/TransformProductCode.php?ProductCode=" + @p[0].value))
+    pattern = JSON.parse(Net::HTTP.get URI(@a[0][:appconf]["wasurl"] + "ui/TransformProductCode.php?ProductCode=" + @p[0].value))
 
     searchstring = "SELECT " + pattern.keys[0] + ".internalID AS ID"
     searchstring = searchstring + " FROM " + pattern.map{ |key, val| "pattern " + key}.join(', ')
@@ -814,14 +814,25 @@ class GetAssignment < Riddl::Implementation
       station = $db.execute "SELECT value FROM patternassignments WHERE ID = #{@r[1]} AND AssID = #{row[0]} AND type == 'STATION'"
       stationvalue = Integer(station[0][0])
       
-      singleItem = $db.execute "SELECT value FROM patternassignments WHERE ID = #{@r[1]} AND AssID = #{row[0]} AND type != 'STATION'"
+      #old where pattern is stored as string
+      #singleItem = $db.execute "SELECT value FROM patternassignments WHERE ID = #{@r[1]} AND AssID = #{row[0]} AND type != 'STATION'"
+      #if(ret[stationvalue] == nil)
+      #  ret[stationvalue] = Hash.new()
+      #end
+      #ret[stationvalue][row[0]] = singleItem.join('.')
+      
+    
+      singleItem = $db.execute "SELECT type, value FROM patternassignments WHERE ID = #{@r[1]} AND AssID = #{row[0]} AND type != 'STATION'"
       
       if(ret[stationvalue] == nil)
         ret[stationvalue] = Hash.new()
       end
-      ret[stationvalue][row[0]] = singleItem.join('.')
+      ret[stationvalue][row[0]] = Hash.new()
+      
+      singleItem.each do |it|
+        ret[stationvalue][row[0]][it[0]] = it[1]
+      end
       
-    
     
     end
     Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(ret))
@@ -845,30 +856,43 @@ class ListAssignmentSearch < Riddl::Implementation
   
     #https://centurio.work/customers/evva/was/ui/TransformProductCode.php?ProductCode=E.A.PZ.DZ-S.31.31.MP.SEP
   
-    pattern = JSON.parse(Net::HTTP.get URI("https://centurio.work/customers/evva/was/ui/TransformProductCode.php?ProductCode=" + @p[0].value))
 
-    puts  @p[1].value + @p[2].value
-#$db.execute "CREATE TABLE IF NOT EXISTS patternassignments(ID INT, AssID INT, type CHARACTER(20), value CHARACTER(20), FOREIGN KEY(ID) REFERENCES assignments(ID) ON DELETE CASCADE)"
+    pattern = JSON.parse(Net::HTTP.get URI(@a[0][:appconf]["wasurl"] + "ui/TransformProductCode.php?ProductCode=" + @p[0].value))
+
+  #$db.execute "CREATE TABLE IF NOT EXISTS patternassignments(ID INT, AssID INT, type CHARACTER(20), value CHARACTER(20), FOREIGN KEY(ID) REFERENCES assignments(ID) ON DELETE CASCADE)"
 
     #Get first key dynamicly and then build sql query
-    searchstring = "SELECT " + pattern.keys[0] + ".ID AS ID"
-    searchstring = searchstring + " FROM " + pattern.map{ |key, val| "patternassignments " + key}.join(', ')
-    searchstring = searchstring + " , patternassignments STATION , patternassignments ValText"    
-    searchstring = searchstring + " WHERE " + pattern.map{ |key, val| pattern.keys[0] + ".AssID == " + key + ".AssID"}.join(' AND ') + " AND ";
-    searchstring = searchstring + pattern.map{ |key, val| pattern.keys[0] + ".ID == " + key + ".ID"}.join(' AND ')
-    
-    searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == STATION.AssID"   
-    searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == ValText.AssID"   
-    searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == STATION.ID"   
-    searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == ValText.ID"   
-    
-    
-    searchstring = searchstring + " AND STATION.type == 'STATION'" + " AND STATION.value == '" + @p[1].value + "'"
-    searchstring = searchstring + " AND ValText.type == 'TEXT'"  + " AND ValText.value == '" + @p[2].value + "'"
+    if(pattern.keys[0] != nil)
+      searchstring = "SELECT " + pattern.keys[0] + ".ID AS ID"
+      searchstring = searchstring + " FROM " + pattern.map{ |key, val| "patternassignments " + key}.join(', ')
+      searchstring = searchstring + " , patternassignments STATION , patternassignments ValText"    
+      searchstring = searchstring + " WHERE " + pattern.map{ |key, val| pattern.keys[0] + ".AssID == " + key + ".AssID"}.join(' AND ') + " AND ";
+      searchstring = searchstring + pattern.map{ |key, val| pattern.keys[0] + ".ID == " + key + ".ID"}.join(' AND ')
+      
+      searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == STATION.AssID"   
+      searchstring = searchstring + " AND " + pattern.keys[0] + ".AssID == ValText.AssID"   
+      searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == STATION.ID"   
+      searchstring = searchstring + " AND " + pattern.keys[0] + ".ID == ValText.ID"   
+      
+      
+      searchstring = searchstring + " AND STATION.type == 'STATION'" + " AND STATION.value == '" + @p[1].value + "'"
+      searchstring = searchstring + " AND ValText.type == 'TEXT'"  + " AND ValText.value == '" + @p[2].value + "'"
+      
+      searchstring = searchstring + " AND " + pattern.map{ |key, val| key + ".type == '" + key + "' AND (" + key + ".value == '"+ val +"' or " + key + ".value == '*')"}.join(' AND ') + " ORDER BY ID ASC" 
+      
+      #puts searchstring;
+    else
+      searchstring = "SELECT * FROM "
+      searchstring = searchstring + "patternassignments STATION , patternassignments ValText"
+      searchstring = searchstring + " WHERE"    
+      searchstring = searchstring + " STATION.type == 'STATION'" + " AND STATION.value == '" + @p[1].value + "'"
+      searchstring = searchstring + " AND ValText.type == 'TEXT'"  + " AND ValText.value == '" + @p[2].value + "'"
+      searchstring = searchstring + " AND ValText.AssID == STATION.AssID"
+      searchstring = searchstring + " ORDER BY ID ASC"
+
     
-    searchstring = searchstring + " AND " + pattern.map{ |key, val| key + ".type == '" + key + "' AND (" + key + ".value == '"+ val +"' or " + key + ".value == '*')"}.join(' AND ') + " ORDER BY ID ASC" 
+    end
     
-    #puts searchstring;
     
     result = $db.execute searchstring;
     
@@ -964,7 +988,7 @@ server = Riddl::Server.new(File.join(__dir__,'/was.xml'), :host => 'localhost')
           #should add deleteReplacement
         end
         on resource 'images' do
-          run GetImages if get
+          run GetImages, opts if get
           #run CreateImage if post #'image'
           run AddExternalImage if post 'externalImage'
           run UploadImage if post
@@ -974,7 +998,7 @@ server = Riddl::Server.new(File.join(__dir__,'/was.xml'), :host => 'localhost')
             end
           end
           on resource '\d+' do
-            run GetImage if get
+            run GetImage, opts if get
             on resource do
               run UpdateImageLabel if put 'label'
               run GetRealImage if get
@@ -986,13 +1010,13 @@ server = Riddl::Server.new(File.join(__dir__,'/was.xml'), :host => 'localhost')
       on resource 'search' do
         run ListSearch if get
         on resource 'imagesWIZ' do
-          run SearchImages if get
+          run SearchImages, opts if get
           on resource '\d+' do
-            run SearchImagesSingle if get
+            run SearchImagesSingle, opts if get
           end
         end
         on resource 'errorsWIZ' do
-          run SearchErrors if get
+          run SearchErrors, opts if get
         end
       end
     end
@@ -1000,7 +1024,7 @@ server = Riddl::Server.new(File.join(__dir__,'/was.xml'), :host => 'localhost')
       run GetAssignments if get
       run SaveNewAssignment if post 'list'
       on resource 'search' do
-        run ListAssignmentSearch if get
+        run ListAssignmentSearch, opts if get
       end
       on resource '\d+' do
         run GetAssignment if get

+ 31 - 14
ui/TransformProductCode.php

@@ -12,27 +12,44 @@
   $productcode = str_replace("/", ".", $_GET["ProductCode"]);
   $productarray = explode(".", $productcode);
   
-  //Fixwerte übernehmen:
-  $fixwerte = 6;
-  for($i = 0; $i < $fixwerte; ++$i){
-    if(isset($productarray[$i])){
-      $asocarray[$json->pattern[$i]->abk] = $productarray[$i];
+  
+  if($_GET["ProductCode"] == ""){
+    echo json_encode (json_decode ("{}"));
+    return;
+  }
+  if(isset($_GET["Semantic"])){
+    $fixwerte = 6;
+    for($i = 0; $i < $fixwerte; ++$i){
+      if(isset($productarray[$i])){
+        $asocarray[$json->pattern[$i]->abk] = $productarray[$i];
+      }
+      else{
+        $asocarray[$json->pattern[$i]->abk] = "";
+      }
     }
-    else{
-      $asocarray[$json->pattern[$i]->abk] = "";
+    
+    //Search which abk can be linked to the patternpart
+    for($i = $fixwerte; $i < count($productarray); ++$i){
+      foreach($json->pattern as $node){
+        foreach($node->types as $type){
+          if($productarray[$i] == $type && $type != "*"){
+              $asocarray[$node->abk] = $productarray[$i];
+          }
+        }
+      }
     }
   }
-  
-  //Search which abk can be linked to the patternpart
-  for($i = $fixwerte; $i < count($productarray); ++$i){
+  else{
+    $i = 0;
     foreach($json->pattern as $node){
-      foreach($node->types as $type){
-        if($productarray[$i] == $type){
-            $asocarray[$node->abk] = $productarray[$i];
-        }
+      if(isset($productarray[$i])){
+        $asocarray[$node->abk] = $productarray[$i];
       }
+      ++$i;
     }
+    
   }
   
+  
   echo json_encode($asocarray);
 ?>

+ 5 - 0
ui/config.php

@@ -0,0 +1,5 @@
+<?php
+  $wasUrl ="https://centurio.work/customers/evva/was/";
+  $transformCodeUrl ="https://centurio.work/customers/evva/was/";
+  $universalStorageEinzelbilder = "https://centurio.work/customers/evva/universal-storage/storage/Stationsbilder/Einzelbilder/";
+?>

+ 27 - 0
ui/css/design.css

@@ -221,6 +221,33 @@ td {
   width: 100%;
 }
 
+/* Assignments */
+.DataImg{
+  text-align: center;
+  vertical-align: middle;
+  width: 8em;
+  height: 8em;
+  border: 2px dashed #92b0b3;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.DataImg img{
+  max-height: 100%;
+  max-width: 100%;
+}
+#assignmentdetaillist{
+  border-collapse:collapse;
+}
+#assignmentdetaillist td{
+  width: 3em;
+  text-align: center;
+}
+
+#assignmentdetaillist tr {background: white;}
+#assignmentdetaillist tr:nth-child(even) {background: #efefef;}
+
 
 /*Image Upload CSS*/
 

+ 28 - 4
ui/imageReplacement.php

@@ -4,6 +4,8 @@
   <body style="margin: 0px">
 
 <?php
+  include 'config.php';
+
   ini_set('display_errors', 1);
   ini_set('display_startup_errors', 1);
   error_reporting(E_ALL);
@@ -90,6 +92,7 @@
   $curstation = $_GET["Station"];
   //Einzelbilder vom Universal Storage laden
   foreach ($keyValueStore as $key => $value) {
+  
     $keyorig = $key;
   
     $key = substr($key, 1); 
@@ -109,15 +112,36 @@
         $fullfilename = $fullfilename . "_" . $keypart . ";" . $asocarray[$keypart];
       }
       else{
-        //echo "Continue";
         continue 2;
       }
     }
     $fullfilename = substr($fullfilename, 1); 
-    $fullfilename = "https://centurio.work/customers/evva/universal-storage/storage/Stationsbilder/Einzelbilder/Station" . $curstation . "/Station". $curstation.     "_" . $fullfilename . ".jpg";
+    $fullfilename = $universalStorageEinzelbilder . "Station" . $curstation . "/Station". $curstation.     "_" . $fullfilename . ".jpg";
+    
     
-    if (!file_exists($fullfilename)) {
-      $fullfilename = "https://centurio.work/customers/evva/was/server/assignments/search?pattern=". $_GET["ProductCode"] ."&station=". $curstation ."&Text=" .  $textentry;
+    //if Real image was not found
+    $file_headers = @get_headers($fullfilename);
+    if(!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
+      echo $key . " ";
+      echo json_encode($asocarray);
+      
+      $onlyUsedParts=array();
+      foreach($asocarray as $keypart => $keyval){
+      
+        if(in_array($keypart, $keyarray)){
+          array_push($onlyUsedParts, $keyval);
+        }
+        else{
+          array_push($onlyUsedParts, "");
+        }
+      }
+      echo implode (".", $onlyUsedParts);
+      echo "<br>";
+      
+      
+        
+      
+      $fullfilename = $wasUrl . "server/assignments/search?pattern=". implode (".", $onlyUsedParts) ."&station=". $curstation ."&Text=" .  $textentry;
       $json = json_decode(file_get_contents($fullfilename));
       
       if (isset($json[0])) {

+ 22 - 6
ui/index.html

@@ -53,6 +53,7 @@
     <link   rel="stylesheet"      href="css/settings.css" type="text/css"/>
     
     
+    <script type="text/javascript" src="js/config.js"></script>
     <script type="text/javascript" src="js/design.js"></script>
     <script type="text/javascript" src="js/imageSlicer.js"></script>
     <script type="text/javascript" src="js/assignment.js"></script>
@@ -81,8 +82,8 @@
       <ui-before                                  ><a class="logo" href="/customers/evva"></a></ui-before>
       <ui-tab class=""         data-tab="station"           >Stations</ui-tab>
       <ui-tab class="inactive" data-tab="cutter"            >Slicer</ui-tab>
+      <ui-tab class="inactive" data-tab="assignment"        >Assignment</ui-tab>
       <ui-tab class="inactive" data-tab="settings"          >Settings</ui-tab>
-      <ui-tab class="inactive" data-tab="assignment"          >Assignment</ui-tab>
       <!-- <ui-tab class="inactive" data-tab="patternAlignment"  >Alignment</ui-tab> -->
       <ui-behind                                  ></ui-behind>
     </ui-tabbar>
@@ -592,11 +593,26 @@
     
     
     <ui-area data-belongs-to-tab="assignment" class="inactive">
+      
+      <select name="station" id="searchAssingmentStation"></select>
+      <input data-class="input" id="searchAssingmentPattern" type="text" maxlength="20" size="20" value="Pattern">
+      <input data-class="input" id="searchAssingmentText" type="text" maxlength="20" size="20" value="Text">
+      
+      <a href="javascript:searchAssignmentForm();">Search</a><br>
+    
+    
+    
+    
       List of all Images
       
       <template id="assignmentitem">
-        <tr >
-          <td > </td>
+        <tr data-class='tr'>
+          <td >
+          
+          <div class="DataImg">
+            <img data-class='image' class="image" src="" alt=""  />
+          </div>
+          </td>
           <td data-class='item'><a href=''></a></td>
           <!--<td data-class='duplicate' class="stationAction"><a href=''>⎘</a></td>-->
           <td data-class='delete' class="assignmentAction"><a href=''>[⨯]</a></td>
@@ -604,7 +620,7 @@
       </template>
       <br>
       <a href="javascript:createAssignmentForm();">Create Assignment</a>
-      <table id="assignmentslist">
+      <table id="assignmentslist" style="border-collapse:collapse;">
       </table>
           
     </ui-area>
@@ -669,10 +685,10 @@
         <div id="storedassignments">
         
           <template id="singleassignment">
-            <tr >
+            <tr id="assignmentitemrow"  >
               <td > </td>
               <td data-class='station'></td>
-              <td data-class='item'></td>
+              <td data-class='item' id="asdfasdfa"></td>
               <!--<td data-class='duplicate' class="stationAction"><a href=''>⎘</a></td>-->
               <td data-class='delete' class="assignmentAction"><a href=''>[⨯]</a></td>
             </tr>

+ 65 - 50
ui/js/assignment.js

@@ -2,8 +2,9 @@
 
 function createAssignmentForm(assID, url){
   
-  $('#assignmentdetaillist').text("");
-  
+  initAssignmentTable();
+  $('#assignmentstation').find('option').remove()
+    
 	$.ajax({
     type: "GET",
     url: "../server/",
@@ -39,19 +40,34 @@ function createAssignmentForm(assID, url){
       console.log(data);
     
       $.each( data, function(i, alldata){
+      
+      
+        var clonePattern = $("#copyAssignmentTable").clone();
+        $('td',clonePattern).text("");
+        $('[data-class=station]',clonePattern).text(i);
+        $('#assignmentdetaillist').append(clonePattern);
         
-        var clonePattern = document.importNode(document.querySelector('#singleassignment').content,true);
-        $('[data-class=station]',clonePattern).text("Station " + i);
         
         $('#assignmentdetaillist').append(clonePattern);
       
-        $.each( alldata, function(i, item){
-          var clonePattern = document.importNode(document.querySelector('#singleassignment').content,true);
-          $('[data-class=item]',clonePattern).text(item);
-          $('[data-class=delete] a',clonePattern).attr('href','javascript:deleteSingleAssignment(' + assID +', ' + i + ');');
+        $.each( alldata, function(i, pattern){
+          var clonePattern = $("#copyAssignmentTable").clone();
+          $('td',clonePattern).text("");
+          
+          
+          $.each( pattern, function(i, item){
+            console.log(i);
+            $('[data-class=part' + i + ']',clonePattern).text(item);
+          });
+          $('[data-class=delete]',clonePattern).html('<a href="javascript:deleteSingleAssignment(' + assID +', ' + i + ');">[⨯]</a>');
           
           $('#assignmentdetaillist').append(clonePattern);
         });
+        
+        
+        
+        
+        
       });
     });
     
@@ -63,6 +79,7 @@ function createAssignmentForm(assID, url){
 }
 
 
+
 //called when new image is selected
 function getImgText(imgtext){
   var result = /[^;]*$/.exec(imgtext)[0];
@@ -78,9 +95,9 @@ function submitAssignment(){
   obj.parts = {};  
   abk.forEach(function(item){
     if(typeof $("#FormPatternAssignment_Form_" + item).val() !== 'undefined' && typeof $("#FormPatternAssignment_Form_" + item).val() !== 'undefined'){
-      if($("#FormPatternAssignment_Form_" + item).find(":selected").text() != ""){
+      //if($("#FormPatternAssignment_Form_" + item).find(":selected").text() != ""){
         obj.parts[item] = $("#FormPatternAssignment_Form_" + item).find(":selected").text();
-      }
+      //}
     }
   });
   obj.assignmentText = $('#assignmentText').val();
@@ -125,66 +142,64 @@ function deleteSingleAssignment(assignmentID, patternID) { //Delete From DB
   }
 }
 
+function searchAssignmentForm(){
+  
+  $('#assignmentslist tr').css('background-color', 'white');
+  $.getJSON( "../server/assignments/search/?pattern=" + $('#searchAssingmentPattern').val() + "&station=" + $('#searchAssingmentStation option:selected').text() + "&text=" + $('#searchAssingmentText').val(), function( data ) {  
+    console.log(data);
+    $('tr[name="' + data +'"]').css('background-color', '#73d216')   // Matches exactly 'tcol1'
+
+  });
+}
+
 function initAssignment(){
+  
   $.getJSON( "../server/assignments/", function( data ) {
     $.each( data, function(i, item){
-      console.log("ID " + i + " image " + item)      
           var clonePattern = document.importNode(document.querySelector('#assignmentitem').content,true);
+          $('[data-class=tr]',clonePattern).attr('name', item);
+          $('[data-class=image]',clonePattern).attr('src', item);
           $('[data-class=item] a',clonePattern).text(item);
           $('[data-class=item] a',clonePattern).attr('href','javascript:createAssignmentForm(' + i + ',"' + item + '");');
           //$('[data-class=duplicate] a',clonePattern).attr('href','javascript:duplicatePattern(' + curstation + ','+ $(this).attr('id') + ');');
           $('[data-class=delete] a',clonePattern).attr('href','javascript:deleteAssignment(' + i + ');');
-          
           $('#assignmentslist').append(clonePattern);
       });
   });
+  $.ajax({
+    type: "GET",
+    url: "../server/",
+	  dataType: "xml",
+    success: function(xml) {
+      $(xml).find('station').each(function(index){
+          $('#searchAssingmentStation').append('<option value="' + $(this).attr('id') +'">' + $(this).attr('id') +'</option>');
+      });
+    }
+  });
 }
 
 
 
+function initAssignmentTable(){
+  $('#assignmentdetaillist').text("");
+  $('#assignmentdetaillist').append("<tr id='copyAssignmentTable'></tr>");
+  $('#assignmentdetaillist tr').append("<td data-class='station'>Station</td>");
+  $.getJSON( "../server/json/ProductCode.json", function( data ) {
+    $.each( data["pattern"], function(i, item){
+      $('#assignmentdetaillist tr').append("<td data-class='part"+ item["abk"] +"'>"+ item["abk"] +"</td>");
+    });
+    $('#assignmentdetaillist tr').append("<td data-class='partTEXT'>Text</td>");
+    $('#assignmentdetaillist tr').append("<td data-class='delete'>Delete</td>");
+  });
+  
+}
+
+
 
 $(document).ready(function() {
   initAssignment();
-  
   $(document).on('submit', '#assignmentform', function() { //prevent page reload on form submit
     return false;
   });
   
-  /*
-  loadStationsForm();
-  getAllFolders();
-  //press enter to fill out patternform
-  $("#slicerpatterninput").bind("keypress", {}, fillpatternForm);
-
-
-  
-  $.getJSON( "../server/json/SlicerConfig.json", function( data ) {
-    if(!data["SlicerRectForm"]){
-      $("#addRectanglesGroup").hide();
-      $("#imgRectangles").hide();
-      $("#Json2ClipboardGroup").hide();
-    }
-  });
-  
-  
-  
-  $("#showJson").click(function() {
-    showJson();
-  });
-  
-  $("#multiCut").click(function() {
-    getAllFiles($('#selectfolders').val());
-    
-  });
-  
-  $('#pattern2').text("");
-  var clone = document.importNode(document.querySelector('#patternClone').content,true);
-  $('[data-class=part]',clone).limitkeypress({rexp: keypressRegex()});
-  $("#pattern2").append(clone);
-  
-  
-  //handle zoom event in order to fix rectangle position
-  window.addEventListener("resize", resizeAllRect, false); 
-  */
-  
 });

+ 2 - 0
ui/js/config.js

@@ -0,0 +1,2 @@
+
+var urlUniversalStorage = "https://centurio.work/customers/evva/universal-storage/";

+ 7 - 3
ui/js/design.js

@@ -12,11 +12,15 @@ var pictureHeight = 720;
 
 function overlayOn(value, special="") {
   
-  if(special == "image" || special == "assigment"){
-    url = "https://centurio.work/customers/evva/universal-storage/ui/?iframe&path=Stationsbilder/Gesamtbilder/Station3"
+  if(special == "image"){
+    url = urlUniversalStorage + "ui/?iframe&path=Stationsbilder/Gesamtbilder/Station3"
+  }
+  else if(special == "assigment"){
+    url = urlUniversalStorage + "ui/?iframe&path=Stationsbilder/Einzelbilder/Station3"
+    
   }
   else{
-    url = "https://centurio.work/customers/evva/universal-storage/ui/?iframe"
+    url = urlUniversalStorage + "ui/?iframe"
   }
   document.getElementById("overlay").style.display = "block";
   

+ 4 - 4
ui/js/imageSlicer.js

@@ -404,7 +404,7 @@ function getAllFolders(folder = ""){ //Get DB 2 HTML //has to be synchronus in o
   $('#selectfolders').append("<option></option>")
   $.ajax({
 	  type: "GET",
-	  url: "../../universal-storage/server/allfolders/" + folder,
+	  url: urlUniversalStorage + "server/allfolders/" + folder,
     async: false,
 	  dataType: "json",
 	  success: function(data) {
@@ -419,15 +419,15 @@ function getAllFolders(folder = ""){ //Get DB 2 HTML //has to be synchronus in o
 function getAllFiles(folder = ""){ //Get DB 2 HTML //has to be synchronus in order to update before loading the rest
  $.ajax({
 	  type: "GET",
-	  url: "../../universal-storage/server/images/" + folder,
+	  url: urlUniversalStorage + "server/images/" + folder,
 	  dataType: "json",
 	  success: function(data) {
       $.each( data, function( key, value ) {
       
       
         console.log(value);
-        console.log("../../universal-storage/storage/" + folder + "/" + value);
-        $("#sliceImg").attr("src", "../../universal-storage/storage/" + folder + "/" + value)
+        console.log(urlUniversalStorage + "storage/" + folder + "/" + value);
+        $("#sliceImg").attr("src", urlUniversalStorage + "storage/" + folder + "/" + value)
         fillFormName(value);
         
         submitSlices(true);