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 :  /proc/thread-self/root/home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/area/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/area/create.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;
            }

        }
      </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">Add Area</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">Area</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="addModel" type="POST">
                                    @csrf
                                    <h4 class="card-title">Add Area</h4>
                                    @include('backend.layout.verror_message')
                                    <div class="form-group row">
                                        <label for="address" class="col-sm-3 text-right control-label col-form-label">Region</label>
                                        <div class="col-sm-9 error_select">
                                            <select name="region" class="form-control select2">
                                                <option value="">Select</option>
                                                @foreach($regions as $region)
                                                   <option value="{{$region->region_id}}">{{$region->region_name}}</option>
                                                @endforeach

                                            </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</option>
                                                @foreach($divisions as $division)
                                                   <option value="{{$division->division_id}}">{{$division->division_name}}</option>
                                                @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="">Select</option>


                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="com1" class="col-sm-3 text-right control-label col-form-label">Area Name</label>
                                        <div class="col-sm-6">
                                            <input name="area_name" type="text" class="form-control" id="com1" placeholder="Area Name">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="product_price" class="col-sm-3 text-right control-label col-form-label"></label>
                                        <div class="col-sm-9">
                                            <div class="custom-control custom-checkbox" id="">
                                                <input value="1" name="status" checked="" type="checkbox" class="custom-control-input" id="status" >
                                                <label class="custom-control-label" for="status">Staus</label>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group mb-0 text-right">
                                        <button type="submit" class="btn btn-info waves-effect waves-light">Save</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')
            <script src="{{ asset('public/backend/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);
                            }
                        });
                    }
                    $(document).ready(function(){
                    $('.select2').select2();
                    //validation and add data

                    $("#addModel").validate({

                        rules:
                       {
                            region: {
                                required: true,

                            },
                            division: {
                                required: true,

                            },
                            district: {
                                required: true,

                            },
                            area_name: {
                                required: true,
                                maxlength: 150,
                            },


                       },
                        submitHandler: submitForm
                      });


                       function submitForm()
                        {


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


                            $.ajax({

                                type : 'POST',
                                url  : "{{url('new_area')}}",
                                data : data1,
                                dataType : 'json',
                                success :  function (data)
                                {
                                    //console.log(data);
                                    if(data.errors=='0'){
                                        $('.alert-success').show();
                                        $('.alert-danger').hide();
                                        $('.alert-success').html('<p>'+data.success+'</p>');
                                        $("#com1").val('');
                                    }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;
                        }

                    //end validation and add data
                     });
                </script>
            @endsection

VaKeR 2022