1354 refactor item-descriptor-popover
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-05-07 11:32:35 +02:00
parent 810f4462f6
commit 83898c9ba7
15 changed files with 49 additions and 75 deletions

View File

@ -186,8 +186,7 @@
</div> </div>
</vn-popover> </vn-popover>
<vn-item-descriptor-popover <vn-item-descriptor-popover
vn-id="descriptor" vn-id="descriptor">
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover> </vn-item-descriptor-popover>
<vn-ticket-descriptor-popover <vn-ticket-descriptor-popover
vn-id="ticketDescriptor"> vn-id="ticketDescriptor">

View File

@ -161,15 +161,6 @@ class Controller {
} }
// Item Descriptor // Item Descriptor
showDescriptor(event, itemFk) { showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk}
})`,
tooltip: 'Item diary'
}
};
this.$.descriptor.itemFk = itemFk; this.$.descriptor.itemFk = itemFk;
this.$.descriptor.parent = event.target; this.$.descriptor.parent = event.target;
this.$.descriptor.show(); this.$.descriptor.show();

View File

@ -110,6 +110,5 @@
</tpl-body> </tpl-body>
</vn-dialog> </vn-dialog>
<vn-item-descriptor-popover <vn-item-descriptor-popover
vn-id="descriptor" vn-id="descriptor">
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover> </vn-item-descriptor-popover>

View File

@ -103,15 +103,6 @@ class Controller {
// Item Descriptor // Item Descriptor
showDescriptor(event, itemFk) { showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk}
})`,
tooltip: 'Item diary'
}
};
this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.itemFk = itemFk;
this.$scope.descriptor.parent = event.target; this.$scope.descriptor.parent = event.target;
this.$scope.descriptor.show(); this.$scope.descriptor.show();

View File

@ -151,8 +151,7 @@
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-item-descriptor-popover <vn-item-descriptor-popover
vn-id="itemDescriptor" vn-id="itemDescriptor">
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover> </vn-item-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor" vn-id="workerDescriptor"

View File

@ -18,15 +18,6 @@ class Controller {
} }
showItemDescriptor(event, itemFk) { showItemDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk}
})`,
tooltip: 'Item diary'
}
};
this.$.itemDescriptor.itemFk = itemFk; this.$.itemDescriptor.itemFk = itemFk;
this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.parent = event.target;
this.$.itemDescriptor.show(); this.$.itemDescriptor.show();

View File

@ -9,6 +9,7 @@ class Controller extends Component {
this.$http = $http; this.$http = $http;
this.$q = $q; this.$q = $q;
this.client = null; this.client = null;
this._quicklinks = {};
} }
set clientFk(id) { set clientFk(id) {
@ -28,14 +29,16 @@ class Controller extends Component {
return this._client; return this._client;
} }
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
get quicklinks() { get quicklinks() {
return this._quicklinks; return this._quicklinks;
} }
set quicklinks(value = {}) {
Object.keys(value).forEach(key => {
this._quicklinks[key] = value[key];
});
}
show() { show() {
this.$.popover.parent = this.parent; this.$.popover.parent = this.parent;
this.$.popover.show(); this.$.popover.show();

View File

@ -9,6 +9,7 @@ class Controller extends Component {
this.$http = $http; this.$http = $http;
this.$q = $q; this.$q = $q;
this.worker = null; this.worker = null;
this._quicklinks = {};
} }
set invoiceOutId(id) { set invoiceOutId(id) {
@ -23,14 +24,16 @@ class Controller extends Component {
return this._invoiceOutId; return this._invoiceOutId;
} }
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
get quicklinks() { get quicklinks() {
return this._quicklinks; return this._quicklinks;
} }
set quicklinks(value = {}) {
Object.keys(value).forEach(key => {
this._quicklinks[key] = value[key];
});
}
show() { show() {
this.$.popover.parent = this.parent; this.$.popover.parent = this.parent;
this.$.popover.show(); this.$.popover.show();

View File

@ -9,6 +9,7 @@ class Controller extends Component {
this.$http = $http; this.$http = $http;
this.$q = $q; this.$q = $q;
this.item = null; this.item = null;
this._quicklinks = {};
} }
set itemFk(id) { set itemFk(id) {
@ -16,6 +17,15 @@ class Controller extends Component {
this._itemFk = id; this._itemFk = id;
this.item = null; this.item = null;
this._quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${id},
})`,
tooltip: 'Item diary'
}
};
this.getCard(); this.getCard();
} }
@ -28,14 +38,16 @@ class Controller extends Component {
return this._item; return this._item;
} }
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
get quicklinks() { get quicklinks() {
return this._quicklinks; return this._quicklinks;
} }
set quicklinks(value = {}) {
Object.keys(value).forEach(key => {
this._quicklinks[key] = value[key];
});
}
show() { show() {
this.$.popover.parent = this.parent; this.$.popover.parent = this.parent;
this.$.popover.show(); this.$.popover.show();

View File

@ -139,8 +139,7 @@
question="Do you want to clone this item?" question="Do you want to clone this item?"
message="All it's properties will be copied"> message="All it's properties will be copied">
</vn-confirm> </vn-confirm>
<vn-item-descriptor-popover vn-id="itemDescriptor"> <vn-item-descriptor-popover vn-id="itemDescriptor"></vn-item-descriptor-popover>
</vn-item-descriptor-popover>
<vn-worker-descriptor-popover <vn-worker-descriptor-popover
vn-id="workerDescriptor" vn-id="workerDescriptor"
worker-fk="$ctrl.selectedWorker"> worker-fk="$ctrl.selectedWorker">

View File

@ -53,15 +53,6 @@ class Controller {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk},
})`,
tooltip: 'Item diary'
}
};
this.$.itemDescriptor.itemFk = itemFk; this.$.itemDescriptor.itemFk = itemFk;
this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.parent = event.target;
this.$.itemDescriptor.show(); this.$.itemDescriptor.show();

View File

@ -85,6 +85,5 @@
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-item-descriptor-popover <vn-item-descriptor-popover
vn-id="descriptor" vn-id="descriptor">
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover> </vn-item-descriptor-popover>

View File

@ -31,15 +31,6 @@ class Controller {
} }
showDescriptor(event, itemFk) { showDescriptor(event, itemFk) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${itemFk},
})`,
tooltip: 'Item diary'
}
};
this.$scope.descriptor.itemFk = itemFk; this.$scope.descriptor.itemFk = itemFk;
this.$scope.descriptor.parent = event.target; this.$scope.descriptor.parent = event.target;
this.$scope.descriptor.show(); this.$scope.descriptor.show();

View File

@ -9,6 +9,7 @@ class Controller extends Component {
this.$http = $http; this.$http = $http;
this.$q = $q; this.$q = $q;
this.ticket = null; this.ticket = null;
this._quicklinks = {};
} }
set ticketFk(id) { set ticketFk(id) {
@ -28,14 +29,16 @@ class Controller extends Component {
return this._ticket; return this._ticket;
} }
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
get quicklinks() { get quicklinks() {
return this._quicklinks; return this._quicklinks;
} }
set quicklinks(value = {}) {
Object.keys(value).forEach(key => {
this._quicklinks[key] = value[key];
});
}
show() { show() {
this.$.popover.parent = this.parent; this.$.popover.parent = this.parent;
this.$.popover.show(); this.$.popover.show();

View File

@ -9,6 +9,7 @@ class Controller extends Component {
this.$http = $http; this.$http = $http;
this.$q = $q; this.$q = $q;
this.worker = null; this.worker = null;
this._quicklinks = {};
} }
set workerFk(workerFk) { set workerFk(workerFk) {
@ -23,14 +24,16 @@ class Controller extends Component {
return this._workerFk; return this._workerFk;
} }
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this._quicklinks);
}
get quicklinks() { get quicklinks() {
return this._quicklinks; return this._quicklinks;
} }
set quicklinks(value = {}) {
Object.keys(value).forEach(key => {
this._quicklinks[key] = value[key];
});
}
show() { show() {
this.$.popover.parent = this.parent; this.$.popover.parent = this.parent;
this.$.popover.show(); this.$.popover.show();