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/create.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"> Add 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="add_project" role="form" action="{{ route('project.store') }}" class="jqueryValidation">
            @csrf
            <div class="card-body">
                <div class="form-group">
                    <label for="company">Company</label>
                    <select class="form-control" name="company_id" id="" required>
                        <option value="">--Select--</option>
                        @foreach ($companies as $company)
                            <option value="{{ $company->id }}">{{ $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="{{ old('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"value="{{ old('description') }}" required></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->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 }}">
                                {{ $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 }}">{{ $property_natures }}</option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group">
                    <label for=" last_contacted">Start Date</label>
                    <x-adminlte-input type="date" class="form-control" id="start_date " name="start_date"
                        placeholder="Enter  Start Date" required :min="now()->toDateString()" />
                </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="{{ old('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="{{ old('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>
                        <option value="">Select Country</option>
                        @foreach ($countries as $key => $value)
                            <option value="{{ $value->id }}">{{ $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>
                        <option value="">Select State</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="city">Select your City</label>
                    <select name="city" id="city" class="form-control select2" >
                        <option value="">Select City</option>
                    </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="{{ old('postal_code') }}" required />
                </div>
                <div class="form-group">
                    <label for="tags">Tags </label>
                    <input type="text" name="input" class="form-control" placeholder="Add tags" required>
                </div>

                <div class="form-group">

                    <input type="checkbox" id="is_active" name="is_active" value="1" checked
                        {{ old('is_active') == 'on' ? '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">Submit</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,
                            url: "{{ route('states.get', '') }}/" + 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,
                            url: "{{ route('cities.get', '') }}/" + 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