123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- @using Karsha_Site.Application.Services.Products.Queries.GetCategories;
- @model List<CategoriesDto>
- @{
- ViewData["Title"] = "Index";
- Layout = "~/Areas/Admin/Views/Shared/_Adminlayout.cshtml";
- }
- <div class="content container-fluid">
- <!-- Page Header -->
- <div class="page-header">
- <div class="row">
- <div class="col-sm-11 col-auto">
- <ul class="breadcrumb">
- <li class="breadcrumb-item"><a href="index.html">داشبورد</a></li>
- <li class="breadcrumb-item active">لیست گروه محصولات</li>
- </ul>
- </div>
- </div>
- </div>
- <!-- /Page Header -->
- <div class="row">
- <div class="col-sm-12">
- <div class="card">
- <div class="card-body">
- <div class="table-responsive">
- <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap4 no-footer">
- <div ><div class="col-sm-12 col-md-6"><div class="dataTables_length" id="DataTables_Table_0_length"><label>Show <select name="DataTables_Table_0_length" aria-controls="DataTables_Table_0" class="custom-select custom-select-sm form-control form-control-sm"><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select> entries</label></div></div><div class="col-sm-12 col-md-6"></div></div><div >
- <div class="col-sm-12">
- <table class="datatable table table-hover table-center mb-0 dataTable no-footer" id="DataTables_Table_0" role="grid" aria-describedby="DataTables_Table_0_info">
- <thead>
- <tr >
- <th class="sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-sort="ascending" aria-label="عکس گروه محصول: activate to sort column descending">عکس گروه محصول</th>
- <th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="نام گروه : activate to sort column ascending">نام گروه </th>
- <th class="text-right" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" aria-label="عملیات: activate to sort column ascending">عملیات</th>
- </tr>
- </thead>
- <tbody>
-
- @{
- var i = 0;
- string classNmae = "odd";
- }
- @foreach (var item in Model)
- {
- i++;
- if (i % 2 == 0)
- {
- classNmae = "even";
- }
- else
- {
- classNmae = "odd";
- }
- <tr class="@classNmae">
-
- <td>
- <h2 class="table-avatar avatar avatar-lg ml-4">
- <img class="avatar-img" src="~/@item.Image" alt="@item.Title" >
-
- </h2>
- </td>
- <td>
- @*@{
- string parent = item.Parent != null ? item.Parent.Title : "-";
- }*@
-
- <text> @item.Title </text>
- </td>
- <td>
- <a class="btn btn-sm bg-danger-light" onclick="DeleteCategory('@item.ID')">
- <i class="fe fe-trash"></i> حذف
- </a>
- @*@if (item.Parent == null)
- {
- <a href="~/admin/categories/addnewcategory?ParentId=@item.ID" class="btn btn-success">افزودن فرزند</a>
- }
-
- @if (item.HasChild == true)
- {
- <a href="~/admin/categories/index?ParentId=@item.ID" class="btn btn-info">مشاهده لیست فرزند ها </a>
- }
- else
- {
- <a class="btn btn-sm bg-danger-light" onclick="DeleteCategory('@item.ID')">
- <i class="fe fe-trash"></i> حذف
- </a>
- }*@
-
-
- </td>
- </tr>
- }
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </div>
- </div>
- @section Scripts
- {
-
- <link href="~/Sweetalert2/sweetalert2.min.css" rel="stylesheet" />
- <script src="~/Sweetalert2/sweetalert2.min.js"></script>
-
- <script>
- function DeleteCategory(CategoryId) {
- swal.fire({
- title: 'حذف گروه محصول',
- text: "کاربر گرامی از حذف گروه مطمئن هستید؟",
- icon: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#d33',
- cancelButtonColor: '#7cacbe',
- confirmButtonText: 'بله ، گروه حذف شود',
- cancelButtonText: 'خیر'
- }).then((result) => {
- if (result.value) {
- var postData = {
- 'CategoryId': CategoryId,
- };
-
- $.ajax({
- contentType: 'application/x-www-form-urlencoded',
- dataType: 'json',
- type: "POST",
- url: "Delete",
- data: postData,
- success: function (data) {
- if (data.isSuccess == true) {
- swal.fire(
- 'موفق!',
- data.message,
- 'success'
- ).then(function (isConfirm) {
- location.reload();
- });
- }
- else {
-
- swal.fire(
- 'هشدار!',
- data.message,
- 'warning'
- );
-
- }
- },
- error: function (request, status, error) {
- alert(request.responseText);
- }
-
- });
-
- }
- })
- }
- </script>
- }
|