HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //var/www/html/owlcrm/resources/views/users/project/edit.blade.php
@extends('adminlte::page')

@section('title', 'Dashboard')

@section('content_header')
    <h1>Project</h1>
    <small>Manage Project</small>
@stop

@section('content')
    <div class="card card-dark">
        <div class="card-header">
            <h3 class="card-title"> Edit Project</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_leads" role="form" action="{{ route('project.update', $project->id) }}"
            class="jqueryValidation">
            @csrf
            @method('PATCH')

            <div class="card-body">
                <div class="form-group">
                    <label for="company">Company</label>
                    <select class="form-control" name="company_id" id="" required>
                        @foreach ($companies as $company)
                            <option value="{{ $company->id }}"
                                {{ $project->company_id == $company->id ? 'selected' : '' }}>
                                {{ $company->name }}
                            </option>
                        @endforeach
                    </select>
                </div>
                <div class=" form-group">
                    <label for="title">Title</label>
                    <x-adminlte-input class="form-control" id="title" name="title" placeholder="Enter Title"
                        value="{{ $project->title }}" required />
                </div>
                <div class=" form-group">
                    <label for="description">Description</label>
                    <textarea class="form-control" id="description" name="description" rows="4" placeholder="Enter Description"
                        required>{{ old('description', $project->description) }}</textarea>
                </div>
                <div class="form-group">
                    <label for="user">User</label>
                    <select class="form-control" name="user_id" required>
                        <option value="">--Select--</option>
                        @foreach ($users as $user)
                            <option
                                value="{{ $user->id }}"{{ $user_project->contains('user_id', $user->id) ? 'selected' : '' }}>
                                {{ $user->first_name . ' ' . $user->last_name }}
                            </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 }}"{{ $project_amenities->contains('amenity_id', $amenity->id) ? 'selected' : '' }}>
                                {{ $amenity->title }}
                            </option>
                        @endforeach
                    </select>
                </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 }}"{{ $project->nature == $key ? 'selected' : '' }}>
                                {{ $property_natures }}</option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group">
                    <label for=" start_date">Start Date</label>
                    <x-adminlte-input type="date" class="form-control" id="start_date" name="start_date"
                        placeholder="Enter Start Date"
                        value="{{ old('start_date', $project->start_date ? \Carbon\Carbon::parse($project->start_date)->format('Y-m-d') : '') }}"
                        required />
                </div>
                <div class="form-group">
                    <label for="address_line_1"> Adress Line 1 </label>
                    <x-adminlte-input type=" form-control " class="form-control" id="address_line_1" name="address_line_1"
                        placeholder="Enter Adress Line 1" value="{{ $project->address_line_1 }}" required />
                </div>
                <div class="form-group">
                    <label for="address_line_2"> Adress Line 2 </label>
                    <x-adminlte-input type=" form-control " class="form-control" id="address_line_2" name="address_line_2"
                        placeholder="Enter Adress Line 2" value="{{ $project->address_line_2 }}" />
                </div>
                <div class="form-group">
                    <label for="country">Select your Country</label>
                    <select name="country" id="country" class="form-control select2" required>

                        @foreach ($countries as $key => $value)
                            <option value="{{ $value->id }}" {{ $project->country == $value->id ? 'selected' : '' }}>
                                {{ $value->name }}
                            </option>
                        @endforeach
                    </select>
                </div>

                <div class="form-group">
                    <label for="state">Select your State</label>
                    <select name="state" id="state" class="form-control select2" required>
                        @foreach ($states as $state)
                            <option value="{{ $state->id }}" {{ $project->state == $state->id ? 'selected' : '' }}>
                                {{ $state->name }}
                            </option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group">
                    <label for="city">Select your City</label>
                    <select name="city" id="city" class="form-control select2" required>
                        @foreach ($cities as $city)
                            <option value="{{ $city->id }}" {{ $project->city == $city->id ? 'selected' : '' }}>
                                {{ $city->name }}
                            </option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group">
                    <label for="postal_code"> Postal Code </label>
                    <x-adminlte-input type=" form-control " class="form-control" id="postal_code" name="postal_code"
                        placeholder="Enter Postal Code" value="{{ $project->postal_code }}" required />
                </div>
                <div class="form-group">
                    <label for="tags">Tags </label>
                    <input type="text" name="input" class="form-control" value="{{ $project->tags }}" required>
                </div>

                <div class="form-group">
                    <input type="checkbox" id="is_active" name="is_active" value="1"
                        {{ $project->status == '1' ? 'checked' : '' }}>
                    <label for="is_active">Is Active</label>
                </div>

                <div class="card-footer d-flex justify-content-end">
                    <a href="{{ route('project.index') }}" class="btn btn-danger mx-1">Cancel</a>
                    <button type="submit" class="btn btn-dark mx-1">Update</button>
                </div>
        </form>
    </div>

    @push('js')
        {{-- country-state-city --}}
        <script type="text/javascript">
            $(document).ready(function() {

                //Initialize Select2 Elements
                $('.select2').select2();


                $('select[name="country"]').on('change', function() {
                    // alert(" {{ url('/getStates') }} / + country_id ");
                    var country_id = $(this).val();
                    // alert("{{ '/getStates' }}/" + country_id);

                    if (country_id) {
                        $.ajax({
                            url: "{{ '/getStates' }}/" + country_id,
                            type: "GET",
                            dataType: "json",
                            success: function(data) {
                                console.log(data);
                                $('select[name="state"]').empty();
                                $.each(data, function(key, value) {
                                    $('select[name="state"]').append(
                                        '<option value="' +
                                        key + '">' + value + '</option>');
                                });
                            }
                        });
                    } else {
                        $('select[name="state"]').empty();
                    }
                });
                $('select[name="state"]').on('change', function() {
                    var state_id = $(this).val();
                    if (state_id) {
                        $.ajax({
                            url: "{{ '/getCities' }}/" + state_id,
                            type: "GET",
                            dataType: "json",
                            success: function(data) {
                                console.log(data);
                                $('select[name="city"]').empty();
                                $.each(data, function(key, value) {
                                    $('select[name="city"]').append('<option value="' +
                                        key + '">' + value + '</option>');
                                });
                            }
                        });
                    } else {
                        $('select[name="city"]').empty();
                    }
                });
            });
            // {{-- End country-state-city --}}
            // tags
            $(document).ready(function() {
                $('input[name="input"]').tagsinput({
                    trimValue: true,
                    confirmKeys: [13, 44, 32]
                });

                $('.bootstrap-tagsinput input').on('focus', function() {
                    $(this).closest('.bootstrap-tagsinput').addClass('has-focus');
                }).on('blur', function() {
                    $(this).closest('.bootstrap-tagsinput').removeClass('has-focus');
                });
            });
            // End-tags
        </script>
    @endpush
@stop