From ae08a4e96d63b6dddae39fcc921a86fa32052999 Mon Sep 17 00:00:00 2001 From: cael <judirakoto6@gmail.com> Date: Tue, 11 Mar 2025 09:27:45 +0300 Subject: [PATCH] Add next column on kanban --- assets/js/co.js | 1004 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1004 insertions(+) diff --git a/assets/js/co.js b/assets/js/co.js index cdc82abcf..5e625ebb8 100755 --- a/assets/js/co.js +++ b/assets/js/co.js @@ -1773,6 +1773,1010 @@ var coInterface = { requestAnimationFrame(updateCounter); }, actions: { + convertirTimestampEnDate: function(dateInput) { + if(!dateInput || dateInput == 'Invalid date') return ""; + let date; + // Vérifier si l'entrée est un nombre (timestamp Unix) + if (!isNaN(dateInput)) { + date = new Date(dateInput.toString().length === 10 ? dateInput * 1000 : dateInput); + } else if(typeof dateInput === 'string') { + date = new Date(dateInput); + console.log("date",date) + } + + // Vérifier si la date est valide + if (isNaN(date.getTime())) { + return "Date invalide"; + } + + // Formater la date en jj/mm/aa + const day = String(date.getDate()).padStart(2, '0'); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const year = String(date.getFullYear()).slice(-2); + + return `${day}/${month}/${year}`; + }, + loadKanbanAction: function (projectId, linkAction, titleAction, slug = "", costumParams = null) { + actifProject = { + id: projectId, + slug: slug, + type: "projects" + } + let urlBase = baseUrl; + let kanbanHeader = [ + { + id: 'discuss', + label: 'A discuter', + editable: false + }, { + id: 'todo', + label: 'A faire', + editable: false + }, + { + id: 'next', + label: 'Next', + editable: false + }, + { + id: 'tracking', + label: 'En cours', + editable: false + }, + { + id: 'totest', + label: 'A tester', + editable: false + }, + { + id: 'done', + label: 'Terminer', + editable: false + } + ] + $('#modalKanbanAction .modal-header h4').text(titleAction) + let dataAction = [] + let kanbanData = [] + + let paramsKanbanAction = { + "connectedUser": userConnected._id.$id, + "filters[urls][$in][]": location.href, + "filters[parentId]": projectId + }; + + if( costumParams !== null ){ + paramsKanbanAction["filters[parentId]"] = costumParams.id + } + + + ajaxPost( + null, + baseUrl + "/costum/project/action/request/actions/scope/" + linkAction, + paramsKanbanAction, + function(data) { + dataAction = data; + }, null, null, { + async: false + } + ) + + for (let i = 0; i < dataAction.length; i++) { + let startDate = typeof dataAction[i].startDate == "string" ? coInterface.actions.convertirTimestampEnDate(dataAction[i].startDate) : ( typeof dataAction[i].startDate == "object" && dataAction[i].startDate != null ? coInterface.actions.convertirTimestampEnDate(dataAction[i].startDate['sec']) : coInterface.actions.convertirTimestampEnDate(dataAction[i].created)); + let endDate = typeof dataAction[i].endDate == "string" ? coInterface.actions.convertirTimestampEnDate(dataAction[i].endDate) : ( typeof dataAction[i].endDate == "object" && dataAction[i].endDate != null ? coInterface.actions.convertirTimestampEnDate(dataAction[i].endDate['sec']) : ''); + if (typeof dataAction[i].status != "undefined" && dataAction[i].status == "done") { + let actionsItem = { + _id: dataAction[i].id, + id: dataAction[i].id + i, + instanceIdentity: dataAction[i].id, + title: '<b>' + dataAction[i].name + '</b>', + name: dataAction[i].name, + tags: (typeof dataAction[i].tags != 'undefined' ? dataAction[i].tags : []), + header: "done", + html: true, + canMoveCard: true, + actions: [ + { + 'icon': 'fa fa-trash', + 'bstooltip': { + 'text': "Supprimer l'action", + 'position': 'left' + }, + 'action': 'onRemoveAction' + }, + { + 'badge' : startDate + ' - ' + endDate, + } + ] + } + kanbanData.push(actionsItem) + } else if (typeof dataAction[i].tags != "undefined" && dataAction[i].tags.indexOf('totest') > -1) { + let actionsItem = { + _id: dataAction[i].id, + id: dataAction[i].id + i, + instanceIdentity: dataAction[i].id, + title: '<b>' + dataAction[i].name + '</b>', + name: dataAction[i].name, + tags: (typeof dataAction[i].tags != 'undefined' ? dataAction[i].tags : []), + header: "totest", + html: true, + canMoveCard: true, + actions: [ + { + 'icon': 'fa fa-trash', + 'bstooltip': { + 'text': "Supprimer l'action", + 'position': 'left' + }, + 'action': 'onRemoveAction' + }, + { + 'badge' : startDate + ' - ' + endDate, + } + ] + } + kanbanData.push(actionsItem) + } else if (typeof dataAction[i].tracking != "undefined" && (dataAction[i].tracking == true || dataAction[i].tracking == 'true')) { + let actionsItem = { + _id: dataAction[i].id, + id: dataAction[i].id + i, + instanceIdentity: dataAction[i].id, + title: '<b>' + dataAction[i].name + '</b>', + name: dataAction[i].name, + tags: (typeof dataAction[i].tags != 'undefined' ? dataAction[i].tags : []), + header: "tracking", + html: true, + canMoveCard: true, + actions: [ + { + 'icon': 'fa fa-trash', + 'bstooltip': { + 'text': "Supprimer l'action", + 'position': 'left' + }, + 'action': 'onRemoveAction' + }, + { + 'badge' : startDate + ' - ' + endDate, + } + ] + } + kanbanData.push(actionsItem) + } else if (typeof dataAction[i].tags != "undefined" && dataAction[i].tags.indexOf('discuter') > -1) { + let actionsItem = { + _id: dataAction[i].id, + id: dataAction[i].id + i, + instanceIdentity: dataAction[i].id, + title: '<b>' + dataAction[i].name + '</b>', + name: dataAction[i].name, + tags: (typeof dataAction[i].tags != 'undefined' ? dataAction[i].tags : []), + header: "discuss", + html: true, + canMoveCard: true, + actions: [ + { + 'icon': 'fa fa-trash', + 'bstooltip': { + 'text': "Supprimer l'action", + 'position': 'left' + }, + 'action': 'onRemoveAction' + }, + { + 'badge' : startDate + ' - ' + endDate, + } + ] + } + kanbanData.push(actionsItem) + } else if (typeof dataAction[i].tags != "undefined" && dataAction[i].tags.indexOf('next') > -1) { + let actionsItem = { + _id: dataAction[i].id, + id: dataAction[i].id + i, + instanceIdentity: dataAction[i].id, + title: '<b>' + dataAction[i].name + '</b>', + name: dataAction[i].name, + tags: (typeof dataAction[i].tags != 'undefined' ? dataAction[i].tags : []), + header: "next", + html: true, + canMoveCard: true, + actions: [ + { + 'icon': 'fa fa-trash', + 'bstooltip': { + 'text': "Supprimer l'action", + 'position': 'left' + }, + 'action': 'onRemoveAction' + }, + { + 'badge' : startDate + ' - ' + endDate, + } + ] + } + kanbanData.push(actionsItem) + } else if (typeof dataAction[i].status != "undefined" && dataAction[i].status == "todo") { + let actionsItem = { + _id: dataAction[i].id, + id: dataAction[i].id + i, + instanceIdentity: dataAction[i].id, + title: '<b>' + dataAction[i].name + '</b>', + name: dataAction[i].name, + tags: (typeof dataAction[i].tags != 'undefined' ? dataAction[i].tags : []), + header: "todo", + html: true, + canMoveCard: true, + actions: [ + { + 'icon': 'fa fa-trash', + 'bstooltip': { + 'text': "Supprimer l'action", + 'position': 'left' + }, + 'action': 'onRemoveAction' + }, + { + 'badge' : startDate + ' - ' + endDate, + } + ] + } + kanbanData.push(actionsItem) + } + } + + let kanbanDom = $('#kanbanActionContainer') + .kanban('destroy') + .kanban({ + headers: kanbanHeader, + data: kanbanData, + editable: false, + language: mainLanguage, + canAddCard: true, + editable: false, + canAddColumn: false, + canEditCard: false, + canEditHeader: true, + canMoveCard: true, + canMoveColumn: true, + readonlyHeaders: [], + copyWhenDragFrom: [], + endpoint: `${baseUrl}/plugins/kanban/`, + defaultColumnMenus: [''], + onRenderDone() { + + }, + onCardClick(action) { + mylog.log(action) + if (notEmpty(userConnected)) { + var self = $(this); + var actionModalDom = $('#corner-action-preview').empty().html(''); + if (typeof action.isClickable === 'undefined' || action.isClickable) { + action.isClickable = false; + $('*').css('cursor', 'wait'); + self.data('datum', action); + var url = baseUrl + '/costum/project/action/request/action_detail_html/mode/r'; + var id = action._id; + var post = { + id: id + }; + setTimeout(function() { + ajaxPost(null, url, post, function(html) { + actionModalDom.off('shown.bs.modal').on('shown.bs.modal', '.modal', function() { + action.isClickable = true; + self.data('datum', action); + }); + actionModalDom.html(html); + }, null, 'text'); + }); + } + } + }, + onRemoveAction: function(action, cardDom) { + $.confirm({ + title: trad['Archive'], + type: 'orange', + content: trad['Please confirm archiving'], + buttons: { + no: { + text: trad.no, + btnClass: 'btn btn-default' + }, + yes: { + text: trad.yes, + btnClass: 'btn btn-warning', + action: function() { + var params = { + id: action._id, + collection: 'actions', + path: 'status', + value: 'disabled' + }; + + dataHelper.path2Value(params, function(response) { + if (response.result) { + var index = kanbanDom.find(`[data-column=${action.header}] .kanban-list-card-detail`).index(cardDom); + kanbanDom.kanban('deleteData', { + column: action.header, + id: action.id + }); + toastr.success('Action archiver avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueOption); + } + } + } + }); + }, + onCardInsert: function (created) { + console.log('created', created) + created = $.extend({}, created); + var post = { + name: created.title, + status: created.header, + parentId: projectId, + parentType: 'projects', + component: 'kanban', + server_url: baseUrl + }; + if (wsCO && wsCO.id) + post.emiter = wsCO.id; + coInterface.actions.request_create_action(post).then(function (response) { + if (response.success) { + mylog.log('new action', response) + if(linkAction == 'mine') { + var updateCOntrib = { + id : response.data._id.$id, + collection : 'actions', + path : 'links.contributors.'+userConnected._id.$id, + value : {"type" : "citoyens", "isAdmin" : true} + } + dataHelper.path2Value(updateCOntrib, function(resp) { + if (resp.result) { + + } + }); + + } + // send create notification + var id_at_kanban = created.id; + created.id = response.data._id.$id; + created._id = response.data._id.$id; + created.actions = [{ + icon: 'fa fa-trash', + bstooltip: { text: trad.delete, position: 'top' }, + action: 'onRemoveAction', + bstooltip: { text: trad['Archive'], position: 'top' } + }, + { + 'badge' : coInterface.actions.convertirTimestampEnDate(response.data.created)+' - ' + } + ]; + $('#kanbanActionContainer').kanban('setData', { column: created.header, id: id_at_kanban, data: created }); + coInterface.actions.update_action_position({ + action: created.id, + group: created.header, + emiter: wsCO && wsCO.id ? wsCO.id : null, + component: 'kanban', + server_url: baseUrl + }).then(); + } + else + toastr.error(coTranslate(response.data)); + }).catch(function (error) { + if (error && error.data) + toastr.error(coTranslate(error.data)); + else + mylog.error(error); + }); + }, + onCardDrop(dropped, updates) { + if (dropped.origin != dropped.target) { + let path2ValueUrl = {}; + path2ValueUrl.url = urlBase; + let actionObjet = { + id: dropped.data.instanceIdentity, + collection: 'actions', + }; + let resetObjet = { + id: dropped.data.instanceIdentity, + collection: 'actions', + }; + if (typeof dropped.target != 'undefined' && dropped.target == 'tracking' && typeof dropped.origin != 'undefined' && dropped.origin == 'done') { + actionObjet['value'] = 'true' + actionObjet['path'] = 'tracking' + actionObjet['setType'] = 'boolean' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + resetObjet['value'] = 'todo' + resetObjet['path'] = 'status' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'tracking' && typeof dropped.origin != 'undefined' && dropped.origin == 'totest') { + actionObjet['value'] = 'true' + actionObjet['path'] = 'tracking' + actionObjet['setType'] = 'boolean' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + let index = dropped.data.tags.indexOf('totest') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'tracking' && typeof dropped.origin != 'undefined' && dropped.origin == 'next') { + actionObjet['value'] = 'true' + actionObjet['path'] = 'tracking' + actionObjet['setType'] = 'boolean' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('next') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'tracking' && typeof dropped.origin != 'undefined' && dropped.origin == 'discuss') { + actionObjet['value'] = 'true' + actionObjet['path'] = 'tracking' + actionObjet['setType'] = 'boolean' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + let index = dropped.data.tags.indexOf('discuter') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'tracking') { + actionObjet['value'] = 'true' + actionObjet['path'] = 'tracking' + actionObjet['setType'] = 'boolean' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes'); + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'totest' && typeof dropped.origin != 'undefined' && dropped.origin == 'done') { + dropped.data.tags.push('totest') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + resetObjet['value'] = 'todo' + resetObjet['path'] = 'status' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'totest' && typeof dropped.origin != 'undefined' && dropped.origin == 'discuss') { + dropped.data.tags.push('totest') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('discuter') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'totest' && typeof dropped.origin != 'undefined' && dropped.origin == 'next') { + dropped.data.tags.push('totest') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('next') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'totest' && typeof dropped.origin != 'undefined' && dropped.origin == 'tracking') { + dropped.data.tags.push('totest') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + resetObjet['value'] = 'false' + resetObjet['path'] = 'tracking' + resetObjet['setType'] = 'boolean' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'totest') { + dropped.data.tags.push('totest') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes'); + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'next' && typeof dropped.origin != 'undefined' && dropped.origin == 'done') { + dropped.data.tags.push('next') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + resetObjet['value'] = 'todo' + resetObjet['path'] = 'status' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'next' && typeof dropped.origin != 'undefined' && dropped.origin == 'discuss') { + dropped.data.tags.push('next') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('discuter') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'next' && typeof dropped.origin != 'undefined' && dropped.origin == 'totest') { + dropped.data.tags.push('next') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('totest') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'next' && typeof dropped.origin != 'undefined' && dropped.origin == 'tracking') { + dropped.data.tags.push('next') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + resetObjet['value'] = 'false' + resetObjet['path'] = 'tracking' + resetObjet['setType'] = 'boolean' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'next') { + dropped.data.tags.push('next') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes'); + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'discuss' && typeof dropped.origin != 'undefined' && dropped.origin == 'done') { + dropped.data.tags.push('discuter') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + resetObjet['value'] = 'todo' + resetObjet['path'] = 'status' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'discuss' && typeof dropped.origin != 'undefined' && dropped.origin == 'tracking') { + dropped.data.tags.push('discuter') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + resetObjet['value'] = 'false' + resetObjet['path'] = 'tracking' + resetObjet['setType'] = 'boolean' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'discuss' && typeof dropped.origin != 'undefined' && dropped.origin == 'totest') { + dropped.data.tags.push('discuter') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('totest') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'discuss' && typeof dropped.origin != 'undefined' && dropped.origin == 'next') { + dropped.data.tags.push('discuter') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('next') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'discuss') { + dropped.data.tags.push('discuter') + actionObjet['value'] = dropped.data.tags + actionObjet['path'] = 'tags' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes'); + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'done' && typeof dropped.origin != 'undefined' && dropped.origin == 'totest') { + actionObjet['value'] = 'done' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('totest') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'done' && typeof dropped.origin != 'undefined' && dropped.origin == 'discuss') { + actionObjet['value'] = 'done' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('discuter') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'done' && typeof dropped.origin != 'undefined' && dropped.origin == 'next') { + actionObjet['value'] = 'done' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('next') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'done' && typeof dropped.origin != 'undefined' && dropped.origin == 'tracking') { + actionObjet['value'] = 'done' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes'); + } + }, path2ValueUrl); + + resetObjet['value'] = 'false' + resetObjet['path'] = 'tracking' + resetObjet['setType'] = 'boolean' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'done') { + actionObjet['value'] = 'done' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + + } else if (typeof dropped.target != 'undefined' && dropped.target == 'todo' && typeof dropped.origin != 'undefined' && dropped.origin == 'totest') { + actionObjet['value'] = 'todo' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('totest') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'todo' && typeof dropped.origin != 'undefined' && dropped.origin == 'discuss') { + actionObjet['value'] = 'todo' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('discuter') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'todo' && typeof dropped.origin != 'undefined' && dropped.origin == 'next') { + actionObjet['value'] = 'todo' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + let index = dropped.data.tags.indexOf('next') + dropped.data.tags.splice(index, 1) + resetObjet['value'] = dropped.data.tags + resetObjet['path'] = 'tags' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'todo' && typeof dropped.origin != 'undefined' && dropped.origin == 'tracking') { + actionObjet['value'] = 'todo' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + + resetObjet['value'] = 'false' + resetObjet['path'] = 'tracking' + resetObjet['setType'] = 'boolean' + dataHelper.path2Value(resetObjet, function(resp) { + if (resp['result']) { + + } + }, path2ValueUrl); + } else if (typeof dropped.target != 'undefined' && dropped.target == 'todo') { + actionObjet['value'] = 'todo' + actionObjet['path'] = 'status' + dataHelper.path2Value(actionObjet, function(resp) { + if (resp['result']) { + toastr.success('Action deplacer avec succes', { + closeButton: true, + preventDuplicates: true, + timeOut: 3000 + }); + } + }, path2ValueUrl); + } + mylog.log(dropped, updates, 'data drop') + } + } + }) + $('#modalKanbanAction').modal('show') + let htm = `<button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>` + $('#modalKanbanAction .modal-footer').html(htm) + }, get_action_status: function (action) { var has_tags = action && action.tags && Array.isArray(action.tags); var status = typeof action.status === 'string' ? action.status : ''; -- GitLab