File: /var/www/html/owlcrm/resources/views/users/properties/edit.blade.php
@extends('adminlte::page')
@section('title', 'Dashboard')
@section('content_header')
<h1>Properties</h1>
<small>Manage Properties</small>
@stop
@section('content')
<div class="card card-dark">
<div class="card-header">
<h3 class="card-title"> Edit Properties</h3>
</div>
@if (session('error'))
<h6 class="alert alert-danger">
{{ session('error') }}
</h6>
@endif
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form method="POST" id="edit_properties" role="form" action="{{ route('properties.update', $property->id) }}"
class="jqueryValidation">
@csrf
@method('PATCH')
<div class="card-body">
<div class=" form-group">
<label for="name">Name</label>
<x-adminlte-input class="form-control" id="name" name="name" placeholder="Enter Name"
value="{{ $property->name }}" required />
</div>
<div class=" form-group">
<label for="nature">Nature</label>
<select name="nature" id="nature" class="form-control" required>
<option value="">--Select--</option>
@foreach (App\Models\Property::property_natures as $key => $property_natures)
<option value="{{ $key }}"{{ $property->nature == $key ? 'selected' : '' }}>
{{ $property_natures }}</option>
@endforeach
</select>
</div>
<div class=" form-group">
<label for="type">Type</label>
<select name="type" id="type" class="form-control" required>
<option value="">--Select--</option>
@foreach (App\Models\Property::property_types as $key => $property_types)
<option value="{{ $key }}"{{ $property->type == $key ? 'selected' : '' }}>
{{ $property_types }}</option>
@endforeach
</select>
</div>
<div class=" form-group">
<label for="description">Description</label>
<textarea class="form-control" id="description" name="description" rows="4" placeholder="Enter Description"
required>{{ $property->description }}</textarea>
</div>
<div class=" form-group">
<label for="location">Location</label>
<x-adminlte-input class="form-control" id="location" name="location" placeholder="Enter Location"
value="{{ $property->location }}" required />
</div>
<div class="form-group">
<label for="project">Project</label>
<select class="form-control" name="project_id" id="" required>
<option value="">--Select--</option>
@foreach ($projects as $project)
<option
value="{{ $project->id }}"{{ $property->project_id == $project->id ? 'selected' : '' }}>
{{ $project->title }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="amenity_id">Amenity</label>
<select class="form-control" name="amenity_id" id="amenity_id" required>
<option value="">--Select--</option>
@foreach ($amenities as $amenity)
<option value="{{ $amenity->id }}"
{{ in_array($amenity->id, $property_amenities) ? 'selected' : '' }}>
{{ $amenity->title }}
</option>
@endforeach
</select>
</div>
<div class="card-footer d-flex justify-content-end">
<a href="{{ route('properties.index') }}" class="btn btn-danger mx-1">Cancel</a>
<button type="submit" class="btn btn-dark mx-1">Update</button>
</div>
</form>
</div>
@stop