@extends('layout.main')
@section('title','TechDms | Customer Views')
@section('content')
        <!-- main content start-->
<!-- main content start-->

<!-- main content start-->
<div id="page-wrapper">

    <div class="main-page">
        <a href="" class="pull-right uplode_tag"
           data-toggle="modal" data-target="#exampleModal"
           data-placement="top" title="Uplode Image"
           data-original-title="Tooltip on top">
            <span class="fa fa-upload" style="font-size: 25px !important;"></span>
        </a>

        <a href="/show-documents-lists" class="pull-left btn-view theme-btn2 btn btn-default"
           style="position: relative;margin-top:-1em">Go back</a>
        <h3 class="title1 text-center" style="position: relative;top:-0.5em">Customer Id: {{$cartegory}} </h3>
        @if(isset($images))
            <div class="row">
                @forelse($images as $image)
                    <div class="col-lg-3 col-md-3 col-xs-6">
                        <div class="col-lg-12  galler_preview ">
                            <img src="/gallery/{{$cartegory}}/{{$image->documents}}" class="img-responsive">
                        </div>
                        <div class="col-lg-12 text-center nopad">
                            <a href="/gallery/{{$cartegory}}/{{$image->documents}}"
                               class="btn btn-default theme-btn" download> <i class="fa fa-download"></i></a>
                            <a href="" id="{{$image->id}}" title="Delete Image"
                               data-original-title="Tooltip on top"
                               class="btn btn-danger theme-btn-delete delete-docs" download> <i
                                        class="fa fa-trash-o"></i></a>
                            {{--<iframe src="/storage/gallery/{{$cartegory}}/{{$file->documents}}"--}}
                            {{--class="img-responsive"></iframe>--}}
                        </div>
                        <div><br></div>
                    </div>

                @empty
                    <div class="col-lg-12">
                        <div class="col-lg-12 text-center ">
                            <span class="badge badge-danger"> No Record Found!</span>
                        </div>
                    </div>
                @endforelse

            </div>
        @endif

        @if(isset($docs))
            <div class="row">
                @forelse($docs as $doc)

                    <div class="col-lg-2 col-md-2 col-xs-6">
                        <div class="col-lg-12 text-center widget-shadow" style="padding: 10px;">
                            @if($doc->extension=='pdf')
                                <img src="/images/ext/pdf.svg" class="preview-size">
                            @elseif($doc->extension=='doc')
                                <img src="/images/ext/doc.svg" class="preview-size">
                            @elseif($doc->extension=='docx')
                                <img src="/images/ext/docx-file-format.svg" class="preview-size">
                            @elseif($doc->extension=='xls')
                                <img src="/images/ext/xls.svg" class="preview-size">
                            @elseif($doc->extension=='xlsx')
                                <img src="/images/ext/excel.svg" class="preview-size">
                            @elseif($doc->extension=='txt')
                                <img src="/images/ext/txt.svg" class="preview-size">
                            @else
                                <img src="/images/ext/csv.svg" class="preview-size">
                            @endif

                        </div>
                        <div class="col-lg-12 text-center nopad">
                            <a href="/gallery/{{$cartegory}}/{{$doc->documents}}" title="Downlode File"
                               data-original-title="Tooltip on top"
                               class="btn btn-default theme-btn" download> <i class="fa fa-download"></i></a>
                            <a href="" id="{{$doc->id}}" title="Delete Image"
                               data-original-title="Tooltip on top"
                               class="btn btn-danger theme-btn-delete delete-docs" download> <i
                                        class="fa fa-trash-o"></i></a>
                            {{--<iframe src="/storage/gallery/{{$cartegory}}/{{$file->documents}}"--}}
                            {{--class="img-responsive"></iframe>--}}
                            <div><br></div>
                        </div>

                    </div>


                @empty
                    <div><br></div>
                    <div class="col-lg-12">
                        <div class="col-lg-12 text-center ">
                            <span class="badge badge-danger"> No Record Found!</span>
                        </div>
                    </div>
                @endforelse

            </div>
        @endif

        @if(isset($files))
            <div class="row">
                @forelse($files as $file)
                    <div class="col-lg-2 col-md-2 col-xs-6">
                        <div class="col-lg-12 text-center widget-shadow" style="padding: 10px;">
                            @if($file->extension=='zip')
                                <img src="/images/ext/zip.svg" class="preview-size">
                            @elseif($file->extension=='rar')
                                <img src="/images/ext/rar.svg" class="preview-size">
                            @else
                                <img src="/images/ext/psd.svg" class="preview-size">
                            @endif
                            {{--<iframe src="/storage/gallery/{{$cartegory}}/{{$file->documents}}"--}}
                            {{--class="img-responsive"></iframe>--}}
                        </div>
                        <div class="col-lg-12 text-center nopad">
                            <a href="/gallery/{{$cartegory}}/{{$file->documents}}"
                               class="btn btn-default theme-btn" download> <i class="fa fa-download"></i></a>
                            <a href="" id="{{$file->id}}" title="Delete Image"
                               data-original-title="Tooltip on top"
                               class="btn btn-danger theme-btn-delete delete-docs" download> <i
                                        class="fa fa-trash-o"></i></a>
                            {{--<iframe src="/storage/gallery/{{$cartegory}}/{{$file->documents}}"--}}
                            {{--class="img-responsive"></iframe>--}}
                            <div><br></div>
                        </div>
                        <div><br></div>
                    </div>

                @empty
                    <div class="col-lg-12">
                        <div class="col-lg-12 text-center ">
                            <span class="badge badge-danger"> No Record Found!</span>
                        </div>
                    </div>

                @endforelse

            </div>
        @endif

    </div>

</div>


{{--uplode gallery update--}}

        <!-- Modal -->
<div class="modal uplode-modal" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">@if(isset($images)) Image Update @elseif(isset($docs))
                        Document update @else File Update  @endif </h5>
                <button type="button" class="close" data-dismiss="modal" style="position: relative;top:-1em;"
                        aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form name="update_docs" method="post" action="" enctype="multipart/form-data">
                <div class="modal-body">
                    <div class="row">
                        <input type="hidden" value="{{$doc_ID}}" id="doc_id">
                        @if(isset($images))
                            <div class="col-sm-12 nopad">

                                <div class="btn btn-default btn btn-file center-block">
                                    <i class="fa fa-paperclip"></i> Attach Image
                                    <input type="file" name="attachment_photos[]" id="attachment_photos"
                                           {{--onchange="this.form.submit()"--}}
                                           multiple>
                                </div>
                                <div class="col-lg-12"><br></div>
                                <div class="col-lg-12 nopad" id="preview_photos">

                                </div>
                            </div>

                        @elseif(isset($docs))
                            <div class="col-sm-12 nopad">

                                <div class="btn btn-default btn btn-file center-block">
                                    <i class="fa fa-paperclip"></i> Attach Doc &nbsp;&nbsp;&nbsp;
                                    <input type="file" name="attachment_doc[]" id="attachment_doc" multiple>
                                </div>
                                <div class="col-lg-12"><br></div>
                                <div class="col-lg-12 nopad" id="preview_doc">


                                </div>

                            </div>

                        @else
                            <div class="col-sm-12 nopad">

                                <div class="btn btn-default btn btn-file center-block">
                                    <i class="fa fa-paperclip"></i> Attach File &nbsp;&nbsp;&nbsp;
                                    <input type="file" name="attachment_files[]" id="attachment_files" multiple>
                                </div>
                                <div class="col-lg-12"><br></div>
                                <div class="col-lg-12 nopad" id="preview_files"></div>

                            </div>

                        @endif

                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary update_document">Save changes</button>
                </div>
            </form>
        </div>
    </div>
</div>


{{--loading cotent--}}
<div class="modal" id="loading" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

            <div class="modal-body text-center">
                <img src="/images/loading.gif" style="width:20%;" class="center-block">
                <span class="badge badge-warning">Please Wait</span>
            </div>

        </div>
    </div>
</div>
<!--footer-->
@endsection