`; }); $('#soldoutReasonModal .modal-body').html(result); $('#soldoutReasonModal').modal('show'); } }, error: function(jqXHR, textStatus, errorThrown) { if(jqXHR.status==401) { bootbox.alert({ message: 'เกิดข้อผิดพลาด กรุณา Log In ใหม่อีกครั้ง', size: 'small', callback: function () { window.location.reload(); } }); } else { bootbox.alert({message: textStatus,size: 'small'}); } } }); } function confirmSoldout() { var mem_id = ''; var device_id = ''; var sub_mem_id = ''; var sub_device_id = ''; $.ajax({ url: 'https://api.livinginsider.com/living_topic_update_status.php', type: 'post', data: { mem_id: mem_id, device_id: device_id, device_type: 1, web_id: $('#sold_web_id').val(), lang:"EN", web_topic_status: 2, sub_mem_id: sub_mem_id, sub_device_id: sub_device_id, reason_id:$('input[name=reason_sold_id]:checked').val() }, dataType: 'json', success: function (data) { bootbox.alert({ message: data.result_msg, size: 'small', callback: function () { if (data.result_code == 0) { $.cookie('OpenDonate', '1'); window.location.reload(); } } }); }, error: function (err) { bootbox.alert({ message: err, size: 'small' }); } }); } function check_delete(web_id, web_status) { if (web_status == 2) { bootbox.confirm({ size: "small", message: "This record will delete and can not recovery, Are you sure to delete?", buttons: { confirm: { label: 'Delete', className: 'btn-danger' }, cancel: { label: 'Cancel', } }, callback: function (result) { if (result == true) { $.ajax({ url: 'https://www.livinginsider.com/mystock.php', type: 'post', data: { action_case: "delete", delete_id: web_id }, dataType: 'json', success: function (data) { if (data.status == 0) { bootbox.alert({ message: data.massage, size: 'small', callback: function () { $("#frm_search").submit(); } }); } else { bootbox.alert({ message: data.massage, size: 'small' }); } }, error: function (err) { bootbox.alert({ message: err, size: 'small' }); } }); } } }); } else { const mem_id = ''; const device_id = ''; const sub_mem_id = ''; const sub_device_id = ''; $.ajax({ url: 'https://api.livinginsider.com/living_delete_reason.php', type: 'post', data: { mem_id: mem_id, device_id: device_id, device_type: 1, lang:"EN", sub_mem_id: sub_mem_id, sub_device_id: sub_device_id }, dataType: 'json', success: function (data) { if(data.result_code == 0){ let result = ` `; data.reason.forEach(e => { result += `