2019-11-16 10:21:14 +03:00
|
|
|
@stack('bulk_action_row_input_start')
|
2020-02-14 11:36:47 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
@php
|
|
|
|
if (is_array($path)) {
|
|
|
|
$path = route('bulk-actions.action', $path);
|
|
|
|
} else {
|
|
|
|
$path = url('common/bulk-actions/' . $path);
|
2020-02-14 11:36:47 +03:00
|
|
|
}
|
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
$actions_to_show = [];
|
|
|
|
foreach ($actions as $key => $action) {
|
|
|
|
if ((isset($action['permission']) && !user()->can($action['permission']))) {
|
|
|
|
continue;
|
|
|
|
}
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
$actions_to_show[$key] = true;
|
|
|
|
}
|
|
|
|
@endphp
|
|
|
|
|
|
|
|
@if(!empty($actions_to_show))
|
2020-12-25 15:53:38 +03:00
|
|
|
<div class="align-items-center d-none mt-2"
|
2020-03-19 22:57:28 +03:00
|
|
|
v-if="bulk_action.show"
|
|
|
|
:class="[{'show': bulk_action.show}]">
|
|
|
|
<div class="mr-6">
|
|
|
|
<span class="text-white d-none d-sm-block">
|
|
|
|
<b v-text="bulk_action.count"></b>
|
|
|
|
<span v-if="bulk_action.count === 1">
|
|
|
|
{{ strtolower(trans_choice($text, 1)) }}
|
|
|
|
</span>
|
|
|
|
<span v-else-if="bulk_action.count > 1">
|
|
|
|
{{ strtolower(trans_choice($text, 2)) }}
|
|
|
|
</span>
|
|
|
|
{{ trans('bulk_actions.selected') }}
|
2020-02-01 13:32:43 +03:00
|
|
|
</span>
|
2020-03-19 22:57:28 +03:00
|
|
|
</div>
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
<div class="w-25 mr-4" v-if="bulk_action.count">
|
|
|
|
<div class="form-group mb-0">
|
|
|
|
<select
|
|
|
|
class="form-control form-control-sm"
|
|
|
|
v-model="{{ !empty($attributes['v-model']) ? $attributes['v-model'] : 'bulk_action.value' }}"
|
|
|
|
@change="onChange">
|
|
|
|
<option value="*">{{ trans_choice('bulk_actions.bulk_actions', 2) }}</option>
|
|
|
|
@foreach($actions as $key => $action)
|
|
|
|
@if(isset($actions_to_show[$key]))
|
|
|
|
<option
|
|
|
|
value="{{ $key }}"
|
|
|
|
@if(!empty($action['message']))
|
2021-06-20 15:38:48 +03:00
|
|
|
data-message="{{ trans_choice($action['message'], 2, ['type' => strtolower(trans_choice($text, 2))]) }}"
|
2020-03-19 22:57:28 +03:00
|
|
|
@endif
|
2020-09-22 00:37:00 +03:00
|
|
|
@if(isset($action['path']) && !empty($action['path']))
|
|
|
|
data-path="{{ route('bulk-actions.action', $action['path']) }}"
|
|
|
|
@else
|
|
|
|
data-path=""
|
|
|
|
@endif
|
|
|
|
@if(isset($action['type']) && !empty($action['type']))
|
|
|
|
data-type="{{ $action['type'] }}"
|
|
|
|
@else
|
|
|
|
data-type=""
|
|
|
|
@endif
|
2020-03-19 22:57:28 +03:00
|
|
|
>{{ trans($action['name']) }}</option>
|
|
|
|
@endif
|
|
|
|
@endforeach
|
|
|
|
</select>
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
<input type="hidden" name="bulk_action_path" value="{{ $path }}" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-11-16 10:21:14 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
<div class="mr-4" v-if="bulk_action.count">
|
|
|
|
<button type="button" class="btn btn-sm btn-outline-confirm"
|
|
|
|
:disabled="bulk_action.value == '*'"
|
|
|
|
v-if="bulk_action.message.length"
|
|
|
|
@click="bulk_action.modal=true">
|
|
|
|
<span>{{ trans('general.confirm') }}</span>
|
|
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-sm btn-outline-confirm"
|
|
|
|
:disabled="bulk_action.value == '*'"
|
|
|
|
v-if="!bulk_action.message.length"
|
|
|
|
@click="onAction">
|
|
|
|
<span>{{ trans('general.confirm') }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
2020-02-01 13:32:43 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
<div class="mr-4" v-if="bulk_action.count">
|
|
|
|
<button type="button" class="btn btn-outline-clear btn-sm"
|
|
|
|
@click="onClear">
|
|
|
|
<span>{{ trans('general.clear') }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-01 13:32:43 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
<akaunting-modal
|
|
|
|
:show="bulk_action.modal"
|
2021-06-02 18:09:24 +03:00
|
|
|
:title="`{{ trans_choice($text, 2) }}`"
|
2020-03-19 22:57:28 +03:00
|
|
|
:message="bulk_action.message"
|
|
|
|
@cancel="onCancel"
|
|
|
|
v-if='bulk_action.message && bulk_action.modal'>
|
|
|
|
<template #card-footer>
|
|
|
|
<div class="float-right">
|
|
|
|
<button type="button" class="btn btn-outline-secondary" @click="onCancel">
|
|
|
|
<span>{{ trans('general.cancel') }}</span>
|
|
|
|
</button>
|
2020-02-01 13:32:43 +03:00
|
|
|
|
2020-03-19 22:57:28 +03:00
|
|
|
<button :disabled="bulk_action.loading" type="button" class="btn btn-success button-submit" @click="onAction">
|
|
|
|
<div class="aka-loader d-none"></div>
|
|
|
|
<span>{{ trans('general.confirm') }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</akaunting-modal>
|
|
|
|
@else
|
2020-12-24 01:28:38 +03:00
|
|
|
<div class="text-white d-none" :class="[{'show': bulk_action.show}]">{{ trans('bulk_actions.no_action') }}</div>
|
2020-03-19 22:57:28 +03:00
|
|
|
@endif
|
2019-11-16 10:21:14 +03:00
|
|
|
|
|
|
|
@stack('bulk_action_row_input_end')
|