| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- @*
- For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
- *@
- @using SuperAdmin.Controllers;
- @using SuperAdmin.Models.View;
- @using SuperAdmin.Models.Object;
- @model TreeViewModel
- @{
- // get the newest data folowing by each service
- for (int j = 0; j < Model.rows.data.Count; j++)
- {
- RowStructure row = Model.rows.data[j];
- <tr class="@(j%2==0? "oven-column" : "")">
- <td class="text-truncate">@(j + 1)</td>
- <td class="text-truncate" style="max-width: 300px">@row.name_global</td>
- <td class="text-truncate">@UtilsController.GetStatus(row.is_show)</td>
- <td class="text-truncate">
- <img class="icon-style edit-btn" value="@row.id" src="~/img/icons8-edit-96.png" />
- <img class="icon-style delete-btn" value="@row.id" src="~/img/icons8-delete-bin-96.png" />
- </td>
- <td class="text-truncate">@row.update_date</td>
- </tr>
- }
- }
- <script>
- $('h4.title-parent-name').text('@(Model.parent != null ? Model.parent.name_global : "Categories")');
- $(".edit-btn").on("click", function () {
- var id = $(this).attr("value");
- console.log("edit id: ", id);
- $.ajax({
- type: "POST",
- url: urlConfig("/Tree/Editing"),
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- id: $(this).attr("value"),
- },
- success: function (data) {
- $('#contentModel').html(data);
- $('#myContent').modal({ "backdrop": "static", keyboard: true });
- $('#myContent').modal('show');
- },
- failure: function (data) {
- ///console.log(data);
- alert(data);
- },
- error: function (data) {
- ///console.log(data);
- alert(data);
- }
- });
- })
- $(".delete-btn").on("click", function () {
- var id = $(this).attr("value");
- console.log("delete id: ", id);
- var serviceName = $("#serviceName").val();
- $.ajax({
- type: "POST",
- url: urlConfig("/Partial/TreeConfirm"),
- data: {
- "message": "Are you sure ?",
- "id": id,
- "url": "/" + serviceName + "/DeletingAction"
- },
- success: function (data) {
- $('#informModel').html(data);
- $('#myInform').modal({ "backdrop": "static", keyboard: true });
- $('#myInform').modal('show');
- },
- failure: function (data) {
- ///console.log(data);
- alert(data);
- },
- error: function (data) {
- ///console.log(data);
- alert(data);
- }
- });
- })
- </script>
|