%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/crm-ind-code/resources/views/backend/pages/calling/
Upload File :
Create Path :
Current File : //home/silvzytp/crm-ind-code/resources/views/backend/pages/calling/form.blade.php

@extends('layouts.backend')
@section('title', $siteTitle)
@push('styles')

@endpush

@section('content')

    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">{{ $siteTitle }}</h4>
                </div>
                <div class="card-body">
                    <form action="{{ isset($calling) ? Auth::user()->role->slug == 'agent' ? route('app.callings.agent.update', $calling->id) : route(routeName().'.callings.update', $calling->id) : route(routeName().'.callings.store') }}" method="POST">
                        @csrf
                        @isset($calling)
                            @method('PUT')
                        @endisset
                        @php
                            if (Auth::user()->role->slug == 'agent'){
                                $disabled = 'disabled';
                            }else{
                                $disabled = '';
                            }
                        @endphp
                        <div class="row">
                            <div class="col-6">
                                <div class="form-group">
                                    <label for="serial" class="required">Serial</label>
                                    <input type="text" class="form-control" name="serial" {{ $disabled }} value="{{ $calling->serial ?? old('serial') }}" id="serial">
                                    @error('serial')
                                        <span class="text-danger d-block">{{ $message }}</span>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label for="name" class="required">Name</label>
                                    <input type="text" class="form-control" {{ $disabled }} name="name" value="{{ $calling->name ?? old('name') }}" id="name">

                                    @error('name')
                                        <span class="text-danger d-block">{{ $message }}</span>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label for="email" class="required">Email</label>
                                    <input type="text" class="form-control" {{ $disabled }} name="email" value="{{ $calling->email ?? old('email') }}" id="email">

                                    @error('email')
                                        <span class="text-danger d-block">{{ $message }}</span>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label for="number_1" class="required">Number 1</label>
                                    <input type="text" class="form-control" {{ $disabled }} name="number_1" value="{{ $calling->number_1 ?? old('number_1') }}" id="number_1">

                                    @error('number_1')
                                        <span class="text-danger d-block">{{ $message }}</span>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label for="number_2">Number 2</label>
                                    <input type="text" class="form-control" {{ $disabled }} name="number_2" value="{{ $calling->number_2 ?? old('number_2') }}" id="number_2">

                                    @error('number_2')
                                        <span class="text-danger d-block">{{ $message }}</span>
                                    @enderror
                                </div>

                                <x-form.selectbox name="status" error="status" labelName="Status" required="required" onchange="selectStatus(this.value)">
                                    <option value="">-- Select Status --</option>
                                    @forelse ($statuses as $status)
                                        <option value="{{ $status->id }}" @isset($calling) {{ $status->id == $calling->status ? 'selected' : '' }} @endisset>{{ $status->name }}</option>
                                    @empty

                                    @endforelse
                                </x-form.selectbox>

                                <x-form.selectbox name="sub_status" labelName="Sub Status" required="required" error="sub_status">
                                    <option value="">-- Select Sub Status --</option>
                                </x-form.selectbox>
                                
                                <x-form.selectbox name="potential" labelName="Potential" error="potential">
                                    <option value="">-- Select Potential --</option>
                                    @foreach (POTENTIAL as $key=>$potential)
                                        <option value="{{ $key }}" @isset($calling) {{ $calling->potential == $key ? 'selected' : '' }} @endisset>{{ $potential }}</option>
                                    @endforeach
                                </x-form.selectbox>
                            </div>
                            <div class="col-6">
                                <div class="form-group">
                                    <label for="comment">Comment</label>
                                    <textarea type="text" class="form-control" rows="3" name="comment" id="comment">{{ $calling->comment ?? old('comment') }}</textarea>

                                    @error('comment')
                                        <span class="text-danger d-block">{{ $message }}</span>
                                    @enderror
                                </div>

                                <div class="form-group">
                                    <label for="time_of_calling">Time of Calling</label>
                                    <input type="text" class="form-control"  name="time_of_calling" value="{{ $calling->time_of_calling ?? old('time_of_calling') }}" id="time_of_calling">

                                    @error('time_of_calling')
                                        <span class="text-danger d-block">{{ $message }}</span>
                                    @enderror
                                </div>

                                <x-form.textarea name="follow_up_1" labelName="Follow up 1" value="{{ $calling->follow_up1 ?? old('follow_up_1') }}"></x-form.textarea>
                                <x-form.textarea name="follow_up_2" labelName="Follow up 2" value="{{ $calling->follow_up2 ?? old('follow_up_2') }}"></x-form.textarea>
                                <x-form.textarea name="follow_up_3" labelName="Follow up 3" value="{{ $calling->follow_up3 ?? old('follow_up_3') }}"></x-form.textarea>
                            </div>
                        </div>

                        <div class="text-right">
                            <button type="submit" class="btn btn-sm btn-success">Submit</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

@endsection

@push('scripts')
    <script>
        function selectStatus(status){
            $.ajax({
                type: "POST",
                url: "{{ route(routeName().'.callings.status.get-data') }}",
                data: {_token:_token,status:status},
                dataType: "JSON",
                success: function (response) {
                    $('select[name="sub_status"]').html('');
                    if (response) {
                        $('select[name="sub_status"]').html(response);
                    }
                }
            });
        }

        @isset($calling)
            function statusSelected(){
                $.ajax({
                    type: "POST",
                    url: "{{ route(routeName().'.callings.status.selected') }}",
                    data: {_token:_token,calling_id:{{ $calling->id }},status_id:{{ $calling->status }}},
                    dataType: "JSON",
                    success: function (response) {
                        if (response) {
                            $('select[name="sub_status"]').html(response);
                        }
                    }
                });
            }

            statusSelected();
        @endisset
    </script>
@endpush

Zerion Mini Shell 1.0