import { Component, OnInit } from '@angular/core';
import {BsModalRef} from 'ngx-bootstrap';
import {FormBuilder, Validators} from '@angular/forms';
import {FrameEditComponent} from '../../../frame/core/FrameEditComponent';
import {CookieService} from 'ngx-cookie-service';

@Component({
  selector: 'app-weixin-tag-detail',
  templateUrl: './weixin-tag-detail.component.html',
  styleUrls: ['./weixin-tag-detail.component.scss']
})
export class WeixinTagDetailComponent extends FrameEditComponent implements OnInit {

  constructor(bsModalRef: BsModalRef, fb: FormBuilder, private cookies: CookieService) {
    super(bsModalRef);
    this.valForm = fb.group({
      'tag_name': [null, Validators.compose([Validators.required, Validators.minLength(1), Validators.maxLength(128)])],
      'tag_desc': [null],
      'tag_status': [null]
    });
  }
  initDefautEntity() {
    if (this.editModel === 'add') {
      this.currentEntity.wx_id = this.cookies.get('CurrentWxId');
      this.currentEntity.tag_status = 'Active';
    }
  }

  ngOnInit() {
  }

}
