Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modifyAttrs: function(){
- var tempHdl = calc.creditHandlersMgr.hdl('CC_CURRENCY');
- if (tempHdl.propEqual("CC_PRODUCT_TYPE", "Credit.ProductType.Obligation")){ // Облигация
- this.modifyAttrNames(this.bondAttrNames);
- this.modifyAttrPlaces(this.bondAttrPlaces);
- } else if ( tempHdl.propEqual("CC_PRODUCT_TYPE", "Credit.ProductType.Guarant1") &&
- tempHdl.inFilter("CC_CREDIT_TYPE", "CREDIT_TYPE_GUARANT_LC") &&
- tempHdl.propEqual("CC_LC_TYPE", "Credit.Accreditiv.NoPokr")
- ){ // Аккредитивы
- this.modifyAttrNames(this.lcAttrNames);
- this.modifyAttrPlaces(this.lcAttrPlaces);
- } else if (tempHdl.propEqual("CC_PRODUCT_TYPE", "Credit.ProductType.Guarant")){ // Гарантия
- this.modifyAttrNames(this.guarantyAttrNames);
- this.modifyAttrPlaces(this.guarantyAttrPlaces);
- } else { // Кредит
- this.modifyAttrNames(this.creditAttrNames);
- this.modifyAttrPlaces(this.creditAttrPlaces);
- }
- // Проверка атрибутов, с изменяемыми блоками
- this.ccRatesBlockAttrs = this.getBlockAttributes('CC_RATES');
- this.ccCommissionsBlockAttrs = this.getBlockAttributes('CC_COMMISSIONS');
- this.ccPrivlBlockAttrs = this.getBlockAttributes('CC_DOP_PRIVL');
- this.ccPokrBlockAttrs = this.getBlockAttributes('CC_DOP_POKR');
- this.ccVeksBlockAttrs = this.getBlockAttributes('CC_DOP_VEKS');
- },
- modifyAttrNames: function(attrNames){
- for (var attr in attrNames){
- var attrHdl = this.creditHandlersMgr.hdl(attr);
- attrHdl.setName(attrNames[attr] + ":");
- }
- },
- modifyAttrPlaces: function(attrPlaces){
- for (var i=0; i<attrPlaces.length; i++){
- var attrPlace = attrPlaces[i];
- var attrCode = attrPlace.attrCode;
- var attrBlock = attrPlace.blockCode;
- var attrOrder = attrPlace.blockOrder;
- var beforeAttr = undefined, afterAttr = undefined;
- var beforeOrder = undefined, afterOrder = undefined;
- for (var attr in this.pane.attrOrders){
- if (this.pane.attrOrders[attr].block === attrBlock){
- var order = this.pane.attrOrders[attr].order;
- // Здесь из предыдущих и последующих атрибутов выбираются те,
- // которые расположены наиболее близко к искомому атрибуту.
- // Например, если у искомого атрибута order = 50 и есть атрибуты:
- // "attr_A" (order = 10)
- // "attr_B" (order = 20)
- // "attr_C" (order = 30)
- // "attr_D" (order = 60)
- // "attr_E" (order = 70)
- // то beforeAttr = "attr_C", beforeOrder = 30,
- // afterAttr = "attr_D", afterOrder = 60
- if (order < attrOrder){
- if (typeof beforeOrder === "undefined" || order > beforeOrder){
- beforeAttr = attr;
- beforeOrder = order;
- }
- } else {
- if (typeof afterOrder === "undefined" || order < afterOrder){
- afterAttr = attr;
- afterOrder = order;
- }
- }
- }
- }
- var attrHdl = this.creditHandlersMgr.hdl(attrCode);
- if (typeof beforeAttr !== "undefined"){
- attrHdl.changeAttrPlace(beforeAttr, "after");
- } else if (typeof afterAttr !== "undefined"){
- attrHdl.changeAttrPlace(afterAttr, "before");
- } else {
- attrHdl.changeAttrPlace("block_" + attrBlock, "last");
- }
- this.pane.attrOrders[attrCode].block = attrBlock;
- this.pane.attrOrders[attrCode].order = attrOrder;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement