VaKeR CYBER ARMY
Logo of a company Server : Apache
System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : vapecompany ( 2719)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/employee/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/employee/edit.blade.php
@extends('backend.layout.app')
@section('content')
      <style type="text/css">
        @media only screen and (max-width: 600px) {
           .error_select label{
            position: absolute;
            top: 30px;
          }
          .select2-container{
                width:100%!important;
            }
        }
        @media only screen and (min-width: 768px) {
          .error_select label{
             position: absolute;
            left: 50%;
          }
          .select2-container{
                width:50%!important;
            }
            .dropdowndynamic{
                width:30%!important;
            }
        }
      </style>
        <!-- ============================================================== -->
        <!-- Page wrapper  -->
        <!-- ============================================================== -->
        <div class="page-wrapper">
            <!-- ============================================================== -->
            <!-- Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <div class="page-breadcrumb">
                <div class="row">
                    <div class="col-5 align-self-center">
                        <h4 class="page-title">Edit Employee</h4>
                        <div class="d-flex align-items-center">
                            <nav aria-label="breadcrumb">
                                <ol class="breadcrumb">
                                    <li class="breadcrumb-item"><a href="#">Home</a></li>
                                    <li class="breadcrumb-item active" aria-current="page"> Employee</li>
                                </ol>
                            </nav>
                        </div>
                    </div>

                </div>
            </div>
            <!-- ============================================================== -->
            <!-- End Bread crumb and right sidebar toggle -->
            <!-- ============================================================== -->
            <!-- ============================================================== -->
            <!-- Container fluid  -->
            <!-- ============================================================== -->
            <div class="container-fluid">
                <!-- ============================================================== -->
                <!-- Start Page Content -->
                <!-- ============================================================== -->
                <div class="row">
                    <div class="col-12">

                        <div class="card">
                            <div class="card-body">
                                <form id="addEmployee" type="POST">
                                    @csrf
                                    <h4 class="card-title">Edit Employee</h4>
                                    @include('backend.layout.verror_message')
                                    <div class="form-group row">
                                        <label for="name" class="col-sm-3 text-right control-label col-form-label">Employee Name</label>
                                        <div class="col-sm-9">
                                            <input type="hidden" name="employee_id" value="{{$employee->employee_id}}">
                                            <input type="text" name="employee_name" class="form-control" value="{{$employee->employee_name}}" id="name" placeholder="Employee Name ">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">Designation</label>
                                        <div class="col-sm-9 error_select">
                                             <select name="designation" class="form-control select2 ">
                                                   <option value="">Select</option>
                                                    @foreach($designations as $designation)
                                                    @if($employee->designation_id == $designation->designation_id)
                                                        <option selected="" value="{{$designation->designation_id}}">{{$designation->designation_name}}</option>
                                                        @else
                                                         <option value="{{$designation->designation_id}}">{{$designation->designation_name}}</option>
                                                        @endif
                                                    @endforeach
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">Department</label>
                                        <div class="col-sm-9 error_select">
                                            <select name="department" class="form-control select2">
                                                <option value="">Select</option>
                                                @foreach($departments as $department)
                                                @if($employee->department_id == $department->department_id)
                                                   <option selected="" value="{{$department->department_id}}">{{$department->department_name}}</option>
                                                   @else
                                                    <option value="{{$department->department_id}}">{{$department->department_name}}</option>
                                                   @endif
                                                @endforeach

                                            </select>
                                        </div>
                                    </div>
                                     <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">Address</label>
                                        <div class="col-sm-9">
                                            <input value="{{$employee->employee_address}}" name="employee_address" type="text" class="form-control" id="address" placeholder="Address">
                                        </div>
                                    </div>
                                     <div class="form-group row">
                                        <label for="phone" class="col-sm-3 text-right control-label col-form-label">Mobile</label>
                                        <div class="col-sm-9">
                                            <input value="{{$employee->employee_phone}}" name="employee_phone" type="text" class="form-control" id="phone" placeholder="phone">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="email" class="col-sm-3 text-right control-label col-form-label">Email</label>
                                        <div class="col-sm-9">
                                            <input value="{{$employee->employee_email}}" name="employee_email" id="email" type="text" class="form-control" id="com1" placeholder="email">
                                        </div>
                                    </div>





                                    <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">User Type</label>
                                        <div class="col-sm-9 error_select">
                                             <select name="user_type" class="dropdowndynamic form-control">
                                                   <option @if($employee->user_type == 2) selected @endif value="2">User</option>
                                                   <option @if($employee->user_type == 1) selected @endif value="1">Admin</option>
                                                   <option @if($employee->user_type == 3) selected @endif value="3">Sales Man</option>

                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">Status</label>
                                        <div class="col-sm-9 error_select">
                                             <select name="emp_status" class="dropdowndynamic form-control">
                                                 <option @if($employee->emp_status == 1) selected @endif value="1">Current</option>
                                                   <option @if($employee->emp_status == 2) selected @endif value="2">Terminated</option>

                                                   <option @if($employee->emp_status == 3) selected @endif value="3">Resigned</option>

                                            </select>
                                        </div>
                                    </div>
                                     <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">Division</label>
                                        <div class="col-sm-9 error_select">
                                            <select onchange="get_district();" id="division" name="division" class="form-control select2">
                                                <option value="">Select Division</option>
                                                @foreach($divisions as $division)
                                                @if($division->division_id == $employee->division_id)
                                                    <option selected="" value="{{$division->division_id}}">{{$division->division_name}}</option>
                                                @else
                                                     <option value="{{$division->division_id}}">{{$division->division_name}}</option>
                                                @endif
                                                @endforeach


                                            </select>
                                        </div>
                                    </div>
                                     <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">District</label>
                                        <div class="col-sm-9 error_select">
                                            <select id="district" name="district" class="form-control select2">
                                                <option value="0">Select District</option>
                                                @if($employee->district_id > 0)
                                                 @foreach($districts as $district)
                                                }
                                                @if($district->district_id == $employee->district_id)
                                                    <option selected="" value="{{$district->district_id}}">{{$district->district_name}}</option>
                                                @else
                                                     <option value="{{$district->district_id}}">{{$district->district_name}}</option>
                                                @endif
                                                @endforeach
                                                @endif

                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group mb-0 text-right">
                                        <button type="submit" class="btn btn-info waves-effect waves-light">Update</button>
                                       <!--  <button type="submit" class="btn btn-dark waves-effect waves-light">Cancel</button> -->
                                    </div>

                                 </form>


                                </div>
                        </div>


                    </div>
                </div>
                <!-- ============================================================== -->
                <!-- End PAge Content -->
                <!-- ============================================================== -->
                <!-- ============================================================== -->
                <!-- Right sidebar -->
                <!-- ============================================================== -->
                <!-- .right-sidebar -->
                <!-- ============================================================== -->
                <!-- End Right sidebar -->
                <!-- ============================================================== -->
            </div>
            <!-- ============================================================== -->
            <!-- End Container fluid  -->
            @endsection
            @section('script')
            <style type="text/css">

            </style>
                <script src="{{url('/public/js/jquery.validate.min.js')}}"></script>
                <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
                <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
                <script>
                function get_district(){
                        var id=$('#division').val();
                            //console.log("{{url('get_productById')}}/"+id);
                        $.ajax({

                            type : 'POST',
                            url  : "{{url('get_all_district_by_id')}}",
                            data:{division_id:id},
                             dataType: 'json',
                            success :  function (data)
                            {

                                //var d=JSON.parse(data);

                                var color="<option>Select District</option>";
                                $.each(data,function(){

                                    color +="<option value='"+this.district_id+"'> "+this.district_name+" </option>";
                                });
                               // console.log(color);
                                $('#district').html(color);

                            },
                            error :  function (data)
                            {
                                //console.log(data);
                            }
                        });
                    }
                    $('.select2').select2();
                    jQuery(document).ready(function(){


                      $("#addEmployee").validate({

                        rules:
                       {
                            employee_name: {
                                required: true,
                                maxlength: 150,
                            },
                            employee_email: {
                                required: true,
                                maxlength: 150,
                            },
                             password: {
                                required: true,

                            },
                            employee_phone: {
                                required: true,
                                maxlength: 14,
                            },
                            employee_address: {
                                required: true,
                            },
                            department: {
                                required: true,
                            },
                            designation: {
                                required: true,
                            },

                       },
                        submitHandler: submitForm
                      });


                       function submitForm()
                        {


                            var data1 = $("#addEmployee").serialize();


                            $.ajax({

                                type : 'POST',
                                url  : "{{url('upate_employee')}}",
                                data : data1,
                                dataType : 'json',
                                success :  function (data)
                                {
                                    //console.log(data);
                                    if(data.errors=='0'){
                                        $('.alert-success').show();
                                        $('.alert-danger').hide();
                                        $('.alert-success').append('<p>'+data.success+'</p>');
                                        //$("#addEmployee").get(0).reset();
                                    }else{
                                         var val="";
                                        $.each(data.errors, function(key, value){
                                            $('.alert-danger').show();
                                            $('.alert-success').hide();
                                            val+= '<p>'+value+'</p>';

                                        });
                                        $('.alert-danger').html(val);
                                    }

                                },error: function(response) {
                                    //console.log(response);
                                }
                            });
                            return false;
                        }



                    });
                </script>
            @endsection

VaKeR 2022