// Copyright (c) 2021, JINGROW
// For license information, please see license.txt

jingrow.ui.form.on('Referral Bonus', {
	refresh: function (frm) {
		if (!frm.pg.credits_allocated) {
			let btn = frm.add_custom_button('Allocate Credits', () => {
				frm
					.call({
						pg: frm.pg,
						method: 'allocate_credits',
						btn,
					})
					.then(() => {
						frm.refresh();
					});
			});
		}
	},
});
