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

jingrow.ui.form.on("Dashboard", {
	refresh: function (frm) {
		frm.add_custom_button(__("Show Dashboard"), () =>
			jingrow.set_route("dashboard-view", frm.pg.name)
		);

		if (!jingrow.boot.developer_mode && frm.pg.is_standard) {
			frm.disable_form();
		}

		frm.set_query("chart", "charts", function () {
			return {
				filters: {
					is_public: 1,
				},
			};
		});

		frm.set_query("card", "cards", function () {
			return {
				filters: {
					is_public: 1,
				},
			};
		});
	},
});
