@extends('layouts.app')


<?php
    $request = request();
    $victim = new App\Models\Victim;
    $posturl = url("dataentry/postfmg");
    $gotosuccess = false; $id = $tab ="";
    $successmessage = $successurl = $failureurl = "";
    if(!Empty($request->successurl)){
        $successurl = $request->successurl;
        $gotosuccess = true; 
    }
?>
@section('content')
<div class="pcoded-content">
    <div class="pcoded-inner-content">
        <div class="main-body">
            <div class="page-wrapper">
                <!-- Page-header start -->
                <div class="page-header card page-body">
                    <div class="row align-items-end">
                        <div class="col-lg-8">
                            <div class="page-header-title">
                                <i class="icofont icofont icofont icofont-file-document bg-c-pink"></i>
                                <div class="d-inline">

                                    <h4></h4>
                                    <a href="<?php echo url("dataentry/fgmrecords");?>">
                                        <span>FGM Data</span>
                                    </a>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="page-header-breadcrumb">
                                <ul class="breadcrumb-title">
                                    <li class="breadcrumb-item">
                                        <a href="index.html">
                                            <i class="icofont icofont-home"></i>
                                        </a>
                                    </li>

                                    <li class="breadcrumb-item"><a href="#!">Incident Data</a>
                                    </li>
                                    <li class="breadcrumb-item"><a href="#!">Data Entry</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                        <hr>
                        <div class="row">
                            <div class="col-sm-12">
                                <form id="indexform" class="form-horizontal" method="POST" action="<?php echo $posturl; ?>">
                                    @csrf
                                    <input name="entityname" id="entityname" type="hidden" value="Incident" />
                                    <input type="hidden" id="action" name="action"value="" />
                                    <input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
                                    <input name="successmessage" id="successmessage" type="hidden" value="<?php echo $successmessage; ?>" />  
                                    <input type="hidden" id="<?php echo "SUCCESS_MESSAGE"; ?>" name="<?php echo "SUCCESS_MESSAGE"; ?>" value="<?php echo $successmessage; ?>" /> 
                                    <input type="hidden" id="<?php echo "URL_SUCCESS"; ?>" name="<?php echo $successurl; ?>" value="<?php echo base64_encode($successurl); ?>" /> 
                                    <input type="hidden" id="<?php echo "URL_FAILURE"; ?>" name="<?php echo "URL_FAILURE"; ?>" value="<?php echo base64_encode($failureurl); ?>" /> 
                                    <!--Number of Girls Saved from FGM-->
                                    <div class="row">
                                        <div class="col-sm-6" id="home1">
                                            <div class="form-group row">
                                                <label class="col-md-4 col-form-label text-md-left">F/Year <span style="color: red">*</span></label>
                                                <div class="col-md-8">
                                                    <input type="text" class="form-control" name="fyear" id="fyear" placeholder="<?php echo date("Y"); ?>" required="required" maxlength="4">
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-md-4 col-form-label text-md-left">Quarter <span style="color: red">*</span></label>
                                                <div class="col-md-8">
                                                    <select id="quarter" class="form-control search-select" name="quarter" required>
                                                        <option value="">Choose One</option>
                                                        <option value="1">Quarter 1</option>
                                                        <option value="2">Quarter 2</option>
                                                        <option value="3">Quarter 3</option>
                                                        <option value="4">Quarter 4</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-md-4 col-form-label text-md-left">No. Girls Saved <span style="color: red">*</span></label>
                                                <div class="col-md-8">
                                                    <input type="number" class="form-control" name="number" id="number" placeholder="Number of Girls saved" required="required" maxlength="10">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-sm-6" id="home1">
                                            <div class="form-group row">
                                                <label class="col-sm-4 control-label">District: <span style="color: red">*</span></label>
                                                <div class="col-sm-8">
                                                    <select id="district" class="form-control search-select" name="districtid" required>
                                                        <option value="">Choose One</option>
                                                        @foreach($districts as $district)
                                                        <option value="{{$district->id}}">{{$district->name}}</option>
                                                        @endforeach
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-sm-4 control-label">Sub-County: <span style="color: red">*</span></label>
                                                <div class="col-md-8">
                                                    <select id="subcounty" class="form-control search-select" name="subcountyid" required>
                                                        <option value="">Choose One</option>
                                                        @foreach($subcounties as $subcounty)
                                                        <option value="{{$subcounty->id}}">{{$subcounty->name}}</option>
                                                        @endforeach
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-sm-4 control-label">Parish: <span style="color: red">*</span></label>
                                                <div class="col-md-8">
                                                    <select id="parish" class="form-control search-select" name="parishid" required>
                                                        <option value="">Choose One</option>
                                                        @foreach($parishes as $parish)
                                                        <option value="{{$parish->id}}">{{$parish->name}}</option>
                                                        @endforeach
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group row">
                                                <label class="col-sm-4 control-label">Village:</label>
                                                <div class="col-md-8">
                                                    <input type="text" class="form-control" name="village" placeholder="Village" required="required">
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <!--Services Given to Girls-->
                                    <div class="row">
                                        <legend>Services Given to the Girls</legend>
                                        <div class="col-sm-12" id="home1">
                                            <table class="table" width="80%">
                                                <thead>
                                                    <tr>
                                                        <th>#</th>
                                                        <th>Service Offered</th>
                                                        <th>Number of Girls</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php $key=1; ?>
                                                    @foreach($services as $service)
                                                    <tr>
                                                      <td><?php echo $key; ?></td>
                                                      <td><input type="hidden" name="service_<?php echo $key; ?>" id="service_<?php echo $key; ?>" value="{{$service->id}}">{{$service->name}}</td>
                                                      <td>
                                                          <input type="number" class="form-control" name="girls_<?php echo $key; ?>" id="girls_<?php echo $key; ?>" placeholder="Number of Girls" min="0" value="0" size="10" maxlength="10">
                                                      </td>  
                                                    </tr>
                                                    <?php $key++; ?>
                                                    @endforeach
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                    <hr>
                                    <div class="text-md-right testborder xhide pull pull-right">
                                        <a class="btn cancel gonowhere" type="button"> Cancel</a>
                                        <button class="btn btn-primary btn-green changesuccessurl savebutton savecontinue" type="submit" successurl="" pretext="Save and Continue">Save and Continue</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    
                </div>
                <!-- Page-header end -->
            </div>
        </div>
    </div>
</div>
@endsection
