Daniel hace 1 año
padre
commit
e3573728f5
Se han modificado 17 ficheros con 33 adiciones y 114 borrados
  1. +0
    -20
      matsen-tool/src/app/_components/list/list.component.ts
  2. +0
    -1
      matsen-tool/src/app/_components/search-select/search-select.component.html
  3. +3
    -6
      matsen-tool/src/app/_components/search-select/search-select.component.ts
  4. +1
    -2
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html
  5. +2
    -0
      matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts
  6. +3
    -9
      matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts
  7. +7
    -8
      matsen-tool/src/app/_views/posts/new-post/new-post.component.html
  8. +2
    -11
      matsen-tool/src/app/_views/posts/new-post/new-post.component.ts
  9. +3
    -5
      matsen-tool/src/app/_views/products/assign-product/assign-product.component.html
  10. +0
    -10
      matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts
  11. +4
    -4
      matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html
  12. +3
    -12
      matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts
  13. +1
    -1
      matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts
  14. +0
    -1
      matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.html
  15. +2
    -8
      matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.ts
  16. +0
    -2
      matsen-tool/src/app/_views/tasks/new-task/new-task.component.html
  17. +2
    -14
      matsen-tool/src/app/_views/tasks/new-task/new-task.component.ts

+ 0
- 20
matsen-tool/src/app/_components/list/list.component.ts Ver fichero

@@ -42,21 +42,6 @@ export class ListComponent implements OnInit, AfterViewInit {
public static COLUMN_TYPE_TEXT_LINKED: string = 'text_linked';
public static COLUMN_TYPE_WEBSITE: string = 'website';

public static validColumnTypes: string[] = [
ListComponent.COLUMN_TYPE_ADDRESS,
ListComponent.COLUMN_TYPE_BTN_DOWNLOAD,
ListComponent.COLUMN_TYPE_BTN_EDIT,
ListComponent.COLUMN_TYPE_BTN_REMOVE,
ListComponent.COLUMN_TYPE_CURRENCY,
ListComponent.COLUMN_TYPE_DATE,
ListComponent.COLUMN_TYPE_DETAIL,
ListComponent.COLUMN_TYPE_EMAIL,
ListComponent.COLUMN_TYPE_IMAGE,
ListComponent.COLUMN_TYPE_POSITION,
ListComponent.COLUMN_TYPE_TEXT,
ListComponent.COLUMN_TYPE_TEXT_LINKED,
ListComponent.COLUMN_TYPE_WEBSITE,
];
get COLUMN_TYPE_ADDRESS(): string { return ListComponent.COLUMN_TYPE_ADDRESS; }
get COLUMN_TYPE_BTN_DOWNLOAD(): string { return ListComponent.COLUMN_TYPE_BTN_DOWNLOAD; }
get COLUMN_TYPE_BTN_EDIT(): string { return ListComponent.COLUMN_TYPE_BTN_EDIT; }
@@ -115,11 +100,6 @@ export class ListComponent implements OnInit, AfterViewInit {
)
}

setData(dataSource: any, dataLength: number): void {
this.pagingComponent.dataSource = dataSource;
this.pagingComponent.setDataLength(dataLength);
}

onSortChange = (sortState: Sort) => {
this.pagingComponent.resetPageIndex()
this.onSortFunction(sortState);


+ 0
- 1
matsen-tool/src/app/_components/search-select/search-select.component.html Ver fichero

@@ -3,7 +3,6 @@
<p #paragraphRef (click)="openSearchBox()" [class.search-empty]="!searchBoxFilled"></p>
<span class="spt-clear" *ngIf="searchBoxFilled" (click)="clearSearch()"></span>
</div>
<!-- <p>NAME {{documentForm.get(formId)}}<span>X</span></p>-->
<div class="search-toggle" [class.search-box-open]="searchBoxOpen">
<app-list #listComponent
[getDataFunction]="getDataFunction"


+ 3
- 6
matsen-tool/src/app/_components/search-select/search-select.component.ts Ver fichero

@@ -19,7 +19,6 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
@Input() public documentForm!: FormGroup;
@Input() public documentFormField!: string;
@Input() public getDataFunction!: (index: number, pageSize: number, term?: string) => Observable<any>;
@Input() public dataSource: any;
@Input() public dataSet!: any;
@Input() public displayedDataField!: string;
@Input() public displayedDataSubResource!: string;
@@ -52,10 +51,6 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
}
}

setData(dataSource: any, data: any[], dataLength: number): void {
this.listComponent.setData(dataSource, dataLength);
}

onSortChange = (sortState: Sort) => {
let order: OrderFilter;
if (sortState.direction === "") {
@@ -118,7 +113,7 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
];
}

public static getDefaultColDefProducts(): ListColDefinition[] {
public static getDefaultColDefProducts(subResource?: string): ListColDefinition[] {
return [
ListComponent.getDefaultColPosition(),
{
@@ -126,12 +121,14 @@ export class SearchSelectComponent implements OnInit, AfterViewInit {
text: 'overview.image',
type: ListComponent.COLUMN_TYPE_IMAGE,
field: 'imageUrl',
subResource: subResource,
} as ListColDefinition,
{
name: 'name',
text: 'form.product',
type: ListComponent.COLUMN_TYPE_TEXT,
field: 'name',
subResource: subResource,
}
];
}


+ 1
- 2
matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.html Ver fichero

@@ -18,8 +18,7 @@
</div>
<div class="col-12 col-lg-6">
<ul *ngFor="let contactPartnerProduct of contactPartnerProducts">
<!-- TODO: contactPartnerProduct.productName ist falsch, hier muss die ID rein -->
<li><a href="/products/{{this.appHelperService.extractId(contactPartnerProduct.product?.id)}}">{{contactPartnerProduct.product?.name}}</a></li>
<li><a href="{{ appHelperService.getResourceLink(contactPartnerProduct.product) }}">{{contactPartnerProduct.product?.name}}</a></li>
</ul>
</div>
</div>


+ 2
- 0
matsen-tool/src/app/_views/contacts/contacts-detail/contacts-detail.component.ts Ver fichero

@@ -107,4 +107,6 @@ export class ContactsDetailComponent implements OnInit, AfterViewInit {
}
this.appHelperService.openModal(NewContactComponent, data, this.getContactData);
}

protected readonly AppHelperService = AppHelperService;
}

+ 3
- 9
matsen-tool/src/app/_views/partners/partner-list/partner-list.component.ts Ver fichero

@@ -107,20 +107,14 @@ export class PartnerListComponent implements OnInit, AfterViewInit {
} as ListColDefinition
)
}
if (this.user !== undefined) {
this.getDataFunction = this.getPartnerData;
} else if (this.product !== undefined) {
this.getDataFunction = this.getUserPartnerData
} else {
this.getDataFunction = this.getPartnerData;
}
this.getDataFunction = this.getGetDataFunction();
}

ngAfterViewInit() {
this.listComponent.getData();
}

getData = (): ListGetDataFunctionType => {
getGetDataFunction = (): ListGetDataFunctionType => {
if (this.user !== undefined) {
return this.getUserPartnerData;
} else if (this.product !== undefined) {
@@ -207,7 +201,7 @@ export class PartnerListComponent implements OnInit, AfterViewInit {
openModalNewPartner() {
let partner: PartnerJsonld = {} as PartnerJsonld;
partner.partnerType = this.partnerType as TypeEnum;
this.appHelperService.openModal(NewPartnerComponent, { 'partner': partner }, this.getData);
this.appHelperService.openModal(NewPartnerComponent, { 'partner': partner }, this.getGetDataFunction);
}

unassignPartner = (element: any)=> {


+ 7
- 8
matsen-tool/src/app/_views/posts/new-post/new-post.component.html Ver fichero

@@ -14,14 +14,13 @@
<label for="product" class="form-label">{{ 'form.product' | translate }}:</label>
<ng-container *ngIf="posting.saleIri === null || posting.saleIri === undefined">
<app-search-select *ngIf="this.posting.id === null || this.posting.id === undefined"
#productSearchSelect
[formId]="'productIri'"
[formLabelLangKey]="'form.product'"
[documentForm]="postForm"
[getDataFunction]="getProducts"
[dataSource]="dataSourceProducts"
[displayedDataField]="'name'"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()"
#productSearchSelect
[formId]="'productIri'"
[formLabelLangKey]="'form.product'"
[documentForm]="postForm"
[getDataFunction]="getProducts"
[displayedDataField]="'name'"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()"
>
</app-search-select>
<input id="product" type="hidden" *ngIf="this.posting.id === null || this.posting.id === undefined"


+ 2
- 11
matsen-tool/src/app/_views/posts/new-post/new-post.component.ts Ver fichero

@@ -10,10 +10,7 @@ import {
} from "@app/core/api/v1";
import {FormGroupInitializer} from "@app/_helpers/formgroup.initializer";
import {AppHelperService} from "@app/_helpers/app-helper.service";
import {Subscription} from "rxjs";
import {SearchSelectComponent} from "@app/_components/search-select/search-select.component";
import {MatTableDataSource} from "@angular/material/table";
import {SearchInputColDef} from "@app/_components/search-input/search-input-col-def";
import {ListGetDataFunctionType} from "@app/_components/list/list-get-data-function-type";

@Component({
@@ -29,9 +26,6 @@ export class NewPostComponent implements OnInit {
protected readonly SearchSelectComponent = SearchSelectComponent;

protected postForm: FormGroup;
protected postSub: Subscription;
protected products: Array<ProductJsonld>;
protected dataSourceProducts;

constructor(
private postService: PostService,
@@ -39,9 +33,6 @@ export class NewPostComponent implements OnInit {
protected appHelperService: AppHelperService,
) {
this.postForm = postForm;
this.postSub = new Subscription();
this.products = [];
this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products);
}

ngOnInit(): void {
@@ -60,7 +51,7 @@ export class NewPostComponent implements OnInit {
if (this.postForm.valid) {
if (this.posting.id === null || this.posting.id === undefined) {
// Create new post
this.postSub = this.postService.postsPost(
this.postService.postsPost(
this.postForm.value as PostJsonld
).subscribe(
data => {
@@ -70,7 +61,7 @@ export class NewPostComponent implements OnInit {
);
} else {
// Edit post
this.postSub = this.postService.postsIdPatch(
this.postService.postsIdPatch(
this.appHelperService.extractId(this.posting.id),
this.postForm.value as PostJsonld
).subscribe(


+ 3
- 5
matsen-tool/src/app/_views/products/assign-product/assign-product.component.html Ver fichero

@@ -9,24 +9,22 @@
[formLabelLangKey]="'form.product'"
[documentForm]="form"
[getDataFunction]="getUnassignedProducts"
[dataSource]="dataSourceProducts"
[displayedDataField]="'name'"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()"
>
<input type="hidden" id="product" formControlName="productIri" value="{{partnerProduct.productIri}}"/>
</app-search-select>
</div>
<div class="mb-3" *ngIf="this.contactPartnerProduct">
<label for="partnerProduct" class="form-label">{{ 'form.product' | translate }}:</label>
<app-search-select #partnerSearchSelect
<app-search-select #productSearchSelect
[formId]="'partnerProductIri'"
[formLabelLangKey]="'form.product'"
[documentForm]="form"
[getDataFunction]="getUnassignedPartnerProducts"
[dataSource]="dataSourcePartnerProducts"
[displayedDataField]="'name'"
[displayedDataSubResource]="'product'"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts('product')"
>
<input type="hidden" id="partnerProduct" formControlName="partnerProductIri" value="{{contactPartnerProduct.partnerProductIri}}"/>
</app-search-select>


+ 0
- 10
matsen-tool/src/app/_views/products/assign-product/assign-product.component.ts Ver fichero

@@ -27,10 +27,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit {
@ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent
protected readonly SearchSelectComponent = SearchSelectComponent;

protected products: Array<ProductJsonld>;
protected dataSourceProducts;
protected partnerProducts: Array<PartnerProductJsonld>;
protected dataSourcePartnerProducts;
protected form!: FormGroup;

constructor(
@@ -39,11 +35,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit {
protected contactPartnerProductService: ContactPartnerProductService,
protected appHelperService: AppHelperService,
) {
this.products = [];
this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products);

this.partnerProducts = [];
this.dataSourcePartnerProducts = new MatTableDataSource<PartnerProductJsonld>(this.partnerProducts);
}

ngOnInit(): void {
@@ -87,7 +78,6 @@ export class AssignProductComponent implements OnInit, AfterViewInit {
onSubmit() {
if (this.form.valid) {
if (this.partnerProduct !== undefined) {
// Partner product
this.partnerProductService.partnerProductsPost(
this.form.value as PartnerProductJsonld
).subscribe(


+ 4
- 4
matsen-tool/src/app/_views/sales/new-sale/new-sale.component.html Ver fichero

@@ -4,12 +4,12 @@
<form [formGroup]="saleForm" (ngSubmit)="onSubmit()">

<div class="mb-3">
<app-search-select #partnerSearchSelect
<label for="partnerIri" class="form-label">{{ 'form.partner' | translate }}:</label>
<app-search-select #partnerSearchSelect id="partnerIri"
[formId]="'partnerIri'"
[formLabelLangKey]="'form.partner'"
[documentForm]="saleForm"
[getDataFunction]="getPartners"
[dataSource]="dataSourcePartners"
[displayedDataField]="'name'"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefPartners()"
>
@@ -18,12 +18,12 @@
</div>

<div class="mb-3">
<app-search-select #productSearchSelect
<label for="productIri" class="form-label">{{ 'form.product' | translate }}:</label>
<app-search-select #productSearchSelect id="productIri"
[formId]="'productIri'"
[formLabelLangKey]="'form.product'"
[documentForm]="saleForm"
[getDataFunction]="getProducts"
[dataSource]="dataSourceProducts"
[displayedDataField]="'name'"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()"
>


+ 3
- 12
matsen-tool/src/app/_views/sales/new-sale/new-sale.component.ts Ver fichero

@@ -26,17 +26,13 @@ import {ListColDefinition} from "@app/_components/list/list-col-definition";
})
export class NewSaleComponent implements OnInit, AfterViewInit {
@Input() public sale!: SaleJsonld;
@Input() public partner!: PartnerJsonld;
@Output() public submit: EventEmitter<ModalStatus> = new EventEmitter<ModalStatus>();
@ViewChild('partnerSearchSelect', { static: false }) partnerSearchSelect!: SearchSelectComponent;
@ViewChild('productSearchSelect', { static: false }) productSearchSelect!: SearchSelectComponent;
protected readonly SearchSelectComponent = SearchSelectComponent;

protected saleForm: FormGroup;
protected saleSub: Subscription;
protected partners: Array<PartnerJsonld>;
protected dataSourcePartners;
protected products: Array<ProductJsonld>;
protected dataSourceProducts;

constructor(
private saleService: SaleService,
@@ -46,11 +42,6 @@ export class NewSaleComponent implements OnInit, AfterViewInit {
protected appHelperService: AppHelperService,
) {
this.saleForm = saleForm;
this.saleSub = new Subscription();
this.partners = [];
this.dataSourcePartners = new MatTableDataSource<PartnerJsonld>(this.partners);
this.products = [];
this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products);
}

ngOnInit(): void {
@@ -90,7 +81,7 @@ export class NewSaleComponent implements OnInit, AfterViewInit {
}
if (this.sale.id === null || this.sale.id === undefined) {
// Create new sale
this.saleSub = this.saleService.salesPost(
this.saleService.salesPost(
this.saleForm.value as SaleJsonld
).subscribe(
data => {
@@ -100,7 +91,7 @@ export class NewSaleComponent implements OnInit, AfterViewInit {
);
} else {
// Edit sale
this.saleSub = this.saleService.salesIdPatch(
this.saleService.salesIdPatch(
this.appHelperService.extractId(this.sale.id),
this.saleForm.value as SaleJsonld
).subscribe(


+ 1
- 1
matsen-tool/src/app/_views/sales/sale-list/sale-list.component.ts Ver fichero

@@ -120,7 +120,7 @@ export class SaleListComponent implements OnInit, AfterViewInit {

openModalNewSale() {
let sale: SaleJsonld = {} as SaleJsonld;
this.appHelperService.openModal(NewSaleComponent, { 'sale': sale }, this.listComponent.getData);
this.appHelperService.openModal(NewSaleComponent, { 'sale': sale, 'partner': this.partner }, this.listComponent.getData);
}

}

+ 0
- 1
matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.html Ver fichero

@@ -17,7 +17,6 @@
[formLabelLangKey]="'form.product'"
[documentForm]="taskNoteForm"
[getDataFunction]="getContacts"
[dataSource]="dataSourceContacts"
[displayedDataField]="'fullName'"
[dataSet]="taskNote.contact"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefContacts()"


+ 2
- 8
matsen-tool/src/app/_views/tasks/new-task-note/new-task-note.component.ts Ver fichero

@@ -30,10 +30,7 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit {
protected readonly SearchSelectComponent = SearchSelectComponent;

protected taskNoteForm: FormGroup;
protected taskNoteSub: Subscription;
protected contactTypes = Object.values(TaskNoteJsonld.ContactTypeEnum);
protected contacts: Array<ContactJsonld>;
protected dataSourceContacts;

constructor(
protected taskNoteService: TaskNoteService,
@@ -41,9 +38,6 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit {
protected contactService: ContactService
) {
this.taskNoteForm = taskNoteForm;
this.taskNoteSub = new Subscription();
this.contacts = [];
this.dataSourceContacts = new MatTableDataSource<ContactJsonld>(this.contacts);
}

ngOnInit(): void {
@@ -77,7 +71,7 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit {
if (this.taskNoteForm.valid) {
if (this.taskNote.id === null || this.taskNote.id === undefined) {
// Create new taskNote
this.taskNoteSub = this.taskNoteService.taskNotesPost(
this.taskNoteService.taskNotesPost(
this.taskNoteForm.value as TaskNoteJsonld
).subscribe(
data => {
@@ -87,7 +81,7 @@ export class NewTaskNoteComponent implements OnInit, AfterViewInit {
);
} else {
// Edit taskNote
this.taskNoteSub = this.taskNoteService.taskNotesIdPatch(
this.taskNoteService.taskNotesIdPatch(
this.appHelperService.extractId(this.taskNote.id),
this.taskNoteForm.value as TaskNoteJsonld
).subscribe(


+ 0
- 2
matsen-tool/src/app/_views/tasks/new-task/new-task.component.html Ver fichero

@@ -25,7 +25,6 @@
[formLabelLangKey]="'form.product'"
[documentForm]="taskForm"
[getDataFunction]="getProducts"
[dataSource]="dataSourceProducts"
[displayedDataField]="'name'"
[dataSet]="task.product"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefProducts()"
@@ -42,7 +41,6 @@
[formLabelLangKey]="'form.user'"
[documentForm]="taskForm"
[getDataFunction]="getUsers"
[dataSource]="dataSourceUsers"
[displayedDataField]="'fullName'"
[dataSet]="task.assignedTo"
[listColDefinitions]="SearchSelectComponent.getDefaultColDefUsers()"


+ 2
- 14
matsen-tool/src/app/_views/tasks/new-task/new-task.component.ts Ver fichero

@@ -33,27 +33,15 @@ export class NewTaskComponent implements OnInit, AfterViewInit {
protected readonly SearchSelectComponent = SearchSelectComponent;

protected taskForm: FormGroup;
protected taskSub: Subscription;
protected dueAtValue: string;

protected users: Array<UserJsonld>;
protected dataSourceUsers;

protected products: Array<ProductJsonld>;
protected dataSourceProducts;

constructor(
protected taskService: TaskService,
protected userService: UserService,
protected productService: ProductService,
protected appHelperService: AppHelperService
) {
this.users = [];
this.dataSourceUsers = new MatTableDataSource<UserJsonld>(this.users);
this.products = [];
this.dataSourceProducts = new MatTableDataSource<ProductJsonld>(this.products);
this.taskForm = taskForm;
this.taskSub = new Subscription();
this.dueAtValue = "";
}

@@ -101,7 +89,7 @@ export class NewTaskComponent implements OnInit, AfterViewInit {
if (this.taskForm.valid) {
if (this.task.id === null || this.task.id === undefined) {
// Create new task
this.taskSub = this.taskService.tasksPost(
this.taskService.tasksPost(
this.taskForm.value as TaskJsonld
).subscribe(
data => {
@@ -111,7 +99,7 @@ export class NewTaskComponent implements OnInit, AfterViewInit {
);
} else {
// Edit task
this.taskSub = this.taskService.tasksIdPatch(
this.taskService.tasksIdPatch(
this.appHelperService.extractId(this.task.id),
this.taskForm.value as TaskJsonld
).subscribe(


Cargando…
Cancelar
Guardar