Alap töréls Web Locations működik.
This commit is contained in:
@@ -48,11 +48,22 @@
|
|||||||
},
|
},
|
||||||
data: JSON.stringify(formData.LocationDTO),
|
data: JSON.stringify(formData.LocationDTO),
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
|
if (response.success)
|
||||||
|
{
|
||||||
showMessageModal({
|
showMessageModal({
|
||||||
title: 'Figyelmem!',
|
title: 'Figyelmem!',
|
||||||
message: 'Sikeres mentés.',
|
message: 'Sikeres mentés.',
|
||||||
okText: 'Értettem'
|
okText: 'Értettem'
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
showMessageModal({
|
||||||
|
title: 'Figyelmem, HIBA!',
|
||||||
|
message: 'Sikertelen mentés.',
|
||||||
|
okText: 'Értettem'
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
// Hiba esetén
|
// Hiba esetén
|
||||||
|
|||||||
@@ -74,26 +74,6 @@
|
|||||||
$('#tbLocationsPage').on('click', '.delete-btn', function ()
|
$('#tbLocationsPage').on('click', '.delete-btn', function ()
|
||||||
{
|
{
|
||||||
const row = table.row($(this).closest('tr')).data();
|
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({
|
showConfirmModal({
|
||||||
title: 'Törlés megerősítése',
|
title: 'Törlés megerősítése',
|
||||||
message: 'Biztosan törölni szeretnéd ezt az elemet?',
|
message: 'Biztosan törölni szeretnéd ezt az elemet?',
|
||||||
@@ -101,7 +81,36 @@
|
|||||||
cancelText: 'Mégsem'
|
cancelText: 'Mégsem'
|
||||||
}).then(function(result) {
|
}).then(function(result) {
|
||||||
if(result === 'ok') {
|
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)
|
public async Task<JsonResult> OnGetDeleteLocation(int id)
|
||||||
{
|
{
|
||||||
|
var isSuccess = await _baseStockService.DeleteLocation(id);
|
||||||
return new JsonResult(new { result = true });
|
return new JsonResult(new { result = isSuccess });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,6 +144,27 @@ namespace WorkFlowCheck.Web.Services
|
|||||||
return retVal;
|
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)
|
public async Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint(CheckPointDTO checkPointDTO)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
|
|||||||
{
|
{
|
||||||
|
|
||||||
Task<CheckPointDTO> GetCheckPoint(int id);
|
Task<CheckPointDTO> GetCheckPoint(int id);
|
||||||
|
//Task<bool> DeleteCheckpoint(int id);
|
||||||
Task<List<CheckPointDTO>> GetAllCheckPoints();
|
Task<List<CheckPointDTO>> GetAllCheckPoints();
|
||||||
Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint(CheckPointDTO checkPointDTO);
|
Task<ApiResponseDTO<CheckPointDTO>> UpdateCheckPoint(CheckPointDTO checkPointDTO);
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ namespace WorkFlowCheck.Web.Services.Interfaces
|
|||||||
Task<ApiResponseDTO<EquipmentDTO>> UpdateEquipment(EquipmentDTO equipmentDTO);
|
Task<ApiResponseDTO<EquipmentDTO>> UpdateEquipment(EquipmentDTO equipmentDTO);
|
||||||
|
|
||||||
Task<LocationDTO> GetLocation(int id);
|
Task<LocationDTO> GetLocation(int id);
|
||||||
|
Task<bool> DeleteLocation(int id);
|
||||||
Task<List<LocationDTO>> GetAllLocations();
|
Task<List<LocationDTO>> GetAllLocations();
|
||||||
Task<ApiResponseDTO<LocationDTO>> UpdateLocation(LocationDTO LocationDTO);
|
Task<ApiResponseDTO<LocationDTO>> UpdateLocation(LocationDTO LocationDTO);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user