/**
 * Плашка "не более X тонн"
 */
CalcClass.TonnsClass = go.Class({

    'CONTAINERS': {
        '0.8' : 0.35,
        '1.1' : 0.5,
        '8'   : 5,
        '20'  : 12,
        '27'  : 12,
        '33'  : 12,    
    },
    
    'TONNS_FORMS': ["тонны", "тонн", "тонн"],

    '__construct': (function(node) {
        this.node = $(node);
        this.set("0.8", 1);
    }),
    
    'set': (function(container, count) {
        var tonns = this.CONTAINERS[container] * count;
        if (tonns < 10) {
            tonns = tonns.toFixed(2).replace(".", ",");
            var form = this.TONNS_FORMS[2];
        } else {
            tonns = tonns.toFixed(0);
            var form = CalcClass.Helper.ending(tonns, this.TONNS_FORMS);
        }
        this.node.text(tonns + " " + form);
    }),

    'eoc': null
});

