%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/silvzytp/dsr_code/resources/views/backend/member/pages/daily_data/
Upload File :
Create Path :
Current File : /home/silvzytp/dsr_code/resources/views/backend/member/pages/daily_data/form.blade.php

@extends('layouts.backend')
@section('title', $siteTitle)
@section('action')
    <button type="button" class="btn btn-sm btn-success submit-form-btn">Submit</button>
@endsection
@push('styles')

    <style>
        .append-btn button {
            width: 25px;
            height: 25px;
            text-align: center;
            line-height: 25px;
            border-radius: 50%;
            border: 0;
            font-size: 12px;
            color: #fff;
        }
    </style>
@endpush

@section('content')

    <div class="row">
        <div class="col-12">
            <form action="{{ isset($monthlyData) ? route('app.monthly-data.update', $monthlyData->id) : route('app.monthly-data.store') }}" method="POST" id="form" enctype="multipart/form-data">
                @csrf
                @isset($monthlyData)
                    @method('PUT')
                    <input name="manager_id" type="hidden" value="{{ $monthlyData->user_id }}">
                    <input name="data_id" type="hidden" value="{{ $monthlyData->id }}">
                @endisset

                <div class="ibox">
                    <div class="ibox-body">

                        <div class="row">
                            <div class="col-md-6 mb-2">
                                <div class="form-group" id="date_1">
                                    <label class="font-normal required">Revenue Date</label>
                                    <div class="input-group date">
                                        <span class="input-group-addon bg-white"><i class="fa fa-calendar"></i></span>
                                        <input class="form-control" name="revenue_date" value="{{ isset($monthlyData) ? date_formats($monthlyData->revenue_date,'m/d/Y') : '' }}" type="text" class="date" >
                                    </div>
                                    @error('revenue_date')
                                        <span class="text-danger">{{ $message }}</span>
                                    @enderror
                                </div>
                            </div>
                            @if (Auth::user()->role->slug == 'admin')
                                @php
                                    $managers = App\Models\User::where('role_id',3)->select('id','name')->get();
                                @endphp

                                <div class="col-md-6 mb-2">
                                    <x-form.selectbox name="manager" error="manager" onchange="manager_select(this.value)" labelName="Manager" >
                                        <option value="">-- Select Manager --</option>
                                        @forelse ($managers as $manager)
                                            <option value="{{ $manager->id }}" @isset($monthlyData) {{ $monthlyData->user_id == $manager->id ? 'selected' : "" }} @endisset>{{ $manager->name }}</option>
                                        @empty

                                        @endforelse
                                    </x-form.selectbox>
                                </div>

                                <div class="col-md-6 mb-2">
                                    <x-form.selectbox name="agent_name" required="required" error="agent_name" labelName="Agent Name" >

                                    </x-form.selectbox>
                                </div>
                            @else
                                @php
                                    $agents = DB::table('users')->where('manager_id',Auth::id())->get();
                                @endphp
                                <div class="col-md-6 mb-2">
                                    <x-form.selectbox name="agent_name" required="required" error="agent_name" labelName="Agent Name" >
                                        <option value="">-- Select Agent --</option>
                                        @forelse($agents as $agent)
                                        <option value="{{ $agent->name }}" @isset($monthlyData) {{ $monthlyData->agent_name == $agent->name ? 'selected' : '' }} @endisset>{{ $agent->name }}</option>
                                        @empty

                                        @endforelse
                                    </x-form.selectbox>
                                </div>
                            @endif

                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="sale_achievment" labelName="Sale Achievment" value="{{ $monthlyData->sale_achievment ?? old('sale_achievment') }}" error="sale_achievment"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="revenue_achievment" labelName="Revenue Achievment"  value="{{ $monthlyData->revenue_achievment ?? old('revenue_achievment') }}" error="revenue_achievment"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="s_media_lead" labelName="Social Media Leads"  value="{{ $monthlyData->s_media_lead ?? old('s_media_lead') }}" error="s_media_lead"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="dj_lead" labelName="Dj Leads"  value="{{ $monthlyData->dj_lead ?? old('dj_lead') }}" error="dj_lead"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="telesale_l" labelName="Telesales Lead"  value="{{ $monthlyData->telesale_l ?? old('telesale_l') }}" error="telesale_l"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="c_caling_l" labelName="Cold Calling Leads "  value="{{ $monthlyData->c_caling_l ?? old('c_caling_l') }}" error="c_caling_l"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="old_s_media_l" labelName="old Social Media Leads"  value="{{ $monthlyData->old_s_media_l ?? old('old_s_media_l') }}" error="old_s_media_l"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="meeting_attendance" labelName="Meeting Attendance "  value="{{ $monthlyData->meeting_attendance ?? old('meeting_attendance') }}" error="meeting_attendance"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox name="meeting_source" labelName="Meeting Source"  value="{{ $monthlyData->meeting_source ?? old('meeting_source') }}" error="meeting_source"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="n_of_deal" labelName="Number of Deals"  value="{{ $monthlyData->n_of_deal ?? old('n_of_deal') }}" error="n_of_deal"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="n_of_call" labelName="Number of Calls  "  value="{{ $monthlyData->n_of_call ?? old('n_of_call') }}" error="n_of_call"/>
                            </div>
                            <div class="col-md-6 mb-2">
                                <x-form.inputbox type="number" name="connected_call" labelName="Connected Calls"  value="{{ $monthlyData->connected_call ?? old('connected_call') }}" error="connected_call"/>
                            </div>
                            <div class="col-md-6">
                                <x-form.inputbox name="remark" labelName="Remark"  value="{{ $monthlyData->remark ?? old('remark') }}" error="remark"/>
                            </div>
                            <div class="col-md-6 text-right">
                                <button type="button" class="btn btn-sm btn-success submit-form-btn">Submit</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>

@endsection

@push('scripts')
    <script>
        // Bootstrap datepicker
        $('#date_1 .input-group.date').datepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            autoclose: true,
            endDate: '-0d'
        });

        @if (Auth::user()->role->slug == 'admin')
            // manager by agent
            function manager_select(manager_id){
                if (manager_id != '') {
                    $.ajax({
                        url: '{{ route("app.monthly-data.manager.select") }}',
                        type: 'POST',
                        data:{_token:_token,manager_id:manager_id},
                        dataType: 'JSON',
                        cache: false,
                        success: function(response){
                            $('select#agent_name').html(response);
                        },
                        error: function(error){
                            console.log(error);
                        }
                    });
                }
            }

            @isset($monthlyData)
                function agent_selected(){
                    $.ajax({
                        type: "POST",
                        url: "{{ route('app.monthly-data.agent.select') }}",
                        data: {_token:_token,manager_id:$('input[name="manager_id"]').val(),data_id:$('input[name="data_id"]').val()},
                        dataType: "json",
                        success: function (response) {
                            if (response) {
                                $('select#agent_name').append(response);
                            }
                        }
                    });
                }
                agent_selected()
            @endisset
        @endif

    </script>
@endpush


Zerion Mini Shell 1.0