 @extends('adminlte::page') @section('content')
<?php Fun::lang();?>
<style>
    .page{
        height: 80% !important;
    }
</style>
<div class="modal fade bs-modal-lg" id="create-payment-policy" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-dm modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h3>Create Payment Policy</h3>
            </div>
            <br />
            <form class="form-horizontal" role="form" action="{{ route('payment-policy.store') }}" method="post">
                @csrf
                <div class="row col-sm-12">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 required control-label">Name</label>
                            <div class="col-sm-9">
                                <input type="text" name="name" class="form-control"required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row col-sm-12">
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">Description</label>
                            <div class="col-sm-9">
                                <textarea name="description" class="form-control"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" data-dismiss="modal" class="button_danger"><i class="fa fa-close"></i> No</button>
                    <button type="submit" class="button_success" data-toggle="modal"><i class="fa fa-save"></i> Save</button>
                </div>
            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<div class="title-page">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="#">Setting</a></li>
            <li><a href="#">Payment Policy</a></li>
        </ul>
    </div>
</div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-12 col-xs-12">
                    <div class="title-page">
                        <div class="pull-left">
                            <h3>Payment Policy List</h3>
                        </div>
                    </div>
                    <div class="pull-right">
                        <a class="button_sm button_primary" href="#create-payment-policy" data-toggle="modal"><span class="fa fa-plus"></span>  Create New</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body table-responsive">
                        
            <table id="datatable_paymentpolicy" class="table table-striped table-bordered table-hover nowrap">
                <thead>
                    <tr>
                        <th>NO</th>
                        <th>Name</th>
                        <th>Description</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                        {!!$data!!}
                </tbody>
            </table>

        </div>
    </div>
    <div class='modal fade bs-modal-lg' id='edit-payment-policy' tabindex='-1' role='dialog' aria-hidden='true'>
        <div class='modal-dialog modal-dm modal-lg'>
            <div class='modal-content'>
                <div class='modal-header'>
                    <button type='button' class='close' data-dismiss='modal' aria-hidden='true'></button>
                    <h3>Edit Policy Payment</h3>
                </div>
                <br />
                <form class='form-horizontal' role='form' action="{{route('payment-policy.update')}}" method='post'>
                    @csrf
                    <div class='row col-sm-12'>
                        <div class='col-sm-12'>
                            <div class='form-group'>
                                <label class='col-sm-2 required control-label'>Name</label>
                                <div class='col-sm-9'>
                                    <input type='text' name='name' id='name' class='form-control' required>
                                    <input type='hidden' name='id' id='id'>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class='row col-sm-12'>
                        <div class='col-sm-12'>
                            <div class='form-group'>
                                <label class='col-sm-2 control-label'>Description</label>
                                <div class='col-sm-9'>
                                    <textarea name='description' id='description' class='form-control'></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class='modal-footer'>
                        <button type='button' data-dismiss='modal' class='button_danger'><i class='fa fa-close'></i> No</button>
                        <button type='submit' class='button_success' data-toggle='modal'><i class='fa fa-save'></i> Save</button>
                    </div>
                </form>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    @endsection
    @section('js')
    <script type="text/javascript">
            function delete_promotion(obj)
            {
                var id = $(obj).data("id");
                $.confirm({
                    title:'Are you sure ?',
                    content:'',
                    theme:'modern',
                    buttons:{
                        cancel:{
                            btnClass:'btn btn-primary',
                            text:'Cancel',
                            action:function () {

                            }
                        },
                        submit:{
                            btnClass:'btn btn-danger',
                            text:"Delete",
                            action:function () {
                                    window.location.replace('{{route("payment-policy.delete")}}?id='+id);
                            }
                        },
                    },
                });
            }
            function edit(obj)
            {
                var id = $(obj).data("id");
                var name = $(obj).data("name");
                var description = $(obj).data("description");
                    $("#edit-payment-policy").modal("show");
                    $("#name").val(name);
                    $("#description").val(description);
                    $("#id").val(id);
                
            }
            $(document).ready(function() {
                $('.main-spinner').show();
                $('#datatable_paymentpolicy').DataTable();
            });
    </script>
    @endsection
<style>
    .modal-lg {
        width: 800px;
    }
</style>