<md-card ng-repeat='q in obj'>
  <div class='topcard'></div>
  <div class='row'>

    <div class='col-xs-1 col-sm-1 col-md-1'></div>
    <div class='col-xs-1 col-sm-1 col-md-1'>
      <div class='numquest' ng-if='level == 0'>{{ $index+1 }}</div>
      <div class='numquest' ng-if='level == 1'>{{ pindex+1 }}.{{ $index+1 }}</div>
      <div class='numquest' ng-if='level == 2'>{{ gpindex+1 }}.{{ pindex+1 }}.{{ $index+1 }}</div>
    </div>
    <div class='col-xs-6 col-sm-6 col-md-6'>
      <md-input-container class='md-block fullwidth'>
        <label class='control-label label-custom'><swaplang code="SW013215">Question (English)</swaplang></label>
        <textarea ng-model='q.question.eng' rows="2"></textarea>
      </md-input-container>
    </div>
    <div class='col-xs-2 col-sm-2 col-md-2'>
      <md-input-container class='md-block fullwidth'>
        <label class='control-label label-custom'><swaplang code="SW005559">Type</swaplang></label>
        <md-select ng-model='q.type' ng-change='question.setType(q)'>
          <md-option ng-repeat='qt in questype.questtype' ng-value='qt.type' ng-if='level != 2'>{{ qt.getString(mylang) }}</md-option>
          <md-option ng-repeat='qt in questype.questtype' ng-value='qt.type' ng-if='level == 2 && qt.type != 8'>{{ qt.getString(mylang) }}</md-option>
        </md-select>
      </md-input-container>
    </div>
    <div class='col-xs-1 col-sm-1 col-md-1'>
      <a class='delquestion' ng-click='deleteArray(obj, $index)'><i class='fa fa-times'></i></a>
    </div>
  </div>

  <div class='row'>
    <div class='col-xs-2 col-sm-2 col-md-2'></div>
    <div class='col-xs-6 col-sm-6 col-md-6'>
      <md-input-container class='md-block fullwidth'>
        <label class=' -label label-custom'><swaplang code="SW013216">Question (Thai)</swaplang></label>
        <textarea ng-model='q.question.tha' rows="2"></textarea>
      </md-input-container>
    </div>
    <div class='col-xs-2 col-sm-2 col-md-2'>
      <md-input-container class='md-block fullwidth'>
        <a class='btn btn-primary' ng-class='checkClass(q.pictureproperty, "picture")' ng-click='openUploadPicture(q)'><i class='fa fa-picture-o'></i></a>
        <a class='btn btn-primary' ng-class='checkClass(q.audioproperty, "audio")' ng-click='openUploadAudio(q)'><i class='fa fa-volume-down'></i></a>
        <a class='btn btn-primary' ng-class='checkClass(q.videoproperty, "video")' ng-click='oepnUploadVideo(q)'><i class='fa fa-film'></i></a>
      </md-input-container>
    </div>
  </div>

  <div class='row'>
  </div>

  <ans-text ng-if='q.type === 1' obj='q'></ans-text>
  <ans-Singlechoice ng-if='q.type === 2' obj='q'></ans-Singlechoice>
  <ans-Multichoice ng-if='q.type === 3' obj='q'></ans-Multichoice>
  <ans-Sortsentence ng-if='q.type === 4' obj='q'></ans-Sortsentence>
  <ans-Pairtext ng-if='q.type === 5' obj='q'></ans-Pairtext>
  <ans-Pairpicture ng-if='q.type === 6' obj='q'></ans-Pairpicture>
  <ans-Pairpicturetext ng-if='q.type === 7' obj='q'></ans-Pairpicturetext>

  <ans-Subquestion ng-if='level == 0 && q.type === 8' obj='q.ansgroup' level='nextlv' pindex='$index' gpindex='"none"'></ans-Subquestion>
  <ans-Subquestion ng-if='level == 1 && q.type === 8' obj='q.ansgroup' level='nextlv' pindex='$index' gpindex='pindex'></ans-Subquestion>

  <div class='row' ng-if='q.type === 8'>
    <div class='col-xs-12 col-sm-12 col-md-12'>
      <center>
        <a class='btn btn-primary' ng-click='question.addSubQuestion(q.ansgroup)'><i class='fa fa-plus'></i></a>
      </center>
    </div>
  </div>

  <div class='bottomcard'></div>
</md-card>