diff --git a/models/doctype/Kanban/Kanban.js b/models/doctype/Kanban/Kanban.js new file mode 100644 index 00000000..93d6c6c4 --- /dev/null +++ b/models/doctype/Kanban/Kanban.js @@ -0,0 +1,40 @@ +module.exports = { + name: 'Kanban', + doctype: 'DocType', + naming: 'random', + keywordFields: ['kanbanname', 'referencedoctype', 'sortby'], + fields: [ + { + fieldname: 'kanbanname', + label: 'Kanban Name', + fieldtype: 'Data', + required: 1 + }, + { + fieldname: 'referencedoctype', + label: 'Reference Doctype', + fieldtype: 'Data', + required: 1 + }, + { + fieldname: 'sortby', + label: 'Sort By', + fieldtype: 'Select', + options: [], + required: 1 + }, + { + fieldname: 'lists', + label: 'Lists', + fieldtype: 'Table', + childtype: 'KanbanList' + }, + { + fieldname: 'titlefield', + label: 'Title Field for Cards', + fieldtype: 'Select', + options: [], + required: 1 + } + ] +}; diff --git a/models/doctype/KanbanCard/KanbanCard.js b/models/doctype/KanbanCard/KanbanCard.js new file mode 100644 index 00000000..037a01a7 --- /dev/null +++ b/models/doctype/KanbanCard/KanbanCard.js @@ -0,0 +1,44 @@ +module.exports = { + name: 'KanbanCard', + doctype: 'DocType', + naming: 'random', + keywordFields: ['cardtitle', 'carddescription', 'assignee'], + titleField: 'cardtitle', + fields: [ + { + fieldname: 'cardtitle', + label: 'Card Title', + fieldtype: 'Data', + required: 1 + }, + { + fieldname: 'listname', + label: 'Add To List', + fieldtype: 'Data', + required: 1 + }, + { + fieldname: 'boardname', + label: 'Kanban board', + fieldtype: 'Data', + required: 1 + }, + { + fieldname: 'referencedoctype', + label: 'Reference Doctype Name', + fieldtype: 'Data', + required: 1 + }, + { + fieldname: 'carddescription', + label: 'Card Description', + fieldtype: 'Text' + }, + { + fieldname: 'assignee', + label: 'Assignee', + fieldtype: 'Link', + target: 'User' + } + ] +}; diff --git a/models/doctype/KanbanList/KanbanList.js b/models/doctype/KanbanList/KanbanList.js new file mode 100644 index 00000000..4b25838b --- /dev/null +++ b/models/doctype/KanbanList/KanbanList.js @@ -0,0 +1,19 @@ +module.exports = { + name: 'KanbanList', + doctype: 'DocType', + isChild: 1, + naming: 'random', + fields: [ + { + label: 'List Name', + fieldname: 'listname', + fieldtype: 'Data' + }, + { + label: 'Archived', + fieldname: 'archived', + fieldtype: 'Int', + default: 0 + } + ] +}; diff --git a/models/index.js b/models/index.js index 4e0abb23..16f912d1 100644 --- a/models/index.js +++ b/models/index.js @@ -1,17 +1,20 @@ module.exports = { - models: { - FilterItem: require('./doctype/FilterItem/FilterItem.js'), - FilterGroup: require('./doctype/FilterGroup/FilterGroup.js'), - FilterSelector: require('./doctype/FilterSelector/FilterSelector.js'), - NumberSeries: require('./doctype/NumberSeries/NumberSeries.js'), - PrintFormat: require('./doctype/PrintFormat/PrintFormat.js'), - Role: require('./doctype/Role/Role.js'), - Session: require('./doctype/Session/Session.js'), - SingleValue: require('./doctype/SingleValue/SingleValue.js'), - SystemSettings: require('./doctype/SystemSettings/SystemSettings.js'), - ToDo: require('./doctype/ToDo/ToDo.js'), - User: require('./doctype/User/User.js'), - UserRole: require('./doctype/UserRole/UserRole.js'), - File: require('./doctype/File/File.js'), - } -} + models: { + FilterItem: require('./doctype/FilterItem/FilterItem.js'), + FilterGroup: require('./doctype/FilterGroup/FilterGroup.js'), + FilterSelector: require('./doctype/FilterSelector/FilterSelector.js'), + NumberSeries: require('./doctype/NumberSeries/NumberSeries.js'), + PrintFormat: require('./doctype/PrintFormat/PrintFormat.js'), + Role: require('./doctype/Role/Role.js'), + Session: require('./doctype/Session/Session.js'), + SingleValue: require('./doctype/SingleValue/SingleValue.js'), + SystemSettings: require('./doctype/SystemSettings/SystemSettings.js'), + ToDo: require('./doctype/ToDo/ToDo.js'), + User: require('./doctype/User/User.js'), + UserRole: require('./doctype/UserRole/UserRole.js'), + File: require('./doctype/File/File.js'), + Kanban: require('./doctype/Kanban/Kanban.js'), + KanbanList: require('./doctype/KanbanList/KanbanList.js'), + KanbanCard: require('./doctype/KanbanCard/KanbanCard.js') + } +}; diff --git a/ui/components/Form/Form.vue b/ui/components/Form/Form.vue index e9ac15f0..fe3d5372 100644 --- a/ui/components/Form/Form.vue +++ b/ui/components/Form/Form.vue @@ -56,7 +56,10 @@ export default { try { this.doc = await frappe.getDoc(this.doctype, this.name); - if (this.doc._notInserted && this.meta.fields.map(df => df.fieldname).includes('name')) { + if ( + this.doc._notInserted && + this.meta.fields.map(df => df.fieldname).includes('name') + ) { // For a user editable name field, // it should be unset since it is autogenerated this.doc.set('name', ''); @@ -89,7 +92,6 @@ export default { } this.$emit('save', this.doc); - } catch (e) { console.error(e); return; diff --git a/ui/components/Form/FormLayout.vue b/ui/components/Form/FormLayout.vue index 58048f5f..e4ac6d05 100644 --- a/ui/components/Form/FormLayout.vue +++ b/ui/components/Form/FormLayout.vue @@ -26,7 +26,6 @@ export default { const dataObj = {}; for (let df of this.fields) { dataObj[df.fieldname] = this.doc[df.fieldname]; - if (df.fieldtype === 'Table' && !dataObj[df.fieldname]) { dataObj[df.fieldname] = []; } @@ -80,15 +79,17 @@ export default { if (!layout) { const fields = this.fields.map(df => df.fieldname); - layout = [{ - columns: [{ fields }] - }]; + layout = [ + { + columns: [{ fields }] + } + ]; } if (Array.isArray(layout)) { layout = { sections: layout - } + }; } return layout; } diff --git a/ui/components/Kanban/CreateKanbanModal.vue b/ui/components/Kanban/CreateKanbanModal.vue new file mode 100644 index 00000000..46224301 --- /dev/null +++ b/ui/components/Kanban/CreateKanbanModal.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/ui/components/Kanban/CustomModal.vue b/ui/components/Kanban/CustomModal.vue new file mode 100644 index 00000000..f1a82249 --- /dev/null +++ b/ui/components/Kanban/CustomModal.vue @@ -0,0 +1,55 @@ + + + + + + diff --git a/ui/components/Kanban/Kanban.vue b/ui/components/Kanban/Kanban.vue new file mode 100644 index 00000000..2a402409 --- /dev/null +++ b/ui/components/Kanban/Kanban.vue @@ -0,0 +1,307 @@ + + + + + diff --git a/ui/components/Kanban/KanbanDetails.vue b/ui/components/Kanban/KanbanDetails.vue new file mode 100644 index 00000000..603f07fc --- /dev/null +++ b/ui/components/Kanban/KanbanDetails.vue @@ -0,0 +1,109 @@ + + + + diff --git a/ui/components/Kanban/KanbanTable.vue b/ui/components/Kanban/KanbanTable.vue new file mode 100644 index 00000000..9f2cd557 --- /dev/null +++ b/ui/components/Kanban/KanbanTable.vue @@ -0,0 +1,112 @@ + + + + + diff --git a/ui/components/List/List.vue b/ui/components/List/List.vue index 9e99ba85..2c9a7783 100644 --- a/ui/components/List/List.vue +++ b/ui/components/List/List.vue @@ -1,44 +1,38 @@ diff --git a/ui/components/List/ListItem.vue b/ui/components/List/ListItem.vue index 8eb43d96..6dbaf5b4 100644 --- a/ui/components/List/ListItem.vue +++ b/ui/components/List/ListItem.vue @@ -1,9 +1,7 @@ diff --git a/ui/routes/index.js b/ui/routes/index.js index 3ba36c89..614c6292 100644 --- a/ui/routes/index.js +++ b/ui/routes/index.js @@ -1,6 +1,9 @@ import ListAndForm from '../pages/ListAndForm'; import ListAndPrintView from '../pages/ListAndPrintView'; import Tree from '../components/Tree'; +import KanbanTable from '../components/Kanban/KanbanTable'; +import KanbanDetails from '../components/Kanban/KanbanDetails'; +import Kanban from '../components/Kanban/Kanban'; export default [ { @@ -26,5 +29,20 @@ export default [ name: 'PrintView', component: ListAndPrintView, props: true + }, + { + path: '/kanban', + name: 'Kanban', + component: KanbanTable + }, + { + path: '/kanban/:name', + name: 'Edit Kanban', + component: KanbanDetails + }, + { + path: '/kanban/view/:name', + name: 'Show Kanban', + component: Kanban } ];