Эх сурвалжийг харах

Removed code that caused notes to reverse orientation on user switch.

Bug was causing an infinite render loop slowing down the page. Not sure of a solution atm, remove code altogether for now.
Christopher Leggett 5 жил өмнө
parent
commit
6f3031770f

+ 39 - 60
public/js/app.js

@@ -2648,19 +2648,6 @@ __webpack_require__.r(__webpack_exports__);
     });
   },
   methods: {
-    setOrder: function setOrder(index) {
-      if (index === 0) {
-        this.currentOrder = 'order-first';
-      } else if (this.notes[index].noteuser !== this.notes[index - 1].noteuser) {
-        if (this.currentOrder === 'order-first') {
-          this.currentOrder = 'order-last';
-        } else {
-          this.currentOrder = 'order-first';
-        }
-      }
-
-      return this.currentOrder;
-    },
     createNote: function createNote() {
       var _this2 = this;
 
@@ -50217,53 +50204,45 @@ var render = function() {
               }
             }),
             _vm._v(" "),
-            _c(
-              "div",
-              {
-                staticClass: "col-md-1 d-flex flex-column mx-md-3",
-                class: _vm.setOrder(index)
-              },
-              [
-                _c("div", { staticClass: "text-center p-0 m-0" }, [
-                  _vm._v(_vm._s(note.noteuser))
-                ]),
-                _vm._v(" "),
-                _c(
-                  "div",
-                  { staticClass: "text-muted text-small text-center p-0 m-0" },
-                  [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
-                ),
-                _vm._v(" "),
-                _c(
-                  "div",
-                  { staticClass: "btn-group justify-content-center p-0 m-0" },
-                  [
-                    _vm.authusername === note.noteuser ||
-                    _vm.authusername === "admin"
-                      ? [
-                          _c(
-                            "button",
-                            {
-                              staticClass: "btn btn-sm btn-primary m-1",
-                              attrs: {
-                                "data-toggle": "modal",
-                                "data-target":
-                                  "#note" + note.noteid + "editModal"
-                              }
-                            },
-                            [_c("i", { staticClass: "fas fa-fw fa-edit" })]
-                          ),
-                          _vm._v(" "),
-                          _vm._m(0, true),
-                          _vm._v(" "),
-                          _vm._m(1, true)
-                        ]
-                      : _vm._e()
-                  ],
-                  2
-                )
-              ]
-            ),
+            _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
+              _c("div", { staticClass: "text-center p-0 m-0" }, [
+                _vm._v(_vm._s(note.noteuser))
+              ]),
+              _vm._v(" "),
+              _c(
+                "div",
+                { staticClass: "text-muted text-small text-center p-0 m-0" },
+                [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
+              ),
+              _vm._v(" "),
+              _c(
+                "div",
+                { staticClass: "btn-group justify-content-center p-0 m-0" },
+                [
+                  _vm.authusername === note.noteuser ||
+                  _vm.authusername === "admin"
+                    ? [
+                        _c(
+                          "button",
+                          {
+                            staticClass: "btn btn-sm btn-primary m-1",
+                            attrs: {
+                              "data-toggle": "modal",
+                              "data-target": "#note" + note.noteid + "editModal"
+                            }
+                          },
+                          [_c("i", { staticClass: "fas fa-fw fa-edit" })]
+                        ),
+                        _vm._v(" "),
+                        _vm._m(0, true),
+                        _vm._v(" "),
+                        _vm._m(1, true)
+                      ]
+                    : _vm._e()
+                ],
+                2
+              )
+            ]),
             _vm._v(" "),
             _c("div", { staticClass: "col-md-10" }, [
               _c("div", { staticClass: "card m-2" }, [

+ 1 - 13
resources/js/components/notes.vue

@@ -15,7 +15,7 @@
             </div>
         <li class="row no-gutters mb-2" v-bind:key="index" v-for="(note, index) in this.notes">
             <note-form-modal :modal-id="'note'+note.noteid+'editModal'" :populate-with="note"></note-form-modal>
-            <div class="col-md-1 d-flex flex-column mx-md-3" :class="setOrder(index)">
+            <div class="col-md-1 d-flex flex-column mx-md-3">
                 <div class="text-center p-0 m-0">{{note.noteuser}}</div>
                 <div class="text-muted text-small text-center p-0 m-0">{{getHRDate(note.notetime)}}</div>
                 <div class="btn-group justify-content-center p-0 m-0">
@@ -72,18 +72,6 @@ export default {
             })
     },
     methods: {
-        setOrder (index) {
-            if (index === 0) {
-                this.currentOrder = 'order-first'
-            } else if (this.notes[index].noteuser !== this.notes[index-1].noteuser) {
-                if (this.currentOrder === 'order-first') {
-                    this.currentOrder = 'order-last'
-                } else {
-                    this.currentOrder = 'order-first'
-                }
-            }
-            return this.currentOrder
-        },
         createNote () {
             axios.post('/api/workorders/notes', this.newNote)
                     .then((response) => {