1737192474a:1:{s:23:"dashboard/list-blog.htm";a:10:{s:8:"fileName";s:23:"dashboard/list-blog.htm";s:7:"content";s:5822:"title = "Blog"
url = "/blog"
layout = "Dashboard"
is_hidden = 0

[session]
security = "user"
allowedUserGroups[] = "admin"
allowedUserGroups[] = "supplier"
redirect = "dashboard/login"
==
<?php
  use Yuren\BaliTiket\Models\Blog;

  use Winter\Storm\Auth\AuthManager;
  use Auth;

  function onStart()
  {
    $user = Auth::getUser();
    if ($user) {
      $this['vendor'] = $user->vendor; 

      $this['blogs'] = Blog::orderBy('created_at', 'desc')->get();

      $this['active_blog'] = Blog::orderBy('created_at', 'desc')->where('published', 1)->count();

      $this['all_blog'] = Blog::orderBy('created_at', 'desc')->count();
    } 

    $this['blog'] = Blog::make();
  }

  function onDelete()
  {
    $blogId = Input::post('id_blog');

    $blog = Blog::find($blogId);
    if ($blog) {
      $blog->delete();
    }

    return redirect()->refresh();
  }
?>
==
<!-- Content -->

<div class="container-xxl flex-grow-1 container-p-y">
  <div class="row">

    <!-- revenue -->
    <div class="col-6 col-xl-3 col-sm-6 mb-4">
      <div class="card">
        <div class="card-header header-elements">
          <h5 class="card-title mb-0">Blog Active</h5>
        </div>
        <div class="card-body">
          <div class="d-flex gap-2 align-items-center">
            <div class="badge rounded bg-label-info p-1"><i class="ti ti-box ti-sm"></i></div>
            <h4 class="mb-0">{{active_blog}} {{ (active_blog > 1) ? 'Blogs' : 'Blog'}}</h4>
          </div>
        </div>
      </div>
    </div>

    <div class="col-6 col-xl-3 col-sm-6 mb-4">
      <div class="card">
        <div class="card-header header-elements">
          <h5 class="card-title mb-0">All Blog</h5>
        </div>
        <div class="card-body">
          <div class="d-flex gap-2 align-items-center">
            <div class="badge rounded bg-label-primary p-1">
              <i class="ti ti-box ti-sm"></i>
            </div>
            <h4 class="mb-0">{{all_blog}} {{ (all_blog > 1) ? 'Blogs' : 'Blog'}}</h4>
          </div>
        </div>
      </div>
    </div>
    <!-- end revenue -->

    <!-- recent bookings -->
    <div class="col-12 col-xl-12 col-sm-12 mb-4">
      <div class="card">
        <div class="card-header header-elements">
          <h5 class="card-title mb-0">List Blog</h5>
        </div>
        <div class="card-body">
          <p class="text-end">
            <a href="{{url('blog/add')}}" class="btn btn-success btn-sm" ><i class="fa fa-plus me-2"></i>Add</a>
          </p>
          <div class="card-datatable table-responsive">
            <table class="table border-top" id="recent-booking-list">
              <thead>
                <tr class="" >
                  <th class="fw-bold">Title</th>
                  <th class="fw-bold">Activity ID</th>
                  <th class="fw-bold">Area</th>
                  <th class="fw-bold">Published</th>
                  <th class="fw-bold">View</th>
                  <th class="fw-bold">Created</th>
                  <th class="fw-bold"></th>
                </tr>
              </thead>
              <tbody>
                {% for key, blog in blogs %}
                <tr>
                  <td>{{ blog.title }}</td>
                  <td>{{ blog.activity_id }}</td>
                  <td>{{ blog.location.name }}</td>
                  <td class="text-center">{{ (blog.published == 1) ? 'Yes' : 'No' }}</td>
                  <td class="text-center">{{ blog.view }}</td>
                  <td>{{ blog.created_at|date('d F Y') }}</td>
                  <td class="text-end">
                    <!-- <button class="btn btn-primary btn-xs py-1 me-1" ><i class="fa fa-eye "></i></button> -->

                    <a href="{{url('blog/'~blog.id~'/edit')}}" class="btn btn-warning btn-xs py-1 me-1" ><i class="fa fa-edit "></i></a>

                    <button type="button" class="btn btn-danger btn-xs py-1 me-1" data-bs-toggle="modal" data-bs-target="#delete-blog-{{key}}"><i class="fa fa-trash "></i></button>
                    <div class="modal fade" id="delete-blog-{{key}}" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-sm modal-dialog-centered" role="document">
                        <div class="modal-content">
                          <div class="modal-body text-start">
                            <p class="fs-big">Are you sure you want to delete this <b>{{ blog.title }}</b> ?</p>
                          </div>
                          <div class="modal-footer justify-content-between">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                            <form data-request="onDelete" method="POST">
                              <input type="hidden" name="id_blog" value="{{blog.id}}">
                              <button type="submit" class="btn btn-danger" data-bs-dismiss="modal">Delete</button>
                            </form>
                          </div>
                        </div>
                      </div>
                    </div>

                  </td>
                </tr>
                {% endfor %}
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    <!-- end recent bookings -->

  </div>
</div>
<!-- / Content -->


<!-- js -->
{% put scripts %}

<script type="text/javascript">
  //  For Datatable
  // --------------------------------------------------------------------
  var dt_projects_table = $('.datatables-projects');

  var dt_project = dt_projects_table.DataTable();

  </script>
  {% endput %}
<!-- end js -->";s:5:"mtime";i:1727255785;s:6:"markup";s:4909:"<!-- Content -->

<div class="container-xxl flex-grow-1 container-p-y">
  <div class="row">

    <!-- revenue -->
    <div class="col-6 col-xl-3 col-sm-6 mb-4">
      <div class="card">
        <div class="card-header header-elements">
          <h5 class="card-title mb-0">Blog Active</h5>
        </div>
        <div class="card-body">
          <div class="d-flex gap-2 align-items-center">
            <div class="badge rounded bg-label-info p-1"><i class="ti ti-box ti-sm"></i></div>
            <h4 class="mb-0">{{active_blog}} {{ (active_blog > 1) ? 'Blogs' : 'Blog'}}</h4>
          </div>
        </div>
      </div>
    </div>

    <div class="col-6 col-xl-3 col-sm-6 mb-4">
      <div class="card">
        <div class="card-header header-elements">
          <h5 class="card-title mb-0">All Blog</h5>
        </div>
        <div class="card-body">
          <div class="d-flex gap-2 align-items-center">
            <div class="badge rounded bg-label-primary p-1">
              <i class="ti ti-box ti-sm"></i>
            </div>
            <h4 class="mb-0">{{all_blog}} {{ (all_blog > 1) ? 'Blogs' : 'Blog'}}</h4>
          </div>
        </div>
      </div>
    </div>
    <!-- end revenue -->

    <!-- recent bookings -->
    <div class="col-12 col-xl-12 col-sm-12 mb-4">
      <div class="card">
        <div class="card-header header-elements">
          <h5 class="card-title mb-0">List Blog</h5>
        </div>
        <div class="card-body">
          <p class="text-end">
            <a href="{{url('blog/add')}}" class="btn btn-success btn-sm" ><i class="fa fa-plus me-2"></i>Add</a>
          </p>
          <div class="card-datatable table-responsive">
            <table class="table border-top" id="recent-booking-list">
              <thead>
                <tr class="" >
                  <th class="fw-bold">Title</th>
                  <th class="fw-bold">Activity ID</th>
                  <th class="fw-bold">Area</th>
                  <th class="fw-bold">Published</th>
                  <th class="fw-bold">View</th>
                  <th class="fw-bold">Created</th>
                  <th class="fw-bold"></th>
                </tr>
              </thead>
              <tbody>
                {% for key, blog in blogs %}
                <tr>
                  <td>{{ blog.title }}</td>
                  <td>{{ blog.activity_id }}</td>
                  <td>{{ blog.location.name }}</td>
                  <td class="text-center">{{ (blog.published == 1) ? 'Yes' : 'No' }}</td>
                  <td class="text-center">{{ blog.view }}</td>
                  <td>{{ blog.created_at|date('d F Y') }}</td>
                  <td class="text-end">
                    <!-- <button class="btn btn-primary btn-xs py-1 me-1" ><i class="fa fa-eye "></i></button> -->

                    <a href="{{url('blog/'~blog.id~'/edit')}}" class="btn btn-warning btn-xs py-1 me-1" ><i class="fa fa-edit "></i></a>

                    <button type="button" class="btn btn-danger btn-xs py-1 me-1" data-bs-toggle="modal" data-bs-target="#delete-blog-{{key}}"><i class="fa fa-trash "></i></button>
                    <div class="modal fade" id="delete-blog-{{key}}" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                      <div class="modal-dialog modal-sm modal-dialog-centered" role="document">
                        <div class="modal-content">
                          <div class="modal-body text-start">
                            <p class="fs-big">Are you sure you want to delete this <b>{{ blog.title }}</b> ?</p>
                          </div>
                          <div class="modal-footer justify-content-between">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                            <form data-request="onDelete" method="POST">
                              <input type="hidden" name="id_blog" value="{{blog.id}}">
                              <button type="submit" class="btn btn-danger" data-bs-dismiss="modal">Delete</button>
                            </form>
                          </div>
                        </div>
                      </div>
                    </div>

                  </td>
                </tr>
                {% endfor %}
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
    <!-- end recent bookings -->

  </div>
</div>
<!-- / Content -->


<!-- js -->
{% put scripts %}

<script type="text/javascript">
  //  For Datatable
  // --------------------------------------------------------------------
  var dt_projects_table = $('.datatables-projects');

  var dt_project = dt_projects_table.DataTable();

  </script>
  {% endput %}
<!-- end js -->";s:4:"code";s:700:"
  use Yuren\BaliTiket\Models\Blog;

  use Winter\Storm\Auth\AuthManager;
  use Auth;

  function onStart()
  {
    $user = Auth::getUser();
    if ($user) {
      $this['vendor'] = $user->vendor; 

      $this['blogs'] = Blog::orderBy('created_at', 'desc')->get();

      $this['active_blog'] = Blog::orderBy('created_at', 'desc')->where('published', 1)->count();

      $this['all_blog'] = Blog::orderBy('created_at', 'desc')->count();
    } 

    $this['blog'] = Blog::make();
  }

  function onDelete()
  {
    $blogId = Input::post('id_blog');

    $blog = Blog::find($blogId);
    if ($blog) {
      $blog->delete();
    }

    return redirect()->refresh();
  }
";s:5:"title";s:4:"Blog";s:3:"url";s:5:"/blog";s:6:"layout";s:9:"Dashboard";s:9:"is_hidden";s:1:"0";s:7:"session";a:3:{s:8:"security";s:4:"user";s:17:"allowedUserGroups";a:2:{i:0;s:5:"admin";i:1;s:8:"supplier";}s:8:"redirect";s:15:"dashboard/login";}}}