/*
 * @Author: baozhoutao@steedos.com
 * @Date: 2024-08-29 09:36:15
 * @LastEditors: baozhoutao@steedos.com
 * @LastEditTime: 2024-09-05 16:26:51
 * @Description: 
 */
module.exports = {

    design_form_layout: function(object_name, record_id, item_element) {
        var record = this.record || Creator.getObjectById(record_id);
        if (record && record.record) {
            record = record.record;
        }
        if (!record) {
            return toastr.error("未找到记录");
        }
        var locale = Builder.settings.context?.user?.language || window.navigator.language;
        if(locale === 'en' || locale.startsWith('en-')){
            locale = 'en-US'
        }
        window.open(Steedos.getRelativeUrl("/api/workflow/form_design?fid=" + record_id+`&assetUrls=${Builder.settings.assetUrls}&locale=${locale}`));
    },
    design_form_layoutVisible: function(object_name, record_id, record_permissions, data) {
        var record = data && data.record;

        if (!record) {
            return false;
        }

        if (record && !record.is_deleted && record.name != 'users' && record.created) {
            return true;
        }
    }

}