<?php
$id = '';
$strName = '';
$strCategoryId = '';
$strCost = '';
$strCostLabel = '';

if(isset($service))
{
    $id = $service->id;
    $strName = $service->name;
    
    $strCategoryId = $service->category_id;
    $strCost = $service->cost;
    $strCostLabel = $service->cost_label;
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap + Creative Studio main styles -->
	<link rel="stylesheet" href="https://by-arsolution.com/assets/css/creative-studio.css">
	<!--<link rel="stylesheet" href="assets/css/styles.css">-->

    @include('admin/ar-css')
</head>

<body id="home">
    @include('admin/header_admin')
    <div class="container">
        <div class="row">
            <form action = "/admin-clean" method = "post" class="form-group" style="margin:20px auto;max-width:400px;width:90%">

                <input type = "hidden" name = "_token" value = "<?php echo csrf_token(); ?>">
                <input type="hidden" name="id" value="<?=$id?>">
                
                <div class="form-group">
                    <label>Service Name:</label>
                    <input type="text" class="form-control" placeholder="Service name" name="name" value="<?=$strName?>" required>
                </div>
                <!--
                <div class="form-group">
                    <label>Image File:</label>
                    <input type="text" class="form-control" placeholder="Image file" name="image_file" value="<?//=$strImageFile?>">
                </div>
                -->
                
                <div class="form-group">
                <label>Category:</label>
                    <select class="form-control" name="category">
                        @foreach($categories as $category)
                            @if($strCategoryId == $category->id)
                                <option value="{{ $category->id }}" selected>{{$category->category_name}}</option>
                            @else
                                <option value="{{ $category->id }}">{{$category->category_name}}</option>
                            @endif
                        @endforeach
                    </select>
                </div>
                
                <div class="form-group">
                    <label>Cost:</label>
                    <input type="text" class="form-control" placeholder="Cost" name="cost" value="<?=$strCost?>" required>
                </div>
                
                <div class="form-group">
                    <label>Cost Label:</label>
                    <input type="text" class="form-control" placeholder="Service label" name="cost_label" value="<?=$strCostLabel?>" required>
                </div>
                
                <button type="submit" class="btn btn-primary">Submit</button>
                <button class="btn btn-secondary" onclick="window.history.back();return false">Cancel</button>
            </form>
        </div>
    </div>
    
</body>
</html>