Created
October 28, 2017 12:48
-
-
Save naydav/f6ed7a567aa76f48fce73b5f97e018d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright © 2016 Magento. All rights reserved. | |
* See COPYING.txt for license details. | |
*/ | |
define([ | |
'Magento_Ui/js/grid/columns/column', | |
'jquery', | |
'mage/template', | |
'text!Magento_MultipleLocationInventory/template/grid/cells/qty/info.html', | |
'mage/translate' | |
], function (Column, $, mageTemplate, qtyInfoTemplate, $t) { | |
'use strict'; | |
return Column.extend({ | |
defaults: { | |
bodyTmpl: 'Magento_MultipleLocationInventory/grid/cells/qty' | |
}, | |
/** | |
* @param {Object} row | |
* @returns string | |
*/ | |
getTooltipHtml: function (row) { | |
return mageTemplate( | |
qtyInfoTemplate, | |
{ | |
data: { | |
sources: row['source_info'], | |
sourceTitle: $t('Source'), | |
qtyTitle: $t('Quantity') | |
} | |
} | |
); | |
}, | |
/** | |
* @param {Object} row | |
* @returns boolean | |
*/ | |
isQtyDetailsAvailable: function (row) { | |
return row['source_info'].length > 0; | |
}, | |
/** | |
* @param {Object} row | |
* @returns boolean | |
*/ | |
isLowStock: function (row) { | |
var i, | |
isLowStock = false; | |
for (i = 0; i < row['source_info'].length; i++) { | |
if (row['source_info'][i]['low_stock']) { | |
isLowStock = true; | |
break; | |
} | |
} | |
return isLowStock; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment