From 50d12767b04f0f84cc4d179495418a7df976b3d8 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 16 Jun 2021 01:25:53 -0700 Subject: [PATCH] msgtplui - Edit - Skeletal action buttons --- ext/msgtplui/ang/msgtplui/Edit.html | 51 ++++------------------------- ext/msgtplui/ang/msgtplui/Edit.js | 21 ++++++++++-- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/ext/msgtplui/ang/msgtplui/Edit.html b/ext/msgtplui/ang/msgtplui/Edit.html index c2ab16046d..40cf404524 100644 --- a/ext/msgtplui/ang/msgtplui/Edit.html +++ b/ext/msgtplui/ang/msgtplui/Edit.html @@ -40,51 +40,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ + + +
- - - - +
- + diff --git a/ext/msgtplui/ang/msgtplui/Edit.js b/ext/msgtplui/ang/msgtplui/Edit.js index 6eaa5d56df..72cde71307 100644 --- a/ext/msgtplui/ang/msgtplui/Edit.js +++ b/ext/msgtplui/ang/msgtplui/Edit.js @@ -67,7 +67,6 @@ }]; } - console.log('requests', requests); return crmStatus({start: ts('Loading...'), success: ''}, crmApi4(requests).then(mergeTranslations).then(pickFirsts)); } } @@ -75,7 +74,8 @@ } ); - angular.module('msgtplui').controller('MsgtpluiEdit', function($scope, crmApi, crmStatus, crmUiHelp, $location, prefetch) { + angular.module('msgtplui').controller('MsgtpluiEdit', function($scope, crmApi4, crmBlocker, crmStatus, crmUiAlert, crmUiHelp, $location, prefetch) { + var block = $scope.block = crmBlocker(); var ts = $scope.ts = CRM.ts('msgtplui'); var hs = $scope.hs = crmUiHelp({file: 'CRM/msgtplui/Edit'}); // See: templates/CRM/msgtplui/Edit.hlp var ctrl = this; @@ -87,8 +87,25 @@ ctrl.tab = args.status === 'draft' ? 'txDraft' : 'txActive'; } else { + ctrl.lang = null; ctrl.tab = 'main'; } + + ctrl.allowDelete = function() { + return !!ctrl.lang; + }; + + ctrl.save = function save() { + var p = crmApi4('Contact', 'get', {limit: 1}); // TODO + return block(crmStatus({start: ts('TODO-ing...'), success: ts('TODO-ed')}, p)); + }; + ctrl.cancel = function() { + window.location = '#/workflow'; + }; + ctrl.delete = function() { + var p = crmApi4('Contact', 'get', {limit: 1}); // TODO + return block(crmStatus({start: ts('TODO-ing...'), success: ts('TODO-ed')}, p)); + }; }); })(angular, CRM.$, CRM._); -- 2.25.1