#2051 - DMS unify methods #1888
|
@ -15,6 +15,7 @@ import './module-card';
|
|||
import './module-main';
|
||||
import './side-menu/side-menu';
|
||||
import './section';
|
||||
import './section-dms';
|
||||
import './summary';
|
||||
import './topbar/topbar';
|
||||
import './user-popover';
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
import ngModule from '../../module';
|
||||
import Component from 'core/lib/component';
|
||||
import './style.scss';
|
||||
|
||||
export default class SectionDms extends Component {
|
||||
getAllowedContentTypes() {
|
||||
return this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
return contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
getDms(dmsId) {
|
||||
return this.$http.get(`Dms/${dmsId}`).then(res => res);
|
||||
}
|
||||
getDmsTypes(params) {
|
||||
return this.$http.get('DmsTypes/findOne', params).then(res => res);
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnSectionDms', {
|
||||
controller: SectionDms
|
||||
});
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.dms = {
|
||||
|
@ -20,30 +20,21 @@ class Controller extends Section {
|
|||
this._client = value;
|
||||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
const params = {filter: {
|
||||
where: {code: 'paymentsLaw'}
|
||||
}};
|
||||
this.getDmsTypes(params).then(res => this.handleDefaultParams(res));
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
}
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
});
|
||||
}
|
||||
|
||||
setDefaultParams() {
|
||||
const params = {filter: {
|
||||
where: {code: 'paymentsLaw'}
|
||||
}};
|
||||
this.$http.get('DmsTypes/findOne', {params}).then(res => {
|
||||
const dmsType = res.data && res.data;
|
||||
handleDefaultParams({data: dmsType}) {
|
||||
const companyId = this.vnConfig.companyFk;
|
||||
const warehouseId = this.vnConfig.warehouseFk;
|
||||
const defaultParams = {
|
||||
|
@ -59,7 +50,6 @@ class Controller extends Section {
|
|||
};
|
||||
|
||||
this.dms = Object.assign(this.dms, defaultParams);
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
get client() {
|
||||
return this._client;
|
||||
}
|
||||
|
@ -11,28 +11,18 @@ class Controller extends Section {
|
|||
this._client = value;
|
||||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
this.getDms(this.$params.dmsId).then(handleDefaultParams);
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
}
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
});
|
||||
}
|
||||
|
||||
setDefaultParams() {
|
||||
const path = `Dms/${this.$params.dmsId}`;
|
||||
this.$http.get(path).then(res => {
|
||||
const dms = res.data && res.data;
|
||||
handleDefaultParams({data: dms}) {
|
||||
this.dms = {
|
||||
reference: dms.reference,
|
||||
warehouseId: dms.warehouseFk,
|
||||
|
@ -43,7 +33,6 @@ class Controller extends Section {
|
|||
hasFileAttached: false,
|
||||
files: []
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
import UserError from 'core/lib/user-error';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
constructor($element, $, vnFile) {
|
||||
super($element, $, vnFile);
|
||||
this.dms = {
|
||||
|
@ -11,7 +11,7 @@ class Controller extends Section {
|
|||
hasFileAttached: false
|
||||
};
|
||||
this.vnFile = vnFile;
|
||||
this.getAllowedContentTypes();
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
this._editDownloadDisabled = false;
|
||||
}
|
||||
|
||||
|
@ -53,15 +53,6 @@ class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
if (res.data.length > 0) {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openEditDialog(dmsId) {
|
||||
this.getFile(dmsId).then(() => this.$.dmsEditDialog.show());
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
import './style.scss';
|
||||
import UserError from 'core/lib/user-error';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.dms = {
|
||||
|
@ -19,9 +19,11 @@ class Controller extends Section {
|
|||
|
||||
set route(value) {
|
||||
this._route = value;
|
||||
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
const params = {filter: {
|
||||
where: {code: 'invoiceIn'}
|
||||
}};
|
||||
this.getDmsTypes(params).then(res => this.handleDefaultParams(res));
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
}
|
||||
|
||||
$onChanges() {
|
||||
|
@ -29,25 +31,13 @@ class Controller extends Section {
|
|||
this.params = JSON.parse(this.$params.q);
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
});
|
||||
}
|
||||
|
||||
setDefaultParams() {
|
||||
const params = {filter: {
|
||||
where: {code: 'invoiceIn'}
|
||||
}};
|
||||
this.$http.get('DmsTypes/findOne', {params}).then(res => {
|
||||
const dmsType = res.data && res.data;
|
||||
handleDefaultParams({data: dmsType}) {
|
||||
const companyId = this.vnConfig.companyFk;
|
||||
const warehouseId = this.vnConfig.warehouseFk;
|
||||
const defaultParams = {
|
||||
|
@ -58,7 +48,6 @@ class Controller extends Section {
|
|||
};
|
||||
|
||||
this.dms = Object.assign(this.dms, defaultParams);
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
this.dms = {
|
||||
|
@ -19,30 +19,22 @@ class Controller extends Section {
|
|||
this._ticket = value;
|
||||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
const params = {filter: {
|
||||
where: {code: 'ticket'}
|
||||
}};
|
||||
this.getDmsTypes(params).then(res => this.handleDefaultParams(res));
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
}
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
});
|
||||
}
|
||||
|
||||
setDefaultParams() {
|
||||
const params = {filter: {
|
||||
where: {code: 'ticket'}
|
||||
}};
|
||||
this.$http.get('DmsTypes/findOne', {params}).then(res => {
|
||||
const dmsTypeId = res.data && res.data.id;
|
||||
handleDefaultParams(data) {
|
||||
const dmsTypeId = res?.data?.id;
|
||||
const warehouseId = this.vnConfig.warehouseFk;
|
||||
const defaultParams = {
|
||||
reference: this.ticket.id,
|
||||
|
@ -57,7 +49,6 @@ class Controller extends Section {
|
|||
};
|
||||
|
||||
this.dms = Object.assign(this.dms, defaultParams);
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
get ticket() {
|
||||
return this._ticket;
|
||||
}
|
||||
|
@ -10,28 +10,18 @@ class Controller extends Section {
|
|||
this._ticket = value;
|
||||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
this.getDms(this.$params.dmsId).then(handleDefaultParams);
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
}
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
});
|
||||
}
|
||||
|
||||
setDefaultParams() {
|
||||
const path = `Dms/${this.$params.dmsId}`;
|
||||
this.$http.get(path).then(res => {
|
||||
const dms = res.data && res.data;
|
||||
handleDefaultParams({data: dms}) {
|
||||
this.dms = {
|
||||
reference: dms.reference,
|
||||
warehouseId: dms.warehouseFk,
|
||||
|
@ -42,7 +32,6 @@ class Controller extends Section {
|
|||
hasFileAttached: false,
|
||||
files: []
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
|
@ -17,16 +17,10 @@ class Controller extends Section {
|
|||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
this.allowedContentTypes = this.getAllowedContentTypes();
|
||||
}
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
get travel() {
|
||||
return this._travel;
|
||||
}
|
||||
|
@ -12,17 +12,10 @@ class Controller extends Section {
|
|||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
}
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
allowedContentTypes: this.allowedContentTypes
|
||||
|
|
|
@ -21,16 +21,11 @@ class Controller extends Section {
|
|||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
}
|
||||
}
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
this.getAllowedContentTypes().then(data => {
|
||||
this.allowedContentTypes = data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
return this.$t('ContentTypesInfo', {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../../module';
|
||||
import Section from 'salix/components/section';
|
||||
import SectionDms from 'salix/components/section-dms';
|
||||
import './style.scss';
|
||||
|
||||
class Controller extends Section {
|
||||
class Controller extends SectionDms {
|
||||
get worker() {
|
||||
return this._worker;
|
||||
}
|
||||
|
@ -11,16 +11,10 @@ class Controller extends Section {
|
|||
this._worker = value;
|
||||
|
||||
if (value) {
|
||||
this.setDefaultParams();
|
||||
this.getAllowedContentTypes();
|
||||
}
|
||||
}
|
||||
this.getDms(this.$params.dmsId).then(handleDefaultParams);
|
||||
|
||||
getAllowedContentTypes() {
|
||||
this.$http.get('DmsContainers/allowedContentTypes').then(res => {
|
||||
const contentTypes = res.data.join(', ');
|
||||
this.allowedContentTypes = contentTypes;
|
||||
});
|
||||
this.getAllowedContentTypes().then(data => this.allowedContentTypes = data);
|
||||
}
|
||||
}
|
||||
|
||||
get contentTypesInfo() {
|
||||
|
@ -29,10 +23,7 @@ class Controller extends Section {
|
|||
});
|
||||
}
|
||||
|
||||
setDefaultParams() {
|
||||
const path = `Dms/${this.$params.dmsId}`;
|
||||
this.$http.get(path).then(res => {
|
||||
const dms = res.data && res.data;
|
||||
handleDefaultParams({data: dms}) {
|
||||
this.dms = {
|
||||
reference: dms.reference,
|
||||
warehouseId: dms.warehouseFk,
|
||||
|
@ -43,7 +34,6 @@ class Controller extends Section {
|
|||
hasFileAttached: false,
|
||||
files: []
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
|
|
Loading…
Reference in New Issue