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/document/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/document/create.blade.php
@extends('backend.layout.app')
@section('content')
<style type="text/css">

</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">Document Add</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">Document</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="addBrand">
                                    @csrf
                                    <h4 class="card-title">Add Document-({{$type}})</h4>
                                     @include('backend.layout.verror_message')
                                     <input type="hidden" name="type" value="{{$type}}">
                                     <input type="hidden" name="id" value="{{$id}}">
                                   <div class="row" id="fieldadd">
                                        <div class="col-sm-5">
                                            <div class="form-group ">
                                                <label for="com1" class=" text-right control-label col-form-label">Docuemnt Name</label>

                                            </div>
                                        </div>

                                        <div class="col-sm-5">
                                            <div class="form-group">
                                                <label class="text-right control-label col-form-label">Docuement</label>

                                            </div>
                                        </div>
                                        <div class="col-sm-2">

                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-5">
                                            <div class="form-group ">


                                                    <input name="document_name[]" type="text" class="form-control" id="com1" placeholder="Document Name">

                                            </div>
                                        </div>

                                        <div class="col-sm-5">
                                            <div class="form-group">

                                                    <div class="input-group mb-3">
                                                        <!-- <div class="input-group-prepend">
                                                            <span class="input-group-text">Upload</span>
                                                        </div> -->
                                                        <div class="custom-file">
                                                            <input name="document_file_name[]" type="file" class="custom-file-input" id="document_file_name0">
                                                            <label class="custom-file-label" for="document_file_name0" id="id_document_file_name0">Choose file</label>
                                                        </div>
                                                    </div>

                                            </div>
                                        </div>
                                        <!-- <div class="col-sm-2">
                                            <div class="form-group">

                                                <button onclick="closeCart('6-1')" data-repeater-delete="" class="btn btn-danger waves-effect waves-light form-group" type="button">
                                                    <i class="ti-close"></i>
                                                </button>
                                            </div>
                                        </div> -->
                                        <div class="col-sm-2">
                                            <div class="form-group">
                                                <button class="btn btn-success" type="button" onclick="addfield();"><i class="fa fa-plus"></i></button>
                                            </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>
                <script>
                    //add new field
                    function filechanges(arg){
                        console.log(arg.id);
                        console.log($('#id_'+arg.id));

                        $('#id_'+arg.id).text(arg.value);

                    }
                    var fieldid=1;
                    function addfield(){
                        var value='<div class="row" id="'+'field_id_'+fieldid+'">'+
                                        '<div class="col-sm-5"><div class="form-group "><input name="document_name[]" type="text" class="form-control" id="com1" placeholder="Document Name"></div></div><div class="col-sm-5"><div class="form-group"><div class="input-group mb-3"><div class="custom-file"><input name="document_file_name[]" onchange="filechanges(this);" type="file" class="custom-file-input" id="document_file_name'+fieldid+'"><label class="custom-file-label" id="id_document_file_name'+fieldid+'" for="document_file_name'+fieldid+'">Choose file</label></div></div></div></div><div class="col-sm-2"><div class="form-group"><button onclick="closeCart('+fieldid+')" data-repeater-delete="" class="btn btn-danger waves-effect waves-light form-group" type="button"><i class="ti-close"></i></button></div></div></div>';
                       $('#fieldadd').after(value);
                       fieldid++;
                    }
                    var b = window.location.pathname.split("/");
                                        console.log(b);
                                        var c = b.splice(1,1);
                                        console.log(c);
                                        var cs = b.splice(4);
                                        var d = b.join('/');
                                         console.log(d);
                    function closeCart(arg){
                        $('#field_id_'+arg).remove();
                    }
                    //close new filed

                    jQuery(document).ready(function(){


                      $("#addBrand").validate({
                        ignore: "",
                        rules:
                       {

                             'document_name[]': {
                                required: true,
                                maxlength: 150,
                            },
                            'document_file_name[]': {
                                required: true,
                            },


                       },
                       messages: {
                                'document_name[]': "Please Add Document Name",
                                'document_file_name[]': "Please Add Document File",
                            },
                        submitHandler: submitForm
                      });


                       function submitForm()
                        {

                            event.preventDefault();

                            var data = new FormData(document.getElementById('addBrand'));
                            $.ajax({

                                type : 'POST',
                                url  : "{{url('admin/new_document')}}",
                                data : data,
                                cache:false,
                                contentType: false,
                                processData: false,
                                success :  function (data)
                                {
                                    console.log(data);
                                    if(data.errors=='0'){
                                        $('.alert-success').show();
                                        $('.alert-danger').hide();
                                        $('.alert-success').append('<p>'+data.success+'</p>');
                                        $("#addBrand").get(0).reset();
                                        var b = window.location.pathname.split("/");
                                        console.log(b);
                                        //var c = b.splice(1,1);
                                        console.log(c);
                                        var cs = b.splice(4);
                                        var d = b.join('/');
                                         console.log(d);
                                        //  window.location.href="{{url('/')}}"+d;
                                    }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