mirror of
https://github.com/frappe/lms.git
synced 2026-04-19 22:52:29 +03:00
fix(payment gateway): add missing removeAccount function
This commit is contained in:
@@ -88,6 +88,7 @@
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
call,
|
||||
createListResource,
|
||||
FeatherIcon,
|
||||
ListView,
|
||||
@@ -97,10 +98,12 @@ import {
|
||||
ListRow,
|
||||
ListRowItem,
|
||||
ListSelectBanner,
|
||||
toast,
|
||||
} from 'frappe-ui'
|
||||
import { computed, ref } from 'vue'
|
||||
import { Plus, Trash2 } from 'lucide-vue-next'
|
||||
import PaymentGatewayDetails from '@/components/Settings/PaymentGatewayDetails.vue'
|
||||
import { cleanError } from '@/utils'
|
||||
|
||||
const showForm = ref(false)
|
||||
const currentGateway = ref(null)
|
||||
@@ -128,6 +131,23 @@ const openForm = (gatewayID) => {
|
||||
showForm.value = true
|
||||
}
|
||||
|
||||
const removeAccount = (selections, unselectAll) => {
|
||||
call('lms.lms.api.delete_documents', {
|
||||
doctype: 'Payment Gateway',
|
||||
documents: Array.from(selections),
|
||||
})
|
||||
.then(() => {
|
||||
paymentGateways.reload()
|
||||
toast.success(__('Payment gateways deleted successfully'))
|
||||
unselectAll()
|
||||
})
|
||||
.catch((err) => {
|
||||
toast.error(
|
||||
cleanError(err.messages[0]) || __('Error deleting payment gateways')
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
const columns = computed(() => {
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -702,7 +702,13 @@ def save_certificate_details(
|
||||
@frappe.whitelist()
|
||||
def delete_documents(doctype: str, documents: list):
|
||||
frappe.only_for("Moderator")
|
||||
meta = frappe.get_meta(doctype)
|
||||
non_lms_allowed = ["Payment Gateway", "Email Template"]
|
||||
if meta.module != "LMS" and doctype not in non_lms_allowed:
|
||||
frappe.throw(_("Deletion not allowed for {0}").format(doctype))
|
||||
for doc in documents:
|
||||
if not isinstance(doc, str) or not doc.strip():
|
||||
frappe.throw(_("Invalid document name"))
|
||||
frappe.delete_doc(doctype, doc)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user