@extends('admin.main')
@section('content')
<style>
    .additional-info{
        display:none;
    }
</style>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
    <h1>
        Clipart Categories
        <!-- <small>Optional description</small> -->
    </h1>
    <ol class="breadcrumb">
        <li><a href="{{ url ('admin') }}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
        <li><a href="{{ url ('admin') }}"><i class="fa fa-paint-brush"></i> Designer Management</a></li>
        <li class="active"> Clipart Categories</li>
    </ol>
    </section>

    <!-- Main content -->
    <section class="content container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                       <h4 class="box-title">List</h4>
                    </div>
                    <div class="box-body">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="well">
                                    <button type="button" class="btn btn-primary" id="btn_save_clipart_cat_sorting">
                                        Save Changes
                                    </button>
                                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal_add_category">
                                        <i class="fa fa-plus"></i> Add Category
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-12">
                                @if(count($clipart_categories_array) > 0)
                                    <table class="table table-bordered table-condensed">
                                        <thead>
                                        <tr>
                                            <th></th>
                                            <th>Category Name</th>
                                            <th>Category Status</th>
                                            <th>Category Owner</th>
                                            <th class="text-center">Action</th>
                                        </tr>
                                        </thead>
                                        <tbody id="tblbody_clipart_cat">
                                            @foreach($clipart_categories_array as $clipart_category)
                                                <tr id="{{ 'clip_cat_id_'. $clipart_category->Id }}">
                                                    <td class="text-center" style="width: 50px"><i class="fa fa-bars"></i></td>
                                                    <td><a href="#">{{ $clipart_category->CategoryName }}</a></td>
                                                    <td>
                                                        @if( $clipart_category->IsActive == 1)
                                                            <span class="label label-success">Active</span>
                                                        @else
                                                            <span class="label label-danger">Inactive</span>
                                                        @endif
                                                    </td>
                                                    <td>
                                                        @if( $clipart_category->UserId == null)
                                                            Administrator
                                                        @else
                                                            {{ $clipart_category->username }}
                                                        @endif
                                                    </td>
                                                    <td class="text-center">
                                                        <button class="btn btn-default btn-xs btn-edit-clipart-cat" data-category="{{ $clipart_category->CategoryName }}" data-status="{{ $clipart_category->IsActive }}" data-id="{{ $clipart_category->Id }}"><i class="fa fa-edit"></i></button>
                                                        <button class="btn btn-default btn-xs btn-delete-clipart-cat" data-id="{{ $clipart_category->Id }}"><i class="fa fa-trash"></i></button>
                                                    </td>
                                                </tr>
                                            @endforeach
                                        </tbody>
                                    </table>
                                @else
                                    <div class="col-sm-12">
                                        <h3 style="color: #b5b5b5;">No Record Found</h3>
                                    </div>
                                @endif
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- /.content -->
</div>

<div class="modal fade" id="modal_edit_category" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <form id="frm_edit_category">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Edit Category</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <div id="modal_edit_category_msg"></div>
                            <div class="form-group">
                                Category Name *
                                <div class="row">
                                    <div class="col-sm-12">
                                        <input type="text" name="id" id="cat_id" class="form-control">
                                        <input type="text" name="category" id="edit_category" class="form-control" placeholder="Enter category name">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                Category Status *
                                <div class="row">
                                    <div class="col-sm-12">
                                        <select name="is_active" id="edit_is_active" class="form-control">
                                            <option value="1">Active</option>
                                            <option value="0">Inactive</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary btn-custom-save">Save</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </form>
        </div>
    </div>
</div>
@endsection