nm-copy-item-attributes
src/app/shared/widgets/apps/my-client-copy/copy-item-attributes/copy-item-attributes.component.ts
Used in App myClientCopy. Surrounded by widgetframe
host | { |
providers |
EditAttributeService
|
selector | nm-copy-item-attributes |
styleUrls | copy-item-attributes.component.scss |
templateUrl | ./copy-item-attributes.component.html |
constructor(_widgetframeService: WidgetframeService, _sourceAttributeService: EditAttributeService, _targetAttributeService: EditAttributeService, _halService: HalService, _notificationService: CustomNotificationService, _dragAndDropService: DragAndDropService, zone: NgZone, translateService: TranslateService, dialog: MatDialog)
|
||||||||||||||||||||||||||||||
Parameters :
|
addAssetRelationToChangedAssets | ||||||
addAssetRelationToChangedAssets(assetRelation: , selectedRow: )
|
||||||
Parameters :
Returns :
void
|
clearAllSelections |
clearAllSelections()
|
Returns :
void
|
Protected configureWidget | ||||||
configureWidget(configuration: WidgetConfig)
|
||||||
Decorators : WidgetConfigure
|
||||||
Parameters :
Returns :
void
|
copyAssets | ||||
copyAssets(assetRelation: )
|
||||
Parameters :
Returns :
void
|
delteAssets | ||||
delteAssets(assetRelation: )
|
||||
Parameters :
Returns :
void
|
editAssets |
editAssets()
|
Returns :
void
|
groupItems | |||||||||
groupItems(items: , selectedGroupByItemAttribute: any)
|
|||||||||
Parameters :
Returns :
any
|
hashCode | ||||
hashCode(str: )
|
||||
Parameters :
Returns :
any
|
imageClick | ||||||||
imageClick(index: , asset: , assetRelation: )
|
||||||||
Parameters :
Returns :
void
|
keydown | ||||||
keydown(event: any)
|
||||||
Parameters :
Returns :
void
|
keyup | ||||||
keyup(event: any)
|
||||||
Parameters :
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
refeshDnD |
refeshDnD()
|
Returns :
void
|
resetWidget |
resetWidget()
|
Returns :
any
|
selectedAssetById | ||||||||
selectedAssetById(identifier: , side: , assetRelationIdentifer: )
|
||||||||
Parameters :
Returns :
void
|
selectRowsBetweenIndexes | ||||||
selectRowsBetweenIndexes(assetRelation: , indexes: )
|
||||||
Parameters :
Returns :
void
|
setBoxWidth | ||||
setBoxWidth(index: )
|
||||
Parameters :
Returns :
string
|
sourceTableRowSelectChange | ||||
sourceTableRowSelectChange(event: )
|
||||
Parameters :
Returns :
void
|
targetTableRowSelectChange | ||||
targetTableRowSelectChange(event: )
|
||||
Parameters :
Returns :
void
|
toggleRow | ||||||
toggleRow(asset: , assetRelation: )
|
||||||
Parameters :
Returns :
void
|
trackByFn | ||||||
trackByFn(index: , item: )
|
||||||
Parameters :
Returns :
any
|
Public _dragAndDropService |
_dragAndDropService:
|
Type : DragAndDropService
|
Public _halService |
_halService:
|
Type : HalService
|
Public _id |
_id:
|
Type : string
|
Decorators : WidgetId
|
Public _notificationService |
_notificationService:
|
Type : CustomNotificationService
|
Public _sourceAttributeService |
_sourceAttributeService:
|
Type : EditAttributeService
|
Public _targetAttributeService |
_targetAttributeService:
|
Type : EditAttributeService
|
Public _widgetframeService |
_widgetframeService:
|
Type : WidgetframeService
|
Public action |
action:
|
Default value : new Subject<any>()
|
Decorators : WidgetOutput
|
Public assetRows |
assetRows:
|
Type : any[]
|
Default value : []
|
Public assets |
assets:
|
Type : AssetContainer[]
|
Default value : []
|
Public attributes |
attributes:
|
Default value : <any>{}
|
Public boxWidth |
boxWidth:
|
Type : string
|
Public changedAssets |
changedAssets:
|
Type : AssetContainer[]
|
Default value : []
|
Public changedAttributes |
changedAttributes:
|
Type : any[]
|
Public changedAttributesOutput |
changedAttributesOutput:
|
Default value : new Subject<any>()
|
Decorators : WidgetOutput
|
Public clearChangedAttributes |
clearChangedAttributes:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public cols |
cols:
|
Type : any[]
|
Public configuration |
configuration:
|
Type : WidgetConfig
|
Decorators : WidgetConfiguration
|
Public ctrlIsPressed |
ctrlIsPressed:
|
Type : boolean
|
Public dialog |
dialog:
|
Type : MatDialog
|
Public editLayout |
editLayout:
|
Type : string
|
Public inputLink |
inputLink:
|
Type : string
|
Public lastSelectedAsset |
lastSelectedAsset:
|
Type : Asset
|
Public locale |
locale:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public productLevel |
productLevel:
|
Type : string
|
Default value : ""
|
Public productNo |
productNo:
|
Public productNoForEdit |
productNoForEdit:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public resetSourceItemAttributes |
resetSourceItemAttributes:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public resetTargetItemAttributes |
resetTargetItemAttributes:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public resetWidgets |
resetWidgets:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public selectedAssets |
selectedAssets:
|
Type : any[]
|
Public selectedDataLocaleString |
selectedDataLocaleString:
|
Public selectedGroupByItemSource |
selectedGroupByItemSource:
|
Default value : new ReplaySubject<any>()
|
Decorators : WidgetInput
|
Public selectedGroupByItemSourceValue |
selectedGroupByItemSourceValue:
|
Type : string
|
Public selectedGroupByItemTarget |
selectedGroupByItemTarget:
|
Default value : new ReplaySubject<any>()
|
Decorators : WidgetInput
|
Public selectedGroupByItemTargetValue |
selectedGroupByItemTargetValue:
|
Type : string
|
Public selectedLocaleProductSource |
selectedLocaleProductSource:
|
Default value : new ReplaySubject<any>()
|
Decorators : WidgetInput
|
Public selectedLocaleProductTarget |
selectedLocaleProductTarget:
|
Default value : new ReplaySubject<any>()
|
Decorators : WidgetInput
|
Public selectedRowsSource |
selectedRowsSource:
|
Type : any[]
|
Default value : []
|
Public selectedRowsTarget |
selectedRowsTarget:
|
Type : any[]
|
Default value : []
|
Public selectedUiLocale |
selectedUiLocale:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public selectedUiLocaleValue |
selectedUiLocaleValue:
|
Type : string
|
Public shiftIsPressed |
shiftIsPressed:
|
Type : boolean
|
Public sourceAssetOriginales |
sourceAssetOriginales:
|
Type : AssetContainer[]
|
Default value : []
|
Public sourceAssets |
sourceAssets:
|
Type : AssetContainer[]
|
Default value : []
|
Public sourceItems |
sourceItems:
|
Type : any[]
|
Public sourceItemsGroupedby |
sourceItemsGroupedby:
|
Type : any[]
|
Public sourceuri |
sourceuri:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public sub |
sub:
|
Public targetAssets |
targetAssets:
|
Type : AssetContainer[]
|
Default value : []
|
Public targetItems |
targetItems:
|
Type : any[]
|
Public targetItemsGroupedby |
targetItemsGroupedby:
|
Type : any[]
|
Public targetsInput |
targetsInput:
|
Type : []
|
Default value : []
|
Public targeturi |
targeturi:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
Public unsubscribe |
unsubscribe:
|
Default value : NgUnsubscribe.create()
|
Public widgetLocale |
widgetLocale:
|
Default value : new Subject<any>()
|
Decorators : WidgetInput
|
import {
combineLatest as observableCombineLatest,
Subject,
ReplaySubject,
Observable,
} from "rxjs";
import { mergeMap, onErrorResumeNext, takeUntil } from "rxjs/operators";
import {
Component,
OnDestroy,
ChangeDetectionStrategy,
ChangeDetectorRef,
NgZone,
} from "@angular/core";
import { TranslateService } from "@ngx-translate/core";
import { WidgetframeService } from "../../../widgetframe/widgetframe.service";
import { WidgetConfig } from "../../../widget.configuration";
import {
WidgetComponent,
WidgetId,
WidgetConfiguration,
WidgetConfigure,
WidgetInput,
WidgetOutput,
} from "../../../widget.metadata";
import { NgUnsubscribe } from "../../../../ng-unsubscribe";
import * as uriTemplates_ from "uri-templates";
const uriTemplates = uriTemplates_;
import { Attribute } from "../../../../components/edit-attribute/attribute";
import { EditAttributeService } from "../../../../components/edit-attribute/edit-attribute.service";
import { HalService } from "../../../../components/hal/index";
import { CustomNotificationService } from "../../../../components/notification/customnotification.service";
import { Asset, AssetContainer } from "../../../../components/image/index";
import { DragAndDropService } from "../../../../components/util/drag-and-drop.service";
import { MatDialog } from "@angular/material/dialog";
import { CopyAssetsPopupComponent } from "./copy-assets-popup.component";
declare var jQuery: any;
/**
* Used in App myClientCopy.
* Surrounded by widgetframe
*
*/
@WidgetComponent("nm-copy-item-attributes")
@Component({
selector: "nm-copy-item-attributes",
templateUrl: "./copy-item-attributes.component.html",
styleUrls: ["./copy-item-attributes.component.scss"],
providers: [EditAttributeService],
host: {
"(window:keydown)": "keydown($event)",
"(window:keyup)": "keyup($event)",
},
})
export class CopyItemAttributesWidgetComponent implements OnDestroy {
public cols: any[];
public attributes = <any>{};
public selectedRowsTarget: any[] = [];
public selectedRowsSource: any[] = [];
public targetItems: any[];
public sourceItems: any[];
public targetItemsGroupedby: any[];
public sourceItemsGroupedby: any[];
public selectedGroupByItemSourceValue: string;
public selectedGroupByItemTargetValue: string;
public shiftIsPressed: boolean;
public ctrlIsPressed: boolean;
public changedAttributes: any[];
public inputLink: string;
@WidgetConfiguration()
public configuration: WidgetConfig;
@WidgetInput()
public productNoForEdit = new Subject<any>();
@WidgetInput()
public selectedUiLocale = new Subject<any>();
@WidgetInput()
public selectedLocaleProductSource = new ReplaySubject<any>();
@WidgetInput()
public selectedLocaleProductTarget = new ReplaySubject<any>();
@WidgetInput()
public selectedGroupByItemSource = new ReplaySubject<any>();
@WidgetInput()
public selectedGroupByItemTarget = new ReplaySubject<any>();
@WidgetOutput("changedAttributesOutput")
public changedAttributesOutput = new Subject<any>();
@WidgetOutput("action")
public action = new Subject<any>();
@WidgetInput()
public widgetLocale = new Subject<any>();
@WidgetInput()
public locale = new Subject<any>();
@WidgetInput()
public resetWidgets = new Subject<any>();
@WidgetInput()
public targeturi = new Subject<any>();
@WidgetInput()
public sourceuri = new Subject<any>();
@WidgetInput()
public resetTargetItemAttributes = new Subject<any>();
@WidgetInput()
public resetSourceItemAttributes = new Subject<any>();
@WidgetInput()
public clearChangedAttributes = new Subject<any>();
@WidgetId()
public _id: string;
public unsubscribe = NgUnsubscribe.create();
public sub;
public editLayout: string;
public boxWidth: string;
public productNo;
public selectedDataLocaleString;
public productLevel: string = "";
public targetsInput = [];
public selectedUiLocaleValue: string;
public assets: AssetContainer[] = [];
public sourceAssets: AssetContainer[] = [];
public sourceAssetOriginales: AssetContainer[] = [];
public targetAssets: AssetContainer[] = [];
public changedAssets: AssetContainer[] = [];
public lastSelectedAsset: Asset;
public selectedAssets: any[];
public assetRows: any[] = [];
constructor(
public _widgetframeService: WidgetframeService,
public _sourceAttributeService: EditAttributeService,
public _targetAttributeService: EditAttributeService,
public _halService: HalService,
public _notificationService: CustomNotificationService,
public _dragAndDropService: DragAndDropService,
private zone: NgZone,
private translateService: TranslateService,
public dialog: MatDialog
) {
this.cols = [
{
field: "Std_EAN",
header: "app.ipim-my-client-copy.placeholder.EAN",
sortable: true,
filter: true,
},
{
field: "itemNo",
header: "app.ipim-my-client-copy.placeholder.ItemNumber",
sortable: true,
filter: true,
},
{
field: "dim_FARBE",
header: "app.ipim-my-client-copy.placeholder.Color",
sortable: true,
filter: true,
},
{
field: "dim_GROESSE",
header: "app.ipim-my-client-copy.placeholder.Size",
sortable: true,
filter: true,
},
{
field: "image",
header: "app.ipim-my-client-copy.placeholder.Image",
sortable: true,
filter: true,
},
{
field: "manufacturerImage",
header: "app.ipim-my-client-copy.placeholder.ManufacturerImage",
sortable: true,
filter: true,
},
{
field: "searchcolor",
header: "app.ipim-my-client-copy.placeholder.Searchcolor",
sortable: true,
filter: true,
},
];
}
addAssetRelationToChangedAssets(assetRelation, selectedRow) {
let tempSelectedRow = jQuery.extend(true, {}, selectedRow);
for (let targetIdentifer of selectedRow["targets"]) {
let matchedAttribute = this.targetItems.filter(
(attribute) => attribute.itemNo == targetIdentifer
);
if (matchedAttribute.length > 0) {
for (
let index = 0;
index < matchedAttribute[0]["_embedded"]["assets"].length;
index++
) {
if (
matchedAttribute[0]["_embedded"]["assets"][index].identifier ==
assetRelation.identifier
) {
matchedAttribute[0]["_embedded"]["assets"][index] = jQuery.extend(
true,
{},
assetRelation
);
}
}
}
}
for (let targetIdentifer of selectedRow["targets"]) {
let matchedAttribute = this.changedAttributes.filter(
(attribute) => attribute.targets[0].identifier == targetIdentifer
);
if (matchedAttribute.length > 0) {
for (let i = 0; i < matchedAttribute[0]["values"].length; i++) {
for (
let j = 0;
j < matchedAttribute[0]["values"][i]["_embedded"]["assets"].length;
j++
) {
if (
matchedAttribute[0]["values"][i]["_embedded"]["assets"][j]
.identifier == assetRelation.identifier
) {
matchedAttribute[0]["values"][i]["_embedded"]["assets"][
j
] = jQuery.extend(true, {}, assetRelation);
}
}
}
} else {
assetRelation["assets"] = [];
assetRelation["assets"] = jQuery.extend(
true,
[],
assetRelation["_embedded"]["assets"]
);
let payload = {};
let target = {};
target["level"] = "item";
target["identifier"] = targetIdentifer;
payload["targets"] = [];
payload["targets"].push(target);
payload["locale"] = this.selectedUiLocaleValue;
payload["values"] = [];
payload["values"].push(assetRelation);
this.changedAttributes.push(payload);
}
}
this.targetItemsGroupedby = this.groupItems(
this.targetItems,
this.selectedGroupByItemTargetValue
);
this.changedAttributesOutput.next(this.changedAttributes);
}
@WidgetConfigure()
protected configureWidget(configuration: WidgetConfig) {
this.changedAttributes = [];
this.sourceuri.subscribe((data) => {
console.log("ITEMS", data);
});
this.resetTargetItemAttributes
.pipe(takeUntil(this.unsubscribe))
.subscribe((resetTargetItemAttributes) => {
this.selectedRowsTarget = [];
this.targetItems = [];
this.targetItemsGroupedby = [];
this.changedAttributes = [];
});
this.resetSourceItemAttributes
.pipe(takeUntil(this.unsubscribe))
.subscribe((resetSourceItemAttributes) => {
this.selectedRowsSource = [];
this.sourceItems = [];
this.sourceItemsGroupedby = [];
});
this.clearChangedAttributes
.pipe(takeUntil(this.unsubscribe))
.subscribe((clearChangedAttributes) => {
console.log("CLEAR changedAttributes", this.changedAttributes);
this.changedAttributes = [];
// this.changedAttributesOutput.next(this.changedAttributes);
});
this._sourceAttributeService
.getCopyAttributeEvent()
.pipe(takeUntil(this.unsubscribe))
.subscribe((attribute) => {
let temptargetItem = jQuery.extend(true, {}, this.selectedRowsTarget);
for (let targetIdentifer of temptargetItem["targets"]) {
let matchedAttribute = this.targetItems.filter(
(attribute) => attribute.itemNo == targetIdentifer
);
if (matchedAttribute.length > 0) {
matchedAttribute[0].attributes.default[1].source = jQuery.extend(
true,
[],
attribute.source
);
matchedAttribute[0]["searchcolor"] = attribute.source[0].value;
this._targetAttributeService.setTriggerSourceRefreshEvent(
matchedAttribute[0].attributes.default[1]
);
}
}
for (let targetIdentifer of temptargetItem["targets"]) {
let matchedAttribute = this.changedAttributes.filter(
(attribute) => attribute.targets[0].identifier == targetIdentifer
);
if (matchedAttribute.length > 0) {
let valueFound: boolean = false;
for (let k = 0; k < matchedAttribute[0].values.length; k++) {
if (
matchedAttribute[0].values[k].identifier ===
attribute.identifier
) {
matchedAttribute[0].values[k] == attribute;
valueFound = true;
}
}
if (!valueFound) {
matchedAttribute[0].values.push(attribute);
}
temptargetItem["targets"].splice(
temptargetItem["targets"].indexOf(targetIdentifer),
1
);
} else {
let payload = {};
let target = {};
target["level"] = "item";
target["identifier"] = targetIdentifer;
payload["targets"] = [];
payload["targets"].push(target);
payload["locale"] = this.selectedUiLocaleValue;
payload["values"] = [];
payload["values"].push(attribute);
this.changedAttributes.push(payload);
}
}
this.targetItemsGroupedby = this.groupItems(
this.targetItems,
this.selectedGroupByItemTargetValue
);
this.changedAttributesOutput.next(this.changedAttributes);
});
this.selectedUiLocale
.pipe(takeUntil(this.unsubscribe))
.subscribe((selectedUiLocale) => {
this.selectedUiLocaleValue = selectedUiLocale;
});
this._targetAttributeService
.getAttributeChangedEvent()
.pipe(takeUntil(this.unsubscribe))
.subscribe((attribute) => {
let temptargetItem = jQuery.extend(true, {}, this.selectedRowsTarget);
for (let targetIdentifer of temptargetItem["targets"]) {
let matchedAttribute = this.targetItems.filter(
(attribute) => attribute.itemNo == targetIdentifer
);
if (matchedAttribute.length > 0) {
matchedAttribute[0].attributes.default[1].source = jQuery.extend(
true,
[],
attribute.source
);
matchedAttribute[0]["searchcolor"] = attribute.source[0].value;
// this._targetAttributeService.setTriggerSourceRefreshEvent(matchedAttribute[0].attributes.default[1]);
}
}
for (let targetIdentifer of temptargetItem["targets"]) {
let matchedAttribute = this.changedAttributes.filter(
(attribute) => attribute.targets[0].identifier == targetIdentifer
);
if (matchedAttribute.length > 0) {
let valueFound: boolean = false;
for (let k = 0; k < matchedAttribute[0].values.length; k++) {
if (
matchedAttribute[0].values[k].identifier ===
attribute.identifier
) {
matchedAttribute[0].values[k] == attribute;
valueFound = true;
}
}
if (!valueFound) {
matchedAttribute[0].values.push(attribute);
}
temptargetItem["targets"].splice(
temptargetItem["targets"].indexOf(targetIdentifer),
1
);
} else {
let payload = {};
let target = {};
target["level"] = "item";
target["identifier"] = targetIdentifer;
payload["targets"] = [];
payload["targets"].push(target);
payload["locale"] = this.selectedUiLocaleValue;
payload["values"] = [];
payload["values"].push(attribute);
this.changedAttributes.push(payload);
}
}
this.targetItemsGroupedby = this.groupItems(
this.targetItems,
this.selectedGroupByItemTargetValue
);
this.changedAttributesOutput.next(this.changedAttributes);
});
var sourceObservable = observableCombineLatest(
this.sourceuri.asObservable(),
function (uri) {
let template = uriTemplates(uri);
let uriParams = {};
uriParams["context"] = "my-clientCopy";
return template.fill(uriParams);
}
).pipe(
takeUntil(this.unsubscribe),
mergeMap((href) =>
this._widgetframeService
.getData(href)
.pipe(onErrorResumeNext(this.resetWidget()))
)
);
sourceObservable.pipe(takeUntil(this.unsubscribe)).subscribe(
(data) => {
let tempitems: any[] = data["_embedded"]["items"];
for (var item of tempitems) {
if (item.attributes.default !== undefined) {
for (var attribute of item.attributes.default) {
item[attribute.identifier] = attribute.value;
}
}
if (item.attributes.dimensions !== undefined) {
for (var attribute of item.attributes.dimensions) {
item[attribute.identifier] = attribute.value;
}
}
if (item["_embedded"] != undefined) {
for (let assetRelation of item["_embedded"]["assets"]) {
if (assetRelation._embedded === undefined) {
assetRelation._embedded = {};
assetRelation._embedded.assets = [];
}
assetRelation._embedded.assets.sort(function (a, b) {
return a["sequence"] - b["sequence"];
});
for (let asset of assetRelation._embedded.assets) {
asset["assetRelationIdentifier"] = assetRelation.identifier;
}
}
}
}
this.sourceItems = jQuery.extend(true, [], tempitems);
this.sourceItemsGroupedby = jQuery.extend(true, [], tempitems);
this.selectedGroupByItemSource.subscribe(
(selectedGroupByItemSource) => {
if (this.sourceItems.length > 0) {
this.selectedGroupByItemSourceValue = selectedGroupByItemSource;
this.sourceItemsGroupedby = this.groupItems(
this.sourceItems,
selectedGroupByItemSource
);
}
}
);
},
(error) => {
console.log(error);
}
);
var targetObservable = observableCombineLatest(
this.targeturi.asObservable(),
function (uri) {
let template = uriTemplates(uri);
let uriParams = {};
uriParams["context"] = "my-clientCopy";
return template.fill(uriParams);
}
).pipe(
takeUntil(this.unsubscribe),
mergeMap((href) =>
this._widgetframeService
.getData(href)
.pipe(onErrorResumeNext(this.resetWidget()))
)
);
targetObservable.subscribe(
(data) => {
let tempitems: any[] = data["_embedded"]["items"];
for (var item of tempitems) {
if (item.attributes.default !== undefined) {
for (var attribute of item.attributes.default) {
item[attribute.identifier] = attribute.value;
}
}
if (item.attributes.dimensions !== undefined) {
for (var attribute of item.attributes.dimensions) {
item[attribute.identifier] = attribute.value;
}
}
if (item["_embedded"] != undefined) {
for (let assetRelation of item["_embedded"]["assets"]) {
if (assetRelation._embedded === undefined) {
assetRelation._embedded = {};
assetRelation._embedded.assets = [];
}
assetRelation._embedded.assets.sort(function (a, b) {
return a["sequence"] - b["sequence"];
});
for (let asset of assetRelation._embedded.assets) {
asset["assetRelationIdentifier"] = assetRelation.identifier;
}
}
}
}
this.targetItems = jQuery.extend(true, [], tempitems);
this.targetItemsGroupedby = jQuery.extend(true, [], tempitems);
this.selectedGroupByItemTarget.subscribe(
(selectedGroupByItemTarget) => {
if (this.targetItems.length > 0) {
this.selectedGroupByItemTargetValue = selectedGroupByItemTarget;
this.targetItemsGroupedby = this.groupItems(
this.targetItems,
this.selectedGroupByItemTargetValue
);
}
}
);
},
(error) => {
console.log(error);
}
);
}
hashCode(str) {
var hash = 0;
if (str.length == 0) return hash;
for (let i = 0; i < str.length; i++) {
let char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash; // Convert to 32bit integer
}
return hash.toString();
}
groupItems(items, selectedGroupByItemAttribute: any) {
let self = this;
let tempgroupedbyItems = [];
if (
selectedGroupByItemAttribute === "notGrouped" ||
selectedGroupByItemAttribute === "Std_EAN" ||
selectedGroupByItemAttribute === "ItemNo"
) {
for (let item of items) {
item["targets"] = [];
item["targets"].push(item["itemNo"]);
if (item["attributes"] && item["attributes"].default) {
for (let attribute of item["attributes"].default) {
if (attribute.identifier === "searchcolor") {
attribute.targets = [];
attribute.targets.push(item["itemNo"]);
}
}
}
}
this.clearAllSelections();
return items;
}
let targetItemsToDisplay = {};
if (
selectedGroupByItemAttribute === "manufacturerImage" ||
selectedGroupByItemAttribute === "image"
) {
targetItemsToDisplay = items.reduce(function (r, a) {
for (const assetRelaion of a._embedded.assets) {
if (assetRelaion.identifier == selectedGroupByItemAttribute) {
if (
r[self.hashCode(JSON.stringify(assetRelaion._embedded.assets))] ==
undefined
) {
r[
self.hashCode(JSON.stringify(assetRelaion._embedded.assets))
] = [];
}
r[
self.hashCode(JSON.stringify(assetRelaion._embedded.assets))
].push(a);
}
}
return r;
}, Object.create(null));
} else {
targetItemsToDisplay = items.reduce(function (r, a) {
r[a[selectedGroupByItemAttribute]] =
r[a[selectedGroupByItemAttribute]] || [];
r[a[selectedGroupByItemAttribute]].push(a);
return r;
}, Object.create(null));
}
for (var groupedByValue in targetItemsToDisplay) {
let groupedItem = {};
groupedItem["tooltips"] = {};
// init all properties... muss das sein ?!
for (let item of targetItemsToDisplay[groupedByValue]) {
for (const attributeKey in item) {
if (item.hasOwnProperty(attributeKey)) {
groupedItem[attributeKey] = "";
groupedItem["tooltips"][attributeKey] = "";
}
}
}
groupedItem["targets"] = [];
// for (let item of targetItemsToDisplay[groupedByValue]) {
for (
let index = 0;
index < targetItemsToDisplay[groupedByValue].length;
index++
) {
if (index === 0) {
groupedItem["attributes"] =
targetItemsToDisplay[groupedByValue][index]["attributes"];
for (let attribute of groupedItem["attributes"].default) {
if (attribute.identifier === "searchcolor") {
attribute.targets = [];
}
}
groupedItem["_embedded"] =
targetItemsToDisplay[groupedByValue][index]["_embedded"];
}
for (const attributeKey in targetItemsToDisplay[groupedByValue][
index
]) {
if (
targetItemsToDisplay[groupedByValue][index].hasOwnProperty(
attributeKey
)
) {
if (
targetItemsToDisplay[groupedByValue][index][attributeKey] !=
undefined
) {
if (attributeKey == "itemNo") {
groupedItem["targets"].push(
targetItemsToDisplay[groupedByValue][index][attributeKey]
);
for (let attribute of groupedItem["attributes"].default) {
if (attribute.identifier === "searchcolor") {
attribute.targets.push(
targetItemsToDisplay[groupedByValue][index][attributeKey]
);
}
}
}
if (
typeof targetItemsToDisplay[groupedByValue][index][
attributeKey
] === "string" ||
targetItemsToDisplay[groupedByValue][index][
attributeKey
] instanceof String
) {
groupedItem["tooltips"][attributeKey] += targetItemsToDisplay[
groupedByValue
][index][attributeKey].trim();
if (index === 0) {
groupedItem[attributeKey] = targetItemsToDisplay[
groupedByValue
][index][attributeKey].trim();
}
if (index < targetItemsToDisplay[groupedByValue].length - 1) {
groupedItem["tooltips"][attributeKey] += ", ";
}
}
}
}
}
groupedItem[selectedGroupByItemAttribute] = groupedByValue;
}
tempgroupedbyItems.push(groupedItem);
}
this.clearAllSelections();
return tempgroupedbyItems;
}
resetWidget() {
return null;
}
ngOnDestroy() {
this.unsubscribe.destroy();
}
setBoxWidth(index) {
return 98 / index + "%";
}
imageClick(index, asset, assetRelation) {
if (this.ctrlIsPressed) {
this.toggleRow(asset, assetRelation);
}
if (this.shiftIsPressed) {
this.selectRowsBetweenIndexes(assetRelation, [
assetRelation._embedded["assets"].indexOf(this.lastSelectedAsset),
index,
]);
}
if (!this.ctrlIsPressed && !this.shiftIsPressed) {
//this.clearAllSelections();
this.toggleRow(asset, assetRelation);
}
}
selectedAssetById(identifier, side, assetRelationIdentifer) {
console.log("select", identifier, side, assetRelationIdentifer);
this.clearAllSelections();
if (
side === "sourceAssetRelation" &&
this.sourceItemsGroupedby.length > 0
) {
for (let item of this.sourceItemsGroupedby) {
if (this.selectedRowsSource[0]["itemNo"] === item.itemNo) {
for (let assetRelation of item._embedded.assets) {
for (let asset of assetRelation._embedded.assets) {
if (asset.title === identifier) {
asset["selected"] = true;
this.selectedAssets.push(asset);
}
}
}
}
}
}
if (
side === "targetAssetRelation" &&
this.targetItemsGroupedby.length > 0
) {
for (let item of this.targetItemsGroupedby) {
if (this.selectedRowsTarget["itemNo"] === item.itemNo) {
for (let assetRelation of item._embedded.assets) {
for (let asset of assetRelation._embedded.assets) {
if (asset.title === identifier) {
asset["selected"] = true;
this.selectedAssets.push(asset);
}
}
}
}
}
}
}
clearAllSelections() {
this.selectedAssets = [];
if (this.targetItemsGroupedby) {
if (this.targetItemsGroupedby.length > 0) {
for (let item of this.targetItemsGroupedby) {
if (item._embedded && item._embedded.assets) {
for (let assetRelation of item._embedded.assets) {
if (assetRelation._embedded && assetRelation._embedded.assets) {
for (let asset of assetRelation._embedded.assets) {
asset["selected"] = false;
}
}
}
}
}
}
}
if (this.sourceItemsGroupedby) {
if (this.sourceItemsGroupedby.length > 0) {
for (let item of this.sourceItemsGroupedby) {
if (item._embedded && item._embedded.assets) {
for (let assetRelation of item._embedded.assets) {
if (assetRelation._embedded && assetRelation._embedded.assets) {
for (let asset of assetRelation._embedded.assets) {
asset["selected"] = false;
}
}
}
}
}
}
}
}
selectRowsBetweenIndexes(assetRelation, indexes) {
indexes.sort(function (a, b) {
return a - b;
});
for (var i = indexes[0]; i <= indexes[1]; i++) {
assetRelation._embedded["assets"][i]["selected"] = true;
}
this.selectedAssets = assetRelation._embedded["assets"].filter(
(row) => row["selected"] == true
);
}
toggleRow(asset, assetRelation) {
asset["selected"] = !asset["selected"];
this.selectedAssets = assetRelation._embedded["assets"].filter(
(row) => row["selected"] == true
);
console.log(
" this.selectedAssets in toggle",
asset,
assetRelation,
this.selectedAssets
);
this.lastSelectedAsset = asset;
//this._changeDetectorRef.markForCheck();
}
keydown(event: any) {
if (event.keyCode === 16) {
this.shiftIsPressed = true;
}
if (event.keyCode === 17) {
this.ctrlIsPressed = true;
}
}
keyup(event: any) {
if (event.keyCode === 16) {
this.shiftIsPressed = false;
}
if (event.keyCode === 17) {
this.ctrlIsPressed = false;
}
}
copyAssets(assetRelation) {
assetRelation["replaced"] = true;
this.addAssetRelationToChangedAssets(
assetRelation,
this.selectedRowsTarget
);
}
editAssets() {
let dialogRef = this.dialog.open(CopyAssetsPopupComponent, {
// width: '250px',
data: {
selectedRowsSource: this.selectedRowsSource,
selectedRowsTarget: this.selectedRowsTarget,
},
});
dialogRef.afterClosed().subscribe((assetrelations) => {
if (assetrelations) {
for (const assetrelation of assetrelations) {
this.addAssetRelationToChangedAssets(
assetrelation,
this.selectedRowsTarget
);
}
}
});
}
refeshDnD(): void {
let self = this;
this.zone.runOutsideAngular(() => {
setTimeout(() => {
let sourcecontainer = jQuery("ul.source-asset-column > li");
let targetcontainer = jQuery("ul.target-asset-column");
jQuery(targetcontainer).sortable({
revert: false,
tolerance: "touch",
placeholder: "ui-state-asset-placeholder",
cursor: "grabbing",
delay: 50,
scroll: true,
scrollSensitivity: 80,
scrollSpeed: 3,
containment: "document",
// refreshPositions: true,
helper: function (e, item) {
let selected = jQuery(this)
.closest("ul.target-asset-column")
.find(".ui-state-selected");
if (selected.length === 0) {
self.selectedAssetById(
item.context.id,
"targetAssetRelation",
jQuery(this).data("ari")
);
selected = item;
}
var container = jQuery("<div/>").attr(
"id",
"draggingContainerImage"
);
container.append(selected.clone());
item.siblings(".ui-state-selected").addClass("hidden");
return container;
},
start: function (event, ui) {
console.log("this.selectedAssets in start", self.selectedAssets);
var elements = ui.item
.siblings(".selected.hidden")
.not(".ui-sortable-placeholder");
self._dragAndDropService.registerDrag(
"target-item-assets",
jQuery.extend(true, [], self.selectedAssets)
);
},
over: function (event, ui) {
console.log("over", event, ui);
jQuery(event.target).addClass("nm-small-drop-target");
},
out: function (event, ui) {
console.log("out", event, ui);
jQuery(event.target).removeClass("nm-small-drop-target");
},
stop: function (e, ui) {
let dragged = self._dragAndDropService.completeDrag();
let draggedAssets = <Asset[]>dragged.data;
if (!dragged) {
return;
}
if (draggedAssets[0] === undefined) {
return;
}
let prev = jQuery(ui.item[0]).prev();
var prevId = null;
if (prev.length > 0) {
prevId = jQuery(prev[0]).attr("id").trim();
}
ui.placeholder.remove();
if (ui.helper) {
ui.helper.remove();
}
if (ui.item && dragged) {
ui.item.remove();
}
ui.item.siblings(".hidden").remove();
let assetRelationIdentifier =
draggedAssets[0]["assetRelationIdentifier"];
let titles: Set<string> = new Set<string>(
draggedAssets.map((item) => item.title)
);
for (let assetRelation of self.selectedRowsTarget["_embedded"][
"assets"
]) {
if (assetRelation.identifier === assetRelationIdentifier) {
//let result = Object.assign({}, assetRelation);
let assets = assetRelation._embedded["assets"].filter(
(item) => !titles.has(item.title)
);
let assetCount = assets.length;
if (
assetCount < assetRelation._embedded["assets"].length &&
dragged.source === "source-item-assets"
) {
self._notificationService.create(
self.translateService.instant(
"app.ipim-my-client-copy.asset-already-available.title"
),
self.translateService.instant(
"app.ipim-my-client-copy.asset-already-available.message"
),
"ERROR"
);
}
let index = !!prevId
? assets.findIndex((item) => item.title == prevId) + 1
: 0;
assets.splice(index, 0, ...draggedAssets);
assetRelation._embedded["assets"] = assets;
/*
if (assetRelation._embedded["assets"].length === 0) {
assets.splice(index, 0, ...draggedAssets);
}
*/
console.log("stop", assetRelation, self.selectedRowsTarget);
self.addAssetRelationToChangedAssets(
assetRelation,
self.selectedRowsTarget
);
}
}
jQuery(".nm-attribute-list-asset.hidden").remove();
jQuery(targetcontainer).sortable("refresh");
jQuery(targetcontainer).sortable("refreshPositions");
jQuery(prev[0]).click();
jQuery("li").each(function () {
jQuery(this).removeClass("ui-state-selected");
});
self.zone.run(() => {
//self._changeDetectorRef.markForCheck();
});
},
});
let selected;
jQuery(sourcecontainer).draggable({
connectToSortable: ".ui-state-highlight ul.target-asset-column",
scroll: true,
scrollSensitivity: 80,
scrollSpeed: 3,
containment: "document",
helper: function (e) {
if (
jQuery(this)
.closest("ul.source-asset-column")
.find(".ui-state-selected").length === 0
) {
self.selectedAssetById(
e["currentTarget"]["id"],
"sourceAssetRelation",
jQuery(this).data("ari")
);
}
selected = jQuery(this)
.closest("ul.source-asset-column")
.find(".ui-state-selected");
if (selected.length === 0) {
selected = jQuery(this);
}
var container = jQuery("<div/>").attr(
"id",
"draggingContainerImage"
);
container.append(selected.clone());
return container;
},
revert: "invalid",
tolerance: "touch",
start: function (event, ui) {
self._dragAndDropService.registerDrag(
"source-item-assets",
jQuery.extend(true, [], self.selectedAssets)
);
},
});
// jQuery(sourcecontainer).draggable('instance').scssPosition = 'absolute';
jQuery("ul, li").disableSelection();
this.lastSelectedAsset = null;
// this.selectedAssets = [];
}, 1);
});
// this._changeDetectorRef.markForCheck();
}
targetTableRowSelectChange(event) {
if (this.targetItemsGroupedby.length > 0) {
for (let item of this.targetItemsGroupedby) {
if (item._embedded && item._embedded.assets) {
for (let assetRelation of item._embedded.assets) {
if (assetRelation._embedded.assets) {
for (let asset of assetRelation._embedded.assets) {
asset["selected"] = false;
}
}
}
}
}
}
// this.refeshDnD();
}
sourceTableRowSelectChange(event) {
if (this.sourceItemsGroupedby) {
if (this.sourceItemsGroupedby.length > 0) {
for (let item of this.sourceItemsGroupedby) {
if (item._embedded && item._embedded.assets) {
for (let assetRelation of item._embedded.assets) {
if (assetRelation._embedded.assets) {
for (let asset of assetRelation._embedded.assets) {
asset["selected"] = false;
}
}
}
}
}
}
}
// this.refeshDnD();
}
delteAssets(assetRelation) {
assetRelation._embedded.assets = [];
assetRelation["replaced"] = true;
this.addAssetRelationToChangedAssets(
assetRelation,
this.selectedRowsTarget
);
}
trackByFn(index, item) {
return item.itemNo; // or item.id
}
}
<div slot="content" class="nm-widgetframe__content">
<div class="nm-attribute-list">
<!-- [trackBy]="trackByFn"-->
<div class="nm-attribute-list-elements">
<div class="nm-attribute-list-value source-table">
<p-dataTable
[value]="sourceItemsGroupedby"
emptyMessage=""
[paginator]="true"
[rows]="10"
[scrollable]="false"
[pageLinks]="3"
selectionMode="multiple"
#dtSourceItems
(onRowSelect)="sourceTableRowSelectChange($event)"
[(selection)]="selectedRowsSource"
[rowTrackBy]="trackByFn"
>
<p-column
*ngFor="let col of cols"
[sortable]="col.sortable"
[styleClass]="
col.field == selectedGroupByItemSourceValue ? 'highlight' : ''
"
[filter]="col.sortable"
[field]="col.field"
filterMatchMode="contains"
[header]="col.header | translate"
>
<ng-template pTemplate="filter" let-col *ngIf="col.filter">
<mat-form-field>
<input
matInput
placeholder="{{ col.header }}"
type="text"
pInputText
class="ui-column-filter"
*ngIf="col.filter == true"
(click)="dtSourceItems.onFilterInputClick($event)"
(input)="
dtSourceItems.onFilterKeyup(
$event.target.value,
col.field,
col.filterMatchMode
)
"
/>
</mat-form-field>
</ng-template>
<ng-template pTemplate="filter" let-col *ngIf="!col.filter">
<span class="nm-column-title">{{ col.header }}</span>
</ng-template>
<ng-template let-col let-results="rowData" pTemplate type="body">
<div style="width: 100%">
<div [ngSwitch]="col.field">
<span *ngSwitchCase="'image'">
<span
*ngFor="let assetRelation of results?._embedded?.assets"
>
<ul
class="source-asset-column"
*ngIf="assetRelation.identifier == col.field"
[attr.data-ari]="assetRelation?.identifier"
>
<li
*ngFor="
let asset of assetRelation?._embedded.assets;
let k = index
"
[attr.data-ari]="assetRelation?.identifier"
[attr.id]="asset.title"
class="nm-attribute-list-asset"
(click)="imageClick(k, asset, assetRelation)"
[class.ui-state-selected]="asset.selected === true"
>
<nm-image
[assetObj]="asset"
size="thumbnail"
width="auto"
height="auto"
max-width="25px"
max-height="25px"
></nm-image>
</li>
</ul>
<button
class="nm-attribute-action-button"
*ngIf="
assetRelation.identifier == col.field &&
assetRelation?._embedded?.assets.length > 0
"
mat-icon-button
(click)="copyAssets(assetRelation)"
>
<mat-icon color="primary">content_copy</mat-icon>
</button>
</span>
</span>
<span *ngSwitchCase="'manufacturerImage'">
<span
*ngFor="let assetRelation of results?._embedded?.assets"
>
<ul
class="source-asset-column"
*ngIf="assetRelation.identifier == col.field"
[attr.data-ari]="assetRelation?.identifier"
>
<li
*ngFor="
let asset of assetRelation?._embedded.assets;
let k = index
"
[attr.data-ari]="assetRelation?.identifier"
[attr.id]="asset.title"
class="nm-attribute-list-asset"
(click)="imageClick(k, asset, assetRelation)"
[class.ui-state-selected]="asset.selected === true"
>
<nm-image
[assetObj]="asset"
size="thumbnail"
width="auto"
height="auto"
max-width="25px"
max-height="25px"
></nm-image>
</li>
</ul>
<button
class="nm-attribute-action-button copy-manufacturerImage"
*ngIf="
assetRelation.identifier == col.field &&
assetRelation?._embedded?.assets.length > 0
"
mat-icon-button
(click)="copyAssets(assetRelation)"
>
<mat-icon color="primary">content_copy</mat-icon>
</button>
</span>
</span>
<span *ngSwitchCase="'identifier'">
{{ results[col.field] }}
</span>
<span *ngSwitchCase="'searchcolor'" class="searchclolor">
<div
*ngIf="
results['attributes'] &&
results['attributes']['default'] &&
results['attributes']['default'][1] != undefined
"
>
<div
*ngIf="
results['tooltips'] != undefined &&
col.field != selectedGroupByItemSourceValue;
then withtooltips;
else notooltips
"
></div>
<ng-template #withtooltips>
<span
popover="{{ results['tooltips'][col.field] }}"
placement="top"
container="body"
triggers="mouseenter:mouseleave"
>
<span
*ngFor="
let attribute of results['attributes']['default']
"
>
<nm-edit-attribute
*ngIf="attribute.identifier === 'searchcolor'"
[readOnly]="true"
[attribute]="attribute"
[loadOptionsLazy]="true"
[editLayout]="'list'"
[editAttributeService]="_sourceAttributeService"
[role]="'itemTarget'"
[addCopyButton]="true"
></nm-edit-attribute>
</span>
</span>
</ng-template>
<ng-template #notooltips>
<span
*ngFor="
let attribute of results['attributes']['default']
"
>
<nm-edit-attribute
*ngIf="attribute.identifier === 'searchcolor'"
[readOnly]="true"
[attribute]="attribute"
[loadOptionsLazy]="true"
[editLayout]="'list'"
[editAttributeService]="_sourceAttributeService"
[role]="'itemTarget'"
[addCopyButton]="true"
></nm-edit-attribute>
</span>
</ng-template>
</div>
</span>
<span *ngSwitchDefault class="nm-break">
<div
*ngIf="
results['tooltips'] != undefined &&
col.field != selectedGroupByItemSourceValue;
then withtooltips;
else notooltips
"
></div>
<ng-template #withtooltips>
<span
popover="{{ results['tooltips'][col.field] }}"
placement="top"
container="body"
triggers="mouseenter:mouseleave"
>
<nm-ellipsis
[disableTooltip]="true"
[content]="results[col.field]"
></nm-ellipsis>
</span>
</ng-template>
<ng-template #notooltips>
<nm-ellipsis [content]="results[col.field]"></nm-ellipsis>
</ng-template>
</span>
</div>
</div>
</ng-template>
</p-column>
<footer>
<div class="ui-helper-clearfix" style="width: 100%"></div>
</footer>
</p-dataTable>
</div>
<div class="nm-attribute-list-value target-table">
<p-dataTable
[value]="targetItemsGroupedby"
emptyMessage=""
[paginator]="true"
[rows]="10"
[scrollable]="false"
[pageLinks]="3"
selectionMode="single"
#dtTargetItems
(onRowSelect)="targetTableRowSelectChange($event)"
[(selection)]="selectedRowsTarget"
>
<!-- (onRowSelect)="onRowSelectChange($event)" #dt -->
<p-column
*ngFor="let col of cols"
[styleClass]="
col.field == selectedGroupByItemTargetValue ? 'highlight' : ''
"
[sortable]="col.sortable"
[filter]="col.sortable"
[field]="col.field"
filterMatchMode="contains"
[header]="col.header | translate"
>
<ng-template pTemplate="filter" let-col *ngIf="col.filter">
<mat-form-field>
<input
matInput
placeholder="{{ col.header }}"
type="text"
pInputText
class="ui-column-filter"
*ngIf="col.filter == true"
(click)="dtTargetItems.onFilterInputClick($event)"
(input)="
dtTargetItems.onFilterKeyup(
$event.target.value,
col.field,
col.filterMatchMode
)
"
/>
</mat-form-field>
</ng-template>
<ng-template pTemplate="filter" let-col *ngIf="!col.filter">
<span class="nm-column-title">{{ col.header }}</span>
</ng-template>
<ng-template let-col let-results="rowData" pTemplate type="body">
<div style="width: 100%">
<div [ngSwitch]="col.field">
<span *ngSwitchCase="'image'">
<span
*ngFor="let assetRelation of results?._embedded?.assets"
>
<ul
class="target-asset-column"
*ngIf="assetRelation.identifier == col.field"
[attr.data-ari]="assetRelation?.identifier"
>
<li
*ngFor="
let asset of assetRelation?._embedded.assets;
let k = index
"
[attr.data-ari]="assetRelation?.identifier"
[attr.id]="asset.title"
class="nm-attribute-list-asset"
(click)="imageClick(k, asset, assetRelation)"
[class.ui-state-selected]="asset.selected === true"
>
<nm-image
[assetObj]="asset"
size="thumbnail"
width="auto"
height="auto"
max-width="25px"
max-height="25px"
></nm-image>
</li>
</ul>
<button
class="nm-attribute-action-button"
*ngIf="
assetRelation.identifier == col.field &&
assetRelation?._embedded?.assets.length > 0
"
mat-icon-button
(click)="delteAssets(assetRelation)"
>
<mat-icon color="primary">clear</mat-icon>
</button>
<button
class="nm-attribute-action-button"
*ngIf="
assetRelation.identifier == col.field &&
assetRelation?._embedded?.assets.length > 0
"
mat-icon-button
(click)="editAssets()"
>
<mat-icon color="primary">compare_arrows</mat-icon>
</button>
</span>
</span>
<span *ngSwitchCase="'manufacturerImage'">
<span
*ngFor="let assetRelation of results?._embedded?.assets"
>
<ul
class="target-asset-column"
*ngIf="assetRelation.identifier == col.field"
[attr.data-ari]="assetRelation?.identifier"
>
<li
*ngFor="
let asset of assetRelation?._embedded.assets;
let k = index
"
[attr.data-ari]="assetRelation?.identifier"
[attr.id]="asset.title"
class="nm-attribute-list-asset"
(click)="imageClick(k, asset, assetRelation)"
[class.ui-state-selected]="asset.selected === true"
>
<nm-image
[assetObj]="asset"
size="thumbnail"
width="auto"
height="auto"
max-width="25px"
max-height="25px"
></nm-image>
</li>
</ul>
<button
class="nm-attribute-action-button"
*ngIf="
assetRelation.identifier == col.field &&
assetRelation?._embedded?.assets.length > 0
"
mat-icon-button
(click)="delteAssets(assetRelation)"
>
<mat-icon color="primary">clear</mat-icon>
</button>
<button
class="nm-attribute-action-button"
*ngIf="
assetRelation.identifier == col.field &&
assetRelation?._embedded?.assets.length > 0
"
mat-icon-button
(click)="editAssets()"
>
<mat-icon color="primary">compare_arrows</mat-icon>
</button>
</span>
</span>
<span *ngSwitchCase="'identifier'">
{{ results[col.field] }}
</span>
<span *ngSwitchCase="'searchcolor'">
<div
*ngIf="
results['attributes'] &&
results['attributes']['default'] &&
results['attributes']['default'][1] != undefined
"
>
<div
*ngIf="
results['tooltips'] != undefined &&
col.field != selectedGroupByItemTargetValue;
then withtooltips;
else notooltips
"
></div>
<ng-template #withtooltips>
<span
popover="{{ results['tooltips'][col.field] }}"
placement="top"
container="body"
triggers="mouseenter:mouseleave"
>
<span
*ngFor="
let attribute of results['attributes']['default']
"
>
<nm-edit-attribute
*ngIf="attribute.identifier === 'searchcolor'"
[attribute]="attribute"
[loadOptionsLazy]="true"
[editLayout]="'list'"
[editAttributeService]="_targetAttributeService"
[role]="'itemTarget'"
[addDeleteButton]="true"
></nm-edit-attribute>
</span>
</span>
</ng-template>
<ng-template #notooltips>
<span
*ngFor="
let attribute of results['attributes']['default']
"
>
<nm-edit-attribute
*ngIf="attribute.identifier === 'searchcolor'"
[attribute]="attribute"
[loadOptionsLazy]="true"
[editLayout]="'list'"
[editAttributeService]="_targetAttributeService"
[role]="'itemTarget'"
[addDeleteButton]="true"
></nm-edit-attribute>
</span>
</ng-template>
</div>
</span>
<span *ngSwitchDefault class="nm-break">
<div
*ngIf="
results['tooltips'] != undefined &&
col.field != selectedGroupByItemTargetValue;
then withtooltips;
else notooltips
"
></div>
<ng-template #withtooltips>
<span
popover="{{ results['tooltips'][col.field] }}"
placement="top"
container="body"
triggers="mouseenter:mouseleave"
>
<nm-ellipsis
[disableTooltip]="true"
[content]="results[col.field]"
></nm-ellipsis>
</span>
</ng-template>
<ng-template #notooltips>
<nm-ellipsis [content]="results[col.field]"></nm-ellipsis>
</ng-template>
</span>
</div>
</div>
</ng-template>
</p-column>
<footer>
<div class="ui-helper-clearfix" style="width: 100%"></div>
</footer>
</p-dataTable>
</div>
</div>
<hr />
</div>
</div>