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/customer/ |
Upload File : |
@extends('backend.layout.app') @section('content') <!-- ============================================================== --> <!-- 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">Customer Edit</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">Customer</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="addCustomer"> @csrf <h4 class="card-title">Edit Customer</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">Customer Type</label> <div class="col-sm-9 error_select"> <input type="hidden" name="customer_id" value="{{$customer->customer_id}}"> <select name="customer_type" class="form-control"> <option value="">Select</option> @foreach($customer_type as $customer_type) @if($customer_type->customer_type_id == $customer->customer_type_id) <option selected="" value="{{$customer_type->customer_type_id}}">{{$customer_type->customer_type_name}}</option> @else <option value="{{$customer_type->customer_type_id}}">{{$customer_type->customer_type_name}}</option> @endif @endforeach </select> </div> </div> <div class="form-group row"> <label for="name" class="col-sm-3 text-right control-label col-form-label">Customer Name</label> <div class="col-sm-9"> <input type="text" name="customer_name" class="form-control" id="name" value="{{$customer->customer_name}}" placeholder="Customer Name "> </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="{{$customer->customer_address}}" name="customer_address" type="text" class="form-control" id="address" placeholder="Address"> </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="{{$customer->customer_email}}" name="customer_email" id="email" type="text" class="form-control" id="com1" placeholder="Email"> </div> </div> <div class="form-group row"> <label for="phone" class="col-sm-3 text-right control-label col-form-label">Phone</label> <div class="col-sm-9"> <input value="{{$customer->customer_phone}}" name="customer_phone" type="text" class="form-control" id="phone" placeholder="Phone"> </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="{{$customer->customer_mobile}}" name="customer_mobile" type="text" class="form-control" id="customer_mobile" placeholder="Mobile"> </div> </div> <div class="form-group row"> <label for="phone" class="col-sm-3 text-right control-label col-form-label">Website</label> <div class="col-sm-9"> <input value="{{$customer->customer_website}}" name="customer_website" type="text" class="form-control" id="customer_website" placeholder="Website"> </div> </div> <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 id="region" name="region" class="form-control select2" style="width:100%"> <option value="">Select Region</option> @foreach($regions as $region) @if($region->region_id == $customer->region_id) <option selected="" value="{{$region->region_id}}">{{$region->region_name}}</option> @else <option value="{{$region->region_id}}">{{$region->region_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">Division</label> <div class="col-sm-9 error_select"> <select onchange="get_district();" id="division" name="division" class="form-control select2" style="width:100%"> <option value="">Select Division</option> @foreach($divisions as $division) @if($division->division_id == $customer->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 onchange="get_area();" id="district" name="district" class="form-control select2" style="width:100%"> <option value="0">Select District</option> @if($customer->district_id > 0) @foreach($districts as $district) } @if($district->district_id == $customer->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 row"> <label for="address" class="col-sm-3 text-right control-label col-form-label">Area</label> <div class="col-sm-9 error_select"> <select id="area" name="area" class="form-control select2" style="width:100%"> <option value="0">Select Area</option> @if($customer->area_id > 0) @foreach($areas as $area) } @if($area->area_id == $customer->area_id) <option selected="" value="{{$area->area_id}}">{{$area->area_name}}</option> @else <option value="{{$area->area_id}}">{{$area->area_name}}</option> @endif @endforeach @endif </select> </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" @if($customer->status == 1) checked="" @endif 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="{{url('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> $('.select2').select2(); function get_area(){ var id=$('#district').val(); //console.log("{{url('get_productById')}}/"+id); $.ajax({ type : 'POST', url : "{{url('admin/get_all_area_by_id')}}", data:{district_id:id}, dataType: 'json', success : function (data) { //var d=JSON.parse(data); var color="<option>Select Area</option>"; $.each(data,function(){ color +="<option value='"+this.area_id+"'> "+this.area_name+" </option>"; }); // console.log(color); $('#area').html(color); }, error : function (data) { //console.log(data); } }); } function get_district(){ var id=$('#division').val(); //console.log("{{url('get_productById')}}/"+id); $.ajax({ type : 'POST', url : "{{url('admin/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); } }); } jQuery(document).ready(function(){ $("#addCustomer").validate({ rules: { customer_name: { required: true, maxlength: 150, }, customer_email: { email:true, maxlength: 150, }, customer_phone: { maxlength: 20, }, customer_address: { required: true, }, customer_mobile: { maxlength: 20, }, customer_type: { required: true, }, }, submitHandler: submitForm }); function submitForm() { var data = $("#addCustomer").serialize(); $.ajax({ type : 'POST', url : "{{url('admin/edit_customer')}}", data : data, dataType : 'json', success : function (data) { if(data.errors=='0'){ $('.alert-success').show(); $('.alert-danger').hide(); $('.alert-success').html('<p>'+data.success+'</p>'); window.location="{{url('admin/all_customer')}}"; //$("#addCustomer").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