Alap töréls Web Locations működik.
This commit is contained in:
@@ -146,21 +146,21 @@
|
||||
data: JSON.stringify(formData.CheckPointDTO),
|
||||
success: function (response) {
|
||||
if (response.success)
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem, HIBA!',
|
||||
message: 'Sikertelen mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem, HIBA!',
|
||||
message: 'Sikertelen mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Hiba esetén
|
||||
|
||||
@@ -48,11 +48,22 @@
|
||||
},
|
||||
data: JSON.stringify(formData.LocationDTO),
|
||||
success: function (response) {
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
if (response.success)
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem!',
|
||||
message: 'Sikeres mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
showMessageModal({
|
||||
title: 'Figyelmem, HIBA!',
|
||||
message: 'Sikertelen mentés.',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Hiba esetén
|
||||
|
||||
@@ -74,26 +74,6 @@
|
||||
$('#tbLocationsPage').on('click', '.delete-btn', function ()
|
||||
{
|
||||
const row = table.row($(this).closest('tr')).data();
|
||||
|
||||
$.ajax({
|
||||
url: '/LocationsPage?handler=DeleteLocation', // A URL a handler-hez, ami az OnGetDeleteLocation metódust hívja
|
||||
type: 'GET', // A kérés típusa, ebben az esetben GET
|
||||
data: { id: 123 }, // Az id paraméter, amit átadsz
|
||||
success: function (data) {
|
||||
if (data.result) {
|
||||
// A válaszban lévő result true, tehát sikeres volt a törlés
|
||||
alert('Helyszín törölve!');
|
||||
} else {
|
||||
alert('Hiba történt a törlés során.');
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
// Ha valami hiba történik a kérés során
|
||||
alert('Hiba történt: ' + error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
showConfirmModal({
|
||||
title: 'Törlés megerősítése',
|
||||
message: 'Biztosan törölni szeretnéd ezt az elemet?',
|
||||
@@ -101,7 +81,36 @@
|
||||
cancelText: 'Mégsem'
|
||||
}).then(function(result) {
|
||||
if(result === 'ok') {
|
||||
console.log('Törlés végrehajtva');
|
||||
$.ajax({
|
||||
url: '/BaseStock/Locations/LocationsPage?handler=DeleteLocation',
|
||||
type: 'GET',
|
||||
data: { id: row.id },
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
if (data) {
|
||||
showMessageModal({
|
||||
title: 'Információ',
|
||||
message: 'A törlés sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
|
||||
table.ajax.reload();
|
||||
} else {
|
||||
showMessageModal({
|
||||
title: 'Hiba!',
|
||||
message: 'A törlés NEM sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
showMessageModal({
|
||||
title: 'Hiba!',
|
||||
message: 'A törlés NEM sikerült!',
|
||||
okText: 'Értettem'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace WorkFlowCheck.Web.Pages.BaseStock.Locations
|
||||
}
|
||||
public async Task<JsonResult> OnGetDeleteLocation(int id)
|
||||
{
|
||||
|
||||
return new JsonResult(new { result = true });
|
||||
var isSuccess = await _baseStockService.DeleteLocation(id);
|
||||
return new JsonResult(new { result = isSuccess });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,27 @@ namespace WorkFlowCheck.Web.Services
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteLocation(int id)
|
||||
{
|
||||
string endpoint = $"{_httpClient.BaseAddress}api/Sync/DeleteLocation/{id}";
|
||||
var retVal = false;
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
return response.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public async Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint(CheckPointDTO checkPointDTO)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
|
||||
{
|
||||
|
||||
Task<CheckPointDTO> GetCheckPoint(int id);
|
||||
//Task<bool> DeleteCheckpoint(int id);
|
||||
Task<List<CheckPointDTO>> GetAllCheckPoints();
|
||||
Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint(CheckPointDTO checkPointDTO);
|
||||
|
||||
@@ -16,6 +17,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
|
||||
Task<ApiResponseDTO<EquipmentDTO>> UpdateEquipment(EquipmentDTO equipmentDTO);
|
||||
|
||||
Task<LocationDTO> GetLocation(int id);
|
||||
Task<bool> DeleteLocation(int id);
|
||||
Task<List<LocationDTO>> GetAllLocations();
|
||||
Task<ApiResponseDTO<LocationDTO>> UpdateLocation(LocationDTO LocationDTO);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user