This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,102 @@
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
define([
'underscore',
'Magento_Catalog/js/components/new-category'
], function (_, Category) {
'use strict';
/**
* Processing options list
*
* @param {Array} array - Property array
* @param {String} separator - Level separator
* @param {Array} created - list to add new options
*
* @return {Array} Plain options list
*/
function flattenCollection(array, separator, created) {
var i = 0,
length,
childCollection;
array = _.compact(array);
length = array.length;
created = created || [];
for (i; i < length; i++) {
created.push(array[i]);
if (array[i].hasOwnProperty(separator)) {
childCollection = array[i][separator];
delete array[i][separator];
flattenCollection.call(this, childCollection, separator, created);
}
}
return created;
}
return Category.extend({
/**
* Get path to current option
*
* @param {Object} data - option data
* @returns {String} path
*/
getPath: function (data) {
var pathParts,
createdPath = '';
if (this.renderPath && typeof data.path !== "undefined") {
pathParts = data.path.split('.');
_.each(pathParts, function (curData) {
createdPath = createdPath ? createdPath + ' / ' + curData : curData;
});
return createdPath;
}
},
/**
* Set option to options array.
*
* @param {Object} option
* @param {Array} options
*/
setOption: function (option, options) {
// eslint-disable-next-line radix
var parent = parseInt(option.parent),
copyOptionsTree;
if (_.contains([0, 1], parent)) {
options = options || this.cacheOptions.tree;
options.push(option);
copyOptionsTree = JSON.parse(JSON.stringify(this.cacheOptions.tree));
this.cacheOptions.plain = flattenCollection(copyOptionsTree, this.separator);
this.options(this.cacheOptions.tree);
} else {
this._super(option, options);
}
}
});
});
@@ -0,0 +1,49 @@
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license sliderConfig is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
define([
'Magento_Ui/js/grid/columns/select'
], function (Column) {
'use strict';
return Column.extend({
defaults: {
bodyTmpl: 'ui/grid/cells/html'
},
getLabel: function (record) {
var label = this._super(record);
if (label !== '') {
switch (record.enabled) {
case '1':
label = '<span class="grid-severity-notice"><span>' + label + '</span></span>';
break;
case '0':
label = '<span class="grid-severity-critical"><span>' + label + '</span></span>';
break;
case '2':
label = '<span class="grid-severity-critical"><span>' + label + '</span></span>';
break;
}
}
return label;
}
});
});
@@ -0,0 +1,49 @@
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license sliderConfig is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
define([
'Magento_Ui/js/grid/columns/select'
], function (Column) {
'use strict';
return Column.extend({
defaults: {
bodyTmpl: 'ui/grid/cells/html'
},
getLabel: function (record) {
var label = this._super(record);
if (label !== '') {
switch (record.status) {
case '1':
label = '<span class="grid-severity-notice"><span>' + label + '</span></span>';
break;
case '2':
label = '<span class="grid-severity-critical"><span>' + label + '</span></span>';
break;
case '3':
label = '<span class="grid-severity-minor"><span>' + label + '</span></span>';
break;
}
}
return label;
}
});
});
@@ -0,0 +1,97 @@
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the Mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://www.mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Blog
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
* @license https://www.mageplaza.com/LICENSE.txt
*/
define([
'jquery',
'Magento_Ui/js/modal/modal',
'mage/translate'
], function ($, modal, $t) {
"use strict";
$.widget('mageplaza.mpBlogAuthor', {
options: {
url: ''
},
isloaded: false,
/**
* This method constructs a new widget.
* @private
*/
_create: function () {
this.initCustomerGrid();
this.selectCustomer();
},
/**
* Init popup
* Popup will automatic open
*/
initPopup: function () {
var options = {
type: 'popup',
responsive: true,
innerScroll: true,
title: $t('Select Customer'),
buttons: []
},
customerGridEl = $('#customer-grid');
modal(options, customerGridEl);
customerGridEl.modal('openModal');
},
/**
* Init select customer
*/
selectCustomer: function () {
$('body').delegate('#customer-grid_table tbody tr', 'click', function () {
var first_name = $(this).find('td:nth-child(3)').text().trim(),
last_name = $(this).find('td:nth-child(4)').text().trim();
$("#author_customer_id").val($(this).find('input').val().trim());
$("#author_customer").val(first_name+' '+last_name);
$('#customer-grid').data('mageModal').closeModal();
});
},
/**
* Init customer grid
*/
initCustomerGrid: function () {
var self = this;
$("#author_customer").click(function () {
$.ajax({
method: 'POST',
url: self.options.url,
data: {form_key: window.FORM_KEY},
showLoader: true
}).done(function (response) {
$('#customer-grid').html(response);
self.initPopup();
});
});
}
});
return $.mageplaza.mpBlogAuthor;
});