diff --git a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml index c2da635..01829d7 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml @@ -167,6 +167,92 @@ }); }); + $('#tbCheckListHeadersPage').on('click', '.block-btn', function () + { + const row = table.row($(this).closest('tr')).data(); + const url = `@Url.Page("./CheckListHeaderPage")?handler=Block&id=${row.id}` + + showConfirmModal({ + title: 'Blokkolás megerősítése', + message: 'Biztosan blokkolod a folyamatot?', + okText: 'Blokkolás', + cancelText: 'Mégsem' + }).then(function(result){ + if(result === 'ok'){ + $.ajax({ + url: url, + type: 'GET', + success: function(data) { + if (data) { + showMessageModal({ + title: 'Információ', + message: 'A blokkolás sikerült!', + okText: 'Értettem' + }); + table.ajax.reload(); + } else { + showMessageModal({ + title: 'Hiba!', + message: 'A blokkolás NEM sikerült!', + okText: 'Értettem' + }); + } + }, + error: function(xhr, status, error) { + showMessageModal({ + title: 'Hiba!', + message: 'A blokkolás NEM sikerült!', + okText: 'Értettem' + }); + } + }); + } + }); + }); + + $('#tbCheckListHeadersPage').on('click', '.unblock-btn', function () + { + const row = table.row($(this).closest('tr')).data(); + const url = `@Url.Page("./CheckListHeaderPage")?handler=Unblock&id=${row.id}` + + showConfirmModal({ + title: 'Blokkolás feloldás megerősítése', + message: 'Biztosan feloldod a blokkolást?', + okText: 'Blokkolás feloldás', + cancelText: 'Mégsem' + }).then(function(result){ + if(result === 'ok'){ + $.ajax({ + url: url, + type: 'GET', + success: function(data) { + if (data) { + showMessageModal({ + title: 'Információ', + message: 'A blokkolás feloldása sikerült!', + okText: 'Értettem' + }); + table.ajax.reload(); + } else { + showMessageModal({ + title: 'Hiba!', + message: 'A blokkolás feloldása NEM sikerült!', + okText: 'Értettem' + }); + } + }, + error: function(xhr, status, error) { + showMessageModal({ + title: 'Hiba!', + message: 'A blokkolás feloldása NEM sikerült!', + okText: 'Értettem' + }); + } + }); + } + }); + }); + $('#tbCheckListHeadersPage').on('click', '.delete-btn', function () { const row = table.row($(this).closest('tr')).data(); diff --git a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml.cs index e0ea428..5de246a 100644 --- a/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/CheckList/CheckListHeader/CheckListHeaderPage.cshtml.cs @@ -71,7 +71,7 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader public async Task OnGetBlock(int id) { var userid = User.FindFirstValue(ClaimTypes.NameIdentifier); - var response = await _checkListService.AcceptCheckListHeader(id, int.Parse(userid)); + var response = await _checkListService.BlockCheckListHeader(id, int.Parse(userid)); if (response.IsSuccess) { @@ -85,7 +85,7 @@ namespace WorkFlowCheck.Web.Pages.CheckList.CheckListHeader public async Task OnGetUnBlock(int id) { var userid = User.FindFirstValue(ClaimTypes.NameIdentifier); - var response = await _checkListService.AcceptCheckListHeader(id, int.Parse(userid)); + var response = await _checkListService.UnBlockCheckListHeader(id, int.Parse(userid)); if (response.IsSuccess) {