/**
 * Плашка с подробным расчётом цены 
 * (что составляет V м3 * C контейнеров в месяц, стоимостью P каждый)
 *
 * @property jQuery node
 *           нода плашки
 * @property jQuery nodeContainer
 *           нода с объёмом контейнеров
 * @property jQuery nodeCEnding
 *           нода с надписью "контейнер(а|ов)"
 * @property jQuery nodeCount
 *           нода с количеством контейнеров
 * @property jQuery nodePer
 *           нода с ценой одного контейнера
 * @property bool visible
 *           отображается ли плашка
 */
CalcClass.DetailsClass = go.Class({

    'NODE_CONTAINER' : ".pr_volume",
    'NODE_CENDING'   : ".pr_cnts",
    'NODE_COUNT'     : ".pr_count",
    'NODE_PER'       : ".pr_price",
    'C_FORMS'        : ["контейнер", "контейнера", "контейнеров"],

    /**
     * Конструктор
     *
     * @param jQuery node
     *        нода плашки
     */
    '__construct': (function(node) {
        this.node           = $(node);
        this.nodeContainers = this.node.find(this.NODE_CONTAINER);
        this.nodeCEnding    = this.node.find(this.NODE_CENDING);
        this.nodeCount      = this.node.find(this.NODE_COUNT);
        this.nodePer        = this.node.find(this.NODE_PER);
        this.visible        = false;
    }),
    
    /**
     * Отобразить плашку
     */
    'show': (function() {
        if (!this.visible) {
            this.node.show();
            this.visible = true; 
        }
    }),
    
    /**
     * Скрыть плашку
     */
    'hide': (function() {
        if (this.visible) {
            this.node.hide();
            this.visibel = true;
        }
    }),
    
    /**
     * Указать контейнер (объём)
     *
     * @param float container
     */
    'setContainer': (function(container) {
        this.nodeContainers.text(container.replace(".", ","));
    }),
    
    /**
     * Указать количество контейнеров
     *
     * @param int count
     */
    'setCount': (function(count) {
        this.nodeCount.text(count);
        this.nodeCEnding.text(CalcClass.Helper.ending(count, this.C_FORMS));        
    }),
    
    /**
     * Указать цену одного контейнера
     *
     * @param int per
     */
    'setPerPrice': (function(per) {
        this.nodePer.text(per);
    }),
    
    'eoc': null
});

