Skip to content
Snippets Groups Projects
Commit b1210f2b authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #12346 TIME 1 fix css shipping action + add checkbox main document

parent d3a00fdd
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,9 @@
<b *ngIf="data.resIds.length > 1" color="primary" class="highlight">{{data.resIds.length}}
{{lang.elements}}</b> ?
</div>
<div *ngIf="data.resIds.length > 0" style="padding:10px;display: flex;flex-direction: column;">
<mat-checkbox color="primary" *ngFor="let inteKey of integrationsInfo | keyvalue" (click)="toggleIntegration(inteKey.key)" [checked]="data.resource.integrations[inteKey.key]">{{lang[inteKey.key+'_doc']}}</mat-checkbox>
</div>
<div class="col-md-12" style="padding-top: 10px;">
<mat-form-field>
<mat-label>{{lang.shippings}}</mat-label>
......@@ -102,7 +105,7 @@
<mat-sidenav mode="side" fixedTopGap="56" position='end' [opened]="attachList.length > 0" style="width: 50%;">
<div class="pjList">
<img *ngFor="let attach of attachList" title="{{attach.identifier}} : {{attach.title}}"
src="../../rest/attachments/{{attach.res_id}}/thumbnail" />
src="../../rest/{{attach.type === 'attachments_coll' ? 'attachments' : 'resources'}}/{{attach.res_id}}/thumbnail" />
</div>
</mat-sidenav>
</mat-sidenav-container>
......
......@@ -36,7 +36,13 @@ export class SendShippingActionComponent implements OnInit {
entitiesList: string[] = [];
attachList: any[] = [];
mailsNotSend: any[] = []
mailsNotSend: any[] = [];
integrationsInfo: any = {
inShipping: {
icon: 'fas fa-shipping-fast'
}
};
@ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent;
......@@ -45,17 +51,7 @@ export class SendShippingActionComponent implements OnInit {
ngOnInit(): void {
this.loading = true;
this.http.post('../../rest/resourcesList/users/' + this.data.userId + '/groups/' + this.data.groupId + '/baskets/' + this.data.basketId + '/actions/' + this.data.action.id + '/checkShippings', { resources: this.data.resIds })
.subscribe((data: any) => {
this.shippings = data.shippingTemplates;
this.mailsNotSend = data.canNotSend;
this.entitiesList = data.entities;
this.attachList = data.resources;
this.loading = false;
}, (err: any) => {
this.notify.handleErrors(err);
this.loading = false;
});
this.checkShipping();
}
onSubmit() {
......@@ -85,8 +81,26 @@ export class SendShippingActionComponent implements OnInit {
).subscribe()
} */
checkShipping() {
this.http.post(`../../rest/resourcesList/users/${this.data.userId}/groups/${this.data.groupId}/baskets/${this.data.basketId}/actions/${this.data.action.id}/checkShippings`, { resources: this.data.resIds }).pipe(
tap((data: any) => {
this.shippings = data.shippingTemplates;
this.mailsNotSend = data.canNotSend;
this.entitiesList = data.entities;
this.attachList = data.resources;
}),
finalize(() => this.loading = false),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe()
}
executeAction() {
let realResSelected: string[] = this.attachList.map((e: any) => { return e.res_id_master; });
let realResSelected: string[] = this.attachList.filter(attach => attach.type === 'attachments_coll').map((e: any) => { return e.res_id_master; });
realResSelected = realResSelected.concat(this.attachList.filter(attach => attach.type === 'letterbox_coll').map((e: any) => { return e.res_id; }));
this.http.put(this.data.processActionRoute, {resources : realResSelected, data: { shippingTemplateId: this.currentShipping.id }, note : this.noteEditor.getNoteContent()}).pipe(
tap((data: any) => {
......@@ -104,4 +118,17 @@ export class SendShippingActionComponent implements OnInit {
).subscribe();
}
toggleIntegration(integrationId: string) {
this.http.put(`../../rest/resourcesList/integrations`, {resources : this.data.resIds, integrations : { [integrationId] : !this.data.resource.integrations[integrationId]}}).pipe(
tap(() => {
this.data.resource.integrations[integrationId] = !this.data.resource.integrations[integrationId];
this.checkShipping();
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment