Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/extmag/shiplab/view/adminhtml/web/js/form/components/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/old/vendor/extmag/shiplab/view/adminhtml/web/js/form/components/insert-listing.js
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @api
 */
define([
    'jquery',
    'Magento_Ui/js/form/components/insert-listing',
    'mageUtils',
    'underscore'
], function ($, Insert, utils, _) {
    'use strict';

    return Insert.extend({
        attributesLabels: {},
        stepInitialized: false,
        defaults: {
            imports: {
                onSelectedChange: '${ $.selectionsProvider }:selected',
                'update_url': '${ $.externalProvider }:update_url',
                'indexField': '${ $.selectionsProvider }:indexField'
            },
            listens: {
                externalValue: 'updateExternalFiltersModifier updateSelections',
                indexField: 'initialUpdateListing',
                '${ $.selectionsProvider }:selected': 'doSelectedAttributesLabels',
                '${ $.selectionsProvider }:rows': 'doSelectSavedAttributes'
            },
            modules: {
                selections: '${ $.selectionsProvider }',
                externalListing: '${ $.externalListingName }',
                multiselect: '${ $.selectionsProvider }',
                attributeProvider: '${ $.externalProvider }'
            },
            selectedAttributes: []
        },
        /** @inheritdoc */
        initObservable: function () {
            this._super().observe(['selectedAttributes']);

            return this;
        },
        /**
         * Do select saved attributes.
         */
        doSelectSavedAttributes: function () {
            if (this.stepInitialized === false) {
                this.stepInitialized = true;
                //cache attributes labels, which can be present on the 2nd page
                //console.log(this);
                _.each(this.initData, function (attribute) {
                    this.attributesLabels[attribute] = attribute;
                }.bind(this));
                this.multiselect().selected(this.initData);
            }
        },

        /**
         * @param {*} selected
         */
        doSelectedAttributesLabels: function (selected) {
            var labels = [];
            this.selected = selected;
            _.each(selected, function (attributeId) {
                var attribute;

                if (!this.attributesLabels[attributeId]) {
                    attribute = _.findWhere(this.multiselect().rows(), {
                        'entity_id': attributeId
                    });

                    if (attribute) {
                        this.attributesLabels[attribute['entity_id']] = attribute['frontend_label'];
                    }
                }
                labels.push(this.attributesLabels[attributeId]);
            }.bind(this));
            this.selectedAttributes(labels.join(', '));
        },
    });
});

Spamworldpro Mini