 @extends('admin.layouts.main-layout')
 @section('content')
   <div class="container">
        <div class="justify-content-center">
            <div class="">
                <div class="card">
                    <div class="card-header">Reverse Game Winner</div>
                    <div class="card-body">
                        @if ($errors->any())
                            <div class="alert alert-danger">
                                <ul>
                                    @foreach ($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                        @endif
                         <form role="form" method="post" onsubmit="return validateForm('addsstatus')" class="addsstatus" action="{{url('admin/gamwinnerreverseclose/'.$store->id)}}" autocomplete="off" enctype="multipart/form-data">
                             @csrf
                       
                        <div class="row">
                            <div class="col-md-6">
                             <div class="form-group">
                                <label for="title"> Game Name<span class="require label-mandatory">*</span></label>
                                 <span class="form-control bit_place">
                                    {{$store->name}}
                                 </span>
                                 
                                  
                                
                            </div>
                          </div>
                           <div class="col-md-6">
                             <div class="form-group">
                                <label for="title"> Open Time<span class="require label-mandatory">*</span></label>
                                 <span class="form-control bit_place">
                                     {{ isset($store->storesDay) ? timeShow($store->storesDay->close_time) : ''}}
                                 </span>
                                
                            </div>
                          </div>
                           <div class="col-md-6">
                             <div class="form-group">
                                <label for="title"> Result Number<span class="require label-mandatory">*</span></label>
                                
                                  <input type="text" 
       class="form-control bit_place"
       name="result" 
       id="result"
       placeholder="xxx"
       maxlength="3"
       minlength="3"
       required>
                                  
                                
                            </div>
                            <b>Single Digit:-</b><span id="digit_sum"></span>
                          </div>
                           </div>
                      
                           
                            <div class="form-group">

                                <button type="submit"  class="btn btn-primary" >Submit</button>
                            </div>

                        </form>
                        <div id="compareform">
                           
                        </div>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
document.getElementById("result").addEventListener("input", function () {
    let val = this.value.replace(/\D/g, ""); // keep only digits

    let sum = 0;
    for (let char of val) {
        sum += parseInt(char);
    }

    let lastDigit = sum % 10; // get last digit

    document.getElementById("digit_sum").innerText = val ? lastDigit : "";
});
</script>

@endsection

 