|
|
@@ -2359,7 +2359,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
return credential.credid === deletedCred['credid'];
|
|
|
});
|
|
|
|
|
|
- console.log(index);
|
|
|
$('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
|
|
|
|
|
|
_this.deleteCred(index);
|
|
|
@@ -2529,7 +2528,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
|
props: {
|
|
|
populateWith: {
|
|
|
- type: Object
|
|
|
+ type: Object,
|
|
|
+ require: true
|
|
|
},
|
|
|
modalId: {
|
|
|
type: String,
|
|
|
@@ -2547,32 +2547,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
},
|
|
|
data: function data() {
|
|
|
return {
|
|
|
- note: {}
|
|
|
+ note: JSON.parse(JSON.stringify(this.populateWith))
|
|
|
};
|
|
|
},
|
|
|
- mounted: function mounted() {
|
|
|
- if (!this.populateWith) {
|
|
|
- this.note = {
|
|
|
- thenote: '',
|
|
|
- notetype: this.noteType,
|
|
|
- noteuser: this.noteUser,
|
|
|
- woid: this.woid
|
|
|
- };
|
|
|
- } else {
|
|
|
- this.note = JSON.parse(JSON.stringify(this.populateWith));
|
|
|
- }
|
|
|
- },
|
|
|
methods: {
|
|
|
updateNote: function updateNote(note) {
|
|
|
- if (this.populateWith) {
|
|
|
- axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
|
|
|
- hideModal();
|
|
|
- });
|
|
|
- } else {
|
|
|
- axios.post('/api/workorders/notes', note).then(function (response) {
|
|
|
- hideModal();
|
|
|
- });
|
|
|
- }
|
|
|
+ axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
|
|
|
+ hideModal();
|
|
|
+ });
|
|
|
},
|
|
|
hideModal: function hideModal() {
|
|
|
$('#' + this.modalId).modal('hide');
|
|
|
@@ -2619,29 +2601,98 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
|
mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
|
|
|
- props: ['initialnotes', 'authusername', 'noteType', 'woid'],
|
|
|
+ props: {
|
|
|
+ initialnotes: {
|
|
|
+ type: Array,
|
|
|
+ "default": []
|
|
|
+ },
|
|
|
+ authusername: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ noteType: {
|
|
|
+ type: Number,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ woid: {
|
|
|
+ type: Number,
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ },
|
|
|
data: function data() {
|
|
|
return {
|
|
|
- notes: Object.values(this.initialnotes),
|
|
|
- currentOrder: 'order-first'
|
|
|
+ notes: this.initialnotes,
|
|
|
+ newNote: {
|
|
|
+ notetype: this.noteType,
|
|
|
+ thenote: '',
|
|
|
+ noteuser: this.authusername,
|
|
|
+ woid: this.woid
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ noteOrders: function noteOrders() {
|
|
|
+ return this.getNoteOrders(this.notes);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted: function mounted() {
|
|
|
+ var _this = this;
|
|
|
+
|
|
|
+ Echo.channel('wonotes.' + this.noteType + '.' + this.woid).listen('WorkOrderNoteAdded', function (e) {
|
|
|
+ _this.notes.push(e.note);
|
|
|
+ }).listen('WorkOrderNoteEdited', function (e) {
|
|
|
+ var index = _this.notes.findIndex(function (note) {
|
|
|
+ return note.noteid === e.note.noteid;
|
|
|
+ });
|
|
|
+
|
|
|
+ _this.notes[index] = e.note;
|
|
|
+ }).listen('WorkOrderNoteDeleted', function (e) {
|
|
|
+ var index = _this.notes.findIndex(function (note) {
|
|
|
+ return note.noteid === e.noteid;
|
|
|
+ });
|
|
|
+
|
|
|
+ _this.notes.splice(index, 1);
|
|
|
+ });
|
|
|
+ },
|
|
|
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';
|
|
|
+ createNote: function createNote() {
|
|
|
+ var _this2 = this;
|
|
|
+
|
|
|
+ axios.post('/api/workorders/notes', this.newNote).then(function (response) {
|
|
|
+ $('#note' + _this2.noteType + 'add').collapse('hide');
|
|
|
+ _this2.newNote.thenote = '';
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getNoteOrders: function getNoteOrders(notes) {
|
|
|
+ var noteOrders = [];
|
|
|
+ notes.forEach(function (note, index) {
|
|
|
+ if (index === 0) {
|
|
|
+ noteOrders[index] = 'order-first';
|
|
|
+ } else if (note.noteuser !== notes[index - 1].noteuser) {
|
|
|
+ if (noteOrders[index - 1] === 'order-first') {
|
|
|
+ noteOrders[index] = 'order-last';
|
|
|
+ } else {
|
|
|
+ noteOrders[index] = 'order-first';
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.currentOrder = 'order-first';
|
|
|
+ noteOrders[index] = noteOrders[index - 1];
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- return this.currentOrder;
|
|
|
+ });
|
|
|
+ return noteOrders;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -50093,27 +50144,91 @@ var render = function() {
|
|
|
"ul",
|
|
|
{ staticClass: "list-unstyled" },
|
|
|
[
|
|
|
- _c("note-form-modal", {
|
|
|
- attrs: {
|
|
|
- "modal-id": "note" + _vm.noteType + "CreateModal",
|
|
|
- "note-type": _vm.noteType,
|
|
|
- woid: _vm.woid,
|
|
|
- "note-user": _vm.authusername
|
|
|
- }
|
|
|
- }),
|
|
|
- _vm._v(" "),
|
|
|
- _c(
|
|
|
- "button",
|
|
|
- {
|
|
|
- staticClass: "btn btn-primary",
|
|
|
- attrs: {
|
|
|
- type: "button",
|
|
|
- "data-toggle": "modal",
|
|
|
- "data-target": "#note" + _vm.noteType + "CreateModal"
|
|
|
- }
|
|
|
- },
|
|
|
- [_c("i", { staticClass: "fas fa-fw fa-plus" }), _vm._v(" Add New Note")]
|
|
|
- ),
|
|
|
+ _c("div", { staticClass: "row" }, [
|
|
|
+ _c(
|
|
|
+ "div",
|
|
|
+ {
|
|
|
+ staticClass:
|
|
|
+ "col-md-2 d-flex justify-content-center justify-content-md-start"
|
|
|
+ },
|
|
|
+ [
|
|
|
+ _c(
|
|
|
+ "button",
|
|
|
+ {
|
|
|
+ staticClass: "btn btn-primary m-2",
|
|
|
+ attrs: {
|
|
|
+ type: "button",
|
|
|
+ "data-toggle": "collapse",
|
|
|
+ "data-target": "#note" + _vm.noteType + "add"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ [
|
|
|
+ _c("i", { staticClass: "fas fa-fw fa-plus" }),
|
|
|
+ _vm._v(" Add New Note")
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ ),
|
|
|
+ _vm._v(" "),
|
|
|
+ _c("div", { staticClass: "col-md-10" }, [
|
|
|
+ _c(
|
|
|
+ "div",
|
|
|
+ {
|
|
|
+ staticClass: "collapse",
|
|
|
+ attrs: { id: "note" + _vm.noteType + "add" }
|
|
|
+ },
|
|
|
+ [
|
|
|
+ _c(
|
|
|
+ "div",
|
|
|
+ {
|
|
|
+ staticClass:
|
|
|
+ "d-flex flex-wrap flex-md-nowrap justify-content-center"
|
|
|
+ },
|
|
|
+ [
|
|
|
+ _c("textarea", {
|
|
|
+ directives: [
|
|
|
+ {
|
|
|
+ name: "model",
|
|
|
+ rawName: "v-model",
|
|
|
+ value: _vm.newNote.thenote,
|
|
|
+ expression: "newNote.thenote"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ staticClass: "form-control",
|
|
|
+ attrs: {
|
|
|
+ name: "newnote" + _vm.noteType,
|
|
|
+ id: "newnote" + _vm.noteType
|
|
|
+ },
|
|
|
+ domProps: { value: _vm.newNote.thenote },
|
|
|
+ on: {
|
|
|
+ input: function($event) {
|
|
|
+ if ($event.target.composing) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ _vm.$set(_vm.newNote, "thenote", $event.target.value)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ _vm._v(" "),
|
|
|
+ _c(
|
|
|
+ "button",
|
|
|
+ {
|
|
|
+ staticClass: "btn btn-secondary m-2",
|
|
|
+ attrs: { type: "button" },
|
|
|
+ on: {
|
|
|
+ click: function($event) {
|
|
|
+ return _vm.createNote()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ [_vm._v("Save")]
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ )
|
|
|
+ ])
|
|
|
+ ]),
|
|
|
_vm._v(" "),
|
|
|
_vm._l(this.notes, function(note, index) {
|
|
|
return _c(
|
|
|
@@ -50131,7 +50246,7 @@ var render = function() {
|
|
|
"div",
|
|
|
{
|
|
|
staticClass: "col-md-1 d-flex flex-column mx-md-3",
|
|
|
- class: _vm.setOrder(index)
|
|
|
+ class: _vm.noteOrders[index]
|
|
|
},
|
|
|
[
|
|
|
_c("div", { staticClass: "text-center p-0 m-0" }, [
|