<commit_before>@extends('layouts.app')

@section('content')
<div class="container">

    <h1>Add New Card</h1>
    

    <div class="row">
    	<div class="col-md-4">
        Picture would be here
    	<img class="img-responsive" src="">
    	</div>
    	<div class="col-md-8">
			{!! Form::open(['url' => '/add/card']) !!}
                  <div class="form-group">
                    <label for="boy">Boy</label>
                    {!! Form::select('boy_id', $boys,'' ,['class'=>'form-control', 'id'=>'boy','placeholder' => 'Boy']) !!} 
                  </div>
                  <div class="form-group">
                    <label for="japanese-name">Japanese Name</label>
                     {!! Form::text('japanese_name','',['class'=>'form-control','id'=>'japanese-name']) !!}
                  </div>                  
			      <div class="form-group">
                    <label for="english-name">English Name</label>
                     {!! Form::text('english_name','',['class'=>'form-control','id'=>'english-name']) !!}
                  </div>   
                  <div class="form-group">
                    <label for="s-name">Placeholder Name</label>
                     {!! Form::text('name_s','',['class'=>'form-control','id'=>'s-name']) !!}
                  </div>   
                  <div class="form-group">
                    <label for="stars">Stars</label>
                    <select name="stars" class="form-control" id="stars">
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                    </select>
                  </div>    
                  <div class="form-group">
                    <label for="type">Type</label>
                    <select name="color" class="form-control" id="type">
                        <option value="">Type</option>
                        <option value="dance">Dance</option>
                        <option value="vocal">Vocal</option>
                        <option value="performance">Performance</option>
                    </select>
                  </div>   
                  <div class="form-group">
                    <label for="lesson-skill">Lesson Skill</label>
                    {!! Form::select('lesson_id', $lesson_skills,'' ,['class'=>'form-control', 'id'=>'lesson-skill','placeholder' => 'Lesson Skill']) !!} 
                  </div>
                  <div class="form-group">
                    <label for="dorifes-id">Dream Festival Skill</label>
                    {!! Form::select('dorifes_id', $dorifes_skills,'' ,['class'=>'form-control', 'id'=>'dorifes-id','placeholder' => 'Dream Festival Skill']) !!} 
                  </div>                                                                         
            {!! Form::submit('Add') !!}
            {!! Form::close() !!}
			
    	</div>
   	</div>

</div>
<script>
      $('#type').change(function() {

        var type = $(this).val();
        console.log(type);
          $.get('/api/skill/dreamfestival/'+type,function(data){
            //clear out dorifes-id options
            var select = document.getElementById('dorifes-id');
            select.options.length=0;

            //need to parse this for just what I want
            for (const skill of data) {
              //create a new dorifes option
              var option = document.createElement('option');
              option.value = skill.id;
              option.innerHTML = skill.english_description;
              select.appendChild(option);
            }          

          },'json');






		// var $self = $(this);
		// //make this global to get into the delay function
		// slideSpeaker = $self.val();
		// slideID = $self.attr('id');
		// slideName = $self.attr('name');
    //     //remove the first two characters - Christine 2017-09-24
    //     slideID = slideID.slice(2);<commit_msg>Fix issue with type being too long for database column<commit_after>@extends('layouts.app')

@section('content')
<div class="container">

    <h1>Add New Card</h1>
    

    <div class="row">
    	<div class="col-md-4">
        Picture would be here
    	<img class="img-responsive" src="">
    	</div>
    	<div class="col-md-8">
			{!! Form::open(['url' => '/add/card']) !!}
                  <div class="form-group">
                    <label for="boy">Boy</label>
                    {!! Form::select('boy_id', $boys,'' ,['class'=>'form-control', 'id'=>'boy','placeholder' => 'Boy']) !!} 
                  </div>
                  <div class="form-group">
                    <label for="japanese-name">Japanese Name</label>
                     {!! Form::text('japanese_name','',['class'=>'form-control','id'=>'japanese-name']) !!}
                  </div>                  
			      <div class="form-group">
                    <label for="english-name">English Name</label>
                     {!! Form::text('english_name','',['class'=>'form-control','id'=>'english-name']) !!}
                  </div>   
                  <div class="form-group">
                    <label for="s-name">Placeholder Name</label>
                     {!! Form::text('name_s','',['class'=>'form-control','id'=>'s-name']) !!}
                  </div>   
                  <div class="form-group">
                    <label for="stars">Stars</label>
                    <select name="stars" class="form-control" id="stars">
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                    </select>
                  </div>    
                  <div class="form-group">
                    <label for="type">Type</label>
                    <select name="color" class="form-control" id="type">
                        <option value="">Type</option>
                        <option value="red">Dance</option>
                        <option value="blue">Vocal</option>
                        <option value="yellow">Performance</option>
                    </select>
                  </div>   
                  <div class="form-group">
                    <label for="lesson-skill">Lesson Skill</label>
                    {!! Form::select('lesson_id', $lesson_skills,'' ,['class'=>'form-control', 'id'=>'lesson-skill','placeholder' => 'Lesson Skill']) !!} 
                  </div>
                  <div class="form-group">
                    <label for="dorifes-id">Dream Festival Skill</label>
                    {!! Form::select('dorifes_id', $dorifes_skills,'' ,['class'=>'form-control', 'id'=>'dorifes-id','placeholder' => 'Dream Festival Skill']) !!} 
                  </div>                                                                         
            {!! Form::submit('Add') !!}
            {!! Form::close() !!}
			
    	</div>
   	</div>

</div>
<script>
      $('#type').change(function() {
        var color = $(this).val();
        //TODO: need to change the db to a lookup table or something here
        if (color === 'red') {
          type = 'dance';
        } else if (color === 'blue') {
          type = 'vocal';
        } else {
          type = 'performance';
        }
        console.log(type);
          $.get('/api/skill/dreamfestival/'+type,function(data){
            //clear out dorifes-id options
            var select = document.getElementById('dorifes-id');
            select.options.length=0;

            //need to parse this for just what I want
            for (const skill of data) {
              //create a new dorifes option
              var option = document.createElement('option');
              option.value = skill.id;
              option.innerHTML = skill.english_description;
              select.appendChild(option);
            }          

          },'json');






		// var $self = $(this);
		// //make this global to get into the delay function
		// slideSpeaker = $self.val();
		// slideID = $self.attr('id');
		// slideName = $self.attr('name');
    //     //remove the first two characters - Christine 2017-09-24
    //     slideID = slideID.slice(2);
{'fraction_non_alphanumeric': 0.17498165810711666, 'fraction_numerical': 0.004891171435558816, 'mean_word_length': 1.5004585753592175, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 159, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6598486', 'n_tokens_mistral': 2339, 'n_tokens_neox': 2182, 'n_words': 413}