diff --git a/client/client/src/client.js b/client/client/src/client.js
index 4917bc3d0..5e2cfd913 100644
--- a/client/client/src/client.js
+++ b/client/client/src/client.js
@@ -7,6 +7,7 @@ import './basic-data';
import './fiscal-data';
import './billing-data';
import './descriptor';
+import './descriptor-popover';
import './search-panel';
import './address/index';
import './address/create';
diff --git a/client/client/src/descriptor-popover/index.html b/client/client/src/descriptor-popover/index.html
new file mode 100644
index 000000000..4cefbedbb
--- /dev/null
+++ b/client/client/src/descriptor-popover/index.html
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/client/client/src/descriptor-popover/index.js b/client/client/src/descriptor-popover/index.js
new file mode 100644
index 000000000..b39b9b66e
--- /dev/null
+++ b/client/client/src/descriptor-popover/index.js
@@ -0,0 +1,61 @@
+import ngModule from '../module';
+import Component from 'core/src/lib/component';
+import './style.scss';
+
+class Controller extends Component {
+ constructor($element, $scope, $http, $timeout) {
+ super($element, $scope);
+ this.$http = $http;
+ this.$timeout = $timeout;
+ this.isTooltip = true;
+ this.client = {};
+ }
+
+ clear() {
+ this.client = {};
+ this.clientFk = null;
+ }
+
+ _getClientDebt(clientFk) {
+ this.$http.get(`/client/api/Clients/${clientFk}/getDebt`)
+ .then(response => {
+ this.clientDebt = response.data.debt;
+ });
+ }
+
+ _getClient(clientFk) {
+ this.$http.get(`/client/api/Clients/${clientFk}/card`)
+ .then(response => {
+ this.client = response.data;
+ });
+ }
+
+ goToClientTickets() {
+ this.$state.go('ticket.index', {q: `{"clientFk": ${this.client.id}}`});
+ }
+
+ set clientFk(value) {
+ if (value) {
+ this._getClient(value);
+ this._getClientDebt(value);
+ }
+ }
+
+ show() {
+ this.$.popover.parent = this.parent;
+ setTimeout(() => {
+ this.$.popover.show();
+ }, 150);
+ }
+
+}
+Controller.$inject = ['$element', '$scope', '$http', '$timeout'];
+
+ngModule.component('vnClientDescriptorPopover', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ client: '<',
+ clientFk: '<'
+ }
+});
diff --git a/client/client/src/descriptor-popover/style.scss b/client/client/src/descriptor-popover/style.scss
new file mode 100644
index 000000000..f105ef098
--- /dev/null
+++ b/client/client/src/descriptor-popover/style.scss
@@ -0,0 +1,15 @@
+vn-client-descriptor-popover {
+ div.popover{
+ width: 16em;
+ }
+ vn-client-descriptor {
+ width: 16em;
+ display: block;
+ &>vn-card{
+ margin: 0!important;
+ }
+ .header > a:first-child {
+ display: none
+ }
+ }
+}
\ No newline at end of file
diff --git a/client/client/src/descriptor/index.js b/client/client/src/descriptor/index.js
index ab471a998..431d0bd5f 100644
--- a/client/client/src/descriptor/index.js
+++ b/client/client/src/descriptor/index.js
@@ -23,10 +23,10 @@ class Controller {
this.$state.go('ticket.index', {q: `{"clientFk": ${this.client.id}}`});
}
- $onChanges(changes) {
- if (changes.client && this.client) {
- this._getClient(this.client.id);
- this._getClientDebt(this.client.id);
+ set clientFk(value) {
+ if (value) {
+ this._getClient(value);
+ this._getClientDebt(value);
}
}
}
@@ -36,7 +36,8 @@ Controller.$inject = ['$http', '$state'];
ngModule.component('vnClientDescriptor', {
template: require('./index.html'),
bindings: {
- client: '<'
+ client: '<',
+ clientFk: ''
},
controller: Controller
});
diff --git a/client/ticket/src/index/index.html b/client/ticket/src/index/index.html
index a348bf8db..30b9a75fb 100644
--- a/client/ticket/src/index/index.html
+++ b/client/ticket/src/index/index.html
@@ -44,7 +44,7 @@
{{::ticket.shipped | date:'HH:mm'}} |
+ ng-click="$ctrl.showDescriptor($event, ticket.clientFk)">
{{::ticket.nickname}}
|
{{::ticket.address.province.name}} |
@@ -63,6 +63,7 @@
+