var items = {};
var confirm = $($trigger).data('context-confirm');
var disabledOption = $($trigger).data('context-disabled-action');
+ var callbackFunc = $($trigger).data('context-callback')
var actions = {};
$.each(rawActions, function (key, action) {
- console.log(action);
if (action != sep) {
if (typeof action === 'string') {
action = {'label': action};
action.disabled = action.disabled || (key == disabledOption);
action.isHtmlName = true;
}
- actions[key+""] = action;
+ actions[key + ""] = action;
});
$.each(actions, function (key, action) {
if (action !== sep) {
- items[key+""] = {name: action.label, isHtmlName: action.isHtmlName, disabled: action.disabled,};
+ items[key + ""] = {name: action.label, isHtmlName: action.isHtmlName, disabled: action.disabled,};
} else {
- items[key+""] = action;
+ items[key + ""] = action;
}
});
return {
callback: function (key, options) {
+ if (callbackFunc !== undefined && callbackFunc !== null) {
+ if (!window[callbackFunc]($($trigger), key)) {
+ return false;
+ }
+ }
+
var ok = function () {
var target = actions[key].target;
var url = actions[key].url;
@can('fluidbook-publication:admin')
@if($entry->allowsEdit())
<span data-{{$entry->getOption('name')}}-{{$column['name']}}="{{$values}}">
- <a href="#"
- data-toggle="tooltip"
- data-context-disabled-action="{{$values}}"
- data-context-actions="{{json_encode($column['options'])}}"
- data-context-route="{{$crud->route}}/$id/changestatus/$action"
- data-context-id="{{$entry->getKey()}}"
- title="{{__('Changer le status')}}"
- >{{$v}}</a>
+ <a href="#"
+ data-toggle="tooltip"
+ data-context-disabled-action="{{$values}}"
+ data-context-actions="{{json_encode($column['options'])}}"
+ data-context-route="{{$crud->route}}/$id/changestatus/$action"
+ data-context-id="{{$entry->getKey()}}"
+ data-context-callback="statusCallback"
+ title="{{__('Changer le status')}}"
+ >{{$v}}</a>
@else
+ {{$v}}
+ @endif
+</span>
+ @endcan
+
+ @cannot('fluidbook-publication:admin')
{{$v}}
+ @endcannot
+
+
+
+ @if(!isset($crud->seenStatusChange))
+ @php
+ $crud->seenStatusChange=true;
+
+ @endphp
+ <style>
+
+ </style>
+ <script>
+ function statusCallback(element, value) {
+ if (value < 3) {
+ return true;
+ }
+
+
+ }
+ </script>
@endif
-</span>
-@endcan
-@cannot('fluidbook-publication:admin')
- {{$v}}
-@endcannot
{{-- __('!! Paramètres des fluidbooks') --}}
@if($entry->status<3 && $entry->status>0 && $entry->canAdmin(backpack_user()))
+ @if(!isset($crud->seenInvoice))
+ @php
+ $crud->seenInvoice=true;
+ // $crud->ajaxOwnerList=\Cubist\Backpack\Magic\Fields\SelectFromArray::hashOptions($column['options']);
+ @endphp
+ <style>
+ .select2-dropdown {
+ z-index: 10000;
+ }
+ </style>
+ <script>
+ $(function () {
+ console.log(':))');
+ $(document).on('click', "a.invoice", function () {
+ console.log(':)');
+ var a = $(this);
+ Swal.fire({
+ title: '{{__('Facturer')}}',
+ html: $(a).closest('span').find('.invoice_container').html(),
+ confirmButtonColor: '#467fcf',
+ confirmButtonText: '{{__('Valider')}}',
+ showCancelButton: true,
+ cancelButtonText: '{{__('Annuler')}}',
+ cancelButtonColor: '#f1ecec',
+ cancelButtonTextColor: '#000000',
+ focusConfirm: false,
+ didOpen: function () {
+ let select = $(Swal.getHtmlContainer()).find('select');
+ $(select).select2({
+ theme: 'bootstrap',
+ ajax: {
+ url: '{{backpack_url('select2')}}' + '/' + $(select).data('ajax'),
+ dataType: 'json'
+ },
+ escapeMarkup: function (m) {
+ return m;
+ }
+ });
+ },
+ didDestroy: function () {
+ let select = $(Swal.getHtmlContainer()).find('select');
+ $(select).select2('destroy');
+ },
+ }).then((result) => {
+ if (result.isConfirmed) {
+ let select = $(Swal.getHtmlContainer()).find('select');
+ window.location = '{{backpack_url($entry->getOption('name'))}}/' + $(a).data('entry-id') + '/invoice/' + select.val();
+ }
+ });
+ return false;
+ });
+ });
+
+ </script>
+ @endif
+
+ <div class="invoice_container" style="display: none;">
+ <select
+ style="width: 100%;"
+ name="projects_list"
+ data-ajax="{{$crud->ajaxOwnerList}}"
+ >
+ </select>
+ </div>
<a class="btn btn-sm btn-link" class="invoice" href="#"
data-toggle="tooltip"
title="{{__('Facturer')}}"><i class="las la-money-check-alt"></i> {{__('Facturer')}}
</a>
@endif
-
-
-@if(!isset($crud->seenInvoice))
- @php
- $crud->seenInvoice=true;
- // $crud->ajaxOwnerList=\Cubist\Backpack\Magic\Fields\SelectFromArray::hashOptions($column['options']);
- @endphp
- <style>
- .select2-dropdown {
- z-index: 10000;
- }
- </style>
- <script>
- $(document).on('click', ".invoice", function () {
- var a = $(this);
- Swal.fire({
- title: '{{__('Facturer')}}',
- html: $(a).closest('span').find('.invoice_container').html(),
- confirmButtonColor: '#467fcf',
- confirmButtonText: '{{__('Valider')}}',
- showCancelButton: true,
- cancelButtonText: '{{__('Annuler')}}',
- cancelButtonColor: '#f1ecec',
- cancelButtonTextColor: '#000000',
- focusConfirm: false,
- didOpen: function () {
- let select = $(Swal.getHtmlContainer()).find('select');
- $(select).select2({
- theme: 'bootstrap',
- ajax: {
- url: '{{backpack_url('select2')}}' + '/' + $(select).data('ajax'),
- dataType: 'json'
- },
- escapeMarkup: function (m) {
- return m;
- }
- });
- },
- didDestroy: function () {
- let select = $(Swal.getHtmlContainer()).find('select');
- $(select).select2('destroy');
- },
- }).then((result) => {
- if (result.isConfirmed) {
- let select = $(Swal.getHtmlContainer()).find('select');
- window.location = '{{backpack_url($entry->getOption('name'))}}/' + $(a).data('entry-id') + '/invoice/' + select.val();
- }
- });
- return false;
- });
- </script>
-@endif