/** * Auto-generated JavaScript stub for Task_Model * DO NOT EDIT - This file is automatically regenerated */ class Task_Model extends Rsx_Js_Model { static get name() { return 'Task_Model'; } static STATUS_PENDING = 1; static STATUS_IN_PROGRESS = 2; static STATUS_COMPLETED = 3; static STATUS_CANCELLED = 4; static status_enum_val() { const data = {}; const order = []; data[1] = {"constant":"STATUS_PENDING","label":"Pending","badge":"bg-secondary"}; order.push(1); data[2] = {"constant":"STATUS_IN_PROGRESS","label":"In Progress","badge":"bg-info"}; order.push(2); data[3] = {"constant":"STATUS_COMPLETED","label":"Completed","badge":"bg-success"}; order.push(3); data[4] = {"constant":"STATUS_CANCELLED","label":"Cancelled","badge":"bg-danger"}; order.push(4); // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } static status_label_list() { const values = {}; values[1] = 'Pending'; values[2] = 'In Progress'; values[3] = 'Completed'; values[4] = 'Cancelled'; return values; } static status_enum_select() { const fullData = this.status_enum_val(); const data = {}; const order = []; // Extract labels from full data, respecting selectable flag for (const key in fullData) { const item = fullData[key]; if (item.selectable !== false && item.label) { data[key] = item.label; order.push(parseInt(key)); } } // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } static PRIORITY_LOW = 1; static PRIORITY_MEDIUM = 2; static PRIORITY_HIGH = 3; static PRIORITY_URGENT = 4; static priority_enum_val() { const data = {}; const order = []; data[1] = {"constant":"PRIORITY_LOW","label":"Low","badge":"bg-secondary"}; order.push(1); data[2] = {"constant":"PRIORITY_MEDIUM","label":"Medium","badge":"bg-primary"}; order.push(2); data[3] = {"constant":"PRIORITY_HIGH","label":"High","badge":"bg-warning"}; order.push(3); data[4] = {"constant":"PRIORITY_URGENT","label":"Urgent","badge":"bg-danger"}; order.push(4); // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } static priority_label_list() { const values = {}; values[1] = 'Low'; values[2] = 'Medium'; values[3] = 'High'; values[4] = 'Urgent'; return values; } static priority_enum_select() { const fullData = this.priority_enum_val(); const data = {}; const order = []; // Extract labels from full data, respecting selectable flag for (const key in fullData) { const item = fullData[key]; if (item.selectable !== false && item.label) { data[key] = item.label; order.push(parseInt(key)); } } // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } /** * Fetch taskable relationship * @returns {Promise} Related model instance(s) or false */ async taskable() { if (!this.id) { shouldnt_happen('Cannot fetch relationship without id property'); } const response = await $.ajax({ url: `/_fetch_rel/Task_Model/${this.id}/taskable`, method: 'POST', dataType: 'json' }); if (!response) return false; // Convert response to model instance(s) // Framework handles instantiation based on relationship type return response; } /** * Fetch assigned_to relationship * @returns {Promise} Related model instance(s) or false */ async assigned_to() { if (!this.id) { shouldnt_happen('Cannot fetch relationship without id property'); } const response = await $.ajax({ url: `/_fetch_rel/Task_Model/${this.id}/assigned_to`, method: 'POST', dataType: 'json' }); if (!response) return false; // Convert response to model instance(s) // Framework handles instantiation based on relationship type return response; } /** * Fetch created_by relationship * @returns {Promise} Related model instance(s) or false */ async created_by() { if (!this.id) { shouldnt_happen('Cannot fetch relationship without id property'); } const response = await $.ajax({ url: `/_fetch_rel/Task_Model/${this.id}/created_by`, method: 'POST', dataType: 'json' }); if (!response) return false; // Convert response to model instance(s) // Framework handles instantiation based on relationship type return response; } /** * Fetch subtasks relationship * @returns {Promise} Related model instance(s) or false */ async subtasks() { if (!this.id) { shouldnt_happen('Cannot fetch relationship without id property'); } const response = await $.ajax({ url: `/_fetch_rel/Task_Model/${this.id}/subtasks`, method: 'POST', dataType: 'json' }); if (!response) return false; // Convert response to model instance(s) // Framework handles instantiation based on relationship type return response; } }