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

jingrow.ui.form.on("Module Def", {
	refresh: function (frm) {
		jingrow.xcall("jingrow.core.pagetype.module_def.module_def.get_installed_apps").then((r) => {
			frm.set_df_property("app_name", "options", JSON.parse(r));
			if (!frm.pg.app_name) {
				frm.set_value("app_name", "jingrow");
			}
		});

		if (!jingrow.boot.developer_mode) {
			frm.set_df_property("custom", "read_only", 1);
			if (frm.is_new()) {
				frm.set_value("custom", 1);
			}
		}
	},
});
