xhiveframework.pages["backups"].on_page_load = function (wrapper) {
	var page = xhiveframework.ui.make_app_page({
		parent: wrapper,
		title: __("Download Backups"),
		single_column: true,
	});

	page.add_inner_button(__("Set Number of Backups"), function () {
		xhiveframework.set_route("Form", "System Settings");
	});

	page.add_inner_button(__("Download Files Backup"), function () {
		xhiveframework.call({
			method: "xhiveframework.desk.page.backups.backups.schedule_files_backup",
			args: { user_email: xhiveframework.session.user_email },
		});
	});

	page.add_inner_button(__("Get Backup Encryption Key"), function () {
		if (xhiveframework.user.has_role("System Manager")) {
			xhiveframework.verify_password(function () {
				xhiveframework.call({
					method: "xhiveframework.utils.backups.get_backup_encryption_key",
					callback: function (r) {
						xhiveframework.msgprint({
							title: __("Backup Encryption Key"),
							message: __(r.message),
							indicator: "blue",
						});
					},
				});
			});
		} else {
			xhiveframework.msgprint({
				title: __("Error"),
				message: __("System Manager privileges required."),
				indicator: "red",
			});
		}
	});

	xhiveframework.breadcrumbs.add("Setup");

	$(xhiveframework.render_template("backups")).appendTo(page.body.addClass("no-border"));
};
