@extends('template.app')

@section('meta')
@endsection

@section('title')
   Create Notice
@endsection

@section('styles')
<link href="{{ asset('assets/css/dropify.min.css') }}" rel="stylesheet">
<link href="{{ asset('assets/css/sweetalert2.bundle.css') }}" rel="stylesheet">
<style>
     .col-sm-3{
        font-size: 15px;
    }
    .form-control{
        height: 30px;
    }
</style>
@endsection

@section('content')
<div class="page-breadcrumb">
    <div class="row">
        <div class="col-7 align-self-center">
            <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">Notice</h4>
            <div class="d-flex align-items-center">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb m-0 p-0">
                        <li class="breadcrumb-item"><a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a></li>
                     
                        <li class="breadcrumb-item text-muted active" aria-current="page">Create Notice</li>
                    </ol>
                </nav>
            </div>
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <form action="{{ route('notice.save') }}" name="form" id="form" method="post" enctype="multipart/form-data">
                        @csrf
                        @method('POST')
                        
                      @if(session('message'))
    <div class="alert alert-success">
        {{ session('message') }}
    </div>
@endif

                        <div class="column-layout">
                            <div class="form-group col-sm-5">
                                <label for="password">Notice</label>
                                <input type="test" name="title" class="form-control" placeholder="Please enter title" required>
                                <span class="kt-form__help error password"></span>
                            </div>
                         </div>
                        <div class="form-group">
                            <button type="submit" class="btn waves-effect waves-light btn-sm btn-rounded btn-outline-primary">Submit</button>
                            <a href="{{ route('dashboard') }}" class="btn waves-effect waves-light btn-sm btn-rounded btn-outline-secondary">Cancel</a>
                        </div>
                    </form>
            </div>
        </div>
    </div>
</div>
@endsection

@section('scripts')
<script src="{{ asset('assets/js/dropify.min.js') }}"></script>
<script src="{{ asset('assets/js/promise.min.js') }}"></script>
<script src="{{ asset('assets/js/sweetalert2.bundle.js') }}"></script>

<script>
   
</script>
<script>
    // $(document).ready(function(){
    //     $('.dropify').dropify({
    //         messages: {
    //             'default': 'Drag and drop profile image here or click',
    //             'remove':  'Remove',
    //             'error':   'Ooops, something wrong happended.'
    //         }
    //     });

    //     var drEvent = $('.dropify').dropify();

    //     var dropifyElements = {};
    //     $('.dropify').each(function () {
    //         dropifyElements[this.id] = false;
    //     });

    //     drEvent.on('dropify.beforeClear', function(event, element){
    //         id = event.target.id;
    //         if(!dropifyElements[id]){
    //             var url = "";
    //             <?php if(isset($data) && isset($data->id)){ ?>
    //                 var id_encoded = "{{ base64_encode($data->id) }}";

    //                 Swal.fire({
    //                     title: 'Are you sure want delete this image?',
    //                     text: "",
    //                     type: 'warning',
    //                     showCancelButton: true,
    //                     confirmButtonColor: '#3085d6',
    //                     cancelButtonColor: '#d33',
    //                     confirmButtonText: 'Yes'
    //                 }).then(function (result){
    //                     if (result.value){
    //                         $.ajax({
    //                             url: url,
    //                             type: "POST",
    //                             data:{
    //                                 id: id_encoded,
    //                                 _token: "{{ csrf_token() }}"
    //                             },
    //                             dataType: "JSON",
    //                             success: function (data){
    //                                 if(data.code == 200){
    //                                     Swal.fire('Deleted!', 'Deleted Successfully.', 'success');
    //                                     dropifyElements[id] = true;
    //                                     element.clearElement();
    //                                 }else{
    //                                     Swal.fire('', 'Failed to delete', 'error');
    //                                 }
    //                             },
    //                             error: function (jqXHR, textStatus, errorThrown){
    //                                 Swal.fire('', 'Failed to delete', 'error');
    //                             }
    //                         });
    //                     }
    //                 });

    //                 return false;
    //             <?php } else { ?>
    //                 Swal.fire({
    //                     title: 'Are you sure want delete this image?',
    //                     text: "",
    //                     type: 'warning',
    //                     showCancelButton: true,
    //                     confirmButtonColor: '#3085d6',
    //                     cancelButtonColor: '#d33',
    //                     confirmButtonText: 'Yes'
    //                 }).then(function (result){
    //                     if (result.value){
    //                         Swal.fire('Deleted!', 'Deleted Successfully.', 'success');
    //                         dropifyElements[id] = true;
    //                         element.clearElement();
    //                     }else{
    //                         Swal.fire('Cancelled', 'Discard Last Operation.', 'error');
    //                     }
    //                 });
    //                 return false;
    //             <?php } ?>
    //         } else {
    //             dropifyElements[id] = false;
    //             return true;
    //         }
    //     });
    // });
</script>

<script>
  
</script>
@endsection