var Wick = Wick || {};

Wick.ProjectListMultiple = {
    el: {
      actionBlockBtn: '.action-block_btn',
      formListName: '.form-list-name',
      formRowValidationErrorClass: 'form-row_validation-error',
      formListNameTbx: '.form-list-name_tbx',
      formListNameInfo: '.form-list-name_info',
      tbxErrorClass: 'tbx_error',
      formRowError: 'form-row__error',
      errorText: 'Invalid character(s), please remove any instances of @%£/\|[]{}.-'
    },
    bindAll() {
        Wick.ProjectListMultiple.bindButtons();
    },
    showValidationError() {
      $(Wick.ProjectListMultiple.el.formListNameInfo).text(Wick.ProjectListMultiple.el.errorText);
      $(Wick.ProjectListMultiple.el.formListNameInfo).removeClass('d-none');
    },
    bindButtons() {
      $(Wick.ProjectListMultiple.el.actionBlockBtn).on('click', function () {
        $(Wick.ProjectListMultiple.el.formListName).addClass(Wick.ProjectListMultiple.el.formRowValidationErrorClass);
        $(Wick.ProjectListMultiple.el.formListNameTbx).addClass(Wick.ProjectListMultiple.el.tbxErrorClass);
        $(Wick.ProjectListMultiple.el.formListNameInfo).addClass(Wick.ProjectListMultiple.el.formRowError);
        Wick.ProjectListMultiple.showValidationError();
      });
    }
};

$(document).ready(function() {
    Wick.ProjectListMultiple.bindAll();
});
