Your IP : 18.219.40.177


Current Path : /usr/local/mgr5/skins/orion/src/
Upload File :
Current File : //usr/local/mgr5/skins/orion/src/App.FormFixedField.js

/**
 * Module provide fixed field in form
 *  @param {object} window  global object
 *  @param {function} $ jQuery library
 *  @param {object} EventMgr EventMgr library
 *  @param {object} App Application
 *  @return {object} api
 */
App.FormFixedField = function(window, $, EventMgr, App) {
  'use strict';

  function fixedField(e, data) {
    var tabId = data.tabId;
    $('#cont-' + tabId).find('.i-form__row_fixed_yes').each(function(index) {
       var $self = $(this),
           $clone = $self.clone(),
           height = $self.height(),
           id = 'i' + new Date().getTime();
       $clone.addClass('b-form__row_visible_hidden');
       $clone.html('<td><div class="b-form__row-inner" id="' + id + '" style="height: ' + height + 'px;"></div></td>');
       $self.css('position', 'fixed')
            .css('z-index', 10 - index)
            .css('width', '100%');
       $self.attr('data-id', id);
       $self.after($clone);
    });
  }

  function updateFixedField(e, data) {
    var tabId = data.tabId;
    $('#cont-' + tabId).find('.i-form__row_fixed_yes').each(function() {
       var $self = $(this),
           height = $self.height(),
           id = this.getAttribute('data-id');
       $('#' + id).css('height', height + 'px');
    });
  }

  function init() {
    EventMgr.bind('appendForm', fixedField);
    EventMgr.bind('updateFixedField', updateFixedField);
  }

  var api = {
    init: init
  };

  return api;

} (window, $, EventMgr, App);