File: /var/www/kosmicfarms/resources/views/productions/edit.blade.php
@extends('layouts.app')
@section('content')
<div class="d-sm-flex align-items-center justify-content-between mg-b-20 mg-lg-b-25 mg-xl-b-30">
<div>
<nav aria-label="breadcrumb">
<ol class="breadcrumb breadcrumb-style1 mg-b-10">
<li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
<li class="breadcrumb-item"><a href="{{ url('/') }}">Home</a></li>
<li class="breadcrumb-item"><a href="#">Productions</a></li>
</ol>
</nav>
<h4 class="mg-b-0 tx-spacing--1">Edit Production</h4>
</div>
<div class="d-none d-md-block">
<a href="{{ url('/production/'.$production->id.'/show') }}" class="btn btn-sm pd-x-15 btn-white btn-uppercase"><i data-feather="mail" class="wd-10 mg-r-5"></i> View</a>
<a href="{{ url('/production/'.$production->id.'/sensors/create') }}" class="btn btn-sm pd-x-15 btn-white btn-uppercase"><i data-feather="mail" class="wd-10 mg-r-5"></i> Add Sensor</a>
</div>
</div>
<!-- ============================================================== -->
<!-- Content Start -->
<!-- ============================================================== -->
<div data-label="Example" class="df-example demo-forms">
<h4 id="section2" class="mg-b-10">Edit Production</h4>
<p class="mg-b-30">Edit Production information.</p>
@if ($errors->any())
@foreach ($errors->all() as $error)
<div class="alert bg-danger alert-dismissible " role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Error!</strong> {{ $error }} </div>
@endforeach
@endif
@if(session('success'))
<div class="alert bg-success alert-dismissible " role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Success!</strong> Category successfully updated. </div>
@endif
<div class="row">
<div class="col">
<form method="post" action="{{ url('/production/'.$production->id.'/update') }}" class="form-horizontal">
{!! csrf_field() !!}
<div class="form-group">
<label class="d-block">Main Category</label>
{{ Form::select('category', $categories, old('category', $production->category_id), array('class' => 'form-control m-b')) }}
</div>
<div class="form-group">
<label class="d-block">Main Product Type</label>
{{ Form::select('producttype', $producttypes, old('producttype', $production->product_type_id), array('class' => 'form-control m-b')) }}
</div>
<div class="form-group">
<label class="d-block">Name</label>
<input name="name" type="text" placeholder="New product name" value="{{ old('name', $production->name) }}" required="required" class="form-control form-control-rounded">
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label class="d-block">Start Date</label>
<input name="startdate" type="text" value="{{ old('startdate', $production->startdate) }}" class="form-control" required="required">
</div>
<div class="form-group col-md-6">
<label class="d-block">Maturity</label>
<input name="maturity" type="text" value="{{ old('quantity', $production->maturity) }}" class="form-control form-control-rounded">
</div>
</div>
<div class="form-group">
<label class="d-block">Description</label>
<textarea class="form-control " name="description">{{ old('description', $production->description) }}</textarea>
</div>
<div data-label="Production Details" class="df-example demo-forms">
@if(isset($production->producttype))
@foreach($production->producttype->options as $option)
<div class="form-group">
<label class="d-block">{{ $option->name }}</label>
@php
$input_name = "pruduction_option_".$option->id;
@endphp
<input name="{{ $input_name }}" type="text"
@if(isset($option->value->value))
value="{{ old(''.$input_name, $option->value->value) }}"
@else
value="{{ old(''.$input_name) }}"
@endif
class="form-control form-control-rounded">
</div>
@endforeach
@endif
</div>
<button type="submit" class="btn btn-success btn-icon"><i class="fa fa-floppy-o "></i>Update</button>
<a href="{{ URL::previous() }}" class="btn btn-warning btn-icon"><i class="fa fa-reply"></i>Back</a>
</form>
</div>
</div>
</div>
@endsection
@section('jscript')
<script type="text/javascript">
$(document).ready(function() {
});
</script>
@endsection