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

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

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

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

	influxframework.breadcrumbs.add("Setup");

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