From 467f549afcf7cfdbd4ac488d27b814f1ef1b6306 Mon Sep 17 00:00:00 2001 From: mokaddem Date: Wed, 23 Jun 2021 11:16:13 +0200 Subject: [PATCH] chg: [genericTemplate:delete] Support of single and bulk delete operations --- templates/genericTemplates/delete.php | 70 ++++++++++++--------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/templates/genericTemplates/delete.php b/templates/genericTemplates/delete.php index 6b07d6a..f2b7449 100644 --- a/templates/genericTemplates/delete.php +++ b/templates/genericTemplates/delete.php @@ -1,39 +1,31 @@ - - +element('genericElements/Form/genericForm', [ + 'entity' => null, + 'ajax' => false, + 'raw' => true, + 'data' => [ + 'fields' => [ + [ + 'type' => 'text', + 'field' => 'ids', + 'default' => !empty($id) ? json_encode([$id]) : '' + ] + ], + 'submit' => [ + 'action' => $this->request->getParam('action') + ] + ] +]); +$formHTML = sprintf('
%s
', $form); + +$bodyMessage = !empty($deletionText) ? __($deletionText) : __('Are you sure you want to delete {0} #{1}?', h(Cake\Utility\Inflector::singularize($this->request->getParam('controller'))), h($id)); +$bodyHTML = sprintf('%s%s', $formHTML, $bodyMessage); + +echo $this->Bootstrap->modal([ + 'size' => 'lg', + 'title' => !empty($deletionTitle) ? $deletionTitle : __('Delete {0}', h(Cake\Utility\Inflector::singularize(Cake\Utility\Inflector::humanize($this->request->getParam('controller'))))), + 'type' => 'confirm-danger', + 'confirmText' => !empty($deletionConfirm) ? $deletionConfirm : __('Delete'), + 'bodyHtml' => $bodyHTML, +]); +?>