Merge branch 'dev' into 5417-fixCustomerPayments
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
250cb3cb68
|
@ -14,8 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [2340.01] - 2023-10-05
|
||||
|
||||
### Added
|
||||
- (Usuarios -> Foto) Se muestra la foto del trabajador
|
||||
|
||||
### Changed
|
||||
### Fixed
|
||||
- (Usuarios -> Historial) Abre el descriptor del usuario correctamente
|
||||
|
||||
## [2338.01] - 2023-09-21
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import './section';
|
|||
import './summary';
|
||||
import './topbar/topbar';
|
||||
import './user-popover';
|
||||
import './user-photo';
|
||||
import './upload-photo';
|
||||
import './bank-entity';
|
||||
import './log';
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<vn-avatar
|
||||
ng-class="::{system: !userLog.user}"
|
||||
val="{{::userLog.user ? userLog.user.nickname : $ctrl.$t('System')}}"
|
||||
ng-click="$ctrl.showWorkerDescriptor($event, userLog)">
|
||||
ng-click="$ctrl.showDescriptor($event, userLog)">
|
||||
<img
|
||||
ng-if="::userLog.user.image"
|
||||
ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.token}}">
|
||||
|
@ -260,3 +260,6 @@
|
|||
<vn-worker-descriptor-popover
|
||||
vn-id="worker-descriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-account-descriptor-popover
|
||||
vn-id="account-descriptor">
|
||||
</vn-account-descriptor-popover>
|
||||
|
|
|
@ -362,9 +362,11 @@ export default class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
showWorkerDescriptor(event, userLog) {
|
||||
if (userLog.user?.worker)
|
||||
this.$.workerDescriptor.show(event.target, userLog.userFk);
|
||||
showDescriptor(event, userLog) {
|
||||
if (userLog.user?.worker && this.$state.current.name.split('.')[0] != 'account')
|
||||
return this.$.workerDescriptor.show(event.target, userLog.userFk);
|
||||
|
||||
this.$.accountDescriptor.show(event.target, userLog.userFk);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<div class="photo" text-center>
|
||||
<img vn-id="photo"
|
||||
ng-src="{{$root.imagePath('user', '520x520', $ctrl.userId)}}"
|
||||
zoom-image="{{$root.imagePath('user', '1600x1600', $ctrl.userId)}}"
|
||||
on-error-src/>
|
||||
<vn-float-button ng-click="uploadPhoto.show('user', $ctrl.userId)"
|
||||
icon="edit"
|
||||
vn-visible-by="userPhotos">
|
||||
</vn-float-button>
|
||||
</div>
|
||||
<!-- Upload photo dialog -->
|
||||
<vn-upload-photo
|
||||
vn-id="uploadPhoto"
|
||||
on-response="$ctrl.onUploadResponse()">
|
||||
</vn-upload-photo>
|
|
@ -0,0 +1,31 @@
|
|||
import ngModule from '../../module';
|
||||
|
||||
export default class Controller {
|
||||
constructor($element, $, $rootScope) {
|
||||
Object.assign(this, {
|
||||
$element,
|
||||
$,
|
||||
$rootScope,
|
||||
});
|
||||
}
|
||||
|
||||
onUploadResponse() {
|
||||
const timestamp = Date.vnNew().getTime();
|
||||
const src = this.$rootScope.imagePath('user', '520x520', this.userId);
|
||||
const zoomSrc = this.$rootScope.imagePath('user', '1600x1600', this.userId);
|
||||
const newSrc = `${src}&t=${timestamp}`;
|
||||
const newZoomSrc = `${zoomSrc}&t=${timestamp}`;
|
||||
|
||||
this.$.photo.setAttribute('src', newSrc);
|
||||
this.$.photo.setAttribute('zoom-image', newZoomSrc);
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$scope', '$rootScope'];
|
||||
|
||||
ngModule.vnComponent('vnUserPhoto', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
userId: '@?',
|
||||
}
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
My account: Mi cuenta
|
||||
Local warehouse: Almacén local
|
||||
Local bank: Banco local
|
||||
Local company: Empresa local
|
||||
User warehouse: Almacén del usuario
|
||||
User company: Empresa del usuario
|
|
@ -0,0 +1,4 @@
|
|||
<slot-descriptor>
|
||||
<vn-user-descriptor>
|
||||
</vn-user-descriptor>
|
||||
</slot-descriptor>
|
|
@ -0,0 +1,9 @@
|
|||
import ngModule from '../module';
|
||||
import DescriptorPopover from 'salix/components/descriptor-popover';
|
||||
|
||||
class Controller extends DescriptorPopover {}
|
||||
|
||||
ngModule.vnComponent('vnAccountDescriptorPopover', {
|
||||
slotTemplate: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -2,6 +2,9 @@
|
|||
module="account"
|
||||
description="$ctrl.user.nickname"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-before>
|
||||
<vn-user-photo user-id="{{$ctrl.id}}"/>
|
||||
</slot-before>
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="deleteUser.show()"
|
||||
|
|
|
@ -24,6 +24,28 @@ class Controller extends Descriptor {
|
|||
.then(res => this.hasAccount = res.data.exists);
|
||||
}
|
||||
|
||||
loadData() {
|
||||
const filter = {
|
||||
where: {id: this.$params.id},
|
||||
include: {
|
||||
relation: 'role',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Promise.all([
|
||||
this.$http.get(`VnUsers/preview`, {filter})
|
||||
.then(res => {
|
||||
const [user] = res.data;
|
||||
this.user = user;
|
||||
}),
|
||||
this.$http.get(`Accounts/${this.$params.id}/exists`)
|
||||
.then(res => this.hasAccount = res.data.exists)
|
||||
]);
|
||||
}
|
||||
|
||||
onDelete() {
|
||||
return this.$http.delete(`VnUsers/${this.id}`)
|
||||
.then(() => this.$state.go('account.index'))
|
||||
|
|
|
@ -9,6 +9,7 @@ import './acl';
|
|||
import './summary';
|
||||
import './card';
|
||||
import './descriptor';
|
||||
import './descriptor-popover';
|
||||
import './search-panel';
|
||||
import './create';
|
||||
import './basic-data';
|
||||
|
|
|
@ -3,16 +3,7 @@
|
|||
description="$ctrl.worker.firstName +' '+ $ctrl.worker.lastName"
|
||||
summary="$ctrl.$.summary">
|
||||
<slot-before>
|
||||
<div class="photo" text-center>
|
||||
<img vn-id="photo"
|
||||
ng-src="{{$root.imagePath('user', '520x520', $ctrl.worker.id)}}"
|
||||
zoom-image="{{$root.imagePath('user', '1600x1600', $ctrl.worker.id)}}"
|
||||
on-error-src/>
|
||||
<vn-float-button ng-click="uploadPhoto.show('user', $ctrl.worker.id)"
|
||||
icon="edit"
|
||||
vn-visible-by="userPhotos">
|
||||
</vn-float-button>
|
||||
</div>
|
||||
<vn-user-photo user-id="{{$ctrl.worker.id}}"/>
|
||||
</slot-before>
|
||||
<slot-menu>
|
||||
<vn-item ng-click="$ctrl.handleExcluded()" translate>
|
||||
|
@ -76,8 +67,3 @@
|
|||
<vn-worker-summary worker="$ctrl.worker"></vn-worker-summary>
|
||||
</vn-popup>
|
||||
|
||||
<!-- Upload photo dialog -->
|
||||
<vn-upload-photo
|
||||
vn-id="uploadPhoto"
|
||||
on-response="$ctrl.onUploadResponse()">
|
||||
</vn-upload-photo>
|
||||
|
|
|
@ -71,17 +71,6 @@ class Controller extends Descriptor {
|
|||
return this.getData(`Workers/${this.id}`, {filter})
|
||||
.then(res => this.entity = res.data);
|
||||
}
|
||||
|
||||
onUploadResponse() {
|
||||
const timestamp = Date.vnNew().getTime();
|
||||
const src = this.$rootScope.imagePath('user', '520x520', this.worker.id);
|
||||
const zoomSrc = this.$rootScope.imagePath('user', '1600x1600', this.worker.id);
|
||||
const newSrc = `${src}&t=${timestamp}`;
|
||||
const newZoomSrc = `${zoomSrc}&t=${timestamp}`;
|
||||
|
||||
this.$.photo.setAttribute('src', newSrc);
|
||||
this.$.photo.setAttribute('zoom-image', newZoomSrc);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$rootScope'];
|
||||
|
|
Loading…
Reference in New Issue