Browse Source

feat: added basic product sorting -> by price

IceToast 3 years ago
parent
commit
cda13a2007
1 changed files with 3 additions and 6 deletions
  1. 3 6
      resources/views/servers/create.blade.php

+ 3 - 6
resources/views/servers/create.blade.php

@@ -302,11 +302,6 @@
 
 
                 },
                 },
 
 
-                debuggershit(e) {
-                    this
-
-                },
-
                 /**
                 /**
                  * @description fetch all available locations based on the selected egg
                  * @description fetch all available locations based on the selected egg
                  * @note called whenever a server configuration is selected
                  * @note called whenever a server configuration is selected
@@ -354,7 +349,9 @@
                         .catch(console.error)
                         .catch(console.error)
 
 
                     this.fetchedProducts = true;
                     this.fetchedProducts = true;
-                    this.products = response.data
+                    // TODO: Sortable by user chosen property (cpu, ram, disk...)
+                    this.products = response.data.sort((p1, p2) => p1.price > p2.price && 1 || -1  )
+
 
 
                     this.loading = false;
                     this.loading = false;
                     this.updateSelectedObjects()
                     this.updateSelectedObjects()